News for hackers. Stuff that matters.
Re:Why Crystal Is My Next Language by nepeckman on Sunday June 10, 2018 @09:57PM (#17281195)
I feel like the author dismissed Nim pretty unfairly. Github stars and issues are one signal for a project status, but its hardly conclusive. Nim's development has been pretty consistent and is approaching 1.0. Ultimately, a lot of language choice is subjective, but I think anyone looking for a language in the fast-but-expressive category should at least try Nim.
Re:Why Crystal Is My Next Language by freedomben on Sunday June 10, 2018 @10:42PM (#17281355)
Definitely. He dismissed it mostly because he doesn't like camelCase? seems like a silly reason to dismiss a language. I've been around enough different ecosystems to know that style is something you get used to. snake case, camel case, same-line curly brace, give it a few weeks and you won't really notice. It's a silly reason to dismiss a language.
Re:Why Crystal Is My Next Language by fgimian on Monday June 11, 2018 @12:23AM (#17281773)
True, I REALLY hate camelCase though ... hahaha But seriously, I do need to spend more time on Nim and give it a fair chance on a project :)

Ultimately, I had to choose something to commit to for a while as there are just not enough hours for me to learn multiple new languages outside of work and with my various other hobbies.

But rest assured that Nim was absolutely a front-runner and I'm happy to update the post to reflect this.

Re:Why Crystal Is My Next Language by beagle3 on Monday June 11, 2018 @02:31AM (#17282250)
> True, I REALLY hate camelCase though ...

I do too, and that's exactly why you should use Nim. It is, perhaps, the only language in which the variables "camelCase", "camelcase" and "camel_case" are the same (though CamelCase isn't) -- so you don't have to follow braindead Java principles if you don't like them.

Re:Why Crystal Is My Next Language by skocznymroczny on Monday June 11, 2018 @05:42AM (#17282999)
I'd consider it even worse. I like consistency in my codebases. Good luck grepping for variable, when half of the folks will use variable_name, the other half will use variableName and the last half will do variablename.
Re:Why Crystal Is My Next Language by beagle3 on Monday June 11, 2018 @07:38AM (#17283430)
Nim includes "nimgrep", so I have good luck grepping for a variable, and it is supported in most common editors with a nim package. Nim also includes "nimsuggest", which provides intellisense - also available in most common editors.

And if you really insist, it is quite easy to write a simple program that will unify the styles for you. In practice, it's not a problem.

In this respect, Nim inherits pascal's case insensitivity, and just adds a few minor and arguably useful details (underscores are ignored, case of first letter preserved). It was never a problem for Pascal (or BASIC, or Excel, or NTFS or HFS+) and it's not a problem in Nim.

And being an early Python advocate and evangelist, I feel history is rhyming again .. ."What? You use significant spaces ? That's so stupid, and bound to make everything fail. Yes, some people still dislike significant indentation, but by and large, experience shows that it's not inferior[0] to token block delimiters, and in some ways it is superior.

[0] as long as tabs are a syntax error ....

Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @08:32AM (#17283679)
And what do you do when a library you need doesn't use the same style as your code base? Let me guess: you end up adding an inconsistency into your codebase.

This is what style insensitivity is meant to fix. In reality, you are able to tell what style a code base uses almost immediately and grep accordingly.

Re:Why Crystal Is My Next Language by mcbits on Monday June 11, 2018 @06:57AM (#17283249)
People still grep for variables in $current_millennium? I have to agree with the other comment about tooling being an important factor in language selection.
Re:Why Crystal Is My Next Language by renox on Monday June 11, 2018 @07:27AM (#17283384)
I believe that Nim comes with its own grep to allow this.
Re:Why Crystal Is My Next Language by smt88 on Monday June 11, 2018 @06:56AM (#17283246)
> "camelCase", "camelcase" and "camel_case" are the same (though CamelCase isn't)

I find this horrifying and think it probably reflects deep philosophical differences between myself and the creators of Nim. Languages shouldn't make assumptions and how to interpret my typos. They should tell me about the typo and suggest a possible fix.

Re:Why Crystal Is My Next Language by beagle3 on Monday June 11, 2018 @08:08AM (#17283560)
It's not about typos. Nim borrowed a lot from Pascal when it started life, and Pascal, like BASIC, Fortran, some LISPs, Excel, NTFS, HFS+ and many others, is case insensitive.

What you say is equivalent to "I want to be able to declare three independent variables called camelCase, camel_case and camelcase", and Nim says "no, you can't do that in the same scope" (which is a little more strict than pascal which says "you can have camel_case distinct from the other two, but those two are equivalent).

Experience shows that case sensitivity is harder to use in general[0]; "Although we resisted changing the Python implementation, our user testing data forced us to make ... Python case insensitive. Over 85% of our users made case errors and many continued to do so even after learning that case was significant." it's just that you're used to it; same with respect to int/int vs true division.

I'm feeling an almost dejavu to the early days of Python, when the standard response (which people still repeat sometimes, though rarely these days) was "what!?!? you mean spaces are significant!?!? that's horrible". But this is equivalent to saying "I want to be able to write code that behaves differently then it looks, such the C code:

    if (nuclear_launch_detected)
        notify_the_president();
        launch_strike(STRIKE_MODE_MUTUALLY_ASSURED_DESTRUCTION);
(The like of which make iPhones and Macs susceptible to eavesdropping for a long time). Python says, "Nah, you can't do that". It's opinionated, but experience shows it works better overall.

[0] page 5 of http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.908... - all of it is a fantastic read.

Re:Why Crystal Is My Next Language by smt88 on Monday June 11, 2018 @09:05AM (#17283834)
The reasoning may not be about typos, but the egonomics are. Also, following the tradition of those other systems doesn't make it better for Nim users. The context matters a lot.

And why are case errors a big deal in case-sensitive languages if they cause "undefined" errors or, better yet, are caught by static analysis?

(To your point about Python, I still think semantic whitespace is insane -- invisible code, as you implied -- and is a major reason I avoid Python when possible.)

Re:Why Crystal Is My Next Language by eeZah7Ux on Monday June 11, 2018 @05:38AM (#17282980)
Nim is style-insensitive on purpose.
Re:Why Crystal Is My Next Language by siddhant on Sunday June 10, 2018 @11:47PM (#17281613)
Nim is pretty amazing. I spent last week writing some toy programs and it reminded me of Python - in the sense that it allowed me to write working code within a few hours of picking up the language.

The “optional namespaces” thing is something which bugs me a lot though. That importing a module works similar to `from module import *` in Python. It makes code confusing to read and grasp IMO (which module does this symbol come from?). Other than that, a pretty cool language.

Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @08:44AM (#17283736)
> The “optional namespaces” thing is something which bugs me a lot though. That importing a module works similar to `from module import *` in Python. It makes code confusing to read and grasp IMO (which module does this symbol come from?). Other than that, a pretty cool language.

This is a common complaint, but there is rarely a solution proposed alongside the complaint. Nim is significantly different from Python to warrant these semantics, but I am really open to hearing ideas of how this could be improved keeping in mind these differences (operator overloading, no classes).

A recent proposal was made here, and it looks like it will be adopted, I'd love to know what you think about it:

https://forum.nim-lang.org/t/3783

Re:Why Crystal Is My Next Language by gtycomb on Monday June 11, 2018 @01:11AM (#17281978)
I agree. I am taken by surprise at the all-round strong performance of Nim. Python-like syntax, a pleasing type system, efficient compilation and packaging. I am waiting to hear more on this. As I understand it they are a small team too and their implementation is truly worth following up.
Re:Why Crystal Is My Next Language by rishav_sharan on Monday June 11, 2018 @01:12AM (#17281984)
I came to Crystal from Nim. I really like Nim. But I feel that the language maintainers do not have an idea on how to grow the ecosystem. Even after all these years, Nim doesn't have any good web framework. Jester, is the only one I know of has no website of its own and is very lacking in documentation.
Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @04:07AM (#17282614)
Hi, one of the Nim core devs here. Any ideas how we can fix that?

Crystal has a surprising amount of web frameworks with great marketing behind them. Could that just be because it's a Ruby-like language, and Rubyists are far more interested in web frameworks?

That's my theory, but I could be totally wrong. I'd love to know how we could improve here.

Perhaps it's because I created a web framework that is good enough (jester) early on and so nobody feels like stepping in with their own implementation. A website for jester would be great and it is on my to-do list, but so are many more things.

Re:Why Crystal Is My Next Language by gtycomb on Monday June 11, 2018 @09:52AM (#17284154)
Thanks for asking. I had stopped looking at newer languages long time ago and I can't tell quite how I decided to check out this Nim. Perhaps its finding your well written book, Nim in Action. Nim language has this one characteristic that means a lot to me -- to be able to learn the core concepts very quickly enough to get productive in some of the routine work (back-end system interactions, distributing compiled modules to other locations, numerical/data processing). Nim won my heart in this regard hands-down.

Well, along the lines of what is already mentioned, I stumbled on web communication aspects (I like the available template system, it performs well) and ran into glitches with the mongo or postgresql drivers as I got deeper. I am glad that Nim doesn't have a Ruby-like syntax -- Nim's current type structure/syntax is its strength, IMHO.

(I wanted to contribute some money to the team but PayPal is the only option even if the site says it can take Visa etc. PayPal is something that I avoid due to past experiences)

Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @11:09AM (#17284884)
> Perhaps its finding your well written book, Nim in Action.

Thanks! :)

> I wanted to contribute some money to the team but PayPal is the only option even if the site says it can take Visa etc. PayPal is something that I avoid due to past experiences

There are many ways to donate to us, I guess we need to spruce up the donation page, the "Other ways to donate" is buried at the bottom: https://nim-lang.org/donate.html

Re:Why Crystal Is My Next Language by bb88 on Monday June 11, 2018 @06:35AM (#17283163)
The very first thing should be a package manager, with packages behind a CDN, so I can go between development and deployment easier.
Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @08:57AM (#17283796)
huh? Nim has a package manager, not sure what you mean.
Re:Why Crystal Is My Next Language by bb88 on Monday June 11, 2018 @03:53PM (#17287925)
Apologies. I meant production ready package manager. The one I'm aware about is in beta.

https://github.com/nim-lang/nimble

Re:Why Crystal Is My Next Language by brokencode on Monday June 11, 2018 @04:51AM (#17282790)
Personally, the first thing I look at when I look into a new server side language is how it does in benchmarks conpared to other similar languages (such as the TechEmpower benchmarks). I know that those types of benchmarks are flawed in a lot of ways, but performance is probably the only objective way to evaluate a language, and I’m much more likely to learn about a language if it looks like it’s fast.

From what I’ve seen for Jester/Nim, it’s not really benchmarked a lot, and it doesn’t seem particularly fast where it is benchmarked. This could perhaps be fixed by better implementations for the benchmarks or some optimization in Jester itself.

I think a strong story for performance would go a long way towards improving awareness of Nim. Crystal does very well in such tests, and I think that is one of the most appealing parts of the language. In fact, I evaluated both Nim and Crystal for server side development a while back, and quickly dismissed Nim because it didn’t seem to be all that fast. I eventually dismissed Crystal too because of the compile times and syntax, but I put a lot more time into it.

Re:Why Crystal Is My Next Language by dom96 on Monday June 11, 2018 @08:56AM (#17283791)
I would say that you should look at the language's theoretical performance as much as its actual performance. A lot of these benchmarks are just a result of someone putting in a lot of time tweaking things until they are perfectly suited to the specific benchmark, in real-life you will get nowhere near that. Additionally, you won't actually need to get anywhere near it. If you do, then you will have the time to tweak things and get to know the language inside out. In that case, all that will matter is the theoretical performance of that language.

So what do I mean by theoretical performance? Well, Nim is a statically typed and compiled language, it stands to reason that these attributes make it very performant indeed. Even if certain aspects of the language are not efficient right now, you can bet that it will be fairly trivial to improve their performance. For languages like Python, Ruby, etc. you are heavily limited by the dynamic typing (which restricts the amount of information you have about the code) and the fact that they are primarily interpreted languages. You will need to put far more effort into optimising them than compiled languages.

As a side note, I do intend to improve the performance of Jester as well. But I'm not the only one doing this, the mofuw framework is #24 on the TechEmpower benchmarks right now.[1]

1 - https://twitter.com/nim_lang/status/1004849910699712513

Re:Why Crystal Is My Next Language by brokencode on Monday June 11, 2018 @06:57PM (#17289345)
It’s not enough to have good “theoretical” performance when other languages already have measurably good performance today. I’m not trying to say that Nim is bad or slow, but when there are a dozen similar static, compiled languages to choose from, it’s easy to dismiss one based purely on the benchmarks alone. I understand that it’s sort of an optimization game with these benchmarks, but it’s at least a form of marketing, which is something that Nim can benefit from.
Re:Why Crystal Is My Next Language by nimmer on Monday June 11, 2018 @10:20AM (#17284419)
> I know that those types of benchmarks are flawed in a lot of ways

If the speed of an HTTP framework impacts your application you have an architecture problem.

Nim CPU, memory and compile time performance are excellent in most benchmark.

Re:Why Crystal Is My Next Language by fgimian on Monday June 11, 2018 @12:21AM (#17281767)
You're right about this point. I really should have spent more time on Nim, and I still intend to. In fact, Nim was my main choice prior to learning about Crystal.

So no offence intended at all to any Nim fans, and I hope to dive into it more thoroughly in the near future.