HNHacker News
TopNewBestAskShowJobs

chenglou

1,295 karma · joined March 19, 2013

https://github.com/chenglou/ https://twitter.com/_chenglou https://shadertoy.com/user/chenglou
submissionscomments
chenglou··on Show HN: Stencil – Simple code templating for Go
You mean piping into editors? I'm working on something related; most editors don't handle cursor repositioning very well when you dumbly refresh the content without going through editor-specific APIs.
chenglou··on Snake in Elm with WebGL
I work on Reason, which is something you might like: http://facebook.github.io/reason/

Elm has been personally an inspiration too. Nice set of decisions and tradeoffs for what they're trying to achieve, though yeah, mainstream syntax might not be one of them, but that's fine.

chenglou··on A First Reason React App for JavaScript Developers
Algebraic effects are kinda related to monad.

Btw the ReasonML you're talking about is still just a syntax transform; you're really asking whether OCaml/BuckleScript has these implementations. There's no generators; but I do believe they can be built on top of algebraic effects.

Regarding jargons: you don't have to worry about that =). Though I think what's more crucial is the way the jargons are conveyed, rather than the meanings themselves. I work in the ReactJS community, and there's basically as many jargons (some of which I myself don't quite understand...) as in FP, yet people seem fine with them. We're still not gonna go "monad this monad that" like you feared. Though if the JS community starts picking up terms like monads in the future thanks to Reason, then all the better.

chenglou··on A First Reason React App for JavaScript Developers
I work on Reason, so I think I'm relatively unbiased enough to address this. JavaScript's widely popular, disregarding why it's come to be this way. Any language this popular (and with a history of being used in a different context, nonetheless) ends up having warts and being used by folks who are sometimes less skilled.

In that regard, "jumping on the types bandwagon like it's some new discovery" is exactly right, because it's indeed lots of people's first language. But I don't see why this should sound so negative. Newcomers are now introduced to types and they're amazed by them. That's welcomed and we shouldn't feel they're taking away our own shiny toy and tainting them or whatever.

I think it pays to be nice to beginners. Sure, you don't get the usual quality you're looking for in a niche expert language where communications are atomic, on-point, and lossless, but that's _OK_. All in all, things like a better type system, better language semantics and better paradigms are still worth fighting for.

chenglou··on A First Reason React App for JavaScript Developers
I think you meant "algebraic effect", which most mainstream languages don't have: http://kcsrk.info/ocaml/multicore/2015/05/20/effects-multico...

Algebraic data types are a basic feature.

chenglou··on A First Reason React App for JavaScript Developers
I work on Reason and I used to help with React

* Yeah! I know I'm pure-hearted at least

* JavaScript will be around for a long time. Our stance is more gradual improvement than world-breaking changes all over the place. I'm still trying to phrase this correctly, because sometimes when Reason gets mentioned, the immediate reaction is "wow they're gonna rewrite everything again, kids...". Our interop story is pretty damn good. Please check it out!

* See ReasonReact's license =)

* The more successful Reason is, the less we'll drink. Kidding

Our discord channel is at discord.gg/reasonml. I think we're a bunch of pragmatic and nice folks. It'll take time for people to understand our stance, but blog posts like these really help showing what we're doing.

chenglou··on Differences between Tmux vs Screen (2015)
Atom's Nuclide remote feature does that. We edit codebase on remote servers.

The alternative, and maybe a better way to do this, is a FUSE-like system, like Expandrive. Lazily fetches files from remote.

chenglou··on TypeScript at Slack
I work on Reason, mentioned above. The goal of Reason is exactly to expose a polished layer over the OCaml toolchain: http://facebook.github.io/reason/

Give it a try! Ping us if you need to: https://github.com/facebook/reason#community

chenglou··on A set of efficient persistent immutable data structures for Reason and OCaml
They are the same. I don't think cies was implying they were different.
chenglou··on A set of efficient persistent immutable data structures for Reason and OCaml
If you're still willing to give it a second chance, we've got https://github.com/chenglou/reason-react-example which uses only npm Sorry for the crappy initial experience.
chenglou··on A set of efficient persistent immutable data structures for Reason and OCaml
Ooooouh that's harsh lol. Sorry for your experience. We're trying to improve it but we're a tiny team that also maintains other features.
chenglou··on A set of efficient persistent immutable data structures for Reason and OCaml
Converted. From reactjs to reason-react https://github.com/reasonml/reason-react

Which imo is a bigger achievement! Being able to gradually convert a js codebase over is one of our main goals.

chenglou··on A set of efficient persistent immutable data structures for Reason and OCaml
I work alongside the Reason team. We're using it on messenger.com. 25% converted over already. 4 bugs during conversion, and only a single runtime bug in the converted part since last half.
chenglou··on What else are we getting wrong about programming languages?
Is there a programming language/research area dedicated to the transitioning of one library API to the next?

