On 13-07-28 06:33 AM, Svip wrote:
On 28 July 2013 09:52, Виталий Филиппов <vita...@yourcmc.ru> wrote:

Also for example I don't like python's strict typization ideas (for example it 
throws exception if you concatenate long and str using +). PHP is simple and 
has no such problems.

Except, you know, that is not entirely true.  PHP's weak dynamic types
causes numerous problems.  You cannot compare strings in order to sort
them, you need to convert individual characters to their ASCII/Unicode
value and compare it that way (and that in itself is not always
perfect, because their value may not be in the same order as humans
consider an appropriate sorting[0]).

If I do `"10" == 10' in PHP, PHP will yield true.  I can force it to
say false (because they are not the same type) by using '===' (except
- of course - PHP developers fails to understand what the === operator
is for[1]).

You should prefix that statement with "some" so that it reads "some PHP developers fails[sic] to understand what the === operator is for".

> But if I do `"10" < 11' in PHP, it will yield true,

Because you didn't properly state what you wanted if this is not what you wanted.

because < does what == does (converts the types), but there is no way
to tell PHP, I don't want that.

Indeed there is:

if( is_int( "10" ) && is_int( 11 ) && "10" < 11 )

Particularly because int nor str doesn't exist in the language, you

Yes they do.

cannot cast things in PHP to control your types.

One certainly can:

$int = (int)$string;

Furthermore, PHP has an annoying habit of doing stuff without warning you.

I recommend you reading this article:
http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

The writer names 5 stances:

    predictable, consistent, concise, reliable, debuggable

I can only see one failing... consistent and much of that is for historical reasons and the mirroring of C based library functions. All turing complete languages are predictable by definition. PHP is certainly concise compared to many languages. Reliability is dependent on the skill level of the developer. Debuggable is certainly possible, although perhaps more difficult than some languages. Screen prints, log prints, and xdebug generally make the process simple enough.

Cheers,
Rob.



This is one of the main reasons I stopped contributing to MediaWiki; I
simply got tired of writing in PHP.  I don't like a language where I
constantly have to circumvent it, because its developers are stupider
than I am.

[0] Of course, no other languages solves this issue as well, so that's
another thing.
[1] === compares values and type… except with objects, where === is
only true if both operands are actually the same object! For objects,
== compares both value (of every attribute) and type, which is what
=== does for every other type.  Wat.

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to