Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^9: Definition of numerically equal and rationale for 'you' == 'me'

by moritz (Cardinal)
on Mar 03, 2012 at 13:32 UTC ( #957670=note: print w/ replies, xml ) Need Help??


in reply to Re^8: Definition of numerically equal and rationale for 'you' == 'me'
in thread Definition of numerically equal and rationale for 'you' == 'me'

Well, everything is possible with the right amount of disambiguation rules. Perl 6 doesn't have barewords, and type names must be predeclared. If a subroutine of name x and another symbol with that name (type name, constant, enum element) are in scope, the parser disambiguates in favor of the latter, unless there are parens after the token.

In fact, constants can give you a taste of sigil-less Perl 6 already:

use v6; constant x = 4; say x x x # produces 4444

This works today in both Rakudo and Niecza.


Comment on Re^9: Definition of numerically equal and rationale for 'you' == 'me'
Select or Download Code
Re^10: Definition of numerically equal and rationale for 'you' == 'me'
by JavaFan (Canon) on Mar 03, 2012 at 14:14 UTC
    That works in Perl 5 as well:
    perl -Mconstant=x,1 -MO=Deparse -e 'print x x x' print '1' x '1'; -e syntax OK
    But:
    perl -MO=Deparse -e 'sub x {1} print x x x' sub x { 1; } print x(x(x())); -e syntax OK

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-07-10 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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








    Results (209 votes), past polls