4 ms·
All I'm thinking is that people should start using JSLint instead of making up languages on top of JS. That will catch most of the bugs due to common misunderst
by Seldaek 15y ago
All I'm thinking is that people should start using JSLint instead of making up languages on top of JS. That will catch most of the bugs due to common misunderstandings of the language.
- technomancy 15y agoJSLint can't solve the "I forgot to include a frickin' explicit return again" problem, can it?
- Seldaek 15y agoThat's a first world problem of ruby devs I think. When you're used to it, you never forget to write return statements.
- Confusion 15y agoRuby is far from the only language that is commonly used without explicit return statements (and it at least has them). It's just currently the most popular one.
- rubergly 15y agoAgreed. I hardly think that people who haven't used languages like Ruby or Coffeescript (with implicitly returning the last expression) ever forget return statements in a way where everything would be okay if they just added a "return" keyword. When I use Ruby and Coffeescript, I consciously have to think "no, I _shouldn't_ write return this time"; I find it hard to believe that, without using a language like this, anyone would just write an expression and expect it to be returned. I could see an argument that if you're returning the application of a function, but it has always seemed extremely natural to me that I think about what I'm returning when I write a function; I actually always have a little bit of trouble adjusting to writing Ruby-style return-less code.
- rawsyntax 15y agoit depends on how you think of functions... If you think of everything as an expression, of course it has some kind of value. That being said I prefer not to have to write "return" but work plenty with languages outside of ruby and have no issues writing return when necessary.
- technomancy 15y ago> it depends on how you think of functions... If you think of everything as an expression, of course it has some kind of value. Sure, and functions by definition return a value. I know programming isn't math, but the notion of a "void function" is somewhat of an oxymoron.
- technomancy 15y agoRuby, Lisp, Smalltalk, Python, Forth, Perl... Nearly anything that's not a descendant of C or Basic lets you write in terms of expressions.
- jacobolus 15y agoIt also can't solve the "`function () { return … }` is syntactically very heavy" problem.
- mikemaccana 15y agoAt JSConf yesterday, Brenden Eich (creator of Javascript) specifically said he thought CoffeeScript's syntax was fantastic. He also stood on stage with the CoffeeScript author while he talked about ways to get errors in CS to return line numbers in CS source, rather than JS.
- deleted 15y ago[deleted]