On 3/4/19, Bert Freudenberg <
[hidden email]> wrote:
> On Mon, Mar 4, 2019 at 2:16 AM K K Subbu <
[hidden email]> wrote:
>
>> All,
>>
>>
>> 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
>> oversight).
>>
>> 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).
+1
> - Bert -
>