Skip to content

Releases: crystal-lang/crystal

0.25.1

28 Jun 16:07
@waj waj
b782738
Compare
Choose a tag to compare

Standard library

Macros

Collections

Serialization

  • Add #dup and #clone for JSON::Any and YAML::Any. (6266, thanks @asterite)
  • Add docs example of nesting mappings to YAML.builder. (#6097, thanks @kalinon)

Time

Files

Networking

Misc

  • Fixed mmap usage on OpenBSD 6.3+. (#6250, thanks @jcs)
  • Fixed big/big_int, big/big_float, etc are now able to be included directly. (#6267, thanks @asterite)
  • Refactor dependency in Crystal::Hasher to avoid load order issues. (#6184, thanks @ysbaddaden)

Compiler

  • Fixed a leakage of unbounded generic type variable and show error. (#6128, thanks @asterite)
  • Fixed error message when lookup of library fails and lib's name contains non-alpha chars. (#6187, thanks @oprypin)
  • Fixed integer kind deduction for very large negative numbers. (#6182, thanks @rGradeStd)
  • Refactor specs tempfiles and data files usage in favor of portability (#5951, thanks @straight-shoota)
  • Improve formatting and information in some compiler error messages. (#6261, thanks @RX14)

Tools

Formatter

Doc generator

Misc

0.25.0

15 Jun 07:09
7fb783f
Compare
Choose a tag to compare

New features and breaking changes

  • (breaking-change) Time zones has been added to Time. (#5324, #5819, thanks @straight-shoota)
  • (breaking-change) Drop HTTP.rfc1123_date in favor of HTTP.format_time and add time format implementations for ISO-8601, RFC-3339, and RFC-2822. (#5123, thanks @straight-shoota)
  • (breaking-change) crystal deps is removed, use shards. (#5544, thanks @asterite)
  • (breaking-change) Hash#key was renamed as Hash#key_for. (#5444, thanks @marksiemers)
  • (breaking-change) JSON::Any and YAML::Any have been re-implemented solving some inconsistencies and avoiding the usage of recursive aliases (JSON::Type and YAML::Type have been removed). (#5183, thanks @asterite)
  • (breaking-change) Multiple heredocs can be used as arguments and methods can be invoked writing them in the initial delimiter, also empty heredocs are now supported. (#5578, #5602, #6048, thanks @asterite and @makenowjust)
  • (breaking-change) Refactor signal handlers and avoid closing pipe at exit. (#5730, thanks @ysbaddaden)
  • (breaking-change) Improve behaviour of File.join with empty path component. (#5915, thanks @straight-shoota)
  • (breaking-change) Drop Colorize#push in favor of Colorize#surround and allow nested calls across the stack. (#4196, thanks @makenowjust)
  • (breaking-change) File.stat was renamed to File.info and a more portable API was implemented. (#5584, #6161, thanks @RX14 and @bcardiff)
  • (breaking-change) Refactor HTTP::Server to bind to multiple addresses. (#5776, #5959, thanks @straight-shoota)
  • (breaking-change) Remove block argument from loop. (#6026, thanks @asterite)
  • (breaking-change) Do not collapse unions for sibling types. (#6024, thanks @asterite)
  • (breaking-change) Disallow typeof in type restrictions. (#5192, thanks @asterite)
  • (breaking-change) Perform unbuffered read when IO::Buffered#sync = true. (#5849, thanks @RX14)
  • (breaking-change) Drop when _ support. (#6150, thanks @makenowjust)
  • (breaking-change) The DivisionByZero exception was renamed to DivisionByZeroError. (#5395, thanks @sdogruyol)
  • A bootstrap windows port has been added to the standard library. It's not usable for real programs yet. (#5339, #5484, #5448, thanks @RX14)
  • Add automatic casts on literals arguments for numbers and enums. (#6074, thanks @asterite)
  • Add user defined annotations. (#6063, #6084, #6106, thanks @asterite)
  • Add macro verbatim blocks to avoid nested macros. (#6108, thanks @asterite)
  • Allow namespaced expressions to define constants eg: Foo::Bar = 1. (#5883, thanks @bew)
  • Allow trailing = in symbol literals. (#5969, thanks @straight-shoota)
  • Allow redefining None to 0 for @[Flags] enum. (#6160, thanks @bew)
  • Suggest possible solutions to failing requires. (#5487, thanks @RX14)
  • Allow pointers of external C library global variables. (#4845, thanks @larubujo)
  • Decouple pretty-printing (pp) and showing the expression (!): p, pp, p!, pp!. (#6044, thanks @asterite)
  • Add ivars default value reflection in macros. (#5974, thanks @asterite)
  • Add argless overload to Number#round to rounds to the nearest whole number. (#5397, thanks @Sija)
  • Add Int#bits_set? to easily check that certain bits are set. (#5619, thanks @RX14)
  • Add Float32 and Float64 constants. (#4787, thanks @konovod)
  • Add allocated bytes per operation in Benchmark.ips. (#5522, thanks @asterite)
  • Add String#to_utf16 and String.from_utf16. (#5541, #5579, #5583 thanks @asterite, @RX14 and @straight-shoota)
  • Add String#starts_with?(re: Regex). (#5485, thanks @makenowjust)
  • Add Regex.needs_escape?. (#5962, thanks @Sija)
  • Add Hash#last_key and Hash#last_value. (#5760, thanks @j8r)
  • Add no-copy iteration to Indexable. (#4584, thanks @cjgajard)
  • Add Time#at_{beginning,end}_of_second (#6167, thanks @straight-shoota)
  • Add IO::Stapled to combine two unidirectional IOs into a single bidirectional one. (#6017, thanks @straight-shoota)
  • Add context to errors in JSON.mapping generated code. (#5932, thanks @straight-shoota)
  • Add JSON::Serializable and YAML::Serializable attribute powered mappings. (#6082, thanks @kostya)
  • Add mode param to File.write. (#5754, thanks @woodruffw)
  • Add Punycode/IDNA support and integrate with DNS lookup. (#2543, thanks @makenowjust)
  • Add HTTP::Client#options method. (#5824, thanks @mamantoha)
  • Add support for Last-Modified and other cache improvements to HTTP::StaticFileHandler. (#2470, #5607, thanks @bebac and @straight-shoota)
  • Add operations and improvements related to BigDecimal and BigFloat. (#5437, #5390, #5589, #5582, #5638, #5675, thanks @Sija and @mjago)
  • Add BigDecimal and UUID JSON support. (#5525, #5551, thanks @lukeasrodgers and @lachlan)
  • Add missing UUID#inspect. (#5574, thanks @ngsankha)
  • Add Logger configuration in initializer. (#5618, thanks @Sija)
  • Add custom separators in CSV.build. (#5998, #6008 thanks @Sija)
  • Add INI.build to emit INI files. (#5298, thanks @j8r)
  • Add Process.chroot. (#5577, thanks @chris-huxtable)
  • Add Tempfile.tempname to create likely nonexisting filenames. (#5360, thanks @woodruffw)
  • Add FileUtils#ln, ln_s, and ln_sf. (#5421, thanks @woodruffw)
  • Add support 8bit and true color to Colorize. (#5902, thanks @makenowjust)
  • Add comparison operators between classes. (#5645, thanks @asterite)
  • Add exception cause in backtrace. (#5833, thanks @RX14)
  • Add unhandled exception as argument in at_exit. (#5906, thanks @makenowjust)
  • Add support to target aarch64-linux-musl. (#5861, thanks @jirutka)
  • Add #clear method to ArrayLiteral/HashLiteral for macros. (#5265, thanks @Sija...
Read more

0.24.2

09 Mar 20:22
@waj waj
Compare
Choose a tag to compare

0.24.1

23 Dec 20:42
Compare
Choose a tag to compare

New features

  • Add ThinLTO support for faster release builds in LLVM 4.0 and above. (#4367, thanks @bcardiff)
  • (breaking-change) Add UUID type. Random::Secure.uuid has been replaced with UUID.random. (#4453, thanks @wontruefree)
  • Add a BigDecimal class for arbitrary precision, exact, decimal numbers. (#4876 and #5255, thanks @vegai and @Sija)
  • Allow Set to work as a case condition, which matches when the case variable is inside the set. (#5269, thanks @makenowjust)
  • (breaking-change) Change Time::Format codes to allow more robust options for parsing sub-second precision times. (#5317, thanks @bcardiff)
  • Add Time.utc, an alias of Time.new which shortens creating UTC times. (#5321, thanks @straight-shoota)
  • Add custom extension support to Tempfile. (#5264, thanks @jreinert)
  • Add reduce method to TupleLiteral and ArrayLiteral when using macros. (#5294, thanks @javanut13)
  • Export a JSON representation of the documentation in the generated output. (#4746 and #5228, thanks @straight-shoota)
  • Make gc/none garbage collection compile again and allow it to be enbled using -Dgc_none compiler flag. (#5314, thanks @ysbaddaden)

Standard library bugs fixed

  • Make String#[] unable to read out-of-bounds when the string ends in a unicode character. (#5257, thanks @Papierkorb)
  • Fix incorrect parsing of long JSON floating point values. (#5323, thanks @benoist)
  • Replace the default hash function with one resistant to hash DoS. (#5146, thanks @funny-falcon)
  • Ensure equal numbers always have the same hashcode. (#5276, thanks @akzhan)
  • Fix struct equality when two structs descend from the same abstract struct. (#5254, thanks @hinrik)
  • Fix URI#full_path not to append a ? unless the query params are nonempty. (#5340, thanks @paulcsmith)
  • Fix HTTP::Params.parse to parse && correctly. (#5274, thanks @akiicat)
  • Disallow null bytes in ENV keys and values. (#5216, thanks @Papierkorb)
  • Disallow null bytes in XML::Node names and content. (#5200, thanks @RX14)
  • Fix IO#blocking= on OpenBSD. (#5283, thanks @wmoxam)
  • Fix linking programs in OpenBSD. (#5282, thanks @wmoxam)

Compiler bugs fixed

  • Stop incorrectly finding top-level methods when searching for a super method. (#5202, thanks @lbguilherme)
  • Fix parsing regex literals starting with a ; directly after a call (ex p /;/). (#5208, thanks @makenowjust)
  • Correct a case where Expressions#to_s could produce invalid output, causing macro expansion to fail. (#5226, thanks @asterite)
  • Give error instead of crashing when self is used at the top level. (#5227, thanks @makenowjust)
  • Give error instead of crashing when using instance_sizeof on a generic type without providing it's type arguments. (#5209, thanks @lbguilherme)
  • Fix parsing calls when short block syntax (&.foo) is followed by a newline. (#5237, thanks @makenowjust)
  • Give error instead of crashing when an unterminated string array literal (%w()) sits at the end of a file. (#5241, thanks @asterite)
  • Give error when attempting to use macro yield ({{yield}}) outside a macro. (#5307, thanks @makenowjust)
  • Fix error related to generic inheritance. (#5284, thanks @makenowjust)
  • Fix compiler crash when using recursive alias and generics. (#5330, thanks @makenowjust)
  • Fix parsing foo(+1) as foo + 1 instead of foo(1) where foo was a local variable. (#5336, thanks @makenowjust)
  • Documentation generator: Keep quoted symbol literals quoted when syntax highlighting code blocks in documentation output. (#5238, thanks @makenowjust)
  • Documentation generator: Keep the original delimiter used when syntax highlighting string array literals. (#5297, thanks @makenowjust)
  • Documentation generator: Fix XSS vulnerability when syntax highlighting string array literals. (#5259, thanks @makenowjust)
  • Formatter: fix indentation of the last comment in a begin/end block. (#5198, thanks @makenowjust)
  • Formatter: fix formatting parentheses with multiple lines in. (#5268, thanks @makenowjust)
  • Formatter: fix formatting $1?. (#5313, thanks @makenowjust)
  • Formatter: ensure to insert a space between { and % characters to avoid forming {% macros. (#5278, thanks @makenowjust)

Misc

0.24.0

30 Oct 17:10
Compare
Choose a tag to compare
0.24.0 Pre-release
Pre-release

⚠️ WARNING: this is a pre-release version of Crystal. Do not use this in production.

  • (breaking-change) HTTP::Client#post_form is now HTTP::Client.post(form: ...)
  • (breaking-change) Array#reject!, Array#compact! and Array#select! now return self (#5154)
  • (breaking-change) Remove the possibility to require big_int, big_float or big_rational individually: use require "big" instead (#5121)
  • (breaking-change) Spec: remove expect_raises without type argument (#5096)
  • (breaking-change) IO is now a class, no longer a module (#4901)
  • (breaking-change) Time constructors now have nanosecond and kind as named argument (#5072)
  • (breaking-change) Removed XML.escape. Use HTML.escape instead (#5046)
  • (breaking-change) Removed macro def (#5040)
  • (breaking-change) SecureRandom is now Random::Secure (#4894)
  • (breaking-change) HTML.escape now only escapes &<>"' (#5012)
  • (breaking-change) To define a custom hash method you must now define hash(hasher) (#4946)
  • (breaking-change) Flate::Reader.new(&block) and Flate::Writer.new(&block) now use the name open (#4887)
  • (breaking-change) Use an Enum for Process stdio redirections (#4445)
  • (breaking-change) Remove '$0' special syntax
  • (breaking-change) Remove bare array creation from multi assign (a = 1, 2, 3) (#4824)
  • (breaking-change) Rename skip macro method to skip_file (#4709)
  • (breaking-change) StaticArray#map and Slice#map now return their same type instead of Array (#5124)
  • (breaking-change) Tuple#map_with_index now returns a Tuple. (#5086)
  • Packages built with LLVM 3.9.1. They should (hopefully) fix #4719
  • Syntax: Allow flat rescue/ensure/else block in do/end block (#5114)
  • Syntax: fun names and lib function calls can now start with Uppercase
  • Macros: Using an alias in macros will now automatically resolve it to is aliased type (#4995)
  • Macros: The flags bits32 and bits64 are now automatically defined in macros
  • The YAML module has now full support for the 1.1 core schema with additional types, and properly supports aliases and merge keys (#5007)
  • Add --output option to crystal docs (#4937)
  • Add Time#days_in_year: it returns the no of days in a given year (#5163)
  • Add Time.monotonic to return monotonic clock (#5108)
  • Add remove_empty option to many String#split overloads
  • Add Math.sqrt overloads for Bigs (#5113)
  • Add --stdin-filename to crystal command to compile source from STDIN (#4571)
  • Add Crystal.main to more easily redefine the main of a program (#4998)
  • Add Tuple.types that returns a tuple of types (#4962)
  • Add NamedTuple.types that returns a named tuple of types (#4962)
  • Add NamedTuple#merge(other : NamedTuple) (#4688)
  • Add YAML and JSON.mapping presence: true option (#4843)
  • Add Dir.each_child(&block) (#4811)
  • Add Dir.children (#4808)
  • HTML.unescape now supports all HTML5 named entities (#5064)
  • Regex now supports duplicated named captures (#5061)
  • rand(0) is now valid and returns 0
  • Tuple#[] now supports a negative index (#4735)
  • JSON::Builder#field now accepts non-scalar values (#4706)
  • Number#inspect now shows the number type
  • Some additions to Big arithmetics (#4653)
  • Increase the precision of Time and Time::Span to nanoseconds (#5022)
  • Upgrade Unicode to 10.0.0 (#5122)
  • Support LLVM 5.0 (#4821)
  • Lots of bugs fixed

0.23.1

13 Jul 19:13
Compare
Choose a tag to compare

This is mainly a bugfix release.

The biggest changes are not in the compiler's codebase, but in the release process. Specifically, compatibility with older platforms lost in the 0.23.0 release has been recovered (Debian 7/Ubuntu 14.04, Centos 6), while keeping the builds with LLVM 3.8.

0.23.0

29 Jun 19:31
Compare
Choose a tag to compare

This release has been built with LLVM 3.8.

As discussed in crystal-lang/omnibus-crystal#17, that means dropping support for Debian 7, and CentOS. Users on those platforms can still build from source using LLVM 3.5, but that's not recommended since it's buggy (see #4104).

  • (breaking-change) Logger#formatter takes a Severity instead of a String (See #4355, #4369, thanks @Sija)
  • (breaking-change) Removed IO.select (See #4392, thanks @RX14)
  • Added Crystal::System::Random namespace (See #4450, thanks @ysbaddaden)
  • Added Path#resolve? macro method (See #4370, #4408, thanks @RX14)
  • Added range methods to BitArray (See #4397, #3968, thanks @RX14)
  • Added some well-known HTTP Status messages (See #4419, thanks @akzhan)
  • Added compiler progress indicator (See #4182, thanks @RX14)
  • Added System.cpu_cores (See #4449, #4226, thanks @miketheman)
  • Added separator and quote_char to CSV#each_row (See #4448, thanks @timsu)
  • Added map_with_index! to Pointer, Array and StaticArray (See #4456, #3356, #3354, thanks @Nephos)
  • Added headers parameter to HTTP::WebSocket constructors (See #4227, #4222, thanks @adamtrilling)
  • HTTP::StaticFileHandler can disable directory listing (See #4403, #4398, thanks @joaodiogocosta)
  • bin/crystal now uses /bin/sh instead of /bin/bash (See #3809, #4410, thanks @TheLonelyGhost)
  • crystal init generates a .editorconfig file (See #4422, #297, thanks @akzhan)
  • man page for crystal command (See #2989, #1291, thanks @dread-uo)
  • Re-raising an exception doesn't overwrite its callstack (See #4487, #4482, thanks @akzhan)
  • MD5 and SHA1 documentation clearly states they are not cryptographically secure anymore (See #4426, thanks @RX14)
  • Fixed Crystal not reusing .o files across builds (See #4336)
  • Fixed SomeClass.class.is_a?(SomeConst) causing an "already had enclosing call" exception (See #4364, #4390, thanks @rockwyc992)
  • Fixed HTTP::Params.parse query string with two = gave wrong result (See #4388, #4389, thanks @akiicat)
  • Fixed Class.class.is_a?(Class.class.class.class.class) 🎉 (See #4375, #4374, thanks @rockwyc992)
  • Fixed select hanging when sending before receive (See #3862, #3899, thanks @kostya)
  • Fixed "Unknown key in access token json: id_token" error in OAuth2 client (See #4437)
  • Fixed macro lookup conflicting with method lookup when including on top level (See #236)
  • Fixed Vagrant images (see #4510, #4508, thanks @Val)
  • Some bug fixes

0.22.0

21 Apr 12:50
Compare
Choose a tag to compare
  • (breaking-change) Removed Process.new(pid) is now private (See #4197)
  • (breaking-change) IO#peek now returns an empty slice on EOF (See #4240, #4261)
  • (breaking-change) Rename WeakRef#target to WeakRef#value (See #4293)
  • (breaking-change) Rename HTTP::Params.from_hash to HTTP::Params.encode (See #4205)
  • (breaking-change) '\"' is now invalid, use '"' (See #4309)
  • Improved backtrace function names are now read from DWARF sections (See #3958, thanks @ysbaddaden)
  • Improved sigfaults and exceptions are printed to STDERR (See #4163, thanks @Sija)
  • Improved SSL Sockets are now buffered (See #4248)
  • Improved type inference on loops (See #4242, #4243)
  • Improved pp and p, the printed value is returned (See #4285, #4283, thanks @makenowjust)
  • Added support for OpenSSL 1.1.0 (See #4215, #4230, thanks @ysbaddaden)
  • Added SecureRandom#random_bytes(Bytes) (See #4191, thanks @konovod)
  • Added setting and deleting of attributes on XML::Node (See #3902, thanks @bmmcginty)
  • Added File.touch and FileUtils.touch methods (See #4069, thanks @Sija)
  • Added #values_at for CSV (See #4157, thanks @need47)
  • Added Time#clone (See #4174, thanks @Sija)
  • Added ancestors macro method (See #3875, thanks @david50407)
  • Added skip macro method (#4237, thanks @mverzilli)
  • Added Colorize.on_tty_only! for easier toggling (See #4075, #4271, thanks @makenowjust)
  • Added WebSocket#on_binary to receive binary messages (See #2774, thanks @lbguilherme)
  • Fixed Iterator.of stops iterating when Iterator.stop is returned (See #4208)
  • Fixed String#insert for non-ascii Char (See #4164, thanks @Papierkorb)
  • Fixed File.link now creates a hard link (#4116, thanks @KCreate)
  • Fixed error message for #to_h over empty NamedTuple (See #4076, thanks @karlseguin)
  • Fixed NamedTuple#to_h does no longer call to value's #clone (See #4203)
  • Fixed Math#gamma and Math#lgamma (See #4229, thanks @KCreate)
  • Fixed TCPSocket creation for 0 port for Mac OSX (See #4177, thanks @will)
  • Fixed repo name extraction from git remote in doc tool (See #4132, thanks @Sija)
  • Fixed self resolution when including a generic module (See #3972, thanks @makenowjust)
  • Fixed debug information was missing in some cases (See #4166, #4202, #4254)
  • Fixed use generic ARM architecture target triple for all ARM architectures (See #4167, thanks @ysbaddaden)
  • Fixed macro run arguments escaping
  • Fixed zsh completion (See #4284, thanks @veelenga)
  • Fixed honor --no-color option in spec (See #4306, thanks @luislavena)
  • Some bug fixes

0.21.1

07 Mar 13:27
Compare
Choose a tag to compare
  • Improved lookup of abstract def implementors (see #4052)
  • Improved allocation of objects without pointer instance variables using malloc_atomic (see #4081)
  • Added crystal --version reports also the LLVM version (see #4095, thanks @matiasgarciaisaia)
  • Fixed instance variables initializers corner cases (see #3988)
  • Fixed crystal play was broken (see #4061)
  • Fixed Atomic can be set to nil (see #4062)
  • Fixed GZip::Header extra byte (see #4068, thanks @crisward)
  • Fixed ASTNode#to_s for Attribute (see #4098, thanks @olbat)
  • Some bug fixes

0.21.0

21 Feb 17:02
Compare
Choose a tag to compare
  • (breaking-change) The compiler now reuses previous macro run compilations so {{ run(...) }} is only re-run if the code changes
  • (breaking-change) Spec: assert { ... } is now it { ... } (thanks @TheLonelyGhost)
  • (breaking-change) Renamed Set#merge! to Set#concat
  • (breaking-change) Zlib was split into Flate, Gzip and Zlib (bda40f)
  • (breaking-change) Crypto::MD5 is now Digest::MD5
  • (breaking-change) String#chop is now String#rchop
  • (breaking-change) String#to_slice now returns a read-only Slice
  • (breaking-change) String can now hold invalid UTF-8 byte sequences, and they produce a unicode replacement character when traversed
  • (breaking-change) Removed String#lchomp. Use String#lchop
  • (breaking-change) Octal escapes inside strings incorrectly produced a codepoint value instead of a byte value
  • (breaking-change) Removed octal escape from char literals
  • Fixed compiler performance regression related to cached files (f69e37e)
  • Added \xHH escape sequence in string literals
  • Char::Reader can now traverse a string backwards
  • Enum#to_s now uses pipes instead of commas for flag enums
  • IO#read_string is now encoding-aware
  • OAuth2::Client now sends application/json Accept header, and considers the expires_in access token property as optional
  • Slice can now be read-only
  • TCPServer no longer set SO_REUSEPORT to true by default
  • Added HTTP::Multipart and HTTP::FormData (thanks @RX14)
  • Added File::Stat#pipe?
  • Added File.utime
  • Added IO#peek
  • Added String#strip(arg), String#lstrip(arg), String#rstrip(arg)
  • Added String#lchop, String#lchop(prefix), String#rchop and String#rchop(suffix)
  • Added String#hexbytes and String#hexbytes?
  • Added String#scrub and String#valid_encoding?
  • Added includes? macro method for StringLiteral, SymbolLiteral and MacroId (thanks @karlseguin)
  • Added "view source" links to GitLab (thanks @ezrast)
  • Updated CONTRIBUTING.md guidelines
  • Some bug fixes