You got your type annotations in my javascript!
October 3, 2012 10:36 AM   Subscribe

TypeScript is Microsoft's new open source programming language.

Designed by Anders Hejlsberg (of Turbo Pascal, Delphi, and C# fame), it is a strict superset of (and compiles to) javascript. TypeScript adds optional static types and a module system, using ECMAScript 6 "Harmony" syntax for new features whenever possible.

Reactions have been mixed. But don't take their word for it- try it out for yourself.
posted by a snickering nuthatch (67 comments total) 18 users marked this as a favorite
 
I'd go with Emscripten just for the fun of getting to say "Emscripten" all the time.
posted by Egg Shen at 10:37 AM on October 3, 2012 [2 favorites]


"It looks like you're writing some code.
Would you like help?
[] Format your hard drive and install Linux
[] Throw your PC into the dumpster, buy a MacBook Pro, adopt the hipster lifestyle and join MetaFilter
[] Give up on coding, move to Tuscany and plant a small vineyard
[] Don't show me this tip again"
posted by Wordshore at 10:56 AM on October 3, 2012 [26 favorites]




I don't get it.

This is their "types" example:

function Greeter(greeting: string) {
this.greeting = greeting;
}

Greeter.prototype.greet = function() {
return "Hello, " + this.greeting;
}

var greeter = new Greeter("world");
...


If you change this line:

var greeter = new Greeter("world");


to this:

var greeter = new Greeter(7);


And run it, what do you get? Some sort of type error? No, you get "7" coerced to a string, which is what javascript would have done anyway.
posted by tylerkaraszewski at 11:08 AM on October 3, 2012


JScript++
posted by ook at 11:11 AM on October 3, 2012


Oh I'm sorry, that should be JScript#.net

Because the world needs another version of a perfectly good language proprietized by Microsoft
posted by ook at 11:12 AM on October 3, 2012 [1 favorite]


tylerkaraszewski, I get a compiler warning. That is the point. It's not trying to actually modify the behaviour of Javascript itself, only provide better tools for writing it.
posted by CaseyB at 11:16 AM on October 3, 2012 [8 favorites]


Because the world needs another version of a perfectly good language proprietized by Microsoft

Why do you hate open source languages?

(Edit? Seriously? This works? Whoa)
posted by Leon at 11:17 AM on October 3, 2012


I have to admit I'm a bit of a Hejlsberg fanboy ever since Turbo Pascal. I wish Delphi had been more popular in domains other than soulless enterprise GUIs and Russian malware.
posted by RobotVoodooPower at 11:20 AM on October 3, 2012 [8 favorites]


or coffeescript, or a bunch of other alternatives. ECMAScript has a ton of problems that ought to be addressed, and people are working on a bunch of interesting ideas on making the language more robust outside of the burdened spec process.


Sadly, this goofy "transpiler" state is probably where we're stuck at for the foreseeable future.
posted by boo_radley at 11:22 AM on October 3, 2012


Lotta good stuff. I wish we could have go style structural interfaces in c#.

MS is really pushing node.js. This really helps "enterprise" node.js apps. Write your TypeScript, compile it to javascript with tsc (which is itself written in TypeScript), get your javascript back and run it with node.js
posted by Ad hominem at 11:23 AM on October 3, 2012


Yeh, you're right, it's open source. I kneejerked a little there.

I just... my reaction is basically who asked for this? Do we really need this? Does javascript really need a layer of syntax sugar for objects? Maybe I'm just showing my age, I'm more interested in doing things with existing languages that work perfectly well than in jumping into this. And, yeah, the whole .net thing of making a MS-approved version of every popular language Just Because We Can left me pretty kneejerky when it comes to new language announcements from MS.

To be fair I'm equally uninterested in jumping into Dart or Go or Coffeescript or whatever next month's flavor will be.
posted by ook at 11:26 AM on October 3, 2012 [3 favorites]


I'm also just back from the hospital and am pretty grumpy and probably shouldn't be posting in this state. Don't mind me.
posted by ook at 11:29 AM on October 3, 2012 [2 favorites]


Meh. Just a contracts implementation that's limited to type checking. That's not the type of type system (pun intended) that helps you, like in Haskell, F# or Scala.
posted by floatboth at 11:33 AM on October 3, 2012


More evidence that javascript is the awkward assembly language of the web.

Zed Says it best:
http://vimeo.com/43380467
posted by ethansr at 11:38 AM on October 3, 2012 [1 favorite]


my reaction is basically who asked for this? Do we really need this?

My guess is Mr. Hejlsberg wanted to do it. And he gets to do what he wants. MS can say it's Open Source, and if it takes off, great. If it doesn't, it's keeping a huge name under their roof and happy.
posted by DigDoug at 11:39 AM on October 3, 2012 [2 favorites]


Visual Studio 2012 Developers can install the TypeScript editor plugin to get rich TypeScript tooling.

I'm guessing that some aspect of it makes it easier to implement VS features than in straight js, perhaps?
posted by XMLicious at 11:41 AM on October 3, 2012


Hmm.

I am really Against This Sort of Thing, whether it be Dart or Coffescript or the other Google one or I think Google has another one or whatever.

On the other hand, the outputted code is rather nice. That's some straightforward JavaScript module patterns there that I think Douglas Crockford would approve of and I would totally work with and maintain that code, which undermines my argument that the inherent result of This Sort of Thing is blackbox gibberish.
posted by Artw at 11:42 AM on October 3, 2012


I just... my reaction is basically who asked for this?

Well, it's aligned reasonably well with Harmony, so the answer to "who asked for this" arguably includes Brendan Eich and other ECMA folks. This is hastens the availability of features that are going to come to javascript eventually.
posted by a snickering nuthatch at 11:43 AM on October 3, 2012 [1 favorite]


JavaScript should still be JavaScript though, and I still find the idea of compiling to it silly.
posted by Artw at 11:43 AM on October 3, 2012


Zed Says it best:

Really disappointed that isn't a clip of Sean Connery in a red loincloth.
posted by fleetmouse at 11:44 AM on October 3, 2012 [1 favorite]


There seems to be a market. Doesn't "everyone" use coffescript now ? Everyone and their brother has a module system, all conflicting. Not to mention the Javascript peeps are adding just this same stuff themselves.

I'm guessing that some aspect of it makes it easier to implement VS features than in straight js, perhaps?

Watch the video, it is like magic. It gives you error squiggles, intellisense, autocomplete, It is like using a real language.

Don't underestimate tooling support. Tooling support is fucking primative for Javascript. I know you guys are all like "I use VI and I type every character myself and I like it", but I have a symbiotic relationship with VS and type checking. I rely on it to tell me where I screwed up and I can just keep hitting tab and the code just writes itself. I might actually write javascript myself now instead of trying to talk other people into doing it for me.
posted by Ad hominem at 11:46 AM on October 3, 2012 [5 favorites]


JavaScript should still be JavaScript though, and I still find the idea of compiling to it silly.

Why is that? If JS is available on basically every browser, then it's a great target language. If you can make a source language [x] that is more expressive and/or less error-prone, then an [x]ToJs compiler is the perfect tool.

Your developers write in [x] with all its benefits, and the user only "sees" JS. What's the objection?
posted by CheeseDigestsAll at 11:50 AM on October 3, 2012 [3 favorites]


It's fun to create new programming languages, especially when you don't have to worry about compiling to machine code on modern processors. Whether it is necessary to do so is a exercise left to the reader.
posted by tommasz at 12:04 PM on October 3, 2012 [2 favorites]


Metafilter: I type every character myself and I like it.
posted by pombe at 12:05 PM on October 3, 2012 [4 favorites]


Your developers write in [x] with all its benefits, and the user only "sees" JS. What's the objection?

One thing that I've loved about the web since the mid-1990s is that I can always pull down a menu (whatever it is in whichever browser) and select something like View Source. From reading reviews, it looks like the developer-to-end-user chain of TypeScript-to-JS can involve a lot of code obfuscation. That obfuscation may not even be deliberate, but I could see that making exploration (by beginners or anyone interested in programming) more difficult, and it also takes some of the spirit of "openness" out of the web. Would the early days of the web have been as successful, if an Edit > View Source operation shows a series of bytes in hexadecimal format?
posted by Blazecock Pileon at 12:18 PM on October 3, 2012 [2 favorites]


Artw: "JavaScript should still be JavaScript though, and I still find the idea of compiling to it silly."

So, I do get where you're coming from, but these compiled JavaScript subsets really don't do all that much compilation, as you'd think of it in the traditional sense of the word. In the examples I've seen, uncompiled TypeScript actually looks pretty similar to the final compiled output. Ditto for most CoffeeScript. It's all just syntactic sugar and macros...

In many ways, TypeScript is less of a departure from JavaScript than CoffeeScript is, as it reuses JavaScript's syntax. I like a lot of what CoffeeScript has to offer, but have always resisted it because significant whitespace really bothers me. TypeScript looks like a more palatable alternative that adds to the language, rather than redefining it.

I'm interested to see where this goes. The static typing system is frankly one of the less interesting parts of the language to me (or, at the very least, it certainly doesn't sell me on it). On the other hand, the "you can use it today" implementation of ECMAScript6 classes is very valuable. If you're careful enough, you could write TypeScript that could eventually become valid ES6 without any modification.
posted by schmod at 12:23 PM on October 3, 2012


