Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Re: Apocalypse 12

by tilly (Archbishop)
on Apr 19, 2004 at 23:09 UTC ( #346485=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Apocalypse 12
in thread Apocalypse 12

I think that the main thing that concerns people about A12 is just that there are a lot of pieces involved, and they are not sure what you do and do not have to worry about. One message that people really need to hear loud and clear is that they don't need to understand all of them since the changes DWIM. For instance all of the stuff about lexical namespaces etc can be forgotten since if you don't use it, you won't be burned by anyone else using it, and if you do use it, then it does what you'd expect.

Another major concern is confusion about how traits differ from roles and classes differ from types (really, subtypes, but type is the keyword chosen at the moment). I admit to considerable confusion on traits vs roles until Larry said that a trait is a role on the class. As soon as I knew how the mechanism is supposed to work, I could see the difference. Stated in my own words, A role grants extra methods to objects that are given that role. The role does nothing until you call the methods that it provides, so it is relatively unobtrusive. We say, 'Foo does Bar;' to indicate that you have those methods. But if there is a role on your Class, that role could easily arrange to do whatever it wanted when you were being created. In other words it could have changed what you are, which is why we say, 'Foo is Bar;'. That far more intrusive thing is called a trait. As for classes vs types, while I can describe what a type is, I'm significantly less clear on what practical role is anticipated for them.

As for my areas of actual concern, they exist but I don't think that E12 is going to be able to address them. Here are a few:

  1. Having read the discussion of how roles will be implemented with multiple inheritance, how well will the role/trait stuff play with people declaring the current inheritance model?
  2. My major concern about any mix-in kind of design (including inheritance and roles) is that people can wind up having methods available and have no idea where the method came from. I'm hoping that there will be a limited number of very useful traits and roles that are built in (or at least widely used) and people don't go about building too many of their own. That will let me amortize the cost of learning them over a lot of usage. This is not, however, fundamentally a language design issue but an education one.
  3. I'd like to understand the proposed aliasing mechanism better than I do. I understand the need (particularly when cooperating across languages), but I'd like to understand how it will be done.
  4. The proposal that we have multiple versions of modules loaded at the same time scares me. I cannot help but think that it is an inherently fragile thing to attempt, particularly if someone does anything dynamic. Problems comes in many flavours, and I'm not sure which bothers me most. Here is a sample.
    • How can the feature help if developers have not specified versions for dependencies? I'm in the habit of just saying "use X", so do most people. Most do likewise. If most of CPAN follows suit, then this great feature will never assist me in the real world because I'll depend on some module that requires some specific version of another module, and the specific version was never specified. Relying on developer behaviour is fragile.
    • How do you handle versioning of proxied modules? For instance suppose that module A dynamically loads any of a number of modules, including B, behind the scenes on behalf of C. (Consider a plugin architecture to see why someone might do this.) How do you address version dependencies between C and B?
    • When will bugs go away? If module X is used by many others, and an annoying bug in it is fixed in module X, people can keep running into that bug until every other module has been updated to say that they work with the newer version of module X. This delay can be rather frustrating for the person who is trying to remove the bug on their local system.
    • What code am I REALLY running? When debugging, one of the more frustrating bugs to track down is when the code that you are running is not the code that you are looking at. Been there, done that. When you load multiple versions of the same software at the same time, this multiplies.
    • Where's my data? When you load CGI.pm, behind the scenes it can read in all of STDIN. (It has to for a POST.) So now a poor web developer has 2 modules, which require different versions of CGI.pm. One gets the data, and the other gets confused. As does the developer who is trying to figure out why CGI.pm just broke. This becomes an issue any time a module has to interact with external resources.
    • What about C libraries? So I'm using a nice XS module, and then go to load 2 versions of it. But each wants a different version of a .dll or .so (either platform, same issue). Unless you figure out how to make the versioning trick work down to the C level, it is going to break on lots of important modules.
    • Feeling bloated? While I'm hardly the first to argue for efficiency over everything else, loading multiple versions of the same software at the same time is a problem. Particularly if the module is supposed to do something like hold my database handle so that I don't need extra database connections...
  5. When I first heard about the idea of trying to support having multiple versions of software on your system, I thought that it was a fundamentally broken idea. No, I don't want the added complexity when I think that it will fail, and complicate my life in the process. That opinion hasn't improved with time...


Comment on Re: Re: Re: Apocalypse 12
Re: Re: Re: Re: Apocalypse 12
by BrowserUk (Pope) on Apr 20, 2004 at 00:28 UTC

    I agree wholeheartedly with your reservation regarding versioning.

    Any library, module or class exports two things. It's interface, and it's implementation. Whilst the implementation can go through versions, the interface cannot.

    Once defined, even before implementation, an interface becomes fixed. If the interface later varies, it becomes an new interface. Anything written to comply with the old interface will need to be adapted to use the new one, no matter how small the change.

    You can dress the new version's name up by applying a version number to the old name, but that simply means that the name of the new interface looks superficialy, but misleadingly similar to the old one.

    Even if the new interface is a proper superset of the old interface, it still means that code using either are forced into making loadtime or runtime tests to determine which version of the interface they have access to. In the case of existing code, connecting to the new version, if it remains unmodified, there is the possibility of conflict between new features of that new interface and existing features or extensions added by the pre-existing caller.

    In the case of new code that doesn't now whether it will have the new or old version of the interface at runtime, it must then add code to test for teh availability of the new features and either fail if it doesn;t have them r supply alternatives.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
Re: Re: Re: Re: Apocalypse 12
by TimToady (Parson) on Apr 20, 2004 at 02:08 UTC
    My goodness. Such a lot of stuff in one article. I will try to address the concerns separately.
    1. Having read the discussion of how roles will be implemented with multiple inheritance, how well will the role/trait stuff play with people declaring the current inheritance model?
    Should be no problem at all. The internal MI implementation of roles is hidden from view. That's part of what's "funny" about it.
      Got it..maybe. When you describe here that roles are actually done with multiple inheritance, you are actually walking about multiple inheritance being used when you WALKMETH, so that even though you think that you are only inheriting along a chain, some links of the chain of inheritance may choose to search a little hidden sub-bush. (Particularly if your Role declared that it is some other class.)

      Or something like that.

      But it doesn't matter whether I understand this. I just hope that the implementor gets the joke...

        I hope so too, considering it's the implementor that made up the joke in the first place. If anything, the joke was on me. Which is the other part that makes it really, really funny... :-)
Re: Re: Re: Re: Apocalypse 12
by TimToady (Parson) on Apr 20, 2004 at 02:11 UTC
    2. My major concern about any mix-in kind of design (including inheritance and roles) is that people can wind up having methods available and have no idea where the method came from. I'm hoping that there will be a limited number of very useful traits and roles that are built in (or at least widely used) and people don't go about building too many of their own. That will let me amortize the cost of learning them over a lot of usage. This is not, however, fundamentally a language design issue but an education one.
    I expect this one to be solved culturally, as you say. Plus it will help to have tools to tell people where their methods came from--when they want to know that, and not sooner.
      $method.meta.getattributes doesn't list source class/role and version metadata but it could be included.

      This non-transparent method source also worried me. The combination of multiple inheritence, roles, traits, runtime role-things, multiple dispatch (including subtypes and signature distance), dispatcher/traversal options and the autoloading possibilities together make interpreting a method call potentially quite tricky. It seems like the composability and flattening of the Traits Paper has been lost.

      I have to remind myself that while the explanation has to be exhaustive, the cognitive load during programming should in fact be lighter.

        It seems like the composability and flattening of the Traits Paper has been lost.
        You must have missed this statement: "The .getmethods method has a selector parameter that lets you specify whether you want to see a flattened or hierarchical view, whether you're interested in private methods, and so forth."

        But yes, it would be nice if the flat view could also give you the pedigree of the methods.

Re: Re: Re: Re: Apocalypse 12
by TimToady (Parson) on Apr 20, 2004 at 02:16 UTC
    3. I'd like to understand the proposed aliasing mechanism better than I do. I understand the need (particularly when cooperating across languages), but I'd like to understand how it will be done.
    Me too. :-) I suspect it will involve allomorphic references, but hopefully only at a low-level that can be hidden from the languages in question.

    Certainly there are lots of issues to deal with here. Even what you name your exceptions changes across languages...

      I'm not entirely sure that I understand what you mean by "allomorphic references". However the first design that comes to my mind is that Perl 6 should define what it looks like to refer directly to something in another language, and then there should be tools built to offer a translation service, translating the one language into another. If no translation layer exists, then things like errors are pretty much opaque to Perl. If a translation layer exists, then it handles things however you would like.

      A thought: the translation layers should not just map classes, but should be able to add/detect useful metadata. For instance in translating Perl errors into Ruby or Python, it may be good to allow a Perl type to translate into a Ruby Class, and a Ruby Class to translate into a Perl Class with some extra metadata tagged on it (so that it falls into a type that would be translated back). This piece of complexity allows you to do as reasonable a job as is realistically possible in translating between 2 class hierarchies that divided things up in fundamentally incompatible ways.

      Yes, this kind of approach would make those interfaces substantially more complex. But I think that the complexity is necessary.

      A tangential thought that this discussion of translation brings to mind. I think that it is important for the Perl world to plan on some "best practices" for handling internationalization. (Documentation, error messages, etc.) The current CPAN works great..if you're willing to say that all programmers must speak English fluently. But I'm convinced that many people with scripting problems do not speak English as a first language, and I'd like to think that Perl will attempt to address their problems.

        Definition of alomorph:
        A variant phonological representation of a morpheme; "the final sounds of `bets' and `beds' and `horses' and `oxen' are allomorphs of the English plural morpheme"
        UPDATE:

        For those without ancient languages... greek and latin roots. Basically morph is shape, allo is "different" or "another".

        Another definition for allomorph seems a bit closer to Larry's reply: "An allomorph is one of two or more complementary morphs which manifest a morpheme in its different phonological or morphological environments."

        So, I guess in the computer context, an allomorph is an object that manifests differently depending on the context.

