Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dave Mitchell
Dan Sugalski <[EMAIL PROTECTED]> wrote: > At 3:53 PM + 2/14/02, Dave Mitchell wrote: > >My outstanding niggle is when a typed variable is undef. I guess we > >need a generic Perl_Undef_But_Typed vtable type, which behaves mostly > >like the PerlUndef type, but saves a pointer to its 'real' vta

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dan Sugalski
At 3:53 PM + 2/14/02, Dave Mitchell wrote: >My outstanding niggle is when a typed variable is undef. I guess we >need a generic Perl_Undef_But_Typed vtable type, which behaves mostly >like the PerlUndef type, but saves a pointer to its 'real' vtable in >self->data or whatever. When it's assign

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Melvin Smith
TECTED] Subject: Re: PMCs, setting, and suchlike things 02/14/2002 10

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dan Sugalski
At 3:48 PM + 2/14/02, Alex Gough wrote: >On Thu, 14 Feb 2002, Melvin Smith wrote: > >> >my Dog $spot = Dog.new("waggly tail"); >> >$spot = Cat.new(); >> >> In this case all types are known at compile time. Why would >> we relegate this to a runtime vtable check or bit flag? > >There's no r

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dave Mitchell
Dan Sugalski <[EMAIL PROTECTED]> wrote: > There's a flag in the flags field to mark the PMC as a permanent type > or not. It's insufficient for "Type X or child of X" things, though. > > >Or to put it another way, is the type of a PMC determined purely by > >it's current vtable pointer, and if s

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Alex Gough
On Thu, 14 Feb 2002, Melvin Smith wrote: > >my Dog $spot = Dog.new("waggly tail"); > >$spot = Cat.new(); > > In this case all types are known at compile time. Why would > we relegate this to a runtime vtable check or bit flag? There's no reason to suspect that Dog::new will actually return a Dog

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Melvin Smith
3 cc: AM Subject: Re: PMCs, setting, and suc

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dan Sugalski
At 11:46 AM + 2/14/02, Dave Mitchell wrote: >Dan Sugalski <[EMAIL PROTECTED]> wrote: >> Right, for typed variables. Most variables (i.e. anything you >> declared with a plain "my $foo" or "our @bar") are untyped and can >> change their types as needed. >> >> If you did: >> >> my $foo;

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Graham Barr
On Thu, Feb 14, 2002 at 02:10:20PM +, Dave Mitchell wrote: > 2. If so, how do we distinguish between two PMCs, both of whose > vtable pointers currently point to the 'Dog' vtable, but one of whom has > been delared as type Dog and so should never have it's vatble pointer > updated, and the oth

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dave Mitchell
Alex Gough <[EMAIL PROTECTED]> wrote: > On Thu, 14 Feb 2002, Dave Mitchell wrote: > > > $foo would first be a Dog, then a FireHydrant. When it changed to a > > > FireHydrant the previous contents would get blown away. > > > > Hmmm - how do we distinguish between a plain scalar that is temporarily

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Alex Gough
On Thu, 14 Feb 2002, Dave Mitchell wrote: > > $foo would first be a Dog, then a FireHydrant. When it changed to a > > FireHydrant the previous contents would get blown away. > > Hmmm - how do we distinguish between a plain scalar that is temporarily > typed, and a 'proper' permanently-typed scala

Re: PMCs, setting, and suchlike things

2002-02-14 Thread Dave Mitchell
Dan Sugalski <[EMAIL PROTECTED]> wrote: > Right, for typed variables. Most variables (i.e. anything you > declared with a plain "my $foo" or "our @bar") are untyped and can > change their types as needed. > > If you did: > > my $foo; > $foo = Dog.new(); > $foo = FireHydrant.new();

RE: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Angel Faus
>> my $plain = $c - $d : Math::Complex # 3.0 + 0i >> sqrt(2 : Math::Integers) # -> exception or not-a-number >Not a bad idea,. I beleive that the perl6 adjective operator >(for functions) will be a semicolon, not a colon. I'm not >sure how it is planned to apply it to operators. > >Its a

Re: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Larry Wall
: This might be even more "Complex" than that - what if Complex can be : reduced? Should it? for instance: : : my Complex $c = 3+4i; : my Complex $d = 4i; : my $plain = $c / $d; : : Does $plain (which is actually '3' after reducing) get promoted to Complex, : or does the result from the division

RE: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread David Whipp
> In a related matter, computer languages with Symbolic Mathematics > capabilities, like Mapple, let you explicitly demand where do > you want the operation to take place. > > This could be done naturally in perl6 using the colon meta-operator: > > my $plain = $c - $d : Math::Complex # 3.0 + 0

RE: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Angel Faus
> my Complex $c = 3+4i; > my Complex $d = 4i; > my $plain = $c / $d; > > Does $plain (which is actually '3' after reducing) get promoted to > Complex, or does the result from the division get demoted? In a related matter, computer languages with Symbolic Mathematics capabilities, like Mapple, le

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Dan Sugalski
At 3:43 PM + 2/13/02, Dave Mitchell wrote: >Dan Sugalski <[EMAIL PROTECTED]> wrote: >> >So in the following: >> > >> >my Complex $c = 3+4i; >> >my $plain = 1.1; >> >$plain = $c; >> > >> >I presume that $plain ends up as type Complex (with value 3+4i)? >> >> Yup. >> >> >If so, how does

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Dan Sugalski
At 11:12 AM -0500 2/13/02, Buddha Buck wrote: >At 03:43 PM 02-13-2002 +, Dave Mitchell you wrote: >>Dan Sugalski <[EMAIL PROTECTED]> wrote: >>> >So in the following: >>> > >>> >my Complex $c = 3+4i; >>> >my $plain = 1.1; >>> >$plain = $c; >>> > >>> >I presume that $plain ends up as type

