develooper Front page | perl.perl6.language | Postings from October 2001

RE: A3, the ';' operator, and hyper-operators

Thread Previous | Thread Next
From:
Damian Conway
Date:
October 3, 2001 20:24
Subject:
RE: A3, the ';' operator, and hyper-operators
Message ID:
200110040324.NAA38230@indy05.csse.monash.edu.au

   > Set in stone, huh?  Hmm.  It may affect the parsing, but I'm not sure.
   > Perhaps we can Arbitrarily Declare that an underscore isn't allowed as
   > the last character of a symbol.  That way, you can still do $foo_$bar
   > without worrying about whitespace.

I doubt it. From E3:

	Underscore is still a valid identifier character, so you need to be
	careful about spacing it from a preceding or following identifier
	(just as you've always have with the C<x> or C<eq> operators):

	    # Perl 6 code                   # Meaning

	    $name = getTitle _ getName;     # getTitle() . getName()
	    $name = getTitle_ getName;      # getTitle_(getName())
	    $name = getTitle _getName;      # getTitle(_getName())
	    $name = getTitle_getName;       # getTitle_getName()


   > BTW, did you guys look at the possibility of overloading hyper?  $foo ^
   > $bar ought not to occur anywhere; nor should @foo ^^ @bar.  And I didn't
   > see anything about you being able to hyper =, so ^= ought to be alright
   > too.

Syntactically these would be fine, but I think the idea is: one symbol, one
operation (or family of operations). That's why Perl 5's C<^> becomes C<~> in
Perl 6. We *could* have left it as is, but this way, whenever you see a caret,
you know you're seeing a vector operation.


   > Of course.  OTOH, people will scratch their heads when they come upon
   > $foo ยง $bar or whatever.

Sure. Isn't that the point?  >;-)


   > On a separate note, how will '$foo??Bar::baz::frob' parse?

As a call to Bar::baz::frob if $foo is true, followed by
"Missing :: in ternary operation".

From E3:

        The doubling also helps it stand out better in code, in part
        because it forces you to put space around the C<::> so that it's
        not confused with a package name separator.

   
   > Since I've been complaining a lot, I'll now say a bunch of the things I
   > do like:

Yes, there *are* a great many things to like in Larry's design.
I'm glad you think so too.

Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About