Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^7: Why should any one use/learn Perl 6?

by liz (Monsignor)
on Jun 11, 2018 at 20:25 UTC ( [id://1216435]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Why should any one use/learn Perl 6?
in thread Why should any one use/learn Perl 6?

Perl 6 normalizes to graphemes by default. That is, what the user thinks of as a character. A blog post by Jonathan Worthington on the subject is a good starting .point.
  • Comment on Re^7: Why should any one use/learn Perl 6?

Replies are listed 'Best First'.
Re^8: Why should any one use/learn Perl 6?
by jeffenstein (Hermit) on Jun 12, 2018 at 12:53 UTC

    Thanks for the link. I didn't see anything in there about normalizing the source code in particular, but did try a test case with the 2018.05 version of Perl 6 with good results, in case anybody is interested:

    $ cat t.p6 #!/usr/bin/env perl6 my $charé = "asdf"; if $charé { say "It Works!"; } $ perl6 t.p6 It Works!

    The source:

    $ grep \$char t.p6 | od -c 0000000 m y $ c h a r 303 251 = " a +s 0000020 d f " ; \n i f $ c h a r e 314 20 +1 0000040 { \n 0000043

    After parsing:

    $ perl6 --target=parse t.p6 | head | grep \$char | od -c 0000000 m y $ c h a r 303 251 = " a +s 0000020 d f " ; \n i f $ c h a r 303 251 0000040 { \n - E X P R : m +y 0000060 $ c h a r 303 251 = " a s d +f 0000100 " \n 0000102

      Thank you for trying!

      FWIW, there's nothing special about Perl 6 source code: when you run a script foo.pl, it's basically

      "foo.pl".IO.slurp.EVAL

      or if you're more procedurally inclined

      EVAL slurp "foo.pl"

      So the source code is handled exactly the same as any other source of text: assumed to be encoded in UTF-8 (by default) and thus normalized using synthetic graphemes if necessary. Also note that CRLF is such a synthetic grapheme

      say "\r\n".chars; # 1

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1216435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found