std.concurrency & immutable classes...
Michel Fortin
michel.fortin at michelf.com
Fri Feb 11 04:33:19 PST 2011
On 2011-02-10 14:45:14 -0500, Tomek Sowiński <just at ask.me> said:
> Michel Fortin napisał:
>
>>> Thanks for doing this. Is it approved by Walter?
>>
>> Depends on what you mean by "approved".
>>
>> He commented once on the newsgroup after I posted an earlier version of
>> the patch, saying I should add tests for type deduction and some other
>> stuff. This change his something he attempted to do in the past and
>> failed, I expect him to be skeptical.
>
> It would be much easier if he provided the specific case(s) which broke
> his teeth. Then we'll all know where's the problem.
I don't think he had much time to look at the patch. His last remark
were more of like "I'm skeptical it can work, please make sure you have
tests to cover those specific cases..." followed with a list of things
to test. I'll surely get some feedback on my patch someday, hopefully
right after the next release (which should be imminent now).
The architecture of the DMD front end makes it very difficult to
approach the tail-const problem for classes the same way it works for
pointers. If this is what Walter tried, I have no difficulty
understanding why it didn't go very far. My approach was to make the
optional 'ref' a modifier that changes the attributes of a new head
type attached to classes. This may look a little of a hack, but it
works.
> If it's soluble, it'll ope
> n the door to tail type modifiers in general, not just in classes. It's a b
> urning issue e.g. with ranges (mostly struct).
>
> http://d.puremagic.com/issues/show_bug.cgi?id=5377
>
> Look at the attachment to get a feel of what hoops we'll have to jump throu
> gh to side-step lack of tail X.
Passing 'this' by reference in struct member functions makes it pretty
much impossible to support tail const. The reason it works for classes
is that class member functions receive a *copy* of the 'this' object
reference, in other words the constness of the original reference does
not matter.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d-learn
mailing list