News for hackers. Stuff that matters.
Re:Crystal 1.0 – What to expect by The_rationalist on Monday March 22, 2021 @05:49PM (#26547704)
All of those points are already met and in a better way by mature languages like e.g Kotlin. Really the only argument would be the "Ruby elegance" (or familiarity?) which I don't know. What make ruby/crystal more "elegant" (I would prefer the term readable) than the competition?
Re:Crystal 1.0 – What to expect by bovermyer on Monday March 22, 2021 @07:54PM (#26549132)
Well, speaking purely from personal experience, Crystal is much more enjoyable to write and read than Java derivatives.

Take that with a grain of salt, though, since I have a deep-seated hatred of Java stemming from experiences in the early 00s.

Re:Crystal 1.0 – What to expect by The_rationalist on Tuesday March 23, 2021 @09:52AM (#26554958)
Interesting, could you characterize some of what make it more enjoyable?
Re:Crystal 1.0 – What to expect by ezrast on Tuesday March 23, 2021 @03:51PM (#26559573)
Kotlin is indeed very Crystal-like, and I enjoy both languages, but I really miss union types in Kotlin, as well as deeper type inference. For example, in Crystal you can write

    def foo_then_bar(a, b)
      a.foo
      b.bar
    end
and it will just work for any two types that implement `foo` and `bar`, respectively. This isn't something I do often - I like the clarity that type-annotated parameters give - but it's a really nice feature to have available in the 2% of cases where I want it.

Then there's all the ecosystem stuff - Kotlin makes me do extra work to target native, and has little bits of weirdness inherited from Java all around the edges. None of it's deal-breaking, but it is friction.

Re:Crystal 1.0 – What to expect by The_rationalist on Tuesday March 23, 2021 @10:26PM (#26562866)
Thanks for the example, that's interesting.

Note that Kotlin has union types through this compiler plugin: https://github.com/arrow-kt/arrow-meta/issues/570 However it is experimental and shouldn't yet be used in production. Btw sealed classes take care of many uses of union types.

What kind of extra work is needed? I'd say that graal native is transparant for any library that doesn't do weird use of reflection but it's true that many libraries do abuse of reflection.

Re:Crystal 1.0 – What to expect by ezrast on Tuesday March 23, 2021 @11:58PM (#26563454)
Having to install and set up third-party pre- and post-processors is the extra work I mean. I'm sure it's not super difficult, but it's also not very accessible to those like me who aren't already familiar with Java tools. The documentation seems to assume I'm slightly competent with Maven or Gradle, etc.

I did try Kotlin/native hoping it would make it easier to remain in blissful ignorance of the JVM ecosystem, but as of a year or two ago it had significant holes in the standard library (most notably no file abstractions other than thin bindings to libc) and pretty atrocious compile times (something like 10s for hello world, and 30+ for a couple thousand lines of code).

Re:Crystal 1.0 – What to expect by bovermyer on Tuesday March 23, 2021 @03:12PM (#26559061)
Sure.

The simplicity and predictability are key with Crystal; everything is an object, and the control structures are limited in number.

Crystal code is very concise and legible. You might say it's crystal clear.

Re:Crystal 1.0 – What to expect by nine_k on Monday March 22, 2021 @06:18PM (#26548094)
Kotlin mostly requires JVM, Crystal does not. Kotlin is heavily oriented towards Java familiarity and interoperability, Crystal is heavily oriented towards Ruby familiarity, and C interoperability.

Also, Crystal was first released in 2014, when Kotlin was like 3 years old, and 100% JVM-bound.

Re:Crystal 1.0 – What to expect by The_rationalist on Monday March 22, 2021 @09:43PM (#26549979)
Kotlin mostly requires JVM, Crystal does not. With Kotlin native, Kotlin js and most importantly Graal native this is plain wrong.
Re:Crystal 1.0 – What to expect by socialdemocrat on Monday March 22, 2021 @10:14PM (#26550211)
That is like a hack. You are basically dumping a JIT image to file. That means all sorts of caveats apply such as be real careful about how you use reflection.

Also there is no ABI so you cannot use anything like a native DLL.

Native compilation while possible is clearly second class on the JVM platform. For Crystal it is first class.

Re:Crystal 1.0 – What to expect by heavyset_go on Tuesday March 23, 2021 @12:39AM (#26551190)
> Also there is no ABI so you cannot use anything like a native DLL.

Pretty sure this isn't the case with Kotlin Native[1].

[1] https://kotlinlang.org/docs/native-dynamic-libraries.html

Re:Crystal 1.0 – What to expect by yxhuvud on Monday March 22, 2021 @10:40PM (#26550393)
Crystal is also not great for dlls or .so files as the event loop and gc probably wouldn't work well in that scenario.
Re:Crystal 1.0 – What to expect by filleduchaos on Tuesday March 23, 2021 @06:09AM (#26553135)
I have used Crystal to make DLLs and it worked plenty fine.
Re:Crystal 1.0 – What to expect by iomcr on Tuesday March 23, 2021 @09:50AM (#26554933)
Sounds like a fair compromise when the alternatives includes at least one of the following tradeoffs: harder, less safe, and/or slower.
Re:Crystal 1.0 – What to expect by abhijat on Tuesday March 23, 2021 @12:24AM (#26551100)
Is kotlin/native a first class option today for server side programming? Last I looked at it, which was fairly recently, that did not seem to be the case.
Re:Crystal 1.0 – What to expect by The_rationalist on Tuesday March 23, 2021 @09:38AM (#26554800)
While Kotlin native is likely more mature than crystal I would say that graal native is much better as it allow you to reuse Java libraries and therefore spring native.
Re:Crystal 1.0 – What to expect by nine_k on Monday March 22, 2021 @09:49PM (#26550028)
This is correct today.

This was not the case when Crystal development started.

Re:Crystal 1.0 – What to expect by The_rationalist on Tuesday March 23, 2021 @09:32AM (#26554741)
Translation: Crystal had a value proposition but now it's gone, before the product launch.
Re:Crystal 1.0 – What to expect by iomcr on Tuesday March 23, 2021 @09:53AM (#26554963)
Reality: Kotlin's value proposition is android development.
Re:Crystal 1.0 – What to expect by The_rationalist on Tuesday March 23, 2021 @01:12PM (#26557385)
It's a misconception, Kotlin is suitable everywhere that Java is suitable, and even more.
Re:Crystal 1.0 – What to expect by iomcr on Tuesday March 23, 2021 @09:42AM (#26554842)
That doesn't stop 99% of the mind share and language design from being "Java with lipstick".
Re:Crystal 1.0 – What to expect by socialdemocrat on Monday March 22, 2021 @10:11PM (#26550189)
Why Kotlin when you got Swift is an equally valid point. People like choice and for a lot of us, running on the JVM is a non starter.

Try creating a small command line tool for a JVM language. You need to distribute a virtual machine with it. You got the overhead of firing up a VM or JIT just for a short lived session.

Also JVM gobbles memory. You would not want a system made up of lots of tiny command line tools all running on a JVM. That would be a lot of overhead.

Re:Crystal 1.0 – What to expect by dm3 on Tuesday March 23, 2021 @03:05AM (#26551928)
This information was true a few years ago. Now, with modular JVM you do not ship a VM with the program. JVM by itself is lean and starts up pretty fast. You can also compile to native with GraalVM - this is a viable option if you want to write lots of tiny command line tools.

See Babashka[0] for an example scripting toolkit written in Clojure.

[0]: https://github.com/babashka/babashka

Re:Crystal 1.0 – What to expect by pjmlp on Tuesday March 23, 2021 @05:40AM (#26552909)
Since 2000 AOT compiling into native code has been available to Java developers, no different from using something like Go.

That many didn't want to buy those compilers and settled with the free beer that could get hold of is another matter.

Re:Crystal 1.0 – What to expect by cb321 on Tuesday March 23, 2021 @08:46AM (#26554354)
Just to corroborate - with gcc's gcj Java folk could get compilation to an ELF binary for free as well. I was profiling such in 2004. This was unpopular/unmaintained enough that eventually gcc discontinued it.

Sadly, people often confuse "prevailing mindset of the noisiest authorities of some programming language" with "the programming language itself" { not that this is the only confusion or maybe even the worst... :-) }

Re:Crystal 1.0 – What to expect by himujjal on Monday March 22, 2021 @10:31PM (#26550328)
kotlin/native doesnt require jvm

swift support for windows is non-existent

Re:Crystal 1.0 – What to expect by eyelidlessness on Monday March 22, 2021 @11:15PM (#26550611)
> swift support for windows is non-existent

I was prepared to suggest WSL, but apparently Swift support for Windows is existent[1].

1: https://swift.org/blog/swift-on-windows/

Re:Crystal 1.0 – What to expect by ibraheemdev on Tuesday March 23, 2021 @08:37AM (#26554291)
> What make ruby/crystal more "elegant" (I would prefer the term readable) than the competition?

In the words of David Heinemeier Hansson:

> In fact, Ruby, to me, so much of the enjoyment in Ruby is these incredible subtleties, of how many different ways you can structure a conditional. Like, Ruby has, I don't know even the count, there's gotta be 60 different ways you can say `if something`, right? And it is in those 60 different ways that I find half the enjoyment of writing Ruby. Like, it was one of those things where I knew, very early on, that Python was not a language for me because it said, right in the manifesto, there should be preferably one and only one way to do things. Ruby has the exact opposite approach, there should be preferably ten thousand subtle different ways of doing things, that will allow you to write that particular conditional, with just the right emphasis, do you write it in the front, do you put it at the back, is it multi-line, is it single line? Like, there's so much variety and it's in that variety that I find poetry. And it is the poetry of writing Ruby code, of making those subtle distinctions where, at the end, you can like, "Ehh, should we move it around" like, where I just go like, giggles, right? Like, this where like we talked about that big smile, right? So much of that big smile comes from, not just like solving the problem, but solving it in a poetic way.

Re:Crystal 1.0 – What to expect by pansa2 on Tuesday March 23, 2021 @09:15AM (#26554578)
> there should be preferably ten thousand subtle different ways of doing things

This doesn’t sound elegant (meaning “pleasingly ingenious and simple”) at all.

It also only seems readable in the most shallow sense - certainly not understandable.