crystal v0.31.0 Release Notes

Release Date: 2019-09-23 // over 4 years ago
  • Language changes

    • ๐Ÿ‘ Allow non-captured block args with type restriction using & : T -> U. (#8117, thanks @asterite)

    Macros

    • Ensure @type is devirtualized inside macros. (#8149, thanks @asterite)

    Standard library

    • (breaking-change) Remove Markdown from the std-lib. (#8115, thanks @asterite)
    • (breaking-change) Deprecate OptionParser#parse!, use OptionParser#parse. (#8041, thanks @didactic-drunk)
    • ๐Ÿ›  Fix example codes in multiple places. (#8194, thanks @maiha)

    Numeric

    • (breaking-change) Enable overflow by default. (#8170, thanks @bcardiff)
    • (breaking-change) Make / the arithmetic division for all types. (#8120, thanks @bcardiff)
    • Add BigDecimal# ** and BigRational#** (pow operator). (#7860, thanks @jwbuiter)
    • ๐Ÿ‘ป Avoid overflow exception in Number#round(digits, base). (#8204, thanks @bcardiff)
    • ๐Ÿ”จ Refactor Int#divisible_by? for clarity. (#8045, thanks @yxhuvud)

    Text

    • ๐ŸŽ (performance) Minor String#lchop? ASCII-only optimization. (#8052, thanks @r00ster91)

    Collections

    • ๐ŸŽ (performance) Array optimizations for small number of elements. (#8048, thanks @asterite)
    • ๐ŸŽ (performance) Optimize Array#*. (#8087, thanks @asterite)
    • ๐ŸŽ (performance) Hash now uses an open addressing algorithm. (#8017, #8182, thanks @asterite)
    • ๐ŸŽ (performance) Optimize Hash#to_a, Hash#keys and Hash#values. (#8042, thanks @asterite)
    • ๐ŸŽ (performance) Add Hash#put and optimize Set#add?. (#8116, thanks @asterite)
    • ๐Ÿ›  Fixed Slice#== for some generic instantiations, add Slice#<=>. (#8074, thanks @asterite)
    • โž• Add docs on idempotence and methods involving eager evaluation in Iterator. (#8053, thanks @KimBurgess)
    • โž• Add Set#+. (#8121, thanks @sam0x17)
    • ๐Ÿ”จ Refactor Hash to use integer division instead of float division. (#8104, thanks @asterite)

    Serialization

    • (breaking-change) Rename XML::Type to XML::Node::Type, introduce XML::Reader::Type. (#8134, thanks @asterite)
    • ๐Ÿ›  Fixed JSON and YAML parsing of NamedTuple with nilable fields. (#8109, thanks @asterite)
    • ๐Ÿ›  Fixed YAML to emit unicode characters as such. (#8132, thanks @asterite)
    • ๐Ÿ›  Fixed INI generation of empty sections. (#8106, thanks @j8r)

    Files

    • ๐ŸŽ (performance) Optimize Path#join by precomputing capacity if possible. (#8078, thanks @asterite)
    • ๐ŸŽ (performance) Optimize Path#join for the case of joining one single part. (#8082, thanks @asterite)
    • ๐ŸŽ (performance) Optimize Dir.glob. (#8081, thanks @asterite)
    • ๐Ÿ›  Fixed File.basename off-by-one corner-case. (#8119, thanks @ysbaddaden)
    • ๐Ÿ›  Fixed unneeded evaluation of Path.home on Path.expand. (#8128, thanks @asterite)
    • ๐Ÿ›  Fixed Zip::Writer STORED compression. (#8142, thanks @asterite)
    • ๐Ÿ›  Fixed missing check on ARGF if read_count is zero. (#8177, thanks @Blacksmoke16)

    Networking

    • (breaking-change) Replace HTTP::Server::Response#respond_with_error with #respond_with_status. (#6988, thanks @straight-shoota)
    • (breaking-change) Handle too long URIs and too large header fields in HTTP::Request.from_io and remove HTTP::Request::BadRequest. (#8013, thanks @straight-shoota)
    • ๐Ÿ†• Fixed memory leak from SSL_new if ssl_accept fails. (#8088, thanks @rdp)
    • ๐Ÿ›  Fixed WebSocket ipv6 hostname connection. (#8066, thanks @MrSorcus)
    • โž• Add URI#query_params method. (#8090, thanks @rodrigopinto)
    • โž• Add URI#resolve and URI#relativize. (#7716, thanks @straight-shoota)
    • โž• Add #clear, #delete, and #size methods to HTTP::Cookies. (#8107, thanks @sam0x17)
    • ๐Ÿ”จ Refactor http/server_spec. (#8056, thanks @straight-shoota)
    • ๐Ÿ”จ Refactor UDP specs to use random port. (#8139, thanks @waj)

    Concurrency

    • Multithreading. (#8112, thanks @waj)
    • Delay releasing of fiber stack in multi-thread mode. (#8138, thanks @waj)
    • โฑ Make Crystal::Scheduler.init_workers block until workers are ready. (#8145, thanks @bcardiff)
    • ๐Ÿ‘‰ Make Crystal::ThreadLocalValue thread-safe. (#8168, thanks @waj)
    • Let exec_recursive use a thread-local data structure. (#8146, thanks @asterite)
    • โž• Add explicit return types for some channel methods. (#8161, thanks @Blacksmoke16)
    • โœ‚ Remove the dedicated fiber to run the event loop. (#8173, thanks @waj)
    • ๐Ÿ›  Fix corruption of thread linked list. (#8196, thanks @waj)
    • โ†ช Workaround compile on win32 until fibers is implemented. (#8195, thanks @straight-shoota)

    System

    Spec

    Compiler

    • ๐Ÿ›  Fixed ICE on declarations inside fun. (#8076, thanks @asterite)
    • ๐Ÿ›  Fixed missing name_location of some calls. (#8192, thanks @asterite)
    • โš  Activate compiler warnings by default. (#8171, thanks @bcardiff)
    • ๐Ÿ‘Œ Improve return type mismatch error. (#8203, thanks @asterite)
    • ๐Ÿ‘Œ Improve for expression error. (#7641, thanks @r00ster91)

    Language semantics

    • ๐Ÿ›  Fixed abstract def check regarding generic ancestor lookup. (#8098, thanks @asterite)
    • ๐Ÿ›  Fixed missing virtualization of type arguments in Proc types. (#8159, thanks @asterite)
    • ๐Ÿ›  Fixed incorrect typing after exception handler. (#8037, thanks @asterite)
    • ๐Ÿ›  Fixed behaviour when a yield node can't be typed. (#8101, thanks @asterite)
    • ๐Ÿ›  Fixed offsetof on reference types. (#8137, thanks @mcr431)
    • ๐Ÿ‘ Allow rescue var to be closured. (#8143, thanks @asterite)
    • ๐Ÿ”จ Refactor class var and constant initialization. (#8067, #8091, thanks @waj)
    • โž• Add runtime check for recursive initialization of class variables and constants. (#8172, thanks @waj)

    Tools

    Doc generator

    • ๐Ÿ›  Fixed link to constructors of another class. (#8110, thanks @asterite)
    • ๐Ÿ“„ Enable docs from previous def and/or ancestors to be inherited. (#6989, thanks @asterite)

    Others