July 15, 2005
"AJG" <AJG_member@pathlink.com> wrote in message news:db7hf0$181k$1@digitaldaemon.com...
> Hi there,
>
>>> D structs are no help at all for use cases like this. The interesting
>>> part
>>> of
>>> UnitVector3 is the invariant, and while you can specify an invariant for
>>> a
>>> D
>>> struct, it feels a bit like mocking the poor thing because the struct
>>> has
>>> no way
>>> to establish or preserve that invariant.
>>
>>Why not? Make the fields private with no setter.
>
> Correct me if I'm wrong, but I believe that the private modifier has no
> effect
> on struct variable members. I'm on DMD/Linux 0.127 and I can do this:

That's a bug in dmd that will get fixed (as Mike mentioned, too). Don't worry about it.


1 2 3 4 5 6
Next ›   Last »