On Tue, 03 Oct 2017 17:52:39 -0700, c...@zoffix.com wrote:
> Perhaps it should throw when it was given trailing stuff after the
> relevant char?
> 
> 00:49   dpk     m: say unival("1\x[300]23")
> 00:49   camelia rakudo-moar 98fae3: OUTPUT: «1␤»
> 00:50   dpk     that … seems like a potential security issue for some
> apps
> 00:51           m: say unival("1\x[300]dasdsadsadsadsadasdsa")
> 00:51   camelia rakudo-moar 98fae3: OUTPUT: «1␤»

I assume it's modeled after `ord`, which also does this:

    ➜  say "Hello".ord;  # 72

...which in turn probably does it because its Perl 5 version always did it:

    $  perl -E 'say ord "Hello"
    72

Whether this is really the best thing to do, or if a warning/error would be 
better, I don't know.

Note that Perl 6 also has plural versions of all three of these though, which 
give the result for every character in the string:

    ➜  .say for "123".ords;
    49
    50
    51

    ➜  .say for "123".uninames;
    DIGIT ONE
    DIGIT TWO
    DIGIT THREE

    ➜  .say for "123".univals;
    1
    2
    3

Reply via email to