0.25.0
New features and breaking changes
- (breaking-change) Time zones has been added to
Time. (#5324, #5819, thanks @straight-shoota) - (breaking-change) Drop
HTTP.rfc1123_datein favor ofHTTP.format_timeand add time format implementations for ISO-8601, RFC-3339, and RFC-2822. (#5123, thanks @straight-shoota) - (breaking-change)
crystal depsis removed, useshards. (#5544, thanks @asterite) - (breaking-change)
Hash#keywas renamed asHash#key_for. (#5444, thanks @marksiemers) - (breaking-change)
JSON::AnyandYAML::Anyhave been re-implemented solving some inconsistencies and avoiding the usage of recursive aliases (JSON::TypeandYAML::Typehave 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.joinwith empty path component. (#5915, thanks @straight-shoota) - (breaking-change) Drop
Colorize#pushin favor ofColorize#surroundand allow nested calls across the stack. (#4196, thanks @makenowjust) - (breaking-change)
File.statwas renamed toFile.infoand a more portable API was implemented. (#5584, #6161, thanks @RX14 and @bcardiff) - (breaking-change) Refactor
HTTP::Serverto 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
typeofin 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
DivisionByZeroexception was renamed toDivisionByZeroError. (#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
Noneto0for@[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#roundto 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
Float32andFloat64constants. (#4787, thanks @konovod) - Add allocated bytes per operation in
Benchmark.ips. (#5522, thanks @asterite) - Add
String#to_utf16andString.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_keyandHash#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::Stapledto combine two unidirectionalIOs into a single bidirectional one. (#6017, thanks @straight-shoota) - Add context to errors in
JSON.mappinggenerated code. (#5932, thanks @straight-shoota) - Add
JSON::SerializableandYAML::Serializableattribute powered mappings. (#6082, thanks @kostya) - Add
modeparam toFile.write. (#5754, thanks @woodruffw) - Add Punycode/IDNA support and integrate with DNS lookup. (#2543, thanks @makenowjust)
- Add
HTTP::Client#optionsmethod. (#5824, thanks @mamantoha) - Add support for
Last-Modifiedand other cache improvements toHTTP::StaticFileHandler. (#2470, #5607, thanks @bebac and @straight-shoota) - Add operations and improvements related to
BigDecimalandBigFloat. (#5437, #5390, #5589, #5582, #5638, #5675, thanks @Sija and @mjago) - Add
BigDecimalandUUIDJSON support. (#5525, #5551, thanks @lukeasrodgers and @lachlan) - Add missing
UUID#inspect. (#5574, thanks @ngsankha) - Add
Loggerconfiguration in initializer. (#5618, thanks @Sija) - Add custom separators in
CSV.build. (#5998, #6008 thanks @Sija) - Add
INI.buildto emitINIfiles. (#5298, thanks @j8r) - Add
Process.chroot. (#5577, thanks @chris-huxtable) - Add
Tempfile.tempnameto create likely nonexisting filenames. (#5360, thanks @woodruffw) - Add
FileUtils#ln,ln_s, andln_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
#clearmethod toArrayLiteral/HashLiteralfor macros. (#5265, thanks @Sija) - Add
Bool#to_unsafefor C bindings. (#5465, thanks @woodruffw) - Spec: Add expectations
starts_with,ends_with. (#5881, thanks @kostya) - Formatter: Add
--includeand--excludeoptions to restrict directories. (#4635, thanks @straight-shoota) - Documentation generator: improved navigation, searching, rendering and SEO. (#5229, #5795, #5990, #5657, #6073, thanks @straight-shoota, @Sija and @j8r)
- Playground: Add button in playground to run formatter. (#3652, thanks @samueleaton)
Standard library bugs fixed
- Fixed
String#subhandling of negative indexes. (#5491, thanks @makenowjust) - Fixed
String#gsubin non-ascii strings. (#5350, thanks @straight-shoota) - Fixed
String#dumpfor UTF-8 characters higher than\uFFFF. (#5668, thanks @straight-shoota) - Fixed
String#tredge case optimization bug. (#5913, thanks @makenowjust) - Fixed
String#rindexwhen called withRegex. (#5594, thanks @straight-shoota) - Fixed
Time::Spanprecision loss and boundary check. (#5563, #5786, thanks @petoem and @straight-shoota) Array#samplewas fixed to use the provided random number generator (instead of the default) in all cases. (#5419, thanks @c910335)- Add short-circuit logic in
Deque#rotate!for singleton and empty queues. (#5399, thanks @willcosgrove) Slice#reverse!was optimised to be up to 43% faster. (#5401, thanks @larubujo)- Fixed
Regex#inspectwhen escaping was needed. (#5841, thanks @makenowjust) - Fixed
JSON.mappingnow generates type restriction on getters. (#5935, thanks @Daniel-Worrall) - Fixed
JSON.mappingdocumentation regarding unions. (#5483, thanks @RX14) - Fixed
JSON.mappingandYAML.mappingto allowpropertiesproperty. (#5180, #5352, thanks @maxpowa and @Sija) - Fixed
YAMLint and float parsing. (#5699, #5774, thanks @straight-shoota) - Fixed WebSocket handshake validation. (#5327, #6027 thanks @straight-shoota)
- Fixed
HTTP::Clientis able to use ipv6 addresses. (#6147, thanks @bcardiff) - Fixed handling some invalid responses in
HTTP::Client. (#5630, thanks @straight-shoota) - Fixed
HTTP::ChunkedContentwill raise on unterminated content. (#5928, #5943, thanks @straight-shoota) URI#to_snow handles default ports for lots of schemes. (#5233, thanks @lachlan)HTTP::Cookiesis able to deal with spaces in cookies. (#5408, thanks @bararchy)- Fixed MIME type of SVG images in
HTTP::StaticFileHandler. (#5605, thanks @damianham) - Fixed URI encoding in
StaticFileHandler#redirect_to. (#5628, thanks @straight-shoota) - Fixed
before_requestcallbacks to be executed right before writing the request inHTTP::Client. (#5626, thanks @asterite) Dir.globwas re-implemented with performance improvements and edge cases fixed. (#5179, thanks @straight-shoota)- Fixed
File.extnameedge case for '.' in path with no extension. (#5790, thanks @codyjb) - Some ECDHE curves were incorrectly disabled in
OpenSSLclients, this has been fixed. (#5494, thanks @jhass) - Fixed allow bcrypt passwords up to 71 bytes. (#5356, thanks @ysbaddaden)
- Unhandled exceptions occurring inside
Process.forknow print their backtrace correctly. (#5431, thanks @RX14) - Fixed
Zipno longer modifies deflate signature. (#5376, thanks @luislavena) - Fixed
INIparser edge cases and performance improvements. (#5442, #5718 thanks @woodruffw, @j8r) - Fixed initialization of
LibXML. (#5587, thanks @lbguilherme) - Some finalizers were missing for example when the object where cloned. (#5367, thanks @alexbatalov)
- Fixed sigfault handler initialization regarding
sa_mask. (#5677 thanks @ysbaddaden) - Fixed missing reference symbol in ARM. (#5640, thanks @blankoworld)
- Fixed detect llvm 5.0 by
llvm-config-5.0command. (#5531, thanks @Vexatos) - Restore STDIN|OUT|ERR blocking state on exit. (#5802, thanks @bew)
- Fixed multiple
at_exithandlers chaining. (#5413, thanks @bew) - Fixed senders were not notified when channels were closed. (#5880, thanks @carlhoerberg)
- Fixed forward unhandled exception to caller in
parallelmacro. (#5726, thanks @lipanski) - Fixed Markdown parsing of code fences appearing on the same line. (#5606, thanks @oprypin)
- Fixed OpenSSL bindings to recognize LibreSSL. (#5676, #6062, #5949, #5973 thanks @LVMBDV and @RX14)
- Fixed path value in to
UNIXSocketcreated byUNIXServer. (#5869, thanks @straight-shoota) - Fixed
Object.delegateover setters. (#5964, thanks @straight-shoota) - Fixed
ppwill now use the same width on every line. (#5978, thanks @makenowjust) - Fixes missing stdarg.cr for i686-linux-musl. (#6120, thanks @bcardiff)
- Spec: Fixed junit spec formatter to emit the correct XML. (#5463, thanks @hanneskaeufler)
Compiler bugs fixed
- Fixed enum generated values when a member has value 0. (#5954, thanks @bew)
- Fixed compiler issue when previous compilation was interrupted. (#5585, thanks @asterite)
- Fixed compiler error with an empty
ensureblock. (#5396, thanks @makenowjust) - Fixed parsing regex in default arguments. (#5481, thanks @makenowjust)
- Fixed parsing error of regex literal after open parenthesis. (#5453, thanks @makenowjust)
- Fixed parsing of empty array with blank. (#6107, thanks @asterite)
- Static libraries are now found correctly when using the
--staticcompiler flag. (#5385, thanks @jreinert) - Improve error messages for unterminated literals. (#5409, thanks @straight-shoota)
- Fixed
ProcNotationandProcLiteralintrospection in macros. (#5206, thanks @javanut13) - Cross compilation honors
--emitand avoid generatingbc_flagsin current directory. (#5521, thanks @asterite) - Fixed compiler error with integer constants as generic arguments. (#5532, thanks @asterite)
- Fixed compiler error with self as base class. (#5534, thanks @asterite)
- Fixed macro expansion when mutating the argument. (#5247, thanks @makenowjust)
- Fixed macro expansion edge cases. (#5680, #5842, #6163, thanks @asterite, @makenowjust and @splattael)
- Fixed macro overload on named args. (#5808, thanks @bew)
- Fixed macro numeric types used in interpreter. (#5972, thanks @straight-shoota)
- Fixed missing debug locations in several places. (#5597, thanks @asterite)
- Fixed missing information in AST nodes needed for macro expansion. (#5454, thanks @makenowjust)
- Fixed multiline error messages in emitted by
ASTNode#raisemacro method. (#5670, thanks @asterite) - Fixed nested delimiters and escaped whitespace in string/symbol array literals. (#5667, thanks @straight-shoota)
- Fixed custom array/hash-like literals in nested modules. (#5685, thanks @asterite)
- Fixed usage of static array in C externs. (#5690, thanks @asterite)
- Fixed
spawnover expression with receivers. (#5781, thanks @straight-shoota) - Fixed prevent heredoc inside interpolation. (#5648, thanks @makenowjust)
- Fixed parsing error when a newline follows block arg. (#5737, thanks @bew)
- Fixed parsing error when macro argument is followed by a newline. (#6046, thanks @asterite)
- Fixed compiler error messages wording. (#5887, thanks @r00ster91)
- Fixed recursion issues in
method_addedmacro hook. (#5159, thanks @makenowjust) - Fixed avoid using type of updated argument for type inference. (#5166, thanks @makenowjust)
- Fixed parsing error message on unbalanced end brace in macros. (#5420, thanks @makenowjust)
- Fixed parsing error message on keywords are used as arguments. (#5930, #6052, thanks @makenowjust and @esse)
- Fixed parsing error message on missing comma for named tuples. (#5981, thanks @makenowjust)
- Fixed missing handling of
condnode in visitor. (#6032, thanks @veelenga) - Fixed cli when
--threadshas invalid value. (#6039, thanks @r00ster91) - Fixed private methods can now be called with explicit
selfreceiver. (#6075, thanks @makenowjust) - Fixed missing some missing rules of initializer in initializers macro methods. (#6077, thanks @asterite)
- Fixed regression bug related to unreachable code. (#6045, thanks @asterite)
Tools bugs fixed
- Several
crystal initand template improvements. (#5475, #5355, #4691, #5788, #5644, #6031 thanks @woodruffw, @faustinoaq, @bew, @kostya and @makenowjust) - Formatter: improve formatting of method call arguments with trailing comments. (#5492, thanks @makenowjust)
- Formatter: fix formatting of multiline statements. (#5234, #5901, #6013 thanks @makenowjust)
- Formatter: fix formatting of multi assignment. (#5452, thanks @makenowjust)
- Formatter: fix formatting of backslash ending statements. (#5194, thanks @asterite)
- Formatter: fix formatting of
.[]methods. (#5424, thanks @makenowjust) - Formatter: fix formatting of statements with comments. (#5655, #5893, #5909, thanks @makenowjust)
- Formatter: fix formatting of nested
begin/end. (#5922, thanks @makenowjust) - Formatter: fix formatting of trailing comma with block calls. (#5855, thanks @makenowjust)
- Formatter: fix formatting of ending expression after heredoc. (#6127, thanks @asterite)
- Documentation generator: references to nested types in markdown are now correctly parsed. (#5308, thanks @straight-shoota)
- Documentation generator: fix leftovers regarding default old
docdirectory. (#5406, thanks @gloverdonovan) - Documentation generator: avoid failing on non git directory. (#3700, thanks @makenowjust)
Crystal::Doc::Highlighterhas specs now (#5368, thanks @makenowjust)- Playground: can now be run with HTTPS. (#5527, thanks @opiation)
- Playground: Pretty-print objects in inspector. (#4601, thanks @jgaskins)
Misc
- The platform-specific parts of
FileandIO::FileDescriptorwere moved toCrystal::System, as part of preparation for the windows port. (#5333, #5553, #5622 thanks @RX14) - The platform-specific parts of
Dirwere moved toCrystal::System, as part of preparation for the windows port. (#5447, thanks @RX14) - Incremental contributions regaring windows support. (#5422, #5524, #5533, #5538, #5539, #5580, #5947 thanks @RX14 and @straight-shoota)
- The build on OpenBSD was fixed. (#5387, thanks @wmoxam)
- Add support for FreeBSD 12 (64-bit inodes). (#5199, thanks @myfreeweb)
- Scripts and makefiles now depend on
shinstead ofbashfor greater portability. (#5468, thanks @j8r) - Honor
LDFLAGSandEXTRA_FLAGSinMakefile. (#5423, #5860, thanks @trofi, @jirutka) - Improve message on link failure. (#5486, #5603, thanks @RX14 and @waj)
- Improve
String#to_jsonwhen chars don't need escaping. (#5456, thanks @larubujo) - Improve
Time#add_spanwhen arguments are zero. (#5787, thanks @straight-shoota) - Improve
String#pretty_printto output by splitting newline. (#5750, thanks @makenowjust) - Add
\aescape sequence. (#5864, thanks @r00ster91) - Several miscellaneous minor code cleanups and refactors. (#5499, #5502, #5507, #5516, #4915, #5526, #5529, #5535, #5537, #5540, #5435, #5520, #5530, #5547, #5543, #5561, #5599, #5493, #5546, #5624, #5701, #5733, #5646, #5729, #5791, #5859, #5882, #5899, #5918, #5896, #5810, #5575, #5785, #5866, #5816, #5945, #5963, #5968, #5977, #6004, #5794, #5858, #6033, #6036, #6079, #6111, #6118, #6141, #6142, #5380, #6071, thanks @chastell, @lachlan, @bew, @RX14, @sdogruyol, @makenowjust, @Sija, @noriyotcp, @asterite, @splattael, @straight-shoota, @r00ster91, @jirutka, @paulcsmith, @rab, @esse, @carlhoerberg, @chris-huxtable, @luislavena)
- Several documentation fixes and additions. (#5425, #5682, #5779, #5576, #5806, #5817, #5873, #5878, #5637, #5885, #5884, #5728, #5917, #5912, #5894, #5933, #5809, #5936, #5908, #5851, #5378, #5914, #5967, #5993, #3482, #5946, #6095, #6117, #6131, #6162, thanks @makenowjust, @straight-shoota, @vendethiel, @bew, @Heaven31415, @marksiemers, @Willamin, @r00ster91, @maiha, @Givralix, @docelic, @CaDs, @esse, @igneus, @masukomi)
- CI housekeeping and including 32 bits automated builds. (#5796, #5804, #5837, #6015, #6165, thanks @bcardiff, @bew and @Sija)
- Sync docs in master to https://crystal-lang.org/api/master. (#5941, thanks @bcardiff)
- Enable the large heap configuration for libgc. (#5839, thanks @RX14)
- Improve Ctrl-C handling of spec. (#5719, thanks @makenowjust)
- Playground: Update to codemirror 5.38.0. (#6166, thanks @bcardiff)
Note: crystal-0.25.0-2.pkg & crystal-0.25.0-2-darwin-x86_64.tar.gz Darwin packages fix a bug with a missing clock_gettime on older MacOS X versions (ie, El Capitan & previous).