|
Yeah Windows rand() is loving worthless. Found that out when trying to reimplement the deals in FreeCell. It's got some ridiculously low period.
|
# ? Apr 10, 2012 03:35 |
|
|
# ? May 23, 2024 06:19 |
|
McGlockenshire posted:Perl, Ruby and Python all expose the same flawed rand by default, as does, say, C. This has been a known problem for decades. Doesn't Python use Mersenne? Or am I misinterpreting the flaw in that one too.
|
# ? Apr 10, 2012 03:37 |
|
Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go.
|
# ? Apr 10, 2012 05:20 |
|
Captain Capacitor posted:Doesn't Python use Mersenne? Or am I misinterpreting the flaw in that one too. Honestly, I last checked over seven years ago when I wrote my last rant about rand. Everyone has Mersenne implementations available regardless, no excuse to use anything other for non-crypto randomness.
|
# ? Apr 10, 2012 05:42 |
|
bahahahahahahaquote:Unlike (literally!) every other language with a similar operator, ?: is left associative [in PHP]. So this: edit: quote:function foo() { return new __stdClass(); } leaks memory. The garbage collector can only collect garbage that has a name. edit: quote:php_uname tells you about the current OS. Unless PHP can’t tell what it’s running on; then it tells you about the OS it was built on. It doesn’t tell you if this has happened. edit: quote:PHP’s parser fails if there’s a NUL in a file anywhere quote:Declaring a function named __lambda_func will break create_function—the actual implementation is to eval-create the function named __lambda_func, then internally rename it to the broken name. If __lambda_func already exists, the first part will throw a fatal error. pokeyman fucked around with this message at 06:28 on Apr 10, 2012 |
# ? Apr 10, 2012 05:50 |
|
Suspicious Dish posted:Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go. That is a magnum opus.
|
# ? Apr 10, 2012 06:00 |
|
McGlockenshire posted:Honestly, I last checked over seven years ago when I wrote my last rant about rand. I gave a quick read through that rand article and Python (and Perl, I think) use Mersenne Twister, and PHP has one using the mt_rand function.
|
# ? Apr 10, 2012 06:04 |
|
Suspicious Dish posted:Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go. This is the best thing ever.
|
# ? Apr 10, 2012 06:13 |
|
Suspicious Dish posted:Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go. quote:function foo() { return new __stdClass(); } leaks memory. The garbage collector can only collect garbage that has a name.
|
# ? Apr 10, 2012 06:29 |
|
That huge list had me laughing out loud. Some of it, like not collecting "unnamed" garbage, is just nonsensical. It's self-parody.
|
# ? Apr 10, 2012 06:38 |
|
pokeyman posted:That huge list had me laughing out loud. Some of it, like not collecting "unnamed" garbage, is just nonsensical. It's self-parody. quote:=== 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. hahahaha gently caress you for posting this, I need to sleep!
|
# ? Apr 10, 2012 06:40 |
|
I'm not noticing that stdClass leak; I'm running it in a tight loop in constant memory. Maybe it got fixed?
|
# ? Apr 10, 2012 06:41 |
|
the ultimate PHP rant posted:I have heard a great many stories about the PHP interpreter and its developers from a great many places. These are from people who have worked on the PHP core, debugged PHP core, interacted with core developers. Not a single tale has been a compliment.
|
# ? Apr 10, 2012 06:41 |
|
Oh wait, no, I have a new favorite:quote:Array functions often have confusing or inconsistent behavior because they have to operate on lists, hashes, or maybe a combination of the two. Consider array_diff, which “computers the difference of arrays”.
|
# ? Apr 10, 2012 06:45 |
|
quote:Functions are not data. Closures are actually objects, but regular functions are not. You can’t even refer to them with their bare names; var_dump(strstr) issues a warning and assumes you mean the literal string, "strstr". There is no way to discern between an arbitrary string and a function “reference”. quote:Incrementing (++) a NULL produces 1. Decrementing (--) a NULL produces NULL. Decrementing a string likewise leaves it unchanged. This is the best. PHP is the best. edit: quote:PHP basically runs as CGI. Every time a page is hit, PHP recompiles the whole thing before executing it. Even dev servers for Python toy frameworks don’t act like this. Check the prices on that Zend page too Look Around You fucked around with this message at 07:17 on Apr 10, 2012 |
# ? Apr 10, 2012 07:13 |
|
tef posted:assuming no integer overflow OddObserver posted:Well, the compiler probably can (repeat after me: signed integer overflow in C is undefined...) Let's try this again: tef posted:assuming the pointer isn't null OddObserver posted:Well, the compiler probably can (repeat after me: dereferencing a null pointer in C is undefined...) Do you see the problem with this sort of reasoning?
|
# ? Apr 10, 2012 07:23 |
|
Otto Skorzeny posted:Since it's come up twice now, I'll disagree
|
# ? Apr 10, 2012 08:41 |
|
CGameProgrammer posted:That does not work if foo is declared as void*. Well yeah, but malloc(n * sizeof(void)) isn't standard C either, so that's kind of beside the point.
|
# ? Apr 10, 2012 08:48 |
|
Suspicious Dish posted:Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go. Look at the hate this writeup is getting on hackernews: http://news.ycombinator.com/item?id=3820431
|
# ? Apr 10, 2012 09:17 |
|
Vanadium posted:Look at the hate this writeup is getting on hackernews: http://news.ycombinator.com/item?id=3820431 To be fair, there are a lot of comments saying "actually the writeup is pretty much spot on and people like you are the reason things like this need to be said". The fact that those are tucked way down the discussion lists basically proves that vote-moderated discussions are still really lovely even (or perhaps "especially") on niche communities. edit: While we're here I'd just make the point that even more than Minecraft, PHP more or less proves that code quality is completely orthogonal to something actually being "successful". Jabor fucked around with this message at 09:36 on Apr 10, 2012 |
# ? Apr 10, 2012 09:32 |
|
Vanadium posted:Look at the hate this writeup is getting on hackernews: http://news.ycombinator.com/item?id=3820431 I only skimmed the comments but it seems like most people defending PHP from criticism like this tend to say things like "yes well it's easy to hack something together in 10 minutes" or "yes well it's easy for newbies to learn" and the part they miss is that yes, those are things that are good about PHP but (the great majority of) the bad things don't have to be present in order to have the good things. You don't have to have a massive standard library with inconsistently named functions in order to be easy for new programmers to learn your language, for example. If anything those redeeming qualities are in spite of the flaws of the language.
|
# ? Apr 10, 2012 09:53 |
|
Jabor posted:The fact that those are tucked way down the discussion lists basically proves that vote-moderated discussions are still really lovely even (or perhaps "especially") on niche communities. I would say that even in my (relatively) short tenure there, the quality of discussions on HN has declined precipitously. The articles posted are still often good, but a combination of the bikeshed problem, influxes of new users from variegated sources and a few other things has really wrecked the comments.
|
# ? Apr 10, 2012 10:13 |
|
Not sure about 'hate'. That HN thread seems on pretty even keel with a lot of people saying good and bad things about PHP. And overall I don't really see much comments about how the article sucked unless you imply that people who comment defending PHP hated the article.
|
# ? Apr 10, 2012 11:03 |
|
pokeyman posted:That huge list had me laughing out loud. Some of it, like not collecting "unnamed" garbage, is just nonsensical. It's self-parody. I think my favourite new bit of information is http://www.php.net/~derick/meeting-notes.html#named-parameters quote:'Discussion: We don't see the real need for named parameters, as they seem to violate PHP's KISS principle. It also makes for messier code.'
|
# ? Apr 10, 2012 14:28 |
|
"Keep it stupid, stupid"
|
# ? Apr 10, 2012 14:32 |
|
Hammerite posted:If anything those redeeming qualities are in spite of the flaws of the language. When you learn another language, you'll find those 'qualities' start to look like flaws in their own right. PHP is so broken that the minor bugs look like features. You can knock up anything quickly in a language you know, meanwhile php is the one that will let you write easily exploitable code off the bat in a number of contexts. If php was a way to build a house, it would be the quickest way to build a house that's on fire. If php was a way to cook food, it would be the quickest way to burn food and poison people. It isn't easy for newbies to learn. Most of them are using it because they don't want to learn or understand what they are doing. It's the quickest, fastest way to make terrible decisions that will haunt you for life. No-one learns php, they cut and paste and google around the error messages until the issue goes away for them. The people who defend php, haven't learned any other programming language, let alone the one they champion.
|
# ? Apr 10, 2012 14:35 |
|
Nippashish posted:PHP's rand() function seems to have some pretty obvious patterns. As much as I love a good 'PHP Sucks' rant (and oh god do I), this has been fixed in the intervening four years. It looks like rand() defaults to using Mersenne Twister in at least 5.3.6 on Windows.
|
# ? Apr 10, 2012 14:56 |
|
Suspicious Dish posted:Since PHP doesn't already get enough hate, eevee has published the ultimate anti-PHP rant. Look at that thing go. The comments are gold(?) too. I've already seen at least half a dozen "it's open source, if you don't like it fix it rather than whining about it" (by people who I'm guessing have neither read the article, nor attempted to report a bug against PHP). I've also seen nearly as many "gently caress the haters, PHP pays the bills and that's the only thing that matters. Good luck getting a job with one of your toy languages like ruby, or python, or java. " posts.
|
# ? Apr 10, 2012 16:27 |
|
McGlockenshire posted:Perl, Ruby and Python all expose the same flawed rand by default, as does, say, C. This has been a known problem for decades. Is this really a bad thing, besides rand() being flawed? That way if you have a system with some sort of fancy RNG that can be used without the languages really needing to know. And if a security hole is found in an RNG then fixing it is just a matter of updating the OS as opposed to updating all of your binaries?
|
# ? Apr 10, 2012 16:56 |
|
evensevenone posted:Is this really a bad thing, besides rand() being flawed? That way if you have a system with some sort of fancy RNG that can be used without the languages really needing to know. And if a security hole is found in an RNG then fixing it is just a matter of updating the OS as opposed to updating all of your binaries? Well, the underlying horror is really: - the only C standard PRNG is rand(); random() is POSIX, so anything that wants to be portable to windows (or weird-but-standards-conformant embedded systems or the like) can't use it - windows is still using the old lovely rand() and probably will be forever Using the system PRNG rather than rolling your own is nice for the reasons you stated, except on windows, where the system PRNG is poo poo and will never be fixed.
|
# ? Apr 10, 2012 17:02 |
|
Is there a reason that rand can't be fixed on windows? I mean what kind of applications depends on the non randomness of the Rand function?
|
# ? Apr 10, 2012 17:43 |
|
MEAT TREAT posted:Is there a reason that rand can't be fixed on windows? I mean what kind of applications depends on the non randomness of the Rand function? I have no idea. As far as I know there's no technical reason except maybe "backwards compatibility with legacy programs that might depend on the brokenness of rand()" and they can always roll that into compatibility mode if people actually need it. To clarify, my "will never be fixed" statement stems not from any technical reasoning but from the fact that rand() has been known to be poo poo for years if not decades and yet has not, to my knowledge, been fixed in any release of windows or msvcrt.
|
# ? Apr 10, 2012 18:01 |
|
MEAT TREAT posted:Is there a reason that rand can't be fixed on windows? I mean what kind of applications depends on the non randomness of the Rand function? FreeCell!
|
# ? Apr 10, 2012 18:10 |
|
I'm still laughing at ?: being left-associative. That's the best joke I've ever seen.
|
# ? Apr 10, 2012 19:22 |
|
ToxicFrog posted:Well, the underlying horror is really: Most systems have a cryptographically secure PRNG: http://msdn.microsoft.com/en-us/library/aa379942.aspx https://en.wikipedia.org/wiki//dev/random That it's not the same function in all of them is a poo poo excuse to use rand().
|
# ? Apr 10, 2012 19:43 |
|
pokeyman posted:I'm still laughing at ?: being left-associative. That's the best joke I've ever seen. I'm still having trouble wrapping my head around how that's even supposed to work. The words all parse but I just can't make the logic happen. dis astranagant fucked around with this message at 19:59 on Apr 10, 2012 |
# ? Apr 10, 2012 19:45 |
|
As much as I hate having to work with PHP, I love learning about the dumb poo poo that it does. It's the gift that keeps on giving.
|
# ? Apr 10, 2012 19:58 |
|
code:
|
# ? Apr 10, 2012 19:58 |
|
ToxicFrog posted:I have no idea. As far as I know there's no technical reason except maybe "backwards compatibility with legacy programs that might depend on the brokenness of rand()" and they can always roll that into compatibility mode if people actually need it.
|
# ? Apr 10, 2012 20:00 |
|
|
# ? May 23, 2024 06:19 |
|
dis astranagant posted:I'm still having trouble wrapping my head around how that's even supposed to work. The words all parse but I just can't make the logic happen. code:
|
# ? Apr 10, 2012 20:23 |