Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# jochem@xxxxxxxxxxxxx / 2007-01-03 16:43:14 +0100:
> Roman Neuhauser wrote:
> > # jochem@xxxxxxxxxxxxx / 2007-01-03 14:07:31 +0100:
> >> Roman - you make some very good point but the pragmatist in me
> >> says of your first example - why the F*** would anyone pass in an object and
> >> blindly push it through printf() ?? that sucks as far as code goes (personally
> >> evening being so diligent as to implement __toString() on the relevant class is
> >> asking for bad news - too much magic imho)
> >>
> >> if the function should be capable of taking an object or a string it should
> >> check what it recieves.
> >>
> >> the way I see it this is bad code by design - and needs to be fixed.
> > 
> > Well, why the F*** would anyone use a language that allows you to pass
> > incompatible objects to a function and crashes when you do so? ;)
> > 
> > Errors and warnings are fine for languages where the compilation step is
> > separate from the run. For a language like PHP, anything but
> > "RuntimeException" means your perfectly correct code can crash at
> > runtime, without you having a slightest chance to react (in the code).
> 
> you have to pay some kind of price for dynamic typing and intepreted
> running.
> 
> testing is done for a reason and I stand by my opinion that your given example
> is tantamount to awful coding and it should be corrected.

Why is it awful coding? I have a piece of code where exactly this is
(was in 5.1) a perfectly reasonable thing to do (the example is
contrived to clearly demonstrate the behavior at hand). The output was
for informational purposes, and the "Object #N" presentation was
completely adequate even with its quirks.

BTW, would you share a version of f($any) that meets your definition of
good code?
 
> >>>     function f($any)
> >>>     {
> >>>         printf("%s\n", $any);
> >>>     }

> >> true - but then it would force someone to use exceptions - the overall
> >> consensus went against forcing that on people.
> > 
> > I don't follow the logic. What did we gain? Can one of those "exceptions
> > == Java, Java stinks, exceptions stink" campers show me their version of
> > the below f($any) that works in 5.1 and 5.2?
> 
> probably not - i wouldn't know I don't live in that camp.

That's why I didn't ask *you*. ;)

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux