HNHacker News
TopNewBestAskShowJobs

slikts

272 karma · joined October 7, 2011

[ my public key: https://keybase.io/slikts; my proof: https://keybase.io/slikts/sigs/Yg7YirrQaVsun4cTHhrCUvT5OShLMjuGvHFudwLY8qE ]

Verifying my Blockstack ID is secured with the address 1GypFJtCV2dG5kH8JWuCNNxE6ENLpRcEVu https://explorer.blockstack.org/address/1GypFJtCV2dG5kH8JWuCNNxE6ENLpRcEVu

submissionscomments
slikts··on JavaScript is Good, Actually
Having to explicitly mark where the control flow goes to the event loop with `await` is a very small price to pay for making the code much more clear. This is why I don't recommend node-fibers or deep coroutines in general.

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··on JavaScript is Good, Actually
Elm stands out in this regard, as it gives fairly robust guarantees of no runtime errors, so the debugging you'll do when working with Elm will almost always be limited to its compiler or Elm Debugger. The price to pay for this is limited interoperability with JS, but it may be acceptable to trade interop for type safety, depending on the use case.

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··on JavaScript is Good, Actually
The criteria for this list of languages seems to have been "isn't JS". The story for metaprogramming in JS certainly is limited in some aspects; for example, there's no operator overloading and JS isn't homoiconic like lisps, but between dynamic inheritance in older JS and the newer additions like proxies, symbols, accessors, reflection API, protocols and being able to extend the 'exotic' behavior of arrays, JS can probably still do whatever the snippet you posted is supposed to illustrate.

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··on JavaScript is Good, Actually
The generators or async/await in JS are 'shallow' coroutines because you can only `yield` or `await` in the direct scope of a generator or async function, but the benefit of shallowness is that the control flow is explicit; you don't have to consider whether a function call will suspend the calling context's execution or not. I find the explicit clarity to outweigh the reduced power of shallow coroutines.

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··on Hard-won lessons: Five years with Node.js
There is no interpretation involved; V8 has an unoptimized base compiler for compiling JS to machine code one function at a time, and a pair of optimizing compilers that work based on runtime profiling. V8 also has a bytecode interpreter for low memory devices, but it'd mainly be used on very low end mobile devices.
slikts··on Hard-won lessons: Five years with Node.js
V8 compiles to native code with the exception of low memory devices (512M or less), for which it has a (relatively recently introduced) bytecode compiler, so it uses an interpreter in that one case.
slikts··on Disadvantages of purely functional programming
You're confusing first-class and higher-order functions.
slikts··on Show HN: Abstracting APIs with ES2015 Proxy – promisifying Chrome and Node
I wasn't anywhere near as fancy and just collected the callback methods from the Chrome docs with a snippet pasted in browser console.
slikts··on How to Use a Generator Function as a Constructor
Just, why… Pass in a parameter if you need to set the state, no need to mess with the context.
slikts··on Informative YouTube channels
The shortcuts are actually Shift+> and Shift+<.
slikts··on Informative YouTube channels
The shortcut is actually Shift+>.
slikts··on Informative YouTube channels
As someone who frequently watches videos, changing the tempo is very underrated, as there's usually no good reason to waste time watching people talk at their natural speed. I used to do this with VLC (it can stream YouTube), but YouTube's HTML5 player now implements tempo adjustment as well, and I use the ImprovedTube Chrome extension to set the tempo to 1.5x by default. It can be conveniently changed with the keyboard as well (Ctrl+< and Ctrl+>). Discovering this has been a game changer with regard to watching technical videos.
slikts··on Informative YouTube channels
I have YouTube set to 1.5x tempo by default (with an extension), and watch things at 2x if possible (Ctrl+> is the keyboard shortcut for upping the tempo). Reading is still faster, but not by that much. Ctrl+F is still a problem, though, but for that you can typically find a different source.
slikts··on The Systemd Project Forks the Linux Kernel
Yeah, there's no such surname as "Готяович"; it's made up.
slikts··on Grad Student Who Shook Global Austerity Movement
Straw-man much? I just said that it's funny to hold up Paul Ryan as an exemplar of sensibility.
slikts··on Grad Student Who Shook Global Austerity Movement
Sensible people like Paul Ryan? Now, that's rich.
slikts··on Grad Student Who Shook Global Austerity Movement
There's a difference between "papers" and "every other paper". Instead of a consensus, economists are split into camps over the question whether austerity harms or improves economic growth. There's been criticism of austerity even from the IMF, for instance. Discrediting Reinhart and Rogoff's paper (published without peer-review, by the way) in particular is important because they were the first to collect and analyse data from so many sources and their results couldn't be replicated and are now shown to be incorrect.
slikts··on Grad Student Who Shook Global Austerity Movement
> Nor is this surprising; the reason nobody looked too closely at the numbers is because they agree broadly with every other paper and model out there.

The data Reinhart and Rogoff used hadn't been analysed together before so their work was original, and it got widely cited. The results failed to be reproducible, and now the analysis has been found to have multiple methodological errors, of which the spreadsheet error is just a minor component. Reinhart and Rogoff didn't cause austerity, but they published a high impact paper supporting austerity that has now been discredited. Also, it would be interesting to know how you get the impression that their results "agree broadly with every other paper and model out there".

slikts··on WYSIHTML5: A better approach to rich text editing
Looking at the examples, I don't understand how this is "a better approach" to editing, because the HTML it outputs does not follow best practices. The HTML it outputs should look like a competent human had authored it, but currently it uses line-break hacks for paragraphs instead of semantic paragraph elements (two &lt;br> elements aren't really a paragraph, it just looks like it), adds underline elements with Ctrl+U (these should be reserved for links and defined in stylesheets anyway) etc.
slikts··on WYSIHTML5: A better approach to rich text editing
Looking at the examples, I don't understand how this is "a better approach" to editing, because the HTML it outputs does not follow best practices. The HTML it outputs should look like a competent human had authored it, but currently it uses line-break hacks for paragraphs instead of semantic paragraph elements (two &lt;br> elements aren't really a paragraph, it just looks like it), adds underline elements with Ctrl+U (underlines should be reserved for links and defined in stylesheets anyway) etc.
slikts··on Dotfiles.github.com - A guide to dotfiles on GitHub
It's a user page, so not by github
← PreviousPage 2 of 2