Slashdot Mirror


Facebook Introduces Hack: Statically Typed PHP

alokmenghrajani (2602135) writes with news of Facebook's new Open Source language, Hack. Quoting: "Today we're releasing Hack, a programming language we developed for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages. ... Traditionally, dynamically typed languages allow for rapid development but sacrifice the ability to catch errors early and introspect code quickly, particularly on larger codebases. Conversely, statically typed languages provide more of a safety net, but often at the cost of quick iteration. We believed there had to be a sweet spot. ... Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files. ... Our principal addition is static typing. We have developed a system to annotate function signatures and class members with type information; our type checking algorithm infers the rest. Type checking is incremental, such that even within a single file some code can be converted to Hack while the rest remains dynamically typed. ... If a function parameter or class member does not have an explicit type annotation, the type checker considers its type to be dynamic, and it does not check the type of that value." In addition to static typing, they've introduced proper closures that capture the lexical environment, generics, collections, and array shapes. The Hack website has more details. There's a fairly complete language manual, tools to infer types in PHP source and annotate the code, and source available under the PHP license.

230 comments

  1. English? by Anonymous Coward · · Score: 0

    Can someone please convert the summary in english, with basic explanations?

    1. Re:English? by Anonymous Coward · · Score: 2, Informative

      FaceBook is developing an in-house version of PHP that adds optional static typing and some other features.

    2. Re:English? by Anonymous Coward · · Score: 4, Funny

      Can someone please convert the summary in english, with basic explanations?

      My interpretation of the summary is: Facebook has sunk a lot of investment into a turd, and now they've determined that that turd needs polishing.

    3. Re:English? by Marginal+Coward · · Score: 1

      Can someone please convert the summary in english, with basic explanations?

      The basic idea is that they've hacked PHP into something called "Hack" by turning it into something PHP was never intended to be. Yet Hack is still backwards-compatible with PHP. Presumably, this is to avoid the need to convert Facebook's large base of sluggish PHP code into some other language which was designed from the start for run-time efficiency. Instead, they can make incremental efficiency changes to their code base to make it run as if it had been written in a more efficient language in the first place. Much saving of expensive hardware and power will ensue.

      If all you've ever used is a hammer, everything looks like a nail. But if you eventually find yourself faced with a screw and you're really smart, you can just hack your hammer into a screwdriver rather than hammering in the screw like those not-so-smart folks who find themselves using the wrong tool do.

    4. Re:English? by MightyMartian · · Score: 5, Insightful

      My interpretation is that they've put a lot of work turning PHP into Java or C. Why go through all this effort when they could simply used one of the C-like strongly typed languages is beyond me. All that effort could have been put into creating a PHP-to-Java converter or something along those lines.

      But hey, it's Mark Zuckerberg's bazillion dollars. If he wants to tape testicles on a eunuch, be my guest.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    5. Re:English? by alokmenghrajani · · Score: 5, Interesting

      Hack is more than turning PHP into Java or C. Java's type system is way different than C's (there are no objects in C). Hack's is different than Java's because it uses a type inference system. It also type checks incrementally, which allows the quick edit/save/reload cycles web developers are used to.

    6. Re:English? by Minwee · · Score: 1, Troll

      Team Zuck has been trying to find something that is more of a hack than PHP, but couldn't. So they invented one.

    7. Re:English? by K.+S.+Kyosuke · · Score: 2

      convert the summary in english

      They reinvented soft typing. ;-)

      --
      Ezekiel 23:20
    8. Re:English? by Wootery · · Score: 2

      Why go through all this effort when they could simply used one of the C-like strongly typed languages is beyond me.

      Because they already have a huge PHP codebase. That said, Twitter moved from Ruby to Scala for their back-end; it seems it can be done. I suspect Facebook have more of a lots-of-programmers problem: they all know PHP, and they might not all know, say, Scala.

      to creating a PHP-to-Java converter or something along those lines.

      You mean take PHP source and translate it into readable, maintainable Java source? That's all but impossible. They're very different languages, and source-to-source translators tend to produce pretty unreadable code when faced with that kind of task. A human wouldn't design a PHP program the same way she'd design the same program in Java. Without some terribly impressive AI, there's really no way around this.

      They could have translated PHP into totally-unreadable Java and then (run that through javac and) run the result on the JVM, sure, but then you're really just creating a rival PHP implementation. (Look like two separate projects have done just that, though, and apparently had pretty good results, outperforming the official PHP interpreter. All that says is that the official PHP interpreter is crap, which I think we all knew anyway.)

    9. Re:English? by Chris+Graham · · Score: 5, Informative

      For pragmatic-minded people, PHP is an extremely productive language to work in. No compiling, or waiting for compiling, no object files to mess with or get out of sync, and still relatively good speed. It really removes a lot of inconvenience between the programmer writing code and testing it. Despite what the detractors say, I've always found it a joy to work in (and I have worked in many languages).

      The down-side has always been that the language also had many sloppy characteristics. Modern PHP has cleaned up a lot of the language design errors, and static typing is extremely useful for reducing quantity of bugs (I know this as I developed a PHP fork that enforces this and it's saved me many many times over the years). HHVM adds much more speed, so that really complex modern social webapps are really needing. There are still many small inconsistencies in the language, but it's not a big deal given the other advantages.

    10. Re:English? by MightyMartian · · Score: 4, Interesting

      PHP is productive in that it can work as a fast prototyping language. Even I recognize that, and in fact use it as such.

      Where it falls down is that it doesn't enforce the kind of discipline that better languages do. It is well and truly the BASIC of the 21st century.

      That's not to say you cannot write good code in PHP. I do strive when I have to work in PHP (which is more than I would like) to write well-formed code, use newer language structures and so forth. But still, and maybe it's because I like the crutch, I just feel better coding in statically typed languages, and to be pretty blunt, if PHP is evolving into that kind of language, there are far better languages out there.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    11. Re:English? by Anonymous Coward · · Score: 0

      There are still many small inconsistencies in the language, but it's not a big deal given the other advantages.

      The thing is, there are dozens of other languages which have those same advantages, but don't have the legacy of basically being patched together from disparate ideas by people who don't think things through properly.

    12. Re:English? by CommanderK · · Score: 1

      All that effort could have been put into creating a PHP-to-Java converter or something along those lines.

      They have created a PHP-to-C++ translator called HPHP (or HipHop), years ago. The code that it generated wasn't really human-readable or maintainable.

    13. Re:English? by MightyMartian · · Score: 1, Funny

      So not much different than PHP then...

      (ducks)

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    14. Re:English? by turbidostato · · Score: 3, Insightful

      "For pragmatic-minded people, PHP is an extremely productive language to work in. No compiling, or waiting for compiling, no object files to mess with or get out of sync, and still relatively good speed. "

      You mean, like any other interpreted languages you could choose?

      "The down-side has always been that the language also had many sloppy characteristics."

      You mean, like those avoided by any other interpreted languages you could choose?

    15. Re:English? by RabidReindeer · · Score: 4, Funny

      So not much different than PHP then...

      (ducks)

      It generates Perl?

    16. Re:English? by nickittynickname · · Score: 1

      Php (Personal Home Pages) is already something it was never intended to be. It's the "hey thats a nice feature, let me add a crappy implementation of it" language. If you mean "turn PHP into something never inteded to be" as turning it into something not absolutely horrible to work with then OK. Anything they do is going to be better than PHP. You would have to try really hard to make it worse.

    17. Re:English? by Anonymous Coward · · Score: 1

      Inconsistency seems to be a design philosophy in PHP. Even the new type system is inconsistent...sometimes you use type prefixes and sometimes you use type suffixes. For example:

      Hack: function add(int $x, int $y): int { ... }
      Go: func add(x int, y int) int { ... }
      Java: public int add(int x, int y) { ... }

      Both Go and Java are consistent...either the type comes before or after the name, but it's always the same. Hack has types both before and after the names. This makes code really hard to read when you start passing functions around.

      For example, compare: function map(array<Foo> $ar, function(Foo): Bar $mapFn): array<Bar> { ... }
      To: func map(ar []Foo, mapFn func(Foo) Bar) []Bar { ... }

      One is readable as the nesting level increases, the other isn't.

    18. Re:English? by MightyMartian · · Score: 1

      I think I just went blind!!!!

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    19. Re:English? by Anonymous Coward · · Score: 0

      Depends on what you mean by "object." Both the C and C++ standards define "object" as (loosely) something occupies memory and has a type (i.e., an int variable is an object).

    20. Re:English? by Chris+Graham · · Score: 5, Insightful

      Ah, it seems I started a religious language war simply by sticking up for the tool I (have to) use ;-). I've not claimed PHP is the best language, only it is a comfortable language to me and many others. I just do not feel the pain some developer's always claim to feel, the inconsistencies just don't cause ongoing real world problems for me. I do not lose productivity on a day-to-day basis, they do not cause additional bugs (well, dynamic typing could - and a small number of other things could if you don't have a framework / know the issues), they do not make the code unreadable, and I do not have a problem hiring or training competent developers in the language. Whatever problems there are are easily resolved, and the smallest problem I have as a professional. A PHP developer not aware of the few issues to avoid, would also not have the basic field knowledge to avoid a myriad of other pitfalls that affect all programming languages. I know so many people will read this and think "but there are issues, and you can't excuse that" - I'm not - but I also firmly believe going through your professional career with so much anality for the small niggles doesn't help anybody, and that instead of whinging, people should put their energy into something more productive and positive, like concentrating on client ROI (and no, the 5 minutes you took looking up an inconsistently named function the other day doesn't make an identifiable difference to it), or perhaps, putting in RFCs for cleaning up the issues for PHP6.

      The reason I develop in PHP is because I write consumer software to deploy on web hosts, and I don't chose the web hosts, and PHP is the overwhelming 'standard'. Probably the world would be better if Python replaced PHP, but bitching about the tools people use with arguments that the users of said tools simply cannot relate to, just seems ridiculous, and annoying because it just undermines the good work some seriously talented/hardworking/worthy people are doing. There is absolutely no reason PHP cannot continue to evolve, step by step, without forcing the entire hosting industry to adapt to something else (which is never going to happen).

      I just ported a project from ASP.net to PHP, and my God the problems I saw in that language. Whenever I look at Ruby code, I just see the most inelegant syntax - it just looks like it was deliberately designed to combine being cryptic in some places, with pulling in English words where self-describing layout would be better. And then there are a host of academic languages which have elegant concepts, but poor libraries, or just are too over-complex for real world use.

      For what it's worth, I think the world would be better off if Javascript was replaced too (I get annoyed by that much more than PHP actually, because some basic programming constructs are just hacks, and it is literally impossible to write elegant looking code).

    21. Re:English? by HiThere · · Score: 3, Interesting

      That's not what Object programming considers an object. It would be more like:
      "A struct and all the functions that use it as the first argument" depending on the language. Some languages would have it be a pointer to the above. One of the critical aspects of an object is that is has a local scope for each instance. In C this either means you are holding it on the stack, or you've done a malloc.

      That said, you can definitely do object programming in C. Existence proof is offered by valac -C which takes Vala code and emits a C equivalent. (It uses the GObject protocol to do so.) Mind you, the code that it emits is nearly unreadable, but it *is* object programming in C.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    22. Re:English? by MightyMartian · · Score: 1

      I'll remember that the next time I'm navigating the horror that is the PHP function library.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    23. Re:English? by Pseudonym · · Score: 4, Informative

      No. Facebook is developing a new language which is syntactically similar to, and inter-operates with, PHP. Calling Hack a "version of PHP" is like calling Delphi a "version of ALGOL".

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    24. Re:English? by Pseudonym · · Score: 3, Insightful

      To be fair to Facebook, no other languages had those advantages in 2002-2003. Assuming you didn't want to use F/CGI, plugins for Apache or the equivalent, your server-side scripting options were JSP, Asp.NET and PHP.

      PHP was a reasonable choice under the circumstances, but they've now reached the limit of what it can do. It's good to see that they're moving to an entirely new and better language which just happens to have a similar syntax. If I was a Facebook engineer, I could live with that; syntax matters, but it doesn't matter as much as semantics and pragmatics.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    25. Re:English? by mrbester · · Score: 1

      Huh. I responded in a similar way on reddit (to one of the developers, no less). Downvote frenzy ensues as I dared to compare the marvellous nothing-remotely-wrong-with-it PHP with born-of-the-faeces-of-Satan ASP...

      --
      "Wait. Something's happening. It's opening up! My God, it's full of apricots!"
    26. Re:English? by gnupun · · Score: 1

      To be fair to Facebook, no other languages had those advantages in 2002-2003. Assuming you didn't want to use F/CGI, plugins for Apache or the equivalent, your server-side scripting options were JSP, Asp.NET and PHP.

      Wow, they couldn't port a simple web app into a mature language in 10 years. You have to wonder what kind of programmers they hire.

    27. Re:English? by swilver · · Score: 1

      Java has had quick edit/reload cycles since there was hot code replacement. If you see Java developers recompiling / restarting their entire project every time they make a change, then unfortunately they just don't care enough and/or are incompetent.

      For projects that I'm assigned to, the first thing I look at is making sure the turnover time is below 10 seconds.. if it isn't, I fiddle with it until it is. And yes, that works for Facebook sized websites as well.

      They invented a square wheel to go with their already mediocre Volkswagen. Meanwhile, languages designed statically to begin with are looking at more important issues that crop up half a dozen iterations further down the road.

    28. Re:English? by Anonymous Coward · · Score: 1

      "I just ported a project from ASP.net to PHP, and my God the problems I saw in that language."

      You say you have a lot of experience with other languages but you're not displaying any evidence of it in your posts. ASP.NET isn't even a language, it's a framework. The language would likely be VB or C#, but given that you don't appear to be able to differentiate it shows you clearly don't have the pre-requisite knowledge of other such languages to be reasonable here.

      You're making the same argument all PHP developers do "I've worked with other languages (but not really) and PHP is the best!" - the reality is PHP is all you really know because it's all you've really done and you're too naive to other technologies that are just simply better to be able to see why it's bad.

      Your comments about Ruby also seem to hint at a lack of breadth of experiences with other languages, and whilst I agree Javascript is equally as shit if not more so than PHP the criticism of it aren't those you claim.

      I'd wager it's not that you don't experience the problems with PHP others complain about, or that you don't have problems hiring good developers, but that you're simply too experienced to know when you're writing bad code, and too experienced to know another bad dev when you see one.

      Either way there's a clear disparity between the claims you're implying ("I'm experienced in other languages") and the things you're saying (which show you really aren't).

    29. Re:English? by ptrobinson7 · · Score: 1

      Please advise if you have a guide as to how to make Java program turnaround time to below 10seconds. I would find it invaluable.

    30. Re:English? by Warbothong · · Score: 1

      For what it's worth, I think the world would be better off if Javascript was replaced too (I get annoyed by that much more than PHP actually, because some basic programming constructs are just hacks, and it is literally impossible to write elegant looking code).

      I agreed up until this part. IMHO Javascript is one of the better scripting languages, since it was based so closely on Scheme. Most importantly, it gets lexical scoping right (which PHP doesn't, and neither does Python for that matter). Lexically-scoped closures are equivalent to the Actor model, which is why it's good at async, and it also makes most of the boilerplate cargo-cult of other languages unnecessary (classes, globals, namespaces, etc.). Although some kind of (proper, ML-style) module system would be nice to have.

      It just needs to integrate those missing bits, like tail-call optimisation, which make it frustrating to use. I'm not attached to call/cc, so that can be left out; although delimited continuations would be a nicer alternative (and would make things like generators, co-routines, etc. unnecessary).

    31. Re:English? by Daniel+Hoffmann · · Score: 1

      Meh, Java does all this closure thing better

      Button= new Button(new ButtonListener() {
                            @Override
                            void clickEventListener() {
                                          System.out.println("You clicked the button! All in only 6 lines of code! The current value of the parent class is: " + Parentclass.this.toString());
                            }
                });

      I specially like how you need to say Parentclass.this to get the reference to the parent class, so elegant!

      Also I have never found any use for co-routines in any language/platform that provides threads. Ever. I only used it a couple times in Lua because it does not have threads (not without calling platform-specific C code).

    32. Re:English? by Daniel+Hoffmann · · Score: 1

      While I have gotten hot code replacement working in Java, it is nowhere near as good as web dev edit/save/reload cycle. You usually can not change method signatures or add new methods or classes without restarting the application. If your code is abnormal (reflection, dynamic class loading, multiple class loaders), it starts getting into the territory of "too bothersome to use". Also the debuggers get lost when debugging code that was replaced, which means that the edit/test/debug cycle gets broken. It is way better than nothing, but not nearly good enough.

      The edit/save/reload cycle does work for JSP (and JSF too I believe) files though. And interface code is the most important place to get fast modifications turnabouts.

      Also, no hot code replacement for Android dev. At all.

    33. Re:English? by Chris+Graham · · Score: 1

      Yes, of course I know ASP.net isn't technically a language. It was a combination of VB.net and C#, but I thought just maybe my post was long enough without going into the nitty gritty of exactly where the issues lied.

      You took a tiny inaccuracy in what I wrote, and decided to use it to write a whole load of speculation about me. I've actually written an interpreter (for a new language) in Haskell, I do know what I am talking about.

    34. Re:English? by Ash+Vince · · Score: 2

      Php (Personal Home Pages) is already something it was never intended to be. It's the "hey thats a nice feature, let me add a crappy implementation of it" language. If you mean "turn PHP into something never inteded to be" as turning it into something not absolutely horrible to work with then OK. Anything they do is going to be better than PHP. You would have to try really hard to make it worse.

      People always moan about how horrible PHP is, and I always assume that the people moaning are trying to learn the language without having a basis in C because they have come straight from Ruby or some other perfectly designed load of academic twaddle nobody uses.

      The reality is that PHP is like C, an amazingly flexible and well used tool. Yes, it has tons of quirks due to its slow evolution where they maintain backwards compatibility, but that is it's strength in the real world since nobody wants to rewrite their entire system just to use a new version of a language.

      There are tons of things better than PHP, but PHP is more well used than all of them because the purist developers who like to create perfect systems generally do not create much. The people who do are the armchair warriors who throw together something like Facebook then realise they have created a horrible puddle of code with a ton of technical debt that just happens to be a popular product that actually makes money. The purists have a habit of getting bogged down in producing wonderful code that takes ages, never makes any money and so get consigned to the scrap heap when the company folds.

      What they have done is layer a statically typed language on top of PHP so that they can still run their existing PHP code as they slowly convert it to a typed language. Maybe their end game is to move away from PHP, but maybe they will stay with Hack to they can carry on recruiting PHP developers who then have an easy transition. This is another reason why PHP is so popular with companies: commercially experienced PHP developers are much easier to find than commercially experienced Ruby developers, or even Python.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    35. Re:English? by Chris+Graham · · Score: 1

      The JavaScript base library is really crappy, it misses some of the basic stuff you need even for dealing with web requests.

      The prototype system is inconsistently implemented, and confusing.

      The way objects are created looks like someone was sick over the code. It at least needs some syntactic sugar.

      Late-binding leads to horrible bugs.

      Scope chains are a mess, and cause bugs.

    36. Re:English? by Anonymous Coward · · Score: 1

      Success seems to be tied to not using Java Enterprise. Has any new company ever succeeded with Java Enterprise?

    37. Re:English? by nickittynickname · · Score: 1

      Yes, your correct. PHP is the only language anyone written anything worth while in and programmers that think about what they write before they write it are worthless. Thanks for your insight. BTW, I'm sure Zuck and gang cursed PHP and its authors a million times while writing code.

    38. Re:English? by aestrivex · · Score: 1

      Can you provide me with an implementation of your hammer-to-screwdriver translator?

    39. Re:English? by Marginal+Coward · · Score: 1

      Sorry, but I'm the kind of person who just buys a screwdriver when faced with a screw. (Thus, I use Windows instead of Linux. ;-) So, I guess you'll have to ask Facebook.

    40. Re:English? by Ash+Vince · · Score: 1

      Yes, your correct. PHP is the only language anyone written anything worth while in and programmers that think about what they write before they write it are worthless. Thanks for your insight. BTW, I'm sure Zuck and gang cursed PHP and its authors a million times while writing code.

      Maybe you have reading problems, but I never said PHP was the only language anybody ever wrote anything worthwhile in. I said it was the most widely used, that does not mean nobody uses anything else.

      Every developer I know bitches about the tools we use, that doesn't mean we don't think they are useful.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    41. Re:English? by nickittynickname · · Score: 1

      Also, you must have spent no time using C. In C you know exactly what you're working with. It's a simple model where you're working closer to physical memory. PHP likes to "magic" everything. The only thing C like about it is how you call functions, and even with that, you had to add headers to get any functionality, so you still knew where things were coming from. With PHP you have a vast library of functions on the global scope.

    42. Re:English? by Anonymous Coward · · Score: 0

      > You have to wonder what kind of programmers they hire.

      Ones who ship?

    43. Re:English? by Anonymous Coward · · Score: 0

      > In C you know exactly what you're working with.

      Thanks to "sizeof(int)"

    44. Re:English? by Ash+Vince · · Score: 1

      Also, you must have spent no time using C. In C you know exactly what you're working with. It's a simple model where you're working closer to physical memory. PHP likes to "magic" everything. The only thing C like about it is how you call functions, and even with that, you had to add headers to get any functionality, so you still knew where things were coming from. With PHP you have a vast library of functions on the global scope.

      I was referring more to C++ really and the way OO stuff has been bolted on top of an existing language, but your right I haven't used it in years. I moved from C to PHP and was very comfortably straight away due to the familiarity with many of the functions.

      With regard to the magic everything most have that has gone from PHP nowadys. The only thing left is it being untyped and that is what Hack is designed to change.

      --
      I dont read /. to RTFA, I read /. to offend people in ignorance.
    45. Re:English? by Anonymous Coward · · Score: 0

      Assuming you didn't want to use F/CGI, plugins for Apache or the equivalent, your server-side scripting options were JSP, Asp.NET and PHP.

      a) What do you think mod_php is, if not a plugin for Apache?
      b) Why would you arbitrarily exclude (F)CGI? You may as well say "assuming you didn't want to use something other than PNP, your only server-side scripting option was PHP", which is true but doesn't state any advantage of PHP over the alternatives.

    46. Re:English? by Anonymous Coward · · Score: 0

      You may as well say "assuming you didn't want to use something other than PNP, your only server-side scripting option was PHP"

      s/PNP/PHP/, obviously.

    47. Re:English? by Pseudonym · · Score: 1

      If you don't know why Facebook would be reluctant to fund a compete rewrite of their core money-making software, then you've never worked in industry.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    48. Re:English? by Pseudonym · · Score: 1

      Why would you arbitrarily exclude (F)CGI?

      Would you use (F)CGI today? If the answer is "no", you have your answer.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    49. Re:English? by Pseudonym · · Score: 1

      Has any new company ever succeeded with Java Enterprise?

      If you're old enough, you might remember a company called "eBay". It's apparently still around as a cheap Chinese crap vendor.

      But seriously, plenty of new companies have succeeded with Java EE, but most new companies don't make external-facing social media websites. You probably haven't heard of the company that wrote the online banking system used by your financial institution, but chances are good that it's written in either .NET or J2EE.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    50. Re:English? by DocHoncho · · Score: 1

      Ugh, this is exactly what I've been dealing with lately. Got stuck using PHP for some project for reasons beyond my control. When I realized there was this "autoloader" thing magically loading and "linking" code without me explicitly having requested it, I understandably threw up my hands in despair. How are you supposed to know, at a glance, which parts of the project are being referenced by a particular class/file? Can you predict whatOh, right, "You need to know your framework," they say. But it's the frameworks that are full of this shit!!!

      I've settled on accepting autoload as it is, since there's really no sane way around it. Which is very typical PHP: pathological solutions to insane problems. Throwing in use statements for every class you use is about the best you can do. Even those are a bit... off, but it sure the hell beats writing Foo\Bar\baz->doStuff($x); all over the place. And the PSR-4 guidelines seems to have caused many package maintainers to come up with... interesting namespace layouts.

      Sorry about the rant. I'm pretty sure it's part of the grieving process, and Anger, Bargaining, and Depression are all co-incident.

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
    51. Re:English? by Anonymous Coward · · Score: 0

      Find tutorials of Hack here
      http://sickprogrammersarea.blogspot.in/search/label/Hack%20Tutorial

  2. Spy by Sigvatr · · Score: 2

    Obviously a backdoor for the NSA 8)

  3. static typing is awesome by Anonymous Coward · · Score: 1

    Many years ago I was a fierce opponent of static typing and loved the power of Obj-C and Python (was a NeXT/Mac head.) C++ and Java were crap (especially since Java didn't have type variables at the time.) Then I tried Haskell and my mind was duly blown. Now I'm a huge proponent of static typing, even if I still can't stand Java and avoid C++ unless necessary. IMHO Scala is the current sweet spot for statically typed general purpose programming language.

    1. Re:static typing is awesome by Anonymous Coward · · Score: 2, Interesting

      that's great.. but the reason Scala is so sweet is that it does type inference. This means all your code is purposely typed even though you don't have to type all the tries (AC doesn't have to apologize for puns). This is going to be a nightmare where your last five dynamic functions his the bug that kills you.

      It's so sad that the fact that Mark got extremely lucky means that all this excellent computer science is wasted on a cesspool like PHP.

    2. Re:static typing is awesome by goombah99 · · Score: 2

      Many years ago I was a fierce opponent of static typing and loved the power of Obj-C and Python (was a NeXT/Mac head.) C++ and Java were crap (especially since Java didn't have type variables at the time.) Then I tried Haskell and my mind was duly blown. Now I'm a huge proponent of static typing, even if I still can't stand Java and avoid C++ unless necessary. IMHO Scala is the current sweet spot for statically typed general purpose programming language.

      I wish there was just some voluntary static typing in python. By this I don't mean run time voluntary type checking. that makes it slower. No I mean a pre-run time filter that optimizes the .pyc to the extent it can.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    3. Re:static typing is awesome by Anonymous Coward · · Score: 0

      You should try http://nimrod-lang.org, the features you mentioned without the jvm overhead. I'm using it for mobile.

    4. Re:static typing is awesome by Anonymous Coward · · Score: 1

      Now I'm a huge proponent of static typing

      There is a new language called Ceylon with a very interesting type system. It uses union and intersection types pervasively to fix some of the awkwardness with existing statically typed systems. It uses unions to prevent dereferencing null references at compile time; NullPointerExceptions (or its moral equivalent in whatever language) are impossible to express in Ceylon. The concept of a "principle type" for every expression simplifies type inference and makes it efficient. The notion of "non-denotable" types and their explicit exclusion from the language specification or implementation is also interesting.

      It's not ready for prime time despite the 1.0 release version, and I'm no fanboi, but if you like static typing Ceylon is worth looking at.

    5. Re:static typing is awesome by Anonymous Coward · · Score: 4, Informative

      Let me introduce you to https://en.wikipedia.org/wiki/Cython

      You are welcome.

    6. Re:static typing is awesome by ebno-10db · · Score: 1

      the reason Scala is so sweet is that it does type inference

      Haskell also does type inference.

    7. Re:static typing is awesome by ebno-10db · · Score: 1

      Actually that sounds a lot like Haskell.

      BTW, why is it called Ceylon instead of Sri Lanka?

    8. Re:static typing is awesome by ebno-10db · · Score: 1

      Then I tried Haskell and my mind was duly blown. Now I'm a huge proponent of static typing, even if I still can't stand Java and avoid C++ unless necessary.

      While I have mixed feelings about Haskell as a whole, it's got the best damned type system I've ever seen. My advice to designers of new languages is just copy Haskell's type system.

    9. Re:static typing is awesome by Bigbutt · · Score: 1

      Misspelled Cylon.

      [John]

      --
      Shit better not happen!
    10. Re:static typing is awesome by Anonymous Coward · · Score: 0

      Haskell's NIH version of SQL is tedious. Why didn't they just implement SQL?

      Also, closures seem to me to violate the premise of static variables and fixed variable scoping. When you introduce closures into a language they are bound to cause all the same problems as global variables.

    11. Re:static typing is awesome by ChunderDownunder · · Score: 1

      Gavin was probably drinking tea at the time.

      Tea from Sri Lanka, e.g. Dilmah, still uses the colonial name on its packaging.

      Given that Java has coffee-related connotations...

    12. Re:static typing is awesome by ebno-10db · · Score: 1

      Haskell's NIH version of SQL is tedious. Why didn't they just implement SQL?

      I haven't tried SQL, but in general Haskell's libraries are one of its weaknesses.

      Also, closures seem to me to violate the premise of static variables and fixed variable scoping. When you introduce closures into a language they are bound to cause all the same problems as global variables.

      I don't agree. A closure should produce a new pure function (some languages allow otherwise, but not Haskell). With functions as first class objects, you can just pass and return them like data. There is nothing about that that suggests the evils of globals.

    13. Re:static typing is awesome by rk · · Score: 1

      "This saw sucks. I can't drive a nail with it. And what's with this useless hammer? Look at the jagged splintery bits I get when I try to cut wood with it!"

      I don't get why there's a holy war between static and dynamic typing in the first place. Different tools for different problems. I don't trust any software engineer very far when they say things like "$LANGUAGE [sucks|rules] because it's [statically|dynamically] typed."

    14. Re:static typing is awesome by davester666 · · Score: 1

      Um, Objective-C has static typing. Just stop using 'id' for everything, and use the proper type instead. You can still use 'id' if necessary, but you can gorge yourself on typing if you want.

      --
      Sleep your way to a whiter smile...date a dentist!
    15. Re:static typing is awesome by Pseudonym · · Score: 1

      Hack does type inference. It doesn't do let-polymorphism because that plus subtyping is formally undecidable. But you only have to declare the types of functions, not every variable inside those functions.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    16. Re:static typing is awesome by Anonymous Coward · · Score: 0

      Haskell's NIH version of SQL is tedious. Why didn't they just implement SQL?

      Not even wrong.

  4. WTF by Anonymous Coward · · Score: 0

    Do all that work just for static typing?

    Netcraft confirms it, facebook is dead.

  5. Only PHP by Anonymous Coward · · Score: 0, Flamebait

    Only with PHP could static typing be considered a 'hack'

    Use a real programming language, faggots!

    1. Re:Only PHP by maxrate · · Score: 1

      I for one approve of your comment. -1 is an injustice.

    2. Re:Only PHP by Anonymous Coward · · Score: 0

      Use a real programming language, faggots!

      Nice way to express an opinion cuntbag.

  6. So many bugs by ClayDowling · · Score: 5, Insightful

    So many of the bugs that have tripped me up over the years would have been solved by simply having static typing.

    1. Re:So many bugs by Anonymous Coward · · Score: 3, Insightful

      Dynamic typing frees your mind to think about the problem at hand and the best solution to that problem, rapidly changing approach and methods as you learn from experience gained. I get sick of spending half my time dicking around with static types, casts, etc and spinning my wheels chasing down type errors when I could be progressing rapidly towards a solution. Unless I'm writing kernel code for a drive by wire system or something similarly life-and-death, I'll take dynamic typing any day and be done twice as fast, moving on to the next challenge. If absolutely necessary, once a final working codebase is established, it can be rewritten to take advantage of the additional lock-down offered by static types.

    2. Re:So many bugs by CastrTroy · · Score: 2

      Yeah, with static typing, there's a whole class of errors that simply can't happen. Any time you lose from having to explicitly declare variable types, or casting variables to the correct time is easily saved by the fact that you don't have to write as many tests. Unless you aren't writing any tests, in which case, you have other problems.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    3. Re:So many bugs by MightyMartian · · Score: 5, Insightful

      It allows you to free your mind, express your inner coding monkey artist.

      And then you get to debug...

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    4. Re:So many bugs by vux984 · · Score: 0

      once a final working codebase is established

      aka... never.

      Especially if you wrote it "rapidly changing approach and methods as you went" and "moved on to the next challenge" as soon as it would occasionally run without crashing on you.

      That's sounds like a recipe for well designed code, right?

      it can be rewritten to take advantage of the additional lock-down offered by static types.

      Not by you though. You'll leave unraveling the spaghetti you left behind for someone else.

      Don't feel bad for 'them' though. It won't happen, they'll just ship your mostly working prototype and call it a day.

      And if its not running well enough to ship, then yeah, they'll toss it and rewrite it but you'll be a distant memory by them.

    5. Re:So many bugs by MightyMartian · · Score: 0

      I think this guy must have wrote the documentation system I was hired to debug about five years ago. Written in PHP in a very free-flowing (aka. spaghetti-like catastrophe), the guy charged the company about $20,000 bucks, and it cost them another $10,000 for me to basically scrap it and rewrite from the ground up.

      There are far too many "programmers" like the parent poster, and PHP is the hurtful creature that allows them to persist.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    6. Re:So many bugs by MoonlessNights · · Score: 1

      I wish it were easier to explain that to less experienced developers (I remember being young and shared the common delusion that types were bad).

      These days, it is intensely frustrating to work on a team with inexperienced developers who want to use all the "trendy" languages and frameworks only to get bogged down in constant re-writes or debugging once they realize that nobody can actually tell which parts of the project, if any, are "correct" (or even executed, in some cases).

      When you point out that many of these problems are trivially decidable at compile time, they just dismiss you as being out of touch since "we don't compile anything before executing it, gramps."

      Instead of listening to your argument, they just dismiss you for being old (you know, early 30s) and not understanding the "new" technology.

    7. Re:So many bugs by Anonymous Coward · · Score: 0

      I used to believe that too. Not anymore. Instead I use short functions, descriptive variable names and well defined API documents.

      Please provide examples of these error classes.

    8. Re:So many bugs by kaiser423 · · Score: 1

      I've written hundreds of thousands of lines of statically typed code and I'd say that at no point in my career, from programming noob in college to anywhere else did I ever spend more than 1-2% of my effort "dicking around with static types, casts, etc and spinning my wheels chasing down type errors when I could be progressing rapidly towards a solution", much less anywhere near half my time. That includes projects where I've done 1k+ SLOC in a morning to get proof of concepts out. I just don't see how static typing really slows anyone down unless your approach is to run a function, see what you get out and then hope that you can do something else with the returned object which is just ugly and slow in its own right. I guess that I just think differently than some; maintaining in my brain's working set what the objects I actually have in front of me are, and what they do and support is not that much overhead and doesn't detract from anything else.

      Also, when I work with dynamically typed languages I tend to spend similar amounts of times if not more figuring out what really is and is not supported with this dynamic object in front me. I personally just don't see the speed up.

    9. Re:So many bugs by ebno-10db · · Score: 1

      I get sick of spending half my time dicking around with static types, casts, etc and spinning my wheels chasing down type errors

      If you spend half, or any appreciable part of your programming time dealing with static typing issues, then you're doing something seriously wrong. Occasionally the compiler will be a pain in the ass about it, but most of the time static typing should require nary a thought. If it's otherwise, you're not thinking about types clearly. The static typing is there to catch you when you screw up. It also serves as useful documentation for the next poor schmuck that has to look at your code, and for good measure the compiler enforces the accuracy of this type of "documentation". If you're really too lazy to type "int" or "double", try a language with type inference.

    10. Re:So many bugs by Anonymous Coward · · Score: 0

      You don't do any web programming, do you? It's all strings that need conversion to whatever and then back to strings.

    11. Re:So many bugs by beelsebob · · Score: 1

      Dynamic typing frees your mind to think about the problem at hand and the best solution to that problem

      Quite the contrary. It frees your mind to think about the problem incorrectly, then requires your mind to churn through many incorrect ideas before finally settling on the correct one. Meanwhile, static typing deals with a large chunk of correctness for you, and gets you to the correct solution faster by pointing out the errors before you hit them at runtime.

      I get sick of spending half my time dicking around with static types, casts, etc

      If you're casting, you're not thinking about the types correctly yet. Learn to code a bit better.

      I'll take dynamic typing any day and be done twice as fast,

      No, you won't. Because every time the static type checker points out an error, it's showing you something that's wrong, that is *going* to crash your program. It's just doing it faster than you would find out otherwise. Otherwise, you'd have to run your program, and discover that type error at runtime.

    12. Re:So many bugs by Anonymous Coward · · Score: 1

      Declare a variable, misspell it on use. A dynamic typed language such as Javascript will happily create a brand new variables (potentially obliterating an existing variable) in the global scope, and go on its merry way thus creating undefined behavior.

      Have A Nice Day.

    13. Re:So many bugs by MightyMartian · · Score: 2

      Usually the compiler will scream "Hey fuckwad, your integer array ain't a string! Error on line 205", and then you dutifully go correct the error. Much better than a dynamic language that happily takes your screwup seriously and you have to follow a debugger chain through half a dozen nested functions to find where you buggered up.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    14. Re:So many bugs by MightyMartian · · Score: 1

      A goodly portion of the young developers don't really know what the word "compile" means.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    15. Re:So many bugs by beelsebob · · Score: 2

      Here's an example:
      The null pointer dereference.

      With a properly set up type system, you express one type as the non-null pointer. You then express a second type - the maybe type, which describes something that is maybe something else. Now you use the Maybe Pointer as the result of allocation. Now in order to use the pointer, you need to get it out of the Maybe or the type system will complain, which enforces that you actually check for null before dereferenecing. It proves that your program will never dereference null.

      Obviously this is only one example, but yes, type systems really can eliminate entire classes of programming error. This is just one (particularly common) one that they can get rid of.

    16. Re:So many bugs by MoonlessNights · · Score: 1

      Obvious example:
      -your data model has a function to get "n" entries from the data store
      -someone passes in "five" (or "purple", array(5), whatever)
      -an empty array is returned since the thing you passed in could not be evaluated as a numerical value (or you get a runtime exception of some sort, if you are lucky)

      The problem here is that the caller is incorrect and the compiler would have told them that, had you specified that you required an int type.

      So, instead of a 1-minute fix for a compilation error, it is potentially hours of hunting down why the program is providing incorrect results (since the actual problem is probably reported by a user due to a confusing result much further down the line).

    17. Re:So many bugs by Anonymous Coward · · Score: 0

      Dynamic typing frees your mind to think about the problem at hand and the best solution to that problem

      So true. However, there's one caveat that I've found..."the problem at hand" becomes a lack of a type system and "the best solution to that problem" becomes a Haskell-like type system.

    18. Re:So many bugs by Anonymous Coward · · Score: 0

      I think it's more that if you're not a moron and you aren't collaborating with anyone dynamic typing vs static typing won't matter.

      You can only really learn to appreciate static typing when you've dealt with the hell that is other people trying to use your code.

      Basicly, when you write a function that needs and integer for input, and a comment saying "// takes an integer" you're all set... until some jackass contractor working for a client of yours tries to pass a string representation of pi and now the client expects you to assist their contractor with integrating their system with yours making it your problem.

    19. Re:So many bugs by ebno-10db · · Score: 2

      when I work with dynamically typed languages I tend to spend similar amounts of times if not more figuring out what really is and is not supported with this dynamic object in front me

      Much worse than writing dynamically typed code is reading it. If I write function foo in a dynamically typed language, I know it's supposed to return an integer. If I'm reading somebody else's code, I often winding up guessing that an integer makes sense. Of course it may return a float or a string on odd Tuesdays when the moon is full. Much nicer for it to explicitly say it returns an integer, and have the compiler check that that's the truth.

    20. Re:So many bugs by ebno-10db · · Score: 1

      So do you rely on implicit or automagical type conversions? That doesn't do much for error checking. No, I don't do web programming, but I've worked on code that had to do a lot of string to whatever conversions. The biggest pain, but one of the most important things, is detecting errors in the string format. You need an explicit function to do that right, and a way to handle the errors. Once you have the explicit function, what's so hard about declaring that it returns an object of class ObiWan?

    21. Re:So many bugs by ebno-10db · · Score: 1

      Otherwise, you'd have to run your program, and discover that type error at runtime.

      Don't be absurd. Type problems don't show up during testing - they show up 3 weeks after the code has been released, and then only in situations that are practically impossible to reproduce. That makes debugging more interesting. Any idiot can find type problems when the compiler does it for you.

    22. Re:So many bugs by ebno-10db · · Score: 1

      Instead of listening to your argument, they just dismiss you for being old (you know, early 30s) and not understanding the "new" technology.

      You could point out that dynamic typing was introduced one year after static typing. Dynamic typing is state-of-the-art, circa 1958.

    23. Re:So many bugs by Anonymous Coward · · Score: 0

      Fans of dynamic typing are typically retarded. It's best to ignore them and let them pretend that they're actually programmers.

    24. Re:So many bugs by Anonymous Coward · · Score: 0

      99% of debugging is about logic errors not type errors.
      If you want a type save language use Ada, Java and C++ are a joke in comparison. But remember it will only save 1% in debugging time, while implementation time is increased by 50%

    25. Re:So many bugs by Anonymous Coward · · Score: 0

      Static types allows my mind to have logical constraints, and a perfect image of how memory is stored at runtime, so I can find the best solution to the problem.

    26. Re:So many bugs by Anonymous Coward · · Score: 0

      A goodly portion of the young developers don't really know what the word "compile" means.

      It's actually not even about compiling. You don't have to "compile" to perform a static type-check. Both concepts just coincide very frequently.

    27. Re:So many bugs by mlk · · Score: 1

      Any good modern platform will do automatic conversion for you.

      --
      Wow, I should not post when knackered.
    28. Re:So many bugs by Daniel+Hoffmann · · Score: 1

      I have to maintain around half a million lines of Javascript code and while I agree with you that static typing would help a lot, it is not THAT bad if you have a proper architecture. Dynamic typing makes too easy to just hack stuff on top of the architecture, if you don't have the discipline your project is sure to be doomed.

    29. Re:So many bugs by DocHoncho · · Score: 1

      You're describing a weakly typed language, like PHP. Something like Python or Ruby would give similar errors as you described. And even Java, which is super finicky about types will have runtime errors that require you to do the same debugger-boogie as any other language.

      Don't get me wrong, static typing can be a huge boon. But it can also be a huge pain, and in many situations hardly worth the hassle. The part I find most compelling about static typed languages is that you can understand a lot more from function signatures and the like. Seeing int foo(int bar) you know that, whatever the hell foo does, it's taking an int and giving one back. The compiler taking care of the sticky details involved in making sure that is always the case is a bonus.

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
    30. Re:So many bugs by DocHoncho · · Score: 1

      The fix for problems like this is not to ditch dynamic typing systems, but to use languages with strong types. You'll still have to wait until runtime, but once the code tries to use "five" as a number is going to crash and burn. Languages like Javascript or PHP that will happily do the wrong thing are pathological, there's no reason to allow such things. Unless your language is stupid simple and treats everything as a string or something, things have implicit types so use them!!

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
  7. hate the name by mr_mischief · · Score: 5, Insightful

    "Hack" as a language name? Really?

    People are going to explain this at dinner parties. People who kind of understand that programming is more than being good at operating a computer as an end user but don't really know the difference between sysadmin, devops, programmer, business analyst, and DBA let alone what those roles really do are going to ask questions. Those questions will be things like "what kind of programming?", "what technologies do you use?", and "what are you working on right now?" The answer will be something about putting together a quick Hack program to change values in a database, and then it gets awkward.

    Plus, did they consider at all how easily this will get confused with Haxe?

    1. Re:hate the name by swb · · Score: 5, Funny

      "The answer will be something about putting together a quick Hack program to change values in a database"

      I take it you don't get invited back to dinner very often.

    2. Re:hate the name by Xunker · · Score: 2

      "I'm a hack hacker who hacks Hack."

      --
      Hilary Rosen's speech was about her love of money and her desire to roll around naked in a pile of money.
    3. Re:hate the name by pushing-robot · · Score: 5, Funny

      Hey, three focus groups chose this over "Kludge".

      --
      How can I believe you when you tell me what I don't want to hear?
    4. Re:hate the name by c0d3g33k · · Score: 1

      It shows they have a sense of humor, given the effort it must have taken to make a 'better PHP'.

    5. Re:hate the name by FuzzNugget · · Score: 1

      I agree, I'm just replying to undo the incorrect moderation I just did. Fucking phone UIs.

    6. Re:hate the name by WillgasM · · Score: 4, Insightful

      It's actually very clever marketing. Now everybody that searches "facebook hack" will get this as the first result. They get lots of hits for their new language and obfuscate any articles teaching people how to exploit FB accounts. Win-win.

    7. Re:hate the name by Anonymous Coward · · Score: 0

      Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.

    8. Re:hate the name by Anonymous Coward · · Score: 0

      "I'm a hack hacker who hacks Hack."

      I think you've got something in your throat.

      *hands over a lozenge*

    9. Re:hate the name by Anonymous Coward · · Score: 0

      Talk about something other than your work with PHP at dinner parties.

    10. Re:hate the name by globaljustin · · Score: 2

      this is my maxim: Geeks should not be allowed to name the things they create.

      "Hack" as a name for a programming language is egregious. It's like naming your newborn baby "Wipe"

      I wish my maxim weren't true, but it is.

      --
      Thank you Dave Raggett
    11. Re:hate the name by bitfarmer · · Score: 2

      > "Hack" as a language name? Really?

      Because "Brainfuck" was already taken.

      --
      Eagles may soar, but weasels don't get sucked into jet engines.
    12. Re:hate the name by Anonymous Coward · · Score: 0

      Haven't you heard? He's a chef.

    13. Re:hate the name by pseudorand · · Score: 1

      Okay, stupid name aside, this is awesome. I've never had a single good thing to say about Facebook or Mr. Zuckerberg, but this could totally change that. Lots of devs disparage PHP, but they're all idiots -- PHP is heavily used because it's heavily useful. I haven't used HACK yet, but if it's not a buggy piece of junk might truly be great. I've yet to find a language that lets me go dynamic when I'm prototyping but gradually type when I see fit. So...Sweet!

      That said, static typing isn't all it's cracked up to be. Java being the prime example, it makes for some very wordy code that's often tedious to change. And of all the bugs I fix in dynamically typed languages, very few are caused by treating something as the wrong type.

    14. Re:hate the name by geekmux · · Score: 1

      It's actually very clever marketing. Now everybody that searches "facebook hack" will get this as the first result. They get lots of hits for their new language and obfuscate any articles teaching people how to exploit FB accounts. Win-win.

      Uh, people exploiting Facebook?

      Ironically, you have that completely backwards.

      Don't feel bad for making that common mistake. The billion other users did too.

    15. Re:hate the name by Anonymous Coward · · Score: 0

      Oh its a language!, When I saw Facebook mentioned I read it as Statically "HYPED".

    16. Re:hate the name by styrotech · · Score: 1

      I'm just waiting for its new socket library to be called NetHack.

    17. Re:hate the name by mr_mischief · · Score: 1

      Why? I'm not the dolt who asks for details about people's jobs when they're trying to relax and enjoy the company of others. I'm the guy bemoaning being asked those questions by said dolts. ;-)

    18. Re:hate the name by Anonymous Coward · · Score: 0

      > Plus, did they consider at all how easily this will get confused with Haxe?

      Nah. Just explain it to the 5 people who use Haxe, and you're done. :)

    19. Re:hate the name by Anonymous Coward · · Score: 0

      “AAAAIIIIIEEEEEEEEEAAAAAAAAUUUUUGGGGGHHHHHHHHHHHHHHH!!!
              HACK! HACK! HACK! *CHOKE!* "

      MR. SPOCK: "FASCINATING!"

    20. Re:hate the name by davewoods · · Score: 1

      It will never get past v1.6

  8. Sarcastically Typed by wisnoskij · · Score: 5, Funny

    We really need a sarcastically typed language. That would be truly awesome.

    --
    Troll is not a replacement for I disagree.
    1. Re:Sarcastically Typed by Pope · · Score: 1

      def c$ as string(as.IF!)

      --
      It doesn't mean much now, it's built for the future.
    2. Re:Sarcastically Typed by Sarten-X · · Score: 2, Interesting

      I'm pretty sure that's Perl. You can define something first as a scalar, then refer to it as an array, because HA HA I WAS JUST KIDDING!

      You can also take a single variable and make it behave entirely differently depending on context. As a scalar, it works fine, but if you try to refer to it as an array, rm -rf /.

      Not saying you'd want to do those things, but you can.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    3. Re:Sarcastically Typed by PhrostyMcByte · · Score: 1

      Allow me to introduce you to C+= and ArnoldC.

    4. Re:Sarcastically Typed by Anonymous Coward · · Score: 0

      Wait, if you try to refer to it as an array, it deletes Slashdot? Impressive.

    5. Re:Sarcastically Typed by Reapy · · Score: 1

      Perl can be extremely frightening sometimes. Still useful though!

    6. Re:Sarcastically Typed by ysth · · Score: 2
  9. Design by contract? by afidel · · Score: 5, Insightful

    This sounds a bit like layering design by contract on top of a typically dynamically typed language rather than being a strictly statically typed language. It's an interesting approach and would seem to achieve their goals of faster but more robust development.

    --
    There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    1. Re:Design by contract? by Anonymous Coward · · Score: 0

      The marketspeak! It burns! Stone the markedroid!

    2. Re:Design by contract? by afidel · · Score: 1

      Huh? I learned design by contract back in college, at RIT we used Eiffel which is language designed around the concept, no marketing here.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
  10. So ... they re-invented Asp.Net? by Anonymous Coward · · Score: 0

    How is this different/better than Asp.Net?

    1. Re:So ... they re-invented Asp.Net? by CodeReign · · Score: 1

      ASP.NET requires a heavy application server.

      As a Java EE developer I'd advocate the benefits of proper application servers/infrastructure but ASP/Java are slow to release languages. You need infrastructure and planning while PHP is a great language for systems that don't have huge reliance requirements and need the project done yesterday. (and even then obviously Facebook has managed to make it very reliable).

      Additionally ASP.NET (with C# as you didn't specify) is statically typed. Even the "var" type is resolved at compile time to the base class of whatever it's first instantiation returns.

    2. Re:So ... they re-invented Asp.Net? by JDG1980 · · Score: 1

      How is this different/better than Asp.Net?

      ASP.NET requires a Windows server. PHP (and presumably Hack) can be run on any cheap hosted Linux server with cpanel.

      That said, ASP.NET/C# is a far better and more coherent development platform than PHP. But PHP's near-zero barrier to entry will keep it on top for the forseeable future.

    3. Re:So ... they re-invented Asp.Net? by Richard_at_work · · Score: 1

      Ive been running ASP.Net MVC stuff on a RaspPi under mono and Nginx now for several months with no issues...

    4. Re:So ... they re-invented Asp.Net? by Xest · · Score: 1

      "As a Java EE developer I'd advocate the benefits of proper application servers/infrastructure but ASP/Java are slow to release languages"

      I don't know if much of that is true anymore, there are plenty of cheap and easy web hosts for deploying ASP.NET applications nowadays. Not sure if the same is true for Java, I've not looked in a while, last time I needed an off-site Java host I just set up my application servers myself.

      "You need infrastructure and planning while PHP is a great language for systems that don't have huge reliance requirements and need the project done yesterday."

      Right, but there's a cost to that which too many people ignore - your application is inherently more bug prone, inherently less performant, and almost certainly less secure. Sometimes things just shouldn't be done yesterday, the reason they are is the reason we have so much insecure software on the web, so many personal details floating where they shouldn't and so much identity fraud as a result.

      "(and even then obviously Facebook has managed to make it very reliable)"

      I'm not convinced by this argument - it strikes me as popular myth as relatively Facebook just isn't that stable. Facebook's method of making Facebook work seems to be creating an insane amount of redundant servers so that if one falls over there's something else to take it's place. Despite this I've had a number of occasions where bits of Facebook have just stopped working, or some general downtime. It's still not overly common, but it is overly common compared to sites like Amazon, eBay, Microsoft, or Google who use technologies like Java and C++. So it's not that Facebook have made PHP reliable - they're just blowing an awful lot of money inefficiently to give an appearance of reliability whilst still having more glitches and downtime than others. Last time Facebook did an article on their server farm and their users I calculated based on their very own numbers that they had 8gb of RAM for every single user - is that not rather fucking insane? The cost of inefficiency to them must be massive, and they can afford it of course, but really, they're throwing so much profit away by sticking with it and fighting it into working most the time.

      "Additionally ASP.NET (with C# as you didn't specify) is statically typed. Even the "var" type is resolved at compile time to the base class of whatever it's first instantiation returns."

      This isn't entirely true, when .NET 4 was released in about 2010 Microsoft introduced the DLR which allows sections of code to be dynamically typed amongst other things. It's used quite heavily in for example ASP.NET MVC where your backend code is normally all statically typed because you want your data models et. al. to be solid, easier and quicker to debug and test, but your front end pages are dynamically typed because front end stuff tends to require quicker iterations. It gives you all the advantages of rapid page development dynamic languages allow, with none of the disadvantages of having an inherently more bug prone, lesser performant and inherently more time consuming to debug back end.

    5. Re:So ... they re-invented Asp.Net? by BitZtream · · Score: 1

      I would kill for a popular BSD licensed ASP.NET framework and CLR/CIL engine that I could count on, I'll accept using Mono in its place (god, does the mono XSP and related stuff not seem unreliable as hell to you?).

      Do you feel that in your limited experience (based on this post alone) running ASP.NET on mono that its reasonable production ready?

      I've been playing with it a FreeBSD server, but ngnix + fastcgi is the ONLY way I've actually gotten something other than XSP to serve pages, everything else crashes in some new and exciting way.

      I'm looking at starting a new toy project soon, and ASP.NET would be my preferred framework, but I'm not doing it on Windows servers and Mono just makes me uncomfortable right now.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    6. Re:So ... they re-invented Asp.Net? by Richard_at_work · · Score: 1

      I find it to be very production ready - I'm doing it on RaspPi for a particular reason, but more recently I've switched to NancyFX self hosted on Mono, which is really reliable, fast and development is frictionless.

  11. Nope by Sarten-X · · Score: 4, Insightful

    In fact, most PHP files are already valid Hack files.

    No, no, no, and no.

    The single biggest problem with PHP is the tendency for old code and old programmers to keep their bad habits around when moving to new projects. PHP lacked vital modern features (like static typing and namespaces) for so long, and it's evolved so many workarounds (like magic quotes), that programmers have learned the wrong way to accomplish basic tasks. Now they have a new language, supporting the right way to do these things... but the old and broken ways still work. Sure, there will be a few programmers that will use the new way and be thrilled about the good technique, but then time crunches will set in, and code reviews will be rushed (or nonexistent), and those old ways will creep in, bringing the bugs with them.

    Backwards-compatibility with a broken language is a great way to improve a new language's adoption, and a terrible way to build a new language's reputation.

    --
    You do not have a moral or legal right to do absolutely anything you want.
    1. Re:Nope by Anonymous Coward · · Score: 1

      Seriously? Magic quotes aren't even in the language anymore. They were removed completely as of PHP 5.4.0. If you're going to troll, please at least do so with the relevant facts instead of outdated FUD.

    2. Re:Nope by Anonymous Coward · · Score: 0

      In what world is static typing a "modern feature"? Lol...

    3. Re:Nope by narcc · · Score: 1

      PHP lacked vital modern features (like static typing

      Modern features like static typing.

      Modern features like static typing...

      Seriously?

    4. Re:Nope by Sarten-X · · Score: 1

      Fine. s/magic quotes/mysql_real_escape_string()/g... or if you prefer, preg_replace('/magic quotes/g', 'mysql_real_escape_string()', $post);

      That's deprecated too, but I'd bet there's still folks out there clinging desperately to it and using it daily in production code.

      Also, you should consider that I don't keep track of PHP's changes, because they'd have to change most of the language for it to be salvageable. I'm not trolling with outdated FUD; I'm arguing with one almost-outdated fact. It's almost outdated because PHP 5.3.8 is still distributed.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    5. Re:Nope by Sarten-X · · Score: 1

      Your grasp of sarcasm is incredible.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    6. Re:Nope by Sarten-X · · Score: 1

      The world of PHP.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    7. Re:Nope by shutdown+-p+now · · Score: 1

      The whole point of this project is back-compat with PHP. If you don't need that, then there are already half a dozen better languages which have all those other new features...

    8. Re:Nope by alokmenghrajani · · Score: 1

      We knew about the tradeoff between backwards compatibility vs adoption since day 1. The end result is not as bad as you make it sound: Each file in your codebase can be in one of many modes: php code, hack will ignore it Requires you to write your code in a subset we consider sane. You can start writing type annotations and they will be checked when present. Requires you to annotate your function parameters, return types & class properties. There are a few other modes, like decl, which lets the type checker "import" types.

    9. Re:Nope by Anonymous Coward · · Score: 0

      PHP 5.4 was released on 2012-03-01, it is not old

    10. Re:Nope by Anonymous Coward · · Score: 0

      They were removed completely as of PHP 5.4.0.

      Sounds great, except the 5.3 branch is still officially available and supported.

    11. Re:Nope by KermodeBear · · Score: 1

      The single biggest problem with PHP is the tendency for old code and old programmers to keep their bad habits [...] code reviews will be rushed (or nonexistent)

      I would be very surprised to learn that code review quality is language dependent. I always thought it depended on one's organization and the people working on the project. I also thought that a bad programmer would be bad no matter the language, too.

      Here I was, writing well-formed PHP for over a decade (I had a background in C, C++, and Java before I started with PHP), using well known software patterns, dependency injection, and other best practices, but then I read this comment. Your well thought-out and decisive commentary has certainly changed my mind.

      I haven't been writing good code at all! Obviously this is the fault of the language. I've never provided a good code review either, again, because of the language. That magic quotes thing? The thing that has been discouraged for the past decade, could always disabled, has been disabled by default many years, and has been removed completely? Yup, still a problem. It's the languages fault though, PHP made me use it, even though I could turn it off!

      On a serious note, PHP does have its problems, but code review quality? Come on. Complaining about an ancient, deprecated, removed feature that nobody used (it wasn't a workaround, either - it was supposed to be a convenience feature)? Saying that the language itself creates bad developers? You're really reaching.

      Poor education, bad mentoring, laziness, and plain stupidity make bad developers. Bad developers make bad code reviews. Bad developers rely on crap like magic quotes. Your problem isn't with the language. It's with the people who churn out crap. Let me tell you a secret: Bad developers will be bad no matter what language they're using.

      --
      Love sees no species.
    12. Re:Nope by Anonymous Coward · · Score: 0

      That's deprecated too, but I'd bet there's still folks out there clinging desperately to it and using it daily in production code.

      Is that the fault of the language or the people using it?

    13. Re:Nope by Anonymous Coward · · Score: 0

      Not having backwards compatibility when you already have an an established install base as THE de-facto platform is a sure way to make your new project fail spectacularly.

      Why would I switch to hack when it's just as much work to switch to something else? Sure, you can talk about standards and good practices but we all know that 99% of production code is ugly just-in-time kludges. It's the nature of the industry.

      Embrace it, or be forgotten.

  12. Dynamic typing proponents are not awesome by Anonymous Coward · · Score: 1

    Many proponents of dynamically typed language say "Statically typed languages suck.", while they are only qualified to make the statement "The statically typed languages I know suck.".

    People tend to compare modern languages they know that have features such as first-class functions and comprehensive standard libraries with the dinosaur languages they know such as Java, C and C++. For some unknown reasons the former tend to be dynamically typed and the latter are statically typed. Then they spread their bullshit opinions all over the internet.

    1. Re:Dynamic typing proponents are not awesome by Anonymous Coward · · Score: 0

      C and C++ is DEAD

    2. Re:Dynamic typing proponents are not awesome by Anonymous Coward · · Score: 0

      Sure, that's why most of the world's computing infrastructure sits on top of C and C++. Dead my ass. BTW, since they are two different things, I assume you mean "are" dead.

    3. Re:Dynamic typing proponents are not awesome by DocHoncho · · Score: 1

      While statically typed languages can be a pain, there are tangible benefits for using one. As far as dynamic typed languages, well, I'll settle for it being strongly typed. Weakly typed languages are awful.

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
  13. Dynamic typing is a hack by ArcadeMan · · Score: 1, Informative

    Ever tried to access 8-bit byte arrays and write them to a binary file in PHP? It's hell and it takes a lot of work to go around all the stupid dynamic typing.

    1. Re:Dynamic typing is a hack by narcc · · Score: 2

      Ever tried to access 8-bit byte arrays and write them to a binary file in PHP?

      Yes, I have.

      It's hell and it takes a lot of work to go around all the stupid dynamic typing.

      No, it's not. It was simple and painless.

      Had you taken a few minutes to read the documentation, you wouldn't have suffered through "hell".

      Maybe programming isn't for you? Have you considered a career more suited to your talents?

    2. Re:Dynamic typing is a hack by ArcadeMan · · Score: 1

      Instead of writing a flamebait reply, how about telling me how simple and painless you'd do that? Because all the examples and explanations I've found were nothing but "simple", they're all work-arounds for something that should be straight and simple.

    3. Re:Dynamic typing is a hack by narcc · · Score: 1

      Because all the examples and explanations I've found were nothing but "simple"

      You're either not very good at searching, terrible at programming, or both.

      A quick look at the documentation and you'll find handy functions like fseek, fread, fwrite, pack, and unpack. It's easier than doing the same in Java, C#, or even C.

      You won't run across any problems caused by dynamic typing. What strange and unusual approach did you take?

    4. Re:Dynamic typing is a hack by Minwee · · Score: 1

      You won't run across any problems caused by dynamic typing. What strange and unusual approach did you take?

      Posting on Slashdot about it, apparently.

    5. Re:Dynamic typing is a hack by ArcadeMan · · Score: 1

      Why do we need to "pack" and "unpack" the data? In any sane programming language, you can access the bytes directly as an indexed array.

      If you find complex work-arounds "simple", then good for you.

    6. Re:Dynamic typing is a hack by istartedi · · Score: 1

      In any sane programming language, you can access the bytes directly as an indexed array.

      You can do that in C; but you shouldn't. There are too many things you don't know:

      1. Debug or release? That could change the structure layout.

      2. Structure padding.

      3. Byte-order.

      IIRC, they call such a cast "type punning". They got away with it in network stacks on BSD; but that was a long time ago, *and* they no doubt had knowledge of all the compiler switches and CPU architecture.

      For a language like PHP to have functions that "pack" and "unpack" data is perfectly reasonable. In fact, you should be writing your C functions like that, not just type punning and letting it fly out to files in all its unknown byte-ordered glory.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    7. Re:Dynamic typing is a hack by wiredlogic · · Score: 1

      Why do we need to "pack" and "unpack" the data? In any sane programming language, you can access the bytes directly as an indexed array.

      Because it's a simple way to control the endianness and low level layout of binary data. Few "sane" programming languages provide that level of control with direct memory accesses, Ada being one exception and even that requires some extra incantations to make work.

      --
      I am becoming gerund, destroyer of verbs.
    8. Re:Dynamic typing is a hack by narcc · · Score: 1

      Wait. A single function call is a "complex work-around" in your world?

      Besides, you only need pack and unpack to get an array (as specified in your silly post). You don't actually need them to read binary data from a file, modify it, and write it back to a file.

      In any sane programming language, you can access the bytes directly as an indexed array.

      Fun fact: You can do that in PHP as well! Use the [] operator on the string you read in to access and modify individual bytes.

      What's so damn hard about reading the documentation anyway? I'd think you'd have at the very least made sure that you had your facts straight before making this post!

      So... Do you still think your complaint is valid?

    9. Re:Dynamic typing is a hack by Anonymous Coward · · Score: 0

      Why do we need to "pack" and "unpack" the data? In any sane programming language, you can access the bytes directly as an indexed array.

      If you find complex work-arounds "simple", then good for you.

      Because PHP arrays are not the same as C arrays. They're a Dictionary, with arbitrary key/value pairs and no static typing to ensure consistent size of either.

      It takes some pretty powerful ignorance to think you can use pointer arithmetic on PHP array indices.

    10. Re:Dynamic typing is a hack by Anonymous Coward · · Score: 0

      Cocksucker shill is shill.

    11. Re:Dynamic typing is a hack by Anonymous Coward · · Score: 0

      I suspect this is more a problem with PHP than with dynamic typing. Python has a bytearray type that works fine for that sort of thing.

      Dynamic typing doesn't mean your type system or builtin types have to be terrible.

  14. hack for THE hack by Anonymous Coward · · Score: 0

    Trying to fix PHP is impossible just GIVE UP already!

  15. Brillant! by Megane · · Score: 0

    So of all the languages they could have forked, they decided to fork PHP? Okey-dokey.

    --
    #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    1. Re:Brillant! by Anonymous Coward · · Score: 0

      Yeah, the language they've built a $7 billion company on that serves 17% of the species; PHP.

      Not the first time they've done stuff like this either. For a while they were compiling PHP to C++ to reduce server load.

    2. Re:Brillant! by MightyMartian · · Score: 1

      This is like justifying strapping a jet engine and wings to a Volkswagen beetle insisting that because it got you to the airport, well by God, it can get you airborne as well!

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    3. Re:Brillant! by Anonymous Coward · · Score: 0

      It's more like strapping a jet engine and wings to a Beetle, flying across the Atlantic and then insisting that it will get you home from the airport.

  16. Sounds like a good band-aid for PHP codebases by PhrostyMcByte · · Score: 3, Insightful

    Every few months someone announces a new fad language despite them rarely bringing anything new to the table, or the new things they do bring not being significant enough to warrant switching from some other well-established one.

    I'm actually happy with this one, because it serves an easier to justify purpose: migrating your existing PHP codebase and developers to something that is immediately better and familiar.

  17. Think about why they really did it by Anonymous Coward · · Score: 0

    SEO purposes - to make anyone interested in computer security not find any of those 0days or exploit codes when things like "how to hack" or "become a hacker" are typed in google. Instead, some useless ass fork of PHP which offers static typing (WOW what a feature!) will show up in your search results and the security real hacker information will be at the very bottom of the barrel.

    Well played NSA, and facebook, well played.

  18. Ugly by Njovich · · Score: 1

    I guess it wouldn't hurt to have static typing in PHP, but for the love of god, why not just pick a more standard syntax?

    Some of their examples:

    ?hh
    function f1(): ?resource { ...
    }

    public function bar(): (string, string) {

    Might look good in some languages, but in PHP I would really expect that type before the function name.

  19. Of all the things to fix... by Arancaytar · · Score: 1

    I'd have thought the horrible global function namespace would have been a top priority.

    Seriously, what is this, C?

  20. What about the performance on this beast? by Anonymous Coward · · Score: 0

    Is it different/same/odd compared to default PHP 5.5 or what? Surely benchmarks must matter a little bit for the big ol' faceborg..

  21. Really... by Ignacio · · Score: 0

    With all the problems in PHP, ***this*** is the change they decide to make? Did they have nothing better to do?

    1. Re:Really... by narcc · · Score: 2

      So ... What would you have changed? What would your top-priority have been?

    2. Re:Really... by Anonymous Coward · · Score: 0

      Re-developing their entire code base in a proper language in parallel would've made far more sense than trying to fix the unfixable.

      Seriously, it was years ago now that Facebook realised that PHP was utterly deficient for their needs, they started by trying to translate it into C and compiling native, then they wrote a Java/.NET esque VM for it, now they're trying to hack in static typing?

      The obvious solution years ago was to just rewrite the damn thing in Java, not try and turn PHP into Java which is exactly what they're doing, but badly.

      I wouldn't even try and fix PHP, it's too broken at a fundamental level to be even worth it due to being developed by amateurs with no worthwhile understanding of the fundamentals of computer science and language design. There are so many non-broken alternatives to just use instead that it's a waste of time.

    3. Re:Really... by Anonymous Coward · · Score: 0

      Have you met a PHP developer? No way on earth they would every agree that they picked the wrong language. The only people I've ever met more in love with their chosen language is C#-ers.

    4. Re:Really... by narcc · · Score: 1

      So ... What's wrong with it?

      How did you come to the conclusion that it is "it's too broken at a fundamental level".

    5. Re:Really... by Anonymous Coward · · Score: 0

      So ... What's wrong with it?

      Everything.

      How did you come to the conclusion that it is "it's too broken at a fundamental level".

      By being forced to use it.

    6. Re:Really... by Anonymous Coward · · Score: 0

      Well. Can't argue with that logic. :-P

  22. kinda like typescript to javascript by poached · · Score: 1

    Hack is to PHP as Typescript is to Javascript?

    http://www.typescriptlang.org/

    1. Re:kinda like typescript to javascript by narcc · · Score: 1

      Silly and irrelevant?

  23. Wait, PHP had no lexical scoped closures? by Daniel+Hoffmann · · Score: 1

    Really? WHAT YEAR IS THIS?

  24. So it's C# with extra dollar signs? by Anonymous Coward · · Score: 0

    Check this out: http://docs.hhvm.com/manual/en/hack.async.php

    So basically it's some sort of cross between PHP and C# 5.0, especially since they're literally taking keywords straight from it now...

  25. nimrod by Anonymous Coward · · Score: 0

    >indentation is done with spaces only
    Nope, killed my interest.

  26. Static languages coming back by slapout · · Score: 1

    Microsoft added static typing to Javascript (with Typescript). Now Facebook is adding static typing to PHP. After a few years of dynamic languages being in vogue, is the pendulum swinging back to statically typed languages?
     

    --
    Coder's Stone: The programming language quick ref for iPad
    1. Re:Static languages coming back by MightyMartian · · Score: 1

      Yes, mainly because there are literal mountains of shit code that no one can debug, and all of a sudden the notion that maybe having basically one variable type is a bad thing.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    2. Re:Static languages coming back by g8oz · · Score: 1

      Difference is the static typing here is "opt-in". I think that helps. "If you like your current type practices you can keep them".

    3. Re:Static languages coming back by Anonymous Coward · · Score: 0

      It's just the cycle of stupidity coming around again.

      It was realised by generations past that whilst the promises of dynamic languages of rapid development sounded awesome, the benefits were rapidly lost when you started trying to test and debug large codebases, with the dynanism resulting in bugs often being unfindable until production. Dynamic typing results in a whole new class of additional bugs that can be hard to detect and so drastically increases bug fixing time meaning all benefits of rapid development are long lost and then some in a large codebase and even then inherently worse software to boot because it's still harder to catch everything.

      So everything important was written in statically typed languages, where that class of bug just really doesn't exist, where the longer initial development type pays dividends in terms of more stable software.

      Then along came the Web2.0 crowd, kids who skipped the whole CS thing because who needs a degree right? They reinvented terms like "Responsive" to mean resolution independent design instead of responsiveness of UIs which is what it always meant. They brought forward an era of "do everything in shitly designed scripting languages" and the mass availability of the likes of SQL injection attacks became common place.

      So the cycle repeats, because the current generation of developers is only just learning what the older generations figured out a decade or two ago. Give it another 10 - 20 years and no doubt you'll see the exact same thing again. Why learn from those more experienced when you can just reinvent the wheel right?

      Though for what it's worth, statically typed languages never went out of vogue with real actual professionals, the ones making large software for real money. It's only the fly by night hipster kiddie developers creating my first website for companies and shitty little startups 99% of which fail miserably because they don't know what they're doing that make statically typed languages look unpopular.

      Really, all the big boys from the banks, to Microsoft, to Google, to Amazon, to eBay, to defence companies are still using tried and tested tech like C++ and Java as well as slightly newer technologies like .NET developed with knowledge that was learnt from the lessons of older languages unlike shit like PHP.

  27. Somebody please tell me... by ysth · · Score: 0

    Somebody please tell me this is an elaborate April fool's joke that someone noticed the groundwork for early?

  28. I kinda want more specific types. by Kaenneth · · Score: 1

    I've contemplated a language/library with extra strict typing for doing real-world calculations.

    For example, if floating point variables x and x were be classed as 'Lengths', and you stated "a = x * y;" a would have to be classed as an Area.

    If you then stated "a *= 2;" a would still be an area (of twice the size), but "v = a * x;" would return a Volume class, and "a = a * x;" would be a compile time error (trying to assign a Volume result to an Area class)

    other included types would be Time intervals, with a "(time)a * (length)b" giving a Velocity class, and "(velocity)c * (time)d" giving an acceleration class object...

    This can all be done with simple Classes, be my specific thought is that once the (pre)compiler is done with the extended type checking, it throws out all the overhead, and compiles to just using simple floating point variables. It's to catch programmer errors, not run-time errors.

    1. Re:I kinda want more specific types. by shutdown+-p+now · · Score: 1

      Some languages do have what you want, e.g. F#. Others allow this to be done as a library, like C++.

      But this feature is sufficiently niche that I wouldn't expect it in PHP.

    2. Re:I kinda want more specific types. by istartedi · · Score: 1

      Not a bad idea. If your classes have no virtual methods and they don't allow mixins or other crazy runtime dynamic shenanigans, then in theory the compiler can optimize them down to un-boxed numbers. I wonder how man OO languages are very good at that though. The hard part might be the base class. If you don't even have un-boxed numbers and the base class has virtual methods... you're kind of stuck with something less than optimal.

      Oh and of course time*length isn't velocity. length/time is. Division is slow and requires exceptions though, so if you try to get around that by inverting the time once and multiplying after that, then you need an invert class where multiplication *does* create a velocity type, or maybe I'm just not thinking it through all the way.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    3. Re:I kinda want more specific types. by serviscope_minor · · Score: 1

      I've contemplated a language/library with extra strict typing for doing real-world calculations. For example, if floating point variables x and x were be classed as 'Lengths', and you stated "a = x * y;" a would have to be classed as an Area.

      You want C++11. You can infer the Kg/m/s powers etc using a small amount of template hackery. The thing that C++11 adds is user defined literals, so you could type:

      length a = 4m;

      which gives it a syntax whih doesn't suck.

      --
      SJW n. One who posts facts.
    4. Re:I kinda want more specific types. by Warbothong · · Score: 1

      This can all be done with simple Classes, be my specific thought is that once the (pre)compiler is done with the extended type checking, it throws out all the overhead, and compiles to just using simple floating point variables. It's to catch programmer errors, not run-time errors.

      This is the source of your problems: classes are not types. Classes are a bizarre mixture of bits of tagged unions, namespaces, free-variable scoping rules, typing, subtyping, polymorphism and pattern-matching. The worst part is that it's all first-order (eg. methods can't have methods), which forces higher-order concepts to be 'flattened out'. For example, static properties/methods, factories, controllers, etc.

      If you tease these apart into separate things, and learn what each is on its own, you'll understand your code a lot more. In this case, float is a type, and types introduce no runtime overhead. Classes are not types, and they do introduce runtime overhead (extra memory for tags and extra runtime for dynamic dispatch).

    5. Re:I kinda want more specific types. by Daniel+Hoffmann · · Score: 1

      This smells too much like architecture astronaut thinking. I see the logic of your examples for numbers, but I fail to see how that would be useful for other types. Like you said the times this would actually be useful could be solved by simple OO practices, which injects some boilercode true, but this thing is niche enough to not require its own magic semantic rules.

  29. Nope by Anonymous Coward · · Score: 0

    Cython is *not* static typing for Python but rather a Python-to-C compiler for when you need the native code speed (math) or need to interface with 3rd-party C libraries.

  30. Variadic SQL queries by tepples · · Score: 1

    Parameterized statements are fine if the number and order of parameters in a particular query won't change from one execution to the next. But what's the alternative to calling the database connection's escape_string method if an application needs to include a variable number of values in a query? An example is the list on the right side of SQL operator IN. What I did back when I still used MySQLi was make a single function that turns an array into a correctly escaped and parenthesized IN list using the database connection's escape_string method, and then I use this function for every IN and only IN. Is there a better practice, other than porting the whole lot to PDO MySQL all at once?

    1. Re:Variadic SQL queries by Anonymous Coward · · Score: 0

      In ADO.NET, this is extremely simple.

      For each query you wish to execute, you dynamically build a query string with the appropriate number of parameter placeholders. The resulting SQL looks like:

      SELECT MyId, MyColumn1, MyColumn2
      FROM MyTable
      WHERE MyId IN ('@a1', '@a2', '@a3', '@a4', ....).

      The IN part of the statement is constructed in a loop. In the same loop, you create and attach one DbParameter object for each iteration to the DbCommand object and set their values. The number of placeholders therefore matches the number of DbParameter objects. Then you execute cmd.Prepare() followed by cmd.ExecuteReader().

      No escape strings, no magic quotes, no any other nonsense. You get the right number of parameters for any query you need, and it's completely safe.

      I haven't used PHP in almost 10 years so I don't know what the equivalent is. Regardless, I can't see any reason for it to be any harder than this.

    2. Re:Variadic SQL queries by Anonymous Coward · · Score: 0

      You post this drivel on EVERY FUCKING ARTICLE where it's even vaguely relevant. Just stop and learn to do things properly.

  31. The name seems a poor choice by wonkey_monkey · · Score: 1

    One of the first things you should consider when choosing a name for your project these days is: how relevant will search results be when people Google for it?

    --
    systemd is Roko's Basilisk.
  32. Shared hosting conservatism by tepples · · Score: 1

    They were removed completely as of PHP 5.4.0.

    That's fine so long as all users of your application are on hosts that offer PHP 5.4.0 or later. Shared hosts tend to stay on old PHP, possibly with backported security fixes, so as not to expose their customers to breaking changes. They also tend to limit the extent to which customers can configure the web server, PHP, and database. I had to wait for my annual renewal in order to move my personal web site from another host to WebFaction in order to get halfway recent PHP.

    1. Re:Shared hosting conservatism by Anonymous Coward · · Score: 0

      I had to wait for my annual renewal in order to move my personal web site

      Is that the fault of the language, the hosting provider, or the person using the hosting provider?

    2. Re:Shared hosting conservatism by tepples · · Score: 1

      It's the fault of people who choose an entry-level hosting provider before coming to understand the tendency of certain popular hosting providers to drag their feet on offering language upgrades. I don't think I'm the only person who has gone through that stage.

  33. I explain this as the outcome of a by Anonymous Coward · · Score: 0

    Zuckerfart.

    And having released my creation into the world, under the GPL 2.0 license, go forth and multiply! Type safely!

  34. What it fixes? by gmuslera · · Score: 0

    This list should be updated. With a bit of luck it won't be a fractal too.

  35. PHP blew chunks until about 2 years ago. PHP =Lego by raymorris · · Score: 1

    > Lots of devs disparage PHP, but they're all idiots

    or they haven't looked closely at the newest changes to the language in the last two years.
    Or they are talking more about the "PHP community", thousands of "scripters" who use PHP because it's easy to build things in PHP, in the same way that it's easy to build things with Legos.

    I helped write the PHP certification test, which suggests I know a little something about PHP. My PHP code is used by many large universities. I could go on, but suffice to say I'm certainly not clueless about PHP. It is my opinion that PHP, as a general purpose language, was awful, horrible, until quite recently. I say "as a general purpose language" because that's how PHP is being used, but that's not what is was originally designed for. It was originally designed as a templating engine, as SSI++. The fact that it was never designed as a programming language was painfully obvious for many years - it had most of the individual features of a language, but no _design_ unifying those features.

  36. Sloppy implementation + bad idea = ? by DavidHumus · · Score: 1

    Sorry, slop and rigor don't really combine well.

  37. Who needs it when by ssufficool · · Score: 1

    You can just wrap all the PHP types in classes and do: function DoSomething(String $str) { } Then you can use the String class to wrap all php string consuming functions and do $str->substring(0,5). And that my friends is PHP.NET XD

  38. Migration of an entire app to a new DB API by tepples · · Score: 1

    Is there a better practice, other than porting the whole lot to PDO MySQL all at once?

    In ADO.NET, this is extremely simple. [explains how to use named placeholders] I haven't used PHP in almost 10 years so I don't know what the equivalent is.

    The equivalent in PHP is PDO, which likewise supports named placeholders. Build the query string with placeholders, and bind variables to the placeholders either one at a time or through an associative array. In new projects I use PDO. But this leaves open the problem of migrating an existing application from a legacy API such as MySQLi, which supports only positional placeholders that are impractical for use with operator IN, to PDO.

  39. Not PHP by fulldecent · · Score: 1

    Can't you just use use documentation to set your variables' type and then use a PHP compiler to check if you broke the rules?

    Then you can still use the baseline or any compatible PHP runtime and use documentation-completeness + compiling tools to tell you if you are following the more strict rules.

    --

    -- I was raised on the command line, bitch

  40. And then you learn to code by SmallFurryCreature · · Score: 1

    And you suddenly learn to write proper code and 99% of your debugging needs disappear simply because you have learned to write code correctly and consistently.

    I see to many code monkeys who can't work consistently, who rely on an IDE to safe their asses and so when it comes crunch time, they can't handle anything because nobody is holding their hands.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

  41. Really? by dasgoober · · Score: 1

    Is it really that difficult to type your variables by naming convention, and then, enforce the convention by beating anyone who breaks it about the ears?
    You can't discipline yourselves, so you need the language to do it for you?

  42. oo w/ plain c... Re:English? by Fubari · · Score: 1

    I've done the struct-based objects w/fnct pointers in C; it just isn't as much fun as working with more oo-minded languages, but at the time C is what we had for multi-platform support (early 90's... I wouldn't go down that road today, much better options are available).

    Also, just for fun, who remembers that C++ started life as a pre-processor (cfront) that generated C code?

    So I agree with your premise, HiThere. It is an interesting exercise to imagine how to do oo-things in non oo languages (though
    riding that train of thought to the end of the line leads to concluding that assembly language has oo-capabilities).
    For something to be an oo-language, the capability to roll-your-own class hierarchy and dispatch mechanism
    gets one's foot in the door... I will suggest that not having to roll anything on your own (e.g. having all that oo stuff
    pre-built for you) gets one all the way to the Buffet of Productivity.

    Now... whether Strong Typing is "all that" is a debate ranking right up there with emacs vs vi.. :-)

    *shrug* I suppose people that want the extra (alleged) safety of Strong Typing will seek it out.

  43. More reasons php sucks by Anonymous Coward · · Score: 0

    Here's a reason to not use php. too many php developers are married to MySQL.

    MySQL has absolutely no place in business; its a shit database and that means that the developers deciding to implement it aren't thinking about the most important part of the application, the data.

    So, yeah, you php weenies can keep your shit database and dynamic typing.

    I'm going to stay away from that shit, its a fast way to weed out incompetent developers.

  44. Another Haskell Hack by Anonymous Coward · · Score: 0

    Bryan O'Sullivan is one of the heavy hitters in the Haskell community. Considering that Hack does type-inferencing too, I have a feeling that even the name 'Hack' was inspired from 'Haskell'.

  45. Find simple tutorial of Hack Language by Anonymous Coward · · Score: 0

    hello friends I found a simple tutorial of Hack Language here:
    http://sickprogrammersarea.blogspot.in/

    Have a look it may help