gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Import/Export everything from a module?


From: Hưng Hưng
Subject: Fwd: Import/Export everything from a module?
Date: Tue, 24 Mar 2020 21:46:33 +0700



---------- Forwarded message ---------
Từ: Hưng Hưng <address@hidden>
Date: Th 3, 24 thg 3, 2020 vào lúc 21:46
Subject: Re: Import/Export everything from a module?
To: Benjamin Kowarsch <address@hidden>


Yes. I think M2 is outdated, too. Free Pascal could survive because we have to endlessly catch up with Delphi and we have Lazarus. M2 doesn't have this push. Even bindings for popular libraries is lacked we only can put hope on a modernized M2.

Vào Th 3, 24 thg 3, 2020 vào lúc 21:42 Benjamin Kowarsch <address@hidden> đã viết:
that URL was too short, it should be


On Tue, 24 Mar 2020 at 23:40, Benjamin Kowarsch <address@hidden> wrote:
I agree that Oberon is a tad too simplistic, but classical Modula-2 (PIM2/3/4 and ISO) is hopelessly outdated.

Rick Sutcliffe and I have been working on a revision of Modula-2 with the approval from Prof. Wirth. This is a modernised version of Modula-2 in which some outdated features are removed (octal literals, local modules etc) and variant records are replaced with Oberon-style extensible records. However, the compiler is still work in progress.


Gaius Mulley stated that he intends to implement this as an additional dialect in GM2, but I have no idea about the timing.

regards
benjamin

On Tue, 24 Mar 2020 at 23:35, Hưng Hưng <address@hidden> wrote:
I know this style, from Oberon. I played a bit with Oberon but I found I want something more like a proper language and of course more powerful so I choose GM2.

If I just IMPORT EXAMPLE; the procedure inside EXAMPLE doesn't automatically available to me but I have to prepend EXAMPLE. before every procedure I want to use. It's very time consuming and imagine if our module has a very long name... it will be a nightmare.

Vào Th 3, 24 thg 3, 2020 vào lúc 21:29 Benjamin Kowarsch <address@hidden> đã viết:
You should not use unqualified imports.

FROM Foo IMPORT Bar, Baz, Bam; (* VERY BAD STYLE *)

Use qualified import instead.

IMPORT Foo; (* PROPER/CLEAN STYLE *)

This way you do not need to import identifiers one by one.

This also saves you the hassle of making up longer more specific names.

Instead of

FROM StringLib IMPORT stringsAreEqual;

IF stringsAreEqual(str1, str2) THEN ...

you do

IMPORT StringT;

IF StringT.equal(str1, str2) THEN ...


On Tue, 24 Mar 2020 at 22:27, Hưng Hưng <address@hidden> wrote:
I found it's too time consuming to write a long list of import, export. Is there any syntax to import everything from a module? e.g: FROM EXAMPLE IMPORT */ALL/EVERYTHING/... or IMPORT EXAMPLE.*? Python has a syntax like this: from example import *; which I think heavily influenced by M2.

I wonder the same thing for Export, too. Thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]