[Oberon] Syntax details.

Jan de Kruyf jan.de.kruyf at gmail.com
Sat Oct 20 16:51:22 CEST 2018


There were some 'features' like that in the S3 compiler in the days I still
wrote commercial Oberon code..
An intermediate variable always fixed the problem. As in your first example.

--
j.



On Sat, Oct 20, 2018 at 3:52 PM <peter at easthope.ca> wrote:

> 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
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20181020/e6c38c07/attachment.html>


More information about the Oberon mailing list