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: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread Jonathan Lang
David Green wrote: > It is kind of comfortable. Which is why I think I'd like to keep the > redundant nth (if we have "first" and "last"), aka 'th (where nth($i) > and $i'th are just pre- and postfixed versions of each other). Especially important since there's a potential ambiguity problem bet

Re: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread David Green
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Luke Palmer) wrote: >sub wn($n) { $n ?? wn($n-1)+1 :: $w } >$w2 = 0... + wn«0...; >assert($w2 == $w*2); >Just think of the possibilities! :-) Hm. Needs more Unicode. =) >Seriously though, putting 1st, 2nd, nth, etc. in the langua

Re: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread David Green
On 2004/9/04, [EMAIL PROTECTED] (Larry Wall) wrote: >Yow. Presumably "nth" without an argument would mean the last. So >@ints[1st..nth] >means >@ints[*] Yeah, I was thinking something like that. And if the arg is an actual array, maybe it returns the max dimension(s)? I think you'd ge

Re: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread Luke Palmer
David Green writes: > The actual issue is how to distinguish cardinal numbers from ordinals, > right? So if we want ordinal numbers, why not use ordinals? While we're here, I think perl should understand ordinals (http://mathworld.wolfram.com/OrdinalNumber.html), too. The syntax is quite ready

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

2004-09-04 Thread John Williams
On Sat, 4 Sep 2004, Juerd wrote: > John Williams skribis 2004-09-03 23:06 (-0600): > > > (A and Z) > > I think I'd prefer alpha and omega. > > Why not use Cyrillic or Korean or the secret code alphabet we used in > school? I meant the actual words "alpha" and "omega", because they're like A and Z

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: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread Adam D. Lopresto
On Sat, 4 Sep 2004, David Green wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (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. > > The actual issue is how to distinguish cardinal numbers from ordinals, > right?

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: The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread Larry Wall
On Sat, Sep 04, 2004 at 08:30:27AM -0600, David Green wrote: : I actually found things I liked in pretty much all the suggested : alternatives, but none of them reached out and grabbed me by the throat : the way "nth" did. It just seems more Perlish. Yow. Presumably "nth" without an argument w

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

The first shall be first (was "Re: parameter contexts (was: Synopsis 9 draft 1)")

2004-09-04 Thread David Green
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (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. Just think of all the trouble it would cause in the summaries: 'Meanwhile, in perl6-language, there was much discussion about Z.

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: parameter contexts (was: Synopsis 9 draft 1)

2004-09-04 Thread Juerd
John Williams skribis 2004-09-03 23:06 (-0600): > > (A and Z) > I think I'd prefer alpha and omega. Why not use Cyrillic or Korean or the secret code alphabet we used in school? I don't like using letters for array indexes, but if they're used, please keep it ascii :) Juerd

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

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

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

Synopsis 9 draft 1

2004-09-02 Thread Larry Wall
=head1 Overview 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 numeric Perl. =head1 Lazy lists All l