Crystal 0.33


98 points | by Can_Not 8 days ago


  • kick 8 days ago

    Crystal is really nice! Cloning Ruby syntax but making it prettier is probably one of the smartest language design decisions that have happened in a long time.

    It's definitely gotten further on my radar in the past year or so, though I remember reading this a few years ago and finding it pretty cool then, too:

    Relevant HN thread:

    Seeing Lilith in (what was, I think) December was what really alerted me to the fact that it had come along so far, I had mostly thought it was dead before.


    Relevant HN thread on Lilith:

    • pjmlp 8 days ago

      I just wish that they would had chosen another name for the OS.

      • scroot 7 days ago

        The Oberon boon -- especially the 2013 update -- is something that is, unfortunately, uncommon in the field: a total description of a computing system, top to bottom.

        If you or anyone reading this has access to that book in epub or similar ereader format I'd greatly appreciate. It seems Wirth published only a PDF (probably from MS Word)

        • pjmlp 7 days ago

          The original books were written in the Oberon System Word Processor, and you can access them as part of Oberon live documentation.

          For example by running A2 and starting Oberon System 3 from it.

          Regarding converting them into epub, I guess it is a question of copyright, even if Wirth has made the PDF versions freely available, but I am no lawyer.

    • gregors 8 days ago

      I recently noticed that frontend language Mint is written in Crystal -

      I've been playing around with Crystal for some toy projects as well as some data cleaning/munging scripts. I had a fairly large CSV dump that was making Ruby choke to death - porting to Crystal was trivial and it ran amazingly fast!

      I'm super interested to see where the concurrency story goes in Crystal. Fingers crossed!

      • devmunchies 8 days ago

        I’ve been using Crystal since 2016, but have recently started to learn Rust. Rust definitely makes me appreciate Crystal’s pretty robust std lib. it’s more like Go in that sense.

        • bsaul 8 days ago

          What's the state of crystal's concurrency ? I think i've read something on HN saying it wasn't quite there yet..

          • devmunchies 7 days ago

            You mean parallelism? Concurrency has been there for years. Parallelism was available under a flag a few months ago. I do t know the current status since I don’t need it.

            • bsaul 5 days ago

              sorry yeah i mean parallelism. Is the model an event loop running on single thread , like with with node.js ?

              When you say you don't need it, don't you use crystal for developing backend APIs ?

        • faitswulff 8 days ago

          The most interesting Crystal project I've heard of is this x86-64 OS:

          If Crystal can make a case for itself as a systems programming language, I'm very interested.

          • appleiigs 8 days ago

            I wonder why Ruby users don’t flock to Crystal, and Python users to Julia. With all the whining about performance and types, they just stay put.

            • hnzix 8 days ago

              Some devs talk about types as if they're the One True Holy Silver Bullet, but that is far from an objective truth. There are no silver bullets in dev, only sweet spots.

              • Can_Not 7 days ago

                I'd say crystal really combines the advantages of a powerful type system with the advantages of duck typing.

              • fermuch 8 days ago

                I've seen a lot of people (myself included) going from ruby to elixir

                • Buttons840 8 days ago

                  As an outsider, a non-Ruby-user, I find it strange that Ruby users seem to be migrating to languages that are similar only in syntax but vastly different in nearly every other imaginable way.

                  Do Ruby users care only about syntax?

                  Maybe I'm not so different? Maybe my preference for ALGOL syntax just gives me more language options?

                  • dnautics 8 days ago

                    It's a "get hooked with the syntax, stay for the features" situation. Elixir leverages the incredible robustness of the erlang virtual machine. So much so, that for me, anyways, it's hard to imagine using anything else without losing sleep anymore.

                    • bsaul 8 days ago

                      i've read a lot about erlang vm, but i'm curious which feature makes it hard for you to imagine using something else, in practice. What are the things that saved you, in your experience.

                      • dnautics 7 days ago

                        I replaced a python/uwsgi stateless stack with an elixir stateful system. Flipped it over and it worked flawlessly, and hasn't died once in several months of operation. Latencies are way down, and operation of it is simpler. Full deploy to the head node is one command, not an ansible script.

                        I guess part of it is that I'm lazy and haven't learned supervisor strategies like kubernetes (the place I work doesn't deploy kubernetes anyways)

                        This video is instrumental in giving me the confidence to do what I did:

                    • nipinium 8 days ago

                      Actually it's more than just syntax, elixir and crystal borrow a lot of ruby's stdlib api design, which in my opinion is way more pleasant than other languages'.

                  • jwhiz22 8 days ago

                    Crystal does not have mature web frameworks like Rails.

                    • nobleach 8 days ago

                      It doesn't have battle-tested everything and the kitchen sink like Rails. It has plenty of frameworks though. They just happen to be far more like ExpressJS for node, or Sinatra for Ruby. In this day of microservice/thin JSON API-style apps, Rails might be overkill. I'm not saying it's bad, it just might be a little much.

                      • jtms 8 days ago

                        Amber was pretty close last time I used it a year or so ago

                      • luhego 8 days ago

                        I use Python and I just don't like 1-based indexed languages. I would say that a better replacement for Python(at least for backend) is Go.

                        • nine_k 8 days ago

                          Go removes so much of the expressive power that writing it after Python is a bit of a pain.

                          OTOH I realize that many people don't use that expressive power and are happy with copy-pasting stuff.

                          • jitl 8 days ago

                            I’m waiting for generics to land before I return to Go.

                            • veeableful 8 days ago

                              One thing I immediately miss from Python after using Go is building a dict (e.g. for writing JSON values). I had to type map[string]interface{} so many times =P

                            • tyingq 8 days ago

                              Did you have a look at nim?

                            • pjmlp 8 days ago

                              I fail to see how a bare bones language is a replacement for a language with Lisp/Smalltalk like expressive power.

                              The only thing missing is having more love for JIT compilers among the Python community.

                            • robbseaton 8 days ago

                              n=1 but I am a Rubyist migrating to Julia, FWIW.

                              • lasagnaphil 8 days ago

                                I'm curious what makes you want to move to Julia, because it seems that the overall philosophy of the two languages are quite far from each other. Would you mind if you share?

                                • socialdemocrat 8 days ago

                                  robbseaton probably has other reasons but I was a huge Ruby fan years ago and have been using Julia for many years now.

                                  For me both languages have similar types of appeal. Ruby is quick to pick up, allows you to write expressive code and is built on the idea of everything being an object. So Ruby is both clean, easy and expressive.

                                  Julia is EXACTLY the same, but for the modern age. It is easy to learn and expressive. Like Ruby the type system is consistent all over. It is not like Java which has primitive types and objects. Numbers in both Julia and Ruby are treated like any other type.

                                  The primary difference is that Ruby came of age in the most object-oriented hyped period of programming language development and that reflects its heavy OOP design.

                                  Julia came around when OOP was no longer considered the silver bullet. So why Julia has elaborate type hierarchies, it is probably closer to a functional language than an object-oriented one.

                                  When Ruby came out it was a language that appealed to programming language geeks like me. It had a bunch of really powerful features we where not used to.

                                  Julia is kind of the same. Multiple-dispatch and Julia macros is something that appeals to all geeks.

                                  I actually never switched to Julia for performance reasons, but because I loved the language.

                                  • pjmlp 7 days ago

                                    > Julia came around when OOP was no longer considered the silver bullet.

                                    Julia has multimethods dispatch.

                                    One of the most famous writings about them is called "The Art of MetaObject Protocol".

                                    A book to be read by everyone that thinks OOP is just the Java way.

                                    While at it, reading about BETA and Self would also be illuminating.

                              • dyeje 8 days ago

                                Most of the people whining about performance and types probably don't actually use Ruby day to day.

                                • eropple 8 days ago

                                  I dunno. I used to use a lot of Ruby. The lack of types regularly made my life a real pain. I ended up building frameworks[0] tied really tightly to dry-struct to try to work around that, and it wasn't great.

                                  I use TypeScript for everything I used to use Ruby for, save for the occasional file munging inside of `pry`.


                                  • jitl 8 days ago

                                    This is pretty much the route I’ve taken, except I used an internal framework at Airbnb for typings instead of “dry-...”.

                                    These days I write Typescript. I’m excited for Deno, which looks like it’ll solve most of the Node bullshit.

                                  • symfoniq 8 days ago

                                    And Ruby 2.6 is already much, much faster than it was in the days when it was too slow for Twitter.

                                    Ruby 3.0 should be much faster still.

                                • xuejie 8 days ago

                                  Crystal is indeed a very nice language, but the only thing that is holding me from using it greatly, is that it still uses the Boehm GC, which makes it hard to compete with other languages in a production setting.

                                  I understand we might get there one day but I'm afraid this is taking far too long.

                                • pjmlp 8 days ago

                                  Love to see the progress on Crystal, hope that they manage to sustain its development.

                                  • Still no first class Win32 support.