Re: [svn:perl6-synopsis] r13567 - doc/trunk/design/syn
Larry Wall schreef: > Dr.Ruud wrote: >> I would expect >> >> %hash.exists{$key} > > Except $foo.bar{$key} is interpreted as $foo.bar().{$key}. Things > like "exists" and "delete" need to evaluate the key before calling > the method in question, not after. OK. >> with the shortcut >> >> %hash.:{$key} >> >> to test (at run-time) for existance of the element, and expect >> >> %hash.:exists >> >> to test (at compile time if possible) for the validity of 'exists', >> more like >> >> %hash.can('exists'); >> >> %hash.has('exists'); >> >> %hash.does('exists'); > > Why would you expect colon to do that? I don't see the prior art... I was reading : as TEST (or indeed STATUS, or even STATE), and read the part ":exists" a "the STATUS (or validity) of exists()", which would always be true (or >0) because exists() is in the "hash-core". So "%table.:$key" or "%table.:{$key}" would then be short for "%table.exists{key}" (assuming exists() to be the default TEST/STATUS/STATE-method for hash). -- Affijn, Ruud "Gewoon is een tijger."
Re: [svn:perl6-synopsis] r13567 - doc/trunk/design/syn
On Fri, Feb 02, 2007 at 08:14:53PM +0100, Dr.Ruud wrote: : I would expect : : %hash.exists{$key} : Except $foo.bar{$key} is interpreted as $foo.bar().{$key}. Things like "exists" and "delete" need to evaluate the key before calling the method in question, not after. : with the shortcut : : %hash.:{$key} : : to test (at run-time) for existance of the element, and expect : : %hash.:exists : : to test (at compile time if possible) for the validity of 'exists', more : like : : %hash.can('exists'); : : %hash.has('exists'); : : %hash.does('exists'); Why would you expect colon to do that? I don't see the prior art... Larry
Re: [svn:perl6-synopsis] r13567 - doc/trunk/design/syn
[EMAIL PROTECTED] schreef: > Just glad someone's reading these things... Of course we are. But it is hard to react when the syntax isn't in your muscle memory yet. >From r13565: > +%hash.:exists{$key} I would expect %hash.exists{$key} with the shortcut %hash.:{$key} to test (at run-time) for existance of the element, and expect %hash.:exists to test (at compile time if possible) for the validity of 'exists', more like %hash.can('exists'); %hash.has('exists'); %hash.does('exists'); -- Affijn, Ruud "Gewoon is een tijger."
[svn:perl6-synopsis] r13567 - doc/trunk/design/syn
Author: larry Date: Fri Feb 2 09:07:05 2007 New Revision: 13567 Modified: doc/trunk/design/syn/S05.pod Log: Nick++ noticed where I spaced out. Just glad someone's reading these things... Modified: doc/trunk/design/syn/S05.pod == --- doc/trunk/design/syn/S05.pod(original) +++ doc/trunk/design/syn/S05.podFri Feb 2 09:07:05 2007 @@ -728,7 +728,7 @@ If the hash has the property "is parsed(...)", the pattern provided is considered to wrap every match, where the key match is represent -by C and the value matchis represented by C. (C, +by C and the value match is represented by C. (C, if present, must come at the beginning. If omitted, the key must be explicitly reparsed by this rule or by the value rule. If C is omitted, it is assumed to be at the end.) The intent of this