|
Posted by Robert Cummings on 09/16/05 21:22
On Fri, 2005-09-16 at 14:10, Rasmus Lerdorf wrote:
> Well, this is the sort of thing the language should help you with.
> Whether or not the code is incorrect or not is not the relevant question
> I think. The question is whether the language should try to detect when
> you are doing something that is not going to do what you expect. If
> someone really writes code like the above, I see it as a plus if they
> could get an optional warning about it. That's exactly what an E_NOTICE
> on this is for.
>
> > As you are seeing now, we now have a horrible situation where
> > the developer now has to care about whether they are passing a value to
> > a function expecting a reference or not, and if that function expects a
> > reference they now have to manually create a temporary container
> > themselves :/ Anyways, I've already accepted whatever comes out of all
> > this, but personally I don't think the code you showed above is wrong at
> > all :)
>
> Well, you can turn off notices, or rather not turn them on since they
> are off by default, and you won't have to care. Like I said, the
> current fatal error in 5.0.5 on this is incorrect and we will fix that,
> but I still believe it is a good idea to provide users with a way to get
> warnings on cases where references are dropped since it could very well
> hide a bug in their code.
Yeah, I concede the point *grumbling under my breath* that people should
probably get a notice, although for me that's just as bad as a warning
since I don't like getting notices while developing. It gives me (and
probably anybody who ever views such code in a development environment)
the feeling that it's incorrect. I guess that's one of the problems
about being anal about code and I don't think I'm alone with this
feeling ;) I've taken over code in that past that's been known to
generate 1000's of E_NOTICES and E_WARNINGS and just as expected, all
kinds of bugs were present *heheh*. Right up there with code that thinks
it's ok to send 10k sql queries to facilitate some purist idea of OOP
data retrieval :)
Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
[Back to original message]
|