Re: Synopsis 9 draft 1

2004-09-21 Thread Jonadab the Unsightly One
Larry Wall <[EMAIL PROTECTED]> writes: > int1, int2, int4, int8, int16, int32, int64, uint1, uint2, uint4, > uint8, uint16, uint32, uint64, num32, num64, num128, complex32, > complex64, complex128, ... Well, all that is harmless enough, as long as I don't ever have the misfortune to inherit maint

Re: Synopsis 9 draft 1

2004-09-21 Thread Jonadab the Unsightly One
Aaron Sherman <[EMAIL PROTECTED]> writes: > It took us some time discussing this... we weren't sure what tense > you were using. At first we thought it might be the past subjective, > but after a while, we decided to coin a new tense: the vapor tense. ;-) Actually, it's not new at all; there's al

Re: Synopsis 9 draft 1

2004-09-21 Thread Ovid
--- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote: > I surely must be misunderstanding what you're saying... the way I > read that, you're suggesting that it will matter to Perl -- not only > to the compiler but even to user code -- how the underlying hardware > addresses its memory. I real

Re: Synopsis 9 draft 1

2004-09-21 Thread Jonadab the Unsightly One
John Macdonald <[EMAIL PROTECTED]> writes: > If a int1 (or int2 or nybble or other sub-addressable sized value) > is being referred to, a similar issue arises since most machines > these days have byte addressing, but do not have bit addressing. If > you can't refer directly to it, the value will

Re: Synopsis 9 draft 1

2004-09-09 Thread Smylers
Michele Dondi writes: > On Thu, 2 Sep 2004, Larry Wall wrote: > > > To declare a multidimensional array, you add a shape parameter: > > > > my num @nums is shape(3); # one dimension, @nums[0..2] > > my int @ints is shape(4;2); # two dimensions, @ints[0..3; 0..1] > > Just a random thou

Re: Synopsis 9 draft 1

2004-09-09 Thread Luke Palmer
John Macdonald writes: > As an array index -1 and 0 give you the 2 ends. The perl5 > code to alternately extract elements from the two eds of an > array can be something like: > > my $end = 0; # -1 to start with right end > > while( @array ) { > my $next = splice( @array, $end

Re: Synopsis 9 draft 1

2004-09-09 Thread John Macdonald
On Thu, Sep 09, 2004 at 03:09:47PM +0200, Michele Dondi wrote: > On Thu, 2 Sep 2004, Larry Wall wrote: > > > And yes, an C can store only -1 or 0. I'm sure someone'll think of > > a use for it... > > Probably OT, but I've needed something like that badly today: "working" on > a japh that turned

Re: Synopsis 9 draft 1

2004-09-09 Thread Matthew Walton
Michele Dondi wrote: On Thu, 2 Sep 2004, Larry Wall wrote: To declare a multidimensional array, you add a shape parameter: my num @nums is shape(3); # one dimension, @nums[0..2] my int @ints is shape(4;2); # two dimensions, @ints[0..3; 0..1] Just a random thought, and probably a minor poi

Re: Synopsis 9 draft 1

2004-09-09 Thread Michele Dondi
On Thu, 2 Sep 2004, Larry Wall wrote: > And yes, an C can store only -1 or 0. I'm sure someone'll think of > a use for it... Probably OT, but I've needed something like that badly today: "working" on a japh that turned out to require mostly golfing skills (and not that I have many, I must admit)

Re: Synopsis 9 draft 1

2004-09-09 Thread Michele Dondi
On Thu, 2 Sep 2004, Larry Wall wrote: > To declare a multidimensional array, you add a shape parameter: > > my num @nums is shape(3); # one dimension, @nums[0..2] > my int @ints is shape(4;2); # two dimensions, @ints[0..3; 0..1] Just a random thought, and probably a minor point: I know

Re: Synopsis 9 draft 1

2004-09-07 Thread Larry Wall
On Tue, Sep 07, 2004 at 10:34:33PM -0400, John Macdonald wrote: : If a int1 (or int2 or nybble or other sub-addressable sized : value) is being referred to, a similar issue arises since most : machines these days have byte addressing, but do not have bit : addressing. If you can't refer directly t

Re: Synopsis 9 draft 1

