Re: implied pascal-like "with" or "express"

2000-08-29 Thread Ken Fox
"David L. Nicol" wrote: > Ken Fox wrote: > > IMHO, curries have nothing to do with this. All "with" really does is > > create a dynamic scope from the contents of the hash and evaluate its > > block in that scope. ... > But that doesn't give us the speed win we want from compiling offset lookups >

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like "with" or "express"

2000-08-24 Thread Randal L. Schwartz
> "Bart" == Bart Lateur <[EMAIL PROTECTED]> writes: Bart> On Tue, 22 Aug 2000 00:03:48 -0600 (MDT), Nathan Torkington wrote: >> Normally what you'd say is: >> >> with (%record) { >> >> } >> >> (look at me, using Larry's new ... operator :-) Bart> No you didn't. You typed four dots. T

RE: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like "with" or "express"

2000-08-24 Thread Brust, Corwin
-Original Message- From: Bart Lateur [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 23, 2000 7:00 PM To: [EMAIL PROTECTED] Subject: Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like "with" or "express" On Tue, 22 Aug 2000 00:03:48 -0600 (MDT), Nat

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-24 Thread Bart Lateur
On Thu, 24 Aug 2000 02:02:06 +0200, Markus Peter wrote: >$one{two\three\four} instead of $$$one{two}{three}{four} Isn't that $one{two}{three}{four} -- Bart.

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like "with" or "express"

2000-08-23 Thread Bart Lateur
On Tue, 22 Aug 2000 00:03:48 -0600 (MDT), Nathan Torkington wrote: >Normally what you'd say is: > > with (%record) { > > } > >(look at me, using Larry's new ... operator :-) No you didn't. You typed four dots. -- Bart.

Re: PROTOPROPOSAL FOR NEW BACKSLASH is still Re: implied pascal-like"with" or "express"

2000-08-23 Thread Damian Conway
> And that's just too much punctuation for too little value. > > How special purpose is "with"? Do people envision using it *only* on > hashes? (I did until this email) If so, I like Damian's version best: > > http://www.mail-archive.com/perl6-language@perl.org/msg02649.html

RE: PROTOPROPOSAL FOR NEW BACKSLASH is still Re: implied pascal-like"with" or "express"

2000-08-23 Thread Brust, Corwin
-Original Message- From: Jonathan Scott Duff [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 23, 2000 1:06 PM To: David L. Nicol Cc: Nathan Torkington; [EMAIL PROTECTED] Subject: Re: PROTOPROPOSAL FOR NEW BACKSLASH is still Re: implied pascal-like"with" or "express&quo

Re: implied pascal-like "with" or "express"

2000-08-23 Thread James Mastros
From: "Damian Conway" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, August 18, 2000 12:56 AM Subject: Re: implied pascal-like "with" or "express" > Aha! How about this...which would give us your desired C functionality > *and* solve a n

Re: PROTOPROPOSAL FOR NEW BACKSLASH is still Re: implied pascal-like"with" or "express"

2000-08-23 Thread Jonathan Scott Duff
On Wed, Aug 23, 2000 at 12:45:06PM -0500, David L. Nicol wrote: > with %container { > ->$fieldname = $value; > ${->destinationvaluename} = ->value_to_put_there > } Then I'd've expected that to have been: with \%container { ->{$fieldname} = $value; ${->

Re: PROTOPROPOSAL FOR NEW BACKSLASH is still Re: implied pascal-like"with" or "express"

2000-08-23 Thread David L. Nicol
Thanks, the actual effects of \ in doublequotes slipped my mind. Nathan Torkington gracefully extolled: > I'd be more receptive to something that reuses existing or similar > Perl syntax (e.g., extend ->). with %container { ->$fieldname = $value; ${->destinationvaluename}

RE: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-23 Thread Brust, Corwin
Correct me if I'm wrong here, but I think what David wanted was an easy way to reference other keys of an hash while creating one, ie: How to do this, in a line: %h = ( first => 10 ); $h{second} = $h{first} * 2; Because, as I'm sure you know, this code (when run w/out strict):

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-22 Thread Nathan Torkington
David L. Nicol writes: > Do either of those expressions make sense in terms of > references to something? If not, then syntactically we > are in the clear. They don't, because currently it makes > no sense to butt a reference up to the LHS of anything. > > It isn't any less clear than, for inst

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-22 Thread Michael Fowler
On Wed, Aug 23, 2000 at 12:17:18AM +, David L. Nicol wrote: > Nathan Torkington wrote: > > The precedent of "if you're doing a hash > > lookup, use {} around the key" is fairly well-ingrained in Perl. > > I don't care how "ingrained" the concept of wrapping the > field names in curlies is, I

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-22 Thread David L. Nicol
Nathan Torkington wrote: > Except that you often don't know the keys in advance, and so now > your code turns into: > > with %one\$keytwo { > push @\$keythree\$keyfour, 5, 6; > } > > which is decided sub-clear. Do either of those expressions make sense in terms of references to some

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-22 Thread Nathan Torkington
David L. Nicol writes: > okay but we still have the hiding issue, in case we want it to What's the hiding issue? I must have missed that. > $one{two} is $one\two > $$one{two}{three} is $one\two\three > $$$one{two}{three}{four} is $one\two\three\four Your le

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with"or "express"

2000-08-22 Thread Markus Peter
On Tue, 22 Aug 2000, David L. Nicol wrote: > And you dont have to make sure the $s on the left of the names match > the {}s on the right, just use one $ and string the names together with > backslashes. This is not easier? > > > $one{two} is $one\two > $$one{two}{three}

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-22 Thread David L. Nicol
Nathan Torkington wrote: > # making this part up > struct Person => [ qw(Name Age Height Weight) ]; > # but once you have a named structure, you can say ... > my Person %nat; > with (%nat) { > $Name = "Nathan"; # rewritten to $nat{Name} at compile-time > ... > } > > It's ki

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-21 Thread Nathan Torkington
Markus Peter writes: > > use %record{ > > > > $\interest_earned += $\balance * $\rate_daily; > > }; Guys, where in the sweet name of Jesus did this awful syntax come from? For a start, %start{ } is only analogous to a slice operation. It has no precedent in Perl. Normally what

Re: PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like"with" or "express"

2000-08-21 Thread Markus Peter
--On 18.08.2000 14:36 Uhr -0700 David L. Nicol wrote: > How about backslash, after the type-qualifier? > > use %record{ > > $\interest_earned += $\balance * $\rate_daily; > }; I don't really like having backslashes in front of ordinary characters anywhere except when I mean them :-) (\n,

Re: implied pascal-like "with" or "express"

2000-08-21 Thread David L. Nicol
Ken Fox wrote: > IMHO, curries have nothing to do with this. All "with" really does is > create a dynamic scope from the contents of the hash and evaluate its > block in that scope. Right, the "with" people are using ^hats because its an available operator, just the same way the "curry" people

Re: implied pascal-like "with" or "express"

2000-08-21 Thread Jeremy Howard
Ken Fox wrote: > Dave Storrs wrote: > > On Thu, 17 Aug 2000, Jonathan Scott Duff wrote: > > > BTW, if we define C to map keys of a hash to named place holders > > > in a curried expression, this might be a good thing: > > > > > > with %person { > > > print "Howdy, ", ^firstname, "

Re: implied pascal-like "with" or "express"

2000-08-19 Thread Ken Fox
Dave Storrs wrote: > On Thu, 17 Aug 2000, Jonathan Scott Duff wrote: > > BTW, if we define C to map keys of a hash to named place holders > > in a curried expression, this might be a good thing: > > > > with %person { > > print "Howdy, ", ^firstname, " ", ^lastname; > > } > >

PROTOPROPOSAL FOR NEW BACKSLASH was Re: implied pascal-like "with" or "express"

2000-08-18 Thread David L. Nicol
Dave Storrs wrote: > The following words could also be overloaded for this purpose: > map, use I think I like use %record{ is a macro that expands to {my \%_ = \%record; even better than the same thing without the key word.

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Damian Conway
> What if the hash keys we want to use are not valid scalar names? For example, > I've had keys like "total - female" as keys, but using the ^ syntax > would fail on this... ^{"total - female"}, just like $ variables. Damian

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Dave Storrs
On Fri, 18 Aug 2000, Jonathan Scott Duff wrote: > On Fri, Aug 18, 2000 at 10:39:36AM -0500, Brian Wheeler wrote: > > "Using" might be an interesting alternative > > Reminds me of BASIC :-) Works for me. > > What if the hash keys we want to use are not valid scalar names? For examp

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Jonathan Scott Duff
On Fri, Aug 18, 2000 at 10:39:36AM -0500, Brian Wheeler wrote: > "Using" might be an interesting alternative Reminds me of BASIC :-) > What if the hash keys we want to use are not valid scalar names? For example, > I've had keys like "total - female" as keys, but using the ^ syntax > would fai

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Brian Wheeler
I've usually been lurking, but I have a few thoughts > > On Thu, 17 Aug 2000, Jonathan Scott Duff wrote: > > > BTW, if we define C to map keys of a hash to named place holders > > in a curried expression, this might be a good thing: > > > > with %person { > > print "How

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Dave Storrs
On Thu, 17 Aug 2000, Jonathan Scott Duff wrote: > BTW, if we define C to map keys of a hash to named place holders > in a curried expression, this might be a good thing: > > with %person { > print "Howdy, ", ^firstname, " ", ^lastname; > } > > # becomes > sub {

Re: implied pascal-like "with" or "express"

2000-08-18 Thread Johan Vromans
Damian Conway <[EMAIL PROTECTED]> writes: > Okay, what if C simply aliased its hash argument to a > localized %_ (remember that one?): > > with (%ws) { > print $_{height}; # prints $ws{height} > print $height; # perl5 visibility rules >

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Damian Conway
> Mmm... yummy... And placeholder names seem to be getting a real > role in life too! I wonder if hashes used as HOF arguments in > general should use placeholder names to fill in their arguments > from the corresponding hash elements. That would be even yummier! Personally I think an

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Jeremy Howard
Damian Conway wrote: > Suppose C were a built-in function with parameter list: > > sub with (\%; ^&) {...} > > That is, C takes an explicit hash and -- optionally -- a block, sub ref, > or higher order function. > <...> > If C is called with *both* a hash and a block/sub ref/h.o.f. as > arguments,

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Damian Conway
> On Thu, Aug 17, 2000 at 10:48:25PM -0500, David L. Nicol wrote: > > Lets use hats again then. > > > > %ws{ > > print ^$height; #prints $ws{height} > > print $height; # perl5 visibility rules > > }; > > But no $ for the keys of %ws. > >

Re: implied pascal-like "with" or "express"

2000-08-17 Thread David L. Nicol
Jonathan Scott Duff wrote: > But no $ for the keys of %ws. > > %ws { > print ^height; # prints $ws{height} > print $height; # prints $height > } I'm thinking that ^name is short for $^name is short for ${^name} and the longer version is what you

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Jonathan Scott Duff
On Thu, Aug 17, 2000 at 10:48:25PM -0500, David L. Nicol wrote: > Lets use hats again then. > > %ws{ > print ^$height; #prints $ws{height} > print $height; # perl5 visibility rules > }; But no $ for the keys of %ws. %ws { print ^heigh

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Damian Conway
> Lets use hats again then. > >%ws{ >print ^$height; #prints $ws{height} >print $height; # perl5 visibility rules >}; > > AFAIK, the entirety of %name{something here} is unplowed ground, as > far as perl syntax goes. For good reason, A

Re: implied pascal-like "with" or "express"

2000-08-17 Thread David L. Nicol
Jeremy Howard wrote: > > This is one of those > few cases where VB has nicer syntax--within a 'with' block you have to > precede a property name with '.' to get the with block scope: > > dim height as double > dim ws as new Excel.worksheet // 'worksheet' has a 'height' property > > with

Re: implied pascal-like "with" or "express"

2000-08-17 Thread Jeremy Howard
David L. Nicol wrote: > Yes, absolutely, about the semantics. > > About the syntax, how about just in a block behind %HASHNAME? > > (as long as it doesn't use $a and $b, of course ) > (or if the insta-sort thing needs "sort" written in and this doesn't) > > %record{ > > $something_new = 3; # just