9 ms·
Show HN: A pure functional programming language targeting decentralized systems
- Athas 7y agoI'm always a sucker for parallel functional programming, but I could not find any details on how specifically it works (and importantly: performs) in Clio.
- garritfra 7y agoClio is still in early development. Right now, you are able to host a clio module with multiple workers: https://docs.clio-lang.org/learn/official-tutorial/hosting https://docs.clio-lang.org/learn/official-tutorial/hosting
- jchook 7y agoApparently it works by hosting HTTP or Websocket microservices and communicating between them via JSON. The .clio files transpile to JavaScript, and the project optimistically targets full JS interoperability (e.g. compatible with any of your favorite npm modules). Thanks to the portability of JSON, clio can import functions from any compatible microservice, including those written in other languages. For an example of this, see: https://github.com/clio-lang/python-microservice-example https://github.com/clio-lang/python-microservice-example Besides reading the tutorial, I found this source helpful to understanding how Clio knits the microservices together: https://github.com/clio-lang/clio/blob/develop/host/host.js https://github.com/clio-lang/clio/blob/develop/host/host.js
- vojta_letal 7y agoI'd like to see a thorough performance evaluation. JS/NPM based untyped language together with communication via HTTP/JSON sounds painfully inefficient.
- garritfra 7y agoWell, Microservices built with Node.js are just that :p Node's V8 engine is very fast
- jchook 7y agoIt seems Clio targets an AWS Lambda-style serverless infrastructure, having a network of short-lived, auto-scaling single-function instances, ideally leading to optimal resource utilization, hands-free administration, unlimited scalability, etc... but trading some performance.
- garritfra 7y agoThats one goal we're aiming for.
- OskarS 7y agoWhat does "memoized by default" mean, precisely? Does it literally memoize every single function call? That seems... illadvised.
- garritfra 7y agoPure functions are memoized. They always return the same results so why not memoize? There's an option to disable this. It's currently being discussed in our telegram group: https://t.me/joinchat/B0kZo0kVldfXldTDqz95XA https://t.me/joinchat/B0kZo0kVldfXldTDqz95XA
- sgeisenh 7y agoCheap pure functions should rarely, if ever, be memoized. With a large space of inputs, it is usually much faster to simply execute the function body than to look up the memoized return value. Not to mention the added space complexity of memoization.
- garritfra 7y agoDo you think it should be determined at runtime, if a value should be memoized?
- dwohnitmok 7y agoThis is actually quite difficult to do automatically. A sibling comment lays this out quite nicely. Because memoization often can affect the asymptotic runtime of algorithms (and of course space usage), this can lead to very confusing behavior for a user, if you determine at runtime similarly to a JIT compiler whether to memoize. Imagine an algorithm's asymptotic complexity jumping back and forth between exponential and linear over the course of a program running as the runtime analyzer memoizes and unmemoizes a function call. Since you already have a lazy language, you can direct users to use lazy data structures to achieve memoization. http://jelv.is/blog/Lazy-Dynamic-Programming/ http://jelv.is/blog/Lazy-Dynamic-Programming/
- 7y ago
- vojta_letal 7y agoCould the goals be accomplished in existing languages, such as Rlang, Haskell, Scala + Akka? Is the added value sufficient for it to find its place?
- garritfra 7y agoWe want to provide an easy interface to quickly deploy decentralized services. Compared to alternative languages, the overhead to do so is much smaller with Clio
- 6700417 7y agoThis is pretty much the first question I ask every time I see a new language pop up. The fact is the “language” part of a programming language is the easy part. The hard part is the ecosystem, tooling, mindshare, etc. If your differentiation is “it’s 35% easier to do task A with my new language vs the next best alternative” then I am afraid you’ve lost me and I suspect most potential users. The effort involved in learning your new system isn’t going to be amortized out by the benefits unless the benefits are very substantial. This is coming from someone who really lives to learn new languages and is spending time most everyday working through new problems in new languages out of personal interest. For your average “just wanna get the job done” type you have an even more uphill battle. Having said all that, it can be a great learning experience to build a new language and it’s always possible you’ll influence changes in preexisting systems that do have an existing user base, so I don’t mean to sound too discouraging to aspiring language designers.
- garritfra 7y agoWe discussed the problems with the ecosystems and I think you are right. Clio compiles to JavaScript, so it only makes sense to be 100% interoperable with the npm modules out there. We are currently working on that.
- Silhouette 7y agoThe fact is the “language” part of a programming language is the easy part. The hard part is the ecosystem, tooling, mindshare, etc. This is certainly true, but on the other hand, any new language that will one day be successful needs to start somewhere, or we're going to be writing systems code in bug-ridden C and line-of-business applications in verbose Java forever. A language where doing day-to-day things would be 35% easier than what I use right now is certainly significantly better, IMHO. It seems to me that to move our industry forward by adopting newer and significantly better languages then a new language probably needs some or all of: 1. easy compatibility with a major existing library ecosystem (a simple FFI to any library with a C interface, for example) or a very comprehensive set of standard libraries out of the box and some tolerable way to integrate with more specialised ones 2. compatibility with existing tools or a decent version of the essential tools of its own (where "essential" today probably means something like build system, package manager, debugger, and maybe profiler, plus usable support in editors and things like version control and diff tools) 3. a compelling use case where it is much better than anything out there today, to act as a starting point for everything else to attach to 4. a core group of initial developers who are interested enough to do things with the language and help develop the above.
- kovek 7y agoDoes the Pony language do something similar?
- garritfra 7y agoNo. Pony is aiming for native performance. Clio compiles to JavaScript, and provides tools for decentralized systems.
- rozap 7y ago> and provides tools for decentralized systems. What does this even mean? It's non-obvious from the website.
- garritfra 7y agoTake a look at this: https://docs.clio-lang.org/learn/official-tutorial/hosting https://docs.clio-lang.org/learn/official-tutorial/hosting
- rgbrgb 7y agoThe linked page doesn't say anything directly about decentralized systems (doesn't use the word "decentralized") and the only tutorial I find uses a centralized server + DB (the to-dos one). Could you explain more concretely? Like does it help with NAT traversal or peering? Very interested, thanks!
- garritfra 7y agoWith Clio, you can develop modules and host them, so you can import them via network from another server. You can essentially build microservices as clio modules and build up decentralized systems. Feel free to join our telegram group to discuss about this. We love to hear new suggestions! :)
- qwerty456127 7y ago> It is made to take advantage of multiple CPUs and CPU cores (parallelism) by default Taking advantage of CPUs and CPU cores oes not make a complete parallelism implementation. It should also take advantage of SIMD instructions (SSE, AVX, Neon etc).
- olodus 7y agoSeems to be in the same ballpark as Unison which I got a bit hyped about when it was revealed earlier this autumn. The "memoize" and network foreign function parts is especially same looking, though Unison takes it a bit further. This seems like the more balanced approach to static typed Erlang-ish.