undefined record field when compiling in NO.
In the alpha release of NO, the compiler applied to MODULE Test; IMPORT ConfigInput; PROCEDURE Frame(F: ConfigInput.Frame); VAR x: INTEGER; BEGIN x := F.x END Frame; BEGIN END Test. reports compiling Test pos 105 err 83 undefined record field . This is in ConfigInput. TYPE Frame* = POINTER TO RECORD (Display.Frame) keys: SET; x, y: INTEGER; text: Texts.Text END; So F.x in Test should be legitimate. Can anyone explain why the compiler complained? Thanks, ... Peter E. -- 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12 Tel +13606390202 Bcc: peasthope at shaw.ca http://carnot.yi.org/ "http://members.shaw.ca/peasthope/index.html#Itinerary "
On Friday 03 January 2014 09:21:08 peasthope@shaw.ca wrote:
In the alpha release of NO, the compiler applied to
MODULE Test; IMPORT ConfigInput; PROCEDURE Frame(F: ConfigInput.Frame); VAR x: INTEGER; BEGIN x := F.x END Frame; BEGIN END Test.
reports compiling Test pos 105 err 83 undefined record field . This is in ConfigInput. TYPE Frame* = POINTER TO RECORD (Display.Frame) keys: SET; x, y: INTEGER; text: Texts.Text END;
So F.x in Test should be legitimate. Can anyone explain why the compiler complained?
Thanks, ... Peter E.
It may be confusing for the compiler that you have a TYPE called Frame and a PROCEDURE called Frame. Also there are two instances of 'x'. One local to Frame and the other local to Frame. -- Met vriendelijke groeten, Jan Verhoeven http://www.verhoeven272.nl
You have to export individually the fields of ConfigInput.Frame if you want to use them in other modules, so it should be x*, y: INTEGER; B
On 3 Jan 2014, at 08:21, <peasthope@shaw.ca> wrote:
In the alpha release of NO, the compiler applied to
MODULE Test; IMPORT ConfigInput; PROCEDURE Frame(F: ConfigInput.Frame); VAR x: INTEGER; BEGIN x := F.x END Frame; BEGIN END Test.
reports compiling Test pos 105 err 83 undefined record field . This is in ConfigInput. TYPE Frame* = POINTER TO RECORD (Display.Frame) keys: SET; x, y: INTEGER; text: Texts.Text END;
So F.x in Test should be legitimate. Can anyone explain why the compiler complained?
Thanks, ... Peter E.
-- 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12 Tel +13606390202 Bcc: peasthope at shaw.ca http://carnot.yi.org/ "http://members.shaw.ca/peasthope/index.html#Itinerary "
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Saturday 04 January 2014 02:00:12 Bob Walkden wrote:
You have to export individually the fields of ConfigInput.Frame if you want to use them in other modules, so it should be x*, y: INTEGER;
And the assignment would probably become x := F.ConfigInput.Frame.x which would make the source rather hard to understand and maintain. -- Met vriendelijke groeten, Jan Verhoeven http://www.verhoeven272.nl
-----Original Message----- From: Jan Verhoeven [mailto:jan@verhoeven272.nl] Sent: Saturday, 4 January 2014 11:35 AM To: ETH Oberon and related systems Subject: Re: [Oberon] undefined record field when compiling in NO.
On Saturday 04 January 2014 02:00:12 Bob Walkden wrote:
You have to export individually the fields of ConfigInput.Frame if you want to use them in other modules, so it should be x*, y: INTEGER;
And the assignment would probably become
x := F.ConfigInput.Frame.x
which would make the source rather hard to understand and maintain.
Not at all. x := F.x is fine. F is declared as type ConfigInput.Frame. Regards, Chris Chris Burrows CFB Software http://www.astrobe.com
Exporter:.... ] TYPE ] Frame* = POINTER TO RECORD (Display.Frame) ] keys: SET; ] x, y: INTEGER; ] text: Texts.Tex ] END; ]... Importer;.... ] x := F.x Compiler error:... ] pos 105 err 83 undefined record field It's useful to know *why*. The less the importer knows about the details of the imported module, the less your mental-load and scope for mistakes. In the example: Module: ConfigInput was designed so that no importer can look inside the exported:Frame. Then there's the compromise possibility of some systems: you can look inside but you can't touch it. I.e. read-only. == Chris Glur.
-----Original Message----- From: peasthope@shaw.ca [mailto:peasthope@shaw.ca] Sent: Friday, 3 January 2014 6:51 PM To: oberon@lists.inf.ethz.ch Subject: [Oberon] undefined record field when compiling in NO.
In the alpha release of NO, the compiler applied to
MODULE Test; IMPORT ConfigInput; PROCEDURE Frame(F: ConfigInput.Frame); VAR x: INTEGER; BEGIN x := F.x END Frame; BEGIN END Test.
reports compiling Test pos 105 err 83 undefined record field . This is in ConfigInput. TYPE Frame* = POINTER TO RECORD (Display.Frame) keys: SET; x, y: INTEGER; text: Texts.Text END;
So F.x in Test should be legitimate. Can anyone explain why the compiler complained?
Thanks, ... Peter E.
A feature of Oberon is that record types may be made partially visible. Although the record type Frame is visible to client modules (i.e. it is marked as with *) its elements are hidden. You can only access the individual elements of an imported record which are also marked as exported e.g. your statement would have worked if the declaration of Frame was: Frame* = POINTER TO RECORD (Display.Frame) keys: SET; x*, y: INTEGER; text: Texts.Text END; Regards, Chris Burrows CFB Software http://www.astrobe.com
participants (5)
-
Bob Walkden -
Chris Burrows -
eas lab -
Jan Verhoeven -
peasthope@shaw.ca