Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

perl 6 craziness

Name: Anonynus 2011-01-28 1:17

The ability to define your own operators, like in haskell, is a
very nice language feature. Perl 6 allows that too but it goes
too far. It allows you to define all kinds of weird operators (e.g., infix, postfix, prefix, postcircumfix, metaoperators ... ).

For instance there's the '=' metaoperator. It acts like the well
known '+=', '*=' etc. except it (theoretically) works for all
operators.

Some examples:

my $a = "foo "; # $a => "foo "
$a.chop; # $a => "foo "
$a.=chop; # $a => "foo"

my $b = "bar"; # $b => "bar"
$b => 1; # $b => "bar"
$b =>= 1; # $b => ("bar" => 1)


So far that's quite nice but now it gets ugly:

my $c = 1; # $c => 1
$c >=; # $c => 1

Here '>=' is itself an operator and thus is given priority over the '=' postfix operator.

$c >== 2; # $c => False

Here it works again.


$c = 1; $c <== 2; # throws an error

You'd probably expect this to work too but '<==' is the feed operator and takes priority.

You can also use letters in your operators:

sub postfix:<foobar> ($x) {$x + 1}
2foobar; # => 4
$c = 2; $cfoobar; # error, no such variable
postfix:<foobar> $c; # => 4


Now whenever you introduce a new operator you have to check that you don't break any of the myriad combinations of the operators you already have (e.g., Zmax, xx=, X=>, >>== ... ).

Name: Anonymous 2011-01-28 1:38

10 GET

NO EXCEPTIONS

Name: Anonymous 2011-01-28 1:47

>>1
Perl
goes too far

POLECAT KEBAGS

Name: Anonymous 2011-01-28 1:56

If I'm not mistaken perl 6 already allows runtime modifications
to the parser so I think they should just remove all custom
operators (except maybe the regular infix operator). That way at
least you can only screw up your syntax in unimaginable ways if
you touch arcane features (like the aforementioned parser
modifications).

Name: Anonymous 2011-01-28 2:04

Arcane features... reminds me of wizards, Perl wizards.

