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,420cbcd8a683dc5,start X-Google-Attributes: gid103376,public From: "W. Wesley Groleau (Wes)" Subject: Re: Flexible Strings (was Equality operator...) Date: 1997/05/01 Message-ID: <9705011408.AA06677@most>#1/1 X-Deja-AN: 238661981 Sender: Ada programming language References: <199705010554.WAA24507@ni1.ni.net> Comments: To: Matthew Heaney Matthew Heaney Mailer: Elm [revision: 70.85] Newsgroups: comp.lang.ada Date: 1997-05-01T00:00:00+00:00 List-Id: (Also posted to comp.lang.ada) :> >I never had a problem implementing an Ada-83 equivalent of bounded strings :> >so that no heap was required. Did it pretty much as Matt Heaney suggested, :> >after reviewing a couple of "free" dynamic_strings packages and finding :> >that nearly every operation leaked heap. :> :> The problem with Ada 83 is that when you do need it, memory leaks are bound :> to happen, because clients often forget to clean up the data structure. The problem with the packages I was offered was that the clients COULDN'T clean up the heap. These guys had every string on the heap, and if a client wanted to say A := A & B the result was a new allocation overwriting the previous pointer in A. :> I got the "+" idea from Barnes' book. Don't think of it as a hack; think :> of it as what it is: the identity operator. It's a happy medium between :> the 2 extremes. I agree with you that automatic conversion is generally harmful. And that too much explicit conversion is information hiding of the wrong sort, i.e., hiding the abstraction in implementation clutter. The thing with "+" is more an issue of retraining one's instincts--after more than 35 years, it's hard not to think of it as something associated with quantities. But then, the strangeness of it is a point in its favor because it catches the attention. If it were routine, being only a single character, it could easily be overlooked. --------------------------------------------------------------------------- W. Wesley Groleau (Wes) Office: 219-429-4923 Hughes Defense Communications (MS 10-41) Home: 219-471-7206 Fort Wayne, IN 46808 (Unix): wwgrol@pseserv3.fw.hac.com -- SPAM should be sent to I.want.one@mailbombs.for.idiots.org If you want to be prosecuted under 27 USC 227, go ahead and send it here. ---------------------------------------------------------------------------