DMD 1.011 release

Bill Baxter dnewsgroup at billbaxter.com
Wed Apr 11 14:14:58 PDT 2007


Sean Kelly wrote:
> freeagle wrote:
>> Walter Bright wrote:
>>> Bug fixes, some enhancements.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>>
>>> http://ftp.digitalmars.com/dmd.1.011.zip
>>
>> what was wrong with "inout" ?
> 
> Got me.  in, out, and inout are already present in other languages (Ada 
> and CORBA, IIRC), and the names seem internally consistent.  I can't say 
> I understand the reason for a new keyword here.

The problem is just that 'const inout' doesn't make any sense.  There's 
no 'out' about it if the thing is const.  'const ref' doesn't have that 
issue.

Another solution to the 'const inout' conundrum might be to add 'in ref' 
or 'ref in'.  I kinda like that.  But I think 'in ref' would basically 
have to be declared a synonym for 'const ref'.  Having synonyms like 
that is not so great.  But I for one would rather declare my parameters 
as 'in ref' than 'const ref' if for no other reason than it's 3 letters 
shorter. :-)   But it also seems to go better with in and out, which I 
presume aren't going away.

Actually, y'know using a single word looks so much better to me than two 
for paramters:

    vector add(inref vector b, inref vector b) { . . . }
vs
    vector add(const ref vector b, const ref vector b) { . . . }

Somehow going from 3 word parameters to 4 word paramters seems to make 
it much less readable to me.

I also feel like we're headed for a paramter system with a personality 
disorder that can't decide if it wants to describe the intent 
(in,out,inout) or the concrete implementation (ref,const).  The problem 
is there are really 4 cases that matter, and one of them really requires 
that you specify an implementation detail.  I guess to me something like 
(in,out,inout,inref) looks cleaner than (in,out,ref,const ref).

--bb



More information about the Digitalmars-d-announce mailing list