4 ms·
Initially I got excited about CS, until I discovered that it forbids shadowing and conflates variable declaration with assignment at the same time, leading to r
by spion 13y ago
Initially I got excited about CS, until I discovered that it forbids shadowing and conflates variable declaration with assignment at the same time, leading to random bugs happening all over the place as I introduce a name that I've used somewhere in a deeper scope. No, identifier names are one of the big problems of all languages and CS gives you even less name locality. Bad.
- ricardobeat 13y agoI found it helps clear up your naming habits and avoid short names, which are a major source of opaqueness in code.
- spion 13y agoOn the contrary, short names are a source of clarity and expressiveness. Humans convey so much information through context, and shadowing nicely allows us to at least approximate that. But I would be okay with this stance (yet would not use coffeescript) if the language had a mechanism to warn you when you're trying to reuse a name. Instead the language's features combine in a way that will clobber your code and lead to subtle or not-so-subtle bugs.
- rmrfrmrf 13y agoI'd argue that that's a feature. You're asking for decreased code comprehension and bugs when you start using identical variable names everywhere. I have noticed a lot of "Issues" in the CoffeeScript repo from angry hackers that were mad that CoffeeScript forces them to code with some modicum of responsibility (no drop-throughs in switch statements, no var shadowing, etc.). Doesn't make sense to me why people would blast JavaScript for letting you do stupid shit then get butthurt when a solution takes those same problems away.
- spion 13y agoNo, I'm not asking for bugs. I'm asking for a basic feature of natural languages: to define a context where I work, where short, concise words have a precise meaning. This is an elementary thing - its the basis behind namespaces, the drive behind object oriented programming. Its a fundamental design mistake to put limits on this. But its worse, because its also a silent mistake. Shadowing could be forbidden but variable declaration and assignment could still be different things, and then the compiler could warn you when you try to re-use a name. But no, coffee script will give you random bugs instead. JavaScript has its rough edges. CofeeScript simply has a rot right in its core.