Skip to content

Releases: crystal-lang/crystal

0.17.0

17 May 17:50
Compare
Choose a tag to compare
  • (breaking change) Macro defs are now parsed like regular methods. Enclose the body with {% begin %} .. {% end %} if you needed that behaviour
  • (breaking change) A union of two tuples of the same size results in a tuple with the unions of the types in each position. This only affects code that later tested a tuple's type with is_a?, for example tuple.is_a?({Int32, String})
  • (breaking change) Method arguments have now a different semantic. This only affects methods that had a splat argument followed by other arguments.
  • (breaking change) The syntax {foo: 1, bar: 2} now denotes a NamedTuple, not a Hash with symbol as keys. Use {:foo => 1, :bar => 2} instead
  • The syntax exp as Type is now deprecated and will be removed in the next version. Use crystal tool format to automatically upgrade your code
  • The compiler now gives an error when trying to define a method named !, is_a?, responds_to?, nil?, as or as?
  • Added the NamedTuple type
  • Added double splatting
  • Added external argument names
  • Macro defs return type is no longer mandatory
  • Added as?: similar to as, but returns nil when the type doesn't match
  • Added Number::Primitive alias
  • Added Tuple#+(Tuple)
  • Added ArrayLiteral#+(ArrayLiteral) in macros
  • Crypto::MD5 now allows Slice(UInt8) and a block form (thanks @will)
  • Added docs for XML (thanks @Hamdiakoguz)
  • Many bug fixes

0.16.0

05 May 21:09
Compare
Choose a tag to compare
  • (breaking change) Instance, class and global variables types must be told to the compiler, either explicitly or through a series of syntactic rules
  • (breaking change) Non-abstract structs cannot be inherited anymore (abstract structs can), check the docs to know why. In many cases you can use modules instead.
  • (breaking change) Class variables are now initialized at the beginning of the program (before "main"), make sure to read the docs about class variables and main
  • (breaking change) Constants are now initialized at the beginning of the program (before "main"), make sure to read the docs about constants and main
  • (breaking change) When doing crystal program.cr arg1 arg2 arg3, arg1, arg2 and arg3 are considered arguments to pass to the program (not the compiler). Use crystal run program.cr arg1 ... to consider arg1 a file to include in the compilation.
  • (breaking change) Int#**(Int) now returns an integer, and raises if the argument is negative. Use a float base or exponent for negative exponents to work.
  • (breaking change) Slice#to_s and StaticArray#to_s now include their type name in the output
  • Support for FreeBSD and musl libc has landed (thanks @ysbaddaden)
  • The .crystal directory is now created at $HOME/cache/.crystal or $HOME/.crystal (or others similar), with a fallback to the current directory
  • crystal doc and crystal tool hierarchy are now much faster. Additionally, the hierarchy tool shows types for generic types, and doesn't show instantiations anymore (wasn't very useful)
  • ! now does type filtering (for example you can do !x || x.bar, assuming x can be nil and the non-nil type responds to bar)
  • Named arguments can now match any argument, even if they don't have a default value. Make sure to read the docs
  • The as operator can now be written as a method: exp.as(Type) in addition to exp as Type. The old syntax will be removed in a few releases.
  • Added @x : Int32 = 1 syntax (declaration + initialization)
  • new/initialize logic now works more as one would expect
  • Added BigRational (thanks @will)
  • Added BigFloat (thanks @exilor)
  • Added String#insert
  • Added Time::EpochConverter and Time::EpochMillisConverter
  • Added %s (unix epoch) directive to Time::Format
  • Time now honours Dayling Saving and ENV["TZ"]
  • Added HTTP::Server::Response#cookies (thanks @jhass)
  • Added Array#bsearch, Array#bsearch_index and Range#bsearch (thanks @makenowjust)
  • Added Range#reverse_each iterator (thanks @omninonsense)
  • JSON::Any: added as_...? methods (thanks @DougEverly)
  • JSON::Any is now Enumerable
  • YAML::Any is now Enumerable
  • Added JSON.parse_raw that returns a JSON::Type
  • JSON::PullParser: added #read_raw to read a JSON value as a raw string (useful for delayed parsing). Also added String::RawConverter to be used with JSON.mapping.
  • JSON and YAML: enums, BigInt and BigFloat are now serializable
  • ENV: allow passing nil as a value to delete an environment variable
  • Hash: allow Array | Tuple arguments for #select, #select!, #reject and #reject!
  • Crypto::Subtle.constant_time_compare now returns Bool, and it can compare two strings in addition to two slices (thanks @skunkworker)
  • HTTP::Server: reset port zero after listening (thanks @splattael)
  • Added File#each_line iterator
  • Added Number.slice, Number.static_array, Slice.[] and StaticArray.[] to easily create slices and static arrays
  • Added Slice#hexdump (thanks @will)
  • Added Enumerable#product (thanks @dkhofer)
  • Fix: disallow using out with Void* pointers
  • Fixed bug in XML::Node#namespace_scopes (thanks @Hamdiakoguz)
  • Added docs for INIFile (thanks @EvanHahn)
  • Lots of bug fixes

