![]() ![]() ![]() ![]() Where while the Crystal language has a statically typed system, it is out of the developer’s way. This is one my favorite features (goals) of Crystal. …in this output, we see syntax that is compatible and functional in both languages! (of course, in a real-world app, this will very unlikely be the case) $ crystal run src/bubble_sort_each_loop.crīefore bubble sort, first element: 9 and last element: 1Īfter bubble sort, first element: 1 and last element: 9 The first realization you need to have is that you can write (some) code that runs in both Crystal and in Ruby. Let’s now go over my favorite Crystal language goals and compare them to the Ruby equivalent… These are just a few differences, there are many more there are advantages and disadvantages to each of these differences, I won’t be going over them here, it is something you can google and learn on your own, and I really just want to get to some code! Interpreted (just run the source code file) 3.2.1), at a glance, here are key differences:Ĭompiled (compile source code, then run binary) This is prove you can have the best of both worlds! Crystal vs Ruby I particularly like the first, second, and last goals. Have compile-time evaluation and generation of code, to avoid boilerplate code.Be able to call C code by writing bindings to it in Crystal.Statically type-checked but without having to specify the type of variables or method arguments.Have a syntax similar to Ruby (but compatibility with it is not a goal).More specifically, from the language source code repository, the goals are stated as: In my limited experience using Crystal, I’ve found that they crush both of these objectives! Which I read as, a language like Ruby designed for ease of use by human beings (this is where a programming language like C fails), but also a language that like other programming languages such as C are designed to be efficient when running on a computer (this is where Ruby usually fails). So what is the Crystal programming language? According to their website, their motto is: This Hacker News post introduced me to this article, that article instroduced me to this other article, and in that fashion I got introduced to the Crystal programming language. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |