Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by liz (Monsignor)
on Jun 11, 2018 at 14:03 UTC ( #1216390=note: print w/replies, xml ) Need Help??


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

...why I don't like these unicode operators: I have no idea how to enter it into my keyboard easily...

FWIW, those characters live in my TouchBar on my MacBook Pro.

...my preferred font in my preferred editor doesn't have a glyph for it...

That's not really a Perl 6 problem. I would say then that your preferred editor will have more and more problems surviving in a more and more unicodey world. Which of course means nothing about how useful it is in its current version for you and the type of work you do with it.

In any case, Perl 6 has ASCII variants for all of its operators, so if you don't want to use them, then that's fine too!

  • Comment on Re^5: Why should any one use/learn Perl 6?

Replies are listed 'Best First'.
Re^6: Why should any one use/learn Perl 6?
by haj (Hermit) on Jun 11, 2018 at 18:29 UTC
    haj: ...why I don't like these unicode operators: I have no idea how to enter it into my keyboard easily...
    liz: FWIW, those characters live in my TouchBar on my MacBook Pro.

    So, should I hop over to the Netherlands and let you type the character or steal your MacBook Pro instead?

    I apologize for mocking you. This is going off-topic towards Unicode fine-print.

    I now know that some browsers don't even show the difference between the characters in question.

    What appears in your article is a ⚛️ character, which is not what you want to use in code. The difference between "⚛️" and "⚛" is that the former is one character composed of two codepoints: The atom symbol, U+269B, and the "VARIATION SELECTOR-16", U+FE0F. U+FEOF is a zero-width symbol which enforces emoji-style display for the preceding character. In Perl 6, "⚛️".chars is 1 and "⚛️".codes is 2.

    The correct character to be used in prefix ++⚛ is the plain atom symbol U+269B. In Perl 6, "⚛".chars is 1 and "⚛".codes is also 1.

    liz: That's not really a Perl 6 problem. I would say then that your preferred editor will have more and more problems surviving in a more and more unicodey world.

    In the past, one could create nasty Perl 6 code by assigning operators to zero-width symbols, but as far as I know this is no longer possible, so I agree, it is no longer a Perl 6 problem. On the other hand, I am actually really, really happy that my editor did display the atom symbol (for which it has a glyph) and the zero-width symbol (for which it displays a "FE0F" surrogate glyph) as two separate entities, so it was rather obvious why Perl 6 complained about a "Bogus postfix".

    For fun, try to type the following into a Perl 6 interactive shell, or feed it into the Perl 6 chat. Try to figure out which of the two fails before you paste it (Looking at the page source is considered cheating):

    • my atomicint $a = 1; $a⚛++; say $a
    • my atomicint $a = 1; $a⚛️++; say $a

    I am in awe about the depth of Unicode support in Perl 6, as far as data are concerned. But I am not so happy about its use in code.

      So, should I hop over to the Netherlands and let you type the character or steal your MacBook Pro instead?

      You're welcome to try :-) But seriously, my point was that in the future there will be more ways to enter Unicode characters. Now, how that VARIATION SELECTOR-16 got there, it looks like it is a new feature of High Sierra :-( I've recently upgraded and am 100% sure it would not add the VARIATION SELECTOR-16 before. Grrr. It even does that from the Symbols viewer. Double Grrr.

      Thank you for spotting this. Wonder whether we would need to fix this in Perl 6 (so that it wouldn't matter if there is a VARIATION SELECTOR after it or not.

      With regards to possible confusion, that's also possible in the ASCII world: e.g. atomic-inc-fetch($ok) versus atomic_int_fetch or atonic-inc-fetch.

        liz: With regards to possible confusion, that's also possible in the ASCII world: e.g. atomic-inc-fetch($ok) versus atomic_int_fetch or atonic-inc-fetch.
        So true! I guess we all have been through that: 0 or O? l or 1 or |? _ or -? I try to make this more bearable by choosing a suitable font: This works reasonably well with the limited set of glyphs in ASCII, but is a considerable challenge for Unicode.
Re^6: Why should any one use/learn Perl 6?
by jeffenstein (Pilgrim) on Jun 11, 2018 at 19:33 UTC

    Maybe I'm just unlucky, but on my Windows desktop for work I couldn't get any of the standard fixed-width fonts to display this glyph. I tried it in both gvim and putty, with no luck.

    Does Perl 6 normalize the code points (like Unicode::Normalize) before it parses the code? haj might have answered that question

        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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2019-08-25 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?