Damian Conway wrote:

> Have I missed anything?

Perhaps you've missed one thing.  It was kind of in a different branch of the
thread, about string numerification yielding NaN when given input that is "bad"
according to some definition of "badness".  It was clear from discussion that
various contributors weren't sure of exactly what types of numbers Perl 5
presently can auto-numerify from strings.  The current selection in Perl 5 is fine
for many uses, and would make a great default for Perl 6.  But it would be nice if
Perl 6 could provide a pragma to produce a warning on the first run-time
auto-numerification (compile time would be really hard to do), together with a
selection of different string numerification methods for extracting the numeric
values, for a variety of types of numeric values.

For example, one method might accept only integers, another method might allow
complex numbers, another method might allow metric suffixes for scaling, another
method might allow floating point numbers, another might allow decimal numbers
without exponents, another might allow full numeric expression evaluation (numeric
constants and operators only).  One method should work exactly as default Perl 6
numerification, allowing the user to be explicit about it without getting the
warning.  With such an option, you could choose the type of conversion based on
the type of data you expect.  I could see each of those conversion functions
taking an optional parameter defining what to return if the conversion fails...
typical values for the parameter might be undef, 0, or NaN... and I'd recommend
that omitting the parameter would cause the conversion to return undef.... easily
detectable by code that cares, converts to zero for some cases of meaningful
results (when they really might be) and compatible with most cases of not
supplying a parameter to a method.  NaN could be provided as the parameter only
under use IEEE (or whatever).

--
Glenn
=====
Due to the current economic situation, the light at the
end of the tunnel will be turned off until further notice.


Reply via email to