0.15.0

02 Apr 16:27
Compare
Choose a tag to compare
  • (breaking change) ! has now its meaning hardcoded in the language. If you defined it for a type it won't be invoked as a method anymore.
  • (breaking change) nil? has now its meaning hardcoded in the language. If you defined it for a type it won't be invoked as a method anymore.
  • (breaking change) typeof is now disallowed in alias declarations
  • Added crystal tool format --check to check that source code is properly formatted
  • crystal play (playground) added workbooks support, as well as improvements and stabilizations
  • Added Tempfile.dirname (thanks @DougEverly)
  • Added Path#resolve method in macros
  • {{...}} arguments to a macro call are now expanded before macro invocation (#2392)
  • Special variables ($~ and $?) are now accessible after being defined in blocks (#2194)
  • Some bugs and regressions fixed

0.14.2

23 Mar 10:39
Compare
Choose a tag to compare
  • Fixed regression with formatter (#2348)
  • Fixed regression with block return types (#2347)
  • Fixed regression with openssl (78c12ca)

0.14.1

22 Mar 10:59
Compare
Choose a tag to compare

0.14.1 (2016-03-21)

  • Fixed some regressions in the formatter

0.14.0 (2016-03-21)

  • (breaking change) The syntax of a method argument with a default value and a type restriction is now def foo(arg : Type = default_value). Run crystal tool format to automatically upgrade exsiting code to this new syntax. The old def foo(arg = default_value : Type) was removed.
  • (breaking change) Enumerable#take(n) and Iterator#take(n) were renamed to first(n)
  • (breaking change) Socket#addr and Socket#peeraddr were renamed to local_address and remote_address respectively
  • (breaking change) Removed Comparable#between?(a, z). Use a <= x <= z instead
  • (breaking change) HTTP::WebSocketHandler callbacks can now access the HTTP::Context. If you had a forwarding method to it you'll need to update it. See #2313.
  • New command crystal play that opens a playground for you to play in the browser :-) (thanks @bcardiff)
  • New command crystal env that prints environment information
  • Spec: you can now run multiple files with specified line numbers, as in crystal spec file1.cr:10 file2.cr:20 ...
  • Initial support for musl-libc (thanks @ysbaddaden)
  • Added FileUtils.cp (thanks @Dreauw)
  • Added Array#first(n) and Array#last(n) (thanks @greyblake)
  • Added WebSocket#close and properly handle disconnections
  • Added UDPSocket#send and UDPSocket#receive (thanks @tatey)
  • Added Char#uppercase? and Char#lowercase? (thanks @MaloJaffre`)
  • Added sync_close property to OpenSSL::SSL::Socket, Zlib::Inflate and Zlib::Deflate
  • Added XML::Node#encoding and XML::Node#version
  • Added HTTP::Client::Response#success? (thanks @marceloboeira)
  • Added StaticArray#shuffle!(random) (thanks @Nesqwik)
  • Added Splat#exp method in macros
  • Added fiber-safe Mutex
  • All Int types (except BigInt) can now be used in JSON and YAML mappings (thanks @marceloboeira)
  • Instance variable declarations/initializations now correctly work in generic classes and modules
  • Lots of bug fixes

0.14.0

22 Mar 10:59
Compare
Choose a tag to compare
  • (breaking change) The syntax of a method argument with a default value and a type restriction is now def foo(arg : Type = default_value). The old def foo(arg = default_value : Type) was removed.
  • (breaking change) Enumerable#take(n) and Iterator#take(n) were renamed to first(n)
  • (breaking change) Socket#addr and Socket#peeraddr were renamed to local_address and remote_address respectively
  • (breaking change) Removed Comparable#between?(a, z). Use a <= x <= z instead
  • (breaking change) HTTP::WebSocketHandler callbacks can now access the HTTP::Context. If you had a forwarding method to it you'll need to update it. See #2313.
  • New command crystal play that opens a playground for you to play in the browser :-) (thanks @bcardiff)
  • New command crystal env that prints environment information
  • Spec: you can now run multiple files with specified line numbers, as in crystal spec file1.cr:10 file2.cr:20 ...
  • Initial support for musl-libc (thanks @ysbaddaden)
  • Added FileUtils.cp (thanks @Dreauw)
  • Added Array#first(n) and Array#last(n) (thanks @greyblake)
  • Added WebSocket#close and properly handle disconnections
  • Added UDPSocket#send and UDPSocket#receive (thanks @tatey)
  • Added Char#uppercase? and Char#lowercase? (thanks @MaloJaffre`)
  • Added sync_close property to OpenSSL::SSL::Socket, Zlib::Inflate and Zlib::Deflate
  • Added XML::Node#encoding and XML::Node#version
  • Added HTTP::Client::Response#success? (thanks @marceloboeira)
  • Added StaticArray#shuffle!(random) (thanks @Nesqwik)
  • Added Splat#exp method in macros
  • Added fiber-safe Mutex
  • All Int types (except BigInt) can now be used in JSON and YAML mappings (thanks @marceloboeira)
  • Instance variable declarations/initializations now correctly work in generic classes and modules
  • Lots of bug fixes

0.13.0

07 Mar 19:11
Compare
Choose a tag to compare
  • (breaking change) Matrix was moved to a separate shard: https://github.com/Exilor/matrix
  • The syntax of a method argument with a default value and a type restriction is now def foo(arg : Type = default_value). Run crystal tool format to automatically upgrade exsiting code to this new syntax. The old def foo(arg = default_value : Type) syntax will be removed in a next release.
  • Special handling of case with a tuple literal. See #2258.
  • Keywords can now be used for variable declaration, so property end : Time works as expected.
  • Comparison of signed vs. unsigned integers now always give a correct result
  • Allow declaring instance variables in non-generic module types (module Moo; @x : Int32; end)
  • Allow initializing instance variables in non-generic module types (module Moo; @x = 1; end)
  • Spec: allow setting multiple output formatters (thanks @marceloboeira)
  • StringScanner: improved performance
  • Added foo.[0] = 1 and foo.[0] as valid syntax, similar to the one in &. blocks (thanks @makenowjust)
  • CSV: allow separate and quote characters different than comma and doble quote (thanks @jreinert)
  • YAML: support merge operator (<<) (thanks @jreinert)
  • Allow redefining primitive methods like Int32#+(other : Int32)
  • Allow defining macros with operator names like []
  • Levenshtein: improved performance (thanks @tcrouch)
  • HTTP::Client: fixed incorrect parsing of chunked body
  • HTTP::Client: added a constructor with an URI argument (thanks @plukevdh)
  • String: sub and gsub now understand backreferences (thanks @bjmllr)
  • Random: added Random#rand(Float64) and Random#rand(Range(Float, Float)) (thanks @AlexWayfer)
  • HTML: HTLM.escape includes more characters (thanks @Ryuuzakis)
  • Added TypeNode.class method in macros (thanks @waterlink)
  • run inside macros now also work with absolute paths (useful when used with __DIR__)
  • Added docs for Math and StaticArray (thanks @zavydiel, @HeleneMyr)
  • Many bug fixes and some micro-optimizations

0.12.0

16 Feb 16:26
Compare
Choose a tag to compare
  • (breaking change) When used with a type declaration, the macros property, getter, setter, etc., declare instance variables with those types.
  • (breaking change) JSON.mapping and YAML.mapping declare instance variables with the given types.
  • (breaking change) YAML.load was renamed to YAML.parse, and it now returns a YAML::Any.
  • (breaking change) embed_ecr and ecr_file were renamed to ECR.embed and ECR.def_to_s (the old methods now produce a warning and will be removed in the next release).
  • Added encoding support: IO#set_encoding, String#encode, and HTTP::Client charset check.
  • Segmentation faults are now trapped and shown in a more friendlier way.
  • The record macro can now accept type declarations (for example record Point, x : Int32, y : Int32)
  • Added Iterator#step (thanks @jhass)
  • Array#push and Array#unshift can now accept multiple values and add the elements in an efficient way (thanks @arktisklada)
  • Added default option to JSON.mapping (thanks @kostya)
  • Added default option to YAML.mapping (thanks @jreinert)
  • Allow doing case foo; when Foo.class (and Foo(T) and Foo(T).class) in case expressions.
  • Added Class#| so a union type can be expresses as Int32 | Char in regular code.
  • Added File.real_path (thanks @jreinert)
  • Added dns_timeout for HTTP::Client (thanks @kostya)
  • Added dynamic width precision to sprintf (thanks @gtramontina)
  • Markdown now supports blockquotes and 1 level of list nesting (thanks @SebastianSzturo)
  • p now accepts multiple arguments
  • Many bug fixes and some optimizations

0.11.1

25 Jan 16:26
Compare
Choose a tag to compare
  • Fixed #2050, #2054, #2057, #2059, #2064
  • Fixed bug: HTTP::Server::Response headers weren't cleared after each request
  • Formatter would incorrectly change property x :: Int32 to property x = uninitialized Int32

0.11.0

23 Jan 18:42
Compare
Choose a tag to compare
  • (breaking change) Syntax for type declarations changed from var :: Type to var : Type. The old syntax is still allowed but will be deprecated in the next version (run crystal tool format to automatically fix this)
  • (breaking change) Syntax for uninitialized variables, which used to be var :: Type, is now var = uninitialized Type. The old syntax is still allowed but will be deprecated in the next version (run crystal tool format to automatically fix this)
  • (breaking change) HTTP::Server refactor to support streaming. Check the docs of HTTP::Server for upgrade instructions
  • (breaking change) Renamed HTTP::WebSocketSession to HTTP::WebSocket.
  • (breaking change) Heredocs now remove indentations according to the indentation of the closing identifier (thanks @rhysd)
  • (breaking change) Renamed Enumerable#inject to Enumerable#reduce
  • (breaking change) next and return semantic inside captured block has been swapped (#420)
  • Fibers context switch is now faster, done with inline assembly. libpcl is no longer used
  • Allow annotating the type of class and global variables
  • Support comments in ECR (thanks @ysbaddaden)
  • Security improvements to HTTP::StaticFileHandler (thanks @makenowjust)
  • Moved seek, tell, pos and pos= from File to IO::FileDescriptor (affects Tempfile)
  • URI.parse is now faster (thanks @will)
  • Many bug fixes, some really old ones involving issues with order of declaration