Odd, I've really enjoyed seeing Crystal develop but this latest release adds so many features that it feels like the language might fall off my radar again - too much complexity!
Just because you don't use features does not mean they don't add complexity when you're trying to understand some piece of code, or when you're trying to design a piece of code that should interact with other code. (Not taking sides about this language's complexity; I don't know the language)
But seriously, I think C++ and Perl have taught us that if you give programmers the logical equivalent of a Swiss Army Knife, they will use/abuse absolutely every single bit of it to write their programs.
I used to be a big fan of "more than one way to do it", but these days, I'd gladly take "one reasonably clear way to do it that not everyone likes but 'everyone' can live with".
Obviously, it's not that simple. But my suppositions are a response to the statement Just because the features exist does not mean you have to use them.
There is a cost to functionality that exists in a language and you can't just ignore it because someone will use it and you will still need to understand it.
Although I don't personally like the Go language, I can empathize and understand the reasoning behind its strong, opinionated language choices. Go is a perfect example of doing things in a way that not every one likes, but "everyone" can live with, just like gofmt.
> I used to be a big fan of "more than one way to do it"
I used to firmly believe that that was the way a programming language should be. Let me do what I want to do, however I want to do it.
I've finally found myself falling in to almost the complete opposite, with a small addition: "There should be one way to do it, and it should be obvious"
> Python mostly scratches that itch for me, but even there it has multiple methods to do the same stuff within the standard library, like list.sort() and sorted(list)
There's also the list vs tuple thing. I can understand it from an efficiency point of view, but it isn't as consistent as just having one such data structure (e.g., a perl array)
>same stuff within the standard library, like list.sort() and sorted(list)
Those have different use cases. `sorted` is for situations where you would use a list comprehension and immediately consume the result vs `.sort` where you need the iterable sorted for future use.
As a quick scribble, you can do something like the following to sort random numbers in a single line:
result = sorted(random.random() for x in range(10))
Come to the Lua side and learn to enjoy "mechanisms over policy"
"...A fundamental concept in the design of Lua is to provide meta-mechanisms for implementing features, instead of providing a host of features directly in the language. For example, although Lua is not a pure object-oriented language, it does provide meta-mechanisms for implementing classes and inheritance. Lua's meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways."
Recently, all new Crystal releases has introduced only new features for very specific use-cases, or made old ones easier or better to use. For example the new "begin-less and end-less ranges" — unless you need such a thing; there is no need to use it, or give it any care alltogether.
I think it's great. If you're a fan of Ruby it's hard not to like. I'd say it competes with go in many respects. If Ruby is your daily driver crystal is perfect for cases where you need more performance or where non blocking io would be a good fit.
We are using Crystal for our mail flow monitoring tool at mailflowmonitoring.com - create a free account and you can check it in action. It was a delight to deal with. We also created a Crystal email parser - https://github.com/amrood-labs/mail.cr
I've written a couple things in it, mostly little web servers that serve a questionnaire or something, more recently a Lisp and a rudimentary voice chat. I really really like it. Compared to the languages I'm coming from (C/C++ mostly, some Python & C#) the compile time checking is unparalleled. I frequently find that once I've fixed all the compile time errors the program works first time, something I've never experienced in any other imperative language. The standard library is nice too. It's still missing a couple things, for example hash functions better than SHA1 must be accessed by providing their string names to the OpenSSL module at the moment, but overall it's well designed and miles ahead of C/C++ in functionality. My main gripe is the state of Windows support, it works in the Linux subsystem but I spent three hours trying to work out how, for my voice chat program it involved:
1. Turning on something in PowerShell.
2. Installing something from the Windows store.
3. Adding a new repository to Apt.
4. Installing Crystal and all the dependencies of your application.
5. Compiling your application.
6. Installing PulseAudio for Windows.
7. Connecting PulseAudio for Windows to Linux somehow. (I gave up upon opening the guide for how to do this bit).
Hardly a process an end user can be expected to do.
For me it is a really good experience: for example the last update didn't break anything and I'm able to add features consistently and relatively quickly.
I took a look at Mint's website and it seemed interesting, but I have to say I was sold when I saw that it already has emacs support. I'll definitely play with it a bit :)
Been using Crystal on a project that would've been written in basic Ruby.. productivity is amazing. And it has generics! :D https://play.crystal-lang.org/#/r/6r3e
How to get Crystal 0.28.0 on macOS right now! :
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ca8f21cd49a936bf154235b365fa23929f9f688d/Formula/crystal.rb
# or: brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/ca8f21cd49a936bf154235b365fa23929f9f688d/Formula/crystal.rb
# start the local playground
crystal play &; open http://127.0.0.1:8080
30 comments
[ 5.3 ms ] story [ 61.0 ms ] threadBut seriously, I think C++ and Perl have taught us that if you give programmers the logical equivalent of a Swiss Army Knife, they will use/abuse absolutely every single bit of it to write their programs.
I used to be a big fan of "more than one way to do it", but these days, I'd gladly take "one reasonably clear way to do it that not everyone likes but 'everyone' can live with".
Ruby has a lot of features but they all feel reasonably thought out. The language still feels quite elegant.
There is a cost to functionality that exists in a language and you can't just ignore it because someone will use it and you will still need to understand it.
Although I don't personally like the Go language, I can empathize and understand the reasoning behind its strong, opinionated language choices. Go is a perfect example of doing things in a way that not every one likes, but "everyone" can live with, just like gofmt.
I used to firmly believe that that was the way a programming language should be. Let me do what I want to do, however I want to do it.
I've finally found myself falling in to almost the complete opposite, with a small addition: "There should be one way to do it, and it should be obvious"
Python mostly scratches that itch for me, but even there it has multiple methods to do the same stuff within the standard library, like list.sort() and sorted(list) https://medium.com/@DahlitzF/list-sort-vs-sorted-list-aab92c...
There's also the list vs tuple thing. I can understand it from an efficiency point of view, but it isn't as consistent as just having one such data structure (e.g., a perl array)
Those have different use cases. `sorted` is for situations where you would use a list comprehension and immediately consume the result vs `.sort` where you need the iterable sorted for future use.
As a quick scribble, you can do something like the following to sort random numbers in a single line:
From your Medium post: Only the `sorted_builtin` function returns the array, `list_sort` returns None. The `list_sort` function would have to become: Edit: goofed the formatting"...A fundamental concept in the design of Lua is to provide meta-mechanisms for implementing features, instead of providing a host of features directly in the language. For example, although Lua is not a pure object-oriented language, it does provide meta-mechanisms for implementing classes and inheritance. Lua's meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways."
But I have no opinion of Crystal, just prefer small, concise languages in general.
Then the article doesn't say another word about Windows.
1. Turning on something in PowerShell.
2. Installing something from the Windows store.
3. Adding a new repository to Apt.
4. Installing Crystal and all the dependencies of your application.
5. Compiling your application.
6. Installing PulseAudio for Windows.
7. Connecting PulseAudio for Windows to Linux somehow. (I gave up upon opening the guide for how to do this bit).
Hardly a process an end user can be expected to do.
For me it is a really good experience: for example the last update didn't break anything and I'm able to add features consistently and relatively quickly.
https://invidio.us | https://github.com/omarroth/invidious
How to get Crystal 0.28.0 on macOS right now! :
Do you think I should learn crystal by porting a smallish ruby CLI app to it, or make one from scratch porting a small bash app ?
I was thinking of doing it in `go` or `rust` but thinking of crystal after seeing this article.