in reply to Re^2: stronger than eval?
in thread stronger than eval?

i agree with the second sentence, but not the first. ;-)

Replies are listed 'Best First'.
Re^4: stronger than eval?
by diotalevi (Canon) on Sep 21, 2006 at 19:38 UTC

    So having unrelated objects all get a method that they might not wish to have added to them is ok with you?

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      if the method is called use or require, then yes, i am ok with that, even when it results in dying if you try $obj->use because you did not define your own use method on that class (which is what would typically happen anyway, except with a different error).

      the more exceptional case would be when you expected to handle use or require methods via AUTOLOAD, but i would never expect such so adding these methods to UNIVERSAL is ok with me.

        I have to agree with diotalevi on this: there is no good reason for this to be done through UNIVERSAL::. It's just a simple utility method. It does not need to be added to every namespace automatically.

        Ok, fine, I guess. What's also missing is that there's no need to implement this with UNIVERSAL:: pollution. This could have just been a "smarter" use and require function named something appropriate and it wouldn't have caused issues for other objects. I have sympathy for features that are best (or perhaps only) implemented by polluting UNIVERSAL:: but this isn't one of them.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