Re: Re: Re: Re: Apocalypse 12
by TimToady (Parson) on Apr 20, 2004 at 03:12 UTC
    4. The proposal that we have multiple versions of modules loaded at the same time scares me. I cannot help but think that it is an inherently fragile thing to attempt, particularly if someone does anything dynamic. Problems comes in many flavours, and I'm not sure which bothers me most. Here is a sample.
    The current library mess is just as fragile in other ways. The whole point of this is to reduce that fragility without inducing additional fragility, and I believe we can.
    * How can the feature help if developers have not specified versions for dependencies?
    If nobody ever specifies a version requirement, we're no worse off than we are now.
    * How do you handle versioning of proxied modules?
    By making sure the interface can be as specific or generic as needed, I suspect. Allowing multiple coexisting versions (where possible) only makes this less fragile in my estimation.
    * When will bugs go away?
    There are a lot of folks who prefer known bugs to unknown bugs. You should know--I particularly had the financial market folks in mind here, having been informed that they like to lock down the versions of *everything* forever. The Perl 6 approach lets them lock down two different versions of the same thing where those versions don't collide dynamically.
    * What code am I REALLY running?
    Shouldn't be a problem within the debugger, which will know which version you're in. If you're poking around the Perl library, I would hope that different versions of the same thing would be stored close enough together that you can at least see that you have a choice.
    * Where's my data?
    Yes, this is a known issue. The basic question is how to mark the modules that can or can't share resources with other versions. And what should be the default...
    * What about C libraries?
    Another known issue, or the same one. Oddly, this shouldn't be a problem with .NET, which is taking the same tack as Perl 6 here, I believe.
    * Feeling bloated?
    Again, that's the external "can't share" problem. Part of the metainfo of a module has to be whether it can coexist with other versions of itself. A database handle is obviously something that can't be shared easily.
    When I first heard about the idea of trying to support having multiple versions of software on your system, I thought that it was a fundamentally broken idea. No, I don't want the added complexity when I think that it will fail, and complicate my life in the process. That opinion hasn't improved with time...
    I think it will solve a real problem for the people who need it solved, and stay out of the way of other people. Especially if we don't botch it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://346485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2014-07-24 13:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls