Autor: Hendrik Boom Data: A: dng Assumptes vells: Re: [DNG] C, Ada, Oberon Assumpte: [DNG] Modula 3 is not Oberon
On Tue, Oct 01, 2024 at 02:16:53AM +1000, nick wrote: >
>
> For a while I was enthusiastic about Oberon, also Modula 3 which is very similar.
Modula 3 is a very different language from eother Modula, Modula 2, and Oberon.
Modula 3 was not designed by Wirth.
> I read all the papers and obtained some compilers for experiments
> (the compiler situation is honestly not great which is probably due to the small number of people using these languages and the researchy nature of them).
> The drawcard was that it promised to be a memory-safe language with similar features to C.
> However, in the end I was disappointed as it seems these languages do not have pointers.
Modula 3 *does* have pointers.
Perhaps you didn't notice them because they are usually intimately associated with the object-oriented
features of the language.
Not only that, but it provides both pointers to garbage-collected data
and pointers to data that are not garbage-collected. The second kind of pointers
involve explicit free operations. which are considered unsafe.
I have never had any problem building intricate data structures linked by pointers in Modula 3.
-- hendrik
> They do have pass by reference which is an improvement on java,
> but otherwise the feature set is basically the same as java.
> And apparently the designer of java (James Gosling) studied Oberon/M3 carefully in the process of specifying java. >
>
>
> So unless you are particularly keen to use the special syntax of Oberon/M3 for creating modules
> (which are something like a class but not quite, maybe Ada has something closer to it),
> then I recommend to use java instead of Oberon/M3.
Except pf course that Modula 3 does have pointers and classes, and they are not the same
as the modules it also provides.
> I would however be interested to learn more about Ada. There is also an extension of Ada which allows to specify invariants and have them enforced by the compiler, which supposedly gives you the same ability that Rust has of reasoning about ownership but in a more generic way. It is called Spark. I haven't tried Spark or Ada but I think it could well be worth a look.
>
>
>
> Kind regards,
>
> Nick