Hưng Hưng <address@hidden> writes:
> I came from Object Pascal so I miss OOP very much. I checked and found
> there is one OOP extension for M2 from ISO. Please let me know if GM2
> supports it and where could I find documents about this ISO dialect.
> There is too litle information about it. I only know about this OOP
> extension from modula2.org without seeing the actual ISO papers.
Hi,
no gm2 doesn't support the OOP extension for M2,
Nor are they worth supporting.
First, there is very little support from other compilers.
Second, they were designed by committee compromise and it shows.
It would be less effort to implement Oberon-style extensible records instead.
We have thrown out variant records in favour of these, but it should be possible to accommodate both variant and extensible records in GM2 in PIM and/or ISO mode perhaps enabled with an option switch. Our syntax makes this possible as an extensible record type declaration must always specify a base type (unlike Oberon) and for root types the base type specifier is simply NIL. Thus, when there is no base type specified, the declaration is for a conventional (non-extensible) record for which the variant syntax could be preserved.