[squeak-dev] final methods
hannes.hirzel at gmail.com
Tue Mar 5 16:42:05 UTC 2019
On 3/4/19, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On Mon, Mar 4, 2019 at 2:16 AM K K Subbu <kksubbu.ml at gmail.com> wrote:
>> How does one enforce finality of methods in Squeak?
>> I noticed that methods like Object>>basicSize have instructions in
>> comments not to override these, but what if these methods do get
>> overridden/extended during compilation (perhaps by accident or
>> Can we use a dummy primitive in these methods to mark them as final?
> There is no way to enforce this from inside the method, since if it is
> overridden in a subclass, the VM never even looks at that method.
> We do warn users about accidentally overriding some methods, in particular
> anything defined in Behavior / ClassDescription / Metaclass. This works
> simply by having the browser check if the method you're trying to accept is
> "scary" (see isScarySelector:).
> We could do something similar for methods that you really should not
> override (like #basicSize, #== etc).
> - Bert -
More information about the Squeak-dev