Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Perl 6 language -- change in hyperoperator syntax

by boo_radley (Parson)
on Dec 31, 2003 at 14:57 UTC ( #317893=perlmeditation: print w/ replies, xml ) Need Help??

the latest p6lang digest says that the hyperoperator's been changed from ^op to >>op<<. It references two threads in perl.perl6.language (1, 2). I can't, however, find any reference on this how this unholy beastie was spawned, or why it was changed -- it turns out that >>op<< is not just ugly, but it's difficult to search on and looking for "hyperoperator" yields results from 2002 and not seemingly relevant anymore.

So how did this come about? Was there a particular mnemonic involved in its creation? A bet? A dare? Should I be donating money to something to turn it back?

Comment on Perl 6 language -- change in hyperoperator syntax
Select or Download Code
Re: Perl 6 language -- change in hyperoperator syntax
by kal (Hermit) on Dec 31, 2003 at 15:10 UTC

    I agree totally, I think >>op<< sucks quite hard. This may be some kind of "I'm special, look at me!" (*bounces*) neon-flashing-light type thing to make people think about what they are doing, but that seems unPerlish. I could see myself ^op'ing a lot too, more's the pity.

    Further, it seems to be that >> and << are just long-hand for « and », irrespectively. So, I can only deduce that it's a) Larry's dastardly plan to force keyboard manufacturers to add more buttons/symbols (thus continuing the "Perl is linenoise" meme) or b) a sop to the French.

    Indeed, < and > are such troublesome characters in some scenarios that some languages (ColdFusion, *ick*) don't use them at all. Bizarro. What's worse is that <<>> is a quoting operator, so <<+>> means the string '+', which could lead to some interesting bugs.

      The reason that Coldfusion doesn't use < and > as operators because it uses them to XML-like syntax for defining operations and seperating them from the surrounding HTML:
      <CFQUERY NAME="pocket" DATASOURCE= "contents_of_my_pocket"> SELECT * FROM contents </CFQUERY> <CFSET today = DateFormat(now(), "dddd, mmmm d, yyyy")>
      --
      Clayton
Re: Perl 6 language -- change in hyperoperator syntax
by shotgunefx (Parson) on Dec 31, 2003 at 15:24 UTC
Re: Perl 6 language -- change in hyperoperator syntax
by duff (Vicar) on Dec 31, 2003 at 16:27 UTC

    Keep in mind that nothing is set in stone yet. The discussion on perl6-language and even the Apocalypses and Exegeses are all working documents subject to change. In fact, Allison Randal supossedly changes them to reflect current thinking as ideas and syntax mature.

      I know that they're all working documents, but the thing is, some bits have gotten up and started working, and once they've started working, they'll tend to stay working, I bet. That's really an aside, though.

      I'm just curious as to what the train of thought was to drop something small and relatively compact and that had decent symmetry with other operators, and move to a minimum 5 character op (for simple tasks), which seems Huffman cruddy.

        I think you mean this.

Re: Perl 6 language -- change in hyperoperator syntax
by BrowserUk (Pope) on Dec 31, 2003 at 17:08 UTC

    Oh boy. Can you imagine trying to write pod documentation for a method that uses the hyperoperator to apply a shift to an array of integers:)

    blah blah C<<<<< @ints >><<=<<1; >>>>> blah blah.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!

      Indeed. I too hope that ^op gains favor over <<op>> for situations exactly like this (or what about POD docs on a hyper here-doc? ;-). But since everything is still in flux, it's just as likely that the bit-shift operators could change instead.

      Not that it would be much prettier without being in POD.

      Makeshifts last the longest.

