Short Strings, Schema discriminants, UCSD Pascal (Was: Modifying string length?)

Sat, 3 May 1997 23:45:10 +0200 (MET DST)


According to Frank Heckenbach:
>
> [...] Then perhaps it would be
> useful to allow the same syntax also for ShortStrings (additionally), just
> as if ShortString[n] was declared as:
> 
> record
>  case boolean of
>   false:(CurrentLength:byte);
>   true:(string:array[0..n] of char);
> end;
>
> Also, it could be good to provide a (read-only) "pseudo field" Capacity.
> [...]
> These two things would make ShortStrings more similar to (and often
> exchangeable with) LongStrings, without giving up BP compatibility.

Good ideas, but a lot of work ...

> (BTW: LongStrings' Capacity is always read-only, isn't it?)

It is not.  Probably it should be - somebody knows?  And for other schema
discriminants?

> BP 7.0 allows this via High(s) -- is something like BP's High and Low
> functions (to give the lower and upper bounds of arrays and subrange types)
> present or planned for gpc?  [...]

Yes.

> [...]  So, perhaps better forget about the #0 with ShortStrings, and add
> it when converting to other strings...

I think that's the way to go.

> But UCSD was non-standard, too, wasn't it? Just out of curiosity, it doesn't
> really matter to me.

UCSD Pascal was developed at the University of California San Diego
(UCSD), not by a company, that's why I consider it as a well-defined
standard, although no ISO standard.  I have read about a company "SofTech"
distributing UCSD Pascal, and I got mine from Apple as "Apple Pascal".
If somebody has some more exact information, I would be glad to know.

Greetings,

    Peter

  Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
 maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es