Re: specifying the key Type for a Hash

2004-12-06 Thread Nigel Sandever
On Sat, 04 Dec 2004 08:01:46 -0700, [EMAIL PROTECTED] (David Green) wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Larry Wall) wrote: S9 talk about it. We current have things like: my Cat %pet is shape(Str); and parameters to types are in square brackets, so it's more like:

Re: specifying the key Type for a Hash

2004-12-06 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Larry Wall) wrote: Maybe type parameters are just subscripts? [...] my Fight %fight does key{Dog;Cat}; I like that. But if English-like is the criterion that'd still read better as my Fight %fight has key{Dog;Cat}; I like that even

Re: iteration (was Re: Angle quotes and pointy brackets)

2004-12-06 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Matt Diephouse) wrote: On Sat, 04 Dec 2004 08:59:24 -0700, David Green [EMAIL PROTECTED] wrote: Cdoes Iterate signifies a role named Iterate. Roles are sort of a mix of interfaces and mixins (as I understand it -- I'm still waiting for E12). So

Re: specifying the key Type for a Hash

2004-12-06 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Smylers) wrote: No! Avoid synonyms. They're initially tempting, because then everybody gets to pick the one he/she wants to use, but then it turns out you need to learn all of them so as to read other people's code, and that's worse than not

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread David Green
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Luke Palmer) wrote: But what we'd really like to do is: given the user knows what push/pop do, what would they *guess* to mean shift (I tend to think that this is a very good technique for naming). And, well, I'm thinking pull. So it's a

Re: specifying the key Type for a Hash

2004-12-06 Thread Luke Palmer
David Green writes: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Larry Wall) wrote: Maybe type parameters are just subscripts? [...] my Fight %fight does key{Dog;Cat}; I like that. Yeah, me too. Except I'm having trouble seeing how key is a role. It's not adding anything into a

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Smylers
David Green writes: I guess we could always use prepend/append, pull/pop. No! Cpush and Cpop are a well-defined pair, not just in Perl, for dealing with stacks; we should keep those as they are. (And no synonyms, before somebody suggests any!) Smylers

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-06 Thread Austin Hastings
Larry Wall wrote: But here's the kicker. The null filename can again represent the standard filter input, so we end up with Perl 5's while () {...} turning into for = {...} Two more issues: idiom, and topification = Topification: There are cases in P5 when I *don't* want while ()

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Austin Hastings
Smylers wrote: Larry Wall writes: But then are we willing to rename shift/unshift to pull/put? Yes. Cunshift is a terrible name; when teaching Perl I feel embarrassed on introducing it. No! But I'd be willing to rename them to get/put. 'Pull' is the opposite of 'push', but 'pop'

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-06 Thread David Wheeler
On Dec 6, 2004, at 7:38 AM, Austin Hastings wrote: for = {...} I dub the...the fish operator! :-) David

Re: specifying the key Type for a Hash

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 05:43:16AM +, Nigel Sandever wrote: : I probably missed teh comprehensive dismissal thread, but why not 'type'? : : my %pet is Hash[:type(Str) :returns(Cat)]; Well, type is just a little off in a couple of ways. On the one hand, it's not specific enough,

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 09:06:22AM -0800, David Wheeler wrote: : On Dec 6, 2004, at 7:38 AM, Austin Hastings wrote: : :for = {...} : : I dub the...the fish operator! : : :-) Mmm. Next thing you'll know, people will name their files oddly just so they can write things like: for =///º

