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.
Obviously a backdoor for the NSA 8)
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.
FaceBook is developing an in-house version of PHP that adds optional static typing and some other features.
So many of the bugs that have tripped me up over the years would have been solved by simply having static typing.
Easy Online Role Playing Campaign Management
"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?
We really need a sarcastically typed language. That would be truly awesome.
Troll is not a replacement for I disagree.
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.
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.
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.
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.
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.
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.
Get free satoshi (Bitcoin) and Dogecoins
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.
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.
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.
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.
I'd have thought the horrible global function namespace would have been a top priority.
Seriously, what is this, C?
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.
I for one approve of your comment. -1 is an injustice.
Team Zuck has been trying to find something that is more of a hack than PHP, but couldn't. So they invented one.
convert the summary in english
They reinvented soft typing. ;-)
Ezekiel 23:20
Hack is to PHP as Typescript is to Javascript?
http://www.typescriptlang.org/
Really? WHAT YEAR IS THIS?
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.
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.)
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.
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.
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
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.
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.
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.
So not much different than PHP then...
(ducks)
The world's burning. Moped Jesus spotted on I50. Details at 11.
"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?
So not much different than PHP then...
(ducks)
It generates Perl?
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.
So ... What would you have changed? What would your top-priority have been?
Required reading for internet skeptics
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.
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?
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.
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.
Ive been running ASP.Net MVC stuff on a RaspPi under mono and Nginx now for several months with no issues...
I think I just went blind!!!!
The world's burning. Moped Jesus spotted on I50. Details at 11.
> 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.
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).
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.
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.
Sorry, slop and rigor don't really combine well.
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
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});
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});
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!"
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.
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.
"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).
Please advise if you have a guide as to how to make Java program turnaround time to below 10seconds. I would find it invaluable.
"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.
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).
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).
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.
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
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.
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
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.
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.
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.
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
Success seems to be tied to not using Java Enterprise. Has any new company ever succeeded with Java Enterprise?
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.
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.
Can you provide me with an implementation of your hammer-to-screwdriver translator?
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.
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?
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.
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
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.
So ... What's wrong with it?
How did you come to the conclusion that it is "it's too broken at a fundamental level".
Required reading for internet skeptics
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
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});
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});
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});
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.