Re: Syntax of using Perl5 modules?

2005-05-25 Thread Darren Duncan
At 12:06 PM +0800 5/25/05, Autrijus Tang wrote: So, this now works in Pugs with (with a env PUGS_EMBED=perl5 build): use Digest--perl5; my $cxt = Digest.SHA1; $cxt.add('Pugs!'); # This prints: 66db83c4c3953949a30563141f08a848c4202f7f say $cxt.hexdigest; This includes the

Re: (1,(2,3),4)[2]

2005-05-25 Thread TSa (Thomas Sandlaß)
Juerd wrote: An array in scalar context evaluates to a reference to itself. A hash in scalar context evaluates to a reference to itself. An array in list context evaluates to a list of its elements. A hash in list context evaluates to a list of its elements (as pairs). Array context is a

Re: (1,(2,3),4)[2]

2005-05-25 Thread Juerd
TSa (Thomas Sandlaß) skribis 2005-05-25 10:47 (+0200): I have understand what you mean and how you---and other p6l'er--- derive [EMAIL PROTECTED] == 1 from @a = [1,2,3]. But allow me to regard this as slightly inconsistent, asymmetric or some such. If you STILL don't understand that it has

Re: Perl6 and support for Refactoring IDE's

2005-05-25 Thread Piers Cawley
Luke Palmer [EMAIL PROTECTED] writes: On 5/6/05, J Matisse Enzer [EMAIL PROTECTED] wrote: I've become scared that if Perl is to continue to be viable for large, complex, multi-developer projects that the tools need to serious catch-up with what is available for Java, for example. Things like:

Re: Perl6 and support for Refactoring IDE's

2005-05-25 Thread Deborah Pickett
Piers Cawley wrote: One of the 'mental apps' that's been pushing some of the things I've been asking for in Perl 6's introspection system is a combined refactoring/debugging/editing environment for the language. One of the annoyances of the 'only perl can parse Perl' thing is not so much the

Re: (1,(2,3),4)[2]

2005-05-25 Thread TSa (Thomas Sandlaß)
Juerd wrote: If you STILL don't understand that it has nothing to do with inconsistency or asymmetry, then please allow me to at this point give up and stop trying to explain. I would bewail that, because your explainations are very clear. And it might appear different but I'm just trying to

Re: (1,(2,3),4)[2]

2005-05-25 Thread Juerd
TSa (Thomas Sandlaß) skribis 2005-05-25 13:53 (+0200): %a = ( a = 1, b = 2, c = 3 ) # @a = (1,2,3) HASH = THREE PAIRS I look at it as infix:{'='}:( Hash, List of Pair : -- Ref of Hash ) and then try to understand how it behaves. BTW, I'm neither sure of the type of the second invocant

Re: Virtual methods

2005-05-25 Thread Piers Cawley
Aaron Sherman [EMAIL PROTECTED] writes: On Wed, 2005-05-18 at 10:51, Luke Palmer wrote: Except that mixins like this always treat things as virtual. Whenever you mixin a role at runtime, Perl creates an empty, anonymous subclass of the current class and mixes the role in that class. Since

Re: (1,(2,3),4)[2]

2005-05-25 Thread TSa (Thomas Sandlaß)
Juerd wrote: If assigning a ref to a hash uses the hashref's elements, then the same is to be expected for an array. Same feeling here. But I would let the array concede. Because this behaviour is unwanted for arrays (because you then can't assign a single arrayref anymore without doubling

Re: comprehensive list of perl6 rule tokens

2005-05-25 Thread Mark A. Biggar
Jonathan Scott Duff wrote: On Tue, May 24, 2005 at 11:24:50PM -0400, Jeff 'japhy' Pinyan wrote: I wish !prop X was allowed. I don't see why !... has to be confined to zero-width assertions. I don't either actually. One thing that occurred to me while responding to your original email was

Re: Syntax of using Perl5 modules?

2005-05-25 Thread Terrence Brannon
Autrijus Tang [EMAIL PROTECTED] writes: So, this now works in Pugs with (with a env PUGS_EMBED=perl5 build): use Digest--perl5; my $cxt = Digest.SHA1; $cxt.add('Pugs!'); # This prints: 66db83c4c3953949a30563141f08a848c4202f7f say $cxt.hexdigest; This includes the

Re: (1,(2,3),4)[2]

2005-05-25 Thread Mark Reed
[1,2,3] is not an array or a list. It is a reference to an anonymous array. It is not 3 values; it¹s 1 value, which happens to point to a list of size 3. If you assign that to an array via something like @a = [1,2,3], I would expect at least a warning and possibly a compile-time error. If it

Re: comprehensive list of perl6 rule tokens

