slikts | 7 years ago | on: JavaScript Equality Minesweeper
slikts's comments
slikts | 7 years ago | on: Agent Maps – OS Library for Simulations Atop Maps
slikts | 7 years ago | on: AMA with Substack and Matt Taibbi about a new business model for journalism
slikts | 7 years ago | on: AMA with Substack and Matt Taibbi about a new business model for journalism
slikts | 7 years ago | on: AMA with Substack and Matt Taibbi about a new business model for journalism
slikts | 7 years ago | on: AMA with Substack and Matt Taibbi about a new business model for journalism
slikts | 7 years ago | on: AMA with Substack and Matt Taibbi about a new business model for journalism
slikts | 7 years ago | on: JavaScript is Good, Actually
The Function constructor is a better alternative for eval(), but still only as a last resort. eval() itself has no use cases.
I find that most JS criticism is ill-informed, because people are too quick to jump to blaming the language due to its reputation. Not that I'd call JS a great language, but it has redeeming aspects.
slikts | 7 years ago | on: JavaScript is Good, Actually
for-in is a legacy feature; due to dynamic inheritance, it's generally not safe to use without also calling Object#hasOwnProperty() every iteration. for-of is not for "array elems", it uses the iteration protocols that are implemented for all built-in collection types, not just Array, and some DOM types, and can be implemented for any user types. Protocols are a much more flexible and clean approach to metaprogramming than overloading the for-in looping construct would be.
You can't use Proxy if you need to target legacy browsers like IE9, and Vue needs to, since it's about 15% of all browsers.
slikts | 7 years ago | on: JavaScript is Good, Actually
slikts | 7 years ago | on: JavaScript is Good, Actually
Destructuring would make your example look better: foo({ui, commit, objs}), and then there's no need for typing out ctx. Another thing that's not needed with for-of loops is .iterate().
Using eval() is a very strong anti-pattern, and it's not needed there anyway. JS has the `with` statement that allows running code with a specific context, but its use is discouraged as it's really bad for readability and hard to optimize.
slikts | 7 years ago | on: JavaScript is Good, Actually
Generally, the alt-js languages provide 'source maps' so that developer tools know to map errors in the 'transpiled' code to their source, and it's possible to avoid JS to a practical degree.
slikts | 7 years ago | on: JavaScript is Good, Actually
As a concrete example, here's a library I made that relies on symbols and dynamic inheritance to extend the built-in data types: https://github.com/slikts/symbol-land
slikts | 7 years ago | on: JavaScript is Good, Actually
As an aside, there exist green threads in JS, namely node-fibers, although it's only a Node.js extension.
You actually can reflect on module exports and dynamically change them with node modules; you can't do it with ES modules, but that has the significant advantage of enabling static analysis.
Proxies absolutely can trap the property assignments you mentioned, but Vue can't take advantage of this because Proxy can't be polyfilled in older browsers.
As for the enumerate handler, it would only have worked with for-in loops, which are a legacy feature. The iteration protocols used by for-of are a much more flexible solution. It might seem silly to have both for-in and for-of loops, but the context of the language is that it can't just go and break older websites. Same goes for == and ===, etc. Linters come in very handy for dealing with this.
Your criticism is better than most, which usually just point out some "wat" moments with mis-features like implicit coercion, but you didn't really make a case for having to do "all things by hand" in JS.
slikts | 9 years ago | on: Hard-won lessons: Five years with Node.js
slikts | 9 years ago | on: Hard-won lessons: Five years with Node.js
slikts | 9 years ago | on: Disadvantages of purely functional programming
slikts | 9 years ago | on: Show HN: Abstracting APIs with ES2015 Proxy – promisifying Chrome and Node
slikts | 10 years ago | on: How to Use a Generator Function as a Constructor
slikts | 10 years ago | on: Informative YouTube channels
A lot of people seem to have a perception of languages as being handed down by some language gods, and apparent problems with the language get explained away by "mere users" lacking knowledge, perspective, discipline, etc.