Re: Bug #748: get_meta_tags() function clobbers namespace
| From: | Kristian Köhntopp | Date: | Wed, 16 Sep 1998 07:09:18 +0000 |
| Subject: | Re: Bug #748: get_meta_tags() function clobbers namespace | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-1155@lists.php.net to get a copy of this message | ||
Rasmus Lerdorf wrote:
> > I don't know who write it. I just saw the entry in the ChangeLog.
> Ah, but there are easy and obvious ways to discover who wrote it.
> I am sure you can figure that out.
Sure, but that is not the point I wanted to make.
The problem I have with the get_meta_tags() function is not who
implemented it, but how it choses to return values. PHP is perfectly
capable of returning arrays, hashes or objects as function results. With
list() these can even be handled comfortably in assignments, if desired.
Returning function results as side-effects of the function call and
messing up the global namespace is a bad design decision because it
creates problems for library implementors and because it is simply not
necessary. "$meta = meta_tags($filename)" and "$meta =
fmeta_tags($filehandle)" with $meta being an array can be easily written
with the current PHP API and would not ruin the concept and the
structure of the language.
This is completely independent of the particular get_meta_tags()
function and who implemented it. Instead it is an annotation that should
be made available to everybody who implements functions for the PHP
language and it is a kind of rule that should be used by those who guard
the source to decide if a submission of a language extension is accepted
for a release.
The latter is important, because if get_meta_tags() style function
returns make it into a release of the language, the language maintainers
will invariably have to support these functions later for compatibility
reasons, even when it starts to hurt. If I guarded the source (which I
don't and which I can't), I would reject such a function on the grounds
that it does not fit into the concept of the language and I would ask
the writer of that function to resubmit it with the suggested changes in
the interface.
Regarding the bug report: Close it or not, I don't care. get_meta_tags()
surely is functional, it just suffers from general interface uglyness.
Kristian
--
SH Online Dienst GmbH, Kristian Koehntopp,
Siemenswall, 24107 Kiel, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.shonline.de/ (GPL)
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net