Re: [VOTE] Scalar Type Hints

From: Date: Fri, 13 Feb 2015 11:07:52 +0000
Subject: Re: [VOTE] Scalar Type Hints
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-82597@lists.php.net to get a copy of this message
On Thu, Feb 12, 2015 at 6:01 PM, François Laupretre <francois@tekwire.net> wrote: > Hi Robert, > >> De : Robert Stoll [mailto:php@tutteli.ch] >> >> There are several programming languages which do support dynamic typing >> and method overloading somehow (Clojure, Erlang, Prolog, Cecil and >> certainly more). Most of them use a multi-method approach and I think if >> PHP would introduce function/method overloading, then such an approach >> would be appropriate. Right now, I need to implement the dynamic >> dispatching quasi myself which might be more verbose but is also more >> cumbersome (and uglier IMO). Consider the following (fictional example): > > We all agree on the interest of polymorphism on object classes, even if your example could be > solved with specialized logger classes, but the question was about polymorphism on different scalar > types, which is much more problematic in PHP, even using strict scalar typing. > > Cheers > > François > Hello, actually, I was speaking about method overloading in general, for both scalars and objects. Also, I don't see the problems with scalar method overloading problem with either weak or strict typing. Could you expand that thought, please? Regards Pavel Kouřil

« previous php.internals (#82597) next »