class Scalar isa intlike, numlike, ...; # and isa Object or whatever
Qoting A6: "Perl makes a distinction between the type of the variable,
and the type of the value"
If we view Scalar as the type of a variable, not value, then we could
cease to need all this cleverness with inheritance. Peopl
On Monday, March 17, 2003, at 10:35 AM, Luke Palmer wrote:
I've been thinking of it like this:
class int isa intlike; # and isa value or whatever
class Int isa intlike; # and isa Object or whatever
class num isa numlike; # and isa value or whatever
class Num isa numlike; # and isa Object
> Nick --
>
> I've been thinking of it like this:
>
> class int isa intlike; # and isa value or whatever
> class Int isa intlike; # and isa Object or whatever
>
> class num isa numlike; # and isa value or whatever
> class Num isa numlike; # and isa Object or whatever
>
> ...
>
> cl
15/2003 06:48 PM
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
cc:
Subject:Re: A6: Complex Parameter Types
There seems to be some confusion about which way up the world is.
On Tue, Mar 11, 2003 at 01:25:41PM +1100, Damian Conway wrote:
> Which in
> I'm not sure if it helps people understand why I'm confused by explaining
> my background, but I've done exactly zero computer science, and have come
> to whatever (mis)understanding of OO I have by using C++ (and then perl).
> I've never used Java, but I'm aware that it has a concept of "interfa
There seems to be some confusion about which way up the world is.
On Tue, Mar 11, 2003 at 01:25:41PM +1100, Damian Conway wrote:
> Which in turn is because:
>
> not Scalar.isa(int)
On Thu, Mar 13, 2003 at 11:55:06AM -0800, Larry Wall wrote:
> On Thu, Mar 13, 2003 at 11:31:30AM -0800, Austi
Austin Hastings wrote:
You're treading dangerously close to the S&M line there...
Sure. That's exactly what types are for.
Does it make sense to say C for this stuff?
I'd much rather that simply using typed params invoked type stricture.
Damian
Larry wrote:
: > multi foo (@a is Array of int) {...}
: >
: > my int @a = baz(); # is Array of int
: > my @b = baz(); # is Array of Scalar
: >
: > foo(@a);# @a is typed correctly, so OK
: > foo(@b);# @b is not explicitly typed as C; OK or FAIL?
I dunno. I can argue that i
Oh goody, two with one blow:
--- Damian Conway <[EMAIL PROTECTED]> wrote:
> Larry wrote:
>
> > : > multi foo (@a is Array of int) {...}
> > : >
> > : > my int @a = baz(); # is Array of int
> > : > my @b = baz(); # is Array of Scalar
> > : >
> > : > foo(@a);# @a is typed correc
Larry wrote:
: > multi foo (@a is Array of int) {...}
: >
: > my int @a = baz(); # is Array of int
: > my @b = baz(); # is Array of Scalar
: >
: > foo(@a);# @a is typed correctly, so OK
: > foo(@b);# @b is not explicitly typed as C; OK or FAIL?
:
: Fails.
:
: Because:
:
Larry Wall wrote:
I dunno. I can argue that it should coerce that. It'll certainly be
able to coerce a random scalar to int for you, so it's not a big stretch
to coerce conformant arrays of them. On the other hand, it's likely
to be expensive in some cases, which isn't so much of an issue for
s
On Tue, Mar 11, 2003 at 01:25:41PM +1100, Damian Conway wrote:
: >3) The edge point between explicitly typed and explicitly non-typed
: >variables: If you pass an "untyped" array (or list?) to an explicitly
: >typed array parameter, is the "untyped" array considered a unique case,
: >or will it
Michael Lazzaro asked:
1) Complex types for sub parameters: The above would imply that a sub
can tell the difference between an C vs an C, thank goodness. That also implies that you can use arbitrarily
complex types, and still get the same type checking:
sub foo ( %pet is Hash of Array of
In A6, it is confirmed that you can have "complex" types such as:
my %pet is Hash of Array of Array of Hash of Array of Cat;
It is also confirmed that you can indeed use such types in sub
signatures, e.g.:
sub foo (@a is Array of int) {...}
Confirmations/Questions:
1) Complex types for su
14 matches
Mail list logo