Front page | perl.perl6.language |
Postings from February 2005
Containers vs Objects.
Thread Next
From:
Rod Adams
Date:
February 15, 2005 12:26
Subject:
Containers vs Objects.
Message ID:
4.2.0.58.20050215140759.00a39148@cyclone.he.net
In my recent unsuccessful attempt to convert junctions into sets with their
own container, perhaps the strongest argument against could be paraphrased
as follows:
Everything about junctions or sets can be represented fully as an object,
and objects are nicely stored in scalars, because it's simply one instance
of a given class, in this case C<Junction>.
My question comes down to: so what makes Arrays and Hashes so special? As
many pure-OO languages demonstrate, both can be fully represented as an
object, and objects belong in Scalars. The obvious statement I expect to
here is "Perl's always had Arrays and Hashes". While I'm not sure if they
were there for Perl 1.0 (I started w/ Perl 4.xx), I do know that they
certainly predate P5's objects and references. Therefore, there was no
other way to create an array or hash. That is no longer the case.
In P6, we've even gone so far as to say that you can access an element in
an array ref with C<$ref[1]>. I'm fairly sure you can call all the methods
of the Array class on the $ref, letting you do C<$ref.pop> and all the
other fun things we do with arrays. Similar things hold for hashes.
So I'm interested in hearing what pushes Arrays and Hashes over the edge
for needing their own container and sigil, whereas Junctions/Sets do not.
-- Rod Adams
Thread Next
-
Containers vs Objects.
by Rod Adams