2005-05-25 Thread Jeff 'japhy' Pinyan
On May 25, Jonathan Scott Duff said: On Tue, May 24, 2005 at 11:24:50PM -0400, Jeff 'japhy' Pinyan wrote: I wish !prop X was allowed. I don't see why !... has to be confined to zero-width assertions. I don't either actually. One thing that occurred to me while responding to your original

Re: Perl6 and support for Refactoring IDE's

2005-05-25 Thread Stevan Little
On May 25, 2005, at 5:39 AM, Piers Cawley wrote: One of the 'mental apps' that's been pushing some of the things I've been asking for in Perl 6's introspection system is a combined refactoring/debugging/editing environment for the language. Maybe I have been reading too much about Smalltalk

Re: comprehensive list of perl6 rule tokens

2005-05-25 Thread Jeff 'japhy' Pinyan
On May 25, Mark A. Biggar said: Jonathan Scott Duff wrote: On Tue, May 24, 2005 at 11:24:50PM -0400, Jeff 'japhy' Pinyan wrote: I wish !prop X was allowed. I don't see why !... has to be confined to zero-width assertions. I don't either actually. One thing that occurred to me while

Re: comprehensive list of perl6 rule tokens

2005-05-25 Thread Mark A. Biggar
Jeff 'japhy' Pinyan wrote: On May 25, Mark A. Biggar said: Jonathan Scott Duff wrote: On Tue, May 24, 2005 at 11:24:50PM -0400, Jeff 'japhy' Pinyan wrote: I wish !prop X was allowed. I don't see why !... has to be confined to zero-width assertions. I don't either actually. One thing

hash slice from array items

