Question about auto ref
Namespace
rswhite4 at googlemail.com
Tue Mar 26 17:26:39 PDT 2013
I tried the last few hours to implement something like 'A&' but
it's horrible if you haven't complete knowledge and want to
implement something that comes after the type...
But what's wrong with '@ref'? If I had knowledge how you could
implement new properties I could start a trial.
----
After my attempts to implement something like 'A&' I tried to get
something like '@A'. And I was successful.
After that I tried to implement '@ref', but without declare it as
a real property (because I just do not know how).
Thats the reason why all following declarations behave as const:
void bar(@ref A a) {
}
void bar(@ ref A a) {
}
void bar(ref@ A a) {
}
void bar(ref @ A a) {
}
For this I had to create a new storage class (currently it is
STCref2).
Disadvantage: because @ref is (currently) not a realy property
you could place '@' whereever you want (but before the type). But
you get an error if you don't use it in combination with 'ref'. I
like it. :D
Even if we should prefer a property this is IMO a nice step.
And maybe we could/should change '@' to '&' so that we have
'ref&'/'&ref' what looks like a (nice) combination of D and C++.
More information about the Digitalmars-d-learn
mailing list