[HN Gopher] An Introduction to Crystal
       ___________________________________________________________________
        
       An Introduction to Crystal
        
       Author : thejokersthief
       Score  : 46 points
       Date   : 2021-02-21 20:47 UTC (2 hours ago)
        
 (HTM) web link (blog.oisinaylward.me)
 (TXT) w3m dump (blog.oisinaylward.me)
        
       | tutfbhuf wrote:
       | The biggest selling point of Crystal is being a very high level
       | language, but at the same time very performant. Think of a Ruby
       | variant with Go speed.
       | 
       | I would like to have something similar for Python.
        
         | komuher wrote:
         | nim-lang
        
         | sidkshatriya wrote:
         | I've heard the compiler is very slow. Is it? Go has a crazy
         | fast compiler.
        
           | ranit wrote:
           | GP meant Go run-time speed, not its compiler's.
        
           | Jenz wrote:
           | This is true, Crystal does compile pretty slowly, but this is
           | the cost of its great static type system. The balance between
           | Crystals expressiveness and performance is truly wonderful
           | and a joy to program with
        
         | RaycatRakittra wrote:
         | Have you taken a look at Nim? https://nim-lang.org
        
         | forde wrote:
         | Yeah crystal is an awesome language
        
       | bestinterest wrote:
       | Crystal is a really nice language to me. If it had some large
       | ecosystem behind it and wasn't boring I'd be able to use it to
       | replace my other preferred boring languages of Java (strong
       | engineering focus and long standing systems) and Ruby (beautiful
       | to write and super productive).
        
       | yeskia wrote:
       | I've played with Crystal a number of times and love it. It ticks
       | a lot of the boxes for what I want in a language.
       | 
       | However, there seemed to be some confusion about whether the
       | language could continue with inferred types or whether you'd need
       | to annotate yourself - and what that would mean for compile
       | speeds. I'm hoping those concerns can be resolved
        
       | klelatti wrote:
       | Having written a Ruby (not Rails) app that would benefit from
       | Crystal's speed and typechecking (and made a start on a
       | conversion) I worry that the language won't find a niche that
       | ensures its long term survival. Is there any area where Crystal
       | is likely to provide a compelling solution when compared to other
       | languages?
        
         | m12k wrote:
         | The absolute killer would be having a (ideally automatic) way
         | to port existing Ruby applications to Crystal, and thus also
         | tap into the existing ecosystem around Ruby. Though in order
         | for that to really take off, they'd need to be able to port
         | Rails too, which is probably quite tricky (considering how much
         | metaprogramming Rails does for its "magic").
        
           | klelatti wrote:
           | Absolutely and given the resources that firms spend on
           | servers running Rails (GitHub, Shopify etc) I could see the
           | effort being put into it - if it's possible. I suspect the
           | metaprogramming issue is really tricky though.
        
           | burlesona wrote:
           | I think for this to have a realistic chance, you have to have
           | some effort on the rails side to reduce the meta-programming.
           | I doubt that's going to happen.
           | 
           | It is certainly possible to port Ruby applications to Crystal
           | without a total rewrite, but the addition of static types in
           | and of itself means you may be surprised at how much fiddling
           | is required to get the compiler to approve your code.
        
       | shric wrote:
       | > Crystal's build times are reasonable. Compiling my project
       | Azula takes ~16s with the release flag. Compiling our barebones
       | project above takes ~8s.
       | 
       | 8s to compile a hello world is "reasonable"? Am I missing
       | something?
        
         | oisina wrote:
         | this is with the release flag! normal compiling is a good bit
         | quicker - sorry, should've mentioned that!
        
         | mhd wrote:
         | > Am I missing something?
         | 
         | One of its main competitors hasn't exactly been up to Turbo
         | Pascal levels with their own compiliation performance.
        
         | doomrobo wrote:
         | Not to mention memory intensiveness. Compiling a medium sized
         | project (https://github.com/iv-org/invidious) on a DigitalOcean
         | $5/mo droplet will throw an out-of-memory error unless I give
         | it a few gigs of swap space
        
       ___________________________________________________________________
       (page generated 2021-02-21 23:01 UTC)