alias this and immutable shenanigans

Justin Johansson no at spam.com
Fri Aug 13 04:19:17 PDT 2010


Yao G. wrote:
> WTF! I'm initializing it in a constructor! Is this a bug? Or by design 
> you cannot alias this to a immutable member of a struct. It seems that 
> there's a hidden temp created that wants to initialize the field. Also, 
> I wanted to alias the property Foo.baz, but it also caused the following 
> errors:

See the prior thread about the status and pandemonium of
const/immutable/shared as your post is manifestly related
to the same.

Whether your particular observation is a bug or not depends on
what the language specification calls out for.

Of course (being cynical), if the language specification says
to raise these kinds of errors that you observe under your input
conditions then it is not a bug and that's simply how this PL
compiler happens to work (and is expected to work according to
its specification). Now, since no warranties are given that
said PL is useful for any particular purpose, the sole responsibility
is on you, the user, to determine whether or not said PL is
useful for your purposes.

ATOH, whether or not the language specification
(formal/informal/absent/otherwise) is in concert with any
formal/established theory of programming is yet another question.

While feeling somewhat awkward about making this response, me
thinks that the "roadmap for the holy grail of D" needs
to be redrafted from scratch in many areas.

-- Justin Johansson


More information about the Digitalmars-d mailing list