Releases: crystal-lang/crystal
Releases · crystal-lang/crystal
0.19.0
- (breaking change) Added
select
keyword - (breaking change) Removed $global variables. Use @@Class variables instead.
- (breaking change) Heredoc now ends when the matching identifier is found, either followed by a space or by a non-identifier
- (breaking change) Assignment to a local variable inside an assignment to that same variable is now an error
- (breaking change) Type names like
T
,T1
,U
, etc., are now disallowed at the top level, to avoid conflicts with free variables - (breaking change) Type lookup (
Foo::Bar::Baz
) had some incorrect behaviour that now is fixed. This can break existing code that relied on this incorrect behaviour. The fix is to fully qualify types (::Foo::Bar::Baz
) - (breaking change) In relationships like
class Bar < Foo(Baz)
andinclude Moo(Baz)
, all ofFoo
,Moo
andBaz
must be defined before that point (this was not always the case in previous versions) - (breaking change) Removed the deprecated syntax
x as T
- (breaking change) Removed block form of
String#match
- (breaking change) Removed
IO#read_nonblock
- (breaking change)
Int#/
now performs floored division. UseInt#tdiv
for truncated division (see their docs to learn the difference) - Added support for LLVM 3.8 (thanks @omarroth)
||
now does type filtering- Generic inheritance should now work well, and (instantiated) generic modules can now be used as the type of instance variables
NamedTuple
can now be accessed with strings too (thanks @jhass)Base64
can now encode and decode directly to anIO
(thanks @kostya)BigInt
now uses GMP implementation of gcd and lcm (thanks @endSly)ECR
now supports removing leading and trailing whitespace (<%-
,-%>
)HTTP::Request#path
now never returnsnil
: it fallbacks to"/"
(thanks @jhass)String#tr(..., "")
is now the same asString#delete
tool hierarchy
now supports--format json
(thanks @bmulvihill)- Added
Char#ascii?
- Added
Class#nilable?
andUnion#nilable?
- Added
Hash#has_value?
(thanks @kachick) - Added
IO::Sized
andIO::Delimited
(thanks @RX14) - Added
IO::Hexdump
(thanks @ysbaddaden) - Added
IO#noecho
andIO#noecho!
(thanks @jhass) - Added
Logger.new(nil)
to create a null logger - Added
OptionParser#missing_option
andOptionParser#invalid_option
(thanks @jhass) - Added
Process.exists?
,Process#exists?
andProcess#terminated?
(thanks @jhass) - Added
Process.exec
(thanks @jhass) - Added
Slice#copy_to
,Slice#copy_from
,Slice#move_to
andSlice#move_from
(thanks @RX14) - Added
URI#==
andURI#hash
(thanks @timcraft) - Added
YAML#parse(IO)
- Added
Indexable
module thatArray
,Slice
,Tuple
andStaticArray
include - Added
indent
parameter toto_pretty_json
- Added lazy form of
getter
andproperty
macros - Added macro methods to access an ASTNode's location
- Unified String and Char to integer/float conversion API (thanks @jhass)
- Lots of bug fixes
0.18.7
- The
compile
command was renamed back tobuild
. Thecompile
command is deprecated and will be removed in a future version - Fibers now can be spawned with a name
- ECR macros can now be required with just
require "ecr"
- Several bugs fixes and enhancements
0.18.6
0.18.6 (28-06-2016)
T?
is now parsed asUnion(T, Nil)
outside the type grammar- Added
String#sub
overloads for replacing an index or range with a char or string - Several bugs fixes
0.18.5 (27-06-2016)
- Added
OpenSSL::SSL::Socket#alpn_protocol
- Added
IO#copy(src, desc, limit)
(thanks @jreinert) - Added
TypeNode#instance
macro method - Several bugs fixes
0.18.4
0.18.2
0.18.0
- (breaking change)
IniFile
was renamed toINI
, and its methodload
renamed toparse
- (breaking change)
Process.getpgid
was renamed toProcess.pgid
- (breaking change) An
Exception
's backtrace is now set when it's raised, not when it's created: it'sbacktrace
method raises if it's not set, and there'sbacktrace?
to get it as a nilable array - (breaking change)
dup
is now correctly implemented in all types.clone
is not defined by default, but some types in the standard library do. Also checkObject#def_clone
- (breaking change) the
method_missing
macro only accepts a single argument: aCall
now. The form that accepted 3 arguments was removed. - (breaking change) the
delegate
macro must now be used likedelegate method1, method2, ..., methodN, to: object
- (breaking change)
Hash#each_with_index
andHash#each_with_object
now yield a tuple (pair) and an index, becauseHash
is nowEnumerable
. Usedo |(key, value), index|
for this. - (breaking change)
{"foo": 1}
denotes a named tuple literal now, not a hash literal. Use{"foo" => 1}
instead. This also applies to, for exampleHTTP::Headers{...}
- (breaking change) Extra block arguments now give a compile-time error. This means that methods that yield more than once, one time with N arguments and another time with M arguments, with N < M, will always give an error. To fix this, add M - N
nil
fillers on the yield side (this makes it more explicit thatnil
was intended to be a block argument value) - (breaking change)
OpenSSL::SSL::Context
andOpenSSL::SSL::Socket
can no longer be used directly anymore. Use their respective subclassesOpenSSL::SSL::Context::Client
,
withOpenSSL::SSL::Socket::Client
,OpenSSL::SSL::Context::Server
withOpenSSL::SSL::Socket::Server
. - (breaking change) TLS server and client sockets now use sane defaults, including support for hostname verification for client sockets, used by default in
HTTP::Client
. - (breaking change) The
ssl
option was renamed totls
inHTTP::Client
,HTTP::Server
,HTTP::WebSocket
,OAuth::Consumer
,OAuth::Signature
andOAuth2::AccessToken
. - The
dns_timeout
setting in a few classes likeHTTP::Client
andTCPSocket
is now ignored until a next version supports a non-blockinggetaddrinfo
equivalent OpenSSL::SSL::Socket::Client
supports server name indication now.- The
build
command was renamed tocompile
. Thebuild
command is deprecated and will be removed in a future version - The
--cross-compile
flag no longer takes arguments, use--target
and-D
- Added a
Union
type that represents the type of a union, which can have class methods - Methods, procs and lib functions that are marked as returning
Void
now returnNil
- Methods that are marked as returning
Nil
are not checked for a correct return type, they always returnnil
now - When
as
fails at runtime it now includes which type couldn't be cast - Macros can now be used inside
lib
andenum
declarations - Macros can now be declared inside enums
- Macro calls can now be used as enum values
- Generic types can now include a splatted type variable. This already existed in the language (
Tuple(*T)
,Proc(*T)
) but there was no syntax to define such types. - Class variables are now inherited (only their type, not their value). They are now similar to Ruby class instance variables.
- Splats in
yield
can now be used - Splat in block arguments can now be used.
- Added block auto-unpacking: if a method yields a tuple and a block specifies more then one block argument, the tuple is unpacked to these arguments
- String literals are now allowed as external method arguments, to match named tuples and named arguments
sizeof
andinstance_sizeof
can now be used as generic type arguments (mostly useful combined withStaticArray
)Hash
,HTTP::Headers
,HTTP::Params
andENV
now include theEnumerable
moduleProc
is nowProc(*T, R)
Tuple(*T).new
andNamedTuple(**T).new
now correctly match the givenT
(#1828)Float64#to_s
now produces an ever more accurate outputJSON
parsing now correctly handle floats with many digitsJSON.mapping
andYAML.mapping
now also accept named arguments in addition to a hash literal or named tuple literalInt#chr
now raises if the integer is out of a char's range. The old non-raising behaviour is now inInt#unsafe_chr
.- The output of
pp x
is nowx # => ...
instead ofx = ...
- The output of the
debug()
macro method now tries to format the code (passfalse
to disable this) - Added
JSON
andYAML
parsing and mapping for unions - Added
FileUtils.cp_r
(thanks @Dreauw) - Added
Tuple.from
andNamedTuple.from
(thanks @jhass) - Added
XML.escape
(thanks @juanedi) - Added
HTTP::Server::Response#respond_with_error
(thanks @jhass) - Added
TCPServer#accept?
- Added optional
base
argument toChar#digit?
andChar#hex?
(thanks @mirek) - Added
flag?
macro method, similar to usingifdef
.ifdef
is deprecated and will be removed in a future version. - Added
YAML::PullParser#read_raw
- Added
Proc#partial
- Added
Socket.ip?(str)
to validate IPv4 and IPv6 addresses - Added
Bytes
as an alias ofSlice(UInt8)
- Added
RangeLiteral
macro methods:begin
,end
,excludes_end?
,map
andto_a
- Added
ArrayLiteral#[range]
andArrayLiteral#[from, to]
in macros (applicable forTupleLiteral
too) - Added
Generic
macro methods:name
,type_vars
,named_args
- Spec: added JUnit formatter output (thanks @juanedi)
- The
tls
option inHTTP::Client
can now take aOpenSSL::SSL::Context::Client
in addition totrue
. HTTP::LogHandler
logs exceptions now (thanks @jhass)HTTP::ErrorHandler
does not tell the client which exception occurred by default (can be enabled with averbose
flag) (thanks @jhass)- Several bug fixes
0.17.4
- Added string literals without interpolations nor escapes:
%q{...}
and<<-'HEREDOC'
. Also added%Q{...}
with the same meaning as%{...}
. - A method that uses
@type
inside a macro expression is now automatically detected as being amacro def
Float64#to_s
now produces a more accurate output- Added
Crystal::VERSION
and other compiler-metadata constants - Added
Object.from_json(string_or_io, root)
and aroot
option toJSON.mapping
- Added
System.hostname
(thanks @miketheman) - The
property
,getter
andsetter
macros now also accept assignments (property x = 0
) - The
record
macro now also accepts assignments (record Point, x = 0, y = 0
) - Comparison in macros between
MacroId
andStringLiteral
orSymbolLiteral
now work as expected (compares theid
representation) - Some bug fixes
0.17.3
- Fixed: multiple macro runs executions didn't work well (#2624)
- Fixed incorrect formatting of underscore in unpacked block arguments
- Fixed wrong codegen for global variable assignment in type declaration (#2619)
- Fixed initialize default arguments where evaluated at the class scope (#731)
- The type guesser can now infer a block type from
def initialize(&@block)
- Allow type restriction in double splat argument (similar to restriction in single splat)
- Allow splat restriction in splat argument (useful for
Tuple.new
) - Allow double splat restriction in double splat argument (useful for
NamedTuple.new
)
0.17.2
0.17.1
- Constants and class vars are no longer initialized before "main". Now their initialization order goes along with "main", similar to how it works in Ruby (much more intuitive)
- Added syntax for unpacking block arguments:
foo { |(x, y)| ... }
- Added
NamedTupleLiteral#map
andHashLiteral#map
in macros (thanks @jhass) - Fixed wrong codgen for tuples/named tuples merge with pass-by-value types
- Formatter: fixed incorrect format for named tuple type