Perl 6 types: ref() vs isa() (was: Just reading up on Pike...)

2002-08-18 Thread Andy Wardley
[EMAIL PROTECTED] wrote: [...] whose type is simultaneously Cstr and Cint. Has any thought yet gone into the builtin Perl types and what they will be called in Perl 6? Will there be a difference between the Cref() of something and the type(s) that Cisa() returns? In keeping with the lower

Re: Just reading up on Pike...

2002-08-17 Thread damian
On Sat, 17 August 2002, Nicholas Clark wrote: But how on earth would you implement such a thing? :-) I imagine that type specifiers require that values assigned to the corresponding variable satisfy: value.isa(type). Using a superposition as a type means that the result of that test comes

Re: Just reading up on Pike...

2002-08-17 Thread damian
Aaron Sherman wrote: So, my all(str, int) $foo = $!; would be fine? I'd expect so. I'm forgetting what has been said about $! Typically contains an object with both string and integer conversions. Whether convertability to both types is enough to satisfy a superpositional type

Re: Just reading up on Pike...

2002-08-17 Thread Trey Harris
In a message dated Sat, 17 Aug 2002, [EMAIL PROTECTED] writes: [$!] Typically contains an object with both string and integer conversions. Whether convertability to both types is enough to satisfy a superpositional type is an interesting question. I suspect it *is*. Then I'd assume that

Re: Just reading up on Pike...

2002-08-16 Thread Damian Conway
Chris Dutton wrote: and this just jumped out at me: class Foo { private string|int bar; static create(string|int newBar) { bar = newBar; } } In other words, as I understand it, you can type the variable bar as either an int or a string. Aside from simply,

Re: Just reading up on Pike...

2002-08-16 Thread Luke Palmer
Well, I'm still hopeful Larry will approve superpositions. In which case, since types in Perl 6 are first-class, you would be able to write the same thing something like: class Foo { attr any(str,int) $bar; method SETUP(any(str,int) $newBar) {

Re: Just reading up on Pike...

2002-08-16 Thread damian
On Fri, 16 August 2002, Luke Palmer wrote: I want superpositions too :). But, what would this mean? my all(str, int) $foo; #... That you need some *serious* psychotherapy! ;-) Actually, it would mean that $foo can only contain values whose type is simultaneously Cstr and

Re: Just reading up on Pike...

2002-08-16 Thread Nicholas Clark
On Sat, Aug 17, 2002 at 06:41:02AM +1000, Damian Conway wrote: Well, I'm still hopeful Larry will approve superpositions. In which case, since types in Perl 6 are first-class, you would be able to write the same thing something like: class Foo { attr any(str,int)