11 ms·
Crystal 1.1.0
- Normille 5y agoThe language itself is very interesting. I've dabbled a few times and really like the clean ruby-esque syntax. What puts me off delving further is the lack of support in various editors / IDEs / Treesitter etc. I think the core development team should really devote some resources to this, as I'm sure I'm not the only one deterred by this dearth of tooling.
- speps 5y agoLack of support for native Windows[1] is probably not helping adoption as well. [1] https://github.com/crystal-lang/crystal/issues/5430 https://github.com/crystal-lang/crystal/issues/5430
- pankajdoharey 5y agoMy personal experience has been pleasant, and i think it is a bit faster than go. Also the easy syntax and better object Oriented features is a plus.
- sidkshatriya 5y agoI like the language but I haven’t tried it out yet. I’ve heard that the compile times can be very long. Is that improved or are there workarounds?
- npn 5y agoThere will be an interpreter, so at least the feedback loop when developing will be fast enough. Time to compile an optimized binary will be still slow for the foreseeable future.
- felipeccastro 5y agoThat's great news! Is the interpreter being developed already? Anywhere we can follow the progress?
- npn 5y agoIt's kinda working right now, with some missing features like exceptions raising and catching, block closures, c-library binding (only libc works IIRC). You can follow the activity here: https://github.com/crystal-lang/crystal/pull/10910 https://github.com/crystal-lang/crystal/pull/10910 I was pleasantly surprised myself that the interpreter actually already somewhat worked, as you can see in the demo: https://www.youtube.com/watch?v=een_W1YEICw&list=PLe1-A91ZPTpD5QZf4pQw4hpy8j7FTY8KR&index=3 https://www.youtube.com/watch?v=een_W1YEICw&list=PLe1-A91ZPT... The creator also claimed that the interpreter only need a few more months to finish.
- frollo 5y agoHonestly, until they provide some more support at least in the editors and IDEs field and support native Windows Crystal is not going to be more than a fun tool. I like it, because the general developer experience I had was really pleasant, but I cannot really use it for work.
- speg 5y agoI’ve been playing with Crystal a lot (every night) for the last few months. It’s really fun language, and I don’t have even have any Ruby background! The main pain points from where I’m sitting are things like debugging and incremental compiling. You can throw lack of tooling in there too I suppose. The dev team knows and is working on these, but they are a small community based team so don’t expect they same resources as in Go or Swift. FWIW I’ve been having good experiences with Sublime.
- rishav_sharan 5y agoI am also having a better experience with sublime than with vs code.
- Normille 5y agoAs per my original post, while the lack of tooling is my biggest pain point around the language ecosystem, inside the language itself, my main gripe is with the error messages. I find them quite impenetrable a lot of the time. Which is not ideal when confronting a new language. Crystal could take a leaf out of V or Rust's book here. Whatever you think of the languages themselves, the error messages are top notch. Errors that say "Ah. I see what you were trying to do here. Maybe you should try this instead?" are so much more helpful than "Why on earth did you do that?!"
- kimburgess 5y agoThere's a few LSP implementation that are very usable: https://github.com/crystal-lang-tools/scry https://github.com/crystal-lang-tools/scry, https://github.com/elbywan/crystalline https://github.com/elbywan/crystalline Beginning of a tree-sitter parser here too: https://github.com/keidax/tree-sitter-crystal https://github.com/keidax/tree-sitter-crystal
- ricardobeat 5y agoWhich IDE/editor do you use? I've had good experiences with Sublime and VS Code.
- m12k 5y agoSmall correction: ae = 'a'..'e' ccae = ['<', *r, '>'] # => ['<', 'a', 'b', 'c', 'd', 'e', '>'] I'm guessing *r in the second line should have been *ae (or ae in the first line should have been named r) Also "It is new possible" should prpbably have been "It is now possible"
- Cthulhu_ 5y agoI'm pretty sure HN is not the place to post corrections for an article; have you tried any of the channels on https://crystal-lang.org/community/ https://crystal-lang.org/community/ instead?
- mgarciaisaia 5y agoThanks! I'll get that fixed :) EDIT: PR submitted. Feel free to create one next time :) https://github.com/crystal-lang/crystal-website/pull/172/files https://github.com/crystal-lang/crystal-website/pull/172/fil...
- gorgoiler 5y agoWell I never: today I learned about break expressions: nine = while 1 do break 9 end puts nine #=> “nine” I love Ruby. I am not sure how I feel about this. It looks useful for the odd thing or two, maybe.
- tokamak-teapot 5y agoDoes nine really end up containing a string like that? I would have expected it to be the number 9.
- bornelsewhere 5y agoThe example is syntactically incorrect Crystal. Should be nine = while 1; break 9; end puts nine And yes, it prints "9".
- diragon 5y agoWhat is going on with the upvotes here? The incorrect comment by OP is upvoted, while this correct comment is downvoted.
- kawsper 5y agoirb(main):001:0> nine = while 1 do break 9 end => 9 irb(main):002:0> nine.class => Integer irb(main):003:0> puts nine 9 => nil puts might be calling .to_s on the variable, which is why you see a string, but the loop does return an integer.
- quesera 5y agoAnd just to be clear, to_s will return a string, but it will definitely not do the craziness of converting an integer into an English representation of the number! 9.to_s => "9"
- gorgoiler 5y agoSorry. Yes, you are correct. I over-edited my comment to fit a narrow screen, breaking the example.
- dash2 5y agoI noticed at the bottom that they're sponsored by Nikola Motor Corp... surprising!
- rvz 5y agoYes (and they still are). They wrote a blog post on using Crystal a year ago as well. [0] https://manas.tech/blog/2020/02/11/nikola-motor-company/ https://manas.tech/blog/2020/02/11/nikola-motor-company/
- guiriduro 5y agoWas Crystal the power behind Trevor Milton's famed "HTML5 supercomputers", then? Crystal looks nice, faster, more beautiful and ergonomic than Go, but I don't see its application for embedded use-cases, which is where I would think Nikola would target any special sauce, if it has any.
- machiaweliczny 5y agoI think they used it for UI work. Crystal has super simple binding to C.
- arc-in-space 5y agoFinding a description of what the language is actually about on the home page was hard, so here it is: https://crystal-lang.org/api/1.1.0/ https://crystal-lang.org/api/1.1.0/
- b3morales 5y agoThere's a list of what they consider important highlights, with snippets, if you scroll down https://crystal-lang.org/ https://crystal-lang.org/ * Syntax: Crystal’s syntax is heavily inspired by Ruby’s... * Type System: Crystal is statically type checked... and so on
- TranquilMarmot 5y agoI'd love to see a "why" somewhere in there... telling me that its syntax is similar to Ruby and that it has a type system (which Ruby also has as of version 3, yeah?) isn't particularly helpful in telling my why the language is compelling. I don't really see a "why use Crystal instead of Ruby" (or any other language, really) explanation anywhere. Maybe the things listed on the main page are meant to be that? Even if it's not on the main page a comparison would be nice in the docs (https://crystal-lang.org/docs/ https://crystal-lang.org/docs/) or the reference (https://crystal-lang.org/reference/ https://crystal-lang.org/reference/)
- mgarciaisaia 5y agoCrystal started way before Ruby's static type system[0]. Matz even mentioned Crystal as a study case while explaining what Ruby's static type system would be like - back in 2016[1]. [0] https://manas.tech/blog/2016/04/01/the-story-behind-crystal/ https://manas.tech/blog/2016/04/01/the-story-behind-crystal/ [1] https://youtu.be/1l3U1X3z0CE?t=1755 https://youtu.be/1l3U1X3z0CE?t=1755
- cguess 5y agoRuby's type system is completely optional using separate definition files (except Sorbet, which isn't part of the core language), while Crystal's is built in and required.
- rishav_sharan 5y agoSo I am currently making an api server in Crystal and I adore this language. I would add some pros/cons for folks who are interested in trying it out; Pros: - Elegant syntax. Crystal is highly inspired by Ruby and it has a lovely elegant syntax. Syntax is important to me and the clutter of symbols and the busy syntax is why i struggle with Rust. - gorgeous type system. F# is the only other language I can think of which has this lovely and complete a type system. The way Crystal handles Nil (its a type) just feels great in practice. - Perf wise, Crystal is blazing fast. It seems to be marginably faster than most compiled languages like Go, Nim etc in the benchmarks. Though at that level the difference isn't much. - batteries included stdlib - decent documentation. It could be better but imo its good enough. I rarely have to look beyond the documentation if I get stuck anywhere. - small but amazing community. the folks in the community like Ali, blacksmoke, Oleh, Ary and many others etc are super helpful and always ready to teach a newcomer. Cons: - Lack of Windows support. The biggest elephant in the room. the good news is that this is under development and even in this release a lot of progress towards a Windows event loop was made. But if you are going to do web dev, you can always go with wsl for the compilation as most of us do. - Slow compilation speed. Its faster than Rust/C++ but if you are coming from an interpreted language the 5-10 seconds it takes to compile your small project rankles a bit. - DB drivers need to be better. They currently don't support pipelining, ssl, async etc. Not a big deal as the Crystal drivers are performant enough. but I think if these were there, Crystal would get at least 20-30 ranks in the techempower Fortunes benchmarks. - IDE tooling is not yet there. - Small community and hence lack of community packages. Often stuff will have to be done by hand. Things like oauth, openssl conversions etc will need some work from you. - no http/2 support - The lack of a BDFL and corporate sponsorship. This means that the language growth is less structured and highly dependent on the community leaders. Here is an old comment I wrote about Crystal on HN. it is still as true today as it was then; ---------------------------------- I have a love-hate relation with Crystal. Every few months, disenchanted with the core maintainers' priorities, lack of platform and tooling updates and overall deadland syndromes - I denounce Crystal, promise I will never use it again, startup a golang or Rust project, make some non trivial toy stuff and then come crawling back to Crystal. I hate the fact that I love this language and the fact that nothing else (except perhaps f# and nim) seems to have the same effect on me. My favorites Crystal features are its do-end syntax, dat sexy type system hnnnnghhh... , domain modelling using sum types, null checking using types, ultra simple OOPs, insanely productive std and its sheer performance. The bits about the language I detest are the overuse of macros, the utter lack of any platform (windows, http/2 etc.) or tooling improvements (IDE support, slow compilation). The core maintainers are amazing but have a weird obsession with just refactoring the language semantics. Things which really would matter for any language usage are just relegated to GH issues which haven't had any comments on it for months (if not years). The lack of a BDFL and corporate sponsorship really hurts Crystal bad. Its a language without directed growth. For a language which seems to be used the most for web servers, it lacks http/2, db pipelining and async db drivers. There have been plans for redoing the http module for years but it hasn't been done yet. Yet, I love this language despite all its shortcomings. I find it to be one of the most readable languages out there. The community is full of amazing individuals who are ever helpful and welcoming. The core maintainers are super talented developers who really value quality of code. Right now I am working on an api servers and have 3 early implementations - one in Rust-actix, one in pure crystal (no framework) and one in Go-Fiber. The joy of using Crystal and feeling like I am in control of the project are reasons which are pushing me towards using Crystal for the project. But I know that by the next few years, we likely still wouldn't have http/2, async drivers, nice IDE support and many other features that I really need. And so, I will likely have to go with Go. (Rust syntax is just too complex for my taste. And I am not talking about the celebrated borrow checker). I like go. Go is simple. Go is Productive. Go is... just not Crystal. ----------------- Epilogue: I did not go with Go. Its error handling and opinionated formatting turned me off so much that I have returned back to crystal. :/
- ptrwis 5y agoLook at their improvement (2x) in HTTP/RPS after moving to io_uring. It's not there yet though https://github.com/crystal-lang/crystal/issues/10740 https://github.com/crystal-lang/crystal/issues/10740
- ksec 5y agoOh interesting, Ruby doing something similar as well, although not official. [1] https://twitter.com/ioquatix/status/1386594287085780992?s=20 https://twitter.com/ioquatix/status/1386594287085780992?s=20
- dom96 5y agoHow much of that is libevent vs. io_uring and not epoll vs. io_uring? It would also be interesting to compare to other frameworks/languages on the TechEmpower Web Framework benchmarks.
- dengolius 5y agoThere are published video from the latest Crystal 1.0 Conference https://twitter.com/postmodern_mod3/status/1417673689244467201 https://twitter.com/postmodern_mod3/status/14176736892444672...
- valbaca 5y agoBLUF: I love crystal and can't wait for it to get the attention I think it deserves. To give a bit of history of myself and programming languages, I first started as an EE/CS major working with ASM/C/C++/Matlab for EE and C++/Java/Lisp for CS. Up until graduation, it was just a given that programming languages were just a concession given to you so you didn't have to write assembly. OO in the form of C++/Java was the "better alternative" to imperative C. Lucky me. Then I heard about Ruby and Ruby on Rails. After reading "The Ruby Programming Language" and working through the examples, I was blown away by the idea that a language could be for a programmer and be a way to express ideas rather than something we translate ideas into. Metaprogramming and mixins and Procs oh my. Then I started working through Project Euler questions with Ruby and it all came crashing down with the reality of Ruby's runtime. Ruby gave me expressiveness but just could't give me the speed of my equivalent C/Java code. Granted, I was definitely doing very sub-optimal algos but even then, C/Java just didn't care and gave the answer in seconds, not minutes. Since then, Java & JS have paid my bills. I've seen the popularity of Ruby die as Rails fell out of style when Twitter moved away. I've messed around with Crystal, trying to work through the problems in "The Go Programming Language" in Crystal and finding that Crystal is a beautiful language and fast as hell. That said, there's always a trade-off right? Crystal's trade off is in compile time, especially with --release. However, I think that's a reasonable trade-off since your release builds should be on a beefy server and it could save you $$$ if it means your actual production servers can be lean as hell. That said, I'm also aware that this problem is exactly one that the Go language was meant to address (C++'s exponentially growing compile time). Crystal definitely needs: 1. IDE/Debugger support, understandable for a new language, but the language should be "finished" and tooling needs critical attention 2. Libraries. The classic problem of any new language. 3. Major sponsorship (would greatly help with point 1 & 2)
- ibraheemdev 5y agoIt would be great if someone compiled a list of important libraries missing from the ecosystem.
- mgarciaisaia 5y agoThere's one here: https://github.com/crystal-community/crystal-libraries-needed/issues https://github.com/crystal-community/crystal-libraries-neede... Not sure how active it is, though.