[fpc-pascal] Re: StrUtils.RomanToInt oddities

Frederic Da Vitoria davitofrg at gmail.com
Tue Sep 24 11:07:11 CEST 2013


2013/9/24 Reinier Olislagers <reinierolislagers at gmail.com>

> On 24/09/2013 09:09, Marco van de Voort wrote:
> > In our previous episode, Bart said:
> >>> Raise an exception
> >>
> >> This will break existing implementations that either expect IM to be
> >> 999, or ABC to be 0 (indicating failure), and that certainly do not
> >> expect that this function throws an exception at them.
> >
> > Yes, but since the routine probably has low utilisation I choose for
> > structuring all conversion routines all the same.
> I would rather choose for maintaining backward compatiblity, the *de
> facto behaviour* (return 0 on invalid values) as it is quite sensible
> for this kind of numbers.
>
> > Moreover I don't think that first attempts should fixate interfaces
> > and behaviour forever.
> It's quite strange though that Delphi compatibility is quite insistently
> adhered to (BTW a good decision IMO).
> The function has been in FPC stable (for presumably a while?) so I would
> really think hard before changing it.
>

I could not find any trace of it on the embarcadero web site. Wouldn't we
be taking into account a compatibility with something which does not exist,
by any chance?


 > And let's not beat about the bush: the main reason for the routine is to
> > show beginning programmers that their homework can be done using a fixed
> > function :-)
> Nice going to show beginning programmers how to break backward
> compatibility then ;)
>

Well, the alternative would be showing how to maintain buggy
implementations because you don't want to break backward compatibility :-)
Or it could show that sometimes rules have to be infringed. Or it could
show the merits of exploring thoroughly the limits of a problem before
committing code which could later place you in such a conflicting situation
(I am not throwing stones to the developer who committed this function
first, I have too often done the same mistake myself)

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130924/7dd91259/attachment.html>


More information about the fpc-pascal mailing list