[Oberon] Syntax details.

peter at easthope.ca peter at easthope.ca
Sat Oct 20 15:51:34 CEST 2018


In S3 this works.

MODULE Test;
	IMPORT Oberon, Texts, TextFrames, Out, Viewers;
	VAR
		nameS: Texts.Scanner;
	PROCEDURE Test*;
		VAR
			v: Viewers.Viewer;
	BEGIN
		v := Oberon.MarkedViewer();
		Texts.OpenScanner(nameS, v.dsc(TextFrames.Frame).text, 0);
		Texts.Scan(nameS);
		Out.String("Marked viewer is named "); Out.String(nameS.s); Out.Char("."); Out.Ln
	END Test;
BEGIN
END Test.

Mark the viewer and Test.Test *

This is more succinct but gives the error "incompatible assignment". 
Edit.Locate leaves the caret after ().

MODULE Test IN Oberon;
	IMPORT Oberon, Texts, TextFrames, Out, Viewers;
	VAR
		nameS: Texts.Scanner;
	PROCEDURE Test*;
		VAR
			v: Viewers.Viewer;
	BEGIN
		Texts.OpenScanner(nameS, Oberon.MarkedViewer().dsc(TextFrames.Frame).text, 0);
		Texts.Scan(nameS);
		Out.String("Marked viewer is named "); Out.String(nameS.s); Out.Char("."); Out.Ln
	END Test;
BEGIN
END Test.

In the Oberon subsystem of A2, the preceeding compiles with no error.
Anything interesting to learn from that?

The (TextFrames.Frame) type cast seems a little devious.
Can the result be accomplished without a type cast?

Thanks,             ... Lyall E.
 

-- 
Message composed and transmitted by software designed to avoid the 
need, overhead and vulnerability of antivirus software.

123456789 123456789 123456789 123456789 123456789 123456789 123456789
Tel: +1 360 639 0202                                  +1 
http://easthope.ca/Peter.html              Bcc: peter at easthope. ca


More information about the Oberon mailing list