FWIW, I think this is a great feature. Forgive my lack of intimate knowledge
with the core and extension, but would this be possible as an extension to
PHP? i.e., xdebug modifies how certain internals of PHP work through the
zend_extension_ts ini setting.

On 10/15/07, Hans Moog <[EMAIL PROTECTED]> wrote:
>
> Yeah PHPLint is cool and very useful when you want to be strict. We do use
> it regularly. But it doesn't enable you to overload your methods as
> described because this could only be done by a native language construct or
> manual type checks and dispatching.
>
> I thought it would be a good idea to embed this into the language because
> php is getting more and more object oriented and overloading functions is
> one of the basic features of an object oriented programming language.
> Overloading is already possible but php doesn't offer the coder a short
> syntax to support him writing oveloaded functions. I would love to see a
> solution for simpler overloading since that would result in a better
> readability of code.
>
> But since I and Richard Quadling seem to be the only ones who would like
> to have this feature in php, I will put no further effort in this request
> and comply to the will of the majority :|
>
> Perhaps a later release of php will have this feature. (After all, even
> namespace support was added and nobody wanted namespaces at first, because
> it was not the "php way" - so there is still hope :P )
>
> -----Ursprüngliche Nachricht-----
> Von: Umberto Salsi [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 15. Oktober 2007 16:36
> An: internals@lists.php.net
> Betreff: Re: AW: [PHP-DEV] Method overloading by method signature
>
> Posting to newsgroup php.internals, Stanislav Malyshev wrote:
>
> > > only reason to use type hints - to ensure the method is used
> > > correctly and build more robust applications), it is better to tell
> >
> > BTW, I'm not sure how exactly it makes the code more robust - if you
> > call it with wrong type and it's not checked, the app would probably die
> > on fatal error. If you call it with wrong type and it is checked, the
> > app would die on fatal error couple of lines above. Unless you use some
> > kind of static analysis tool to verify your app prior to deployment (if
> > you know such tools please tell me!) I don't see much difference here,
> > mostly syntax sugar and enforcing right style (which is not bad - just
> > it's not that big a deal).
>
> Most of the current applications of PHP do not need strict type checking,
> and
> PHP as we know today perfectly fits these needs. But debugging and
> "cleaning"
> large applications may become a nightmare.
>
> That's why I developed PHPLint, a PHP parser and validator that performs
> a static analysis of the source, ensuring the safe handling of types. In
> a word, this tool makes PHP very close to a strong-typed language without
> the need to further complicate the interpreter with new features that
> would
> pervert the nature of the language.
>
> Every constant, variable, property has a well defined type, and every
> function and method has a well defined signature that can be guessed by
> PHPLint or provided through specific meta-code as in this example:
>
>
> $i = 123;
> # type of the variable guessed as int
>
> define("RND_K", 1.0 / (1.0 + getrandmax()));
> # type of the constant guessed as double
>
> function rnd()
> {
>     return RND_K * rand();
> }
> # signature guessed as float()
>
> $i = rnd();
> # ERROR: assigning double to int
>
> function textToattribute(/*.string.*/ $a)
> {
>     return "\"" . htmlspecialchars($a) . "\"";
> }
> # signature string(string)
>
>
> Best regards,
> ___
> /_|_\  Umberto Salsi
> \/_\/  www.icosaedro.it
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>


-- 
It looked like something resembling white marble, which was
probably what it was: something resembling white marble.
                -- Douglas Adams, "The Hitchhikers Guide to the Galaxy"

Reply via email to