# Crystal 0.31.1 has been released!

**URL:** <https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185>\
**Category:** Official\
**Created:** [September 30, 2019, 5:39pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185 "2019-09-30T17:39:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [September 30, 2019, 5:39pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/1 "2019-09-30T17:39:28Z")

</div>

Thanks to all the quick adopters of 0.31.0 and the feedback this past week. We hope this patch release allows everybody to move to 0.31 (and keep all your cores busy).

Back to our regularly scheduled programming …

* * *

We’ve written a blog post summarizing the changes in this release: [https://crystal-lang.org/2019/09/30/crystal-0.31.1-released.html](https://crystal-lang.org/2019/09/30/crystal-0.31.1-released.html)

The full changelog is here: [https://github.com/crystal-lang/crystal/releases/tag/0.31.1](https://github.com/crystal-lang/crystal/releases/tag/0.31.1)

All the usual installation methods still apply: [https://crystal-lang.org/docs/installation/](https://crystal-lang.org/docs/installation/)

Docker images and 64 bits Linux packages are available as usual.

The brew formula PR is in [https://github.com/Homebrew/homebrew-core/pull/44735](https://github.com/Homebrew/homebrew-core/pull/44735)

---

<div class="post-metadata">

**Author:** ![girng\_github](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng_github/32/571_2.png) [@girng\_github](https://forum.crystal-lang.org/u/girng_github)\
**Post date:** [September 30, 2019, 6:25pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/2 "2019-09-30T18:25:38Z")

</div>

Nice!

I’m curious if any improvements to the compilation process are coming in the imminent future?

I was reading [this thread on reddit](https://www.reddit.com/r/crystal_programming/comments/da8ylr/compile_speed/), and decided to extract possible implementations:

From **asterite**

> I believe some sort of caching to reuse previous compilation is possible. The only problem is that it’s really, really hard to do it and it’s not the current priority. Ruby is more than 20 years old and they still optimize it. I believe we can worry about these optimizations in the future.

From **[throwawaybrimsenboy](https://www.reddit.com/user/throwawaybrimsenboy)**

> Would it be feasible to implement optional concrete type annotations to speed up the compiler ( compiling ) ?

The ideas so far:

- Compilation Caching
- Optional Concrete Type Annoations

What does the core team believe about these possible solutions?

---

<div class="post-metadata">

**Author:** ![carlhoerberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/carlhoerberg/32/214_2.png) [@carlhoerberg](https://forum.crystal-lang.org/u/carlhoerberg)\
**Post date:** [September 30, 2019, 8:13pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/4 "2019-09-30T20:13:28Z")

</div>

Is it just me or is the compiler way slower in 0.31.1 than 0.31.0?

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [September 30, 2019, 8:14pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/5 "2019-09-30T20:14:04Z")

</div>

There are no plans to improve compilation times before 1.0

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [October 1, 2019, 4:43am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/6 "2019-10-01T04:43:29Z")

</div>

I haven’t notice that and the changes are minimal between those versions. Is there any reproducible experiment?

 ![chart%20(21)](https://canada1.discourse-cdn.com/flex036/uploads/crystal_lang/original/1X/25541dec6637d3fb155b6237d5d81bd85ddf78cb.png)

---

<div class="post-metadata">

**Author:** ![carlhoerberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/carlhoerberg/32/214_2.png) [@carlhoerberg](https://forum.crystal-lang.org/u/carlhoerberg)\
**Post date:** [October 2, 2019, 7:09am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/7 "2019-10-02T07:09:53Z")

</div>

You’re right, reverted back to 0.31.0 and there’s barely any difference, should’ve measured before i reported.

On another note, homebrew doesn’t seem to have been updated with 0.31.1, is that not part of the roll out?

---

<div class="post-metadata">

**Author:** ![vlazar](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/vlazar/32/31_2.png) [@vlazar](https://forum.crystal-lang.org/u/vlazar)\
**Post date:** [October 2, 2019, 9:08am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/8 "2019-10-02T09:08:17Z")

</div>

> <https://github.com/Homebrew/homebrew-core/pull/44735>

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [October 2, 2019, 9:22am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/9 "2019-10-02T09:22:35Z")

</div>

I used to wait until homebrew merged the PR to announce the release. That way there were no surprises. But it was later decided that we can’t wait for everyone to update (for example arch Linux). Basically, we now don’t wait for things we don’t control.

I personally don’t agree because we do take care of homebrew (except the PR merge time) but that’s just me.

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [October 2, 2019, 9:23am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/10 "2019-10-02T09:23:49Z")

</div>

I also waited because I use Mac, but that’s not fair for people who use Linux and can use the release before homebrew merged the PR. There are always tradeoffs :-)

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [October 2, 2019, 10:16am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/11 "2019-10-02T10:16:07Z")

</div>

We should also go back to using a tap, at least until we reach 1.0

---

<div class="post-metadata">

**Author:** ![girng\_github](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng_github/32/571_2.png) [@girng\_github](https://forum.crystal-lang.org/u/girng_github)\
**Post date:** [October 2, 2019, 12:10pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/12 "2019-10-02T12:10:24Z")

</div>

I personally don’t understand why the `/` division operator was changed to result in a `Float64` as default. @ysbaddaden noted there is a new operator ( `//` ), IMO this is sufficient because developers can just opt-in to use `//`, if they want their resulting division value to be `Float64`.

My entire project is broken. Not broken in a way where I can just replace Time.now to Time.local, but broken in a way that I cannot write in words. I don’t think wrapping all math expressions with parenthesis and casting `.to_i` is a good idea, that feels very hacky to me. I have over 60 or so `Int32` ivars, and about 30 of them are modified by simple integer division. This also adds pressure to the developer to utilize unions (which IMO is not a good idea). And it tries to modify the type that was explicitly set for that `ivar`!! I tried c, golang, and they all return an int type.

With that said, Brian’s PR went over my head. Probably because of my lack of mathematics and comprehension skills. And I really don’t want to post on GitHub and complain because I’m not smart enough to rebuke the PR. Mathematics is just out of my league, especially compared with compiler internals. I believe the highest math I have completed is pre-algebra, and that was in high school (I was in special math classes).

However! What I can try to do is express how this has negatively affected me :(. Not only my confidence level as a programmer, but my code. I’ve also spent all day yesterday trying to find a new language because I was so distraught. It would be really stupid of me to do that, because the time it takes to fix all my code would be far less than learning a new language and converting everything. Plus, when I think of ideas or solutions to in-game bugs, I can transcend those thoughts into Crystal code, **subconsciously**. I’m not an expert in Crystal by any means, however I feel confident it’s the right language for me. I don’t want to not use Crystal, it’s a very special thing in my life.

Finally, since Windows has a new editing server for WSL, editing unix files and compiling crystal have been quite fun. I spent all day yesterday fiddling around. I finally added a **Total Compilation Time** line to the progress\_tracker, which is awesome!! This gives me confidence I can fork Crystal and change the `/` back to returning an `Int`. Or, I was thinking of just compiling an older version.

---

<div class="post-metadata">

**Author:** ![carlhoerberg](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/carlhoerberg/32/214_2.png) [@carlhoerberg](https://forum.crystal-lang.org/u/carlhoerberg)\
**Post date:** [October 2, 2019, 12:48pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/13 "2019-10-02T12:48:46Z")

</div>

Right, of course! Forgot that homebrew can take their sweet time merging PRs. A tap sounds like a good idea when iterating fast :)

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [October 2, 2019, 1:29pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/14 "2019-10-02T13:29:46Z")

</div>

I understand your frustration. You dealt with two of the most annoying breaking changes at once: `Time.now` and `//`. Note however that they were introduced in very different versions and their discussion happened time ago.

All the changes are always with the intention of improving. But that is not always a smooth road. To facilitate that the compiler warnings were introduced.

If your code is built with `--warnings=all` to opt-in the warnings, all the `Int#/` calls will show as deprecation, so it will facilitate the lookup and check if that should or should not be replaced by `Int#//`. With `Time.now` since the method was will be eventually removed the migration is easier. In 0.31 you are able to use `--warnings=none` to opt-out and keep using the deprecated method (yet, the `//` change is still needed).

Regarding `/` and `//`, the changes should allow you to use less `to_i`/`to_f` unless you do care about specific precision. Now the operators are able to reflect the intended operation despite the numeric values. As an example, before you were not able to code an `avg` method that will work across all types.

---

<div class="post-metadata">

**Author:** ![girng\_github](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng_github/32/571_2.png) [@girng\_github](https://forum.crystal-lang.org/u/girng_github)\
**Post date:** [October 2, 2019, 1:53pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/15 "2019-10-02T13:53:13Z")

</div>

Maybe this is just an abstract thing testing my perseverance with Crystal. I trust your judgement based on your actions and knowledge in computer science.

Thank you for your understanding.

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [October 3, 2019, 8:00pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/16 "2019-10-03T20:00:21Z")

</div>

And the homebrew formula has been merged. 🎉 🍎 🎉

---

<div class="post-metadata">

**Author:** ![betelgeuse](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/betelgeuse/32/564_2.png) [@betelgeuse](https://forum.crystal-lang.org/u/betelgeuse)\
**Post date:** [October 5, 2019, 4:06pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/17 "2019-10-05T16:06:12Z")

</div>

> [@girng\_github](#):
>
> I personally don’t understand why the `/` division operator was changed to result in a `Float64` as default.

I have to agree - It broke my code, too. Using // works, technically, but it looks broken 😬

Magically casting integer division to a float is unexpected behavior; developers coming over from JVM, C#, C, or other LLVM languages would expect int32 / int32 to return an int32.

One quick example - in web based financial apps and fintech style apps a common rule is to never use floating point code for basic math or accounting. The (admittedly aging) standard practice is to multiply currency figures out by 1000 (to deal with fractions of a cent). Often the same is done for working win cryptocurrency in satoshis - we just multiply it out to eliminate potential bugs across platforms and languages in fp calculations.

cryptography and networking code both expect a result rounded down to zero like C, so those folks are very likely to be coming back to complain.

---

<div class="post-metadata">

**Author:** ![girng\_github](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng_github/32/571_2.png) [@girng\_github](https://forum.crystal-lang.org/u/girng_github)\
**Post date:** [October 5, 2019, 5:07pm UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/18 "2019-10-05T17:07:52Z")

</div>

`//` in math expressions, looks like a regex remnant that got lost in the wild and infiltrated its way into your code 😆

---

<div class="post-metadata">

**Author:** ![jzakiya](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/jzakiya/32/278_2.png) [@jzakiya](https://forum.crystal-lang.org/u/jzakiya)\
**Post date:** [October 6, 2019, 2:06am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/19 "2019-10-06T02:06:52Z")

</div>

I like the way Ruby deals with using `/` for both integers and floats, so a user’s code looks like normal (expected) math expressions.

For integer results: 7 / 2 =\> 3 or a.to\_i / b.to\_i

For float results, make at least one value a float: 7 / 2.0 = 3.5 or a / b.to\_f

Should be easy for compiler because source code explicitly sets numeric types.

---

<div class="post-metadata">

**Author:** ![betelgeuse](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/betelgeuse/32/564_2.png) [@betelgeuse](https://forum.crystal-lang.org/u/betelgeuse)\
**Post date:** [October 6, 2019, 9:18am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/20 "2019-10-06T09:18:03Z")

</div>

If I remember right, the math symbols are implemented as a method call on the type of the left argument in crystal.

Being a lazy bad programmer that hates unit tests, I often cast var\_int / var2.to\_f in Ruby to return a float, rather than call result.to\_f. But Crystal is using the left-side type. var.to\_f / var\_int would dynamically return a float, but the other way around would round down to zero, confusing users.

With the rest of the types to dynamically manage I think the core devs decided that consistent output was a better compromise than a massive switch statement and weeks of QA. So they’ve erred on the side of flexibility to soften the edges of the type system. I see the logic in the trade-off considering where most of the user audience will be drawn from - one of the top questions to type system newbies is why division doesn’t return a float - they expect 3/4 = 0.75, not 0.

---

<div class="post-metadata">

**Author:** ![girng\_github](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/girng_github/32/571_2.png) [@girng\_github](https://forum.crystal-lang.org/u/girng_github)\
**Post date:** [October 6, 2019, 10:58am UTC](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185/21 "2019-10-06T10:58:16Z")

</div>

I don’t know what this phenomenon is called, but I believe when a repo reaches a certain point in time, there is a disconnect that can happen every once in a while. This disconnect is always between the core developers (working on the internals of the language), and the **average user**. I’ve seen it happen with Godot’s repository (been there for over half a decade), and starting to slightly see it in Crystal’s repo.

An example in Crystal: (Time.now -\> Time.local)? Reason? “Because it makes more sense”

Maybe to the contributor / core developers who implemented the PR, but to me, Time.now is far more explicit and less ambiguous than “local” or “utc”. Time.local? Local to what? We already know it’s a local time because we looked at the API! We want the TIME! (.now). This is equivalent to the English language changing how a word is spelled, after 50 years, just because someone thought it sounded funny.

Similarly, in Godot, `5/2 = int`, and `5/2.0 = float`. Same in the `C` language. Same for `Ruby`!  
Crystal utilizes several `C` functions. And after reading [this](https://i.gyazo.com/4c7c519c6703d2b412dacf44ed7ebe03.png), a developer will **inherently assume** … this operation would work the same.

In Godot, the author (reduz), created `GDScript` to be easy to use, have high readability, dynamically typed, dev friendly syntax, lightweight, etc. Over time, a new “warning system” was [added](https://i.gyazo.com/1393c621ccf15572fcf3cedd38eedbcd.png) which bombarded the developer with any kind of error. Then, static typing was introduced, which now it’s not even simple `GDScript` anymore. Luckily, it’s optionable, and reduz is **minimalist and very conservative** about what PRs to merge, etc. That is the only thing protecting Godot from becoming a heap. Which is why I still use Godot, because I have faith in reduz and know Godot is going to be okay. I mean, they even had to create a separate repo (godot-proposals) because of the massive influx of ideas/PRs.

My point is it’s not about a feature creep of new additions to the language (Crystal removing markdown was a good thing). It’s about the use case a core developer might think is okay, compared to what an average user might do. I understand contributors are super important because of their knowledge of the inner-workings of the language. This is vital, however, this doesn’t necessarily mean PRs are objectively correct. **PRs** needs to make **MORE SENSE to the community** , not just several contributors.

For example, my [issue](https://github.com/crystal-lang/crystal/issues/8278) reporting an arithmetic overflow. The arithmetic overflow error is a GREAT new exception because it makes the compiler stronger and more versatile detecting bugs. These kinds of changes will make Crystal prosper, not / -\> // or Time.now -\> Time.local.

“But but, girng is a newb, has not contributed at all to the language, why listen to him?”. Because I’m your average user!!

[Next page](https://forum.crystal-lang.org/t/crystal-0-31-1-has-been-released/1185.md?page=2)
