On Mon, Apr 18, 2005 at 04:00:53PM -0700, Larry Wall wrote: > %num_of_lines<file> = [EMAIL PROTECTED]; > > : because the Perl 5 way would put a reference to @file in the hash. > : Scalar context always makes references now, from what I understand. > > Interestingly, a stored reference would track the current number of > lines rather than taking a snapshot. But you should definitely think > of it as storing a reference rather than the number of lines, because > the ref will certainly behave differently in string context. > > Larry
How sane would it be to put a reference to the instance method in the hash? I think Perl 6 doesn't actually support that directly, but one can always do: %num_of_lines<file> = List::elems.assuming(@file); I'm not sure if the currying works correctly there. How does one curry the invocant? (I'm thinking about a situation when the method doesn't specify the invocant explicitly in the signature, if that makes any difference.) I like the whole idea of bound references (to use the Pythonic term), although Python's syntax lends itself better to such use. Sometimes I wish we would require parentheses on every method and sub call. Then a reference to the method/sub would be simply its name without the parens. I hope I never have to design my own language. I would be schizophrenic before the day ends. -- wolverian
signature.asc
Description: Digital signature