4 ms·
Care to flesh that out a bit?
by benhoyt 12y ago
Care to flesh that out a bit?
- dingdingdang 12y agoAh, yes, I remember back in 1959 when we all was rocking the Cobol and I used to auto compile straight to Javascript with a Future module so magnificent that it auto-compile-manifested a V8 JS engine with which to run it. Deal with that boring Nim compiler.
- sillysaurus3 12y agoWhen I saw that the top comment is a list of language features which are mostly extremely old, I thought that was interesting, so I pointed out how old those features are. And got hammered for it in spite of the fact that it's true. Obviously, it doesn't matter whether those features are old or new. What matters is whether the language executes them in a compelling way. But almost every single one of those features has been a core aspect of programming languages which have been around since before most of us were born. Also, the mods have strongly urged me to write shorter comments, and to write comments less frequently. And they've suggested that more than once. I try to oblige, and this is the result. So technically I can't flesh out my comments without going against their advice. Of that list of nine features, I'm certain six are extremely old: * Run regular code at compile time * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! * Add your own optimizations to the compiler! * Bind (easily) to your favorite C functions and libraries * Unified Call Syntax, so mystr.len() is equivalent to len(mystr) * Good performance -- not placing too much emphasis on this, but it's faster than C++ in his benchmark I wouldn't be surprised if GC control and typesafe enums are also extremely old, bringing that up to "8 out of 9 features are old." But it's at least 6 out of 9.
- zahary 12y agoWell, you have to combine just two of these features to leave Nim in a very small company of languages, mostly developed in the last decade. Good performance and meta-programming ("run regular code at compile time") used to be found at the opposite ends of the programming languages spectrum and Nim is unifying them in a single package - that's what people are excited about.
- sillysaurus3 12y agoGood performance and meta-programming ("run regular code at compile time") used to be found at the opposite ends of the programming languages spectrum Actually, Lisp has been executing regular code at compile time with good performance since the tail end of the 1980's. Maybe even before that. This is why I said "everything old is new again."
- zahary 12y agoDepends on your definition of "good performance". Idiomatic lisp was never able to compete with the Fortran-s and C/C++-s of its age, but Nim is.
- sillysaurus3 12y ago"Good performance": Within a factor of ~2 to ~4 of native C. No one said idiomatic Lisp was performant. They said Lisp was performant. Seriously, it's not even difficult. It's not like it's a situation where it's easy to accidentally kill your performance by writing elegant code while having no idea why it's slow. Optimizing a Lisp codebase is a straightforward exercise, no more difficult than optimizing a Lua or Javascript codebase. If someone hasn't shipped more than a toy program with Lisp, it's easy to believe the opposite. But if you try it, you'll see that it's true.
- klibertp 12y agoTo be a bit more specific as to where else these ideas are found: * Run regular code at compile time Lisp, of course. Since very long ago. * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! Lisp, but also Dylan, Elixir, JS with Sweet.js and more. See for example here: https://opendylan.org/articles/macro-system/index.html https://opendylan.org/articles/macro-system/index.html * Add your own optimizations to the compiler! I'm not sure here. * Bind (easily) to your favorite C functions and libraries Almost every serious language has FFI for C. Nimrod offers a possibility to use statically linked libraries, which is not very popular, but for example Gambit Scheme does this since long ago. * Unified Call Syntax, so mystr.len() is equivalent to len(mystr) Lua, somewhat. Also Dylan again. * Good performance -- not placing too much emphasis on this, but it's faster than C++ in his benchmark Too many to count. * Compile to JavaScript OCaml. And more: almost every language has a compile-to-JS project for it (although only a couple are workable). EDIT: > typesafe enums are also extremely old Aren't those just sum types? This would make them as old as ML at least. This of course doesn't make Nimrod any less interesting a language and some combinations of those features may be rather novel. Still, 'everything old is new again' I think is 100% true for all of these features. In reality you won't ever encounter truly unprecedented features in general purpose languages and outside of academia: one can go to LtU site for those. All the rest languages are built on really old (proven) concepts, which they reimplement and package in a (very) different ways. I have no idea why would you get downvoted for stating such fact.
- sillysaurus3 12y agoI have no idea why would you get downvoted for stating such fact. And not merely downvoted, but karma carpet bombed (-10). Such an honor used to be reserved for troll comments rather than true statements.
- TylerE 12y agoSimple... the list of languages that provide Lisp-level dynamism AND C level performance is rather short.
- 12y ago