perl6-language
[Top] [All Lists]

Re: Quick questions on classes re S12

To: "John M. Dlugosz" <dhcgnd702@sneakemail.com>
Subject: Re: Quick questions on classes re S12
From: Jonathan Worthington <jonathan@jnthn.net>
Date: Sat, 09 Aug 2008 18:21:57 +0200
Cc: perl6-language@perl.org
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-language@perl.org
Delivered-to: perl6-language@perl.org
In-reply-to: <2276-04902@sneakemail.com>
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-language.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
References: <2276-04902@sneakemail.com>
User-agent: Thunderbird 1.5.0.14 (Windows/20071210)
Hi,

Answers as I understand things...

John M. Dlugosz wrote:
1) How do you declare a private method? I see how you call one, but not how to define one.
my method foo { ... }

1b) Is the intent that $!foo without an explicit invocant refers to self, as opposed to $.bar or .bar which refers to $_ ?
$.bar also refers to self. You'd use just .bar to do a call on $_.

2) re: has $brain;     # also declares $!brain;
Does that mean that $brain by itself refers to $self!brain ?
$!brain refers to the underlying storage location, and this declaration introduces $brain as a lexical alias to that.

Thanks,

Jonathan


<Prev in Thread] Current Thread [Next in Thread>