Re: Perl 6 language -- change in hyperoperator syntax
by elusion (Curate) on Dec 31, 2003 at 20:46 UTC
    Please, people, trust the design team. They're all working hard and they're coming up with great stuff.

    The reason a search for "hyperoperator" doesn't turn up anything new is that they're no longer called that. The new name for them is "vector operators." (Similarly, superpositions are now called junctions.) Search for that and you'll turn up newer information, though I don't think there's been as much discussion on them lately.

    Yes, the vector op has been changed from ^op to »op« or it's ASCII equivalent >>op<<. You should know that there was a lot of discussion on the syntax here, and multiple options were discussed. For a list of proposed syntaxes and their pros and cons, check out this article on google groups.

    As to why, specifically, ^op was abolished, I believe it has to do with code like this: @a ^+= @b. I don't remember what exactly the problem was off the top of my head, though I'm sure some searching could turn it up.

    As to the use of unicode as an operator, get used to it. Perl 6 source files are in unicode. This is a time of transition. You still have ASCII equivalents you can use, but they'll be a little uglier. If it was possible to make things beautiful without resorting to unicode, they'd have done it. As it is, unicode is only used in marginal cases.

      I've always been amused/irritated that programming languages inflict American English on the rest of the world. Whether you're French, Chinese, or Greek or Malay, you have to program in English: if/then/else, while, open, ... As a Canadian, I'm especially frustrated at having to use the American spelling of color, instead of colour as used by the rest of the English Speaking world ( UK, Canada, South Afric, New Zealand, Australia, etc.), ,whether I'm looking at Java, Tk, HTML or Javascript.

      So it's an interesting twist to have a unicode operator ... too bad it's a bit lengthy in ASCII. I guess/hope it will motivate people to learn to type unicode.

      --
      TTTATCGGTCGTTATATAGATGTTTGCA

        You won't have to go Unicode. Latin-1 source will work as well.
        I've always been amused/irritated that programming languages inflict American English on the rest of the world. Whether you're French, Chinese, or Greek or Malay, you have to program in English: if/then/else, while, open, ...
        When I started to learn programming, one of the first things our professor told us that while the keywords "if", "then", "else", etc might look like English words, they weren't. They were just symbols, and the fact they just happened to look like English words was something we should consider a coincidence.

        At that moment, almost 20 years ago, I thought it was a joke. But over time, I've seen it as a valuable lesson - to be able to abstract away the "English" meaning of the word, and just see the bunch of letters as a symbol.

        Abigail

      Re: Perl 6 language -- change in hyperoperator syntax by elusion
      Please, people, trust the design team.
      Sure, trust. "Trust, but verify" as my Russian ancestors said, and so I asked, having done a seemingly reasonable search first.
      They're all working hard and they're coming up with great stuff.
      True. p6lang has been a source of inspiration, wonderment and bafflement for me. for instance, this thread was a delight to pick through.
      The reason a search for "hyperoperator" doesn't turn up anything new is that they're no longer called that. The new name for them is "vector operators." (Similarly, superpositions are now called junctions.) Search for that and you'll turn up newer information, though I don't think there's been as much discussion on them lately.
      Yeah, that turned up much better results. I think I've come to peace with it since the issue seems now to be driven by desperation and only after a long, arduous debate (not that the design team would undertake such a change capriciously, mind).
      As to the use of unicode as an operator, get used to it. Perl 6 source files are in unicode. This is a time of transition. You still have ASCII equivalents you can use, but they'll be a little uglier. If it was possible to make things beautiful without resorting to unicode, they'd have done it. As it is, unicode is only used in marginal cases.
      I have no problem with unicode source, especially if it means dropping two characters off of this operator. >>foo<< looks like extreme emphasis (probably intended) and put me in mind to see, say, an aol-esque !1!! postfix operator (I kid.)
Re: Perl 6 language -- change in hyperoperator syntax
by Juerd (Abbot) on Jan 01, 2004 at 01:17 UTC

    I hate the new vector operator. That is: I like the operator, but not how it's written. Unicode's one thing, but having both <<>> and >><< is awful. Not to mention horrible to use with either POD or HTML.

    <<foo bar baz>> >>cmp<< <<quux xyzzy blah>>
    Thankfully, the grammar will be easy to change, so I'll probably just use
    qw(foo bar baz) |cmp| qw(quux xyzzy blah)
    or something like that.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re: Perl 6 language -- change in hyperoperator syntax
by Zaxo (Archbishop) on Jan 01, 2004 at 03:54 UTC

    How about borrowing vector operator glyphs from APL? They have utf8 representations. Unfortunately, I don't still remember which symbols are vector ops, but here is a random selection : ⌻ (quad-jot), ⍒ (del-stile) ⍝ (up-shoe-jot), ⍡ (up-tack-diaresis).

    How many of you actually see those in your browser?

    After Compline,
    Zaxo

      How many of you actually see those in your browser?

      I can. Opera6 with view->encoding set to 'automatic' and the CODE2000 font setup for unicode that isn't available in other fonts.

      With this combination, the glyphs (from left to right) look like

      • A front-loader washing machine.
      • A whirly-gig washing line closed for the winter.
      • A fingertip with dirty nail.
      • A '50s era wooden telegraph pole.

      If P6 is really going to use unicode operators, I can't help thinking that one of those available in this range would be more appropriate than >>op<<. But then, I guess the problem is finding one that has a reasonably intuative alternative that can be constructed from the standard ANSI set of glyphs.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Hooray!

Re: Perl 6 language -- change in hyperoperator syntax
by jryan (Vicar) on Jan 01, 2004 at 10:09 UTC

    What's with all of the commotion? This was something that almost everyone agreed was a great idea... back in October/November 2002 during the "Operator List" mega-thread. Its what's used in "Perl6 Essentials." Why is everyone acting surprised?

    So yeah, you found the right reference. The reasons for making it that are in that thread. IThe thread is several-hundred messages long, so you might have to dig for awhile to find them. If I remember correctly, Damian came up with it (I think). Work backwards, using Michael Lazzaro's operator summarys as base points. If you're having trouble, I can try to search through my mail archives to find the exact message. However, I don't feel like it doing that right now, as its 5am, its New Years Eve (well, not anymore, I guess), I just got home, and I'm still kinda drunk. But, let me know. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://317893]
Approved by gmax
Front-paged by hsmyers
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-07-14 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls