Re: Where is stringbuilder?



On Thu, 19 Oct 2006 23:29:35 -0500, Rob Kennedy <me3@xxxxxxxxxxx>
wrote:

<snip>

Fascinating,
so VB.NET does not support the equivalent of Mid$( S$, 2, 1 ) = "x"

Dunno. You're the VB expert around here. :)

I'm afraid I've not bothered with VB.NET

Since Mid is a compiler built-in function, it could probably be
implemented the same way I expanded the Delphi assignment statement above.

Actually in VB Classic there is a lot less compiler magic than in
Delphi - a lot of things are actually Functions, one can look them up
in the Object inspector - and out scope them which can be handy.

What an odd idea
A string is just a block of memory

In Win32 Delphi, yes. In Java and .Net, no. In those, a string is an
object. If it had methods that could change its contents, then anything
that stored a reference to a string would be in danger of having that
string change later.

Right, as in old DOS BASIC, where one had a fixed pointer and length
to the real String in string space - and the 'real' data was garbage
collected.

Even so, a String is very close to an Array - well definitely so under
Delphi - so one would have expected indirection to be quite easy

It can't be solved with Delphi's copy-on-write behavior for strings,
either. Since String is now a descendant of Object, anything that can be
done to an Object can be done to a String, and the compiler can't do
anything to ensure that the object gets cloned first. The object itself
can't do anything about it, either, since it is powerless to change the
reference its methods are called on (for the same reason TObject.Free
can't set its reference to nil).

To be honest I am in two minds about Reference Counting, it works very
nicely in Delphi 4, but it might be 'gilding the lily'

Since everything appears to be an Object in .NET, this must open up
considerable problems.

Even in Win32 Delphi, a string isn't "just" a block of memory. It has
special semantics attached to it for assignment and comparison.

Yes, I follow that, another way of putting it is that in Delphi a
String is a light weight Object

There is the old Concat Function, but it is not much use for this sort
of thing.

As it turns out, the Concat function is compiler magic. It does nothing
more than invoke the same routines that the "+" operator uses.

Drat, I expected to find the source for it.

You can still find it. It's just not called Concat. The compiler will
call any of _LStrCat, _LStrCat3, and _LStrCatN, depending on how many
strings are being concatenated.

Interesting, found them, thanks
.



Relevant Pages

  • Re: DLL with string params callable via D4 and VB
    ... I can't get beyond Delphi ... >> Is there any guidance you could give in regards to passing string ... > - use Longint for integer types on the Delphi side, Long on the VBA side, ... > Arrays are another problem data type. ...
    (borland.public.delphi.language.objectpascal)
  • Re: dynamic array of string
    ... If the reference count indicates that the string is still in use, ... Delphi keeps its resources around (both the memory for the string as well as ... disposals or allocations. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Thinking Clearly
    ... often business rules change more rapidly than the technology used to ... C++ came along later we looked again since homebuilt string classes would do ... for a *very* long time MSBasic had a very stable core language. ... but if you Delphi code behaved like Delphi code ...
    (borland.public.delphi.non-technical)
  • Re: array of labels or array of buttons
    ... >>finally got a project that I can do in Delphi. ... >>time you cut and past one it asks if you want to make this an array. ... > draw the buttons in an OnDrawCell event handler of the stringgrid like ... ... > In this case I would use the Objects array of the string grid to store a value ...
    (alt.comp.lang.borland-delphi)
  • Re: Basics
    ... controls from Turbo Delphi and I managed to get things basically working ... via executing a text query and the dbgrid printing what I needed. ... I'm in position where I need to retrieve a long string and UU-hex-convert ... it into a image to the user - DBGrids help me not. ...
    (borland.public.delphi.database.ado)