11 ms·
I really enjoy the language so far. For me, it's the perfect middleground between C and python: a fast compiled language, and one where you can be as productive
by idlewan 13y ago
I really enjoy the language so far. For me, it's the perfect middleground between C and python: a fast compiled language, and one where you can be as productive as in python.
I also tend to prefer catching errors early, and having a typed language that warns and errors at compile-time is great.
- joshbaptiste 13y agoheh.. sounds like Go
- randallsquared 13y agoIt's a lot more complicated than Go, but in return you get generics, templates, and AST macros.
- klibertp 13y agoLess opinionated. Supports generics. And meta-programming seems much more advanced. I'm particularly happy to see hygienic macros.
- idlewan 13y agoWith Nimrod's macro, you can do awesome things. It can improve readability a good deal. Here's an example I made: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/nawak/nawak_app.nim#L44 https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast... Go version: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/go/src/hello/hello.go#L92 https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...
- skybrian 13y agoThe Nimrod version is shorter, but it seems harder to tell whether error-checking is done right.
- idlewan 13y agoNimrod has exceptions. I am catching them (https://github.com/idlewan/nawak/blob/specialpages/nawak_mongrel.nim#L58 https://github.com/idlewan/nawak/blob/specialpages/nawak_mon...) and returning a 500 error page with the detailed exception message. So you need less explicit error-checking everywhere with a language that support exceptions.
- pjmlp 13y agoGo is not that modern, for those of us that know the alternative world of Algol family of languages.
- TheCoelacanth 13y agoGo basically only has one modern feature (goroutines). Beyond that it's a throwback to Java version 1.
- skybrian 13y agoGo interfaces are also new.
- fedesilva 13y agoI hear people saying this all the time. Why? For me they are similar to type-classes+records but without polymorphism. Care to elaborate?
- klibertp 13y agoI looked at http://golangtutorials.blogspot.com/2011/06/interfaces-in-go.html http://golangtutorials.blogspot.com/2011/06/interfaces-in-go... and the only new aspect of Go interfaces I see is that they are implicit - they are considered implemented if the type implements functions that interface defines and you don't need to explicitly write "implements Something". This is a handy shortcut, but it doesn't look like a "serious feature". It also looks a bit like polymorphic variants in OCaml. Of course I might be missing something as I'm not that familiar with Go.
- wtetzner 13y ago> It also looks a bit like polymorphic variants in OCaml. Or like object types in OCaml. They also use structural typing.
- skybrian 13y agoActually it's a big improvement for large-scale programming due its effect on library dependencies. In Go you can easily declare an interface that matches a type in someone else's library without creating a hard dependency on that library. You can also superset and subset interfaces easily. That way you get loose coupling (almost like "duck-typing") in a mostly statically checked language. Contrast with Java where you'd have to both create a new interface and write an adapter class in a separate "glue" library that has hard dependencies on both libraries.
- fedesilva 13y agoNo. It has polymorphism and metaprogramming, things that Go (at least parametric polymorphism) eschews.
- hcarvalhoalves 13y agoI've found some (arguably minor) things to be kinda messy. Maybe the result of a one-person language that grows too much before getting some feedback. 1) Everything is (strangely) called a procedure, and then there's syntax to differentiate arguments that will be modified in place (proc myproc(myarg : int, inplacearg : var int)). Kinda weird, and a lost opportunity to have checking for pure functions at compile time. 2) import vs. include. Why have include at all to shoot yourself in the foot if you have cheap namespacing? 3) If vs. When ? 4) varargs feels kinda unnecessary 5) Case-insensitive. Oh... why? On the bright side, I like how OO was implemented. I disagree that it's a middleground between C and Python though. I see it more like an evolution of Pascal, it has the same niceties (ALGOL-like, static types, builds executables) and some things added on top (no VM, but GC'ed, metaprogramming).
- idlewan 13y agoOh, it does bring a lot to the table that C and Python don't have. You're totally right, it is not a middleground per se, it is just the language I was looking for. If I try to answer your points: -> 1) The procedure keyword comes from Pascal. I am not shocked by it, when I learned programming the teacher used to call them procedures also. The 'var' in procedure arguments could be considered the opposite of the 'const' of C/C++. Everything is const by default in Nimrod, but if you want something modified in place you indicate it. -> 2) Herm... I got nothing. I haven't used include, I didn't see the use for it yet. -> 3) 'when' is compile-time, 'if' is at runtime. -> 4) Unnecessary? varargs is quite useful. For example, if you use redis, you can do db.del("akey", "anotherone", "otherkey"), instead of having to fiddle with an array. Varargs makes some calls cleaner. -> 5) "The idea behind this is that this allows programmers to use their own preferred spelling style and libraries written by different programmers cannot use incompatible conventions." from the Nimrod manual (http://nimrod-lang.org/manual.html http://nimrod-lang.org/manual.html). It forces you not to name functions and variables too closely. So you won't be able to have different things named myStuff and my_stuff because it will refer to the same variable or proc. You enforce your own writing style. That is debatable. You have others enforcing a style, like with gofmt. The case insensivity did not disturb me, though (but I admit it surprised me at first).
- lmm 13y agoDo you know how it compares to a modern typed functional language - Haskell, OCaml, F# or Scala?
- TylerE 13y agoOcaml with better metaprogramming, an actually helpful compiler, and syntax that doesn't feel like having your eyes gouged out by a rusty spoon.