[Oberon] string manipulation

spir denis.spir at gmail.com
Tue Jun 22 17:52:28 MEST 2010


On Tue, 22 Jun 2010 17:19:11 +0200
"Stauber  Sven Philipp" <sven.stauber at inf.ethz.ch> wrote:

> For those Oberon implementations (e.g. Native Oberon, A2, ...) I've seen, string representation and manipulation is mainly part of the Oberon "system", not the Oberon language.
> 
> The only things the Oberon language provides:
> 
> - string literals 
> - built-in COPY function
> - Operators: = # < <= > >= also work on 0X-terminated "strings"
> 
> More advanced string manipulation features as appending a string to another, for example, are implemented as library (as Strings.Mod in Native Oberon/A2). Even more advanced features as text representation are again part of the implementation.

Thank, this makes things clearer. Now, since I'm a bit blocked in low-level details, I would be glad to watch an implementation of a string *type* (similar to those in most Pascal variants, for instance) in any Oberon implementation.
In fact, the issue is that even if I can build a string type to manipulate strings, it is unusable in practice since no builtin function/procedure can use it, eg:
	Out.String(aText);
I thus need an additional method to return the char sequence itself:
	Out.String(aText.chars());
But such a method cannot exist since it would have to return an ARRAY OF CHAR. ;-) the impression of beeing lost inside a vicious circle.


Side-questions (playing the devil's advocate):
* Rationale to forbid using open arrays as variables or return values?
* Why no dynamic array in Oberon?
* Or even true flexible arrays like the ones data types like lists are commonly based on?


Denis
________________________________

vit esse estrany ☣

spir.wikidot.com


More information about the Oberon mailing list