DMD 0.177 release

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Dec 20 13:27:56 PST 2006


Benji Smith wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Let me illustrate further why ident is important and what solution we 
>> should have for it. Consider C's response to ident:
>>
>> #define IDENT(e) (e)
>>
>  > ...
>  >
>> ...leading to the following implementation of ident:
>>
>> auto ident(auto x) {
>>   return x;
>> }
> 
> I don't get it.
> 
> Why is it necessary (or even desirable) for functions to return lvalues?

For functions, I essentially agree.  There aren't many use cases for it, and for the few 
niche ones a pointer will often suffice.  But for methods of classes on the other hand, it 
can be valuable at times.

> Are there languages where this is currently possible?

C++, by returning a referance.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list