Javascript as deployed in most browsers is basically ECMAscript version 5 (trident, gecko and V8 aka IE, firefox and chrome). Safari webkit is only v3 IIRC, as is the javascript embedded in most other things.

node.js uses Chrome's V8 engine as its javascript engine for servers, and is arguably now more popular than ruby on rails, though obviously nowhere near as mature. Websockets aka two-way browser/server communication is way cool though, and a cinch in node.

Typescript is basically what is already under discussion as ECMAscript v6/harmony come early; optional static typing, and more work on classes and modules.

It's not some radical root and branch reform of javascript to try and turn it into java or ruby (I'm looking at you, coffeescript), it's fairly minor add-ons, along the lines of what's already (slowly) going through the process for ECMAscript Harmony - the end compiled code is going to look very javascripty, as it IS javascript - typescript is javascript with a few small extra knobs on to make it easier to build Big Things in javascript and make less avoidable yet hard-to-find screwups, so you shouldn't see great big blobs of unparseable code in the compiled version.

Don't forget, one option for metro apps is javascript and html5, so microsoft themselves were probably after a tool to make their life easier with big projects. And Hejlsberg certainly deserves some slack in 'this isn't a terrible idea' department, especially as this is under the apache licence; that's pretty damn open. And sublime text support! squeee.

