DMD 0.177 release

Charles D Hixson charleshixsn at earthlink.net
Thu Dec 21 12:07:28 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?
> 
> I can see how it'd be an interesting trick, and I can appreciate the 
> experimental curiosity about how the language (and the implementation) 
> should cope with the explicit handling of lvalues.
> 
> But I can't think of a real-world use case.
> 
> Are there languages where this is currently possible? How do they 
> implement it? And, much more importantly, what do people use it for?
> 
> --benji
FWIW,
In PL/1 the substring function could be used as an lvalue. 
(Analogously, in D one can use array slices as lvalues.)

I can't remember whether PL/1 allowed one to use this feature 
to delete characters, or only to alter them, but in Python one 
can use this feature to delete characters (or replace them 
with something that isn't a character?).




More information about the Digitalmars-d-announce mailing list