Re: Barewords and subscripts
Hi, This is already handled in Perl 5 - which I guess will have an influence on Perl 6. I doubt Larry is going to force everyone to quote the hash subscripts (are you Larry? :) Let a newish (6 now 12 months) non professional (unemployed student ;) Perl programmer, like myself, look at how he'd expect things to be handled - and what actually happens. Hence, I'm going through this twice... once BEFORE testing my expectations in Perl, and once AFTER. $foo{shift} vs. $foo{shift} Hmm... I think 'shift' would be taken as the key, not the function in both cases. ANS: I was correct $foo{bar} vs. sub bar() { ... } $foo{bar} As previous. vs. $foo{+bar} I think the + would cause it to fail... since it looks a little like it is part of a sum. ANS: The + forces it to an EXPR, meaning that bar is treated as a function call. However - this action still makes sense to me, since + is used to force scalar context in some places. vs. $foo{bar()} Now, this would call bar(). ANS: I was correct. vs. $foo{+bar} Easy, it's a key. vs. $foo{bar()} Easy, it's a key. and they never cause any problems? Not usually :) The rules actually do what I (think) I mean, in almost all cases. Only perlTk causes any problems since the named arguments are prefixed with minus symbols. In this instance they need quoting. Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Re: Barewords and subscripts
On Sat, Jan 26, 2002 at 10:33:54AM -0800, Peter Scott wrote: Maybe there will be a Perl 6 rule forcing the keys to be quoted, but it won't be because of the no barewords rule. If there were such a rule, I presume you'd also apply it to the LHS of =? It's only a bareword when the parser doesn't have a clue, remember? :) Here's another interesting one: Note that a token like Error::Overflow is not a bareword because it's a declared class. Perl 6 recognizes package names as symbolic tokens. So when you call a class method as Class::Name.method(), the Class::Name is actually a class object (that just happens to stringify to ``Class::Name''). What does this mean for $foo{Bar}; versus class Bar; $foo{Bar}; (I wonder what the package main equivalent to get back to a non-class environment might be) I can't help thinking that requiring quotes will make it all nice and consistent, and completely zap all these edge cases. -- A year spent in artificial intelligence is enough to make one believe in God.
Re: Barewords and subscripts
On 1/27/02 9:57 AM, Simon Cozens wrote: I can't help thinking that requiring quotes will make it all nice and consistent, and completely zap all these edge cases. Well, it'll sure make the subset of Perl programmers who have always quoted hash subscripts anyway (like me--usually with single quotes to be extra-sure nothing gets sneakily interpolated! :) a little bit happier. (or possibly just more smug ;) -John
Re: What can be hyperoperated?
Damian == Damian [EMAIL PROTECTED] writes: Damian @result = {block}^.(@data); But hyperdot sort hyperdot doesn't roll off the tongue as easy as map sort map! :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Barewords and subscripts
On 1/27/02 9:57 AM, Simon Cozens wrote: I can't help thinking that requiring quotes will make it all nice and consistent, and completely zap all these edge cases. Well, it'll sure make the subset of Perl programmers who have always quoted hash subscripts anyway (like me - usually with single quotes to be extra-sure nothing gets sneakily interpolated! :) A little bit happier. (or possibly just more smug ;) -John use draconian 'quotes'; Jonathan Paton __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Re: What can be hyperoperated?
Damian @result = {block}^.(@data); But hyperdot sort hyperdot doesn't roll off the tongue as easy as map sort map! H. You could always overload binary - to implement the sort. Then it would be: hyper dot dash dot Otherwise known in Morse circles as: hyper-r ;-) Damian
Re: Apoc4: The loop keyword
Melvin Smith wrote in perl6-language: Besides no one has commented on Steve Fink's (I think it was him) idea to store the result of the most recently executed conditional in $?. I kinda like that idea myself. It makes mnemonic sense. I like the $? idea, and it could probably be optimized away. And $? should probably be automatically temporarized to the current block (a bit like $^H in Perl 5) : if foo() { if bar() { # $? is bar() here frob(); # let's call a function that may contain # if statements } # but $? is foo() here } (is temporarized the correct word, now that local() goes away?) -- Rafael Garcia-Suarez
Re: Barewords and subscripts
At 01:16 PM 1/26/02 -0700, Tom Christiansen wrote: There is another way to resolve the ambiguity of foo meaning either foo or foo() depending on current subroutine visibility. This would also extend then to issue of $hash{foo} meaning either $hash{foo()} or $hash{foo}. Just use parens. I like this. In my experience, many programmers would prefer that all functions (perhaps restricted to only those of no arguments to appease hysterical cetaceans?) mandatorily take (even empty) parens. Count me among the crazed whales/mad dolphins/whatever you were referring to. It would make it easier to explain to beginners the rules for calling functions by eliminating a qualification (You can leave empty parens off only if perl has already seen a definition or a declaration), and it wouldn't kill me to put empty parens on argumentless function calls. % perl -MO=Deparse,-p -e 'push @foo, fred +1, -2' push(@foo, ('fred' + 1), -2); Do you see what I'm talking about? The reader unfamiliar with the particular context coercion templates of the functions used in code like use SpangleFrob; frob @foo, spangle +1, -2; can have no earthly idea how that will even *parse*. This situation seems at best, unfortunate. It seems less of a pain than the string/function ambiguity, though. I've been frequently annoyed by having to quote, say -title: start_html('-title' = Vole Sanctuary) in CGI.pm function calls when everything else is bare, and embarrassed at explaining to readers why. On the other hand, if someone uses SpangleFrob you'd think that they would have a clue how many arguments spangle and frob expected, so they should have less reason to be confused. Usually the worst trouble a programmer gets into by leaving too many parens off is: print join |, sort @foo, \n; On the other other hand, I seem to recall something about how Perl 6 should be easier to parse, and this issue is the poster child for the Only perl can parse Perl camp. Does the price of easier parseability have to be oatmeal mixed with fingernail clippings? -- Peter Scott Pacific Systems Design Technologies
Re: Barewords and subscripts
On Sun, Jan 27, 2002 at 03:44:07PM -0800, Peter Scott wrote: Count me among the crazed whales/mad dolphins/whatever you were referring to. It would make it easier to explain to beginners the rules for calling functions by eliminating a qualification (You can leave empty parens off only if perl has already seen a definition or a declaration), and it wouldn't kill me to put empty parens on argumentless function calls. There's plenty of good counter-arguments against this. I don't know what they are yet, naturally, but this is perl6-language, and so perfectly good counter-arguments have a habit of materialising out of thin air. On the other other hand, I seem to recall something about how Perl 6 should be easier to parse, and this issue is the poster child for the Only perl can parse Perl camp. That reminds me... -- I washed a sock. Then I put it in the dryer. When I took it out, it was gone. -- Steven Wright
Perl6::Tokeniser
This is my new toy. It's not perfect. I know what's lacking and I know how to fix it, but time is always against us. You don't need any documentation, you're intelligent people. Feed some code to Perl6::Tokeniser::toke, and it'll give you an array. Parser coming soon. -- It's God. No, not Richard Stallman, or Linus Torvalds, but God. (By Matt Welsh) Tokeniser.pm Description: Perl program
RE: Perl6::Tokeniser
Simon Cozens: # This is my new toy. It's not perfect. I know what's lacking and I know # how to fix it, but time is always against us. You don't need any # documentation, you're intelligent people. Feed some code to # Perl6::Tokeniser::toke, and it'll give you an array. # # Parser coming soon. Wow. Simon++. There are a few mistakes in it, though: -aren't the __FOO__ vars going away? -aren't format and formline going non-core? -isn't local being renamed to temp and wantarray being renamed to want? -where's the .. operator? Still, though, a wonderful piece of code. --Brent Dax [EMAIL PROTECTED] Parrot Configure pumpking and regex hacker Check out the Parrot FAQ: http://www.panix.com/~ziggy/parrot.html (no, it's not mine) obra . hawt sysadmin chx0rs lathos This is sad. I know of *a* hawt sysamin chx0r. obra I know more than a few. lathos obra: There are two? Are you sure it's not the same one?