https://oberon-lang.github.io/ -- Sent from my smartphone. Please pardon brevity & typos.
I found the strategy for generics interesting and approachable with the specialization occurring over a module as a whole and the selection occurring on module import. If generic modules are not compiled on their own but are only compiled (with an .rsc file generated just for that concrete type) when the module that imports it is compiled, then the combinatorial explosion of generated code can be limited to just those types actually used. If the generic module was already coerced to be compiled for that type by a different importing module (or the same one previously,) and the .smb files are compatible then it doesn't have to be compiled again. It seems to me to be in the spirit of Oberon -- as simple as possible but no simpler. Chuck On Fri, Jul 16, 2021 at 9:03 AM Liam Proven <lproven@gmail.com> wrote:
https://oberon-lang.github.io/
-- Sent from my smartphone. Please pardon brevity & typos. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
This is not a dialect but a whole new language. The author should use a new name, not Oberon. He implemented all those features that programmers love, ignoring all implications they may cause. Just for example: Why enumeration? Did they find a solution for the problems they may cause in separate compilation? -- Diego Sardina On Fri, Jul 16, 2021, at 6:02 PM, Liam Proven wrote:
https://oberon-lang.github.io/
-- Sent from my smartphone. Please pardon brevity & typos. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Sun, Jul 25, 2021 at 10:07 PM Diego Sardina <dsar@eml.cc> wrote:
This is not a dialect but a whole new language.
The author should use a new name, not Oberon.
I agree. In the documentation it is also referred to as Obex. That might be a suitable alternative name?
He implemented all those features that programmers love, ignoring all implications they may cause. Just for example: Why enumeration? Did they find a solution for the problems they may cause in separate compilation?
For those not aware of these issues they are discussed in the document:'Programming Without Enumerations in Oberon' by C. Lins, published in SIGPLAN NOTICES V25, #7, July 1990: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.97.7983&rep=rep1&type=pdf Regards, Chris Burrows CFB Software https://www.astrobe.com
On 25 Jul 2021, at 14:23, Chris Burrows <cfbsoftware@gmail.com> wrote:
On Sun, Jul 25, 2021 at 10:07 PM Diego Sardina <dsar@eml.cc> wrote:
This is not a dialect but a whole new language.
The author should use a new name, not Oberon.
I agree. In the documentation it is also referred to as Obex. That might be a suitable alternative name?
He implemented all those features that programmers love, ignoring all implications they may cause. Just for example: Why enumeration? Did they find a solution for the problems they may cause in separate compilation?
For those not aware of these issues they are discussed in the document:'Programming Without Enumerations in Oberon' by C. Lins, published in SIGPLAN NOTICES V25, #7, July 1990:
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.97.7983&rep=rep1&type=pdf
Regards, Chris Burrows CFB Software https://www.astrobe.com -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
The paper is an interesting viewpoint: I suspect many of the arguments could be made equally well, almost 'as is', -for- enumerations rather than against. I hold my hand up over never having had to professionally program in Oberon, and in general I love its simplicity; but I do wonder if Oberon takes simplification too far by axing this construct: you lose many good things. Examples include, - having manually to create unique numerical constants for each enumerated value… in fact, for a long list of constants being used to represent enumerated values, it feels like the safest thing would be to generate the source using a script - no cohesion of related values — if you were to use an enumeration as an error code, a type checker would normally ensure you weren’t trying to pass an unrelated value — be that another constant representing a colour of the rainbow or the square root of 4 - no opportunity for compilers to help ensure completeness (eg in CASEs, etc.) However, I didn’t design the language and so I didn’t get to make the design choices :-) Tim
If I was to vote for a single most missing language feature, then I would ask for the underscore in names. FPGA_TRIGGER_LOCATION is much more EE-friendly than FpgaTriggerLocation. Is the Oberon-07 not meant to run on the custom firmware? It should have been more firmware friendly! Wojtek
On Mon, Jul 26, 2021 at 8:21 AM Skulski, Wojciech <skulski@pas.rochester.edu> wrote:
If I was to vote for a single most missing language feature, then I would ask for the underscore in names.
FPGA_TRIGGER_LOCATION is much more EE-friendly than FpgaTriggerLocation. Is the Oberon-07 not meant to run on the custom firmware? It should have been more firmware friendly!
I reluctantly allowed for underscores in the Astrobe ARM Cortex-M compilers and documented this extension with the following recommendation: ---------------------------------------------------------------- "Underscore characters (_) are allowed in identifier names (i.e. constant definitions etc.). This feature is solely intended for use with multi-word uppercase identifiers. Normally uppercase names should only be used for Oberon's reserved words and standard procedures and CamelCaps should be used to distinguish separate words in your own identifier names. However a justifiable exception to this rule is the use of uppercase peripheral register names in your programs to match those used by microcontroller manufacturers in their documentation. For example: MCU.PINMODEOD0 can be defined as: MCU.PINMODE_OD0 ---------------------------------------------------------------- This language extension is something you should be able to manage to implement yourself with the RISC5 compiler. All you need to do is modify procedure ORS.Identifier where it's validating that the characters are only letters or digits. Regards, Chris Burrows CFB Software https://www.astrobe.com/RISC5
On Mon, Jul 26, 2021 at 9:24 AM Chris Burrows <cfbsoftware@gmail.com> wrote:
On Mon, Jul 26, 2021 at 8:21 AM Skulski, Wojciech <skulski@pas.rochester.edu> wrote:
If I was to vote for a single most missing language feature, then I would ask for the underscore in names.
This language extension is something you should be able to manage to implement yourself with the RISC5 compiler. All you need to do is modify procedure ORS.Identifier where it's validating that the characters are only letters or digits.
Sorry - I should have added that you also have to change ORS.Get to make sure that "_" is not swallowed up in the list of characters that return sym = null.
Chris: my example was exactly as you described. The intent was to map all upper case constants meaning FPGA register addresses. It is a long standing practice. I am reluctant to modify the compiler. Once forked, always forked. There are your extensions, Michael's UTF extensions, Andreas' compiler extensions... Not sure about Joerg. He may have introduced some of his own. I only mentioned major players. I do not even mention all these dialects that others are trying to push. Trying to maintain my own compiler would create even more chaos. My intent is to stay with Andreas. His work is solid, well thought through, and it makes perfect sense. I also heard his major developments make it back to the Center. Both the common sense and logistics suggest to stay with his versions. If he admits the underscore then I will be very happy. Perhaps in those modules which import SYSTEM? These are the likely FPGA interfaces where the FPGA_TRIGGER_ADDRESS would make perfect sense. W.
What do you think of these restrictions? * identifiers with _ only allowed when SYSTEM is imported (* to underline the non-portability of this feature *) * an identifier with _ is not allowed to be exported (* to underline the locality of this feature *) * an identifier is not allowed to start with an _ (* changes in ORS are marginally easier *) br Jörg Am 26.07.21, 04:24 schrieb "Oberon im Auftrag von Skulski, Wojciech" <oberon-bounces@lists.inf.ethz.ch im Auftrag von skulski@pas.rochester.edu>: Chris: my example was exactly as you described. The intent was to map all upper case constants meaning FPGA register addresses. It is a long standing practice. I am reluctant to modify the compiler. Once forked, always forked. There are your extensions, Michael's UTF extensions, Andreas' compiler extensions... Not sure about Joerg. He may have introduced some of his own. I only mentioned major players. I do not even mention all these dialects that others are trying to push. Trying to maintain my own compiler would create even more chaos. My intent is to stay with Andreas. His work is solid, well thought through, and it makes perfect sense. I also heard his major developments make it back to the Center. Both the common sense and logistics suggest to stay with his versions. If he admits the underscore then I will be very happy. Perhaps in those modules which import SYSTEM? These are the likely FPGA interfaces where the FPGA_TRIGGER_ADDRESS would make perfect sense. W. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Mon, Jul 26, 2021 at 10:22 PM Jörg <joerg.straube@iaeth.ch> wrote:
What do you think of these restrictions? * identifiers with _ only allowed when SYSTEM is imported (* to underline the non-portability of this feature *)
No. I prefer to restrict SYSTEM to denoting unsafe features (VAL, ADR etc) rather than non-portable. For example CHAR, ORD, SET etc. can no longer be considered to be portable. Also, It would also be a new concept to import SYSTEM but then not having to qualify the relevant items. That would be potentially confusing to a reader leading them to wonder why SYSTEM was imported. I've also just implemented a feature which warns if there are unreferenced items in IMPORT lists - it would confuse that also ;-)
* an identifier with _ is not allowed to be exported (* to underline the locality of this feature *)
I don't like that idea. In Astrobe we have a module called MCU which is used solely to contain all of these peripheral register definitions e.g. for the non-vectored interrup controller NVICBase* = 0E000E000H; NVIC_ISER* = NVICBase + 0100H; NVIC_ICER* = NVICBase + 0180H; NVIC_ISPR* = NVICBase + 0200H; We have a different version of MCU for each different microcontroller that we support - the names are the same but the actual addresses are often different :( That module is then imported into the modules (SPI, I2C etc.) that then accesses these register values.
* an identifier is not allowed to start with an _ (* changes in ORS are marginally easier *)
I agree. That is how we have implemented it. Identifiers that start with an underscore irk me more than ones that include them ;-) Regards, Chris Burrows CFB Software https://www.astrobe.com
Chris Thx for your view. In my point of view CHAR is portable if used correctly (I mean: not assuming it is one byte) I agree: CHR and ORD are not. SET is a little bit of a can of worms. I would call it "half portable". "Normal" Oberon usage eg for the Sieve of Eratosthenes is pretty portable: CONST maxPrime = 1000000; bitsPerSET = 8*SYSTEM.SIZE(SET); VAR odd: ARRAY maxPrime DIV 2 DIV bitsPerSET OF SET; (* store all odd nbrs upto maxPrime *) INCL(i MOD bitsPerSET, odd[i DIV bitsPerSET]); If you use SET low level as overlay to an interrupt mask or similar or for graphics, in addition to the nbr of bits you need to know the bit numbering. CONST LSB0 = ORD({0})=1; you can find the bit numbering and act accordingly. br Jörg Am 26.07.21, 15:40 schrieb "Oberon im Auftrag von Chris Burrows" <oberon-bounces@lists.inf.ethz.ch im Auftrag von cfbsoftware@gmail.com>: On Mon, Jul 26, 2021 at 10:22 PM Jörg <joerg.straube@iaeth.ch> wrote: > > What do you think of these restrictions? > * identifiers with _ only allowed when SYSTEM is imported (* to underline the non-portability of this feature *) No. I prefer to restrict SYSTEM to denoting unsafe features (VAL, ADR etc) rather than non-portable. For example CHAR, ORD, SET etc. can no longer be considered to be portable. Also, It would also be a new concept to import SYSTEM but then not having to qualify the relevant items. That would be potentially confusing to a reader leading them to wonder why SYSTEM was imported. I've also just implemented a feature which warns if there are unreferenced items in IMPORT lists - it would confuse that also ;-) > * an identifier with _ is not allowed to be exported (* to underline the locality of this feature *) I don't like that idea. In Astrobe we have a module called MCU which is used solely to contain all of these peripheral register definitions e.g. for the non-vectored interrup controller NVICBase* = 0E000E000H; NVIC_ISER* = NVICBase + 0100H; NVIC_ICER* = NVICBase + 0180H; NVIC_ISPR* = NVICBase + 0200H; We have a different version of MCU for each different microcontroller that we support - the names are the same but the actual addresses are often different :( That module is then imported into the modules (SPI, I2C etc.) that then accesses these register values. > * an identifier is not allowed to start with an _ (* changes in ORS are marginally easier *) > I agree. That is how we have implemented it. Identifiers that start with an underscore irk me more than ones that include them ;-) Regards, Chris Burrows CFB Software https://www.astrobe.com -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Joerg:
What do you think of these restrictions?
I am not sure why there need be any restrictions. If the language admits a character "A", then why not "_"? Both are provided with every known computer keyboard. "-" is a traditional separator used in C and Component Pascal, for example. Why is it not allowed in Oberon? Is there a technical reason, or just a matter of faith? Concerning the programming style, I do not believe in restrictions or enforcement. Looking at the OS code I am seeing long multistatement lines, murky identifiers ("vwr" is my favorite), lack of rules for capitalization, confusing names (both "W" and "w" used in the same code), numerical literals used in place of named constants (like 1, 2, 3 used for mouse buttons), and lack of separations of concerns in some modules (System.Mod being an example of a kitchen sink full of unrelated utilities). All of these are advised against by NM in his own teachings, and then used by himself and by others. Are you seriously proposing to improve the style by restricting the "_", without addressing any of the above?
* identifiers with _ only allowed when SYSTEM is imported (* to underline the non-portability of this feature *) * an identifier with _ is not allowed to be exported (* to underline the locality of this feature *)
This I do not like, having in mind the "definition modules" like SysDef.Mod, FPGADef.Mod, SpiDevicesDef.Mod, etc. Such modules would export the constants but not code. There is a place for them in Extended Oberon, where the definitions can be imported by MODULE* (the bootloader module) to make the bootloader automatically consistent with the regular system. Such a consistency is technically very valuable. So your proposition is on the collision course with the Andreas' implementation of the definition modules imported into MODULE*.
* an identifier is not allowed to start with an _ (* changes in ORS are marginally easier *)
Aesthetics. Not sure why? I do not like the leading "_" myself, but why fight with this particular windmill? W.
On Mon, Jul 26, 2021 at 11:14 PM Skulski, Wojciech <skulski@pas.rochester.edu> wrote:
"-" is a traditional separator used in C and Component Pascal, for example. Why is it not allowed in Oberon? Is there a technical reason, or just a matter of faith?
(I assume you meant to type "_" not "-".) I would not consider C to be an example of good programming language design.to follow. The question then becomes not "Why is it not allowed in Oberon?" but "Why is it allowed in Component Pascal?" The reason stated by the designers of Component Pascal at the time this change to the language was introduced i.e. to allow underscores in identifiers, is as follows: "To simplify interfacing of existing C libraries, underscores in identifiers are allowed." Ref: What's New in Component Pascal? by Cuno Pfister, Oberon microsystems, Inc. March 2001 Regards, Chris Burrows CFB Software https://www.astrobe.com
On Sun, Jul 25, 2021, at 11:06 PM, Timothy Pearson wrote:
The paper is an interesting viewpoint: I suspect many of the arguments could be made equally well, almost 'as is', -for- enumerations rather than against. I hold my hand up over never having had to professionally program in Oberon, and in general I love its simplicity; but I do wonder if Oberon takes simplification too far by axing this construct: you lose many good things.
Examples include,
- having manually to create unique numerical constants for each enumerated value… in fact, for a long list of constants being used to represent enumerated values, it feels like the safest thing would be to generate the source using a script
- no cohesion of related values — if you were to use an enumeration as an error code, a type checker would normally ensure you weren’t trying to pass an unrelated value — be that another constant representing a colour of the rainbow or the square root of 4
- no opportunity for compilers to help ensure completeness (eg in CASEs, etc.)
That paper discusses two of the three major points but it doesn't discuss the most important one: the first. In earlier "From Modula-2 to Oberon", Wirth wrote about enumeration types that "They defy extensibility over module boundaries". This was removed in later papers because it caused too much confusion and was largely misunderstood. I will try to explain why Wirth removed enumeration types (and should have done it since Modula-2, because this is a long-standing problem). Enumeration types break separate compilation, that is one of the main feature of modularity. In a programming language with separate compilation every module can be compiled separately once the interfaces between all modules are enstablished. But there are cases where a change of the interface force all clients to be recompiled, this is something that when occurs should be impeded. Indeed in various Oberon compilers once you generate the symbol table file (that is the interface), you can't change it (except with a flag that force regeneration). Adding new entities to an enumeration types invalidate the interface of a module and force all clients to be recompiled, this is the main reason of its removal. For example, a module exports this enumeration type: TYPE Colors = (red, green, blue); Later in this module you change the enumeration to: TYPE Colors = (red, green, yellow, blue); If you don't recompile all modules that import this module, what happens with this code? FOR i := MIN(Colors) TO MAX(Colors) DO ... END; VAR table: ARRAY Colors OF BOOLEAN; Your program will have unexpected behaviours or will simply crash. To solve this, you have to recompile all the clients. However not all changes to the interface invalidate clients, these cases may be considered an interface extension. In this paper this topic is further discussed: Regis Crelier - Separate Compilation and Module Extension. The only way to have enumeration types that don't break separate compilation is to remove their ordering and boundaries (no ORD(), MIN() and MAX(), so can't be used in FOR) and can't be used as index type for ARRAY and as base type for SET. But at this point there is no reason to introduce a type since they are no more different than a sequence of constants declaration. Java didn't have enumeration in earlier versions for exactly this problem. Later it implemented enumeration types but not as lightweight as in Modula-2 because of the considerable runtime impact (they are no more integers). Golang doesn't have enumeration types for the same reason and they still keep them out of the language (it has a constant generator called iota to ease the generation of sequences). So I really don't understand why enumeration types should be included, considering that you can obtain the same goal with type extension (just look Lins paper) while having no problems with separate compilation. Oh, I forgot to talk about generics... that requires a whole day of writing :-) -- Diego Sardina
On 26 Jul 2021, at 06:12, Diego Sardina <dsar@eml.cc> wrote:
On Sun, Jul 25, 2021, at 11:06 PM, Timothy Pearson wrote:
The paper is an interesting viewpoint: I suspect many of the arguments could be made equally well, almost 'as is', -for- enumerations rather than against. I hold my hand up over never having had to professionally program in Oberon, and in general I love its simplicity; but I do wonder if Oberon takes simplification too far by axing this construct: you lose many good things.
Examples include,
- having manually to create unique numerical constants for each enumerated value… in fact, for a long list of constants being used to represent enumerated values, it feels like the safest thing would be to generate the source using a script
- no cohesion of related values — if you were to use an enumeration as an error code, a type checker would normally ensure you weren’t trying to pass an unrelated value — be that another constant representing a colour of the rainbow or the square root of 4
- no opportunity for compilers to help ensure completeness (eg in CASEs, etc.)
That paper discusses two of the three major points but it doesn't discuss the most important one: the first.
In earlier "From Modula-2 to Oberon", Wirth wrote about enumeration types that "They defy extensibility over module boundaries". This was removed in later papers because it caused too much confusion and was largely misunderstood. I will try to explain why Wirth removed enumeration types (and should have done it since Modula-2, because this is a long-standing problem).
Enumeration types break separate compilation, that is one of the main feature of modularity.
In a programming language with separate compilation every module can be compiled separately once the interfaces between all modules are enstablished. But there are cases where a change of the interface force all clients to be recompiled, this is something that when occurs should be impeded. Indeed in various Oberon compilers once you generate the symbol table file (that is the interface), you can't change it (except with a flag that force regeneration).
Adding new entities to an enumeration types invalidate the interface of a module and force all clients to be recompiled, this is the main reason of its removal.
For example, a module exports this enumeration type:
TYPE Colors = (red, green, blue);
Later in this module you change the enumeration to:
TYPE Colors = (red, green, yellow, blue);
If you don't recompile all modules that import this module, what happens with this code?
FOR i := MIN(Colors) TO MAX(Colors) DO ... END;
VAR table: ARRAY Colors OF BOOLEAN;
Your program will have unexpected behaviours or will simply crash. To solve this, you have to recompile all the clients.
I guess I’m missing something fundamental. To me, this is a perfect illustration of the benefits of enumerations — that the interface change forces dependencies to be rebuilt.
However not all changes to the interface invalidate clients, these cases may be considered an interface extension. In this paper this topic is further discussed: Regis Crelier - Separate Compilation and Module Extension.
The only way to have enumeration types that don't break separate compilation is to remove their ordering and boundaries (no ORD(), MIN() and MAX(), so can't be used in FOR) and can't be used as index type for ARRAY and as base type for SET. But at this point there is no reason to introduce a type since they are no more different than a sequence of constants declaration.
The difference is they have a type, they are not (conceptually) integer constants. Any procedure with a colour parameter could not be accidentally passed a value of 99. Any procedure with a numeric parameter could not accidentally be passed a value of Green.
Java didn't have enumeration in earlier versions for exactly this problem. Later it implemented enumeration types but not as lightweight as in Modula-2 because of the considerable runtime impact (they are no more integers).
Golang doesn't have enumeration types for the same reason and they still keep them out of the language (it has a constant generator called iota to ease the generation of sequences).
So I really don't understand why enumeration types should be included, considering that you can obtain the same goal with type extension (just look Lins paper) while having no problems with separate compilation.
Language features often involve compromises. This is one area where Oberon makes compromises which given my personal preferences I would’ve made a different choice. The limitations and risks the lack of enumerations introduce would not stop me using the language - there are two many other benefits. Now, if only I could convince my management and developers to switch over in my professional life, but that’s not going to happen.
Oh, I forgot to talk about generics... that requires a whole day of writing :-)
-- Diego Sardina -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Mon, Jul 26, 2021, at 11:14 AM, Timothy Pearson wrote:
I guess I’m missing something fundamental. To me, this is a perfect illustration of the benefits of enumerations — that the interface change forces dependencies to be rebuilt.
You are missing two points: binary compatibility and the constant nature of the enumeration types. Enumeration types are group of entities that don't change ( = immutable) but they are misused for things that change or grow over the time, such error codes and messages. You must be able to add a new error code and message in your minor version of library without breaking binary compatibility with programs that are using your library. You can't tell everyone "hey, there is a new error code, rebuild all your programs".
The difference is they have a type, they are not (conceptually) integer constants. Any procedure with a colour parameter could not be accidentally passed a value of 99. Any procedure with a numeric parameter could not accidentally be passed a value of Green.
True, the fact that they are integers is an implementation detail. But what is different with record instances then? MODULE Days; TYPE Day* = POINTER TO DayDesc; [...] VAR sun*, mon*, tue*, wed*, thu*, fri*, sat* : Day; [...] MODULE daytest; IMPORT Days; VAR today: Days.Day; BEGIN today := Days.mon; [...] In Oberon-07 global variables are readonly outside the module, in Oberon-2 you should use the readonly export. Here Days.Day is a limited type, it can be null or one of the instances declared in the global space of the module (they should not be allocated outside the module, but only declared). If you want to mimic the enumeration type, you can also define a Day.Next() procedure to iterate over the days or a Day.Name() to get the associated string. The nature of days is immutable, in the case of an Error type you can add a new instance here without breaking clients. MODULE InterestingLib; TYPE Error* = POINTER TO ErrorDesc; [...] VAR (* Error instances *) error0001*: Error; error0002*: Error; [...] error0172*: Error; (* added in 26/07/2021 *) BEGIN error0001 := InitError(1, "File not found"); [...] -- Diego Sardina
On Sun, Jul 25, 2021, at 11:06 PM, Timothy Pearson wrote:
- having manually to create unique numerical constants for each enumerated value… in fact, for a long list of constants being used to represent enumerated values, it feels like the safest thing would be to generate the source using a script
This was indeed envisaged in the early days of Oberon. In 1991 Niklaus Wirth wrote a conversion program to convert the bulk of a Modula-2 (with its enumerated types) program to an equivalent Oberon version. Various versions of this convertor can be downloaded from the Internet. Search for ModulaToOberon. I also published a version in 2006 which converted Pascal programs instead. The original source code is included with the MacII Oberon sources: https://norayr.am/archive/oberon/OberonV4/MacII/Sources/ModulaToOberon/ It can be used to generate a list of constants for an enumeration e.g. I have just run a test on a GPCP version of the software. The input file was: MODULE Enums; TYPE Colour = (Red, Orange, Yellow, Green, Blue, Indigo, Violet); END Enums. The resulting output file is: MODULE Enums; TYPE Colour = INTEGER; CONST Red = 0; Orange = 1; Yellow = 2; Green = 3; Blue = 4; Indigo = 5; Violet = 6; END Enums. Regards, Chris Burrows CFB Software https://www.astrobe.com
Hi,
TYPE Colors = (red, green, blue);
Later in this module you change the enumeration to:
TYPE Colors = (red, green, yellow, blue);
If you don't recompile all modules that import this module, what happens with this code?
FOR i := MIN(Colors) TO MAX(Colors) DO ... END;
VAR table: ARRAY Colors OF BOOLEAN;
Your program will have unexpected behaviours or will simply crash. To solve this, you have to recompile all the clients.
Similar problems if you declare three INTEGER red=0, green=1, blue=2 and then change them to yellow=2, blue=3 If you have VAR table: ARRAY 3 OF BOOLEAN; when you add an additional color it can reslt in table[i] to be outside of the array boundaries resulting in a crash. Even worse, FOR i:=0 TO 2 DO ... END; will miss something once you introduce additional colors and your application will misbehave in subtle ways. From my experience, finding errors that occur at runtime are so much costlier than having the compiler report an error or even forcing a recompilation of modules. claudio
On Wed, Jul 28, 2021 at 8:06 AM Claudio Nieder <private@claudio.ch> wrote:
Hi,
TYPE Colors = (red, green, blue);
Later in this module you change the enumeration to:
TYPE Colors = (red, green, yellow, blue);
If you don't recompile all modules that import this module, what happens with this code?
FOR i := MIN(Colors) TO MAX(Colors) DO ... END;
VAR table: ARRAY Colors OF BOOLEAN;
Your program will have unexpected behaviours or will simply crash. To solve this, you have to recompile all the clients.
Similar problems if you declare three INTEGER red=0, green=1, blue=2 and then change them to yellow=2, blue=3
True - but a little bit more difficult to do accidentally methinks. I was a huge fan of enumerated types in the 1970's when I started working with Pascal and was very proud of my extensive use of them. However, as time went on I found their typed quality to be more of a hindrance than a help when working with real-world data. Sooner or later I had to input / output the values, or access their ordinal values, or there were oddball values that didn't neatly fit in the sequence e.g. Ace or Joker in a suit of cards for instance. Also, I often seemed to have the need to test the grey-area boundary values Pred(MIN(settype)) and Succ(MAX(settype) without causing a runtime error. The designers of the Delphi Language (i.e. Object Pascal++) apparently have had similar experiences. This is their solution to overcome some of these problems: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Simple_Types_(Delphi)#Enu... I would describe this solution as 'Make it as complex as possible and then even more complicated' ;-) However, for those who liked programming in Pascal and/or Modula-2 and find Oberon too minimal for their liking I recommend they use Delphi instead. IMHO it is still better than any C-inspired language. Regards, Chris Burrows CFB Software https://www.astrobe.com
On Wed, Jul 28, 2021, at 12:36 AM, Claudio Nieder wrote:
Similar problems if you declare three INTEGER red=0, green=1, blue=2 and then change them to yellow=2, blue=3
Sorry Claudio, but your arguments don't make sense or maybe you misunderstood the whole point. Why you are talking about changing the value of a constant? If you change the value of a (public) constant you are changing the interface of your module. Changing constant values is part of the interface invalidation and compilers will force you a rebuild. We are talking about *extending the interface* and If you want to extend your program just add *new constants*. In an enumeration type instead adding new entities (also at the end) will invalidate the interface. Here lies the problem.
If you have VAR table: ARRAY 3 OF BOOLEAN; when you add an additional color it can reslt in table[i] to be outside of the array boundaries resulting in a crash.
No, the runtime will protect your program from a crash by halting your program. Halting the program by the runtime is different from a crash (segmentation fault, segmentation violation, etc). Strong typing languages don't crash (strong typing implies memory safety). The case with the enumeration types is different and it is *a true crash* (if you don't rebuild all modules). The client module was compiled with the old definition of the enumeration type and the table was then allocated with a different size, while the modified module has the new definition (that the runtime will use, since it is the business of the modified module to export it). The runtime can't protect well your program because has different size information, so the table will be iterated outside of the array boundaries and a bad crash will happen. For this reason a rebuild is required, so they can get the new size information from the interface.
From my experience, finding errors that occur at runtime are so much costlier than having the compiler report an error or even forcing a recompilation of modules.
You can use record pointer instances and you will have static typing. Maybe you are a solo-developer / small team and your libraries are under your full control ( = no clients use it directly), so you don't mind to rebuild your libraries because you ship them with your final product. Maybe you even use static linking, so this is not a true problem at all. I can understand that, but it's not the whole reality. In large scale software changes in an interface that require recompilation of modules is always wrong because you are not ensuring binary compatibility. In software engineering literature is an accepted fact that strong interfaces must rely on opaque data types. In weaker languages like C this is called opaque pointer (that page contains other names used for it): https://en.wikipedia.org/wiki/Opaque_pointer Modula-2 is very strong with the concept of opaque data types and helped to create very strong interface (except if you used an enumeration type in your definition that was changed later, sorry but as I said this was a long-standing problem). Modula-3 designers did a perfect job because the true opaque data type is the OBJECT type (that is only a reference type). Although enumeration types are supported, they are discouraged (even in Exception). They indeed introduced an (opaque) Atom.T object: http://www.opencm3.net/doc/help/gen_html/libm3/src/atom/Atom.i3.html That was used in place of enumeration types for something that grows over the time (such error messages): http://www.opencm3.net/doc/help/gen_html/tcp/src/common/IP.i3.html TYPE EC = AtomList.T; EXCEPTION Error(EC); [...] VAR LookupFailure, Unreachable, PortBusy, NoResources: Atom.T; You can add new errors or exceptions without invalidating your clients. This is the correct way to program strong interfaces. -- Diego Sardina
Diego Sardina пишет:
This is not a dialect but a whole new language. The author should use a new name, not Oberon. He implemented all those features that programmers love, ignoring all implications they may cause.
I totally agree with you, Diego. Fashionable templates, lower case of keywords - all this suggests bad habits. It is commendable that Oberon was taken into work, but the author answered the question for himself: what will happen if I supply Oberon with new-fangled features? I only liked the absence of ";" between operators - the source code looks a little cleaner. Perhaps I will take this decision in my own Oberon dialect, but I must first figure out how to implement it as painlessly as possible on OP2 compiler. Apparently, only simple edits in OPS will not do - there are a lot of checks for presence ";" in other places of the compiler. -- Oleg N. Cher
On Sun, 25 Jul 2021 at 14:37, Diego Sardina <dsar@eml.cc> wrote:
This is not a dialect but a whole new language.
The author should use a new name, not Oberon.
He implemented all those features that programmers love, ignoring all implications they may cause. Just for example: Why enumeration? Did they find a solution for the problems they may cause in separate compilation?
This is an interesting take. I do not know if the Oberon+ author, Rochus Keller, is on this list. This is he: https://github.com/rochus-keller I will try to contact him, in case he wishes to contribute to the discussion. -- Liam Proven – Profile: https://about.me/liamproven Email: lproven@cix.co.uk – gMail/gTalk/gHangouts: lproven@gmail.com Twitter/Facebook/LinkedIn/Flickr: lproven – Skype: liamproven UK: +44 7939-087884 – ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053
On Tue, Jul 27, 2021 at 1:59 AM Liam Proven <lproven@gmail.com> wrote:
On Sun, 25 Jul 2021 at 14:37, Diego Sardina <dsar@eml.cc> wrote:
This is not a dialect but a whole new language.
The author should use a new name, not Oberon.
He implemented all those features that programmers love, ignoring all implications they may cause. Just for example: Why enumeration? Did they find a solution for the problems they may cause in separate compilation?
This is an interesting take.
I do not know if the Oberon+ author, Rochus Keller, is on this list.
He certainly was here - he posted some 30-odd messages in 2020 e.g. http://lists.inf.ethz.ch/pipermail/oberon/2020/013810.html However, he has been quiet this year. Cheers, Chris
On Tue, 27 Jul 2021 at 00:51, Chris Burrows <cfbsoftware@gmail.com> wrote:
He certainly was here - he posted some 30-odd messages in 2020 e.g.
http://lists.inf.ethz.ch/pipermail/oberon/2020/013810.html
However, he has been quiet this year.
He got straight back to me -- in an HTML-formatted email -- saying that he found the old technology of the ETH list to be annoying and it cluttered his inbox, so he quit. It makes me wonder if he knows about email filters, folders and so on... :-( Anyway, he said he did not want to rejoin the list, he read this discussion and sees no real problems being raised, and that if anyone wanted to raise bugs or even discuss issues, they were welcome to do so on Github. :-( I found it a very off-putting and dispiriting response, TBH. -- Liam Proven – Profile: https://about.me/liamproven Email: lproven@cix.co.uk – gMail/gTalk/gHangouts: lproven@gmail.com Twitter/Facebook/LinkedIn/Flickr: lproven – Skype: liamproven UK: +44 7939-087884 – ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053
On Tue, Jul 27, 2021, at 3:56 PM, Liam Proven wrote:
Anyway, he said he did not want to rejoin the list, he read this discussion and sees no real problems being raised, and that if anyone wanted to raise bugs or even discuss issues, they were welcome to do so on Github. :-(
I found it a very off-putting and dispiriting response, TBH.
He sees no real problems being raised means that he will keep the name Oberon for that language? -- Diego Sardina
On Thu, 29 Jul 2021 at 17:45, Diego Sardina <dsar@eml.cc> wrote:
He sees no real problems being raised means that he will keep the name Oberon for that language?
That's right, as far as I can tell. -- Liam Proven – Profile: https://about.me/liamproven Email: lproven@cix.co.uk – gMail/gTalk/gHangouts: lproven@gmail.com Twitter/Facebook/LinkedIn/Flickr: lproven – Skype: liamproven UK: +44 7939-087884 – ČR (+ WhatsApp/Telegram/Signal): +420 702 829 053
Historically I see a number of derivatives of Oberon referencing Oberon in their name https://en.wikibooks.org/wiki/Oberon#/media/File:Oberon_genealogy.svg Oberon-2 from Wirth and Mössenböck but also Object Oberon and Active Oberon extend the language with additional concepts. I imagine it should be clear that a derivative language includes changes from the original language and those changes can be bad. Or good! I understand the reluctance to grant legitimacy to changes not endorsed by Professor Wirth himself. In addition, I believe that historically there has been an aversion to permit profit being made from the name "Oberon" in the context of computer languages and that has induced some name changes. I could be wrong about that though, not knowing any of the details. I would be one of those people introducing an Oberon-<something> as there are some concepts that I think map simply on to the clean substrate of Oberon. I do appreciate that, even if the consensus is that I can't call it Oberon-<something> I can still use the strong foundation of source code Wirth and Gutknecht have open-sourced. It would be nice to learn that Oberon language extensions I wanted to share with others could be called Oberon-<something> when the substrate language is still Oberon. Best Regards, Chuck On Thu, Jul 29, 2021 at 9:24 AM Skulski, Wojciech <skulski@pas.rochester.edu> wrote:
He sees no real problems being raised means that he will keep the name Oberon for that language? That's right, as far as I can tell.
Was the Oberon name not copyrighted by ETH?
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
For what I remember in the past Wirth didn't allow a user to use the name Oberon for his (incompatible) language, he allowed the use of the name Modula for Modula-3 and Modula-2 R10 in recent years, maybe because he lost interest in this language (except for historical reference), but not Oberon. So I guess this guy didn't even ask permission to Wirth for the use of the name Oberon. However, Wirth has always favored compatible dialects and extensions since the time of Pascal. But there is a huge problem here, indeed that comes from Pascal experience. In Pascal there was no distinction between keywords and identifiers, to make things even worse it was case-insensitive. There were lot of Pascal dialects and extensions that broke lot of source codes because they introduced new keywords such as "string", "message", "operator", etc... (lot more), these were very used as variable names. To use a Pascal dialect compiler you had to rename all your variables to string0, message0, etc... Try to use FreePascal to compile some old Pascal source code (such as P4) and have fun :-) Starting with Modula-2, Wirth used uppercase keywords to ease the spreading of dialects. Some Modula-2 compilers had the CLASS keyword to support classes, but they didn't break already existing source codes that used "class" identifier. This still continues in Oberon, there are lot of extensions that can compile plain Oberon without breaking existing source codes. So, what's wrong with this language? It has lowercase keywords and also offers short variants (!!) such as "proc" and "int". Can you imagine how many source codes are broken with that? I also use very often "begin" as variable name because depending on the context it is very explanatory, but I can't compile my code with this compiler, I have to use a different identifier or rename it to begin0. Well... we came back at the time of Pascal. This is not Oberon, nor a dialect / extension and must use a new name. -- Diego Sardina
participants (9)
-
Charles Perkins -
Chris Burrows -
Claudio Nieder -
Diego Sardina -
Jörg -
Liam Proven -
Oleg N. Cher -
Skulski, Wojciech -
Timothy Pearson