Topics related to the use of Oberon language features
-
augustk
- Posts: 54
- Joined: Mon Sep 05, 2011 5:21 pm
- Location: Sweden
Post
by augustk » Sat Oct 01, 2011 10:54 am
If the path in your example is to be exported as a constant, say, it gets a bit more involved if we decide to add quotes. A module like
Code: Select all
MODULE M;
CONST path* = "C:\temp\";
END M.
will turn into something like this:
Code: Select all
MODULE M;
CONST quotes = 22X;
VAR path: ARRAY 10 OF CHAR;
PROCEDURE GetPath*(VAR out: ARRAY OF CHAR);
BEGIN
COPY(path, out)
END GetPath;
BEGIN
path := " C:\temp\ ";
path[0] := quotes;
foo[9] := quotes
END M.
It is unfortunate that character array variables cannot be exported.
-
kevinhely
- Posts: 29
- Joined: Wed May 18, 2011 3:35 am
Post
by kevinhely » Sat Oct 01, 2011 8:25 pm
Well, I'm afraid I'm not convinced that the example you gave justifies the assertion that
That 'solution' creates more problems than it solves.
The "escaping" use of the backslash character is well-established and has certainly never caused me any difficulties in path name processing in C or Java (e.g. in the compilers I've written). I understood the string you'd written in your example straight away (as I'm sure any competent C/Java programmer would). However, with the single-quote string delimiters, the code of your example would have been simpler and clearer.
I applaud the simplification achieved by the elimination of "character constants" but eliminating single-quote delimiters was unnecessarily parsimonious. (Perhaps they'll return in a later revision

)
Regards,
K.
-
augustk
- Posts: 54
- Joined: Mon Sep 05, 2011 5:21 pm
- Location: Sweden
Post
by augustk » Mon Oct 03, 2011 8:37 pm
i would vote for the introduction of a predefined procedure for (compile-time) string concatenation. This function procedure (with a variable number of parameters) could be named UNION. With this minimal addition to the language all strings can be represented. Like kevinhely, I would also like to see the reintroduction of single quotes. The constant declaration in my previous example can then be written like this:
Code: Select all
path* = UNION('"', "C:\temp\", '"')
-
kevinhely
- Posts: 29
- Joined: Wed May 18, 2011 3:35 am
Post
by kevinhely » Wed Oct 05, 2011 2:00 pm
With single quotes, your code can be

-
augustk
- Posts: 54
- Joined: Mon Sep 05, 2011 5:21 pm
- Location: Sweden
Post
by augustk » Wed Oct 05, 2011 6:48 pm
OK, you got me, but I am sure you get my point. With the compile-time concatenation procedure all strings can be represented, just as all representable booleans, numbers and sets can be denoted by constant literals. It is a matter of completeness.
-
cfbsoftware
- Site Admin
- Posts: 464
- Joined: Fri Dec 31, 2010 12:30 pm
-
Contact:
Post
by cfbsoftware » Wed Dec 24, 2014 5:27 am
augustk wrote:It is unfortunate that character array variables cannot be exported.
Export of record and array variables in read-only mode was implemented in v5.1 of Astrobe following the changes in revision Rev 1.10.2013 / 10.03.2014 of the Oberon Language Report.