> Expert Sexchange Hahaha! Bigotry is funny! Hahaha!
How is this bigotry? It's one of the oldest puns on the web.
Hack Isn't PHP
41–50 of 71 posts
Re: Hack Isn't PHP
#42Earlier quoted context omitted.
> Writing list(, $b) = array(3,4) is not allowed. Instead use $_, i.e.: list($_, $b) = array(3, 4). Not that I think the former is good practice at all, but isn't the latter a kind of weird use of what is a valid variable name?
Using _ as a throwaway variable name is idiomatic in Python, Haskell, and Go. Looks like they're pushing the same idiom in Hack, which I'm ok with.
Re: Hack Isn't PHP
#43compared to what? IMO an easy to learn language has very little surprises, is consistent and names things intuitively. Would you say that php as the language is easier to learn than ruby or python?
Re: Hack Isn't PHP
#44Earlier quoted context omitted.
Using _ as a throwaway variable name is idiomatic in Python, Haskell, and Go. Looks like they're pushing the same idiom in Hack, which I'm ok with.
AFAIK in Haskell it's not a throwaway variable, a pattern with _ will not create a binding at all. I don't think Python does this, maybe Go.
lambda _, _: None
gives
SyntaxError: duplicate argument '_' in function definition
but tools like pylint will silence unused-variable warnings if the variable starts with '_'.
Re: Hack Isn't PHP
#45Earlier quoted context omitted.
I think you're just trolling. But on the off-chance that you may actually be interested in discussion from someone who does a lot of JS, has done a lot of PHP: No, they're different. Firstly: - js is the only choice in browsers. for server stuff, you have an almost infinite choice. - javascript has warts, sure. but if you stick to "the good parts", then it is possible to use in a relatively sane manner. the compile-t…
> if you stick to "the good parts", then it is possible to use in a relatively sane manner Is there any language for which this is not true?
I may just be biased against PHP.
Facebook, at least, believe that it does have enough good parts to make it worth while, so my opinion is just that. My opinion.
I feel that JS has the following good points:
closures, anonymous functions & enough of the 'lisp-zen-nature' to be quite powerful. The prototypal inheritance is a bit weird, at first, and a little ugly on its own, but actually is quite powerful.
It's simple enough that any non-js programmer can pick it up pretty quickly.
PHP has all the usual well known issues, but has the following problems that JS doesn't:
a vast vast vast multi-level standard library, with many different ways of doing things (mysql, mysqli, pdo...) all of which are built in (or not, you can't tell until run-time). the various different php.ini settings which actually change how the language works (eg. 3 different 'escape to HTML' tags). although functions are 'considered bad practice' to use, there isn't a single source of truth on how to write it well. the documentation is a sea of misunderstanding and examples of how to abuse functions and do things which aren't non-obvious (the comments on each page). JS objects generally have methods attached for doing the various operations on them. php has a bit of that, but mostly external functions that you pass arrays or whatever to. That can be just a stylistic thing (being more 'c' like) but it also means you end up having to know - just to use the language at a basic level - that it's array_splice($a), sort($a), array_rand($a), strpos & string_replace, etc.
JS is really quite a small language. You can read crockford's, 'the good parts' in a day, including all the bits to avoid. PHP is a very big language. To write a 'the good parts' of it would require a much longer book, as you can't use the recommended parts without understanding pretty much of the whole language.
Re: Hack Isn't PHP
#46> PHP isn’t a great language, but it is a good language. So what is a great language? If it runs the largest active user app on the planet (FB), the most widely used CMSes (WP,Drupal,EE), message boards, MVPs, etc. Why continue the hate, then end the article on how you've chosen it as the greatest option to run some of your systems.
Re: Hack Isn't PHP
#47Earlier quoted context omitted.
How is this bigotry? It's one of the oldest puns on the web.
The question is, what's going on if you do a stack-trace on why people find the joke funny. I think there's a certain amount of "haha, it says sex now" (same as with the [no sex cover]( https://github.com/cmheisel/nose-xcover/ ) but I suspect there's at least some element of "sex change, that's gross and strange and weird, haha" which is pretty problematic.
However, the main reason is simply the fact that it's such a captivating example of unintentional humor, and what happens when you don't pay attention to your image. In many ways, it's the linguistic equivalent of the famous rabbit-duck optical illusion. It's curious and elicits a response when one realizes the double entendre.
It's hardly problematic, unless your definition of problematic is for everyone not to be dull as cardboard to every little example of unintentional humor in their lives.
Re: Hack Isn't PHP
#48Re: Hack Isn't PHP
#49> This is exactly what the PHP world needed: making its already-fast performance many times faster (amplifying one of PHP’s biggest advantages over other common web languages) I think PHPs speed is largely exaggerated here. The interpreter always used to be slow, and before the bytecode cache it was plain awful. Im pretty sure it only ever got away with it because so much of the standard library is thin wrapping. Is…
> Is it really faster than CPython like for like? It is a mixed bag. There are times where PHP is faster because it is closer to C, where as more python is written in Python. I once ran into a situation where it mattered that PHP's file_exists() is much faster than python's os.path.exists(). I have run into other cases where CPython is much better, such as python's heapq crushes a hand rolled PHP priority queue. In p…
That (specific example) sounds incredibly intelligent to me.