Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

outdated/incorrect S12 examples

0 views
Skip to first unread message

Darren Duncan

unread,
May 28, 2006, 10:36:29 PM5/28/06
to perl6-l...@perl.org
I discovered in reading Synopsis 12 today that some code examples use
out of date syntax, as I understand it:

For example, look in the "Roles" main documentation section.

There are many places where the bareword "self" is used, whereas I
believe the current syntax is "$?SELF" for the same thing, and has
been for awhile.

For example:

self.some_other_method;

And:

any reference to C<self> or the type of the invocant

And:

C<self!attr()>

This problem may go beyond Synopsis 12, so I suggest doing a
search'n'replace in all the synopsis. Or at least in all of Synopsis
12.

I'm fairly sure the "self" syntax is invalid.

Moreover, S12 explicitly says that Perl 6 has no barewords, save
package names in specific circumstances.

-- Darren Duncan

Stuart Cook

unread,
May 28, 2006, 11:45:28 PM5/28/06
to Darren Duncan, perl6-l...@perl.org
On 5/29/06, Darren Duncan <dar...@darrenduncan.net> wrote:
> I discovered in reading Synopsis 12 today that some code examples use
> out of date syntax, as I understand it:
>
> For example, look in the "Roles" main documentation section.
>
> There are many places where the bareword "self" is used, whereas I
> believe the current syntax is "$?SELF" for the same thing, and has
> been for awhile.

Actually, I seem to recall `self` being accepted as the correct form,
though I can't remember exactly when that was.

> I'm fairly sure the "self" syntax is invalid.

It's just a 0-ary sub call, I believe.

> Moreover, S12 explicitly says that Perl 6 has no barewords, save
> package names in specific circumstances.

I think that just means P6 has no
barewords-that-are-interpreted-as-strings. You still need to use
"bareword" syntax to write things like class names and subroutine
calls, after you've declared them.

Any "syntactic bareword" without a preceding declaration is assumed to
be a list operator that will be declared later. (Syntactic barewords
are also legal just before `=>`, which autoquotes.)


Stuart

Darren Duncan

unread,
May 28, 2006, 11:56:29 PM5/28/06
to perl6-l...@perl.org
At 1:45 PM +1000 5/29/06, Stuart Cook wrote:
>On 5/29/06, Darren Duncan <dar...@darrenduncan.net> wrote:
>>There are many places where the bareword "self" is used, whereas I
>>believe the current syntax is "$?SELF" for the same thing, and has
>>been for awhile.
>
>Actually, I seem to recall `self` being accepted as the correct form,
>though I can't remember exactly when that was.

I know that 'self' was valid syntax a year ago, but afterwards only
$?SELF was allowed. Besides, the latter is visually consistent with
things like $?CLASS. And the $?SELF form just looks better besides.
It stands out more, as it should, because it is special. -- Darren
Duncan

0 new messages