From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,54c513170bafd693 X-Google-Attributes: gid103376,public From: Ray Blaak Subject: Delphi Strings (was Re: Desirability of C++) Date: 2000/05/03 Message-ID: #1/1 X-Deja-AN: 618773913 Sender: blaak@LANGLEY References: <390DEC7F.9429C82C@online.no> <390E2A20.B647D0D6@maths.unine.ch> <8em8mb$evd$1@wanadoo.fr> <390EEF24.BD36AA24@maths.unine.ch> <8eonat$sqj3@ftp.kvaerner.com> X-Complaints-To: news@bctel.net X-Trace: news.bc.tac.net 957374926 209.53.149.68 (Wed, 03 May 2000 10:28:46 PDT) Organization: The Transcend NNTP-Posting-Date: Wed, 03 May 2000 10:28:46 PDT Newsgroups: comp.lang.ada Date: 2000-05-03T00:00:00+00:00 List-Id: Robert A Duff writes: > > I think it was the ucsd-pascal people who first got it right. > > They got some things right, and some things wrong. For example, the > limit of 255 characters is pretty annoying -- even in the bad old days > of smaller memories. For Delphi 4 and above, at least, strings by default are long strings, which an have arbitrary length (up to 2GB). They are also automatically garbage collected and shared using copy-on-write semantics. The {$H+/-} switch controls whether or not the "String" type represents long strings or short strings (i.e. max 255 chars). I find that the need to use explicitly bounded strings in Delphi programs is very very rare. Most of the time strings are just used to hold "a bunch of text". For that purpose they work very well and are pretty efficient. My only complaint is that one cannot derive distinct string types. Supposedly in Delphi one can do things like: type Name = type String; // this should be a distinct type var n : Name; s : String; begin s := 'hi there'; n := s; // I want a compile error here. end; -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@infomatch.com The Rhythm has my soul.