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/
pgpWfMqiYCwrU.pgp
Description: PGP signature
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 peo
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?
Hi,
Luke Palmer 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 var
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(An
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
C is lexically scoped in that its effect goes away at the closing
curly of the le
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 rea
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 r
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 poss
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
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,
-
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
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 th
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
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
15 matches
Mail list logo