in reply to Re: Re: Re: perl6 & OO
in thread perl6 & OO

What's wrong with each providing a run method?

Nothing. However, there is a LOT wrong with weakly typed variables and not requiring arguments to be of certain types, just because they all have 'run' methods does not mean I should be able to interchange programs and dogs. That's just asking for trouble.

As for getters and setters, can you think of any popular language with OO features that doesn't allow them?

I think you meant to say, is there any language that absolutely requires them? In which, no. The argument was in reference to prior comments of Perl OO's system being flexible. My comment was, essentially, as long as Perl doesn't do anything stupid like require getter/setter methods (it won't), I'm ok with a more rigid object structure.

Can you provide an example?

Dog::chewPantleg(Person ted) { # implementation }

In the above example, you can't have a Dog chew another Dog's pantleg. It's enforced that the argument is a person.

If you're referring to prototypes (I don't think you are)

I am, however weak the current implementation is, that's what I'm talking about. Perl seems to allow OO implementation (a little better than how GTK might implement pseudo-OO in C), but it does not embrace it in spirit. I'm not saying it should be enforced, but it should be embraced.

Then you should be aware that those are checked at compile time while method dispatch is resolved at runtime, thus making prototypes useless on method calls.

I'd like to see that change in Perl6. Maybe it's a pipe dream, but it seems to be a requirement for clean polymorphism.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: perl6 & OO
by Elian (Parson) on Feb 19, 2004 at 18:42 UTC
    What's wrong with each providing a run method?
    Nothing. However, there is a LOT wrong with weakly typed variables and not requiring arguments to be of certain types, just because they all have 'run' methods does not mean I should be able to interchange programs and dogs. That's just asking for trouble.
    This'll throw a runtime error for perl 6. If we can wedge it in, we may do it for perl 5 as well under Ponie, but I wouldn't hold your breath there.

    There's a chance that this might also throw a compile time error, but that's even less likely. Possibly a warning, but as there really isn't enough information at compile time to emit one with any reliability... probably not.

      Nothing. However, there is a LOT wrong with weakly typed variables and not requiring arguments to be of certain types, just because they all have 'run' methods does not mean I should be able to interchange programs and dogs. That's just asking for trouble.

      As for getters and setters, can you think of any popular language with OO features that doesn't allow them?

      so you are against polymorphism? Or only against polymorphism in weakly typed settings? or am I missing it altothether? thats one of the feratures I'd like to keep. I think its fine to extend things to allow strong typing, but I hope it isn't required.