Is This a Solution For the Const/Rebindable Issue?

Steven Schveighoffer schveiguy at yahoo.com
Sun Jun 12 22:42:31 PDT 2011


On Mon, 13 Jun 2011 01:38:17 -0400, Mehrdad <wfunction at hotmail.com> wrote:

> == Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article
>> On Mon, 13 Jun 2011 01:09:57 -0400, Steven Schveighoffer
>> <schveiguy at yahoo.com> wrote:
>> > No.  final is not a type constructor, so it does not get carried
> around
>> > with the type.
>> >
>> > final int i;
>> >
>> > assert(typeof(i) == int); // after the declaration, the storage
> class is
>> > gone from the type!
>> >
>> > int * ip = &i;
>> Note, you might be able to forbid this line, but I don't think
> this works
>> well.
>> -Steve
>
>
> I completely realize that final is not a type constructor (I don't
> want it to be one either), but I'm failing to what that has to do
> with anything.
>
> How does that fact affect my previous answer?

What is the type of s.o?  Hint, it can't be final, because final isn't  
part of the type.

What is the type of &s.o?

If the type of s.o is T (let's say) and the type of &s.o is not T*, then I  
think we have a problem.

I just think it doesn't work.  Maybe you can figure out a way it can, but  
I don't think it can be done without severe confusing semantics.

-Steve


More information about the Digitalmars-d mailing list