byval keyword to make objects act as value types

Christopher Wright dhasenan at gmail.com
Sun Dec 23 10:11:25 PST 2007


BC wrote:
> true, it's just that I don't buy that classes are always either value or
> reference types, I think flexibility is desirable. you could still do
> 
> class Foo{}
> alias byval Foo VFoo;

byval class VFoo {}
alias VFoo* Foo;

Close enough.

>>> i notice the tango iterators are classes. surely we want to use 
>>> iterators as value types... this way, we can.
>>>  alternatively, since scope objects are a bit like value types 
>>> already, perhaps we can just add the functionality to that.
>>
>> Ugh. No.
>>
> no? currently the spec says you can't assign to them (although i see now
> that you can), so i thought that might be the plan.

Unless you can get the functionality while maintaining the current 
behavior of the scope storage class, I'm against it. You'd never get an 
unambiguous rule to determine which is to be used in the current case.



More information about the Digitalmars-d mailing list