> > 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
> >
> Oh, of course it's not the only way. It's the only way native to PHP
though.

Yes.

> > re-opened, so functions and classes belonging to a namespace can span
> > several files, instead of everything having to be in _one_ file).
> >
> Thus, how do you suppose autoloading function would know which file to
> load? We are back to the "complex ugly logic" argument.

That's not something I've thought through: I just wanted to point out that
classes are not the only way to group things. I've quite recently started to
read the postings, here, but I intend to read up on the relevant discussions
in previous postings to the list, to know what has been discussed, and what
has come from it.

> > Why? Besides the above, because you may want to be able to call a
function
> > like:
> >
> > f();
> >
> > and not:
> >
> > SomeClassToWrapItAll::f();
> >
> You may call the class x if you like one-letter names :)

No thanks, I prefer readability. :)

> Besides that, saving keystrokes was never a top priority for PHP

Uah...

> (see how elaborate function names standard modules have).

Yes... "Wonderful", isn't it? :) Sorry, like I said, I'll read up on
previous discussion of things like namespaces, before jumping into a
discussion about them.

Still, just one observation...: Verbosity rarely lead to clarity, it's
rather the other way around.

> Keystrokes are cheap, clarity of the code isn't.

Clarity is very important, but always spelling things out in full may lead
to less clear code. However, I'd think this is a discussion that is more
appropriate at php-general...

> I am just saying trying to make
> functions behave like they belong to class or module without either
> saying "class" or "module" (i.e. include) may not be the best idea to
> support.

I'm not sure I follow you... In for example Java, you have packages
(modules), and you may either use the full name of a class all of the time,
such as "java.lang.Math::sqrt(...)" or "Math::sqrt(...)" (or even
"sqrt(...)", in a language supporting free functions). You seem to argue for
the first one, for "clarity"...

In either of the above cases, you specify where a function belongs, both
where it's defined, and where it's used (either through full qualification,
or a shorter one, using "import"). I'm not arguing for a function to
"magically" become a part of a class/module/whatever, if you thought so
(there's way too much "magic" in PHP as it is, and the separation between
what "implementors" can do, and what "userland" is allowed to, is not a
separation I like, either, but that's another discussion).

Regards,

Terje

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

Reply via email to