For the interested (and with the caveat that I definitely would not suggest it for the Khan Academy's purposes), CoffeeScript does try to address all of the issues that John raises in his post. Type Coercion: There is no `==` in CoffeeScript. You usually write `if x is y` in order to be particularly clear, but if you're in the mode of most other scripting languages, and you write `if x == y`, it will compile to `if (…
And made the mistake of making whitespace significant thereby driving off people in droves.
John Resig: JavaScript as a First Language
191–200 of 228 posts
Re: John Resig: JavaScript as a First Language
#192For the interested (and with the caveat that I definitely would not suggest it for the Khan Academy's purposes), CoffeeScript does try to address all of the issues that John raises in his post. Type Coercion: There is no `==` in CoffeeScript. You usually write `if x is y` in order to be particularly clear, but if you're in the mode of most other scripting languages, and you write `if x == y`, it will compile to `if (…
http://img856.imageshack.us/img856/306/javascriptinasimplewa...
Re: John Resig: JavaScript as a First Language
#193Re: John Resig: JavaScript as a First Language
#194Earlier quoted context omitted.
Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace. Getting stuck and being frustrated hurts motivation a lot. Now curly brackets and syntax may be seen by a person as an irritation or inconvenience compared to whitespace, but I'd say it's better t…
"""Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace.""" I'd argue that for a beginner it's equally difficult. And how about this equally difficult to spot classic bug: if (f==x) do_something() and_also_do_this() //oops! a language with significan…
Re: John Resig: JavaScript as a First Language
#195Earlier quoted context omitted.
You're mistaken if you don't think a shit ton of people dislike Python exactly because of significant white space as well as it being the source of a great many bugs. As for Smalltalk, yes, they do like them, since faking them by passing literal hashes is a common pattern.
"""You're mistaken if you don't think a shit ton of people dislike Python exactly because of significant white space""" Those people don't use Python anyway. There are a shit ton of people disliking anything you can think of. I don't know of many people that tried actually USING Python and still dislike the use of whitespace. I also don't think the "whitespace haters" are intelligent about it or have any basis. For o…
If you don't think it has ever caused bugs, then you aren't thinking very hard or you've not looked into the opposing point of view at all. In any case, I'm done discussing it with you.
Re: John Resig: JavaScript as a First Language
#196Re: John Resig: JavaScript as a First Language
#197Earlier quoted context omitted.
CoffeeScript is a subset of JavaScript with bindings to an alternate syntax (CoffeeScript). John's suggestion is an enforced subset of JavaScript, with the advantage that (some) JavaScript in the wild is understandable; error messages are in terms of the source language (very helpful, more so for beginners); and yields a skill with greater marketability (so far). Why not use the same subset as CoffeeScript? In some c…
You totally could; that would be "good" JavaScript. No problem with that. Some of us like a cleaner, poetic syntax with significant whitespace and a few useful macros; we like CoffeeScript.
Re: John Resig: JavaScript as a First Language
#198Earlier quoted context omitted.
That's an argument for learning C, but not for learning C as a first language. Studying assembler or chip design or even particle physics will also help you understand what the computer is 'actually doing', but it doesn't mean that's the best place to start learning how to program.
I didn't claim that C was the best language for learning how to program. John Resig's article above is about "teaching Computer Science" rather than teaching students how to program. These are very different things. That's why I recommended C - because it is very much a language that will teach the theory about how computers work. I agree that there are other languages better suited for learning how to program.
Re: John Resig: JavaScript as a First Language
#199I want to take this further still. Most JavaScript programmers already use a subset of the language and I believe that there is quite a broad union of those subsets that should resonate with the majority of us. Excluding certain parts of the language will lead to more robust code that is easier to reason about (and more fun to write), I claim. My attempt to formalize it is called "restrict mode for JavaScript" http:/…
I think Resig means to use JSLint throughout, which does something similar. Additionally, browsers already support "use strict" which is also a restricted mode. In short, plenty of people share your views on the matter (me included). The whole thesis of JavaScript: The Good Parts was basically that, and the book is one of the best on the language.
More important than anything I'd like us to start talking about sane subsets of JS more, and stop limiting ourselves to what one author considers "good" because quite frankly, _that_ subsets still contains a whole lot of awful stuff.
Re: John Resig: JavaScript as a First Language
#200For the interested (and with the caveat that I definitely would not suggest it for the Khan Academy's purposes), CoffeeScript does try to address all of the issues that John raises in his post. Type Coercion: There is no `==` in CoffeeScript. You usually write `if x is y` in order to be particularly clear, but if you're in the mode of most other scripting languages, and you write `if x == y`, it will compile to `if (…
And made the mistake of making whitespace significant thereby driving off people in droves.
http://c2.com/cgi/wiki?SyntacticallySignificantWhitespaceCon...