in reply to Perl 6 shocking revelations #1

May I also congratulate you on your clear, concise writing.

I've read the piece twice through now, 2 or 3 times more and some of the implications might finally start to set in. As I read, three thoughts keep crossing my mind:

  1. When oh when will someone come up with inheritance examples that aren't based on geometry or phylogenetics.

    Note: This isn't a criticism of your article. Space and time for real-world examples is rarely available.

    But useful computer programs for dogs that can bark and wag their tails, or chimera Goat-Lions are fairly few and far between in the real world.

    And, for example, there is rarely any real point (sic) in having a Point3D class inherit from a Point2D class. A 2D point is simple a 3D point where you ignore one component, as when mapping 3D space to 2D space. And that is just a method of the 3D Point class. Having the former inherit from the latter usually costs in terms of time, and saves little if any space. So it's usually more practical to just use a 3DPoint class and have done with it.

    In real-world applications, Manager is simply an attribute of Employee-- 1-bit in a flags field --rather than a superclass.

    Or, in those rare organisations that recognise that modelling themselves in terms of JobRoles that has-a Person attribute, rather than JobRoles that is-a person, makes more sense, benefit greatly. By using Encapsulation rather than Inheritance for composition, they get flatter, simpler hierarchies and greater decoupling. And that allows for cleaner, simpler segregation of datasets. Eg. Employee personal details can be kept in a separate DB from corporate structuring information, which greatly simplifies controlling access. Ever more important these days.

  2. Who, other than academics pursuing PhDs in Category Theory are ever going to use all this power and complexity, unless the language forces it upon them?

    And aren't they gonna use something more academically credentialed (and hip), like Haskell or ML anyway.

    Without deep, compile time analysis, it will always be possible to construct an object or class at runtime and subsequently call a method upon it that will fail at runtime. Hence, it will still be necessary to: a) code defensively with exceptions; b) exercise and test thoroughly with 'bad data'.

    So, where's the benefit of using these optional strong type checking facilities if the can be both intentionally and accidentally subverted?

  3. It's an awful lot of baggage and complexity for a runtime compiled language to carry around.

    Especially if there are few benefits to encourage anyone to use them?

Without a real-world, extensive, thorough (working, tested, costed, maintained) example to show both the benefits and costs of using these facilities, they will remain in that academic world of "wouldn't it be nice if".

Examples pulled from, or by reference to, other languages don't work if those languages use highly evolved and complex static compilation. Or heavily finance and extensively developed runtime JITing that took many years, $billions, and 5 attempts to get to the point where it is practical to use them. Perl 6 is unlikely to achieve such investment.

Using C++ and Java as examples encourages onlookers to look at the practical costs of developing projects using those languages. Neither are known for their simplicity of use, speed of development, ease of maintenance, nor absence of runtime failures. The benefits of adding such complexity to Perl 6, which will benefit from neither the multi-generational compile-time optimisations of the former, nor the extensively tuned, cross-platform runtime equivalents, are hard to perceive. If this thing ever comes to pass, what is the performance going to be like?

And will anyone using Perl, use the facilities that experience of C++/Java show, impose such complexities and costs on the development process?.

Sure, they are optional, so you can develop RAD-style omitting the complexity until you've got things up and running and then go back and add them where they will produce benefits. But, if the project is already running and tested, then it must already be handling all the possible errors that these facilities might prevent, so where is the mileage in retro-fitting them?

As always with my doubts about Perl 6, I'm hoping someone (or time) will prove me wrong. But, as with any opinion that I've given considerable thought to, I don't expect it to happen.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Perl 6 shocking revelations #1
by John M. Dlugosz (Monsignor) on Apr 28, 2008 at 00:40 UTC
    In an online venue, space isn't the problem like it is in magazines. The real issue is that a real example needs to be explained. If I grabbed something from work, it would need explaining as to what it is, why it's necessary, and take a considerable effort to grasp before doing any work on it.

    The toy examples embody the interesting features: Take something that works, derive from it to add a new attribute. I did steer clear of the "equal" method which is common place, because testing for equality is more special in Perl than just using some provided method.

    If you can think of any more interesting toys, please let me know. The other extreme is something so abstract that you never remember what it means. That is, m1 and m2 interact but it's just abstract names with no feel for what it does.

    I think a lot of the appeal of Perl 6 is the refactoring of paradigms and cutting-edge features. Roles themselves are a case in point. It's what I wish I could do in any language I do major development in! C# missed the boat, and it's up to Perl 6 to embrace the new ideas.

    Perhaps I'm seeing Perl 6 not as a language for golfing, but as a replacement for the professional development I do in C++, C#, etc. and notice what is problematic about the strongly typed languages. On the other hand, when I did Smalltalk in school, I was most amused at the section in the text book on debugging, since everything but one would be a compile-time error with strong typing.

    As for performance, Parrot did JITing a long time ago and the performance of the virtual machine is quite good. I remember when C++ compilers could not run on PCs, and Ada compile and link time was a joke. I think strong typing will improve the performance of Perl, allowing premade dispatch tables to be used once a type is known. But look at the modern implementations of Smalltalk, Self, etc. for dispatch speed.

    —John

Re^2: Perl 6 shocking revelations #1
by grinder (Bishop) on Apr 28, 2008 at 09:32 UTC
    When oh when will someone come up with inheritance examples that aren't based on geometry or phylogenetics.

    About twenty years ago I worked on a system written in C++ that dealt with various financial instruments (fixed term deposits (with fixed or variable interest rates), stocks, bonds, options, futures and all that financial soup). The original architects had decomposed the different instruments into distinct classes (class Bond, class Option and so on).

    Sadly, they completely missed the concept of ISA hierarchies. A lot of these instruments build on existing things, with an added twist. Yet the architects had merely cut'n'pasted code from class to another, for things like yield and amortisation calculations. Which meant that you had to chase down similar bugs in many similar classes.

    Having learnt object-oriented programming a few years previously with such toy examples as decried by BrowserUK, it struck me that here was a real world example that was easy to explain, easy to code, produced tangible results and probably one of the few textbook cases where true inheritance hierarchies really make sense (insofar as compositional has-a architectures are much more frequent).

    Fortunately enough for me, I left the project and moved on to greener pastures, and since then I have managed to forget just about everything I had learnt about the subject, but someone who has kept up with the field should be able to produce a simple example to demonstrate the basic concepts.

    • another intruder with the mooring in the heart of the Perl