develooper Front page | perl.perl5.porters | Postings from May 2000

Re: overloading = [a solution]

From:
Damian Conway
Date:
May 6, 2000 15:25
Subject:
Re: overloading = [a solution]
Message ID:
200005062225.IAA10292@indy05.csse.monash.edu.au
   > But you also need ASSIGN for any reasonable situation.

Except the reasonable situation of only wanting your variable assigned
references to type-compatible objects.

   > So it is essentially of the same degree of complexity as tie()ing.

Perhaps to someone as clever and knowledgeable as yourself. But to most
people, writing:

	classify $var => 'ClassName';

is considerably less complex than writing a nontrivial package and tie()ing
a scalar to it.

   > > And the tie()d version *still* doesn't support per-object assignment
   > > semantics, dispatch to ASSIGN without type-enforcement,
   > 
   > Of course it does.  ASSIGN is just a shell for STORE.

It didn't support those things as it was written but, yes, of course it
*could* support them with extra coding...at the expense of making the
STORE even more complex.

   > > or use by people who don't (want to) know about tie()ing.
   > 
   > But your package does not support use by people who don't (want to)
   > know about your package. 

Of course. My point was that the complexity of the tie() mechanism (and yes,
for many folks back in the Real World, tie() is firmly in the Too Hard basket)
makes people not want to learn it. Hence they are unable to whip up a custom
TIESCALAR/FETCH/STORE suite when they need it.

   > And given that tie() is so much more useful than your package, it
   > is a killer argument.
   
But within its (humble) domain my package is so much easier to learn and
to use than tie(). For many people *that* is a killer argument. 

Damian

PS: I'm not sure why we're even debating this. I'm not putting this
    forward as a replacement for tie(), I'm not claiming this is the
    Only Way To Do It, I'm not even suggesting the module go into the
    core. I'm just reporting back to P5P on (what I believe to be) a
    useful module that was the outcome of a thread that went offline.

    It saddens me that everything on P5P has to be so adversarial, and
    shames me that I could so easily be caught up in the disputation.
    Unlike the departures of Chip and Graham and Jarrko, mine would be
    no loss to this list, but (for my own sake) maybe I need a break
    from P5P too...



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About