2005-05-25 Thread Carl Franks
Is [EMAIL PROTECTED] the correct way to get a hash slice using elements of an array? (it's giving me a compilation error with pugs) Cheers, Carl

Re: hash slice from array items

2005-05-25 Thread Jonathan Scott Duff
On Wed, May 25, 2005 at 05:00:39PM +0100, Carl Franks wrote: Is [EMAIL PROTECTED] the correct way to get a hash slice using elements of an array? Yep. (it's giving me a compilation error with pugs) Works just fine for me. What version of pugs are you using? Perhaps you need to upgrade.

Re: Syntax of using Perl5 modules?

2005-05-25 Thread Dave Whipp
Autrijus Tang wrote: So, this now works in Pugs with (with a env PUGS_EMBED=perl5 build): use Digest--perl5; my $cxt = Digest.SHA1; $cxt.add('Pugs!'); # This prints: 66db83c4c3953949a30563141f08a848c4202f7f say $cxt.hexdigest; This includes the Digest.pm from Perl 5.

Re: hash slice from array items

2005-05-25 Thread Carl Franks
On 5/25/05, Jonathan Scott Duff [EMAIL PROTECTED] wrote: Works just fine for me. What version of pugs are you using? Perhaps you need to upgrade. Ok, I've just realised I had missed a '-' to '.' in my perl5 to perl6 conversion, I was trying to do [EMAIL PROTECTED] = $obj-list; I wasn't sure

Re: Perl6 and support for Refactoring IDE's

2005-05-25 Thread Luke Palmer
On 5/25/05, Deborah Pickett [EMAIL PROTECTED] wrote: I'm afraid that because of the dynamic parse/execute nature of Perl, it may be a theoretically intractable problem to parse Perl safely. Yep. It's not really possible for the parser to distinguish between: BEGIN {

Re: Syntax of using Perl5 modules?

2005-05-25 Thread Rod Adams
Autrijus Tang wrote: So, this now works in Pugs with (with a env PUGS_EMBED=perl5 build): use Digest--perl5; my $cxt = Digest.SHA1; $cxt.add('Pugs!'); # This prints: 66db83c4c3953949a30563141f08a848c4202f7f say $cxt.hexdigest; This includes the Digest.pm from Perl 5. DBI.pm,

Re: (1,(2,3),4)[2]

2005-05-25 Thread Rod Adams
TSa (Thomas Sandlaß) wrote: You mean @a = [[1,2,3]]? Which is quite what you need for multi dimensional arrays anyway @m = [[1,2],[3,4]] and here you use of course @m[0][1] to pull out the 2. I'm not sure if this automatically makes the array multi-dimensional to the type system though. That

Re: (1,(2,3),4)[2]

2005-05-25 Thread Austin Hastings
--- Rod Adams [EMAIL PROTECTED] wrote: TSa (Thomas Sandlaß) wrote: You mean @a = [[1,2,3]]? Which is quite what you need for multi dimensional arrays anyway @m = [[1,2],[3,4]] and here you use of course @m[0][1] to pull out the 2. I'm not sure if this automatically makes the array

Re: (1,(2,3),4)[2]

2005-05-25 Thread Rod Adams
Austin Hastings wrote: --- Rod Adams [EMAIL PROTECTED] wrote: TSa (Thomas Sandlaß) wrote: You mean @a = [[1,2,3]]? Which is quite what you need for multi dimensional arrays anyway @m = [[1,2],[3,4]] and here you use of course @m[0][1] to pull out the 2. I'm not sure if this

This week's Perl 6 Summary

2005-05-25 Thread The Perl 6 Summarizer
The Perl 6 Summary for the week ending 2005-05-24 Note to self: It's generally not a good idea to go installing Tiger on the day you return from holiday. It's especially not a good idea to fail to check that it didn't completely and utterly radish your Postfix configuration. And

Reductions, junctions, hashslices, and cribbage scoring

2005-05-25 Thread Rob Kinyon
(This post references the discussion at http://www.perlmonks.org/?node_id=458728, particularly dragonchild's response at the bottom.) For those who don't know, cribbage is a game where each player has access to 4 cards, plus a community card. Various card combinations score points. The one in

Re: (1,(2,3),4)[2]

2005-05-25 Thread Juerd
Mark Reed skribis 2005-05-25 10:49 (-0400): [1,2,3] is not an array or a list. It is a reference to an anonymous array. It is not 3 values; it¹s 1 value, which happens to point to a list of size Just for accuracy: it points to an array, which is still not a list in our jargon. 3. If you

Re: (1,(2,3),4)[2]

2005-05-25 Thread Mark Reed
On 2005-05-25 13:54, Juerd [EMAIL PROTECTED] wrote: 3. If you assign that to an array via something like @a = [1,2,3], I would expect at least a warning and possibly a compile-time error. If it does work, it probably gets translated into @a = ([1,2,3]), which That's not a

Re: (1,(2,3),4)[2]

2005-05-25 Thread Juerd
Mark Reed skribis 2005-05-25 14:09 (-0400): That's not a translation. Parens, when not postfix, serve only one purpose: group to defeat precedence. $foo and ($foo) are always the same thing, regardless of the $foo. So, you could then do this to make an array of size 3 in Perl6? @a =

Re: (1,(2,3),4)[2]

2005-05-25 Thread Rod Adams
Juerd wrote: Mark Reed skribis 2005-05-25 14:09 (-0400): That's not a translation. Parens, when not postfix, serve only one purpose: group to defeat precedence. $foo and ($foo) are always the same thing, regardless of the $foo. So, you could then do this to make an array of size 3

Re: (1,(2,3),4)[2]

2005-05-25 Thread wolverian
On Wed, May 25, 2005 at 01:38:27PM -0500, Rod Adams wrote: Or use @a == 1,2,3; I would just like to say that I like this idiom immensely. my @foo == 1, 2, 3; reads extremely well to me, especially since I've always disliked the usage of '=' as an operator with side effects. (I'm

Re: (1,(2,3),4)[2]

2005-05-25 Thread Uri Guttman
w == wolverian [EMAIL PROTECTED] writes: w On Wed, May 25, 2005 at 01:38:27PM -0500, Rod Adams wrote: Or use @a == 1,2,3; w I would just like to say that I like this idiom immensely. w my @foo == 1, 2, 3; w reads extremely well to me, especially since I've always

Re: (1,(2,3),4)[2]

2005-05-25 Thread wolverian
On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote: please don't use == for simple assignments as it will confuse too many newbies and auch. it (and its sister ==) are for pipelining ops like map/grep and for forcing assignment to the slurpy array arg of funcs (hey, i think i said

Re: (1,(2,3),4)[2]

2005-05-25 Thread Uri Guttman
w == wolverian [EMAIL PROTECTED] writes: w On Wed, May 25, 2005 at 07:07:02PM -0400, Uri Guttman wrote: please don't use == for simple assignments as it will confuse too many newbies and auch. it (and its sister ==) are for pipelining ops like map/grep and for forcing assignment to

Re: (1,(2,3),4)[2]

2005-05-25 Thread Stuart Cook
On 5/26/05, Juerd [EMAIL PROTECTED] wrote: You could, if you changed the precedence of , to be tighter than =. However, by default, = has higher precedence than ,, so that you need parens to override this decision: @a = (1,2,3); Is giving = a higher precedence than , still considered A Good

Re: (1,(2,3),4)[2]

2005-05-25 Thread Stuart Cook
On 5/26/05, Stuart Cook [EMAIL PROTECTED] wrote: my $a, $b = 1, 2; # $b should contain 2, not 1 my @foo = 3, 4, 5; # @foo should contain (3, 4, 5), not (list 3) What justification for the status quo could be so compelling that we feel the need to prevent both of these from doing the