FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » loose thinking
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: loose thinking [message #176788 is a reply to message #176787] Tue, 24 January 2012 15:43 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Álvaro G. Vicario wrote:
> El 24/01/2012 14:32, M. Strobel escribió/wrote:
>> Okay I see it is well documented. I just started testing.
>>
>> I am angry about it because not even isset() respects the null value
>> here. I think it
>> makes more sense this way: isset($a[null]) should return false,
>> because there is no
>> null index.
>
> Whatever implementation details are chosen, they need to be coherent.
> I think your proposed behaviour would lead to pretty counter-intuitive
> situations:
>
> $foo[NULL] = 33;
> if( isset($foo[NULL]) ){
> echo $foo[NULL];
> }else{
> echo '$foo[NULL] is not set'; // Seriously? WTF?
> }
>
>
>> The point is that the designers of PHP (if you can talk about design
>> here) probably
>> meant to help programmers in not making all these hideous type
>> distinctions, but the
>> outcome is you have to be really careful about loose comparison and
>> unwanted type
>> conversion, having to write even more if constructs.
>
> The PHP language has basically evolved along the years as a living
> creature would do, unlike other languages that have actually been
> designed "on purpose", and it has lots of obvious inconsistencies. But
> you are basically suggesting that there's no place for loosely typed
> languages and I disagree with that. I'm very happy that I don't need to
> write three overloaded versions of the same method just to cope with all
> the expected input data types.
>

well thats the problem with overloading variables in the first place.

More complexity you neither want nor need.

float mtcomp(float x, float y, int z)

is simple, precisely defined within the context of the machine
architecture at least, and will blow up completely one way or another -
and generally at compile time - when fed string representations of
floating point numbers.


> Whatever, if you do web stuff and you prefer strong typing I believe you
> do have quite a choice, from Java to .NET (VisualBasic and C#). Don't
> stick with PHP if you are not going to enjoy its good parts.
>
use C if you must.

Its strongly typed enough and practical enough, and has as many useful
libraries.

Too many people get distracted by OOP BS and typing and generalised
fluff and bollocks to do with languages, that doesn't actually solve the
problem or even help solve the problem, of well specified cleanly
written reasonably clearly documented fast code.

I.e. in the end

OPP loose typing - allows me to be a sloppy programmer when calling it
and makes me have to deal with the problems when writing it of all the
sloppiness I might conceivably throw at any given object.

Loosely typed procedural is great because I can be sloppy when writing
the functions and in calling them, but it will blow up in strange ways I
didn't anticipate when it decides to do something I didn't anticipate
either.

Strictly typed procedural means it does what it says on the tin, no more
and no less, but I have to decide what that is first. And any
sloppiness the compiler will throw in my face, or it will segfault when
run.

Frankly I prefer the latter. For anything of serious complexity anyway.

OOP is OK, but only where its definitely a shorter method to the desired
solution.









>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Open Source Customization
Next Topic: Product page getting Redirect back to Home page - Please Fix
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 09:22:41 GMT 2024

Total time taken to generate the page: 0.03626 seconds