I'm sure it will become obsolete once ECMAscript v6 rolls around, but that will likely still be a good old while.
posted by ArkhanJG at 12:36 PM on October 3, 2012 [3 favorites]


Doesn't "everyone" use coffescript now ?

No. A lot of people enjoy writing JavaScript using the CoffeeScript syntax / shortcuts, and that's fine. Other people find that it either solves problems they'd already solved in some other way, or doesn't solve their remaining problems.

Particularly relevant in this case, CoffeeScript doesn't solve problems for developers who want type checking or tooling support.

Don't underestimate tooling support. Tooling support is fucking primative for Javascript. I know you guys are all like "I use VI and I type every character myself and I like it", but I have a symbiotic relationship with VS and type checking. I rely on it to tell me where I screwed up and I can just keep hitting tab and the code just writes itself.

A lot of this kind of tooling has basically been growing up in the runtime itself, and if you have to choose where to have the best tooling, picking the runtime has a lot of merits. But it does mean that the feedback is less immediate when you're writing code, and just like JavaScript's differences/warts can be a thorn for people who've been effectively using other dynamic languages, I think it's clear that this is a thorn for people who've been effective using IDEs.

But I don't think it's likely the best tooling will grow up around something like typescript. Rather, I think the logical next step for an inherently dynamic language is to bring the development environment closer to the runtime. My guess is the future is something like Brackets + Webkit dev tools.
posted by weston at 12:39 PM on October 3, 2012 [1 favorite]


