crystal v0.35.0 Release Notes

Release Date: 2020-06-09 // almost 4 years ago
  • Language changes

    • (breaking-change) Let case when be non-exhaustive, introduce case in as exhaustive. (#9258, #9045, thanks @asterite)
    • ๐Ÿ‘ Allow ->@ivar.foo and ->@@cvar.foo expressions. (#9268, thanks @MakeNowJust)

    Macros

    • ๐Ÿ‘ Allow executing OpAssign (+=, ||=, etc.) inside macros. (#9409, thanks @asterite)

    Standard library

    • (breaking-change) Refactor to standardize on first argument for methods receiving IO. (#9134, #9289, #9303, #9318, thanks @straight-shoota, @bcardiff, @oprypin)
    • (breaking-change) Cleanup Digest and OpenSSL::Digest. (#8426, thanks @didactic-drunk)
    • ๐Ÿ›  Fix Enum#to_s for private enum. (#9126, thanks @straight-shoota)
    • Refactor Benchmark::IPS::Entry to use UInt64 in bytes_per_op. (#9081, thanks @jhass)
    • โž• Add Experimental annotation and doc label. (#9244, thanks @bcardiff)
    • โž• Add subcommands to OptionParser. (#9009, #9133, thanks @RX14, @Sija)
    • ๐Ÿ‘‰ Make NamedTuple#sorted_keys public. (#9263, thanks @waj)
    • ๐Ÿ›  Fix example codes in multiple places. (#9203, thanks @maiha)

    Macros

    • (breaking-change) Remove top-level assert_responds_to macro. (#9085, thanks @bcardiff)
    • (breaking-change) Drop top-level parallel macro. (#9097, thanks @bcardiff)
    • ๐Ÿ›  Fix lazy property not forwarding annotations. (#9140, thanks @asterite)
    • โž• Add host_flag? macro method, not affected by cross-compilation. (#9049, thanks @oprypin)
    • Add .each and .each_with_index to various macro types. (#9120, thanks @Blacksmoke16)
    • โž• Add StringLiteral#titleize macro method. (#9269, thanks @MakeNowJust)
    • โž• Add TypeNode methods to check what "type" the node is. (#9270, thanks @Blacksmoke16)
    • ๐Ÿ›  Fix support TypeNode.name(generic_args: false) for generic instances. (#9224, thanks @Blacksmoke16)

    Numeric

    • (breaking-change) Add Int#digits, reverse BigInt#digits result. (#9383, thanks @asterite)
    • ๐Ÿ›  Fix overflow checking for operations with mixed sign. (#9403, thanks @waj)
    • โž• Add BigInt#factorial using GMP. (#9132, thanks @peheje)

    Text

    • โž• Add String#titleize. (#9204, thanks @hugopl)
    • โž• Add Regex#matches? and String#matches?. (#8989, thanks @MakeNowJust)
    • โž• Add IO overloads to various String case methods. (#9236, thanks @Blacksmoke16)
    • ๐Ÿ‘Œ Improve docs examples regarding Regex::MatchData. (#9010, thanks @MakeNowJust)
    • ๐Ÿ‘Œ Improve docs on String methods. (#8447, thanks @jan-zajic)

    Collections

    • (breaking-change) Add Enumerable#first with fallback block. (#8999, thanks @MakeNowJust)
    • ๐Ÿ›  Fix Array#delete_at bug with negative start index. (#9399, thanks @asterite)
    • ๐Ÿ›  Fix Enumerable#{zip,zip?} when self is an Iterator. (#9330, thanks @mneumann)
    • ๐Ÿ‘‰ Make Range#each and Range#reverse_each work better with end/begin-less values. (#9325, thanks @asterite)
    • ๐Ÿ‘Œ Improve docs on Hash. (#8887, thanks @rdp)

    Serialization

    • (breaking-change) Deprecate JSON.mapping and YAML.mapping. (#9272, thanks @straight-shoota)
    • (breaking-change) Make INI a module. (#9408, thanks @j8r)
    • ๐Ÿ›  Fix integration between record macro and JSON::Serializable/YAML::Serializable regarding default values. (#9063, thanks @Blacksmoke16)
    • ๐Ÿ›  Fix XML.parse invalid mem access in multi-thread. (#9098, thanks @bcardiff, @asterite)
    • ๐Ÿ›  Fix double string escape in XML::Node#content=. (#9300, thanks @straight-shoota)
    • ๐Ÿ‘Œ Improve xpath regarding namespaces. (#9288, thanks @asterite)
    • Escape CDATA end sequences. (#9230, thanks @Blacksmoke16)
    • โž• Add JSON and YAML serialization to Path. (#9156, thanks @straight-shoota)
    • Specify pkg-config name for libyaml. (#9426, thanks @jhass)
    • Specify pkg-config name for libxml2. (#9436, thanks @Blacksmoke16)
    • ๐Ÿ‘‰ Make YAML specs robust against libyaml 0.2.5. (#9427, thanks @jhass)

    Time

    • (breaking-change) Support different number of fraction digits for RFC3339 time format. (#9283, thanks @waj)
    • ๐Ÿ›  Fix parsing AM/PM hours. (#9334, thanks @straight-shoota)
    • ๐Ÿ‘Œ Improve File.utime precision from second to 100-nanosecond on Windows. (#9344, thanks @kubo)

    Files

    • (breaking-change) Move Flate, Gzip, Zip, Zlib to Compress. (#8886, thanks @bcardiff)
    • (breaking-change) Cleanup File & FileUtils. (#9175, thanks @bcardiff)
    • ๐Ÿ›  Fix realpath on macOS 10.15 (Catalina). (#9296, thanks @waj)
    • ๐Ÿ›  Fix File#pos, File#seek and File#truncate over 2G on Windows. (#9015, thanks @kubo)
    • ๐Ÿ›  Fix File.rename to overwrite the destination file on Windows, like elsewhere. (#9038, thanks @oprypin)
    • ๐Ÿ›  Fix File's specs and related exception types on Windows. (#9037, thanks @oprypin)
    • โž• Add support for Path arguments to multiple methods. (#9153, thanks @straight-shoota)
    • โž• Add Path#each_part iterator. (#9138, thanks @straight-shoota)
    • โž• Add Path#relative_to. (#9169, thanks @straight-shoota)
    • โž• Add support for Path pattern to Dir.glob. (#9420, thanks @straight-shoota)
    • ๐Ÿ Implement File#fsync on Windows. (#9257, thanks @kubo)
    • ๐Ÿ”จ Refactor Path regarding empty and .. (#9137, thanks @straight-shoota)

    Networking

    • (breaking-change) Make IO#skip, IO#write returns the number of bytes it skipped/written as Int64. (#9233, #9363, thanks @bcardiff)
    • (breaking-change) Improve error handling and logging in HTTP::Server. (#9115, #9034, thanks @waj, @straight-shoota)
    • (breaking-change) Change HTTP::Request#remote_address type to Socket::Address?. (#9210, thanks @waj)
    • ๐Ÿ›  Fix flush methods to always flush underlying IO. (#9320, thanks @straight-shoota)
    • ๐Ÿ›  Fix HTTP::Server sporadic failure in SSL handshake. (#9177, thanks @waj)
    • WebSocket shouldn't reply with same close code. (#9313, thanks @waj)
    • Ignore response body during WebSocket handshake. (#9418, thanks @waj)
    • Treat cookies which expire in this instant as expired. (#9061, thanks @RX14)
    • Set sync or flush_on_newline for standard I/O on Windows. (#9207, thanks @kubo)
    • Prefer HTTP basic authentication in OAuth2 client. (#9127, thanks @crush-157)
    • โฌ†๏ธ Defer request upgrade in HTTP::Server (aka: WebSockets). (#9243, thanks @waj)
    • ๐Ÿ‘Œ Improve URI::Punycode, HTTP::WebSocketHandler, HTTP::Status documentation. (#9068, #9130, #9180, thanks @Blacksmoke16, @dscottboggs, @wontruefree)
    • โœ‚ Remove HTTP::Params::Builder#to_s, use underlying IO directly. (#9319, thanks @straight-shoota)
    • ๐Ÿ›  Fixed some regular failing specs in multi-thread mode. (#9412, thanks @bcardiff)

    Crypto

    • ๐Ÿ”’ (security) Update SSL server secure defaults. (#9026, thanks @straight-shoota)
    • Add LibSSL NO_TLS_V1_3 option. (#9350, thanks @lun-4)

    ๐ŸŒฒ Logging

    • (breaking-change) Rename Log::Severity::Warning to Warn. Drop Verbose. Add Trace and Notice. (#9293, #9107, #9316, thanks @bcardiff, @paulcsmith)
    • (breaking-change) Allow local data on entries via Log::Metadata and redesign Log::Context. (#9118, #9227, #9150, #9157, thanks @bcardiff, @waj)
    • (breaking-change) Split top-level Log::Metadata from Log::Metadata::Value, drop immutability via clone, improve performance. (#9295, thanks @bcardiff)
    • (breaking-change) Rework Log.setup_from_env and defaults. (#9145, #9240, thanks @bcardiff)
    • โž• Add Log.capture spec helper. (#9201, thanks @bcardiff)
    • ๐ŸŒฒ Redesign Log::Formatter. (#9211, thanks @waj)
    • โž• Add to_json for Log::Context. (#9101, thanks @paulcsmith)
    • โž• Add Log::IOBackend#new with formatter named argument. (#9105, #9434, thanks @paulcsmith, @bcardiff)
    • ๐Ÿ‘ Allow nil as context raw values. (#9121, thanks @bcardiff)
    • โž• Add missing Log#with_context. (#9058, thanks @bcardiff)
    • ๐Ÿ›  Fix types referred in documentation. (#9117, thanks @bcardiff)
    • ๐Ÿ‘ Allow override context within logging calls. (#9146, thanks @bcardiff)
    • Check severity before backend. (#9400, thanks @asterite)

    Concurrency

    System

    • (breaking-change) Deprecate Process#kill, use Process#signal. (#9006, thanks @oprypin, @jan-zajic)
    • Process raises IO::Error (or subclasses). (#9340, thanks @waj)
    • โž• Add Process.quote and fix shell usages in the compiler. (#9043, #9369, thanks @oprypin, @bcardiff)
    • ๐Ÿ Implement Process support on Windows. (#9047, #9021, #9122, #9112, #9149, #9310, thanks @oprypin, @RX14, @kubo, @jan-zajic)
    • ๐Ÿ›  Fix compile-time checking of dup3/clock_gettime methods definition. (#9407, thanks @asterite)
    • ๐Ÿ‘‰ Use Int64 as portable Process.pid type. (#9019, thanks @oprypin)

    โš™ Runtime

    • (breaking-change) Deprecate top-level fork. (#9136, thanks @bcardiff)
    • (breaking-change) Move Debug to Crystal namespace. (#9176, thanks @bcardiff)
    • ๐Ÿ›  Fix segfaults when static linking with musl. (#9238, thanks @waj)
    • Allow calling at_exit inside at_exit. (#9388, thanks @asterite)
    • Rework DWARF loading and fix empty backtraces in musl. (#9267, thanks @waj)
    • โž• Add DragonFly(BSD) support. (#9178, thanks @mneumann)
    • โž• Add Crystal::System::Process to split out system-specific implementations. (#9035, thanks @oprypin)
    • ๐Ÿšš Move internal CallStack to Exception::CallStack. (#9076, thanks @bcardiff)
    • Specify pkg-config name for libevent. (#9395, thanks @jhass)

    Spec

    • Reference global Spec in be_a macro. (#9066, thanks @asterite)
    • โž• Add -h short flag to spec runner. (#9164, thanks @straight-shoota)
    • ๐Ÿ›  Fix crystal spec file paths on Windows. (#9234, thanks @oprypin)
    • ๐Ÿ”จ Refactor spec hooks. (#9090, thanks @straight-shoota)

    Compiler

    • (breaking-change) Improve compiler single-file run syntax to make it shebang-friendly #!. (#9171, thanks @RX14)
    • (breaking-change) Use Process.quote for crystal env output. (#9428, thanks @MakeNowJust)
    • (breaking-change) Simplify Link annotation handling. (#8972, thanks @RX14)
    • ๐Ÿ›  Fix parsing of foo:"bar" inside call or named tuple. (#9033, thanks @asterite)
    • ๐Ÿ›  Fix parsing of anonymous splat and block arg. (#9113, thanks @MakeNowJust)
    • ๐Ÿ›  Fix parsing of unless inside macro. (#9024, #9167, thanks @MakeNowJust)
    • ๐Ÿ›  Fix parsing of \ (backslash + space) inside regex literal to (space). (#9079, thanks @MakeNowJust)
    • ๐Ÿ›  Fix parsing of ambiguous '+' and '-'. (#9194, thanks @max-codeware)
    • ๐Ÿ›  Fix parsing of capitalized named argument. (#9232, thanks @asterite)
    • ๐Ÿ›  Fix parsing of {[] of Foo, self.foo} expressions. (#9329, thanks @MakeNowJust)
    • ๐Ÿ›  Fix cast fun function pointer to Proc. (#9287, thanks @asterite)
    • ๐Ÿ—„ Make compiler warn on deprecated macros. (#9343, thanks @bcardiff)
    • ๐Ÿ‘ Basic support for Win64 C lib ABI. (#9387, thanks @oprypin)
    • ๐Ÿ Make the compiler able to run on Windows and compile itself. (#9054, #9062, #9095, #9106, #9307, thanks @oprypin, @Sija)
    • โž• Add docs regarding CRYSTAL_OPTS. (#9018, thanks @straight-shoota)
    • โœ‚ Remove Process.run("which") from compiler. (#9141, thanks @straight-shoota)
    • ๐Ÿ”จ Refactor type parser. (#9208, thanks @MakeNowJust)
    • ๐Ÿ”จ Refactor & clean-up in compiler. (#8781, #9195, thanks @rhysd, @straight-shoota)
    • ๐Ÿ”จ Refactor CrystalPath::Error. (#9359, thanks @straight-shoota)
    • ๐Ÿ”จ Refactor and improvements on spec_helper. (#9367, #9059, #9393, #9351, #9402, thanks @straight-shoota, @jhass, @oprypin)
    • Split general ABI specs from x86_64-specific ones, run on every platform. (#9384, thanks @oprypin)

    Language semantics

    • ๐Ÿ›  Fix RegexLiteral#to_s output when first character of literal is whitespace. (#9017, thanks @MakeNowJust)
    • ๐Ÿ›  Fix autocasting in multidispatch. (#9004, thanks @asterite)
    • ๐Ÿ›  Fix propagation of annotations into other scopes. (#9125, thanks @asterite)
    • ๐Ÿ›  Fix yield computation inside macro code. (#9324, thanks @asterite)
    • ๐Ÿ›  Fix incorrect type generated with as? when type is a union. (#9417, #9435, thanks @asterite)
    • Don't duplicate instance var in inherited generic type. (#9433, thanks @asterite)
    • Ensure type_vars works for generic modules. (#9161, thanks @toddsundsted)
    • 0๏ธโƒฃ Make autocasting work in default values against unions. (#9366, thanks @asterite)
    • Skip no closure check for non-Crystal procs. (#9248, thanks @jhass)

    Debugger

    • ๐Ÿ‘Œ Improve debugging support. (#8538, thanks @skuznetsov)
    • ๐Ÿšš Move recent additions to DIBuilder to LLVMExt. (#9114, thanks @bcardiff)

    Tools

    Formatter

    • ๐Ÿ›  Fix formatting of regex after some comments. (#9109, thanks @MakeNowJust)
    • ๐Ÿ›  Fix formatting of &.!. (#9391, thanks @MakeNowJust)
    • Avoid crash on heredoc with interpolations. (#9382, thanks @MakeNowJust)
    • ๐Ÿ”จ Refactor: code clean-up. (#9231, thanks @MakeNowJust)

    Doc generator

    • ๐Ÿ›  Fix links to methods with String default values. (#9200, thanks @bcardiff)
    • ๐Ÿ›  Fix syntax highlighting of heredoc. (#9396, thanks @MakeNowJust)
    • ๐Ÿ“„ Correctly attach docs before annotations to following types. (#9332, thanks @asterite)
    • ๐Ÿ‘ Allow annotations and :ditto: in macro. (#9341, thanks @bcardiff)
    • โž• Add project name and version to API docs. (#8792, thanks @straight-shoota)
    • โž• Add version selector to API docs. (#9074, #9187, #9250, #9252, #9254, thanks @straight-shoota, @bcardiff)
    • ๐Ÿ‘‰ Show input type path instead of full qualified path on generic. (#9302, thanks @MakeNowJust)
    • โœ‚ Remove README link in API docs. (#9082, thanks @straight-shoota)
    • โœ‚ Remove special handling for version tags in docs generator. (#9083, thanks @straight-shoota)
    • Refactor is_crystal_repo based on project name. (#9070, thanks @straight-shoota)
    • ๐Ÿ”จ Refactor Docs::Generator source link generation. (#9119, #9305, thanks @straight-shoota)

    Playground

    • ๐Ÿ‘ Allow building compiler without 'playground', to avoid dependency on sockets. (#9031, thanks @oprypin)
    • โž• Add support to jquery version 3. (#9028, thanks @deiv)

    Others

    • CI improvements and housekeeping. (#9012, #9129, #9242, #9370, thanks @bcardiff)
    • โšก๏ธ Update to Shards 0.11.1. (#9446, thanks @bcardiff)
    • Tidy up Makefile and crystal env output. (#9423, thanks @bcardiff)
    • Always include lib directory in the CRYSTAL_PATH. (#9315, thanks @waj)
    • Use SOURCE_DATE_EPOCH only to determine compiler date. (#9088, thanks @straight-shoota)
    • ๐Ÿ Win CI: Bootstrap Crystal, build things on Windows, publish the binary. (#9123, #9155, #9144, #9346, thanks @oprypin)
    • Regenerate implementation tool sample. (#9003, thanks @nulty)
    • Avoid requiring non std-lib spec spec_helper. (#9294, thanks @bcardiff)
    • ๐Ÿ‘Œ Improve grammar and fix typos. (#9087, #9212, #9368, thanks @MakeNowJust, @j8r)
    • ๐Ÿ“„ Hide internal functions in docs. (#9410, thanks @bcardiff)
    • Advertise full crystal spec command for running a particular spec. (#9103, thanks @paulcsmith)
    • โšก๏ธ Update README. (#9225, #9163, thanks @danimiba, @straight-shoota)
    • ๐Ÿ›  Fix LICENSE and add NOTICE file. (#3903, thanks @MakeNowJust)