Re: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Uri Guttman
> "W" == Wizard <[EMAIL PROTECTED]> writes: >> my Complex $c = 3+4i; >> my $plain = 1.1; >> $plain = $c; W> This might be even more "Complex" than that - what if Complex can be W> reduced? Should it? for instance: W> my Complex $c = 3+4i; W> my Complex $d = 4i; W> my $plain

Re: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Piers Cawley
"Wizard" <[EMAIL PROTECTED]> writes: > This came up on perl6-internals, and Dan liked the "try" suggestion and > suggested That I post it here for comments. I'm not subscribed to > p6-language, so you'll need to include me in any replies where you want a > response from me. > =

RE: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Wizard
This came up on perl6-internals, and Dan liked the "try" suggestion and suggested That I post it here for comments. I'm not subscribed to p6-language, so you'll need to include me in any replies where you want a response from me. = Dave M

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Buddha Buck
At 03:43 PM 02-13-2002 +, Dave Mitchell you wrote: >Dan Sugalski <[EMAIL PROTECTED]> wrote: > > >So in the following: > > > > > >my Complex $c = 3+4i; > > >my $plain = 1.1; > > >$plain = $c; > > > > > >I presume that $plain ends up as type Complex (with value 3+4i)? > > > > Yup. > > > > >If so

RE: PMCs, setting, and suchlike things

2002-02-13 Thread Wizard
Dan Sugalski wrote: > >my Complex $c = 3+4i; > >my Complex $d = 4i; > >my $plain = $c / $d; > > > >Does $plain get promoted, or does the result from the division > get demoted? > > Since $plain's not a fixed scalar type, it should be whatever the > division of $c and $d produces, presumably a comp

RE: PMCs, setting, and suchlike things

2002-02-13 Thread Dan Sugalski
At 7:16 AM -0800 2/13/02, Wizard wrote: > > my Complex $c = 3+4i; >> my $plain = 1.1; >> $plain = $c; > >This might be even more "Complex" than that - what if Complex can be >reduced? Should it? for instance: > >my Complex $c = 3+4i; >my Complex $d = 4i; >my $plain = $c / $d; > >Does $plain get

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Dave Mitchell
Dan Sugalski <[EMAIL PROTECTED]> wrote: > >So in the following: > > > >my Complex $c = 3+4i; > >my $plain = 1.1; > >$plain = $c; > > > >I presume that $plain ends up as type Complex (with value 3+4i)? > > Yup. > > >If so, how does $plain know how to "morph itself into the RHS's type"? > > The g

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Dan Sugalski
At 10:48 AM + 2/13/02, Dave Mitchell wrote: >Dan Sugalski <[EMAIL PROTECTED]> wrote: >> #2 is what you get with normal assignment. $foo = $bar, for example. >> $foo's assign vtable method is called with $bar as a parameter. $foo >> figures out what it should do--if it's a tied variable of s

RE: PMCs, setting, and suchlike things

2002-02-13 Thread Wizard
> my Complex $c = 3+4i; > my $plain = 1.1; > $plain = $c; This might be even more "Complex" than that - what if Complex can be reduced? Should it? for instance: my Complex $c = 3+4i; my Complex $d = 4i; my $plain = $c / $d; Does $plain get promoted, or does the result from the division get demo

Re: PMCs, setting, and suchlike things

2002-02-13 Thread Dave Mitchell
Dan Sugalski <[EMAIL PROTECTED]> wrote: > #2 is what you get with normal assignment. $foo = $bar, for example. > $foo's assign vtable method is called with $bar as a parameter. $foo > figures out what it should do--if it's a tied variable of some sort > it should perform its assign action. (Thi

RE: PMCs, setting, and suchlike things

2002-02-12 Thread Brent Dax
Dan Sugalski: # So, what about the ramifications of: # # $foo = @bar # # @bar's get_integer method is called, and $foo's set_integer method is # called. No temp PMCs. Huh? Assigning an array to a scalar yields a reference to an array. In integer context that yields the length. In string c

Re: PMCs, setting, and suchlike things

2002-02-12 Thread Dan Sugalski
At 11:39 PM + 2/12/02, Simon Cozens wrote: >Dan Sugalski: >> So, what about the ramifications of: > >No. You've glossed over the details of how we know that > >this assignment is integer, and > >this assignment is string, > >and this assignment is integer. > >Parrot can't know this, surely.

Re: PMCs, setting, and suchlike things

2002-02-12 Thread Simon Cozens
Dan Sugalski: > So, what about the ramifications of: No. You've glossed over the details of how we know that > $foo = @bar > @bar's get_integer method is called, and $foo's set_integer method is > called. No temp PMCs. this assignment is integer, and > $foo = %bar > calls %bar's get_s

PMCs, setting, and suchlike things

2002-02-12 Thread Dan Sugalski
We've been going around a bit about how PMCs should be set and assigned to and suchlike things. So, here's the scoop. There are three sorts of assignment: 1) Pointer assignment 2) Requests to get a value 3) Forced value sets #1 is essentially a sort of bookkeeping. A pointer to one sort of PMC