Hacker News new | ask | show | jobs
by RomanPushkin 3896 days ago

			  ));
			}); // I
		  }); // love
		}); // TypeScript
	  }
	}
Actual code from the article above. Just added comments.
3 comments

That code has nothing to do with TypeScript. First of all, it's a side-effect of JavaScript syntax, and it's also a really strange way to write code. This author's code doesn't seem simple or easy to reason about to me, partially because it's hard to read.
Trailing parents/braces seems like a bad reason to dislike a language. Ever heard of Lisp? :)
Presumably that's why some people dislike Lisp too.
Is that a valid reason? I know that personal taste plays a strong and important role but typescript is really cool.
I didn't like Lisp for a long time because of it, I've since given up and tried Lisp. My friends don't care for Lisp probably because of that as well.
I could get over the parentheses but CAR and CDR instead of HEAD / TAIL or FIRST / REST annoy the crap out of me.
CAR means Content of Address part of Register and CDR means Content of Decrement part of Register. They were tied to the 36-bits nature of the first LISP machines, with 15 bits to CAR and 15 bits to CDR (plus 2 bits for tags IIRC).

So its not just naming keys in a structure, those had a very low level meaning related the the implementation of the CONS cell structure in hardware.

I have no idea about the veracity of the claim but this page[0] contends that Lisp has had first/rest since 1959.

[0] https://en.wikipedia.org/wiki/CAR_and_CDR

Perfectly valid. If it's difficult to read, it's difficult to use.
I agree. And it seems to me that it wasn't language issue, but lack of encapsulation. I also don't find those cons of using CoffeeScript convincing enough. Have these guys tried TDD? If you use TDD you'll probably find accidental overwriting out-of-scope variable in a matter of seconds. Because you should never rely on language syntax.
Once async/await support make it into TypeScript, it should be a lot cleaner dealing with promises. It's already in Babel, and imho I'm fine without the typing as long as modules are minimalistic, organized and straight forward.