comp.lang.ada
 help / color / mirror / Atom feed
From: "Markus Schöpflin" <no.spam@spam.spam>
Subject: Re: Surprising behaviour of strings.fixed.overwrite
Date: Thu, 13 Nov 2014 09:15:20 +0100
Date: 2014-11-13T09:15:20+01:00	[thread overview]
Message-ID: <m41pam$9ni$1@speranza.aioe.org> (raw)
In-Reply-To: m40pt8$u5n$1@loke.gir.dk

Am 13.11.2014 um 00:19 schrieb Randy Brukardt:
> "Markus Schöpflin" <no.spam@spam.spam> wrote in message
> news:m3vdvn$uu$1@speranza.aioe.org...
>> Given the following Ada program:
> ...
>> Which is correct according to the definition of overwrite, but
>> nevertheless I find this extremely surprising.
>
> I suppose, but so what? It's not like we could change the meaning of this
> routine (or any routine in Ada.Strings), as doing so would potentially
> silently break existing code.

True, but I suspect in this case chances are that it would actually silently
fix existing code. :-)

> IMHO, the vast majority of Ada.Strings.Fixed routines are rather nonsense.
> I think they exist so that there are counterparts to the routines in
> Ada.Strings.Unbounded, but there's rarely much reason to use them rather
> than just using an appropriate slice.

That's exactly what I'm trying to avoid. I tend to get the indices wrong when
doing manual slicing; and I have already seen too much code getting it wrong, too.

> I personally use Ada.Strings.Fixed for Index and sometimes Translate or
> Move, and that's about it. Everything else I do with slices or loops
> (admittedly, I started doing that back in the Ada 83 days before
> Ada.Strings.Fixed existed, and there doesn't seem to be much reason to
> change). I find that I have to look up the definition (both the name, the
> parameters, and the semantics) for any other routine, and by the time I've
> done that, I could have written a slice that would generally be faster and
> smaller anyway.

I was hoping to eventually remember all these things when I would finally 
start consistently using the standardized methods provided by Ada.

But by now I think I'm better off creating my own set of functions and 
procedures which just do what I need, as it turns out that the standard 
implementation is rather slow, anyway.

Markus

  reply	other threads:[~2014-11-13  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 10:49 Surprising behaviour of strings.fixed.overwrite Markus Schöpflin
2014-11-12 12:55 ` G.B.
2014-11-12 15:49 ` Adam Beneschan
2014-11-12 23:19 ` Randy Brukardt
2014-11-13  8:15   ` Markus Schöpflin [this message]
2014-11-13 12:40     ` Simon Wright
2014-11-13 12:56       ` Markus Schöpflin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox