Re: Synopsis 9 draft 1

2004-09-03 Thread Tim Bunce
On Thu, Sep 02, 2004 at 04:47:40PM -0700, Larry Wall wrote: > > =head1 Compact structs > > A class whose attributes are all low-level types can behave as > a struct. "all low-level types" or "all low-level *sized* types"? (I'm wondering about char arrays, string and pointers.) I presume a char[

Re: Synopsis 2 draft 1 -- each and every

2004-09-03 Thread Michele Dondi
On Fri, 20 Aug 2004, Luke Palmer wrote: > Austin Hastings writes: > > Larry Wall wrote: > > >Hmm. Gotta decided if S$foo.bar() is too ugly to live though... > > > > It is. > > Agreed. Though IMHO Perl has a long history of syntax allowances too ugly to live, and yet, as long as they are not *

Re: Synopsis 9 draft 1

2004-09-03 Thread Rafael Garcia-Suarez
On Fri, 3 Sep 2004 11:41:05 +0100, Tim Bunce <[EMAIL PROTECTED]> wrote: > Is there some syntax to express if the struct is packed or > needs alignment? (Perhaps that would be needed per element.) Why am I suddenly thinking about unions ?

RE: Reverse .. operator

2004-09-03 Thread Joe Gottman
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 02, 2004 8:41 PM > To: Perl6 > Subject: Re: Reverse .. operator > > On Thu, Sep 02, 2004 at 08:34:22PM -0400, Joe Gottman wrote: > : Is there similar shorthand to set @foo = (5, 3, 3, 2, 1) ? I

Re: Synopsis 4 draft 1

2004-09-03 Thread Peter Haworth
On Thu, 19 Aug 2004 19:45:37 -0700, Larry Wall wrote: > To process two arrays in parallel, use either the zip function: > > for zip(@a,@b) -> $a, $b { print "[$a, $b]\n" } > > or the "zipper" operator to interleave them: > > for @a ¥ @b ¥ @c -> $a, $b, $c { print "[$a, $b, $c]\n" } n-ary z

Re: Synopsis 9 draft 1

2004-09-03 Thread Jonathan Scott Duff
On Thu, Sep 02, 2004 at 04:47:40PM -0700, Larry Wall wrote: > my ref[Array] @ragged2d; What is a "ref" type exactly? Is it like a pointer in C? If so, and based on the parameterization above, I assume that there will also be the appropriate pointer arithmetic such that if $fido is declared as

Re: Synopsis 9 draft 1

2004-09-03 Thread Gregory P. Keeney
Jonathan Scott Duff wrote: Maybe it's just my BASIC upbringing, but "shape" doesn't seem like the right word. Words like "dimension" and "cardinal" fit better in my head, but I'd want them shorter and "dim" and "card" don't quite work either ;-) But "shape" makes me want to do something like this:

Re: Synopsis 4 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 02:56:48PM +0100, Peter Haworth wrote: : n-ary zip() is simple enough, but the infix ? makes zipping more than : two lists somewhat entertaining. Without iterators doesn't work well: : : @a ? @b produces (@a[0],@b[0],@a[1],@b[1],...) : : which is what we wanted, but : :

Re: Synopsis 9 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 10:00:24AM -0500, Jonathan Scott Duff wrote: : On Thu, Sep 02, 2004 at 04:47:40PM -0700, Larry Wall wrote: : > my ref[Array] @ragged2d; : : What is a "ref" type exactly? Is it like a pointer in C? It's exactly like a reference in Perl 5. Declaring a compact array of "

Re: Synopsis 9 draft 1

2004-09-03 Thread Jonathan Scott Duff
On Fri, Sep 03, 2004 at 09:29:36AM -0700, Larry Wall wrote: > : If so, and > : based on the parameterization above, I assume that there will also be > : the appropriate pointer arithmetic such that if $fido is declared as a > : ref[Dog] and pointed at an array of Dogs, then $fido++ will move to the

Re: Synopsis 9 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 12:25:37PM -0500, Jonathan Scott Duff wrote: : If "my int @foo" makes a compact array of ints, is there a way to make a : compact array of Dog? (Does it even make sense?) And if so, does it look : like "my Dog @foo" or must there be some other syntax to declare it? It's jus

Re: Synopsis 9 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 11:41:05AM +0100, Tim Bunce wrote: : On Thu, Sep 02, 2004 at 04:47:40PM -0700, Larry Wall wrote: : > : > =head1 Compact structs : > : > A class whose attributes are all low-level types can behave as : > a struct. : : "all low-level types" or "all low-level *sized* types"?

S4: Can PRE and POST be removed from program flow?

2004-09-03 Thread John Siracusa
Synopsis 4 says: "PRE and POST must return boolean values that are evaluated according to the usual Design by Contract rules." Do "the usual Design by Contract rules" include the ability to "turn off" (i.e. remove from program flow) PRE and POST blocks for performance reasons in production, or is

