Skip to content
GitHub Repository Forum RSS-Newsfeed

Crystal 0.20.1 released!

Johannes Müller

Crystal 0.20.1 has been released!

As any release it includes numerous bugfixes, cool features and performance improvements - in 75 commits since 0.20.0.

Exciting Changes

  • p and pp now use pretty printing.
  • finished macro hook was added. It places it’s contents at the end of the program when all other types and methods are known.
class MyModel
    id: Int32

  macro extra_attributes(**values){% for key, value in values %}{% MAPPING[key] = value %}{% end %}

  macro finished

class MyModel
  extra_attributes name: String, foo: Bool

# JSON mapping will have attribute id, name and foo.
  • Local variables can now have type restrictions.
  • method_missing hook can now define a method, this allows it to control whether it captures a block (see PR #3610)
class Foo
  def add(method, &block : -> U) forall U
    puts "added #{method} #{block}"

  macro method_missing(call)
    def {{}}(&block : -> U) forall U
      add({{}}, &block)
end { 1 } # => added foo #<Proc(Int32):0x1063173a0> { 2 } # => added bar #<Proc(Int32):0x1063173b0>

Other Breaking Changes

  • (breaking change) Set#merge as renamed to Set#merge!
  • (breaking change) no longer works with non primitive integers and floats
  • (breaking change) The macro method argify was renamed to splat

Thanks to everyone who supported this release through contributions, reviews and suggestions.