9 ms·
Nim is very attractive to a previous CoffeeScript user like me. I used it to build my own [ClojureScript clone](http://calcit-lang.org/ http://calcit-lang.org/)
by jiyinyiyong 5y ago
Nim is very attractive to a previous CoffeeScript user like me. I used it to build my own [ClojureScript clone](http://calcit-lang.org/ http://calcit-lang.org/), but finally found I really want ADT and pattern matching, which drove my to Rust.
Object variants could support this need. But I was already amazed by those Haskell features.
- deleted 5y ago[deleted]
- k__ 5y agoI still wish for a Rust with Nim syntax.
- arc776 5y agoWhat things do you wish for in Nim from Rust?
- k__ 5y agoLess clutter. I like ML and Python syntax.
- arc776 5y agoThe syntax is what attracts me to Nim too. Why use Rust over Nim in this case? Is it Rust's static lifetime constraints? Is there some feature you would miss if you used Nim instead? Or would you prefer to use Rust because more organisations are using it?
- k__ 5y agoI like the lifetimes, the traits, the pattern matching, but also that it's used by more people, yes
- cb321 5y agoNim's concepts [0] are sort of like Rust's traits or Haskell's typeclasses - maybe more expressive in some ways. Pattern matching can be added on as a simple library and has been done several times, maybe most pedagogically outlined here [1]. Lifetime annotations just seem unproductive to me. Nim with ARC/ORC does have safe [2], automatic memory management without "a GC" or need for lifetime annotations. [0] https://nim-lang.org/docs/manual_experimental.html#concepts https://nim-lang.org/docs/manual_experimental.html#concepts [1] https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matc... [2] https://uploads.peterme.net/nimsafe.html https://uploads.peterme.net/nimsafe.html
- arc776 5y agoThanks for your reply. It's interesting to know what the perceived weaknesses and strengths are. Nim does have pattern matching but it's rarely used, whereas it seems to be used a lot in Rust (probably because of the prominence of enums). Nim has static lifetime management, but it's mainly used for eliding and thread safety (for now). Traits are an interesting feature, and make a good example of why I'm so bullish on Nim: someone has already replicated them with a macro: https://github.com/haxscramper/nimtraits https://github.com/haxscramper/nimtraits The popularity critical mass thing is mainly getting eyes on the language, but I think Nim has a slight advantage in that it's incredibly cooperative with its compile targets and FFI. Like Python, it's great for good glue code and 'scripting' without the performance penalty, and I hope that helps it meld into people's toolboxes over time.
- lostdog 5y agoRust's Result type and `?` operator makes error handling kinda fun. Every language should strive to be this clean.
- elcritch 5y agoNim’s got an Option type, though it’s not as popular as exceptions. There’s also third party option libraries that provide ‘?’ like features.
- lostdog 5y agoHaving a single Result type as standard has a huge benefit. You can do error handling for every library you use in exactly the same way. You also get decent stack traces because the runtime can reason about a single error type. Unified error handling is, IMO, necessary for making a language a pleasant experience.
- arunc 5y agoThey probably mean ownership?
- ewuhic 5y agoI wish for Nim with Rust syntax AND ecosystem.
- odiroot 5y agoSame here, Rust and/or Golang with a Nim syntax would be my favourite.
- The_rationalist 5y agoscala 3 is much more than this and has a modern syntax https://docs.scala-lang.org/scala3/guides/migration/tooling-syntax-rewriting.html https://docs.scala-lang.org/scala3/guides/migration/tooling-...
- k__ 5y agoScala ditched the JVM and has lifetimes now?
- The_rationalist 5y agoLel 1) JVM languages can compile to ELF binaries with GraalVM 2) lifetimes are an antifeature that is not needed outside of niche performance critical purposes. Moreover in the real world it's much easier to produce slower code in low level and non gc based languages. Btw I'm pretty sure SOTA latency critical GCs such as ZGC (<0.1ms max pause time) has outperformed non-gc memory management for latency critical workloads. More importantly the jvm ecosystem has received order of magnitude more resources at optimisation for complex needs (drools,lucene, the whole Apache empire, etc) Rust is a joke compared to Scala featureset.
- vosper 5y ago> Nim is very attractive to a previous CoffeeScript user like me Is modern JS attractive to you as a previous CoffeeScript user? A think a lot of why CoffeeScript died is that they brought the big features into JS.
- haolez 5y agoCoffeeScript's syntax make a lot more sense than ES6, and CoffeeScript 2 compiles down to ES6 primitives. It's a shame that it's usage is pretty low in the industry.
- jiyinyiyong 5y agoNot much, I would say. Something important in CoffeeScript is "everything is an expression". That was a feature in Lisps, in Haskell, in Rust, but would never be default behavior for JavaScript. JavaScript is becoming less odd with modern features, but still far from being liked. a bad aspect of CoffeeScript I see is "it's not an industry language". too flexible, insufficient integrations with standard tools, slow fixes and new features. The industry definitely need as lot of features for pushing and also controlling work.
- The_rationalist 5y ago> I really want ADT and pattern matching I feel like many people go to the Rust bandwagon for the wrong reasons while mosts would benefit more from a higher level and more expressive language such as scala 3
- WithinReason 5y agoADT and pattern matching: https://news.ycombinator.com/item?id=18560497 https://news.ycombinator.com/item?id=18560497