Do we really need const?

Bill Baxter dnewsgroup at billbaxter.com
Mon Sep 17 15:34:01 PDT 2007


Regan Heath wrote:
> renoX wrote:
>> Bruce Adams a écrit :
>>> An example of one that catches me out quite often is:
>>> strcpy(src,dest) vs. strcpy(dest,src);
>>
>> If it helps you'not the only one to have this kind of issue: some 
>> compilers even try to detect when people makes mistakes for 'memset'?
>> Both case show why function calls with passing the parameter by 
>> position instead of by keywords *sucks*.
>>
>> Let's try it: do you think you would make the same mistake if you 
>> would call your function this way:
>> char[50] var_dest, my_src;
>> strcpy(dest: var_dest, src: my_src)
> 
> My eyes... aaarghh!

Is it the particular syntax or the concept you object to?  I think 
named/keyword parameters can be quite useful.  Have you ever used a 
language that has them?

I think the problem with putting them into D is only that it becomes yet 
another way to do things.  We already have all the flavors of 
overloading inherited from C++.

--bb



More information about the Digitalmars-d mailing list