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."