Blazecock: anyone who cares about optimization is already minifying their JS and CSS anyway, which would be no less difficult to read than compiled TypeScript.

I've got the same concerns with minification itself: it absolutely does make things hard to read/debug, and that may be doing the open web some harm.

Meanwhile, I'm not convinced that minification is a significant net gain for users (though it may be an issue in terms of data transfer costs on high traffic sites). My observation is that big performance hits tend to be caused by the number of HTTP requests, rather than the size of the payload (within certain order-of-magnitude parameters); gzip and caching strategies take most of the edge off of everything else.

So I've stopped worrying about it unless it's for a well-known library the source for which the source is freely available, or I have a specific optimization problem, or if it's a project requirement specified by someone who has a good reason.
posted by weston at 12:51 PM on October 3, 2012 [2 favorites]


More through being forced into it by shitty site architecture and enviroment issues than design I've been writing a lot of code in the browser recently, then copying it back into files. It's suprisingly effective.
posted by Artw at 12:53 PM on October 3, 2012 [1 favorite]


my reaction is basically who asked for this? Do we really need this?

Given the number of other languages that are now compiling into Javascript, the world already seems to have answered that question. But if you're asking "why this instead of Coffeescript or Dart", then I think the answer is somewhat philosophical: none of the existing alternatives was consistent with the design goals for Typescript.

From reading reviews, it looks like the developer-to-end-user chain of TypeScript-to-JS can involve a lot of code obfuscation.

It was actually a specific design goal for Typescript that the resulting JS would look as similar as reasonably possible to something a human being would write. This is in part because a lot of effort has been put by various organizations into writing Javascript implementations that are optimized for human-written JS -- and Typescript's output will need to run well on all of them.

Does javascript really need a layer of syntax sugar for objects?

A lot of people seem to think so. While there are many who embrace the prototype paradigm, it's arguably true that class-based programming has the lion's share of the non-JS world: C++, C#, Objective C, Java, Python, etc. Why shouldn't programmers be able to take their mental models with them into the Javascript world?

Oh I'm sorry, that should be JScript#.net

There is already a JScript.net, which is an implementation of the JS language on the .NET Framework. As far as I know, it's essentially dead.


Disclaimer: I have friends who are involved with this project but am not directly involved myself.
posted by Slothrup at 12:56 PM on October 3, 2012 [1 favorite]


It was actually a specific design goal for Typescript that the resulting JS would look as similar as reasonably possible to something a human being would write.

I probably would never use the thing but I really do thinking they've succeeded in that regard. It could probably even be used as a way of doing a lot of boring legwork before getting down to the real coding.
posted by Artw at 1:00 PM on October 3, 2012


From reading reviews, it looks like the developer-to-end-user chain of TypeScript-to-JS can involve a lot of code obfuscation.

Care to provide a few quotes stating that?
posted by kmz at 1:06 PM on October 3, 2012


This:
class Greeter {
  greeting: string;
  constructor (message: string) {
      this.greeting = message;
   }
   greet() {
      return "Hello, " + this.greeting;
  }
}   

var greeter = new Greeter("world");
var button = document.createElement('button')
button.innerText = "Say Hello"
button.onclick = function() {
      alert(greeter.greet())
}

document.body.appendChild(button)
Compiles to:
var Greeter = (function () {
   function Greeter(message) {
      this.greeting = message;
   }
   Greeter.prototype.greet = function () {
      return "Hello, " + this.greeting;
   };
   return Greeter;
})();

var greeter = new Greeter("world");
var button = document.createElement('button');
button.innerText = "Say Hello";
button.onclick = function () {
  alert(greeter.greet());
};
document.body.appendChild(button);
Which is perfectly understandable if you've written any modern JS especially if any involving module patterns.
posted by Artw at 1:29 PM on October 3, 2012 [2 favorites]