Topification [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 10:38:10AM -0500, Austin Hastings wrote: : Two more issues: idiom, and topification : : = Topification: : : There are cases in P5 when I *don't* want : : while () {...} : : but prefer : : while ($input = ) {...} : : so that I can have something else be the

while idiom [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 10:38:10AM -0500, Austin Hastings wrote: : = Idiom: : : The other concern is idiom. Using Cfor suggests start at the : beginning, continue to the end. OTOH, using Cwhile is a little : weaker -- keep doing this until it's time to stop. Obviously they'll : usually be

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-06 Thread Larry Wall
Or even the dead fish operator: while =###x - $net {...} And here's a flounder: while =: Larry

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 10:45:22AM -0500, Austin Hastings wrote: : But I'd be willing to rename them to get/put. If I went with get, the opposite would be unget for both historical and huffmaniacal reasons. Larry

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

2004-12-06 Thread Austin Hastings
David Wheeler wrote: On Dec 6, 2004, at 7:38 AM, Austin Hastings wrote: for = {...} I dub the...the fish operator! :-) Back before there was a WWW, I used an editor called tgif. It was written in france, and part of the idiom was to have two GUI buttons showing respectively the head ( * )

Re: while Idiom (Was: Arglist I/O)

2004-12-06 Thread Smylers
Austin Hastings writes: The other concern is idiom. Using Cfor suggests start at the beginning, continue to the end. OTOH, using Cwhile is a little weaker -- keep doing this until it's time to stop. Obviously they'll usually be used in the same way: for = {...} vs. while () {...}

Re: specifying the key Type for a Hash

2004-12-06 Thread Abhijit Mahabal
On Mon, 6 Dec 2004, Larry Wall wrote: Hmm. Also says maybe you could attach a block to a hash or array to define what subscripting does. Hmm. That's tantalizing. Did you have something like this in mind: # Count number of accesses to each key our %counter_hash; my %hash is subscripted -

Re: Topification [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Luke Palmer
Larry Wall writes: Currently it does. There have been some rumblings in the design team that maybe it shouldn't. But it occurs to me that this might be another spot to have our cake and eat it to. We could say that for @foo - $input { ... $input ... } doesn't set the topic in the

Re: while Idiom (Was: Arglist I/O)

2004-12-06 Thread Luke Palmer
Smylers writes: To me Cfor makes sense when you've got a pile of stuff you're intending to process (such as array items or lines in a file), and Cwhile makes sense when you're waiting for a condition (such as the user correctly entering her/his password) and you couldn't possibly know in

Re: while idiom [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Jonathan Scott Duff
On Mon, Dec 06, 2004 at 09:56:57AM -0800, Larry Wall wrote: On Mon, Dec 06, 2004 at 10:38:10AM -0500, Austin Hastings wrote: : Can we ditch Cfor in the examples in favor of Cwhile, for a while? :) Okay. Have an example: while =$IN - $line {...} I think that works. I'm back to

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Dan Brian
If I went with get, the opposite would be unget for both historical and huffmaniacal reasons. But get has too strong a class accessor connotation in most OO. unpull? ;-)

Re: while idiom [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 12:45:18PM -0600, Jonathan Scott Duff wrote: : On Mon, Dec 06, 2004 at 09:56:57AM -0800, Larry Wall wrote: : On Mon, Dec 06, 2004 at 10:38:10AM -0500, Austin Hastings wrote: : : Can we ditch Cfor in the examples in favor of Cwhile, for a while? :) : : Okay. Have an

Re: while Idiom (Was: Arglist I/O)

2004-12-06 Thread Elyse M. Grasso
On Monday 06 December 2004 01:26 pm, Smylers wrote: I think that Cfor reads much better than Cwhile for English-ness. Having taught Perl 5 beginners that Cforeach can be used to iterated over each item in a list, many of them then instinctively try to use the same keyword for iterating over

Re: while idiom [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Jonathan Scott Duff
On Mon, Dec 06, 2004 at 10:59:18AM -0800, Larry Wall wrote: On Mon, Dec 06, 2004 at 12:45:18PM -0600, Jonathan Scott Duff wrote: : On Mon, Dec 06, 2004 at 09:56:57AM -0800, Larry Wall wrote: : On Mon, Dec 06, 2004 at 10:38:10AM -0500, Austin Hastings wrote: : : Can we ditch Cfor in the

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Rod Adams
Dan Brian wrote: If I went with get, the opposite would be unget for both historical and huffmaniacal reasons. But get has too strong a class accessor connotation in most OO. unpull? ;-) pushf/popf. f is for front. But I still don't see anything wrong with shift/unshift. I'd prefer to avoid

slight discrepancy between S2 and S7

2004-12-06 Thread Stéphane Payrard
S2: my $foo = 42; say %MY::$foo;# prints 42 S6: Perl5ish subroutine declarations ... sub say { print qq{@_\n}; } # args appear in @_ Because Cprint has no final newline, I would expect Csay will have one. Final newline or not. What is your say? -- stef

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Jonathan Scott Duff
On Mon, Dec 06, 2004 at 01:25:29PM -0600, Rod Adams wrote: Dan Brian wrote: If I went with get, the opposite would be unget for both historical and huffmaniacal reasons. But get has too strong a class accessor connotation in most OO. unpull? ;-) pushf/popf. f is for front. Ew!

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 11:52:22AM -0700, Dan Brian wrote: : If I went with get, the opposite would be unget for both historical : and huffmaniacal reasons. : : But get has too strong a class accessor connotation in most OO. : : unpull? ;-) Given the existence of a unary = for abbreviated use,

Re: specifying the key Type for a Hash

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 03:11:15AM -0700, David Green wrote: [snip] : I like that. [snip] : I like that even better. [snip] : I'm happy with those too (perhaps because I do want to be a bit : mathematical). [snip] : is FAT? Yeah, that works for me too. =) [snip] : I would take that as an

Re: Container method calls

2004-12-06 Thread Larry Wall
On Sat, Dec 04, 2004 at 03:28:12PM -0800, Ashley Winters wrote: : On Sat, 4 Dec 2004 11:15:14 -0800, Larry Wall [EMAIL PROTECTED] wrote: : On Sat, Dec 04, 2004 at 10:25:49AM -0700, Luke Palmer wrote: : : But this convention provides much more accuracy than memorizing a list : : of methods that

