HNHacker News
TopNewBestAskShowJobs

jlongster

7,555 karma · joined May 7, 2009

https://jlongster.com/ (contact me at longster gmail)
submissionscomments
jlongster··on Prettier 1.0
You might be surprised at the quality of the output (obviously I'm biased). We've tried to choose what most people consider to be the best way to style code, and many times prettier ends up formatting complex code better than I would have manually. Also, the biggest benefit that a lot of people don't realize is it allows you to quickly restructure your code easily: http://jlongster.com/s/refactor.gif

I understand if the way prettier formats your code is not the way you would like, and is more of a hindrance than helpful. But I hope the above gif shows why it is freeing for a lot of people.

Also, note that prettier does keep the original blank lines in your code. That's where most of the rhythm comes from, and we allows authors to group code however they want. The rest of it is basically choosing whether to insert a space here or there or not.

I respect your work, antirez, and I hope you at least try it once! It's totally fine if it's not useful for you though.

jlongster··on How I Became a Better Programmer
Holy crap Bob, hi! Thank you for the kind words :) (and be honest, I'm sure there were things to complain about from my projects haha)
jlongster··on Jest 19: Immersive Watch Mode and Test Platform Improvements
> To use power-assert, you need to transform your test code for power-assert output.

That's a pretty big requirement.

I usually avoid the long names like that, but doing `expect(3).toEqual(4)` isn't too bad and it allows the test runner to provide really good error messages.

jlongster··on A Prettier JavaScript Formatter
Check out this issue, we are discussing it: https://github.com/jlongster/prettier/issues/12

Honestly, we may never do it. But we're still figuring out if the ultimate goal is to keep to a single style or not.

jlongster··on A Prettier JavaScript Formatter
It always prints spaces and you can configure the number of spaces with `--tab-width`.

For tabs/spaces and semicolons I'm considering if we should support those options. We need to figure out the goal of the project: is it to converge on generally a single format, or is it to provide formatting options for a few large groups of people that have different opinions. There are issues on the project discussing this right now.

jlongster··on A Prettier JavaScript Formatter
That's actually one of the few config options. Pass `--bracket-spacing=false` to turn off that spacing (or `bracketSpacing: false` in the API)
jlongster··on A Prettier JavaScript Formatter
We do. The entire Flow test suite passes when pretty-printing and re-parsing and comparing ASTs.

There are a very few subtle bugs like the one you mentioned above. As noted in the readme, this is a beta. It's certainly more than an attempt.

jlongster··on A Prettier JavaScript Formatter
Not sure, didn't know it formatted JavaScript! This is written in JS at least so if anything it's more approachable to the community.
jlongster··on A Prettier JavaScript Formatter
esformatter suffers from the same problems as eslint as described in the post. It doesn't take maximum line width into account, which is a critical piece for laying out code.
jlongster··on Announcing OSS-Fuzz: Continuous Fuzzing for Open Source Software
>> "IIRC they still pay Mozilla for making Google the default homepage"

> True.

Not true. Mozilla switched to Yahoo a few years back; Google doesn't give them any money. And it's not the default homepage, it's the default search engine (the default homepage always starts out `about:home`).

jlongster··on Yarn – A new package manager for JavaScript
That big shift will have to happen first. I don't see them ever making their own registry unless 99.99% of people are using yarn and are having a lot of problems with the current npm registry. While I see a lot of people using yarn, I'm not sure about 99.99% and I think npm's registry itself is pretty good.

So I don't think interests will ever align to create a new registry. Nobody wants to do that. That would have serious consquences for the JS community and would take years to recover, in my opinion.

jlongster··on Yarn – A new package manager for JavaScript
Huh, interesting! I thought this was going to just be a client. I wonder if it resolved to npm's servers or something.
jlongster··on You Suck at Excel with Joel Spolsky (2015) [video]
That product is dead: https://www.resolversystems.com/
jlongster··on Create React Apps with No Configuration
It doesn't even support hot reloading. No config means they can make assumptions about how things work which makes it really to share solutions for things like "optimize this for prod" or other use cases that are typically a lot of work for your custom setup.

However, I predict that there will be a softer escape hatch than "eject". At least a single option to take the webpack and config and whatever you want with it, at your own peril. This would be completely unnecessary unless you really Know What You're Doing.

jlongster··on Implementing a Stepping Debugger in JavaScript
The compiler may not because it uses a few node APIs, but those could be easily ported. The compiled code should definitely run; it's vanilla ES5 JavaScript.
jlongster··on Implementing a Stepping Debugger in JavaScript
Nah, there is nothing from this that will benefit the Firefox devtools. It is an interesting space for me to play with ideas that would be a lot harder with native JS engines, but that's all.

We are working on a new debugger interface, so stay tuned about that :)

jlongster··on A Farewell to FRP
I don't know anything about Elm subscriptions yet. But there is a lot more to this stuff then just event emitters.