Three comments:
1. Did somebody just reinvent RATFOR? Or cfront?
2. It's been a few months, isn't it time for Google to announce another new language?
3. If browser languages are going to "compile" down to Javascript, could we make something more efficient than Javascript for that purpose? I honestly don't know.
posted by LastOfHisKind at 1:41 PM on October 3, 2012 [2 favorites]


Did somebody just reinvent RATFOR? Or cfront?

It is essentially a preprocessor, yes.

If browser languages are going to "compile" down to Javascript, could we make something more efficient than Javascript for that purpose?

Sure, all you need to do is get Apple, Google, Mozilla, and Microsoft to agree to implement it in their browsers.
posted by kmz at 1:46 PM on October 3, 2012 [1 favorite]


And then get everyone to upgrade. That's the best bit.
posted by Artw at 1:46 PM on October 3, 2012


Oooh, RATFOR! Software Tools was the second programming book I ever owned. Well, okay, swiped from my father.

The first programming book I owned was A FORTRAN Coloring Book...
posted by Slothrup at 1:47 PM on October 3, 2012 [1 favorite]


It looks like you're writing some code.

Someone port ClippyJS stat!
posted by Gary at 2:02 PM on October 3, 2012 [1 favorite]


I'd go with Emscripten just for the fun of getting to say "Emscripten" all the time.

My beef with "Emscripten" is that it would be way easier to pronounce as "Enscripten".
posted by a snickering nuthatch at 2:02 PM on October 3, 2012


And then get everyone to upgrade. That's the best bit.

Anymore? You wait a week and there will be a big blinking box telling you to upgrade whatever browser.
posted by eriko at 2:21 PM on October 3, 2012


IE is still a thing.
posted by Artw at 2:25 PM on October 3, 2012


Because the world needs another version of a perfectly good language proprietized by Microsoft

a) it's only "perfectly good" if by "perfectly good" you mean "just barely adequate"; Javascript competes with PHP for "worst language in common use". PHP only wins because there's so goddamn much of it, so it has more opportunities to suck.

b) Anders Hejlsberg does what he wants and Microsoft pays him for the privilege of getting to slap their label on it. Do not read the existence of this language as evidence of some nefarious corporate plot.
posted by Mars Saxman at 2:28 PM on October 3, 2012


Oh, there is another TypeScript interview with Hejlsberg and some other dudes he lets hang out in his office?
posted by Ad hominem at 2:46 PM on October 3, 2012 [1 favorite]


"Javascript competes with PHP for "worst language in common use""

The thing is, it's almost perfect for what it's mostly used for. 'Wiring up' a web page to create interactive widgets etc. using jQuery and closures is an absolute joy, one of the rare coding scenarios where I can rattle things off quickly & easily yet still produce code that's clear, logical and succinct.

TypeScript seems harmless enough, almost equivalent to Sass/LESS, but it does grate a little when some people seem to want to turn JavaScript into something more rigid, more 'IDE-friendly', more 'enterprise-ready'. More like Java.
posted by malevolent at 4:01 PM on October 3, 2012 [2 favorites]


Scott Hanselman: Why does TypeScript have to be the answer to anything?
posted by Artw at 5:08 PM on October 3, 2012


Javascript competes with PHP for "worst language in common use"

Oh, piffle.
posted by ook at 5:11 PM on October 3, 2012


> Javascript competes with PHP for "worst language in common use"

You have just got to be joking. Javascript is a nice slick language with a very interesting object model - it's quite a pleasure to use, and I've been mainly been using it for music programming.

PHP, on the other hand, is a vile stinker of a language with a million pitfalls - see this excellent article, PHP: a fractal of bad design.
posted by lupus_yonderboy at 5:28 PM on October 3, 2012 [1 favorite]


PHP and JavaScript are amazing, amazing languages. Can you imagine writing Facebook in MFC and DCOM?
posted by effugas at 5:43 PM on October 3, 2012


