[Oberon] Oberon for a C++ user.
Alexander Ilin
ajsoft at yandex.ru
Tue Nov 15 09:04:33 CET 2016
Hello!
13.11.2016, 22:41, "Diego Sardina" <dsar at eml.cc>:
> TYPE
> MyFinalRec = RECORD
> [...]
> END;
>
> PROCEDURE (VAR m : MyFinalRec) Method(), NEW;
> BEGIN
> [...]
> END Method;
>
> I'm forced to use the NEW keyword, due to the fact
> that Method() is newly introduced.
> But it is meaningless for a final record that does
> not extend a record.
It is not meaningless, it stresses the fact that you are not extending an existing method, and affirmatively states that in the source text.
If at a later point you change the RECORD definition to become an extension of a more generic object, the compiler will help you resolve the method name conflicts.
I find it very thoughtful on part of CP language designers to make this word mandatory. Without it in the situation I described all the methods with clashing names would silently be converted into overrides.
---=====---
Александр
More information about the Oberon
mailing list