> >> Maybe a dump question, but wouldn't it get considered only, AFTER PHP
has
> >> found that the function does not exist?
>
> Technically, this can be done - i.e. engine can be patched so that
> instead of throwing an error or refusing the call it would call
> appropriate function which would allow for autoloading.
>
> However, I think autoloading functions if conceptually wrong. One rarely
> keeps functions individually separated in different files (while this is
> routinely happening - and is recommended - for classes). So, if you want
> to autoload functions you would either have to build complex tables of
> where each function lives or organize them in some well-defined modules.
> Such modules are called "classes" in OO-speak

Or "namespaces"... Or just plain "modules". Classes is not the only way to
group things, and may not be the best (namespaces can typically be
re-opened, so functions and classes belonging to a namespace can span
several files, instead of everything having to be in _one_ file).

>, so if you have a group of
> functions that are united by purpose and you want to autoload - why not
> to make a class out of them?

Why? Besides the above, because you may want to be able to call a function
like:

f();

and not:

SomeClassToWrapItAll::f();

...

Please, people: The availability of free (non-member) functions in PHP (as
in C/C++) is one advantage it has over Java, where everything _has_ to be a
class. So in Java, instead of being able to write "sqrt(<number>)", you have
to write "Math::sqrt(<number>)". Always.

And one small plea: If namespaces are added to PHP, please don't add
something like C++'s "argument-dependent lookup": It has caused no end of
problems in that camp. :)

Regards,

Terje

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to