3 ms·
Flux is almost a subset of Javascript. There are only two exceptions. Our pipe forward syntax, which I've seen proposed for Javascript, but who knows if that's
by pauldix 8y ago
Flux is almost a subset of Javascript. There are only two exceptions. Our pipe forward syntax, which I've seen proposed for Javascript, but who knows if that's going to happen. And the other is our named parameters with optional defaults. You can get close to this in JS by passing an object literal combined with destructuring.
However, there are other things we'll probably be adding to the language over time. Also, if you're only allowing a subset of JS, is it actually JS anymore? I'd imagine that some JS programmers could get frustrated when things they think should work (because they're valid JS) don't because they're not in the subset.
But say we went with that. Then we'd need to adopt an existing JS engine (most likely written in C++) and then modify it based on our needs. And then integrate that into our broader Go codebase. All of that seems a bit less than ideal.
Ultimately, I really do feel that if you're someone that knows Javascript, you can learn the elements of the Flux language in less than an hour. The bigger learning curve is the library of functions and the API, which would exist regardless of what language we chose.
I think the proof will come over time based on what kinds of things we enable in the language and the platform. In the near term I expect a large number of totally reasonable people to question the choice of a new language. After all, that's probably the rational response. But as we improve it, add to it, refine it, and improve the developer and user experience, I expect to win more converts. Developers pick up new tools because they enable them to get their jobs done faster. Ease of use, speed of development, and productivity are our guiding lights.
- alexk 8y ago> But say we went with that. Then we'd need to adopt an existing JS engine (most likely written in C++) and then modify it based on our needs. This is definitely not an easy choice to make and writing a new language interpreter in Go seems a way easier approach initially. One thing that Go helped me to understand though, is that the language does not matter so much as the tooling around it - debugging, compiling and support around the language are way harder to achieve than writing a language parser. Thanks for sharing your thoughts on this design choice, I think this discussion is very relevant for a couple of reasons: There are other Go projects that are taking the same approach to achieve simplicity and not picking the existing language, like OPA [1]. Others, like Helm are picking Lua [2], so there is clearly a problem the Go and infrastructure community is facing and split in the way people are approaching it. We've faced the similar dilemma with Teleport, as we are designing our extensions system. My original plan was to use Lua, however after discussions with the team we settled on GRPC with Go [3], trading expressiveness/simplicity and freedom of lua/js languages in favor of industrial features Go runtime and GRPC provides out of the box. For smaller extension plugins we decided not to create a new language, and ended up with interpreted subset of Go [4]. I wonder if there is a place for some subset of javascript or typescript that is fully interpreted by Go, with native extensions for debugging to be used by the community. [1] OPA policy agent https://www.openpolicyagent.org/ https://www.openpolicyagent.org/ [2] Helm 3.0 Lua plugins https://github.com/helm/community/blob/master/helm-v3/005-plugins.md#lua-plugins https://github.com/helm/community/blob/master/helm-v3/005-pl... [3] Teleport Plugin Design Document https://docs.google.com/document/d/1sPXXxx03P8VXWy-YD5w190g7VVoDFV96DAe3Q8z81gE/edit?usp=sharing https://docs.google.com/document/d/1sPXXxx03P8VXWy-YD5w190g7... [4] Subset of Golang https://github.com/vulcand/predicate https://github.com/vulcand/predicate