Name: Anonymous 2011-01-28 2:14


            o                                             
                 O       /`-.__                           
                        /  \.'^|                          
           o           T    l  *                          
                      _|-..-|_                            
               O    (^ '----' `)     I CONJURE THE SPIRITS
                     `\-....-/^      OF MY COMPUTER WITH PERL!
           O       o  ) "/ " (      /                     
                     _( (-)  )_                           
                 O  /\ )    (  /\                         
                   /  \(    ) |  \                        
               o  o    \)  ( /    \                       
                 /     |(  )|      \                      
                /    o \ \( /       \                     
          __.--'   O    \_ /   .._   \                    
         //|)\      ,   (_)   /(((\^)'\                   
            |       | O         )  `  |                   
            |      / o___      /      /                   
           /  _.-''^^__O_^^''-._     /                    
         .'  /  -''^^    ^^''-  \--'^                     
       .'   .`.  `'''----'''^  .`. \                      
     .'    /   `'--..____..--'^   \ \                     
    /  _.-/                        \ \                    
.::'_/^   |                        |  `.                  
       .-'|                        |    `-.               
 _.--'`   \                        /       `-.            
/          \                      /           `-._        
`'---..__   `.                  .`_.._   __       \       
         ``'''`.              .'gnv   `'^  `''---'^       
                `-..______..-'

Name: Anonymous 2011-01-28 8:30

I'm astounded that this is such a novel concept to y'all.

Name: Anonymous 2011-01-28 9:57

$c > =;
$c >= =2;
$c <= =2;

Name: Anonymous 2011-01-28 11:39

http://www2.research.att.com/~bs/whitespace98.pdf
How long until Perl6 allows overloading whitespace?

Name: Anonymous 2011-01-28 12:12

>>9
It will not be long until C++ turns into a "Write your own language for dummies" toolkit.

Name: Anonymous 2011-01-28 12:17

THIS IS MADDNESS!!!

sub postfix:<;> (Int $n) { $n + 1 }; say 3;
OUTPUT: 4

Name: Anonymous 2011-01-28 12:17

f >=> return ≡ f
return >=> f ≡ f
(f >=> g) >=> h ≡ f >=> (g >=> h)

Name: Anonymous 2011-01-28 12:24

>>12

role Monad {
   multi sub return ($x);
}
multi sub infix:«>=>» (Monad $m, &f);


U MENA PERL6!

Name: Anonymous 2011-01-28 12:27

class Perl6 is Perl but Cool { ...; }

Name: Anonymous 2011-01-28 12:28

sub prefix:<hax> ($what) {  " HAX MY " ~ $what }; say hax "anus";

Name: Anonymous 2011-01-28 15:06

>>12

(equal? (>>= 2 return) 2)
(equal? (>>= (return 3) return) (return 3))
(let ((f (λ (x) (return (add1 x)))))
  (equal? (>>= (>>= (return 3) f) f)
          (>>= (return 3) (λ (x) (>>= (f x) f)))))

Name: Anonymous 2011-01-28 19:41

multi sub postfix:<;> ($x) { die() } ; # be careful about semicolon placement, bitches.

Name: Anonymous 2011-01-28 20:32

>>3
fuck off you cock sucking faggot

Name: Anonymous 2011-01-29 1:37

What's that release date for Perl 6 again? The 12th of never, you say?
I'm still calling vaporware.

Name: Anonymous 2011-01-29 7:45

>>19
Before Christmas. There was a release yesterday. Tip: almost all of the Perl 6 code posted to /prog/[/spoiler] has been tested to work.[/spoiler]

Name: >>20 2011-01-29 7:47

Most of the BBCode, on the other hand, has not.

Name: Anonymous 2011-01-31 19:44

<-- check em dubz

Name: Anonymous 2011-07-31 13:25

>>22
nice dubs...bro

Name: Anonymous 2011-07-31 14:15

>>11
If you're overloading a semicolon, nothing can help you.
even Perl

Name: Anonymous 2011-07-31 14:22

my $c = 1; $c >== 2; say $c

Can't make assignment out of >= because chaining operators are diffy at /tmp/3WqZa0yz2t line 1

Your point again, OP?

Name: Anonymous 2011-07-31 15:25

Perl is becoming Lisp. Stop using it while you still can.

Name: Anonymous 2011-07-31 17:24

>>26
Uh. No. What the fuck.

Name: Anonymous 2011-07-31 19:25

>>27
You must be new around here.

Name: Anonymous 2011-08-02 0:46

>>26,28
Back to /g/, please.

Name: Anonymous 2011-09-22 1:09


            o                                             
                 O       /`-.__                           
                        /  \.'^|                          
           o           T    l  *                          
                      _|-..-|_                            
               O    (^ '----' `)     I CONJURE THE SPIRITS
                     `\-....-/^      OF MY COMPUTER WITH PERL!
           O       o  ) "/ " (      /                     
                     _( (-)  )_                           
                 O  /\ )    (  /\                         
                   /  \(    ) |  \                        
               o  o    \)  ( /    \                       
                 /     |(  )|      \                      
                /    o \ \( /       \                     
          __.--'   O    \_ /   .._   \                    
         //|)\      ,   (_)   /(((\^)'\                   
            |       | O         )  `  |                   
            |      / o___      /      /                   
           /  _.-''^^__O_^^''-._     /                    
         .'  /  -''^^    ^^''-  \--'^                     
       .'   .`.  `'''----'''^  .`. \                      
     .'    /   `'--..____..--'^   \ \                     
    /  _.-/                        \ \                    
.::'_/^   |                        |  `.                  
       .-'|                        |    `-.               
 _.--'`   \                        /       `-.            
/          \                      /           `-._        
`'---..__   `.                  .`_.._   __       \       
         ``'''`.              .'gnv   `'^  `''---'^       
                `-..______..-'


--------------------------------------------------------------------------------

Name: Anonymous 2011-09-22 2:20

I don't know whether I'm >>1. It's a very strange feeling.

Name: Anonymous 2011-09-22 2:20


            o                                            
                 O       /`-.__                          
                        /  \.'^|                         
           o           T    l  *                         
                      _|-..-|_                           
               O    (^ '----' `)     I CONJURE THE SPIRITS
                     `\-....-/^      OF MY COMPUTER WITH PERL!
           O       o  ) "/ " (      /                    
                     _( (-)  )_                          
                 O  /\ )    (  /\                        
                   /  \(    ) |  \                       
               o  o    \)  ( /    \                      
                 /     |(  )|      \                     
                /    o \ \( /       \                    
          __.--'   O    \_ /   .._   \                   
         //|)\      ,   (_)   /(((\^)'\                  
            |       | O         )  `  |                  
            |      / o___      /      /                  
           /  _.-''^^__O_^^''-._     /                   
         .'  /  -''^^    ^^''-  \--'^                    
       .'   .`.  `'''----'''^  .`. \                     
     .'    /   `'--..____..--'^   \ \                    
    /  _.-/                        \ \                   
.::'_/^   |                        |  `.                 
       .-'|                        |    `-.              
 _.--'`   \                        /       `-.           
/          \                      /           `-._       
`'---..__   `.                  .`_.._   __       \      
         ``'''`.              .'gnv   `'^  `''---'^      
                `-..______..-'

Name: Anonymous 2011-09-22 4:23

>>31
Wow I know that feel sometimes too. I thought I was crazy. Maybe we are...

Name: Anonymous 2011-09-25 2:37

>>22-23
Fuck off, spammer.

Name: Anonymous 2012-08-06 17:40

le shiggy face

Don't change these.
Name: Email:
Entire Thread Thread List