DMD 1.011 release

Sean Kelly sean at f4.ca
Mon Apr 16 12:23:41 PDT 2007


Bill Baxter wrote:
> 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.

I suppose it's a matter of interpretation.  To me, 'inout' suggests that 
the parameter *may* be modified, not that it *will* be.  If the type 
passed is const, then that type simply doesn't support the possibility 
for modification allowed by 'inout'.  So long as the compiler can handle 
this via analysis (ensure that const parameters are not modified despite 
the 'inout' qualifier) then great.

> 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.

I was unaware that Walter was considering a reference qualifier for more 
general use.  If that's the case, then 'ref' may indeed make sense.  If 
not, I don't see any reason to to simply have 'inout'.

> 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).

Agreed.  I like 'in', 'out', and 'inout' becuse they're internally 
consistent.  'ref' seems like the odd man out.  Assuming 'inout' isn't 
deprecated, I will continue to use 'inout' for function parameters, and 
'ref' in some other situations, as the design warrants.  Though I'll 
admit that I hate having multiple keywords for the same thing.


Sean



More information about the Digitalmars-d-announce mailing list