Javascript certainly has its warts. It doesn't look good compared to, say, lua, which IMO is its closest cousin.

it does grate a little when some people seem to want to turn JavaScript into something more rigid, more 'IDE-friendly', more 'enterprise-ready'. More like Java.

I don't want Javascript turned into anything more rigid, but I really do wish a language with real typing (a la ML or Haskell) showed up in the browser. When I heard that Google was developing Dart, I thought that could be really cool, until it turned out that Dart is essentially more of the same because for whatever reason people assume that web must equal dynamic or weak typing.
posted by a snickering nuthatch at 6:59 PM on October 3, 2012


You have just got to be joking.

Not in the least. Javascript is the reason I stopped doing web development.

Javascript is a nice slick language with a very interesting object model

So says Crockford's book, but once you step outside the careful little world of the good parts, you're surrounded by the same kinds of pitfalls you find in PHP.
posted by Mars Saxman at 7:47 PM on October 3, 2012 [1 favorite]


TypeScript seems harmless enough, almost equivalent to Sass/LESS, but it does grate a little when some people seem to want to turn JavaScript into something more rigid, more 'IDE-friendly', more 'enterprise-ready'. More like Java.

Yeah. I was an Actionscript programmer for over 10 years, and I've been through this once already. Take a dynamic language w/prototype based inheritance and graft strict typing and classical inheritance onto it, and now it's just better, right? In some ways, in some ways not. I can't tell you what a joy it was to finally bite the bullet and switch over to Javascript and move back to coding the AS2 way as opposed to the Java/AS3 way. ECMAscript is unique and agile and I don't need it to be straitjacketed / "fixed" the way AS2 was.
posted by january at 7:57 PM on October 3, 2012


> PHP and JavaScript are amazing, amazing languages.

As I argued above, PHP is a bag of shit. The only reason it's popular is that a moron can get a one-page "dynamic" site up in a few minutes - but it's a horror if you have to maintain anything larger than that.


> Can you imagine writing Facebook in MFC and DCOM?

Um, no, but even more, it boggles my mind that Facebook uses PHP - it's proof that if you throw enough manpower at it you can get past even the worst language.

Were I doing it? Python - a fantastic library, a really clear and well-specified language with support for things like unit tests, unicode(!), a really well-crafted library that covers almost every service - plus now you can write on the App Engine and just crank up your instances when you get more hits.


> you're surrounded by the same kinds of pitfalls you find in PHP.

Sorry, I don't agree - nor are you providing any actual argument to back you up. I'm quite familiar with both languages, and I'd never, ever use PHP for anything bigger than a couple of pages with trivial logic.

Here's a decent list of some problems in Javascript - but really, are they so bad?

Compare this to the link I posted above about the badnesses of PHP - it just goes on and on and on, and if you're at all experienced, you keep shaking your head and saying, "WTF? What's wrong with these people?"

If you're going to continue in this thread claiming that PHP is a usable language, you'd really need to confront at least some of the arguments presented in that link...
posted by lupus_yonderboy at 8:19 PM on October 3, 2012 [1 favorite]


If you're going to continue in this thread claiming that PHP is a usable language

I'm claiming the exact opposite: neither PHP nor Javascript is a usable language, unless you are talking about trivial hacks.
posted by Mars Saxman at 8:48 PM on October 3, 2012


Your argument being...?
posted by lupus_yonderboy at 9:12 PM on October 3, 2012


So says Crockford's book, but once you step outside the careful little world of the good parts, you're surrounded by the same kinds of pitfalls you find in PHP.

Heretic!

He doth doubt The Book! BURN HIM!
posted by Artw at 9:37 PM on October 3, 2012 [4 favorites]


My argument being: yay for TypeScript. Yay for Dart. Yay for CoffeeScript. JavaScript was a quick hack which happenstance enthroned as a foundational technology of the web, and it'd be great to think we might not be stuck with its array of warts and blemishes for all time. We can do better.
posted by Mars Saxman at 10:16 PM on October 3, 2012