Things like:

* When an event/action/etc comes through, does it always call listeners synchronously? Can you change that and schedule events manually?

* How do you compose subscriptions/event handlers? This is usually the hardest part, and where simple event emitters really start breaking

* What about the lifecycle of the listener? What happens when it subscribes or unsubscribes? More importantly, what happens when the source that it subscribed to "shuts down"?

All of these things get pretty complicated and is the reason why various fields like FRP exist. Simple event emitters work immediately, yes, but they are a pretty terrible abstraction to build an app on.

jlongster··on Two Weird Tricks with Redux
My post says exactly this. Read the full thing. There are other cases where you do not have a reference to the promise. (think a function being called again at some indeterminate time)
jlongster··on Two Weird Tricks with Redux
If you are waiting for a "done" async action (which is usually the case if using this), you might want the action to inspect the value that it was resolved with. We use this in tests: https://github.com/mozilla/gecko-dev/blob/master/devtools/cl...

Tests can wait for an action to be dispatched and the promise is resolved with that action, and tests can inspect it.

jlongster··on Two Weird Tricks with Redux
Basically a UI optimization. Instead of firing multiple requests to the server a lot, we know that a specific UI event may happen multiple times in a short period, so we "throttle" it by only performing the request once at a time and only re-requesting it if it was requested again.

So far it's always been a UI optimization like that.

You could handle this at the connection layer, but I liked how it integrates with actions better (it gives a finer control over when actions are dispatched)

jlongster··on Two Weird Tricks with Redux
There are many reasons why the UI should not care about how the server requests are ordered.

> When I don't want to handle an async response anymore I remove the handle's association with the event it was going to handle. It works like this in native DOM, jQuery, even my own bias data point: msngr. But I'm curious why wouldn't redux be able to handle the same case?

In our case we use the same connection but it switches "contexts" and we want to ignore everything from a previous context. In simpler situations you could make sure the your connection is destroyed before the UI is destroyed, yes.

jlongster··on Untangled: A ClojureScript-Based Webapp Framework
The colocated queries on the frontend components are not datomic queries, Om Next has its own query language which is similar but the backend needs to translate it into datomic queries so you implement whatever security you need there.
jlongster··on Microsoft, Google, Facebook Back Apple in Blocked Phone Case
Mozilla should as well: https://blog.mozilla.org/blog/2016/02/24/continuing-the-conv...
jlongster··on Why We Use Om, and Why We’re Excited for Om Next
You mean the component tree? Sure, it can mixed in whatever way the component tree wants it.
jlongster··on Why We Use Om, and Why We’re Excited for Om Next
Action creators do not read anything from the state. They are only for mutations. You read from the state by literally digging into the JS object.

Not sure what else to say, actions and queries are completely different things.

jlongster··on Why We Use Om, and Why We’re Excited for Om Next
No, Redux is far more like Om Now. In fact, Om Now was one of the early influencers for the single atom app state idea. The only difference is that, instead of using cursors, Redux uses flux-style actions for mutations. You select data from the app state by digging into the app state manually, exactly like you would in Om Now.

It's a common misconception (I fell for this too) that simply having a single atom app state and colocating state accessors with the component is similar to this architecture. It's really not. The query syntax is an extremely important part here, with transparent server syncing, and support for arbitrary graph representations of the state.

jlongster··on Why We Use Om, and Why We’re Excited for Om Next
I'd say 90% is pretty good for a single person. Open-source requires a community to work.
jlongster··on Why We Use Om, and Why We’re Excited for Om Next
I don't think it's that's simple. It's not that it works better for hugely complex apps. It just works better for certain kinds of apps, even if they are small. The project I'm working on is small, but Om Next is far better suited to it (the complexity of using Redux+Redux/etc on it would be far greater).

The question is, are the majority of apps better suited for a tree-based state or a queryable graph? I'm not sure, but it's at least even.

I've heard Elm is working on something similar, so I wouldn't be surprised if that happens.

jlongster··on Why We Use Om, and Why We’re Excited for Om Next
There's a basic start to a remote syncing tutorial here: https://github.com/omcljs/om/wiki/Remote-Synchronization-Tut...

Basically, you specify a query as a remote query and it calls a `send` function that you specify, and you manually pass the query to the server to execute, which will return results and automatically be merged into the app state (and of course, re-render components that depend on that query).

For the part where they stop making that request, they must do custom lifecycle code so that when the component unmounts, they are able to access current open requests (probably indexed by component manually) and cancel it. That part is not builtin to Om Next.

jlongster··on Why We Use Om, and Why We’re Excited for Om Next
Elm's HTML engine conceptually the same as React+Redux and Om Now. It's just a big single atom app state with ways to describe how to update it. It has all the same problems as Om Now (maybe not quite as bad because it doesn't have cursors, but it doesn't solve the data-as-a-graph problem).
← PreviousPage 4 of 21Next →