Method pointers are *function* pointers?? Or delegates??
schveiguy at yahoo.com
Tue May 22 14:05:12 PDT 2012
On Tue, 22 May 2012 15:29:10 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 5/22/12 1:14 PM, Steven Schveighoffer wrote:
>> I agree, it's unsound. But so is this:
>> int *blah = void;
>> *blah = 5;
>> It doesn't mean that the language should forbid it, or that the compiler
>> isn't implemented as designed.
> Initialization with void is a feature. My example shows the fail of a
> feature. There is no comparison.
Your example shows an invalid use for a feature. There are valid uses for
that feature that are not unsound.
But I think we are on the same page -- the misfeature is not that you
*can* take a member address, it's the *type* that it is given.
>> At the *very least*, the address to member function operation should be
>> illegal in @safe code.
> It should be verboten. Other means should be devised for achieving
> whatever utility is there.
I agree, the feature is prone to error.
More information about the Digitalmars-d