Re: iterators and functions (and lists)

2004-12-06 Thread Larry Wall
On Sun, Dec 05, 2004 at 12:05:46AM +, Matthew Walton wrote: : I'm sorry, but from a C++ background, overriding postcircumfix:( ) : feels far more natural to me than setting 'is default' on some method. That only works for disambiguation if you know which .() to call in the first place. It

Re: slight discrepancy between S2 and S7

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 08:26:48PM +0100, Stéphane Payrard wrote: : S2: : : my $foo = 42; : say %MY::$foo;# prints 42 : : S6: : : Perl5ish subroutine declarations : ... : sub say { print qq{@_\n}; } # args appear in @_ : : : Because Cprint has no final

Re: Topification [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Matthew Walton
Luke Palmer wrote: The remaining problem is what to do about unary dot. Repeated here for the, er, benefit? of p6l: class Duple { has $.left; has $.right; method perform (oper) { oper($.left); oper($.right); } } Let's change that

Re: while Idiom (Was: Arglist I/O)

2004-12-06 Thread Matthew Walton
Elyse M. Grasso wrote: But you need to process the file while you haven't reached the end yet, or until you reach the end. And I can't think of an occasion where I knew going in what the length of the file I was processing was going to be. I suppose foreach might make sense if you sucked in the

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Austin Hastings
Larry Wall wrote: On Mon, Dec 06, 2004 at 11:52:22AM -0700, Dan Brian wrote: : If I went with get, the opposite would be unget for both historical : and huffmaniacal reasons. Why? (I get the huffman, not the history.) Is it just a nod to unshift? Given the existence of a unary = for abbreviated

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 03:50:42PM -0500, Austin Hastings wrote: : Larry Wall wrote: : : On Mon, Dec 06, 2004 at 11:52:22AM -0700, Dan Brian wrote: : : If I went with get, the opposite would be unget for both historical : : and huffmaniacal reasons. : : : Why? (I get the huffman, not the

Re: Topification [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Luke Palmer
Matthew Walton writes: Luke Palmer wrote: The remaining problem is what to do about unary dot. Repeated here for the, er, benefit? of p6l: class Duple { has $.left; has $.right; method perform (oper) { oper($.left); oper($.right);

Re: iterators and functions (and lists)

2004-12-06 Thread Luke Palmer
Larry Wall writes: Any foo() can return a list. That list can be a Lazy list. So the ordinary return can say: return 0...; to return an infinite list, or even return 0..., 0...; Is it just me, or did you just return *2?

Re: iterators and functions (and lists)

2004-12-06 Thread Austin Hastings
Luke Palmer wrote: Larry Wall writes: Any foo() can return a list. That list can be a Lazy list. So the ordinary return can say: return 0...; to return an infinite list, or even return 0..., 0...; Is it just me, or did you just return *2?

Re: iterators and functions (and lists)

2004-12-06 Thread Larry Wall
On Mon, Dec 06, 2004 at 06:14:56PM -0500, Austin Hastings wrote: (B: Luke Palmer wrote: (B: (B: Larry Wall writes: (B: (B: (B: Any foo() can return a list. That list can be a Lazy list. So the (B: ordinary return can say: (B: (B:return 0...; (B: (B: to return an infinite

Re: Topification [Was: Arglist I/O [Was: Angle quotes and pointy brackets]]

2004-12-06 Thread Austin Hastings
Luke Palmer wrote: class MyStream { has $.stream; method :send_one ($item) { $.stream.send($item); } method send ([EMAIL PROTECTED]) { .:send_one(BEGIN); for @data { .:send_one($_); }

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread mark . a . biggar
stuff grab :-) -- Mark Biggar [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- Original message -- On Mon, Dec 06, 2004 at 10:45:22AM -0500, Austin Hastings wrote: : But I'd be willing to rename them to get/put. If I went with get, the opposite would

Re: pull put (Was: Angle quotes and pointy brackets)

2004-12-06 Thread Ashley Winters
On Mon, 6 Dec 2004 11:34:24 -0800, Larry Wall [EMAIL PROTECTED] wrote: Though it's awfully tempting to fill in the holes in the periodic table: ($a, $b, $c) = @foo * 3; And then just say all the corresponding unaries default to 1 (or the arity of the left): $bit = + $number;

Perl 6 Summary for 2004-11-29 through 2004-12-06

2004-12-06 Thread Matt Fowles
Perl 6 Summary for 2004-11-29 through 2004-12-06 All~ Last week I asked for help identifying the source of a quotation. One friendly soul suggested Alan J. Perlis, but could not find an actual attribution. It did lead me to find a very applicable (and in my mind funny) quote

Re: iterators and functions (and lists)

2004-12-06 Thread Smylers
Larry Wall writes: As far as I can recall we haven't renamed C.specs to anything else yet. That sounds like a challenge ... Smylers