Not much of an argument there... do you have anything specific?

Javascript is a fine language.

It has a really neat, "promiscuous" object model where you can hang properties off any object you like. Getting object properties and accessing an associative array are the same thing, which makes for clear and compact code. But it's also a really good functional language, one which handles closures really well, a language that lets you do both object inheritance and mix-ins, or create an anonymous function that you can pass around to do your work.

It's a particularly good tool for a language that lives in a browser - partly because you can neatly and naturally send data back and forth between client and server using JSON, but mainly because there's a natural correspondance between the DOM object model and Javascript's promiscuous model.

The "fault tolerance" that people complain about is nothing like PHP's horrors - mainly, it's the fact that you can get a property or variable that's never been set (it has the special value "undefined" which isn't equal to null or 0), which is perfectly well-disciplined.

I wasn't impressed by Javascript when I first learned it but once I started to write more complex programs I loved how logically it all fit together. I wish it had a better library, like Python's, I wish it had namespaces and a few other features, but I'd still be happy to program in it.
posted by lupus_yonderboy at 10:48 PM on October 3, 2012


The thing about PHP is, a lot of big stuff like Facebook, Flickr and Etsy gets written in it by serious developers and operations folks who’ve looked at all the options and made a conscious decision. The other thing about PHP is that the warts and bad stuff prevent you from getting too clever if you’re wise enough to heed their warnings, so you get the most mileage by treating it as the bind-all glue bash-for-the-web language that it really is.

I’m excited about the potential of Typescript. AS3 and the connected Eclipse-derived IDE were an amazing productivity kick for us when we first started using them, and since we’ve switched to JS for our interactive work (because iOS) we’ve flailed a ton over simple development and coordination issues that would have been prevented through strict typing and less goddamn motherfucking closure creep.

In conclusion, I hate jQuery.
posted by migurski at 11:18 PM on October 3, 2012


the careful little world of the good parts

I waved my shiny new copy of Javascript: The Good Parts at my cow-orker. He gave me a look and said "it's a pretty small book, isn't it."
posted by i_am_joe's_spleen at 1:31 AM on October 4, 2012 [1 favorite]


Blazecock Pileon, I totally agree with your view-source sentiments, but fear that ship has long since sailed. The price of progress.
posted by phl at 3:19 AM on October 4, 2012


lupus_yonderboy: "PHP, on the other hand, is a vile stinker of a language with a million pitfalls - see this excellent article, PHP: a fractal of bad design."

The thing is, you could cherry-pick a lot of similar arguments about JavaScript. There's a whole lot of weird cruft leftover from the early days of the language that isn't advisable to use today. I'd argue that JavaScript's scoping rules and inheritance model make it easier to write terrible code than in PHP.

PHP 5.4's object model is pretty clear and concise, and there's finally support for things like namespacing and actually-easy autoloading. Using Composer and Packagist is very similar to using Node and NPM, provided that you stay within certain boundaries.

That said, the PHP binaries and interpreter are in pretty terrible shape, even though the language itself seems to be back on a good path. It's all singlethreaded, bugs can take years to be fixed, there are weird cross-platform inconsistencies, and php.ini gives you way too much control over how the language is interpreted. I also get the impression that Rasumus is a stubborn developer who doesn't get along well with others.
posted by schmod at 10:06 AM on October 4, 2012


I waved my shiny new copy of Javascript: The Good Parts at my cow-orker. He gave me a look and said "it's a pretty small book, isn't it."

This image says it all.
posted by Gary at 11:19 AM on October 4, 2012 [4 favorites]


It's a good joke, but seriously If you're doing anything with JS read The Book.
posted by Artw at 11:31 AM on October 4, 2012 [1 favorite]


Who built Microsoft TypeScript and why
posted by Artw at 1:16 PM on October 6, 2012


Brandon Eich on the state of JavaScript
posted by Artw at 9:39 AM on October 9, 2012


« Older Allelujah! A new album!   |   the intersection of social media and sharing... Newer »


This thread has been archived and is closed to new comments