473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Named argument view for IDE and more

I've seen lots of discussions on the proposed inclusion of "function
call with named arguments" to C/C++ on these newsgroups. My proposal
is slightly different in that:

* No ANSI approval is needed
* No conflicts with existing language features such as function
overloading
* No need to modify the language spec or the compiler
* No need to modify your source code

As you may have guessed, I think it possible to make this a feature of
the IDE.

A first thought was to keep the argument order as specified by the
function declaration, but allow the editing and viewing of function
arguments in a named manner. That is to say, the argument list is
displayed as a closeable table immediately after every function call.
The table include argument names and fields where you can view or fill
the value or expression for each argument. But the tables are just
visual effects of the code editor window, and the source code is
stored in the original format in memory and on disk.

If you also want customized argument order, the order information can
be saved by the IDE as special comments in the source file, or as a
seperate non-source file included by your project file.

Another idea of mine is also about programming language design,
although a bit theoretical. It's about a freer syntax. The idea comes
from my research on controlled language design and translation (the
BabelCode methodology); controlled natural languages and programming
languages have something in common that is they're both formal
languages. We know modern programming language design is evolving
toward a goal of "programming like speaking a natural language"; OOP
has unleashed the most of the semantic potential of programming
languages, but the syntactic freedom still has room to improve.

A typical C function call (enhanced by the "named argument" feature)
is like this:

myfunc(arg1 value1, arg2 value2, ...);

Compared to English syntax, myfunc is like the main verb of a
sentence, and argvalues are the subject, the objects (dierct and
indirect, argument name omitted unless in passive voice),
prepositional phrases (argument names are the preposition, values are
the prepositional objects), adverbials (presence of argument name is a
flag delivering a boolean value) and nonfinite verb phrases (passing
function pointers). This is like the freeform case-based natural
languages such as Russian and German. In OOP programming languages
like C++, the "subject" or "object" argument is isolated and put
before the "main verb", the other arguments being remained in the
argument list:

subject.myfunc(arg2 value2, arg3 value3, ...);

This way it's more like how we form a natural language sentence. But
note that this is only in favor of English-like syntax. Many natural
languages even including English prefer to place some prepostional
phrases before the main verb. The Chinese language prefer:

subject.(arg2 value2, arg3, value3, ..., myfunc objvalue, ...);

Russian and German prefer the "good old C function call" style:

.(arg2 value2, subjvalue, arg3 value3, myfunc, ..., OBJ objvalue,
....);

What's worse, many Chinese monolingual speakers can't distinguish the
v.t. part-of-speech from the prep part-of-speech. In their eyes, these
are both "relational words with an object and belonging to a
predicate" so they're likely to take a PP (viewed from English) such
as "with" for the main verb. This makes me to try break the POS
difference between prep and vt and treat them as equal entities. So
Chinese speakers may prefer this syntax:

subject.argx(valuex, arg1 value1, arg2 value2, ..., myfunc objvalue,
....);

Some programming languages are promoting the idea of "everything is an
object", and here "argument names" also become objects, at least with
equal syntactic status to that of the function name.

The above discussion shows that:

1. The SUBJECT argument may not necessarily come first;
2. Virtually any argument can play the role of "main verb" (function
name);
3. There may not necessarily be a distinct place for "main verb", in
languages that sometimes don't distinguish verbs from preps.
4. The order of arguments should be able to vary.

Handling such function call syntax is technically possible as long as
the real "main verb" identifier can be found.

Although this syntatic freedom is more significant to my controlled
language authoring and translation project, it does have some use in
programming languages. Take an example from the C library function
memcpy:

void *memcpy(
void *dest,
const void *src,
size_t count
);

We would be able to call it in these ways:

memcpy(to p2; from p1; amount count); // the original order
memcpy(amount count; from p1; to p2); // the english order
(from p1; memcpy amout count; to p2); // the chinese order
....

Yao Ziyuan
Nov 14 '05 #1
5 1677
Booted Cat <co********@hotmail.com> spoke thus:
* No ANSI approval is needed
If it isn't ANSI(/ISO)-approved, it isn't standard and isn't discussed
here. If you're suggesting additions to the Standard, take them to
comp.std.c.
* No conflicts with existing language features such as function
overloading
You posted this to comp.lang.c. C doesn't have function overloading.
* No need to modify the language spec or the compiler
Then how are you going to support this feature? Magic?
As you may have guessed, I think it possible to make this a feature of
the IDE.


IDE? Surely you jest.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
In article <news:7a**************************@posting.google. com>
Booted Cat <co********@hotmail.com> writes:

[a bunch of interesting stuff, but alas, all -- or almost all --
off-topic in comp.lang.c.]

This really belongs over in comp.programming.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Nov 14 '05 #3
Booted Cat wrote:
I've seen lots of discussions on the proposed inclusion of "function
call with named arguments" to C/C++ on these newsgroups.
No you haven't. We discuss only the actually existing language, C, not
some fiction in your head called C/C++. Anything you assert about "lots
of discussion ... of C/C++" is, on its face, a lie.
My proposal
is slightly different in that:


Who the hell cares?

Nov 14 '05 #4
Your post is very interesting.
I am working in exactly a similar solution to the problem
of type composition in C.

To implement type composition I have developed an IDE based solution first.

jacob

http://www.cs.virginia.edu/~lcc-win32
Nov 14 '05 #5
Hi,

I have tried your IDE. I only found that it could prompt me the
argument list as a tooltip (Visual C++ IDE also implemented this).
What i proposed as my first idea was viewing and editing named
arguments in graphical tables which are visually "embedded" in the
code editor window. Like this:

r = myfunc(
-------------------------------------
| argname1: ____argvalue1 here____ |
| argname2: ____argvalue2 here____ |
| argname3: ____argvalue3 here____ |
| ... |
-------------------------------------
)

Each argname leads a field where the programmer can edit the argument
expression.

Best Regards,
Yao
"jacob navia" <ja***@jacob.remcomp.fr> wrote in message news:<c6**********@news-reader5.wanadoo.fr>...
Your post is very interesting.
I am working in exactly a similar solution to the problem
of type composition in C.

To implement type composition I have developed an IDE based solution first.

jacob

http://www.cs.virginia.edu/~lcc-win32

Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
1
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
48
by: Adam Ruth | last post by:
Hello, Has there ever been any talk to adding named parameters to C? I enjoy using them in my Python and Ada code and can see their usefulness in C. I can envision an implementation where the...
17
by: Ben R. | last post by:
I'm reading about attribute classes and specifically, named versus positional parameters. Was this implimented instead of multiple constructors for flexibility or is there another reason I'm...
8
by: Paddy | last post by:
Proposal: Named RE variables ====================== The problem I have is that I am writing a 'good-enough' verilog tag extractor as a long regular expression (with the 'x' flag for...
7
by: Roman Susi | last post by:
Hi! it is interesting that I found this syntax error: File "<stdin>", line 1 str('sdfd', **a,) ^ SyntaxError: invalid syntax
36
by: Pacific Fox | last post by:
Hi all, haven't posted to this group before, but got an issue I can't work out... and hoping to get some help here ;-) I've got a base object that works fine with named arguments when called...
2
ADezii
by: ADezii | last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.