KeyWord

KeyWord

Postby luowy » Sat Dec 02, 2017 2:20 am

report by
https://forum.oberoncore.ru/viewtopic.php?f=29&t=6166
Code: Select all
MODULE ObxKW;
   (* https://forum.oberoncore.ru/viewtopic.php?f=29&t=6166 *)
   TYPE
      ABSTRACT = POINTER TO RECORD END;
   VAR
      EXTENSIBLE, LIMITED: ABSTRACT;
BEGIN
   EXTENSIBLE := LIMITED;
END ObxKW.
luowy
 
Posts: 188
Joined: Mon Oct 20, 2014 12:52 pm

Re: KeyWord

Postby Josef Templ » Sat Dec 02, 2017 8:10 pm

This is an inconsistency in the language report.
It mixes keywords with predefined global identifiers.

It could be fixed easily in the docu.
For the keywords DevCPS.Get is relevant.

ARRAY
BEGIN
BY
CASE
...

- Josef
User avatar
Josef Templ
 
Posts: 1940
Joined: Tue Sep 17, 2013 6:50 am

Re: KeyWord

Postby luowy » Sun Dec 03, 2017 4:26 am

I add a single line code to solve this problem in DevCPT.Insert and DevCPT.InsertThisField at
beginning:

Code: Select all
IF (name = "ABSTRACT") OR (name = "EXTENSIBLE") OR (name = "LIMITED") THEN DevCPM.Mark(48, DevCPM.curpos-1);END;

you can ignore it if you not like;
luowy
 
Posts: 188
Joined: Mon Oct 20, 2014 12:52 pm

Re: KeyWord

Postby Robert » Mon Dec 10, 2018 4:35 pm

What is the status of this "Bug"? Is it Dormant or Rejected or Resolved, or something else?
User avatar
Robert
 
Posts: 949
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: KeyWord

Postby Zinn » Thu Dec 13, 2018 3:05 pm

luowy wrote:I add a single line code to solve this problem in DevCPT.Insert and DevCPT.InsertThisField at
beginning:

Code: Select all
IF (name = "ABSTRACT") OR (name = "EXTENSIBLE") OR (name = "LIMITED") THEN DevCPM.Mark(48, DevCPM.curpos-1);END;

you can ignore it if you not like;


Here it make sense to add your lines. I prefer to trade it as keyword and not as global variable.
- Helmut

After following this discussion I changed my mind. We should not add this changes.
Last edited by Zinn on Mon Dec 17, 2018 1:58 pm, edited 1 time in total.
Zinn
 
Posts: 463
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: KeyWord

Postby Robert » Fri Dec 14, 2018 12:54 pm

Josef Templ wrote:This is an inconsistency in the language report.
It mixes keywords with predefined global identifiers.

It could be fixed easily in the docu.

Can you expand this a little; what is the easy fix, and in which docu?
User avatar
Robert
 
Posts: 949
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: KeyWord

Postby Josef Templ » Fri Dec 14, 2018 3:46 pm

In the compiler, keywords and predefined objects are treated in a very different way.
It looks obvious to me that the intention was to treat the type attributes as predefined objects
and not as keywords. I cannot imagine that this was done accidentally in the compiler.
I think the intention was to make as few changes to the set of keywords as possible in order to preserve
compatibility with the original Oberon language and maybe there are more reasons.
In the docu then 3 predefined identifiers were listed under keywords.

With the proposed fix you would forbid using them as identifiers but it creates some mess
in the compiler because then some keywords are real keywords and some are specially treated
predefined identifiers.

- Josef
User avatar
Josef Templ
 
Posts: 1940
Joined: Tue Sep 17, 2013 6:50 am

Re: KeyWord

Postby cfbsoftware » Fri Dec 14, 2018 10:43 pm

I checked the text example in the other major implementation of Component Pascal (GPCP) and it failed to compile as I would have expected. The CP language report defines EXTENSIBLE, ABSTRACT and LIMITED as reserved words and explicitly states that they 'cannot be used as identifiers'.

However I agree that it is quite posible that it was implemented in the BlackBox compiler the way it was for pragmatic reasons. If a proposed solution makes the compiler less maintainable then I'm happy for it to be left as it is - I'm not particularly concerned that it does not reject a pathological test case that I would not expect to occur in the real world.

if the alternative solution, 'It could be fixed easily in the docu', means changing the language report I would reject that.
cfbsoftware
 
Posts: 202
Joined: Wed Sep 18, 2013 10:06 pm

Re: KeyWord

Postby Josef Templ » Sat Dec 15, 2018 9:34 am

Another reason for treating the modifiers as predefined objects, I think, is the
existence of the NEW modifier for type-bound procedures.
NEW was already a predefined name in Oberon and was also used as such in CP.
But NEW is not only a standard procedure but is also used for marking newly added type-bound procedures.
This duality may have been an unfortunate decision but it can certainly not be changed now.
Having one modifier as a predefined object and others as keywords would be strange, wouldn't it?

In general, if the language report accidentally listed INTEGER as a keyword
I would not consider it a 'change' to fix that but rather as fixing a typo.
The practical implications are zero because no existing program can be invalidated.

The distinction between keywords and predefined objects is a subtle topic.
Why does it exist at all? I mean, why aren't for example the basic types (INTEGER, etc.) not keywords but
predefined types? In my understanding the reason for inventing and using the concept of predefined
objects is upgrade-ability. If at a later time a new basic type or standard procedure (or modifier)
needs to be added to the language it does not invalidate any existing programs that happen to use
that particular identifier.

- Josef
User avatar
Josef Templ
 
Posts: 1940
Joined: Tue Sep 17, 2013 6:50 am

Re: KeyWord

Postby cfbsoftware » Sat Dec 15, 2018 10:34 am

Josef Templ wrote:The distinction between keywords and predefined objects is a subtle topic.
Why does it exist at all? I mean, why aren't for example the basic types (INTEGER, etc.) not keywords but
predefined types? In my understanding the reason for inventing and using the concept of predefined
objects is upgrade-ability. If at a later time a new basic type or standard procedure (or modifier)
needs to be added to the language it does not invalidate any existing programs that happen to use
that particular identifier.

Appendix B: Syntax of Component Pascal clarifies the distinction between reserved words / keywords and standard / predefined identifiers for me. The list of keywords comprises all the literal values that appear there. The fact that NEW has a split personality being both a predefined object and a keyword makes it an exception but that is no reason for any other reserved words / keywords to be treated similarly.
Last edited by cfbsoftware on Sat Dec 15, 2018 11:10 am, edited 1 time in total.
cfbsoftware
 
Posts: 202
Joined: Wed Sep 18, 2013 10:06 pm

Next

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron