[Info-vax] String handling
Stephen Hoffman
seaohveh at hoffmanlabs.invalid
Sat Feb 15 15:42:44 EST 2014
On 2014-02-15 16:51:21 +0000, Simon Clubley said:
> I was asking about VMS Basic (ie: DEC/CPQ/HP Basic) not about how VMS
> implements string handling.
>
> IOW, when David talked about fixed strings in VMS Basic, did he really
> mean fixed strings in the sense of Ada's String data type in which the
> length is immutable, or did he really mean something closer to Ada's
> Bounded_String data type ?
The DEC BASIC fixed-length strings use scaler-class string descriptors,
and the string contents are exact-fit / force-fit. The text strings
are truncated or are space-padded to fit, as required.
Based on <http://en.wikibooks.org/wiki/Ada_Programming/Strings>, what
BASIC does with fixed-length strings is slightly simpler than what Ada
provides with its bound strings. Ada has two string length values
around; the current string length and the (potentially implicit)
maximum string length. With BASIC, you have one length. To achieve
what Ada offers here, you'd have to calculate the length at run-time
and maintain it in parallel to the string, if you wanted or needed the
Ada bounded string behavior.
Were this C, Macro32, Bliss or analogous, somebody would suggest just
adjusting the embedded descriptor length directly.
Programming environments that provide garbage collection can change
your view on storage allocation and management, too.
As with anything in computing, there are performance and memory
trade-offs lurking here, whether with it's scalar / static strings,
dynamic strings, or garbage-collected environments.
--
Pure Personal Opinion | HoffmanLabs LLC
More information about the Info-vax
mailing list