[dmd-beta] dmd 2.063 beta
Sönke Ludwig
sludwig at outerproduct.org
Mon Apr 29 02:47:02 PDT 2013
I noticed that the following doesn't work anymore:
---
class Test {
this()
{
// ...
}
}
void main()
{
auto test = new shared Test; // Error: non-shared method
shared_obj.Test.this is not callable using a shared object
//auto test cast(shared)new Text; // still works, but ugly and with
dangerous semantics
}
---
Is there a compelling reason for this or is it just an artifact of
another change? It looks like
http://d.puremagic.com/issues/show_bug.cgi?id=9974 describes this, too,
but the fix doesn't seem to have changed anything regarding the original
issue as far as I can see.
This one hurts a lot because it (again) destroys the only way to use
shared objects in a generally acceptable way (i.e. without coding
everything twice, once with "shared" and once without, and without casts
everywhere):
1. Write the class without explicit "shared" support
2. Creates shared objects where needed using "new shared ClassName"
3. Use a special "lock()" function that locks the object and safely
casts away shared during the lock
More information about the dmd-beta
mailing list