Yeah, I commented above that I had forgotten strict and mistakenly thought Inf was parsed as a number.

But, this is my point - right now the character is illegal in a perl script, and there's no reason (that I can guess, having not looked at perl's internals yet) that the language parser couldn't use that as a permitted character for numeric literals. It would be a little different from 'inf' in that it would be parsed as the constant rather than a lexical function that returns a constant, so like "-∞" would immediately become an NV, where "-inf" is a negation of a function call that hopefully gets resolved to an NV during compiler optimizations.

Edit

I mean exactly this :-)

$ git diff --cached diff --git a/toke.c b/toke.c index e6ff0c4f74..4590774e44 100644 --- a/toke.c +++ b/toke.c @@ -9174,6 +9174,13 @@ yyl_try(pTHX_ char *s) return tok; goto retry_bufptr; } + if (UTF && s + 2 < PL_bufend && *s == '\xE2' && s[1] == '\x88' + && s[2] == '\x9E') { + pl_yylval.opval = newSVOP(OP_CONST, 0, newSVnv(NV_INF)); + s += 3; + if (PL_expect == XOPERATOR) + no_op("Number",s); + TERM(THING); + } yyl_croak_unrecognised(aTHX_ s); case 4:

$ PERLLIB=lib ./perl -E 'use utf8; say;'
Inf
$ PERLLIB=lib ./perl -E 'use utf8; say -;'
-Inf

In reply to Re^2: Unicode infinity by NERDVANA
in thread Unicode infinity by NERDVANA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.