Re: S4: Can PRE and POST be removed from program flow?

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 04:35:56PM -0400, John Siracusa wrote: : Synopsis 4 says: : : "PRE and POST must return boolean values that are evaluated according to the : usual Design by Contract rules." : : Do "the usual Design by Contract rules" include the ability to "turn off" : (i.e. remove from p

Re: S4: Can PRE and POST be removed from program flow?

2004-09-03 Thread John Siracusa
On 9/3/04 6:03 PM, Larry Wall wrote: > On Fri, Sep 03, 2004 at 04:35:56PM -0400, John Siracusa wrote: > : Synopsis 4 says: > : > : "PRE and POST must return boolean values that are evaluated according to the > : usual Design by Contract rules." > : > : Do "the usual Design by Contract rules" incl

Re: S4: Can PRE and POST be removed from program flow?

2004-09-03 Thread Damian Conway
John Siracusa wrote: I don't see how we could prevent someone from clobbering the global definitions of PRE and POST to be no-ops if they wanted to. Seems to me that the whole point of putting the program in charge of its own compilation is to let it be in charge of its own compilation, n'est pa?

Re: S4: Can PRE and POST be removed from program flow?

2004-09-03 Thread John Siracusa
On 9/3/04 6:45 PM, Damian Conway wrote: > John Siracusa wrote: >>> I don't see how we could prevent someone from clobbering the global >>> definitions of PRE and POST to be no-ops if they wanted to. Seems to >>> me that the whole point of putting the program in charge of its own >>> compilation is

Re: Synopsis 9 draft 1

2004-09-03 Thread John Williams
On Thu, 2 Sep 2004, Larry Wall wrote: > The argument to a shape specification is a semicolon list, just like > the inside of a multidimensional subscript. Ranges are also allowed, > so you can pretend you're programming in Fortran, or awk: > > my int @ints is shape(1..4;1..2); # two dimension

Re: Synopsis 9 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 05:45:12PM -0600, John Williams wrote: : On Thu, 2 Sep 2004, Larry Wall wrote: : : > The argument to a shape specification is a semicolon list, just like : > the inside of a multidimensional subscript. Ranges are also allowed, : > so you can pretend you're programming in F

Re: Synopsis 9 draft 1

2004-09-03 Thread John Williams
On Thu, 2 Sep 2004, Larry Wall wrote: > A multidimensional array is indexed by a semicolon list, which is really > a list of lists in disguise. Each sublist is a slice of one particular > dimension. So > > @array[0..10; 42; @x] > > is really short for > > @array.postcircumfix:[]( <== [0..

Re: Synopsis 9 draft 1

2004-09-03 Thread Rod Adams
Larry Wall wrote: On Fri, Sep 03, 2004 at 05:45:12PM -0600, John Williams wrote: : What happens when the Pascal programmer declares : : my int @ints is shape(-10..10); : : Does it blow up? No. : If not, does @ints[-1] mean the element with index -1 or the last element? The element with ind

Re: Synopsis 9 draft 1

2004-09-03 Thread Luke Palmer
John Williams writes: > On Thu, 2 Sep 2004, Larry Wall wrote: > > A multidimensional array is indexed by a semicolon list, which is really > > a list of lists in disguise. Each sublist is a slice of one particular > > dimension. So > > > > @array[0..10; 42; @x] > > > > is really short for > >

parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Jonathan Lang
Larry Wall wrote: > Arrays with explicit ranges don't use the minus notation to count from > the end. We probably need to come up with some other notation for the > beginning and end indexes. But it'd be nice if that were a little > shorter than: > > @ints.shape[0].beg > @ints.shape[0

Re: Synopsis 9 draft 1

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 07:42:53PM -0500, Rod Adams wrote: (B: What jumps to my mind is that inside an array subscript could be (B: (sub)?context of it's own. Then one could do: (B: (B: @ints[.beg .. .end ; .beg + 3 .. .end]; (B (BAwful dotty... (B (B: Where the .beg and .end would relate

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 06:31:49PM -0700, Jonathan Lang wrote: : I wonder if this notion of contextualizing a method's signature could be : generalized... I could see a case for treating most methods as if the : expressions in each parameter were being evaluated within the caller's : class: : :

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread John Williams
> I think we just need something really short and unconfusing for the > commonest cases, @a[ 42 ; -1 but last ] That reads pretty well, no? Maybe the other end isn't quite as good: @a[ 1 but first .. -2 but last ] Hmm. Should "-1 but last" or "0 but last" be the last element? ~ John Wil

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Larry Wall
On Fri, Sep 03, 2004 at 08:19:11PM -0600, John Williams wrote: : > I think we just need something really short and unconfusing for the : > commonest cases, : :@a[ 42 ; -1 but last ] : : That reads pretty well, no? : : Maybe the other end isn't quite as good: : : @a[ 1 but first .. -2 but

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Jonathan Lang
Larry Wall wrote: > On Fri, Sep 03, 2004 at 06:31:49PM -0700, Jonathan Lang wrote: > : I wonder if this notion of contextualizing a method's signature could > : be generalized... I could see a case for treating most methods as if > : the expressions in each parameter were being evaluated within th

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Rod Adams
Larry Wall wrote: I'm still thinking A is the first one and Z is the last one. Someone talk me out of it quick. I had thought about A and Z before my previous post. I dismissed it for two reasons: 1) Using Alphas as an index for something that should be numeric can be very confusing. Especially

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread John Williams
> If you insist on using A and Z, at least make them \A and \Z, to give a > stronger visual cue that something different is happening. I think I'd prefer alpha and omega. Or maybe turn my previous suggestion around and make first and last special constants. Then say: @a[ first .. last but 1 ]

Re: parameter contexts (was: Synopsis 9 draft 1)

2004-09-03 Thread Jonathan Scott Duff
On Fri, Sep 03, 2004 at 11:03:03PM -0500, Rod Adams wrote: > If you insist on using A and Z, at least make them \A and \Z, to give a > stronger visual cue that something different is happening. Some other ideas ... ^A..^Z Too confusing with $^A and $^Z ? ^A..^? Well, if control