$want_deep_copy++;
$want_deep_equal++;
From: Mark-Jason Dominus [mailto:[EMAIL PROTECTED]]
>
> Lisp, which you might expect would have a 'deep copy' operator,
> doesn't have one. The Lisp folks have apparently thought about this
> very carefully, and decided that the semantics are unclear, and that
> the obvious options are all wrong; I've read a number of articles
> about this in the past.
I should start by stating that I'm ignorant of Perl's internals, and a great
deal of other knowledge that most people on this list take for granted. So
if I sound stupid, please give me the benefit of the doubt, and assume it is
ignorance to be cured (until I prove otherwise).
Correct me where I'm wrong. There's got to be lots of material to work with
here ;)
Assumptions:
- Larry wants to cultivate ideas from C#
> C# has very few types... word4, word8, etc. and float4, float8, etc.
> C# more or less infers the type from what is pushed on the stack.
- People in the Perl community are requesting the ability to add new
types for mathematical or other reasons.
Wouldn't discussion of deep copying be tied to whatever is determined to be
the best course for handling extensible types and data structures?
I get a little confused when trying to distinguish the type of data from the
structure of data in Perl. My assumed truth: Perl's "types" are hidden away
in scalars and automagically managed and taken for granted by Perl
programmers like myself. Scalars are both the data and a singular structure
for holding a unit of data. Arrays and hashes are data structures for
holding scalars.
Shouldn't the scalar be able to copy and perform casts and comparisons
between different types of data under the scalar hood?
'a' != 'b'
'A' == 65;
And shouldn't the data structures be responsible iterating through the
scalars to perform shallow and deep copies and comparisons. -Where the
difference is whether or not to look at the reference or what the reference
points to. Is ignorance letting me see clarity where it is really dark,
complex, and murky? Data types handle copy and comparison operators. Data
structures handle navigating themselves both shallow and deep.
Why are things like objects, code, file handles, etc not scalars? Shouldn't
every fundamental data type be hidden away behind the benevolent scalar?
Then if someone decides to add a new type, it is their responsibility to
define their copy and comparison operators right.
> Perl has two equality comparison operators and people already
> complain that that is too many.
Yes, but when you need to do a deep copy, and you aren't a Perl guru... you
really start to wish someone would provide one for you. --I've got a half
functional deep copy subroutine that does most of what I need it to do, but
it's not elegant... I'd rather see a more elegant solution and a couple more
obscure operators so that working with deeply nested data structures would
be easier.
Garrett