* Michael Zedeler <mich...@zedeler.dk> [2015-06-16 11:35]:
> This is working exactly as specified in the synopsis, but does Perl
> 6 NEED anything like this? Just because something is possible doesn't
> make it an automatic requirement!

Well someone thought they needed it in Perl 5 so they wrote NEXT which
provides EVERY:: which does exactly the same thing. C3 dispatch surely
has something similar too, natively, I’m just not aware of it.

> I haven't seen just one reasonable use case for it.

Anyplace you would have to say “if you override this method then make
sure to call the overridden method also” (like calling ->new up the
inheritance tree). Instead of relying on every subclass writer to not
screw this up (and leave the object instance in an incoherent state),
you use something like these operators to make *sure* a certain method
is called all up the inheritance tree as necessary for your de-/init

Every modern Perl 5 OO system invents stuff like BUILD and DEMOLISH for
this purpose. And one of the points of Perl 6 is not to have to handroll
a reasonable OO system as your first step in writing nontrivial systems.
So putting these operators right in the language, properly designed, is
specifically called for.

Just because you can’t think of the use of a feature doesn’t mean there
isn’t one.

Or maybe you are aware of the motivation for these designs and disagree
with that desire in the first place? In that case I don’t know what to
say; obviously there are plenty of people who do see it as a necessity.
If you don’t like the fact that they exist then the situation cannot be
reconciled and you might indeed be happier in a language with reflection
facilities that are sufficiently limited to prevent implementing such
constructs (because if so many people exist who think they need this in
Perl, similar people will inevitably exist in any other language where
this can be done).

Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to