it misses the point of tryxxx. >:D : Don't rely on exceptions when not needed.
it misses the point of tryxxx. >:D : Don't rely on exceptions when not needed.
Of course. StrToInt should call TryStrToInt and only then raise if needed. Not the other way around, first unnecessary raise then catch and discard it.
It's ridiculous.
That is not "implementation detail", it misses the point of tryxxx. >:D : Don't rely on exceptions when not needed.
As far as I can see, that is an introduction of dirty code in the RTL.
Note that AFAIK the tryXXX family in trunk has been recently mutilated by the use of exceptions in its implementations. Just counter-intuitive to why those were designed and not Delphi compatible. This is currently only an issue for trunk.
That is not "implementation detail", it misses the point of tryxxx. >:D : Don't rely on exceptions when not needed.
As far as I can see, that is an introduction of dirty code in the RTL.
That's particularly unfortunate, since a few weeks ago somebody- neither a newcomer to the forum nor to the language- was criticising the entire library stack due to over-use of exceptions.
How on earth did it get past review? The World wonders...
Nothing did get past review here, cause nothing like Thaddy mentioned happened.
I've looked in the rtl documentation I have and I've seen the following declarations:Maybe function IntToStr(Value: QWord) : string does the same thing as function UIntToStr(Value: QWord) : string, I don't know.
function IntToStr(Value: LongInt) : string function IntToStr(Value: Int64) : string function IntToStr(Value: QWord) : string function UIntToStr(Value: QWord) : string function UIntToStr(Value: Cardinal) : string
In addition to the fact that we have TryStrToFloat working with single, double and extended, the point presenting the above extras is that we have IntToStr functions working with 64bit integers, but we don't have TryStrToInt working with 64bit integers. This can't be good. There is no reason or hint to realize that contrary to the use of TryStrToFloat and IntToStr, a developer must use different function names when he wants to do what he expects from a TryStrToInt function.
Regarding the "TryStrTo..." functions, we have a single function name to convert strings to single, double or extended, it's TryStrToFloat.
Thank you!
In addition to this function name we have a dozen other functions but with precise names that do the same kind of thing as TryStrToInt and that support the same multiple types of strings but only one type of integer: TryStrToInt64, TryStrToQWord, TryStrToUInt64, TryStrToDWord and who knows how many others.