PHP sucks dick through a straw
Jonathan Stowe
jns at gellyfish.com
Fri Jan 12 10:36:13 GMT 2007
On Thu, 2007-01-11 at 16:42 -0500, Jeff Anderson wrote:
> What kills me about PHP (i was coding up some recently) is that an objects
> attributes and methods have to be called in different ways:
>
> $object->attribute;
> $object->method();
>
> So if i call some method $object->has_foo() and forget to add the parens
> (thinking that it is an attribute) then PHP will not throw any kind of
> error, and instead just return undef since $object->has_foo was never set.
>
And I thought C# was hateful when you did a similar thing - at least it
emits the error "property access found where method call expected
(perhaps you forgot the parentheses)" or something.
In the end this isn't a PHP specific annoyance, it's an annoyance of all
dynamic languages of one sort or another which nearly to the last one of
them allow you to shoot yourself in various appendages in similar ways.
/J\
More information about the london.pm
mailing list