new principle of division between structures and classes
Christopher Wright
dhasenan at gmail.com
Sat Jan 10 08:07:14 PST 2009
Weed wrote:
> Denis Koroskin пишет:
>
>> I'd suggest you to state you ideas as simple and keep your posts as
>> small as possible (trust me, few people like reading long posts).
>
> The extra-short formulation of my idea:
> Objects should be divided on POD (struct) and non-POD (class).
>
> Instead of such division as now: POD && value type (struct) and POD &&
> reference type (class).
The reference versus value type difference is just a matter of defaults.
Returning a class instance on the stack from a function is possible with
inout parameters, though you can't use a constructor in that case:
void main ()
{
scope MyClass obj = new MyClass;
foo (obj);
}
void foo (inout MyClass obj)
{
// initialize obj somehow
}
More information about the Digitalmars-d
mailing list