Valid hash keys?

2005-02-27 Thread Autrijus Tang
Just a quick question: Is Hash keys still Strings, or can they be arbitary values? If the latter, can Int 2, Num 2.0 and Str 2 point to different values? Thanks, /Autrijus/ pgpy4a1oCQOVh.pgp Description: PGP signature

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Autrijus Tang writes: Just a quick question: Is Hash keys still Strings, or can they be arbitary values? They can be declared to be arbitrary: my %hash is shape(Any); If the latter, can Int 2, Num 2.0 and Str 2 point to different values? That's an interesting question. Some people

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Luke Palmer writes: Autrijus Tang writes: Just a quick question: Is Hash keys still Strings, or can they be arbitary values? They can be declared to be arbitrary: my %hash is shape(Any); If the latter, can Int 2, Num 2.0 and Str 2 point to different values? That's an

Re: S06: Pairs as lvalues

2005-02-27 Thread Ingo Blechschmidt
Hi, Luke Palmer luke at luqui.org writes: Ingo Blechschmidt writes: my $x = (a = 42); # $x is a Pair. $x = 13; # Is $x now the Pair (a = 13) or # the Int 13? You see, in your example, the pair is not functioning as an lvalue. The variable

Re: Valid hash keys?

2005-02-27 Thread Nigel Sandever
On Sun, 27 Feb 2005 02:20:59 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: Luke Palmer writes: Autrijus Tang writes: Just a quick question: Is Hash keys still Strings, or can they be arbitary values? They can be declared to be arbitrary: my %hash is shape(Any); If

Dynamically Scoped Dynamic Scopes

2005-02-27 Thread Dave Whipp
I was thinking about scopes (for a problem unrelated to Perl 6), and I realised that the scoping concepts in P6 are somewhat limited. We have my $var # lexical scope temp $var # lexically-scoped dynamic scope Ctemp is lexically scoped in that its effect goes away at the closing curly of

Re: Valid hash keys?

2005-02-27 Thread Alex Burr
On Sun, Feb 27, 2005 at 02:20:59AM -0700, Luke Palmer wrote: I forgot an important concretity. Hashes should compare based on the generic equal operator, which knows how to compare apples and apples, and oranges and oranges, and occasionally a red orange to an apple. Um. Hashes don't really

parsing ok((2+3)==5)

2005-02-27 Thread Abhijit Mahabal
I hunted down the cause of the non-parsing of ok((2 + 3) == $five, == (sum on lhs)); in 03operator.t, but am not yet up to speed in Haskell to fix it. Below is the location of the problem. The error is in Parser.hs, in the blocks for parseApply and parseParamList. parseApply eats parens using

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Nigel Sandever writes: On Sun, 27 Feb 2005 02:20:59 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: I forgot an important concretity. Hashes should compare based on the generic equal operator, which knows how to compare apples and apples, and oranges and oranges, and occasionally a red

Re: How are types related to classes and roles?

2005-02-27 Thread Thomas Sandlaß
HaloO, Larry Wall wrote: On Fri, Feb 25, 2005 at 12:45:45AM +0800, Autrijus Tang wrote: : So, I think late binding is a sensible (and practical) default, but : do you think it may be a good thing to have a type inference mode that : assign static contexts to expressions, and prebind as much as

Re: Valid hash keys?

2005-02-27 Thread Nigel Sandever
On Sun, 27 Feb 2005 15:36:42 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: Nigel Sandever writes: On Sun, 27 Feb 2005 02:20:59 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: I forgot an important concretity. Hashes should compare based on the generic equal operator, which knows how to

Re: Valid hash keys?

2005-02-27 Thread Thomas Sandlaß
Alex Burr wrote: [..] Actually, it would be useful sometimes to be able to give a hash an explicit canonicalizer: my %msdos_files is canonicalized_by lc; my %fractions is canonicalized_by gcd; Shouldn't that be handled by container subclasses of Hash? Like PersitentScalar or SparseArray? Regards,

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Nigel Sandever writes: On Sun, 27 Feb 2005 15:36:42 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: As far as getting 2, 2.0, and 2 to hash to the same object, well, we know they're 'equal', so we just need to know how to hash them the same way. In fact, I don't believe 2.0 can be

Re: Valid hash keys?

2005-02-27 Thread Alex Burr
On Sun, Feb 27, 2005 at 11:57:30PM +0100, Thomas Sandlaß wrote: Alex Burr wrote: [..] Actually, it would be useful sometimes to be able to give a hash an explicit canonicalizer: my %msdos_files is canonicalized_by lc; my %fractions is canonicalized_by gcd; Shouldn't that be handled

Re: Valid hash keys?

2005-02-27 Thread Nigel Sandever
On Sun, 27 Feb 2005 15:36:42 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: Nigel Sandever writes: When we're talking about hashes of everything, there are a couple of routes we can take. We can go Java's way and define a .hash method on every object. We can go C++'s way and not hash at

Re: Valid hash keys?

2005-02-27 Thread Rod Adams
Luke Palmer wrote: The object model that I'm working on actually identifies 2 and 2 as the same object, indistinguishable in every respect. Okay, that's fine, since C 2 eq 2 and C 2 == 2 . But what about 2.0 and 2.0? In Perl5, C 2.0 == 2.0 , but C 2.0 ne 2.0 . -- Rod Adams

Pugs 6.0.9 released.

2005-02-27 Thread Autrijus Tang
After a week of work, I'm glad to present Pugs 6.0.9, available in a CPAN near you seen as Perl6::Pugs; you can also download it from my home server: http://autrijus.org/dist/Perl6-Pugs-6.0.9.tar.gz [Changes for 6.0.9 - February 28, 2005] * First Perl 6 module: Test.pm. * First Pugs

Re: PATCH: Make check_tail_call work in two more situations.

2005-02-27 Thread Leopold Toetsch
Bob Rogers [EMAIL PROTECTED] wrote: I'd say: .tail_call always does a tail call. The check_tail_call() can be dropped then. leo That takes IMCC out of the loop when it comes to tail-call optimization. But IMCC seems like the natural place for doing these low-level optimizations .