Re: One-pass parsing and forward type references

2010-02-02 Thread Larry Wall
On Mon, Feb 01, 2010 at 06:12:16PM -0800, Jon Lang wrote: : Larry Wall wrote: : But also note that there are several other ways to predeclare : types implicitly.  The 'use', 'require', and 'need' declarations : all introduce a module name that is assumed to be a type name. : : Just to clarify:

Re: One-pass parsing and forward type references

2010-02-01 Thread Moritz Lenz
Carl Mäsak wrote: But on another level, the level of types, Perl 6 makes it fairly *un*natural that the type CFoo refers to the type CBar, which in turn refers to the type CFoo. True, and that has also been bothering me quite a bit. The solution is to always write ::Typename instead of

Re: One-pass parsing and forward type references

2010-02-01 Thread Carl Mäsak
Moritz (), Carl (): But on another level, the level of types, Perl 6 makes it fairly *un*natural that the type CFoo refers to the type CBar, which in turn refers to the type CFoo. True, and that has also been bothering me quite a bit. The solution is to always write ::Typename instead of

Re: One-pass parsing and forward type references

2010-02-01 Thread Patrick R. Michaud
On Sun, Jan 31, 2010 at 06:35:14PM +0100, Carl Mäsak wrote: I found two ways. Either one uses Caugment (the language construct formerly known as Cis also): class B {} class A { sub foo { B::bar } } augment class B { sub bar { A::foo } } ...or one may use the C:: notation to index a

Re: One-pass parsing and forward type references

2010-02-01 Thread Carl Mäsak
Patrick (), Carl (): I found two ways. Either one uses Caugment (the language construct formerly known as Cis also):   class B {}   class A { sub foo { B::bar } }   augment class B { sub bar { A::foo } } ...or one may use the C:: notation to index a type using a string value:   class A {

Re: One-pass parsing and forward type references

2010-02-01 Thread Jan Ingvoldstad
On Mon, Feb 1, 2010 at 17:46, Patrick R. Michaud pmich...@pobox.com wrote: There's a third way: class B { ... }# introduce B as a class name without definition class A { sub foo { B::bar } } class B { sub bar { A::foo } } The first line is a literal ... in the body of the

Re: One-pass parsing and forward type references

2010-02-01 Thread Larry Wall
Please don't assume that rakudo's idiosyncracies and design fossils are canonical. STD does better namespace management in some respects, particularly in accepting the approved predeclaration form: class Foo {...} (and rakudo might now accept this too). You don't want to use augment for

Re: One-pass parsing and forward type references

2010-02-01 Thread Matthew Wilson
On Mon, Feb 1, 2010 at 9:32 AM, Larry Wall la...@wall.org wrote: But I also think that type recursion is likelier to indicate a design error than function recursion, so I'm not sure how far down this road we want to go.  We could, for instance, create a new type name every I was going to say I

Re: One-pass parsing and forward type references

2010-02-01 Thread yary
A slight digression on a point of fact- On Mon, Feb 1, 2010 at 9:32 AM, Larry Wall la...@wall.org wrote: ... You are correct that the one-pass parsing is non-negotiable; this is how humans think, even when dealing with unknown names. It's common for people to read a passage twice when

Re: One-pass parsing and forward type references

2010-02-01 Thread Larry Wall
On Mon, Feb 01, 2010 at 10:10:11AM -0800, yary wrote: : A slight digression on a point of fact- : : On Mon, Feb 1, 2010 at 9:32 AM, Larry Wall la...@wall.org wrote: : ... : You are correct that the one-pass parsing is non-negotiable; this is : how humans think, even when dealing with unknown

Re: One-pass parsing and forward type references

2010-02-01 Thread Patrick R. Michaud
On Mon, Feb 01, 2010 at 05:55:47PM +0100, Carl Mäsak wrote: Is it allowed to do 'class B { ... }' several times in different files before finally declaring the real B? If so, then I'd consider it equivalent to my proposed keyword, and thus there'd be no need for the latter. Yes. And

Re: One-pass parsing and forward type references

2010-02-01 Thread Solomon Foster
On Mon, Feb 1, 2010 at 3:46 PM, Patrick R. Michaud pmich...@pobox.com wrote: On Mon, Feb 01, 2010 at 05:55:47PM +0100, Carl Mäsak wrote: Is it allowed to do 'class B { ... }' several times in different files before finally declaring the real B? If so, then I'd consider it equivalent to my

Re: One-pass parsing and forward type references

2010-02-01 Thread Patrick R. Michaud
On Mon, Feb 01, 2010 at 05:56:09PM +0100, Jan Ingvoldstad wrote: On Mon, Feb 1, 2010 at 17:46, Patrick R. Michaud pmich...@pobox.com wrote: There's a third way: class B { ... }# introduce B as a class name without definition class A { sub foo { B::bar } } class B { sub

Re: One-pass parsing and forward type references

2010-02-01 Thread Larry Wall
On Mon, Feb 01, 2010 at 03:55:15PM -0500, Solomon Foster wrote: : On Mon, Feb 1, 2010 at 3:46 PM, Patrick R. Michaud pmich...@pobox.com wrote: : On Mon, Feb 01, 2010 at 05:55:47PM +0100, Carl Mäsak wrote: : Is it allowed to do 'class B { ... }' several times in different files : before finally

Re: One-pass parsing and forward type references

2010-02-01 Thread Carl Mäsak
Larry (): [Long exposition on the philosophy of predeclaration] Hope this helps, or I just wasted a lot of time.  :-) It did help. Thanks. A comment on one part, though: But I also think that type recursion is likelier to indicate a design error than function recursion [...] I do too. A

Re: One-pass parsing and forward type references

2010-02-01 Thread Larry Wall
On Tue, Feb 02, 2010 at 12:23:50AM +0100, Carl Mäsak wrote: : Another thing I started thinking about: if Perl 6 professes to be able : to put on the hat -- syntactically and semantically -- of most any : other programming language out there, through the use of a simple 'use : Language::Java' or

Re: One-pass parsing and forward type references

2010-02-01 Thread Jon Lang
Larry Wall wrote: But also note that there are several other ways to predeclare types implicitly.  The 'use', 'require', and 'need' declarations all introduce a module name that is assumed to be a type name. Just to clarify: it's possible to define a module within a file, rather than as a

One-pass parsing and forward type references

2010-01-31 Thread Carl Mäsak
There's one thing that bugs me ever so slightly. I'll just air it and happily accept whatever feedback it produces. This email is somewhat of a third-strike thing: looking back, I've been muttering over this itch both on IRC and on Twitter during the past year. masak sometimes one-pass parsing