Perl 6 Summary for 2005-08-02 through 2005-08-10

2005-08-10 Thread Matt Fowles
Perl 6 Summary for 2005-08-02 through 2005-08-10 All~ Welcome to another summary, brought to you by chinese food. The attentive among you will notice that this summary is a day late, because I did not feel like doing it yesterday. If only I could do that at work... Perl 6 Co

Re: my $pi is constant = 3;

2005-08-10 Thread Larry Wall
On Wed, Aug 10, 2005 at 11:48:16PM +0200, TSa wrote: : Only that ?$b is not marked is constant? Strange that is. Straight out of the apocalypse--parameters default to constant. Larry

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:31:40PM +0200, TSa wrote: > >my $x is typed; > >$x = "123"; > >$x = length($x); > > > >Would be a type error. If it's in the dynamic world (as in Perl5), > >that's just fine. Does that difference make sense to you? > > The question remains, when exactly doe

RE: $object.meta.isa(?) redux

2005-08-10 Thread Sam Vilain
On Wed, 2005-08-10 at 21:00 -0400, Joe Gottman wrote: >Will there be an operator for symmetric difference? I nominate (^). That makes sense, although bear in mind that the existing Set module for Perl 6, and the Set::Scalar and Set::Object modules for Perl 5 use % for this (largely due to ove

RE: $object.meta.isa(?) redux

2005-08-10 Thread Joe Gottman
> -Original Message- > From: Luke Palmer [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 10, 2005 11:53 AM > To: TSa > Cc: Perl6 Language List > Subject: Re: $object.meta.isa(?) redux > > > A new development in perl 6 land that will make some folks very happy. > There is now a Set

Re: "set" questions -- Re: $object.meta.isa(?) redux

2005-08-10 Thread Flavio S. Glock
I wonder if infinite sets (recurrences) will be supported - then I'll move all(ext/Recurrence, ext/Span, ext/Set-Infinite) to Perl6::Container::Set::Ordered - cool. - Flavio S. Glock 2005/8/10, Dave Whipp <[EMAIL PROTECTED]>: > Luke Palmer wrote: > > > A new development in perl 6 land that will

Re: my $pi is constant = 3;

2005-08-10 Thread TSa
HaloO, Larry Wall wrote: In this case it desugars to my $pi is constant = 3; :-) In other words the assignment to a my turns into an ordinary assignment that happens at runtime. Hopefully, since $pi is marked constant, it could be optimized to a binding in many cases, but that's not the

Set operators in Perl 6 [was Re: $object.meta.isa(?) redux]

2005-08-10 Thread Dave Rolsky
[changing the subject line for the benefit of the summarizer ...] On Wed, 10 Aug 2005, Larry Wall wrote: And now some people will begin to wonder how ugly set values will look. We should also tell them that lists (and possibly any-junctions) promote to sets in set context, so that the usual way

Re: $object.meta.isa(?) redux

2005-08-10 Thread Dave Rolsky
On Wed, 10 Aug 2005, Luke Palmer wrote: A new development in perl 6 land that will make some folks very happy. There is now a Set role. Among its operations are (including parentheses): (+) Union (*) Intersection (-) Difference (<=) Subset (<) Proper subset (>=) Sup

Re: my $pi is constant = 3;

2005-08-10 Thread Larry Wall
On Thu, Aug 11, 2005 at 02:22:04AM +0800, Autrijus Tang wrote: : According to S06: : : my $pi is constant = 3; Perhaps the actual rewrite is my $pi is constant({ 3 }); much like state $where = $California; is desugared to state $where is first({$California}); or some such, a

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread TSa
HaloO Autrijus, you wrote: I think that's because you live in the static realm already. :) Perhaps, but if yes it is an infinite one. my $x is typed; $x = "123"; $x = length($x); Would be a type error. If it's in the dynamic world (as in Perl5), that's just fine. Does that di

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread TSa
HaloO, Larry Wall wrote: It might be a mistake to call these isa relationships though. I really only care about Package does Object. Module does Package. Role does Module. Class does Role. OK, I've added that and the Set type in my little type lattice. With your Object still

Re: my $pi is constant = 3;

2005-08-10 Thread Larry Wall
On Thu, Aug 11, 2005 at 02:22:04AM +0800, Autrijus Tang wrote: : According to S06: : : my $pi is constant = 3; : : Is this a special form? I believe any assignment to a declarator is potentially a special form, or we can't get assignment to "has" and "state" to work right. : If yes, what do

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 09:29:38PM +0200, TSa wrote: > >Finally, it would get tedious to write them out by hand. So a lexical > >"traits" pragma may help: > > > >{ > > # Entering the realm of referential transparency... > > use traits < defined typed constant >; > > my $x; # autom

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread TSa
HaloO, Autrijus Tang wrote: So I'm starting to write the inferencer. Immediately I encounter the problem that every type can potentially contain "undef": This is the reason why I've bounded Undef below Item disjoint with Value in my type lattice. Of course all types are applicable as type par

Re: $object.meta.isa(?) redux

2005-08-10 Thread Larry Wall
On Tue, Aug 09, 2005 at 10:55:05PM -0400, Stevan Little wrote: : >So why not just use "describes"? Then maybe Object.isa(Foo) delegates : >to $obj.meta.describes(Foo). : : I like that, but is it appropriate for subclasses as well? Well, I suppose we could hedge it as part of a collaboration:

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 11:24:05AM -0700, Larry Wall wrote: > : My current understanding is that the typechecker considers IO to be of > : Class type, not of IO type; the fact that IO.does(IO) is true is purely > : an illusion created by special dispatch for .does. > > Well, that's what I thought

Re: "set" questions -- Re: $object.meta.isa(?) redux

2005-08-10 Thread Larry Wall
On Wed, Aug 10, 2005 at 11:24:02AM -0700, Dave Whipp wrote: : Do Sets get a sigil? Probably not. unicode : I'd guess that % would be appropriate, because a : hash is simply "Set of Pair" where the membership equivalence class is : simply $^member.key. What syntax is used to associate the equiv

Re: $obj.meta.add_method('foo' => ???)

2005-08-10 Thread Autrijus Tang
On Tue, Aug 09, 2005 at 06:32:52PM -0400, Stevan Little wrote: > Now I realize that in perl 6 you can re-open classes and add methods to > them. However this is not convenient for programmatic class generation. Because of string eval, you mean? Well, some quasiquoting should fix that, but let's

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Larry Wall
On Thu, Aug 11, 2005 at 01:24:11AM +0800, Autrijus Tang wrote: : On Wed, Aug 10, 2005 at 10:12:45AM -0700, Larry Wall wrote: : > We can get away with this in Perl 6 because bindings to positionals : > happen lazily. So all we have to check for syntactically is that we : > don't have a subsequent d

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Larry Wall
On Thu, Aug 11, 2005 at 01:34:34AM +0800, Autrijus Tang wrote: : On Wed, Aug 10, 2005 at 10:25:05AM -0700, Larry Wall wrote: : > I'll have to think about the rest of your proposal, but I was suddenly : > struck with the thought that our "platonic" Class objects are really : > forms of undef: : > :

"set" questions -- Re: $object.meta.isa(?) redux

2005-08-10 Thread Dave Whipp
Luke Palmer wrote: A new development in perl 6 land that will make some folks very happy. There is now a Set role. Among its operations are (including parentheses): (+) Union (*) Intersection (-) Difference (<=) Subset (<) Proper subset (>=) Superset (>)

my $pi is constant = 3;

2005-08-10 Thread Autrijus Tang
According to S06: my $pi is constant = 3; Is this a special form? If yes, what does it desugar to? my $pi is constant := 3; my $pi is constant ::= 3; If not a special form, should this work? my $pi is constant; $pi = 3; If yes, should this pass compilation? my $pi i

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Larry Wall
On Tue, Aug 09, 2005 at 10:54:54PM -0400, Stevan Little wrote: : Let me make sure I understand this. : : Package is an Object. : Module is a Package. : Class is a Package. : Role is a Package. I think of it more like: Package is an Object. Module is a Package. Class is a Module.

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Brent 'Dax' Royal-Gordon
TSa <[EMAIL PROTECTED]> wrote: > you wrote: > > Perl 6 in its unannotated form is also (mostly) a typeless languages, > > with only the five builtin types, much like Perl 5 is. > > Counting the sigil quadriga as 4, what is the fifth element? > And $it.does(LookGood)? $ @ % & :: -- Brent 'Dax' R

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 07:32:01PM +0200, TSa wrote: > you wrote: > >Perl 6 in its unannotated form is also (mostly) a typeless languages, > >with only the five builtin types, much like Perl 5 is. > > Counting the sigil quadriga as 4, what is the fifth element? & @ $ % :: In Perl5, :: is replac

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:25:05AM -0700, Larry Wall wrote: > I'll have to think about the rest of your proposal, but I was suddenly > struck with the thought that our "platonic" Class objects are really > forms of undef: > > say defined IO; # prints 0 Hmm, bool::false stringifies to '0'? Al

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread TSa
HaloO Autrijus, you wrote: Perl 6 in its unannotated form is also (mostly) a typeless languages, with only the five builtin types, much like Perl 5 is. Counting the sigil quadriga as 4, what is the fifth element? And $it.does(LookGood)? -- $TSa.greeting := "HaloO"; # mind the echo!

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread TSa
HaloO, Luke Palmer wrote: On 8/10/05, TSa <[EMAIL PROTECTED]> wrote: Here is an example of a 2D distance method role Point { has Num $.x; has Num $.y; } method distance( Point $a, Point $b --> Num ) { return sqrt( ($a.x - $b.x)**2 - ($a.y - $b.y)**2); } [..] # This

Re: Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Larry Wall
I'll have to think about the rest of your proposal, but I was suddenly struck with the thought that our "platonic" Class objects are really forms of undef: say defined IO; # prints 0 That is, we already have an object of type IO that doesn't really have a value yet. And maybe that's the real

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:12:45AM -0700, Larry Wall wrote: > We can get away with this in Perl 6 because bindings to positionals > happen lazily. So all we have to check for syntactically is that we > don't have a subsequent declaration that changes the syntax from list > to unary (or none-ary).

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Larry Wall
On Wed, Aug 10, 2005 at 10:47:47AM +0200, Juerd wrote: : Larry Wall skribis 2005-08-09 16:19 (-0700): : > So either something in the context tells us what "Foo" means, or : > it will be taken as a list operator that hasn't been declared yet. : : Is there, by the way, a pragma to force predeclarati

Re: $object.meta.isa(?) redux

2005-08-10 Thread Larry Wall
On Wed, Aug 10, 2005 at 03:53:00PM +, Luke Palmer wrote: : A new development in perl 6 land that will make some folks very happy. : There is now a Set role. Among its operations are (including : parentheses): : : (+) Union : (*) Intersection : (-) Difference : (<=) Sub

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Luke Palmer
On 8/10/05, TSa <[EMAIL PROTECTED]> wrote: > Here is an example of a 2D distance method > >role Point >{ > has Num $.x; > has Num $.y; >} >method distance( Point $a, Point $b --> Num ) >{ > return sqrt( ($a.x - $b.x)**2 - ($a.y - $b.y)**2); >} > > Now comes

Proposal: "is defined" trait, "is typed" trait, "traits" pragma.

2005-08-10 Thread Autrijus Tang
So I'm starting to write the inferencer. Immediately I encounter the problem that every type can potentially contain "undef": my IO $x = open('/etc/passwd'); $x = undef; $x.close; This raises the runtime error: *** Can't call method "close" on an undefined value. The "undef" li

Re: $object.meta.isa(?) redux

2005-08-10 Thread Luke Palmer
On 8/10/05, TSa <[EMAIL PROTECTED]> wrote: > HaloO, > > Luke Palmer wrote: > > On 8/9/05, Larry Wall <[EMAIL PROTECTED]> wrote: > > > >>So why not just use "describes"? Then maybe Object.isa(Foo) delegates > >>to $obj.meta.describes(Foo). > > > > > > Hmm. We have a similar problem with the new c

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread TSa
HaloO Stevan, you wrote: I hope that .isa, .does and .meta are normal Method subtypes and *not* slots on some implementation objects/structures. I am not sure I understand this. Can you elaborate? With pleasure! OK, where do I start? ... The origin of OO stems from the need to organize da

Re: $object.meta.isa(?) redux

2005-08-10 Thread TSa
HaloO, Luke Palmer wrote: On 8/9/05, Larry Wall <[EMAIL PROTECTED]> wrote: So why not just use "describes"? Then maybe Object.isa(Foo) delegates to $obj.meta.describes(Foo). Hmm. We have a similar problem with the new class-set notation. These two things: Did I miss something? What is

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 06:03:18AM -0600, Luke Palmer wrote: > On 8/10/05, Autrijus Tang <[EMAIL PROTECTED]> wrote: > > But it's an toplevel optimization, which is not applicable to > > module authors. So I'd very much welcome a lexical pragma that > > forces static binding of subroutine calls. >

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Luke Palmer
On 8/10/05, Autrijus Tang <[EMAIL PROTECTED]> wrote: > But it's an toplevel optimization, which is not applicable to > module authors. So I'd very much welcome a lexical pragma that > forces static binding of subroutine calls. Yeah, but the whole point of not allowing that is so that you can over

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Autrijus Tang
On Wed, Aug 10, 2005 at 10:47:47AM +0200, Juerd wrote: > Larry Wall skribis 2005-08-09 16:19 (-0700): > > So either something in the context tells us what "Foo" means, or > > it will be taken as a list operator that hasn't been declared yet. > > Is there, by the way, a pragma to force predeclarati

Re: $object.meta.isa(?) redux

2005-08-10 Thread Luke Palmer
On 8/9/05, Larry Wall <[EMAIL PROTECTED]> wrote: > So why not just use "describes"? Then maybe Object.isa(Foo) delegates > to $obj.meta.describes(Foo). Hmm. We have a similar problem with the new class-set notation. These two things: $a.does(Foo); Bar.does(Foo); Mean two different thi

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Juerd
Larry Wall skribis 2005-08-09 16:19 (-0700): > So either something in the context tells us what "Foo" means, or > it will be taken as a list operator that hasn't been declared yet. Is there, by the way, a pragma to force predeclaration of subs, to gain compile time typo checking? Juerd -- http: