Re: reduce via ^

2001-10-11 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Colin exemplifies: > >> $a = 1; >> @a = (1); >> @b = (1, 2, 3); >> @c = (4, 5, 6); >> >> $a = $a ^+ @b; >> @a = @a ^+ @b; >> >> print $a; # 7 > > No. It will (probably) print: 4. Because: > > $a = $a ^

Operator function names

2001-10-16 Thread Piers Cawley
Okay, I think I understand how we're going to be mapping from an operator to a function name in most cases. But what about the ternary operator? operator:??:: Or something else. I'm assuming something else, because there may be cases in which we want to define our own ternary operators. (Wei

Apropos of nothing...

2001-12-13 Thread Piers Cawley
In the following code fragment, what context is foo() in? @ary[0] = foo() the following code @ary= foo() obviously evaluates @foo in a list context, but in the first I'm no longer sure. -- Piers "It is a truth universally acknowledged that a language in possession of a ri

Re: Apropos of nothing...

2001-12-13 Thread Piers Cawley
"Brent Dax" <[EMAIL PROTECTED]> writes: > Piers Cawley: > # In the following code fragment, what context is foo() in? > # > # @ary[0] = foo() > > The short answer is scalar context. The long answer is below. Note > that the long answer is only

Re: Apropos of nothing...

2001-12-20 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Sun, Dec 16, 2001 at 03:55:10PM +1100, Damian Conway wrote: > > [...] > >>> And, just for laughs: >>> >>> $ref = [1,2]; >>> @ary[$ref] = foo(); # probably a syntax error > > Ok, as far as I can recall, Larry hinted that arrays a

Re: Apropos of nothing...

2001-12-20 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> >$val = (foo())[0]; >> > >> > List? >> >> Scalar, obviously. > > How do you figure that? (Not a criticism: I'd really like to understand your > thought process here so I can assess the relative DWIMity of the two > alternat

Re: Apropos of nothing...

2001-12-21 Thread Piers Cawley
Resending due to BT doing bad things to good nameservers. Damian Conway <[EMAIL PROTECTED]> writes: >> >$val = (foo())[0]; >> > >> > List? >> >> Scalar, obviously. > > How do you figure that? (Not a criticism: I'd really like to understand your > thought process her

Re: Does this mean we get Ruby/CLU-style iterators?

2002-01-18 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > Reading this in Apoc 4 > > sub mywhile ($keyword, &condition, &block) { > my $l = $keyword.label; > while (&condition()) { > &block(); > CATCH { > my $t = $!.tag; > when X::

Re: Does this mean we get Ruby/CLU-style iterators?

2002-01-18 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > At 3:37 PM + 1/18/02, Piers Cawley wrote: >>Michael G Schwern <[EMAIL PROTECTED]> writes: >> >>Hmm... making up some syntax on the fly. I sort of like the idea of >>being able to do >> >> class

Re: Apo4: PRE, POST

2002-01-18 Thread Piers Cawley
"Me" <[EMAIL PROTECTED]> writes: >> [concerns over conflation of post-processing and post-assertions] > > Having read A4 thoroughly, twice, this was my only real concern > (which contrasted with an overall sense of "wow, this is so cool"). I think that people have sort of got used to the fact th

A question

2002-01-18 Thread Piers Cawley
Okay boys and girls, what does this print: my @aaa = qw/1 2 3/; my @bbb = @aaa; try { print "$_\n"; } for @aaa; @bbb -> my $a; my $b { print "$a:$b"; } I'm guessing one of: 1:1 2:2 3:3 or a syntax error, complaining about something near C<@bbb -> my $a ; my $b {> In other words, how

Re: Does this mean we get Ruby/CLU-style iterators?

2002-01-18 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Michael G Schwern writes: > : Reading this in Apoc 4 > : > : sub mywhile ($keyword, &condition, &block) { > : my $l = $keyword.label; > : while (&condition()) { > : &block(); > : CATCH { > : my $

Re: A question

2002-01-18 Thread Piers Cawley
[reformatting response for readability and giving Glenn a stiff talking to] Glenn Linderman <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: > >> Okay boys and girls, what does this print: >> >> my @aaa = qw/1 2 3/; >> my @bbb = @aaa; >> >> try

Re: Apoc4: "When do I put a semicolon after a curly?"

2002-01-19 Thread Piers Cawley
You're treating do, if, foreach as if they were keywords. I'm not entirely sure that that's still the case. And you're also forgetting the possibility of user implemented control type operators/methods. Unless I'm very much mistaken you're suggesting that we special case the parser for 'do' and a

Re: A question

2002-01-21 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : Yeah, that's sort of where I got to as well. But I just wanted to make > : sure. I confess I'm somewhat wary of the ';' operator, especially > : where it's 'unguarded' by brac

Re: A question

2002-01-21 Thread Piers Cawley
Piers Cawley <[EMAIL PROTECTED]> writes: > Larry Wall <[EMAIL PROTECTED]> writes: > >> Piers Cawley writes: >> : Yeah, that's sort of where I got to as well. But I just wanted to make >> : sure. I confess I'm somewhat wary of the ';' oper

Re: Apoc4: The loop keyword

2002-01-22 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Jan 21, 2002 at 03:27:29PM -0500, Casey West wrote: >> So you're suggesting that we fake lexical scoping? That sounds more >> icky than sticking to true lexical scoping. A block dictates scope, >> not before and not after. I don't see ick

Re: [dha@panix.com: Re: ^=~]

2002-01-22 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > I suppose this discussion also raises the vexed question whether ??:: > can also be put out to pasture in favour of: > > $val = if $x { 1 } else { 2 } Only if you can also do: if $x { $x } else { $y } = 'foo'; But that looks really scary. -

Re: Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-22 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> writes: > On Mon, Jan 21, 2002 at 03:02:06PM -0500, Tzadik Vanderhoof wrote: >> Why all the fuss? Often, you would *want* to access that lexical after the >> loop terminates, for instance to check how it terminated. > > In most cases you don't want that to h

Re: PMCs, setting, and suchlike things [forward from p6-internals]

2002-02-13 Thread Piers Cawley
"Wizard" <[EMAIL PROTECTED]> writes: > This came up on perl6-internals, and Dan liked the "try" suggestion and > suggested That I post it here for comments. I'm not subscribed to > p6-language, so you'll need to include me in any replies where you want a > response from me. > =

Re: Metadata

2002-03-19 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Charles Bunders writes: > : I came across Simon Cozens email > : (http:[EMAIL PROTECTED]/msg08641.html) again > : tonight and it got me thinking... > : > : In Perl 6 are modules compiled down to pbc (Perl byte code) going to also > : create metadata simil

A thought occured to me...

2002-03-28 Thread Piers Cawley
Wouldn't it be nice if you could do: class Foo { ... &{intern('{}')} := method ($self: $key) is lvalue { ... } } So, later, you could do: $obj = Foo.new; $obj{something} = $something_else; ie, overriding hash lookups, array lookups, whatever. (I'm using a Lispish 'intern

Re: A thought occured to me...

2002-03-28 Thread Piers Cawley
Simon Cozens <[EMAIL PROTECTED]> writes: > Piers Cawley: >> ie, overriding hash lookups, array lookups, whatever. > > Ah, you want C#/Python indexers, you do. So do I. Um... is that what you call 'em. Actually, you can already do 'use overload q|%{}|', to s

Exegesis 4

2002-04-03 Thread Piers Cawley
Over on use.perl, someone spotted what looks like a bug in the example program which (if it *is* a bug) is fixed by using unary '*', but that's not what I'm writing about here. In the discussion of the yadda yadda yadda operator, Damian says that ... in this example, Err::BadData is *never*

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Piers wrote: > >> Over on use.perl, someone spotted what looks like a bug in the example >> program which (if it *is* a bug) is fixed by using unary '*', but >> that's not what I'm writing about here. > > I'll admit I'm not sure whether it is a bug or n

Apocrypha

2002-04-03 Thread Piers Cawley
So, I've been looking at the stuff in the Apocalypses and Exegeses so far and I think I've reached the point where I can have a crack at using perl 6 to implement another programming language. Coming (possibly) to a mailing list near you, Perl6::Scheme... -- Piers "It is a truth universally

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> Good oh. BTW, (and apologies for repeating the question I asked >> elsewhere) are we going to see an updated Apocalypse 4 incorporating >> all the changes made to get E4 to work? > > Probably not any time soon. Previous Apocalypses haven't been > updat

Nested whens?

2002-04-03 Thread Piers Cawley
Just a thought, I assume that something like the following will be legal: given $msg { when Message::ACK { $msg_store.fetch( $msg.acknowledged_msg ).set_state($msg); } when Message::SMS { when .is_incoming { ... } when .is_outgoin

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> > Eventually, of course, we'll have to go back and make eveything >> > copacetic, but at the moment I think most folks would rather have us >> > working on writing unwritten A's and E's, rather than rewriting >> > written ones. ;-) >> >> Point. Maybe

Re: $^a, $^b, and friends

2002-04-03 Thread Piers Cawley
Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > On Wed, Apr 03, 2002 at 11:27:10AM -0800, Larry Wall wrote: >> They are assumed to be declared in alphabetical order. Whoa! you say, >> that could get confusing. It surely can. But if you're doing >> something complicated enough that alphabetic

Re: Exegesis 4

2002-04-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Larry explained: > >> : Umm. didn't you say bare blocks were going away? >> >> Rule #2 was invoked. >> >> The current thinking is that any bare block will never be interpreted >> as returning a closure. You have to use explicit C or C >> to retur

Re: $^a, $^b, and friends

2002-04-05 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Dan Sugalski writes: > : >Strict, but doesn't really matter. Nobody sane will use anything other > : >than $^a and $^b. > : > : Well Are we allowing non-latin characters in identifiers? There > : may be potential interesting ramifications with those

Re: $^a, $^b, and friends

2002-04-05 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : Larry Wall <[EMAIL PROTECTED]> writes: > : > : > Dan Sugalski writes: > : > : >Strict, but doesn't really matter. Nobody sane will use anything other > : > : >than $^a and $^b. &

Tail Recursion optimization

2002-04-05 Thread Piers Cawley
So, here I am working on a Scheme interpreter in Perl 6, and I'm trying to write it in a (for want of a better description) 'Scheme-like' fashion with lots of recursion. The trouble is, unless Perl6 is going to be guaranteed to do optimization of tail calls, this is going to lead to horribly slo

Re: Questions about private variables

2002-04-05 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Joe Gottman wrote: >> For instance, what would happen in the >> following code? >> >> sub func1() { >> our $varname is private \\= 1; >> return $varname; >> } >> >> sub func2() { >> our $varname is private \\= 2; > > Fatal error: "Private v

Re: Tail Recursion optimization

2002-04-06 Thread Piers Cawley
"Jonathan E. Paton" <[EMAIL PROTECTED]> writes: >> : Piers Cawley writes: >> : >> : So, here I am working on a Scheme interpreter in Perl 6, and I'm >> : trying to write it in a (for want of a better description) >> : 'Scheme-like

Re: Tail Recursion optimization

2002-04-06 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > At 11:45 PM +0100 4/5/02, Piers Cawley wrote: >>So, here I am working on a Scheme interpreter in Perl 6, and I'm >>trying to write it in a (for want of a better description) >>'Scheme-like' fashion with lots

Re: $^a, $^b, and friends

2002-04-06 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Rafael Garcia-Suarez writes: > : Larry Wall wrote in perl.perl6.language : > : > > : > Such a grammar switching routine could operate either over a lexical > : > scope or over the rest of the file. The only restriction is that > : > one module not clobbe

Re: $^a, $^b, and friends

2002-04-06 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : In a use.perl post not far away I sketched out something like the following: > : > : module foo is Mixin { > : > : sub category($category, &block) { > : &block.abst

Unary dot

2002-04-06 Thread Piers Cawley
Whilst I've been hacking the perl 6 scheme interpreter I've found myself using code like the following method get_token( $self: ) { given $self.get_char { when !defined { fail IOException: msg=> "EOF" } when /\s/ { $self.get_token } when '(' { $the_left_paren }

Re: Bracekets

2002-04-07 Thread Piers Cawley
"Jonathan E. Paton" <[EMAIL PROTECTED]> writes: > but wait, there's more... what does: > > @multi_dim[$a][$b][$c] > > give? Who cares? So long as the intermediate results in @multi_dim.[$a].[$b].[$c] respond to []. -- Piers "It is a truth universally acknowledged that a language in poss

Re: Unary dot

2002-04-07 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Piers asked: > >> So, is there any chance that we'll be able to do: >> >> class ical { >> use object_name '$self'; >> >> method ical { >> given $self.ology { >> ... { $self.ish } >> } >> } >> } > > Of course, if you

Re: Ex4 smart match question

2002-04-08 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Incidentally, the table of C<=~> comparisons (Table 1) at: > > http://dev.perl.org/perl6/apocalypse/4 > > suggests that hash/hash matching is equivalent to: > > match if grep exists $a{$_}, $b.keys > > I hope to convince Larry that it would b

Re: Bracekets

2002-04-08 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > At 2:33 PM +0100 4/7/02, Piers Cawley wrote: >>"Jonathan E. Paton" <[EMAIL PROTECTED]> writes: >>> but wait, there's more... what does: >>> >>> @multi_dim[$a][$b][$c] >>> >&g

Re: Bracekets

2002-04-08 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Mon, 2002-04-08 at 13:01, Jonathan E. Paton wrote: > >> I'm I beating this point to death, or do I have to write >> the RPC: >> >> "Keep the {} and [] notation for hashes and arrays" >> >> or >> >> "Save our array!" > > Let's boil this RFC down to

Re: Bracekets

2002-04-08 Thread Piers Cawley
"Mark J. Reed" <[EMAIL PROTECTED]> writes: > On Mon, Apr 08, 2002 at 07:56:11PM +0100, Piers Cawley wrote: >> > Also, just wondering: >> > >> >$_[_][EMAIL PROTECTED] _=_0_-_ >> > >> > does that work the way I expect it to? &

Re: Unary dot

2002-04-09 Thread Piers Cawley
Me <[EMAIL PROTECTED]> writes: >> But suppose you want all .foo to refer to self and not >> to the current topic. > > What about > > given (self) { } > > Also, what about > > use invocant; > > resulting in all method bodies in scope getting an implied > surrounding given (self) { ...

Re: Bracekets

2002-04-09 Thread Piers Cawley
Jonathan Scott Duff <[EMAIL PROTECTED]> writes: > On Tue, Apr 09, 2002 at 04:17:38PM +0100, Simon Cozens wrote: >> Aaron Sherman: >> >nice du -a | sort -n | tail -300 | tac | perl -nle ' >> >die "Require non-zero disk size!\n" unless $ENV{DF}; >> >if ($. == 1) { >> >

Re: Bracekets

2002-04-09 Thread Piers Cawley
Simon Cozens <[EMAIL PROTECTED]> writes: > Piers Cawley: >> Well, no. Because Perl 6 is specified as behaving like perl 5 until >> told different. Which means that the first translation you give would >> be a syntax error. > > Ouch. Guess I need to go reread

Re: Unary dot

2002-04-09 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Me writes: > : > But suppose you want all .foo to refer to self and not > : > to the current topic. > : > : What about > : > : given (self) { } > > That wouldn't have the same effect as what we're talking about--it'd be > overruled by any C with

I'll show you mine...

2002-04-10 Thread Piers Cawley
Okay, this is the beginnings of Scheme in Perl6. I'm sure there's stuff I'm getting wrong. I've not written the parser yet for instance and I'm toying with waiting for A5 before I do. Also, I've not yet implemented such important stuff as proper closures/lambda or the environment chain, but the un

Re: I'll show you mine...

2002-04-10 Thread Piers Cawley
In message <[EMAIL PROTECTED]>, I wrote: > [ A huge wodge of possible perl 6 code ] I'm getting that Warnock's Dilemma feeling here... Did I stun you all into silence? -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a re

Re: I'll show you mine...

2002-04-10 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Wed, 2002-04-10 at 10:03, Piers Cawley wrote: >> In message <[EMAIL PROTECTED]>, I wrote: >> > [ A huge wodge of possible perl 6 code ] >> >> I'm getting that Warnock's Dilemma feeling here...

Re: I'll show you mine...

2002-04-10 Thread Piers Cawley
Melvin Smith <[EMAIL PROTECTED]> writes: > At 09:23 AM 4/10/2002 +0100, Piers Cawley wrote: >>Okay, this is the beginnings of Scheme in Perl6. I'm sure there's >>stuff I'm getting wrong. I've not written the parser yet for instance > > Very nice!

Re: Unary dot

2002-04-10 Thread Piers Cawley
Melvin Smith <[EMAIL PROTECTED]> writes: > At 10:50 AM 4/10/2002 -0700, Glenn Linderman wrote: >>"Mark J. Reed" wrote: >> > >> > On Wed, Apr 10, 2002 at 10:30:25AM -0700, Glenn Linderman wrote: >> > > method m1 >> > > { >> > >m2; # calls method m2 in the same class >> > Yes, but does it call

Re: Unary dot

2002-04-10 Thread Piers Cawley
Graham Barr <[EMAIL PROTECTED]> writes: > On Wed, Apr 10, 2002 at 01:35:22PM -0400, Mark J. Reed wrote: >> On Wed, Apr 10, 2002 at 10:30:25AM -0700, Glenn Linderman wrote: >> > method m1 >> > { >> >m2; # calls method m2 in the same class >> Yes, but does it call it as an instance method on t

Re: Unary dot

2002-04-10 Thread Piers Cawley
Glenn Linderman <[EMAIL PROTECTED]> writes: > Graham Barr wrote: >> >> On Wed, Apr 10, 2002 at 01:35:22PM -0400, Mark J. Reed wrote: >> > On Wed, Apr 10, 2002 at 10:30:25AM -0700, Glenn Linderman wrote: >> > > method m1 >> > > { >> > >m2; # calls method m2 in the same class >> > Yes, but do

Re: none

2002-04-10 Thread Piers Cawley
Ashley Winters <[EMAIL PROTECTED]> writes: >> Patches welcome. > > Excellent... > > Forgive any formatting errors, I have mail issues. Thanks, applying. With a few caveats. > @@ -62,6 +62,7 @@ > class SchemePair is SchemeExpr { >my $nil //= class is SchemeExpr { > method is_nil {1} >

Re: Unary dot

2002-04-10 Thread Piers Cawley
"Mark J. Reed" <[EMAIL PROTECTED]> writes: > On Wed, Apr 10, 2002 at 07:57:01PM +0100, Piers Cawley wrote: >> > ::m2; # calls global subroutine main::m2 >> > main::m2; # calls global subroutine main::m2 >> >> This is looking more and more

Re: Unary dot

2002-04-10 Thread Piers Cawley
"David Whipp" <[EMAIL PROTECTED]> writes: > Piers Cawley >> > This may be a case of keep up at the back, but if that is a >> method call, >> > how do I call a subroutine from within a method ? >> >> [...] >> >> Yes, I know

Re: Unary dot

2002-04-10 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: [...] > Reflecting on this, it seems that it would be useful if methods > implicitly did their default topicalization-of-invocant like so: > > -> $self > > rather than just: > > -> $_ > > That is, that as well as aliasing the invocant to $_,

Re: Unary dot

2002-04-10 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: >> > $.foo >> >> It's already defined as an instance variable. > > I don't think I like that. Instance variables are far more common that > class variables, so why not just $foo, and you could use a compile-time > property for class variables. Lik

Re: Defaulting params

2002-04-10 Thread Piers Cawley
"Miko O'Sullivan" <[EMAIL PROTECTED]> writes: > The current plans indicate that a subroutine's params should be defaulted > like this: > >sub load_data ($filename ; $version / /= 1) {...} > > (The space between / and / is on purpose, my emailer has problems if > they are together.) If that's

Re: Defaulting params

2002-04-10 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Piers wrote: > >> one could always handle the first case >> more explicitly by doing: >> >>sub load_data ($filename; $version) { >> $version = 1 if @_.length < 2; >> ... >>} > > Err...no. If you specify named parameters, you don't g

Re: Defaulting params

2002-04-11 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Thu, 2002-04-11 at 00:47, Damian Conway wrote: > >> sub load_data ($filename) { load_data($filename, 1) } >> >> sub load_data ($filename, $version) {...} > > Interesting. This brings goto to mind. Above, I could just assume > that inlining

Re: How to default? (was Unary dot)

2002-04-12 Thread Piers Cawley
Trey Harris <[EMAIL PROTECTED]> writes: > I think I've missed something, even after poring over the archives for > some hours looking for the answer. How does one write defaulting > subroutines a la builtins like print() and chomp()? Assume the code: > > for <> { > printRec; > } > pri

Re: Fisher-Yates shuffle

2002-04-12 Thread Piers Cawley
[EMAIL PROTECTED] writes: > As for "cleanness", this is my interpretation of how perl6 is going > to work: > > %foo = (); > if %foo {"key"} {print "Hello 1"} > > %foo = (); > if %foo{"key"} {print "Hello 2"} > > %foo = (); > if %foo{"key"}{print "Hello 3"

Re: Fisher-Yates shuffle

2002-04-12 Thread Piers Cawley
[EMAIL PROTECTED] writes: > On Fri, Apr 12, 2002 at 04:00:37PM +0100, Piers Cawley wrote: >> >> [EMAIL PROTECTED] writes: >> > As for "cleanness", this is my interpretation of how perl6 is going >> > to work: >> > >>

Re: Fisher-Yates shuffle

2002-04-12 Thread Piers Cawley
[EMAIL PROTECTED] writes: > On Fri, Apr 12, 2002 at 04:42:07PM +0100, Piers Cawley wrote: >> [EMAIL PROTECTED] writes: >> > >> > Why isn't >> > >> > if %foo {"key"} {print "Hello 1"} >> > >> > equivalent

Re: Subroutine variables are like underwear

2002-04-15 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Yes, subroutine variables *are* like underwear. > But parameter names *aren't* like underwear. > Because they're not (primarily) subroutine variables. > > So they're like the labels on the knobs, dials, and buttons of your > favourite elctronic device.

Re: Unary dot

2002-04-16 Thread Piers Cawley
Andy Wardley <[EMAIL PROTECTED]> writes: > On Mon, Apr 15, 2002 at 07:24:13PM -0700, Larry Wall wrote: >> So the main reason that objects can function as hashes is so that the >> user can poke an object into an interface expecting a hash and have it >> "make sense", to the extent that the object i

Scary things

2002-04-16 Thread Piers Cawley
Also known as constructs you wish you hadn't discovered. So, I'm reading through Finkel and I came across the following, which computes the greatest common divisor of a and b (recast into perl6ish syntax) while { when $a < $b { $b -= $a } when $b < $a { $a -= $b } } The idea is that

Re: Hashes, Stringification, Hashing and Strings

2002-04-16 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Tue, 2002-04-16 at 14:00, Mike Lambert wrote: >> Speaking of which, how do we ensure the immutability of keys being put >> into the hash? I think Perl copied the string, so that: >> >> $b = "aa"; >> $a{$b} = 1; >> chop $b; >> print $a{"aa"}; >> >>

Re: Hashes, Stringification, Hashing and Strings

2002-04-16 Thread Piers Cawley
David Wheeler <[EMAIL PROTECTED]> writes: > On 4/16/02 11:57 AM, "Piers Cawley" <[EMAIL PROTECTED]> claimed: > >> Personally I'd like the default hash to return some immutable, unique >> and probably opaque object id (something the like >> 

Re: Regex and Matched Delimiters

2002-04-23 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > /^pat$/m /^^pat$$/ $$ is no longer the current PID? Or will we have to call that '${$}' in a regex? -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite."

Re: Regex and Matched Delimiters

2002-04-23 Thread Piers Cawley
"Brent Dax" <[EMAIL PROTECTED]> writes: > Larry Wall: > That's...odd. Is $$ (the variable) going away? > > # /./s// or /<.>/ ??? > > I think that . is too common a metacharacter to be relegated to > this. I think you failed to notice that '/s' on the regex. In general . w

Re: Loop controls

2002-05-01 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: > On Tue, 30 Apr 2002, Miko O'Sullivan wrote: > >> > Damian, now having terrible visions of someone suggesting C ;-) >> >> Then may I also give you nightmares on: elsdo, elsdont, elsgrep, elstry ... > > Ooh! Why don't we have a dont command! With several

What does this do?

2002-05-03 Thread Piers Cawley
Consider the following. sub foo {...} foo *@ary; foo * @ary; Is this another place where whitespace will have meaning? Or should I add parentheses to disambiguate? Enquiring minds want to know. -- Piers "It is a truth universally acknowledged that a language in possession of

Re: What does this do?

2002-05-07 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : Consider the following. > : > :sub foo {...} > : > :foo *@ary; > :foo * @ary; > : > : Is this another place where whitespace will have meaning? Or should I > : add parentheses t

Re: Accessor methods ?

2002-05-10 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Aaron Sherman wrote: > >> > What if I want my methods to be called C<.get_bar()> and C<.set_bar()>, >> > since a certain Perl OO specialist suggests this approach is best for >> > avoiding ambiguity in one's API? >> >> Then you can declare them as such

Re: Loop controls

2002-05-10 Thread Piers Cawley
"Miko O'Sullivan" <[EMAIL PROTECTED]> writes: > From: "Damian Conway" <[EMAIL PROTECTED]> >> while (my $res = $search->getnext) { ...} >> >> has a valid meaning in Perl 6. In fact, it's meaning in Perl 6 is far more >> reasonable than in Perl 5. > > I don't think the new meaning makes sense at al

Re: Idea

2002-05-24 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: >> >The rest of this message assumes that the answer to A is "run time error". >> >> I'm not sure that's correct. Might just be a runtime warning, > > I would assume not. How can we optimize if we just make it a > warning? By only optimizing in the prese

Re: A5: a few simple questions

2002-06-06 Thread Piers Cawley
Allison Randal <[EMAIL PROTECTED]> writes: > On Thu, Jun 06, 2002 at 10:38:39AM -0400, John Siracusa wrote: >> On 6/6/02 2:43 AM, Damian Conway wrote: >> > rule wordlist { (\w+) [ , (\w+) ]* } >> >> No semicolon at the end of that line? I've already forgotten the "new >> rules" for that type

Re: Apoc 5 questions/comments

2002-06-11 Thread Piers Cawley
Andy Wardley <[EMAIL PROTECTED]> writes: > On Sat, Jun 08, 2002 at 06:51:19AM +1000, Damian Conway wrote: >> I have no doubt that, once Perl 6 is available, we'll see a rash of >> modules released in the Grammar:: namespace. Including >> Grammar::HTML and Grammar::XML. > > I have no doubt that, o

Perl 6 summary for the week ending 23rd June 2002

2002-06-24 Thread Piers Cawley
=head1 This week on Perl 6 (17-23 June 2002) by Piers Cawley, 020020624 =head2 Notes It's been a while since the last Perl 6 digest and summarizing everything that's happened since then would take, ooh, a while. So I've punted on that, and just pretended that the last one was

Re: @array = %hash

2002-09-02 Thread Piers Cawley
Uri Guttman <[EMAIL PROTECTED]> writes: >> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes: > > SC> [EMAIL PROTECTED] (Damian Conway) writes: > >> > hashes can now take objects as keys and won't just stringify them. > >> > >> Correct. But I believe that's only if the hash has a prope

Re: @array = %hash

2002-09-03 Thread Piers Cawley
David Whipp <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: >> Maybe we should just say 'sod it' and implement the entire Smalltalk >> Collection hierarchy and have done with it? Sets, bags, hashes >> (dictionaries for the Smalltalker), whatever, all have

Implementing new control structures

2002-09-03 Thread Piers Cawley
This came up in a discussion on London.pm about Damian's Perl 6 talk, which led us to wonder about control exceptions and how they're handled. At the moment, control exceptions fall into the 'vaguely handwavy' category, and what follows is my attempt to work out how I think they should behave...

Re: @array = %hash

2002-09-03 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > Uri Guttman wrote: > >> but what simon was saying (and i agree) is the the pair IS a single >> item. it becomes the key and its value is 'scalars'. > > No. If it's a PAIR, then its key is the key and its value is the value. > > >> hashes can now take ob

Perl 6 Summary for week ending 2002-09-01

2002-09-03 Thread Piers Cawley
xing", pairs => "and", "scalars"); It turns out that the @kv_array case will Just Work, and the last case will cause discussion to break out. Damian thought that the example above would throw an error because there are 5 elements in the list.

Re: regex args and interpolation

2002-09-06 Thread Piers Cawley
Nicholas Clark <[EMAIL PROTECTED]> writes: > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: >> What is really needed is something that converts the date syntax >> to normal Perl code: >> >>rule iso_date { () - >>() - >>() >>

Re: regex args and interpolation

2002-09-06 Thread Piers Cawley
Nicholas Clark <[EMAIL PROTECTED]> writes: > On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote: >> Nicholas Clark <[EMAIL PROTECTED]> writes: >> >> > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: >> >> What is really n

Perl 6 summary for week ending 2002-09-08

2002-09-10 Thread Piers Cawley
Lists for languages/scheme Jügen Bömmels offered a patch implementing Scheme pairs, using simple Arrays. Dan was impressed, and wondered how far we were from 'real' scheme. Jürgen thinks we're quite some way away; we still need symbols, strings, lexicals, functions, macro

Blocks and semicolons

2002-09-11 Thread Piers Cawley
So, the new rule for blocks and when the need semicolons seems to be "You don't need a semicolon if the block is the last argument of a subroutine which expects a block as its last argument", which is all very well and all, but where does that leave: sub foo ( &block ) {...} ... $wibb

Re: Blocks and semicolons

2002-09-11 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: > This is for everyone: < >In Perl, this problem comes up most often when people say "Why do I >have to put a semicolon after do {} or eval {} when it looks like a >complete statement?" > >Well, in Perl 6, you don't, if the final c

Perl 6 Summary for week ending 2002-09-15

2002-09-18 Thread Piers Cawley
rlink.com/?M2E0225D1 Scheme Implementation Details Jürgen Bömmels and Piers Cawley continued their discussion of how to go about implementing a scheme interpreter, and "lambda" in particular. Piers made noises about a proof of concept implementation of Scheme that he&#x

Re: Perl 6 Summary for week ending 2002-09-15

2002-09-18 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Wed, 2002-09-18 at 11:42, Piers Cawley wrote: >> The Perl 6 Summary for the Week Ending 20020915 >> Happy birthday to me! > > Indeed! > > And thank you so much for this. You have a way of taking a tangled

Re: Perl 6 Summary for week ending 2002-09-15

2002-09-19 Thread Piers Cawley
Leopold Toetsch <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: > >> Happy birthday to me! > > > Congratulations. > >> ... by my turning 35 on the 15th > > > 44 on 16th - yes Sept. Congrats to you too. So, should I start maintaining a birt

Perl 6 Summary for week ending 2002-09-22

2002-09-25 Thread Piers Cawley
The Perl 6 Summary for the Week Ending 20020822 So, another week, another Perl 6 summary. Let's see if I can get through this one without calling Tim Bunce 'Tim Bunch' shall we? Or maybe I should leave a couple of deliberate errors in as a less than cunning ploy to get more feedbac

Perl 6 summary for week ending 2002-09-29

2002-10-01 Thread Piers Cawley
arrot, and if there wasn't, how should he go about writing one? My tip: Do it, use the tools you prefer to make the kind of guide you would have welcomed finding when you first came to parrot. Just don't use proprietary formats. Heck, it's how I started writing thes

<    1   2   3   4   5   6   >