Prof A Olowofoyeku (The African Chief) wrote:
On 4 Jul 2006 at 14:56, Frank Heckenbach wrote: [....]
This could be because the static nature allocates them together with the objects, while dynamic strings would be an allocation extra,
I suppose you're talking about Delphi's string variant which is only dynamic AFAIR.
I believe he is talking about AnsiStrings, not string variants.
That's what I meant. I didn't mean "variant" as in "variant record" (which would make no sense here), but as in a language variant, or dialect.
BTW, I refuse to call them AnsiStrings myself, since AFAIK no ANSI standard describes these strings, certainly not the ANSI Pascal standards.
[...]
This is not a problem in general. A hybrid system always has penalties, and people _choose_ to use it. Mostly subsystems are internally one string type, and only the interfaces between the subsystems aren't.
I hope so. OTOH, I've seen in the past a lot of BP programmers use CStrings (i.e., "PChar") throughout in their Pascal code, after they were added to BP (version 6 or 7), probably also because of Borland's marketing them as the next big thing.
They were unavoidable for WinAPI programming.
The question (as just discussed WRT short strings on Mac OS and CStrings also on Unix) is whether to use them throughout the Pascal program, or to convert strings for the interfaces. Borland could have done the latter hidden in the units, and never (or hardly ever) even exposed them to Pascal programmers. Unfortunately they did the former, perhaps in a misguided attempt to overcome the 255 chars limitation (which they did, but at the cost of big programming discomfort). But that's all past and we can't change it. Fortunately, with short strings, these kinds of issues are smaller, since the source code changes (between short strings and EP strings) are less severe.
Frank