6 ms·
Hack Isn't PHP
- killertypo 13y agoso new language built by mega corp on top of debated language hasn't garnered enough trust and buy-in to facilitate mainstream use? Seems fair - I do like the static typing of hack though. Weak typing has its place but it can become a real PITA (looking at you javascript).
- ken_railey 13y agoStatic and "weak" typing are not mutually exclusive.
- kansface 13y agoC comes to mind.
- twic 13y ago> PHP isn’t a great language, but it is a good language [...] it’s just as possible to write good, well-structured code in PHP as in most other languages That isn't what "good language" means.
- wvenable 13y agoYes it is. You probably haven't written code in a bad language, but they exist. Most programmers are pretty lucky these days.
- Arnor 13y agoDoes VB count as a bad language?
- krapp 13y agoI vote yes.
- fish2000 13y agoq.v. JCL
- avenger123 13y agoJob Control Language - Old timers love this. The rigidity of it fits the mainframe philosophy.
- methodin 13y ago"Bad language" is subjective, just like practically all discussions on this topic.
- nsmnsf 13y ago> Expert Sexchange Hahaha! Bigotry is funny! Hahaha!
- vezzy-fnord 13y agoHow is this bigotry? It's one of the oldest puns on the web.
- slight 13y agoJinx :p
- MBlume 13y agoThe 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/ 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.
- vezzy-fnord 13y agoI think it's a combination of the fact that our society has historically had a very perverse relationship with sex, in the sense that it is simultaneously icky, taboo and not to be talked about, yet also crucially important for brownie points and social cred. 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.
- DanBC 13y agoI think it's not "sex change Urgh weird and gross" but "sex change haha wow unpexpected". A bit like PenIsland - or PenisLand. They get a lot of traffic from it. I agree it is problematic if people are uncomfortable with the idea of gender reassignment and using that for humour. But then maybe that's a way those people use to get over those feelings of awkwardness and move to a place of acceptance?
- RossM 13y agoZend the organisation, is probably what Marco meant when referring to poor stewardship, instead of the OS project Zend Framework. I like Hack because it explicitly doesn't support[0] a bunch of cruft from PHP. It feels a lot to me like the BC-breaking PHP.next people want - easy to switch to for modern applications, but not hindered by supporting PHP 4 code. Bit early to start pointing fingers at it's future though. [0]: http://docs.hhvm.com/manual/en/hack.unsupported.php http://docs.hhvm.com/manual/en/hack.unsupported.php
- jimhart3000 13y ago> 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?
- wting 13y agoUsing _ 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.
- wycats 13y agoAnd Ruby, and Rust. It's close to universal.
- agumonkey 13y agoAFAIK 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.
- MBlume 13y agoPython doesn't have language support for the idiom -- trying to evaluate lambda _, _: None gives SyntaxError: duplicate argument '_' in function definition but tools like pylint will silence unused-variable warnings if the variable starts with '_'.
- riffraff 13y ago> It’s developed and supported exclusively by one huge web company, and they may decide to deprecate and replace it in a few years Other than the "web" bit, isn't that true of most new languages, where $proposer is google, microsoft, typesafe, mozilla, redhat, netbrains? Should people feel more secure if instead of being built and used by one large corporation it was built and used by a single guy? Or should we prefer not to have a big company supporting it?
- nly 13y ago> 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 it really faster than CPython like for like?
- jcampbell1 13y ago> 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 practice PHP tends to be quite fast, because the standard solutions are pretty unambitious like thin wrappers around CURL, rather than actually implementing HTTP in php.
- bch 13y ago> pretty unambitious like thin wrappers around CURL That (specific example) sounds incredibly intelligent to me.
- redwall_hp 13y agoI should have stopped reading here: "Most non-PHP developers judge the entire language by bad code snippets 'written' (mostly copied and pasted) by amateurs for PHP 4" The old "stop hating on the only language I know! It doesn't have flaws, there are just newbies using it!" There is plenty wrong with PHP, to this day. When people criticize PHP, they're not usually talking about PHP 4. They're talking about 5.4+. There's some seriously lunacy in the core language. Some of it is there for legacy reasons, and some is brand new.
- goforit1223 13y agoHow about providing some examples that aren't obscure edge cases that are easily avoidable?
- StevePerkins 13y agoI'm not much of a PHP coder, so I tend to watch these flamewars from a distance on the sidelines. However, I've never really understood why people criticize or mock Facebook for pouring so many resources into PHP. For building cross-compilers, toolchains, and syntactic extensions on top of a language that is seen as a fundamentally weak foundation. I mean, I DO understand all of those criticisms. I just don't get how the same people can then turn around and use CoffeeScript, TypeScript, Dart, and even Node.js on the server-side. Compared to a JavaScript foundation, PHP is bedrock!
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]
- deckiedan 13y agoI 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-to-js languages are trying to make it easier to use the good parts, and harder to use the bad ones. - node is different, in that bizarre though js may be, if you have to use it in the browser, there is a kind of logic to using it on the server as well.
- nemothekid 13y ago>It’s developed and supported exclusively by one huge web company, and they may decide to deprecate and replace it in a few years as their technical needs change or its core engineers move on to new projects. Thats an interesting sentiment. The exact same could be said for languages like Go (Google), C# (Microsoft), Rust (Mozilla) and platforms like NodeJS (Joyent). In any case it doesn't seem like too much of a worry. Cassandra came from Facebook, and was well done enough that another company came in and picked up development when Facebook left it.
- jimhart3000 13y agoObjective-C as well.
- Delmania 13y agoNitpick, C# is an ECMA standard that has a non proprietary implementation (Mono). I realize the best implementation is the CLR provided by Microsoft, but is feasible that should Microsoft abandon C#, others could pick it up.
- cafard 13y agoI'm pretty sure that I remember Objective-C (under gcc) from way back.
- gmack 13y agoHe says it's like "PHP++" but I like to say it's more like P#P.
- rubysucks 13y agoYeah Ruby is better
- neuroscr 13y ago>pure PHP will become a less-tested second-class citizen on HHVM Not really true because HHVM has to run basic PHP before it can apply the Hack annotation. You can pull out the annotations and it's still PHP.
- dashr 13y ago> 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.
- vezzy-fnord 13y agoArgument from popularity doesn't denote quality. I'd hardly say he's "continuing the hate", quite the contrary: him calling PHP a good language is likely at odds with most of HN. Quite honestly, there's only a couple or so languages that I would truly describe as "great".
- Jtsummers 13y agoCouldn't a similar rationale have justified (still justify?) Cobol in the 90s and Java today as "great languages"?
- eik3_de 13y agoSure, FB, wikipedia, phpbb, wordpress. But when were those started? If you look at what's created today in startups and open source, PHP isn't a very popular language IMO
- dashr 13y agoLots of startups use PHP (with frameworks like Laravel4, CodeIgniter, Symfony) for their API and sexy new front end JS frameworks that they promote. On our current codebase, started in 2013, we decided to use PHP and have Ruby, JS, Python apps, where appropriate, that run on top. Twitter, famously known as a Rails, now Scala, shop, has used php throughout its life (I know several php coders that have worked there). Their developer/documentation area is Drupal (acquia). But moreover, as web architectures have become more distributed and JSON heavy, PHP has held onto its language position, especially with International devs. As a CTO, not a employee, its also important to consider the salaries, roles of the people you need to build the platform. SF Rails http://www.indeed.com/jobs?q=rails&l=San+Francisco,+CA&rbt=Ruby+on+Rails+Developer http://www.indeed.com/jobs?q=rails&l=San+Francisco,+CA&rbt=R... SF PHP http://www.indeed.com/jobs?q=php&l=San+Francisco,+CA&rbt=Senior+Software+Engineer http://www.indeed.com/jobs?q=php&l=San+Francisco,+CA&rbt=Sen... Then look at Non-US prices. Can't find a recent blog post where someone reported on salaries by language.
- eik3_de 13y ago> it's easy to learn compared 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?
- Jtsummers 13y agoQuestion about PHP, is it the BASIC of the web dev languages? Easy to write terrible code, possible to write good code, derided by many, loved by many of the same (secretly).
- korzun 13y agoThis is hilarious because he was the lead developer at Tumblr. I saw Tumblrs 'original' code base and it's a giant cluster fuck that is full of horrible design decisions. They are still in tons of technical debt because of it. So it's funny to see him give an insight on PHP. Kind of ironic. Either way, Facebook’s HHVM is not for 99% of PHP developers. Most PHP developers need better cache coverage and proper SQL architecture and approach. Execution speed is not a problem for most of them.
- thes_kumar 13y agoIt not just the performance or code snippets available on internet for a particular language that matters to a programmer. The community around the stacks you are using to build the product is equally important.
- gaelow 13y agoGreat article, pretty much sums up my opinion on the language. (And the same goes for Dart, TypeScript and many other `Newspeaks`: "Run in masses towards our beautiful shiny freedom handcuffs!")