I feel like Crystal isn't as popular as it should be.
I did part of last years Advent of code in it, and it was very easy to convert Ruby solutions to working Crystal solutions that were as fast as the the Go solutions my buddy had submitted.
It's a really impressive language, I hope it doesn't fizzle out.
Crystal, Carp and Nim are my "I hope these catch on" languages. Each has an elegant and intriguingly modern approach to performance targeting programming.
I don’t think much has changed except today’s developers are more open to natively compiled GC’d languages.
Two decades ago everything was running in the JVM or CLR. But today we’re seeing investment in Go, nim, etc.
I also think two decades ago you didn’t need your app to run everywhere. D can be your web app backend, it can compile to wasm, and it can be compiled to a shared library while still keeping you productive with a GC or without a GC if that’s your thing. This means you have a shared library that your electron desktop app can use or your iOS Swift app can use.
I think D tried to be too many thing for too many people. The "better C" paradigm is obviously desired (Nim, V, Zig, and others) but the D approach was to add more to C, (as is nim and V)... I guess zig is unique in that it started by removing things from C and adding one big thing and a few small things.
I love Zig! I started rewriting xv6 in it last year (I should probably get back to that). Just in my day to day I don't want to manage memory, but I still want performance. I'd write Go, but I'm just not a fan of its general approach to anything.
I do agree D has a problem of a split community. You see it on the forums with 50% just wanting better C++ and 50% going GC. I'm actually looking forward to C# AOT sometime soon.
Computer languages are like people: some remain successful throughout their lives, some fade into obscurity after an initial popularity, some bloom in middle age, some are excellent but never gain a following and so forth...
It's too late to pronounce any language dead. Not only is it hurtful to those who use the language, the pronouncement may also be wrong! :-)
For example, one of the languages that I really like is OCaml. You could say that OCaml is a super niche language like D. It's kinda undergoing a renaissance today with the upcoming OCaml 5.0. Some important software is written in OCaml e.g. Coq, pyre-check, flow, rescript, infer etc. I see OCaml remaining relevant and excellent in the years ahead whether or nor it amasses a huge following.
In other words, the number of people using a language is just one of the metrics you should use to assess the language. D has shown a long term resilience that is amazing. The language has been steadily improving and getting refined for a very long period of time which is admirable. So many open source projects run out of steam in a couple of years! Not the case with D!
D has a native, gcc and llvm backend. Quite amazing huh!?
One thing I would say though about D: The language needs to decide who it wants to be.
Go wants to be minimalist garbage collected language with a good concurrency/parallelism story. Rust wants to be a safer C++ with full control on memory. Java wants to be object oriented and garbage collected.
Because its mission is not clear, it ends up trying to please everyone but delight no one!
The day D decides what it wants to be _and_ this message comes from top leadership it will become much more successful! D can still achieve a lot in the future...I am rooting for D to be more successful in 2020s and beyond!
Personally I don’t like the syntax of crystal or nim.
As for Zig I’ve used it (I rewrote the xv6 user space programs in it, and plan to rewrite the rest of the kernel in it one day) but for day to day I don’t want to manage memory.
I like D because it’s a blend of high level and low level. It’s natively compiled and if GC becomes a problem I can just turn it off in critical sections instead of playing with C FFI shenanigans.
It’s an extremely ergonomic language with amazing metaprogramming and error handling (unlike Go).
It gives me full control of memory and the cpu via pointers, scoped allocations, and in-line assembly if I need it. Which results in a light weight binary and low memory usage (unlike Java and C#).
I used to like D, but then, the GC story got too complex and nowadays for non GC there are many alternatives and for GC there's always C#, which I see covering 99% of the GC enabled use cases for D.
I really hate language bashing, and I'd have liked D to succeed, but I'm not sure where it fits anymore.
The Andrei's book that made me aware of the language was published in 2010.
In 2021 Java and C# aren't the same languages as in 2021. The midori team rejoined .NET and has brought many of the learnings into .NET Core, since C# 7.0, C# has been surfacing CLR features that were only available to C++/CLI, and .NET 7 (yeah still one year away) will finally fix the whole ongoing AOT story.
There are runtimes like Meadow for embedded development, runing on top of NuttX.
Java has been feeling the pressure of languages like Go, and also so also improving its value types, GPGPU programming and AOT story. Also supports embedded development and there is that phone OS out there, even if the language is a subset of the real deal.
C++20 has taken most of the top selling D features (auto, modules, if constexpr, ranges,...), even if in a more clunky way, as always. Then GPGPU programming has made it the SQL of graphics programming.
While many argue that Go isn't a systems programming language, others ship compilers, GC, unikernels, Nintendo Switch games, and even firmware written in Go.
Rust has been gaining steam across Linux kernel, the OSes from Amazon, Google, Microsoft, ARM.
Meanwhile D is still trying to find its niche, without offering the ecosystem of the languages above.
The community is great, the language could have been a deal changer 10 years ago, specially when Facebook and Remedy Games played with it (imagine Unity with D instead of C#), but now I fear it has lost the opportunity.
> In 2021 Java and C# aren't the same languages as in 2021
IMHO beginning with the addition of Linq C# walks the way of C++. It is increasingly becoming a language of many faces / aspects. Don't know if this is a good thing.
Even though I get paid to write Java I’m very much so looking forward to AOT C# and may just make it my main language once it’s released. With AOT C# we’ll finally have a mainstream and _ergonomic_ natively compiled language (i.e. not Go). With .NET MAUI for cross platform apps, and AOT Blazor WASM it seems like the one platform to rule them all.
My only gripe with the language I think is async/await but that isn’t a deal breaker considering only Go and Java (eventually) have decided against it.
I get paid to write both (Java and .NET languages), depending on the project.
AOT C# has existed since 2002 in various forms actually.
I wouldn't bet too much on MAUI, in fact I would kind of bet on older GUI stacks until the UI political wars at Redmond kind of settle down on what they actually want to bring forward.
Uno and Avalonia are safer bets for cross platform .NET applications.
At the time there was an alternative standard library called Tango that was more object oriented like Java or .NET, combined with a desktop UI library (desktop apps were my focus at the time) that was similar to .NET's Windows.Form (I think it was called DFL, and surprisingly the site seems to be still online [0]), plus the native speed & simple approach of D1 I really thought it was going to stay relevant for years.
Sadly, then D2 appeared, the community fragmented over time, then Tango was disbanded, and at some point I think I moved on to web development with Flash.
Nim's elevator pitch is looks like Python so it's easy to read/write, compiles down to C and then to native binaries, and runs so fast it'll make your head explode.
The ecosystem around C and C++, existing projects. C++ code is known to be able to build millions of lines of projects. IIRC, Crystal still struggles there, though I think the last year has had improvements there? To be fair, C++ does as well, but how it struggles is better documented.
I'd bet that C++ gives you more low level control than Crystal does, though I'm not deeply familiar with Crystal.
Zig and Rust both seem to eat at the space that C++ occupies more than what I've seen out of Crystal, but I have not followed it closely at all, so I could well be wrong there. Crystal feels closer to the Ruby flavor to Nim's Python flavor, and I know syntax doesn't imply low-levelness, but yeah.
You can certainly write very low-level Nim code though, seeing that things like Arraymancer (high-performance tensor library) and Chronos (an async runtime) are written in pure Nim. Everything you can do in C you can certainly do it in Nim (event better, with generics/templates/macros helping you out). And once the garbage collector is finally removed for the new ARC/ORC runtime (think of Objective-C-like reference counting, but much better), it’s definitely a language that can compete with C++/Zig/Rust.
> The ecosystem around C and C++, existing projects.
Except that with D you can use C++ ecosystem rather seamlessly and still have a GC which enables one to not worry about memory management too much. Everyone likes to bash at D's GC, yet it's one of the huge improvements over C++, it doesn't get in the way and you can also deactivate it. The other huge improvement is the saner language. Zig can also do C interop to a certain extent.
> Crystal feels closer to the Ruby flavor to Nim's Python flavor
Crystal is to Ruby like what Nim is o Python, except that it's done right with a real LLVM based compiler instead of compiles-to-C nonsense, although I'd wish they copied more APIs out of Ruby. Ruby also compiles to C if you enable MJIT. I don't understand the need for a brand new language to do that when one could have Python do it (like Nuitka does but through the official compiler). Instead they chose to write something like Vala, except Vala was designed that way with a purpose in mind (to build upon GObject).
Crystal is managed memory, C++ isn't. C++ gives a level of control and performance that Crystal, Nim, Java, Common-Lisp don't, even if they're quite close performance-wise. Only Rust (and maybe Zig) truly compete with C++. The rest compete with Java.
The memory management can be quite suboptimal. I wrote the same program in both at one point (an experimental language transpiler) and the Crystal version would spiral up into the 10s of GB when converting a very simple file while the C++ version wouldn't even hit 1 GB.
No doubt there was something I could have done to coax it into behaving, but in C++ that was unnecessary. RAII and ordinary standard library containers were enough to make it work.
This was a while ago, so perhaps things have improved.
> After this release, everyone can expect that, at least for any future 1.x version, your code can still compile and work without any significant incompatibility. Language and standard library features won’t be removed or changed in any way that could prevent existing code from compiling and working. The built-in standard library will continue to be enriched but always with backward compatibility in mind.
And yet 1.2 breaks many things.
Anyway it's not a language that will be mainstream because they don't have the resources to make it serious.
It's a pain in the ass to compile Crystal programs on Windows.
With Go? just download the Go compiler, nothing else, Crystal isn't first class on windows.
That's why. A lot of people here don't understand that a good chunk of developers (and students) still use Windows, without any linux subsystem or VM.
PHP became popular because of easyPHP on Windows. If PHP never ran on windows it would never have ever gain its popularity, it doesn't matter if it's then deployed on Linux servers.
Not only a good chunk, but the vast majority. If I'm not wrong, the StackOverflow survey showed that Windows has the same amount of users as Mac and Linux combined.
At the same time, the largest demographic of respondents are from the US, specifically California, where the amount of Apple users are way higher than in the rest of the world.
PHP initially came on the scene when Windows was very popular and important. This might explain why PHP provided good support for Windows.
In the ensuing decades:
- VMs for development have become more popular. You can run Windows but then easily develop on Linux using VirtualBox. Virtualization is very popular now when compared to the late 1990s/early 2000s. You also have WSL and WSL2 and cygwin
- Windows sadly is no longer the development platform of choice. Production runs mainly on Linux. Since deployment is on Linux, its a good idea that development happens on Linux to iron out any subtle platform issues and also get good support for native extensions in languages like Ruby, Python, PHP etc. Some server software/middleware (message brokers, databases, caches etc.) have much better support on Linux. This necessitates again using Linux rather than Windows for local development
- Due to the rise of mobile and web applications, the dominance of the Windows desktop platform has decreased. Not supporting Windows at one time used to be unthinkable but no longer
- The Windows platform in the late 1990s was arguably technically superior and robust when compared to its competitors. Now Linux and MacOS are robust and very capable as well
- MacOS has risen to become important amongst developers
- Docker runs on Linux
All these factors have led to Windows not being a first class citizen for many open source projects.
> If PHP never ran on windows it would never have ever gain its popularity, it doesn't matter if it's then deployed on Linux servers.
This is a historical fact. The situation in 2021 is different. If a new language is trying to break onto the scene today it must support Linux first. MacOS support often comes "for free" because of its BSD heritage. Windows is quite different internally and due to the reasons above, often lags behind in first class support for many open source packages. Platform support at the end of the day is a "network effect" and the network is with Linux/Unix currently.
You're making a lot of assumptions here, some of which are incorrect in my opinion.
If anything, WSL is making Linux more irrelevant as a development environment, and Windows 11 is going to take this to the next level (take a look at Hanselman's demo video [1]).
Yes, production runs in majority on Linux but development happens massively on Windows. With macOS a distant second and Linux barely used as desktops.
Which is just the point I'm making: develop for Linux and don't worry about development for the Windows platform in 2021 (for most scenarios).
And if you're using WSL you are using Linux effectively. Windows is just that UI around you. Microsoft makes some good products/services and I think they have shifted in strategy. They are not so interested in what _specific_ APIs/OS you use (Win32 or Linux ...) as long as you do it "inside" Windows on the Desktop or on Azure in the Cloud. It clear that the Linux platform is dominating because Linux is everywhere from servers to mobiles.
One of the parent comments was complaining about lack of good _native_ windows support in Crystal. I've responded to why it may not be critical to have good _native_ windows support anymore above in detail...
I'm going to watch that video tomorrow because this stuff is fascinating and I really want to see what amazing stuff MSFT has come up with now, with WSL already being pretty darn good.
That said, it's still a VM and Windows is still a PITA to deal with. Just today I wanted install a script as a Windows service. Windows won't do it. You have to Google for 20 minutes, then download some .exe and use that as a wrapper. The simplest things are difficult or impossible, and I don't think shoving your life into a VM is going to solve all that.
I think even a big chunk of Windows users would agree with that too.
However, the point is, it's still massively, unbelievably popular and not supporting Windows is like having a web app that doesn't run on Safari (which IMHO also suck from a developers perspective, pretty okay when just using).
You can get away with it, yes, but your audience will be (depending on context) unnecessarily limited.
I did use something from the terminal (no idea what terminal, there's like 4...), and it installed, but then when I ran it it timed out. Finally found something called "NSSM", and that worked a treat. Of course, only after wading through 100 paid clones with huge Google Ad budgets.
Looking forward to watching that video. But to be honest, Windows is a gaming console for me. My Windows box is hooked up to a 40' tv and has an Xbox controller attached. Work is something I do on a Ubuntu machine.
How is WSL making GNU/Linux distros irrelevant? I've been running Windows apps on my system for maybe 15 years with Wine but somehow that hasn't made Windows irrelevant, in spite of my best wishes.
It makes running Linux as a primary OS irrelevant.
Linux on the desktop has always been a joke, but it's even more irrelevant now. You run Windows as your main development OS and when you're ready to deploy your app to Linux, you launch WSL or run a CI/CD pipeline.
But there is now zero reason to ever run Linux as the main OS on your desktop.
> But there is now zero reason to ever run Linux as the main OS on your desktop.
s/Linux/Windows/ /s
More seriously, i don't understand your point. Just because you're happy with Microsoft's practices doesn't mean free distros are all "a joke" or "irrelevant". Many people use GNU/Linux as a daily driver and we're more than satisfied.
Personal opinion: i just don't understand the appeal for Windows. MacOS at least has some design/UX guidelines which you can like or dislike but they're consistent about... Windows has just so many anti-patterns i don't have enough fingers to count. The only times i ever needed windows was because of phone-related crapware, and even then Wine was more than enough. Why would i need Windows at all?
I develop on Windows. I can run any Linux software that I need in WSL. I run Docker on Windows. I run Kubernetes on Windows. I dislike Apple's walled garden and the small choice of software. I tried many times to like and use Linux as a desktop but I simply couldn't.
Interesting. When I accepted that a WM simply shouldn't interfere with the user I gave up my complains that I can't configure Gnome the way I like it and since then it is a solved problem for me. Actually I increasingly like it with every iteration.
What was your main pain points with GNOME UI? How have you evolved to like it over time, or how has GNOME evolved to fix those painpoints? Personally, my three pain points are (were?) lack of systray, lack of 1D window list (not 2D rendering of all open windows on workspace, which is harder to navigate), no "execute" action for .desktop/.sh files [0], and alt-tab behavior inconsistent with every other window manager and OS i've used in the past [1].
Not finding settings for any of these is what drove me away from GNOME. But i'm always tempted to come back, because GNOME is otherwise very consistent and pleasant. I like that there's utilities i can place in inexperienced hands, for example GNOME Disks to create bootable USBs. But for those non-tech users of GNOME i know, lack of systray and 1D window list are the most painful points.
[0] How are we supposed to teach users to run apps/scripts? I remember long time ago on Ubuntu there was "Open", "Execute" and "Execute in terminal" actions. Nowadays a lot of non-tech people i meet learn to use a terminal just to start Tor Browser, which is not ideal. Is there a simple package i can install to setup such actions?
[1] That alt-tab doesn't consistently take me to the previous window i was on, i find heavily confusing. When i'm switching between browser or terminal windows, GNOME's Alt-Tab takes me a considerable time to reach my previous window because i need to expand the program's group before i can switch. Otherwise, alt-tab takes me to another window that's not the previous window i was on. Can this be configured back to "normal" now?
On GNOME, you can press Alt+Backtick to switch between windows of an app. I like its presence in KDE and GNOME and Mac (and dislike its absence on Windows), but I'm not sure I like how Alt+Tab on Mac (and GNOME?) don't switch between windows of an app by default.
my main paint point with linux DE is the file explorers.
I have tried them all, nautilus, thunar, dolphin, nemo... none of them is as polished as windows explorer, especially in my case when I have a lot east asia languages file names.
I'd admit that my windows explorer is tweaked a bit (like using the oldnewexplorer tool) though.
I understand what you’re saying but outside some circles ( quite large nowadays), Windows is still king by a mile, specifically with people entering this world who do not have the means to spend 2k on a silver machine made of magic. Starting dev is something that happens very casually with no commitment, so you start with what you have.
You're listing a lot of excellent reasons to _choose_ Linux over Windows, but you aren't making a strong case that people _are_ using Linux over Windows.
In order to optimize adoption, a tool should aim for the platforms that potential new users _actually use_, not the ones that they _should_ use.
As of 2021, 45% of Stack Overflow survey responders use Windows [0], while 25% each use Linux and MacOS.
And I am going to advance the hypothesis that the subgroup of SO survey responders actually skews more towards Linux, based on the fact that the sub-subgroup of professional developers were more likely to use Linux. I expect that the much larger set of developers who don't take SO surveys are less likely to be professionals and therefore less likely to use Linux.
Windows is not quite as dominant as it used to be, but poor Windows support will still cut down your growth potential by half (and, if my hypothesis is correct, likely more).
Windows is a real easy way to break into new, young developers and gamers and generate hype.
Even for established products, so many enterprises have mixed Linux/Windows that supporting Windows as a first class citizen can get you in the door there in a lot of places.
If you don't have an easy frictionless story on Windows you're still missing out in 2021, and because so many people think that Windows isn't relevant its a real easy way to capture a market segment. Neglecting windows is leaving money/mindshare on the table.
Does anyone remember the surge of popularity node.js got when microsoft helped it to be a thing also on windows?
I do.
I'm not intelligent (or silly) enough to create my own platform/language but if I were, windows compatibility would have been on the top of my list, second would be making JS developers feel at home (read: C syntax); or Python, if I'm being adventurous.
Different syntax is easier for different people to learn. So by having languages with many different kinds of syntax programming becomes more inclusive.
I have a very hard time reading JS, the single symbol blocks just all bleed together for me visually when dealing with nested blocks.
If you're a dev or CS student in 2021, there is really no excuse not to be running Linux. I installed Linux Mint on various old machines and on the newest one too. Took half an hour, an old usb pen drive, and it just works. At the high price of 0 bucks. If you really need windows, the installer takes care of dual booting.
It's interesting to see comments like "It's 2021 why can't you get Linux, you should or you are not qualified for a dev or even a CS student".
Though I manage my own cent VM, I'm really satisfied with my Windows environment, I can code in so many Languages and do so many things swiftly and easily on my delicately tinkered OS, why would I give it up to just code Crystal?
I must have been ahead of time then. For me there was already no excuse back in 1999 when I installed a "Black Hat" distro booting from Floppy to have CD-Rom drivers and successfully made the transition from a 1.something kernel to 2.something without breaking anything.
I believe it was Haskell I tried on Linux. After multiple compile errors caused by missing libraries and conflicting versions I just gave up. And this is not the only time this happened to me. Even with old languages like C this happened to me in the past.
This is a real problem for beginners because you just don't know all ins and outs of the ecosystem.
Yes, Cristal looks like a very clean and well designed language...
The problem is that being an impressive language is not enough these days.
First, tooling is needed, especially good IDE. Nobody is going to memorize names of all the methods in 100K code base and do refactoring by hand or using "find and replace". And debugging story, yes, one can use gdb, but it is not really very convenient. If I were Crystal creator I would concentrate on a well featured IntelliJ plugin.
Secondly, integrations and support for ecosystem - databases drivers (looking on the docs there are only for MySQL, Postgres and SQlite), that's definitely not enough. Caches (like Redis), message brokers (traditional and log base like Kafka, etc.). In the real live application those are important points. I guess one can use some C/C++ bindings, but, again, this is not convenient.
"A Crystal program executes in a single operating system thread"
I guess this could be performance issue if someone wants to write server in Crystal.
Developers are "spoiled", having cool type system would not make language popular.
That's kind of egg and chicken problem for each new language. It is hard to start from building large ecosystem for an almost unknown language. Hard to afford this. That's why Go or Kotlin got popular - Go had a huge Google backing and funding, Kotlin found a good niche (better Java for Android phones), has a dev tooling company behind it and has all the Java ecosystem as a backup.
Ruby, on the other hand, got at some point "killer application" - Rails that solved big pains of web development.
I don't see how Crystal can fit any of those success scenarios.
All that means is that it's not (yet) going to be a mass-market language. That's fine, not everything needs to be. Ruby wasn't mass-market until, like you said, it got a killer application. All Crystal needs to do is prove itself useful to people long enough for a killer application to emerge, and the rest sorts itself out.
You're strongly overplaying the importance of having an IDE; neither node.js nor Ruby had a strong contender there when they became popular, and I'd argue Python didn't either - at least not one successful enough that you could point to it as unblocking a popularity bottleneck.
Integrations: it's got an FFI system and a dependency management system (in Shards); again, those will sort themselves out if they haven't already. Not everyone has to go through the hassle of wrapping a C library, it's enough for one person to do it and publish their work. Although for some reason our corporate network seems to blanket-block the TLD, so I can't check out how good the crystalshards.xyz selection actually is.
The reasons why some things become popular and others don't are complicated and usually not what people think, and the route one language took to popularity isn't necessarily the only one. But then again, mass-market popularity isn't the only worthwhile goal.
> First, tooling is needed, especially good IDE. Nobody is going to memorize names of all the methods
As an occasional, non-professional programmer, I used to agree. But now that i started with Rust, i realized good docs are just as good (for me) as a full-fledged IDE, easier to implement, and more portable (i can read HTML docs from any computer).
I really love how `cargo doc` for rust programs allows you to generate offline docs (with search index/bar) for your current project and all dependencies.
Concerning the IDE, I am using a text editor without all the auto-completion stuff activated but I use Dash under macOS and I find it very convenient to use and a must-have. And indeed enough for my use cases.
Didn't most languages become popular long before they got a good IDE? Ruby, Rust, Go, Python, Node, etc. There are some exceptions like Kotlin but in general IDE support does not seem very relevant for popularity.
Once you get used to the type notation - which is far better than any of the ones I've seen bolted on to Ruby - it really is a breeze getting stuff done in Crystal compared to Ruby. The only downside I've encountered so far is, as with any newer language, the number of 3rd party libraries available, but I think this is balanced by the easier availability of C libraries (far easier to use than for Ruby) and considerations like portability and speed etc.
Now, I pick Crystal before Ruby where possible, which is the vast majority of the time.
Crystal is definitely one of my favorite compiled languages. It feels like a happy medium between a dynamic language like Python and something fast but rigid like C++. The only real downside I can see is that the ecosystem is very small and the language is not as popular.
As far as I've seen, Crystal's only merit seems to be is that it's more or less Ruby but statically typed and compiled. In the interest of shedding my ignorance maybe someone can tell me why it's worth trying? From my observation it's features don't seem that differentiated from other modern languages like Rust or Zig.
>it's features don't seem that differentiated from other modern languages like Rust or Zig.
I think Crystal is going more for the space of Go. Compiled language that is performant without manually dealing with memory or the borrow checker. As someone who is disappointed with Go, I would love for a language (Nim or Crystal seem best positioned) to fill this niche.
The type system is so strict that if it compiles it will almost always run. Nil is a type that must be explicitly ruled out before you can use a potentially nilable value.
But it avoids the manual memory management/borrow checking/pointer vs. reference vs. value unpleasantness of Zig/Rust/C++.
It's probably most comparable to Java/C#, but something about the design of the syntax and standard library makes it much more appealing than either of those for me.
Really, what modern language has any real unique features? Rust has an actual unique feature (borrow checking). Other than that, they just pick slightly different subsets of what has been around since 1970.
That being said, Ruby for me always felt like the syntactic ideal.
[1,2,3].map { |i| i + 2 }
The combination of data structure literals, trailing closures (blocks), expressions by default, dropping parens - it is ideal for me. That’s subjective, so, no point in discussing that, I can’t be swayed.
But, what I always hated about working on large Ruby apps was a lack of types and concurrency. Add those on, and that’s a language that I would really enjoy.
That’s what it brings to the table. When people like Ruby, it’s because the syntax can be legitimately pleasurable to work with. Not true of any other language. Add on the more industrial aspects like static types, concurrency, and performance, and you have a compelling language. If that doesn’t seem interesting to you, that’s because it’s not for you.
Put 'Crystal takes the “designed for humans” part of Ruby, and applies it to a typed and compiled language that is extremely fast.' right on the top of the landing page! Earlier, I looked over the whole page for a while and couldn't figure out what the point is; your description is exactly what I was looking for.
I am using Crystal for my small projects (microservices), as a script language (as a replacement for Perl), as a parallel computational language for math. And yes, with it's amazing runtime speed, powerful embeded macro-language and expressive syntax - it is probably the best language i've ever used .
But Crystal's slow compilation time is a "breaking things" for big projects. Developers, please fix this!!
I think Crystal is underrated as a language that can be used for teaching programming. The syntax is clear and has very few confusing aspects for beginners.
129 comments
[ 4.6 ms ] story [ 191 ms ] threadIt's a really impressive language, I hope it doesn't fizzle out.
Two decades ago everything was running in the JVM or CLR. But today we’re seeing investment in Go, nim, etc.
I also think two decades ago you didn’t need your app to run everywhere. D can be your web app backend, it can compile to wasm, and it can be compiled to a shared library while still keeping you productive with a GC or without a GC if that’s your thing. This means you have a shared library that your electron desktop app can use or your iOS Swift app can use.
I do agree D has a problem of a split community. You see it on the forums with 50% just wanting better C++ and 50% going GC. I'm actually looking forward to C# AOT sometime soon.
Sun spoiled their uptake by pushing Java the way they did.
It's too late to pronounce any language dead. Not only is it hurtful to those who use the language, the pronouncement may also be wrong! :-)
For example, one of the languages that I really like is OCaml. You could say that OCaml is a super niche language like D. It's kinda undergoing a renaissance today with the upcoming OCaml 5.0. Some important software is written in OCaml e.g. Coq, pyre-check, flow, rescript, infer etc. I see OCaml remaining relevant and excellent in the years ahead whether or nor it amasses a huge following.
In other words, the number of people using a language is just one of the metrics you should use to assess the language. D has shown a long term resilience that is amazing. The language has been steadily improving and getting refined for a very long period of time which is admirable. So many open source projects run out of steam in a couple of years! Not the case with D!
D has a native, gcc and llvm backend. Quite amazing huh!?
One thing I would say though about D: The language needs to decide who it wants to be.
Go wants to be minimalist garbage collected language with a good concurrency/parallelism story. Rust wants to be a safer C++ with full control on memory. Java wants to be object oriented and garbage collected.
Because its mission is not clear, it ends up trying to please everyone but delight no one!
The day D decides what it wants to be _and_ this message comes from top leadership it will become much more successful! D can still achieve a lot in the future...I am rooting for D to be more successful in 2020s and beyond!
As for Zig I’ve used it (I rewrote the xv6 user space programs in it, and plan to rewrite the rest of the kernel in it one day) but for day to day I don’t want to manage memory.
I like D because it’s a blend of high level and low level. It’s natively compiled and if GC becomes a problem I can just turn it off in critical sections instead of playing with C FFI shenanigans.
It’s an extremely ergonomic language with amazing metaprogramming and error handling (unlike Go).
It gives me full control of memory and the cpu via pointers, scoped allocations, and in-line assembly if I need it. Which results in a light weight binary and low memory usage (unlike Java and C#).
I really hate language bashing, and I'd have liked D to succeed, but I'm not sure where it fits anymore.
In 2021 Java and C# aren't the same languages as in 2021. The midori team rejoined .NET and has brought many of the learnings into .NET Core, since C# 7.0, C# has been surfacing CLR features that were only available to C++/CLI, and .NET 7 (yeah still one year away) will finally fix the whole ongoing AOT story.
There are runtimes like Meadow for embedded development, runing on top of NuttX.
Java has been feeling the pressure of languages like Go, and also so also improving its value types, GPGPU programming and AOT story. Also supports embedded development and there is that phone OS out there, even if the language is a subset of the real deal.
C++20 has taken most of the top selling D features (auto, modules, if constexpr, ranges,...), even if in a more clunky way, as always. Then GPGPU programming has made it the SQL of graphics programming.
While many argue that Go isn't a systems programming language, others ship compilers, GC, unikernels, Nintendo Switch games, and even firmware written in Go.
Rust has been gaining steam across Linux kernel, the OSes from Amazon, Google, Microsoft, ARM.
Meanwhile D is still trying to find its niche, without offering the ecosystem of the languages above.
The community is great, the language could have been a deal changer 10 years ago, specially when Facebook and Remedy Games played with it (imagine Unity with D instead of C#), but now I fear it has lost the opportunity.
IMHO beginning with the addition of Linq C# walks the way of C++. It is increasingly becoming a language of many faces / aspects. Don't know if this is a good thing.
Even C23 isn't the same as K&R C.
My only gripe with the language I think is async/await but that isn’t a deal breaker considering only Go and Java (eventually) have decided against it.
AOT C# has existed since 2002 in various forms actually.
I wouldn't bet too much on MAUI, in fact I would kind of bet on older GUI stacks until the UI political wars at Redmond kind of settle down on what they actually want to bring forward.
Uno and Avalonia are safer bets for cross platform .NET applications.
At the time there was an alternative standard library called Tango that was more object oriented like Java or .NET, combined with a desktop UI library (desktop apps were my focus at the time) that was similar to .NET's Windows.Form (I think it was called DFL, and surprisingly the site seems to be still online [0]), plus the native speed & simple approach of D1 I really thought it was going to stay relevant for years.
Sadly, then D2 appeared, the community fragmented over time, then Tango was disbanded, and at some point I think I moved on to web development with Flash.
[0] http://www.dprogramming.com/dfl.php
Here's a project I wrote in Nim that even if you've never even seen Nim before you would understand what's going on. https://github.com/sergiotapia/torrentinim
I'd bet that C++ gives you more low level control than Crystal does, though I'm not deeply familiar with Crystal.
Zig and Rust both seem to eat at the space that C++ occupies more than what I've seen out of Crystal, but I have not followed it closely at all, so I could well be wrong there. Crystal feels closer to the Ruby flavor to Nim's Python flavor, and I know syntax doesn't imply low-levelness, but yeah.
Except that with D you can use C++ ecosystem rather seamlessly and still have a GC which enables one to not worry about memory management too much. Everyone likes to bash at D's GC, yet it's one of the huge improvements over C++, it doesn't get in the way and you can also deactivate it. The other huge improvement is the saner language. Zig can also do C interop to a certain extent.
> Crystal feels closer to the Ruby flavor to Nim's Python flavorCrystal is to Ruby like what Nim is o Python, except that it's done right with a real LLVM based compiler instead of compiles-to-C nonsense, although I'd wish they copied more APIs out of Ruby. Ruby also compiles to C if you enable MJIT. I don't understand the need for a brand new language to do that when one could have Python do it (like Nuitka does but through the official compiler). Instead they chose to write something like Vala, except Vala was designed that way with a purpose in mind (to build upon GObject).
No doubt there was something I could have done to coax it into behaving, but in C++ that was unnecessary. RAII and ordinary standard library containers were enough to make it work.
This was a while ago, so perhaps things have improved.
For example we're passed v1.0 and they keep breaking APIs.
https://crystal-lang.org/2021/03/22/crystal-1.0-what-to-expe...
> After this release, everyone can expect that, at least for any future 1.x version, your code can still compile and work without any significant incompatibility. Language and standard library features won’t be removed or changed in any way that could prevent existing code from compiling and working. The built-in standard library will continue to be enriched but always with backward compatibility in mind.
And yet 1.2 breaks many things.
Anyway it's not a language that will be mainstream because they don't have the resources to make it serious.
What are they? I looked at the blog post and it shows deprecations, not breaking changes.
Seconded. I really wanted to use Crystal for a recent project at work but I wound up writing it in Python because of specific libraries.
The experience was like "hmm how do I do connection pooling... oh cool it's built in!". I definitely want to try to use it for something else.
With Go? just download the Go compiler, nothing else, Crystal isn't first class on windows.
That's why. A lot of people here don't understand that a good chunk of developers (and students) still use Windows, without any linux subsystem or VM.
PHP became popular because of easyPHP on Windows. If PHP never ran on windows it would never have ever gain its popularity, it doesn't matter if it's then deployed on Linux servers.
https://insights.stackoverflow.com/survey/2021#section-most-...
In the ensuing decades:
- VMs for development have become more popular. You can run Windows but then easily develop on Linux using VirtualBox. Virtualization is very popular now when compared to the late 1990s/early 2000s. You also have WSL and WSL2 and cygwin
- Windows sadly is no longer the development platform of choice. Production runs mainly on Linux. Since deployment is on Linux, its a good idea that development happens on Linux to iron out any subtle platform issues and also get good support for native extensions in languages like Ruby, Python, PHP etc. Some server software/middleware (message brokers, databases, caches etc.) have much better support on Linux. This necessitates again using Linux rather than Windows for local development
- Due to the rise of mobile and web applications, the dominance of the Windows desktop platform has decreased. Not supporting Windows at one time used to be unthinkable but no longer
- The Windows platform in the late 1990s was arguably technically superior and robust when compared to its competitors. Now Linux and MacOS are robust and very capable as well
- MacOS has risen to become important amongst developers
- Docker runs on Linux
All these factors have led to Windows not being a first class citizen for many open source projects.
> If PHP never ran on windows it would never have ever gain its popularity, it doesn't matter if it's then deployed on Linux servers.
This is a historical fact. The situation in 2021 is different. If a new language is trying to break onto the scene today it must support Linux first. MacOS support often comes "for free" because of its BSD heritage. Windows is quite different internally and due to the reasons above, often lags behind in first class support for many open source packages. Platform support at the end of the day is a "network effect" and the network is with Linux/Unix currently.
If anything, WSL is making Linux more irrelevant as a development environment, and Windows 11 is going to take this to the next level (take a look at Hanselman's demo video [1]).
Yes, production runs in majority on Linux but development happens massively on Windows. With macOS a distant second and Linux barely used as desktops.
[1] https://www.youtube.com/watch?v=B4VYjxzx2us
And if you're using WSL you are using Linux effectively. Windows is just that UI around you. Microsoft makes some good products/services and I think they have shifted in strategy. They are not so interested in what _specific_ APIs/OS you use (Win32 or Linux ...) as long as you do it "inside" Windows on the Desktop or on Azure in the Cloud. It clear that the Linux platform is dominating because Linux is everywhere from servers to mobiles.
One of the parent comments was complaining about lack of good _native_ windows support in Crystal. I've responded to why it may not be critical to have good _native_ windows support anymore above in detail...
Many people also don't use WSL. Many don't even have the basic nix tools on their path.
You may say that they aren't your target audience, but many new technologies weren't popular until they made them their target audience.
They also realized that the crowd that buys Macs to do UNIX development doesn't care about Linux, they only want a POSIX like environment.
And since GNU/Linux has eroded the other UNIXes, the Linux kernel ABI has become more relevant than POSIX, that is all.
That said, it's still a VM and Windows is still a PITA to deal with. Just today I wanted install a script as a Windows service. Windows won't do it. You have to Google for 20 minutes, then download some .exe and use that as a wrapper. The simplest things are difficult or impossible, and I don't think shoving your life into a VM is going to solve all that.
I think even a big chunk of Windows users would agree with that too.
However, the point is, it's still massively, unbelievably popular and not supporting Windows is like having a web app that doesn't run on Safari (which IMHO also suck from a developers perspective, pretty okay when just using).
You can get away with it, yes, but your audience will be (depending on context) unnecessarily limited.
Linux on the desktop has always been a joke, but it's even more irrelevant now. You run Windows as your main development OS and when you're ready to deploy your app to Linux, you launch WSL or run a CI/CD pipeline.
But there is now zero reason to ever run Linux as the main OS on your desktop.
s/Linux/Windows/ /s
More seriously, i don't understand your point. Just because you're happy with Microsoft's practices doesn't mean free distros are all "a joke" or "irrelevant". Many people use GNU/Linux as a daily driver and we're more than satisfied.
Personal opinion: i just don't understand the appeal for Windows. MacOS at least has some design/UX guidelines which you can like or dislike but they're consistent about... Windows has just so many anti-patterns i don't have enough fingers to count. The only times i ever needed windows was because of phone-related crapware, and even then Wine was more than enough. Why would i need Windows at all?
Not finding settings for any of these is what drove me away from GNOME. But i'm always tempted to come back, because GNOME is otherwise very consistent and pleasant. I like that there's utilities i can place in inexperienced hands, for example GNOME Disks to create bootable USBs. But for those non-tech users of GNOME i know, lack of systray and 1D window list are the most painful points.
[0] How are we supposed to teach users to run apps/scripts? I remember long time ago on Ubuntu there was "Open", "Execute" and "Execute in terminal" actions. Nowadays a lot of non-tech people i meet learn to use a terminal just to start Tor Browser, which is not ideal. Is there a simple package i can install to setup such actions?
[1] That alt-tab doesn't consistently take me to the previous window i was on, i find heavily confusing. When i'm switching between browser or terminal windows, GNOME's Alt-Tab takes me a considerable time to reach my previous window because i need to expand the program's group before i can switch. Otherwise, alt-tab takes me to another window that's not the previous window i was on. Can this be configured back to "normal" now?
I'd admit that my windows explorer is tweaked a bit (like using the oldnewexplorer tool) though.
In order to optimize adoption, a tool should aim for the platforms that potential new users _actually use_, not the ones that they _should_ use.
As of 2021, 45% of Stack Overflow survey responders use Windows [0], while 25% each use Linux and MacOS.
And I am going to advance the hypothesis that the subgroup of SO survey responders actually skews more towards Linux, based on the fact that the sub-subgroup of professional developers were more likely to use Linux. I expect that the much larger set of developers who don't take SO surveys are less likely to be professionals and therefore less likely to use Linux.
Windows is not quite as dominant as it used to be, but poor Windows support will still cut down your growth potential by half (and, if my hypothesis is correct, likely more).
[0] https://insights.stackoverflow.com/survey/2021#most-popular-...
Even for established products, so many enterprises have mixed Linux/Windows that supporting Windows as a first class citizen can get you in the door there in a lot of places.
If you don't have an easy frictionless story on Windows you're still missing out in 2021, and because so many people think that Windows isn't relevant its a real easy way to capture a market segment. Neglecting windows is leaving money/mindshare on the table.
I do.
I'm not intelligent (or silly) enough to create my own platform/language but if I were, windows compatibility would have been on the top of my list, second would be making JS developers feel at home (read: C syntax); or Python, if I'm being adventurous.
I have a very hard time reading JS, the single symbol blocks just all bleed together for me visually when dealing with nested blocks.
Though I manage my own cent VM, I'm really satisfied with my Windows environment, I can code in so many Languages and do so many things swiftly and easily on my delicately tinkered OS, why would I give it up to just code Crystal?
There's WSL and cloud servers are so cheap I don't see a reason to complain it doesn't work easy on Windows.
I believe it was Haskell I tried on Linux. After multiple compile errors caused by missing libraries and conflicting versions I just gave up. And this is not the only time this happened to me. Even with old languages like C this happened to me in the past.
This is a real problem for beginners because you just don't know all ins and outs of the ecosystem.
Just so people know -- go the stack route of building your haskell apps.
Nim draws it's inspiration from Python which seems to be the most popular programming language as of today so it has better chances to succeed.
And if it is as fast as Go, what advantages does it have over Go for someone who doesn't already know Ruby? Go seems easier to learn.
For what it’s worth, there are cases where Crystal is faster than Go too
Also, have fun changing your codebase every 5 years when what’s popular completely changes.
The problem is that being an impressive language is not enough these days.
First, tooling is needed, especially good IDE. Nobody is going to memorize names of all the methods in 100K code base and do refactoring by hand or using "find and replace". And debugging story, yes, one can use gdb, but it is not really very convenient. If I were Crystal creator I would concentrate on a well featured IntelliJ plugin.
Secondly, integrations and support for ecosystem - databases drivers (looking on the docs there are only for MySQL, Postgres and SQlite), that's definitely not enough. Caches (like Redis), message brokers (traditional and log base like Kafka, etc.). In the real live application those are important points. I guess one can use some C/C++ bindings, but, again, this is not convenient.
"A Crystal program executes in a single operating system thread"
I guess this could be performance issue if someone wants to write server in Crystal.
Developers are "spoiled", having cool type system would not make language popular.
That's kind of egg and chicken problem for each new language. It is hard to start from building large ecosystem for an almost unknown language. Hard to afford this. That's why Go or Kotlin got popular - Go had a huge Google backing and funding, Kotlin found a good niche (better Java for Android phones), has a dev tooling company behind it and has all the Java ecosystem as a backup.
Ruby, on the other hand, got at some point "killer application" - Rails that solved big pains of web development.
I don't see how Crystal can fit any of those success scenarios.
You're strongly overplaying the importance of having an IDE; neither node.js nor Ruby had a strong contender there when they became popular, and I'd argue Python didn't either - at least not one successful enough that you could point to it as unblocking a popularity bottleneck.
Integrations: it's got an FFI system and a dependency management system (in Shards); again, those will sort themselves out if they haven't already. Not everyone has to go through the hassle of wrapping a C library, it's enough for one person to do it and publish their work. Although for some reason our corporate network seems to blanket-block the TLD, so I can't check out how good the crystalshards.xyz selection actually is.
The reasons why some things become popular and others don't are complicated and usually not what people think, and the route one language took to popularity isn't necessarily the only one. But then again, mass-market popularity isn't the only worthwhile goal.
As an occasional, non-professional programmer, I used to agree. But now that i started with Rust, i realized good docs are just as good (for me) as a full-fledged IDE, easier to implement, and more portable (i can read HTML docs from any computer).
I really love how `cargo doc` for rust programs allows you to generate offline docs (with search index/bar) for your current project and all dependencies.
C++ went hand in hand with a great IDE (Visual Studio). Java was always used with Eclipse (not good, but ubiquitous).
Before Eclipse Java had Visual Cafe, Visual Age for Java (which got rebooted as Eclipse), Visual J++ and J#.
Now, I pick Crystal before Ruby where possible, which is the vast majority of the time.
Crystal seems better suited for building command line tools, or stuff like ESbuild.
I think Crystal is going more for the space of Go. Compiled language that is performant without manually dealing with memory or the borrow checker. As someone who is disappointed with Go, I would love for a language (Nim or Crystal seem best positioned) to fill this niche.
But it avoids the manual memory management/borrow checking/pointer vs. reference vs. value unpleasantness of Zig/Rust/C++.
It's probably most comparable to Java/C#, but something about the design of the syntax and standard library makes it much more appealing than either of those for me.
That being said, Ruby for me always felt like the syntactic ideal.
[1,2,3].map { |i| i + 2 }
The combination of data structure literals, trailing closures (blocks), expressions by default, dropping parens - it is ideal for me. That’s subjective, so, no point in discussing that, I can’t be swayed.
But, what I always hated about working on large Ruby apps was a lack of types and concurrency. Add those on, and that’s a language that I would really enjoy.
That’s what it brings to the table. When people like Ruby, it’s because the syntax can be legitimately pleasurable to work with. Not true of any other language. Add on the more industrial aspects like static types, concurrency, and performance, and you have a compelling language. If that doesn’t seem interesting to you, that’s because it’s not for you.
Crystal takes the “designed for humans” part of Ruby, and applies it to a typed and compiled language that is extremely fast.
https://crystal-lang.org/2019/09/06/parallelism-in-crystal.h...