2004-09-07 Thread John Macdonald
On Fri, Sep 03, 2004 at 11:20:05AM -0700, Larry Wall wrote: > On Fri, Sep 03, 2004 at 11:41:05AM +0100, Tim Bunce wrote: > : And that a pointer would be... what? Some platforms has odd > : sizing issues for pointers. Perhaps a "voidp" type is needed? > : (Which would just be an intN where N is size

Re: Synopsis 9 draft 1

2004-09-07 Thread Aaron Sherman
On Fri, 2004-09-03 at 20:08, 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

Re: Synopsis 9 draft 1

2004-09-06 Thread Larry Wall
On Sat, Sep 04, 2004 at 09:47:29AM +0200, Leopold Toetsch wrote: : Honestly I don't see the point why all "normal" array usage should be : slowed down just for the sake of some rare usage patterns. Another possibility is that .[] always forces the "normal" view of an array as 0-based, and if you w

Re: Synopsis 9 draft 1

2004-09-06 Thread Larry Wall
On Mon, Sep 06, 2004 at 10:13:56AM +0200, Leopold Toetsch wrote: : A different vtable implies some kind of a derived class. The question : is, if an "of shape" or "is shape" already causes a new class of : arrayish objects. : The question probably is: how much of this class code is done directly :

Re: Synopsis 9 draft 1

2004-09-06 Thread Leopold Toetsch
Larry Wall <[EMAIL PROTECTED]> wrote: > On Sat, Sep 04, 2004 at 09:47:29AM +0200, Leopold Toetsch wrote: >: Honestly I don't see the point why all "normal" array usage should be >: slowed down just for the sake of some rare usage patterns. > Does it have to? Couldn't it have a different vtable?

Re: Synopsis 9 draft 1

2004-09-05 Thread Aaron Sherman
On Thu, 2004-09-02 at 19:47, Larry Wall wrote: > This synopsis summarizes the non-existent Apocalypse 9, which > discussed in detail the design of Perl 6 data structures. It was > primarily a discussion of how the existing features of Perl 6 combine > to make it easier for the PDL folks to write

Re: Synopsis 9 draft 1

2004-09-04 Thread Larry Wall
: On Sat, Sep 04, 2004 at 09:47:29AM +0200, Leopold Toetsch wrote: : : Honestly I don't see the point why all "normal" array usage should be : : slowed down just for the sake of some rare usage patterns. On Sat, Sep 04, 2004 at 08:48:54AM -0700, Larry Wall wrote: : Does it have to? Couldn't it ha

Re: Synopsis 9 draft 1

2004-09-04 Thread Nigel Sandever
On Fri, 3 Sep 2004 17:08:00 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: > 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

Re: Synopsis 9 draft 1

2004-09-04 Thread Larry Wall
On Sat, Sep 04, 2004 at 09:47:29AM +0200, Leopold Toetsch wrote: : John Williams <[EMAIL PROTECTED]> wrote: : : > What happens when the Pascal programmer declares : : > my int @ints is shape(-10..10); : : Should that really all be in core? Why not let the user create his own : derived array

Re: Synopsis 9 draft 1

2004-09-04 Thread Sean O'Rourke
At Fri, 3 Sep 2004 17:08:00 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: > > On Fri, Sep 03, 2004 at 05:45:12PM -0600, John Williams wrote: > : If not, does @ints[-1] mean the element with index -1 or the last element? > > The element with index -1. Arrays with explicit ranges don't use the >

Re: Synopsis 9 draft 1

2004-09-04 Thread Eirik Berg Hanssen
Larry Wall <[EMAIL PROTECTED]> writes: > 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

Re: Synopsis 9 draft 1

2004-09-04 Thread Leopold Toetsch
Larry Wall <[EMAIL PROTECTED]> wrote: > On Fri, Sep 03, 2004 at 11:41:05AM +0100, Tim Bunce wrote: >: (I'm not (yet) familiar with Parrot's ManagedStruct and UnManagedStruct >: types but there's probably valuable experience there.) > Quite likely. Well, *ManagedStruct is already working pretty w

Re: Synopsis 9 draft 1

2004-09-04 Thread Leopold Toetsch
John Williams <[EMAIL PROTECTED]> wrote: > What happens when the Pascal programmer declares > my int @ints is shape(-10..10); Should that really all be in core? Why not let the user create his own derived array that does what she wants? Honestly I don't see the point why all "normal" array

Re: Synopsis 9 draft 1

2004-09-04 Thread Juerd
Larry Wall skribis 2004-09-03 17:08 (-0700): > The element with index -1. 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. @array.abs[0]; @array.abs[-1]; .abs woul

Re: Synopsis 9 draft 1

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

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 > >

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 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 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: > 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 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"?

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 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 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 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 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 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: 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 9 draft 1

2004-09-02 Thread Uri Guttman
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> =head1 Compact structs LW> A class whose attributes are all low-level types can behave as LW> a struct. (Access from outside the class is still only through LW> accessors, though.) Whether such a class is actually stored compactly