On Tue, Apr 19, 2005 at 02:14:04AM +0300, wolverian wrote:
: 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
It seems like a sane thing to me, but that's a rather low standard.
: I think Perl 6 doesn't actually support that directly, but one can
: always do:
: %num_of_lines<file> = List::elems.assuming(@file);
That would need to be
%num_of_lines<file> = &List::elems.assuming(@file);
or it would assume you're trying to call a class method on a class
: 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
It looks like we're getting positional currying in addition to named,
so the syntax above should work. But as it currently stands
the invocant always has an alias of $_, so you could presumably say
%num_of_lines<file> = &List::elems.assuming(_ => @file);
: 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.
Myself, I'd rather have the possibility of list operators. But you've
probably noticed that already. :-)
: I hope I never have to design my own language. I would be schizophrenic
: before the day ends.
That's backwards. You have to be schizophrenic before the day starts.