For example, I depend on Foo v1, and would like to upgrade to Foo v2. Currently mainstream languages either use a type system to indicate the upgrade was unsuccessful (can't catch everything, and still require the user to patch things), or allow the user to muddle along, knowing things might break subtly but not enough to be "bothersome" (e.g. node ecosystem).

So one Foo upgrade is costing O(n) in refactoring cost where n = dependents of Foo. Given enough patience the Foo author could make an adaptor between v1 and v2 to reduce it to O(1) upgrade (inside Foo itself), but this is asking so much that nobody sensibly do it, except for big projects which provide great migration warnings, codemods, bridges, etc.

This, combined with, say, plaintext structural sharing/diffing between library versions (so that code size doesn't blow up if you have 5 transitive dependencies on Foo), might solve two important problems of dependency/versioning hell imo, and keep software as fresh as realistically possible.

I understand the general version of this is uncomputable, but that's my question: is there research on constraining the expressivity of an language just enough to make version upgrade of a library mostly automatable? Here's an idea: first-class support for fetching the code of a transition between v1 and v2, half-automated by the language & tools, half community-maintained & uploaded to a dedicated place. Alternatively, push as much as possible to data instead of functions, to make writing transition code (which would simply be massaging data from one form to another) much easier, like GraphQL deprecation strategies (https://facebook.github.io/graphql/#sec-Object-Field-depreca...)

Real-life example: two React.js components written under two different React versions naturally don't interoperate. You can't include one inside another. Right now you "can", but this is thanks to sheer human effort from React.js to maintain backward compatibility, so components using React 15 work with components using 14, etc. Same for Java, Windows, and others. The language doesn't help you with that at all. Semi/fully automated version transition/code generation would be a killer language feature.

chenglou··on Announcing BuckleScript 1.0
No email list for now. We'll be active in the chat rooms and HN though.
chenglou··on Announcing BuckleScript 1.0
There's a crucial distinction! OCaml's compilation command takes in a `-pp` flag (preprocessor), which accepts a command that takes in a file and outputs an OCaml AST tree. We're basically using that. In that sense, the official OCaml syntax is really just that: another syntax like Reason, but official, and goes back two decades.

Because of the clean mapping from one syntax to another, you can toggle between the two fairly easily: https://github.com/facebook/reason/wiki/Newcomer-Tips-&-Tric...

chenglou··on Announcing BuckleScript 1.0
Think Elixir for Erlang.

Currently it's a syntax on top of OCaml. But we'd like to polish the OCaml ecosystem tooling too; we're calling the umbrella project "Reason".

chenglou··on Announcing BuckleScript 1.0
I'm on the Facebook Reason team, and we're using BuckleScript to compile OCaml into the best compiler output I've ever seen. People didn't recognize that my React components were generated, not hand-written.

BuckleScript's author (hongbo_zhang here) has been incredibly responsive and welcoming.

We'll be publishing the React.js binding on HN in a few days. Stay tuned! We (including Hongbo) are all sitting in irc #reasonml and https://gitter.im/facebook/reason

chenglou··on Destroy All Ifs – A Perspective from Functional Programming
There are languages (libraries) that solve it. For reference, check Clojure's multimethods and OCaml's polymorphic variants.
chenglou··on MLton with Realtime GC and Threading Features
The Reason team at Facebook (http://facebook.github.io/reason), I myself included, are working on the syntactical aspect & more. Lots of OCaml's pitfalls are low-hanging fruits (imo), and we're actively fixing them.
chenglou··on Servo Nightly Builds Available
OS X also has acceleration when you scroll enough. These are extremely useful on long lists.
chenglou··on Servo Nightly Builds Available
Is the scrolling behavior on OS X custom implemented, just like on Firefox? Imo it hits the uncanny valley unfortunately, especially for edge bounce back. Otherwise, excited to try this out more.
chenglou··on Reason: A new interface to OCaml
I've worked on the Atom plugin for this, itself written in Reason and compiled to JS using js_of_ocaml: https://github.com/facebook/reason/tree/7f3b09a75cacf828dd6b....

Having worked with Reason, JavaScript, and the bridge between the two, most of my errors seem to fall on the JavaScript side. So I guess the type system's indeed working =).

chenglou··on Reason: A new interface to OCaml
The pipe operator's still there.
chenglou··on Reason: A new interface to OCaml
No, the sugar's still there.
chenglou··on Reason: A new interface to OCaml
Reason will have modular implicit. It's really just OCaml under the hood.
chenglou··on Reason: A new interface to OCaml
Fixed. Seems to be a box-shadow issue on FF. Sorry for the trouble...
chenglou··on JavaScript async/await implemented in V8
To give a brief "explanation", look at the type signature of a callback-based API:

  readThisFile: string -> (string -> void) -> void
Usage:

  readThisFile('foo.txt', result => ...)
You have a double void here. Which is the hand-wavy justification as to why callbacks don't compose. On the other hand, a promise's value is Promise<actualTypeOfValue>, which you can pass around as data without asking the other end what it wants to do with the value (aka decoupling). You do have the imperative action at the top to kick the whole chain into motion, but the intermediate stuff are most of the time side-effect-free.

Hopefully that was clear enough to see that passing actions around is akin to controlling the flow with e.g. if-else, and that passing data around is declaring how your tubes/rail tracks/whatever analogy for monads are constructed, aka data flow.

chenglou··on In the Age of Google DeepMind, Do the Young Go Prodigies of Asia Have a Future?
I mean, that's like asking whether marathon runners have a future now that we've got cars. Exercising one's brain/having pleasure through the game could be an end in itself, and is independent of how machines perform.
chenglou··on Children who see clearly underwater
Can you elaborate on the finger trick? I can still only focus outward (aka blurring, if that's what you mean)
← PreviousPage 5 of 9Next →