Rasmus Knutsson
unread,May 11, 2011, 6:32:06 AM5/11/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Compiler construction 2011
Hi everyone,
I don't think it is specified whether a local variable in a method
should be able to have the same name as a field in the same class--
correct me if I am wrong!
I don't really know what to think of this. Following Java it would of
course be natural to allow this, but on the other hand there would be
no way to access the field then, unless we add something like the
expression self->field.
Also there is the question of whether to allow naming a field with a
name that is already in use in a superclass. This too should perhaps
be allowed, but adds a little more mess to the implementation, since I
suppose the fields of the subclass would have to be renamed. Of
course, we could let the two fields be one and the same, but that
would mean allowing the subclass access to the superclass's field,
just by way of declaring it.
It would be nice to get a judgement on these matters!
Best regards,
Rasmus