On Saturday, 25 August 2018 at 01:43:19 UTC, Walter Bright wrote:
On 8/24/2018 4:22 PM, tide wrote:
struct SomeStruct
{
     void foo() {
         // use SomeStruct
     }
}


void broken()
{
     void function() foo = &SomeStruct.foo;
    foo(); // runtime error, isn't actually safe uses wrong calling convention as well
}

Not really lack of feature so much as there exists broken code. This has been valid code for god knows how long. At some point it was usable in @safe, but it looks you can't take an address of a member function without "this" as well in safe anymore.


That's because it isn't safe. But being able to take the address is important for system work.

Which is my point. Why did you link that article then? It's not safe due to the inherent flaw of D. It shouldn't return a function() type. This is invalid code just outright, the type system could easily be used to prevent this kind of mistake. But instead it relies on the user knowing about the bug in D. Hell like someone else mentioned, if it returned a delegate that would make more sense. But it doesn't for whatever reason. There's a lot of little things like this in D, and from your response you obviously don't give a flying shit about fixing it as you don't even see it as a problem. Just disable it in @safe and anyone that needs to write in @system will have to deal with insanity instead of having something reasonable.

Reply via email to