Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-12 Thread Austin Hastings
--- Damian Conway <[EMAIL PROTECTED]> wrote: > Austin Hastings wrote: > > > You're treading dangerously close to the S&M line there... > > Sure. That's exactly what types are for. > Granted. > > Does it make sense to say C for this stuff? > > I'd much rather that simply using typed params i

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-12 Thread Damian Conway
Austin Hastings wrote: In this case, I rather like the idea of being able to say sub foo(@a is Array of Int) {...} my @input = read_a_bunch_o_data(); foo(@input); Where the compiler will automatically "wrap" the @input array in a make-it-an-int converter. This, to me, is DWIM. But to ma

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-12 Thread Austin Hastings
--- Damian Conway <[EMAIL PROTECTED]> wrote: > Austin Hastings wrote: > > > In this case, I rather like the idea of being able to say > > > >sub foo(@a is Array of Int) {...} > > > >my @input = read_a_bunch_o_data(); > >foo(@input); > > > > > > Where the compiler will automaticall

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-12 Thread Leopold Toetsch
Austin Hastings wrote: But what's the vision for p6? My expectation is that the type-checking stuff will be heavily used for: 1- Large scale projects. 2- CPAN modules. 3- speed When you are not on perl one liners, but maybe some inner tight loops of some algorithm or whatever, where speed d

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Damian Conway
Austin Hastings wrote: But what's the vision for p6? My expectation is that the type-checking stuff will be heavily used for: 1- Large scale projects. 2- CPAN modules. I expect that the folks who want to do one-liners will still want to be able to say C So the "strict" bits have to be forgivin

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Austin Hastings wrote: > >> But what's the vision for p6? My expectation is that the >> type-checking stuff will be heavily used >> for: >> 1- Large scale projects. >> 2- CPAN modules. >> I expect that the folks who want to do one-liners will still want

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Larry Wall
On Thu, Mar 13, 2003 at 10:21:25PM +1100, Damian Conway wrote: : But what we can't allow is a reference parameter to coerce its argument. : For example: : : sub loggedincr (Int $i is rw) { : print $log: "Incremented $i.id()\n"; : $i++ unless $i.constant; :

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Angel Faus
Damian Conway wrote: > But large projects -- where typing will be most important -- > *can't* deal with that. That's the point of typing: to specify and > enforce interface contracts. At compile-time if at all possible. One quick question about this. If I write: sub foo (Bar $f) {..} my $x

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Larry Wall
On Thu, Mar 13, 2003 at 10:21:25PM +1100, Damian Conway wrote: : But if I say: : : sub foo(@a is Array of Int) {...} : ... : foo(@x); : : then I'm saying: "within &foo, @a is just another name for @x". So they are : (temporarily) the same thing. That can only (be allowed to) ha

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Larry Wall
On Thu, Mar 13, 2003 at 06:28:00PM +0100, Angel Faus wrote: : : Damian Conway wrote: : > But large projects -- where typing will be most important -- : > *can't* deal with that. That's the point of typing: to specify and : > enforce interface contracts. At compile-time if at all possible. : : One

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Austin Hastings
--- Damian Conway <[EMAIL PROTECTED]> wrote: > Austin Hastings wrote: > > > But what's the vision for p6? > > > > My expectation is that the type-checking stuff will be heavily used > > for: > > > > 1- Large scale projects. > > > > 2- CPAN modules. > > > > I expect that the folks who want to

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Larry Wall
On Thu, Mar 13, 2003 at 11:31:30AM -0800, Austin Hastings wrote: : "Everyone Knows" that an Int is a Scalar, and therefore a sub that has : a Scalar parameter can safely be passed an Int. This is normal. : : What I want is the ability to do the opposite: Silence the warning that : occurs when I pa

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Paul
> I don't see a problem. Scalar == Int|Num|Str|Ref, so > Scalar.isa("Int"). Scalar.isa("Int") && Int.isa("Scalar") __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Damian Conway
Larry Wall wrote: On Thu, Mar 13, 2003 at 10:21:25PM +1100, Damian Conway wrote: : But if I say: : : sub foo(@a is Array of Int) {...} : ... : foo(@x); : : then I'm saying: "within &foo, @a is just another name for @x". So they are : (temporarily) the same thing. That can only (be allowed to

RE: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Brent Dax
Damian Conway: # a) The argument passed here must be something that # could conceivably # not cause the program to crash and burn, and # we'll verify that at # run-time if necessary. # # or: # # b) The argument passed here must be something that will # definite

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-13 Thread Dave Whipp
Damian Conway wrote: b) The argument passed here must be something that will definitely not cause the program to crash and burn, and we'll verify that at compile-time. I'm arguing that the former is well-nigh useless, and that the latter is what large systems developers and

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-14 Thread Larry Wall
On Thu, Mar 13, 2003 at 07:36:00PM -0800, Brent Dax wrote: : I think that there should be two types of arg typing[1]: 'strict' and : 'loose'. Strict arg typing doesn't coerce, except to turn subclasses : into superclasses; loose arg typing, on the other hand, coerces whenever : possible. The mech

Re: A6: Strict signature checking - was: Complex Parameter Types

2003-03-14 Thread Erik Steven Harrison
-- On Fri, 14 Mar 2003 10:08:15 Larry Wall wrote: >On Thu, Mar 13, 2003 at 07:36:00PM -0800, Brent Dax wrote: >: I think that there should be two types of arg typing[1]: 'strict' and >: 'loose'. Strict arg typing doesn't coerce, except to turn subclasses >: into superclasses; loose arg typin

Huffman coding (Was: Re: A6: Strict signature checking - was: Complex Parameter Types)

2003-03-14 Thread Anton Berezin
On Thu, Mar 13, 2003 at 10:21:25PM +1100, Damian Conway wrote: > By distinguishing a parameter that *requires* a particular type, from > a parameter that *ensures* a particular type (by coercion if > necessary). I've suggested that using C semantics should > indicate "make whatever I'm actually gi

Re: Huffman coding (Was: Re: A6: Strict signature checking - was: Complex Parameter Types)

2003-03-14 Thread Larry Wall
On Thu, Mar 13, 2003 at 10:52:04PM +0100, Anton Berezin wrote: : On Thu, Mar 13, 2003 at 10:21:25PM +1100, Damian Conway wrote: : : > By distinguishing a parameter that *requires* a particular type, from : > a parameter that *ensures* a particular type (by coercion if : > necessary). I've suggeste