Crystal 0.25.1

Crystal is a programming language with a Ruby-inspired syntax, completely free of type declarations, still providing for static checks, and many modern idioms. It allows to bind and invoke C code directly. With a compiler that produces efficient native code.

Tags c ruby crystal-lang compiler programming-language developers
License Apache
State beta

Recent Releases

0.25.128 Jun 2018 22:25 minor feature: (breaking-change) Time zones has been added to Time. (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. (breaking-change) crystal deps is removed, use shards. (breaking-change) Hash#key was renamed as Hash#key_for. (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). (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. (breaking-change) Refactor signal handlers and avoid closing pipe at exit. (breaking-change) Improve behaviour of File.join with empty path component. (breaking-change) Drop Colorize#push in favor of Colorize#surround and allow nested calls across the stack. (breaking-change) File.stat was renamed to File.info and a more portable API was implemented. (breaking-change) Refactor HTTP::Server to bind to multiple addresses. (breaking-change) Remove block argument from loop. (breaking-change) Do not collapse unions for sibling types. (breaking-change) Disallow typeof in type restrictions. (breaking-change) Perform unbuffered read when IO::Buffered#sync = true. (breaking-change) Drop when _ support. (breaking-change) The DivisionByZero exception was renamed to DivisionByZeroError. A bootstrap windows port has been added to the standard library. It's not usable for real programs yet. Add automatic casts on literals arguments for numbers and enums. Add user defined annotations. Add macro verbatim blocks to avoid nested macros. Allow namespaced expressions to define constants eg: Foo::Bar = 1. Allow trailing = in symbol literals. Allow redefining None to 0 for @ Flags enum. Suggest possible solutions to failing requires. Allow pointers of external C library global variables. Decouple pretty-printing (pp) and
0.25.012 Jun 2018 09:05 minor feature: an Index out of bounds raised during at_exit. Re-add Dir#each so it complies with Enumerable. SSL::Context verifying certificates. UUID documentation that was missing. a with single expressions in parenthesis. Skip_file macro docs. CI build script's LIBRARY_PATH. Formatter with upper-cased fun names.
0.24.114 Dec 2017 08:45 minor feature: macro lookup from included modules. WebSocket Upgrade header is now case-insensitively compared. Upgraded PCRE version with security. Added PCG32 random generator, now the default one. Added crystal tool format in man page. Docs platform improvements.
0.24.028 Oct 2017 07:25 minor feature: macro lookup from included modules. WebSocket Upgrade header is now case-insensitively compared. Upgraded PCRE version with security. Added PCG32 random generator, now the default one. Added crystal tool format in man page. Docs platform improvements.
0.23.114 Jul 2017 06:45 minor feature: macro lookup from included modules. WebSocket Upgrade header is now case-insensitively compared. Upgraded PCRE version with security. Added PCG32 random generator, now the default one. Added crystal tool format in man page. Docs platform improvements.
0.23.027 Jun 2017 06:45 minor feature: (breaking-change) Removed Process.new(pid) is now private. (breaking-change) IO#peek now returns an empty slice on EOF. (breaking-change) Rename WeakRef#target to WeakRef#value. (breaking-change) Rename HTTP::Params.from_hash to HTTP::Params.encode. (breaking-change) ' "' is now invalid, use '"'. Improved backtrace function names are now read from DWARF sections. Improved sigfaults and exceptions are printed to STDERR. Improved SSL Sockets are now buffered. Improved type inference on loops. Improved pp and p, the printed value is returned. Added support for OpenSSL 1.1.0. Added SecureRandom#random_bytes(Bytes). Added setting and deleting of attributes on XML::Node. Added File.touch and FileUtils.touch methods. Added #values_at for CSV. Added Time#clone. Added ancestors macro method. Added skip macro method. Added Colorize.on_tty_only! for easier toggling. Added WebSocket#on_binary to receive binary messages. Iterator.of stops iterating when Iterator.stop is returned. String#insert for non-ascii Char. File.link now creates a hard link. error message for #to_h over empty NamedTuple. NamedTuple#to_h does no longer call to value's #clone. Math#gamma and Math#lgamma. TCPSocket creation for 0 port for Mac OSX. repo name extraction from git remote in doc tool. self resolution when including a generic module. deinformation was missing in some cases. use generic ARM architecture target triple for all ARM architectures. macro run arguments escaping. zsh completion. honor --no-color option in spec. Some.
0.22.021 Apr 2017 14:05 minor feature: Improved lookup of abstract def implementors. Improved allocation of objects without pointer instance variables using malloc_atomic. Added crystal --version reports also the LLVM version. instance variables initializers corner cases. crystal play was broken. Atomic can be set to nil. GZip::Header extra byte. ASTNode#to_s for Attribute. Some.
0.21.107 Mar 2017 10:05 minor feature: (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 ... . (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. 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. 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(pre), String#rchop and String#rchop(suf). Added String#hexbytes and String#hexbytes?. Added String#scrub and String#valid_encoding?. Added includes? macro method for StringLiteral, SymbolLiteral and MacroId. Added "view source" links to GitLab. Updated CONTRIBUTING.md guidelines. Some.
0.21.021 Feb 2017 09:45 minor feature: Improved performance in String#index, String#rindex due to Rabin-Karp algorithm. Improved performance in Crypto::Bcrypt. expect_raises returns raised exception. Line numbers deinformation is always generated. Added Zip::File, Zip::Reader and Zip::Writer. Native readers for zip files that delegate compression to existing zlib module. Added Hash#delete with block. Added String# (char : Char). Added crystal tool expand to expand macro call in a given location. crystal play is able to show compilation errors again. crystal doc recognizes crystal-lang/crystal in any remote. Some.
0.20.521 Jan 2017 13:25 minor feature: (breaking change) A type that wants to convert itself to JSON now must override to_json(builder : JSON::Builder) instead of to_json(io : IO). The same is true for custom JSON converters. If you are using JSON.mapping then your code will continue to work without changes. (breaking change) Defining a finalize method on a struct now gives a compile error. (breaking change) Default argument types now must match their restriction, if any (for example def foo(x : Int32 = nil) will now fail to compile if foo is invoked without arguments). (breaking change) each methods now return Nil. (breaking change) IO#skip(bytes) will now raise if there aren't at least the given amount of bytes in the IO (previously it would work well if there were less bytes, and it would hang if there were more). (breaking change) MemoryIO was removed (use IO::Memory instead). (breaking change) Number#step now requires named arguments, to and by, to avoid argument order confusion. (breaking change) YAML::Emitter was renamed to YAML::Builder, and some of its methods were also renamed. (breaking change) XML::Node# now always returns a String (previously it could also return Nil, which was incorrect). (breaking change) XML::Node#content now returns an empty String when no content is available. HTTP::Client now automatically reconnects on a dropped keep-alive connection. with... yield now works well with method_missing. Class variables can now be used in generic types (all generic instances share the same variable, and subclasses get their own copy, as usual). Added support for LLVM 4. Added Enum.each and Enum#each. Added Hash#compact and Hash#compact!. Added IO#read_string(bytesize). Added IO#skip_to_end. Added Iterator#flat_map. Added JSON.build and JSON::Builder. Added NamedTuple#has_key?(String). Added p(NamedTuple). Added Regex::MatchData#==. Added String#sub(Regex, NamedTuple). Added XML.build and XML::Builder. Lots of improvements and applied consistencies to doc comments. Some.
0.20.407 Jan 2017 14:45 minor feature: (breaking change) IO#gets, IO#each_line, String#lines, String#each_line, etc. now chomp lines by default. You can pass chomp: false to prevent automatic chomping. Note that chomp is true by default for argless IO#gets (read line) but false if args are given. (breaking change) HTTP::Handler is now a module instead of a class. (breaking change) Free variables now must be specified with forall, a single uppercase letter will not work anymore. (breaking change) The libs directory is no longer in the default CRYSTAL_PATH, use lib (running crystal deps should this). Optimized compile times, specially on linux. private can now be used with macros inside types. CLI: the -s/--stats option now also shows execution time. CLI: added -t/--time to show execution time. Socket now allows any family/type/protocol association, and many other improvements. YAML: an IO can now be passed to from_yaml. Added class_getter, class_setter, class_property, etc. Added String#lchomp. Added IO#read_fully? . Added Iterator#flatten. Added HTTP::WebSocket#ping, pong, on_ping, on_pong, and now a ping message is automatically replied with a pong message. Added File#empty? and Dir#empty?. Added Time::Span#/(Time::Span). Added String#split versions that accept a block. Added URI#normalize and normalize!. Added reuse optional argument to many Array, Enumerable and Iterable methods that allow you to reuse the yielded/return array for better performance and less memory footprint. The :deflag is now present when compiled with --de, useful for doing flag?(:de) in macros. Many and performance improvements.
0.20.324 Dec 2016 18:25 minor feature: (breaking change) Set#merge as renamed to Set#merge!. . (breaking change) Slice.new(size) no longer works with non primitive integers and floats. (breaking change) The macro method argify was renamed to splat. . Added pretty printing. The methods p and pp now use it. To get the old behaviour use puts obj.inspect . Added ArrayLiteral# =, TypeNode#constant, TypeNode#overrides? and HashLiteral#double_splat in macros. Added a finished macro hook that runs at the end of the program. Added support for declaring the type of a local variable. Added Slice.empty . Flags enums now have a none? method. IO::ByteFormat has now methods to encode/decode to/from a Slice. . Spec: the line number passed to run a specific it block can now be inside any line of that block. The CallConvention attribute can now also be applied to a lib declaration, and all funs inside it will inherit it. The method_missing hook can now define a method, useful for specifying block arguments. Support double splat in macros ( ... ). Some.
0.20.106 Dec 2016 23:05 minor feature: (breaking change) Removed ifdef from the language. (breaking change) Removed PointerIO. . (breaking change) The body property of HTTP::Request is now an IO? (previously it was String). Use request.body.try( .gets_to_end) if you need the entire body as a String. (breaking change) MemoryIO has been renamed to IO::Memory. The old name can still be used but will produce a compile-time warning. MemoryIO will be removed immediately after 0.20.0. (breaking change) Char#digit? was split into Char#ascii_number? and Char#number?. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0. (breaking change) Char#alpha? was split into Char#ascii_letter? and Char#letter?. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0. (breaking change) The Iterable module is now generic. Many String and Char methods are now unicode-aware, for example String#downcase, String#upcase, Char#downcase, Char#upcase, Char#whitespace?, etc. Added support for HTTP client and server streaming. Added support for ARM. Added support for AArch64. Added support for LLVM 3.9. Added __END_LINE__ magic constant in method default arguments: will be the last line of a call (if the call has a block, it will be the last line of that block). Added @def inside macros that takes the value of the current method. API docs have a nicer style now, and notes like TODO and DEPRECATED are better highlighted. Slight improvement to deging support. Line numbers in backtraces (linux only for now). Added iteration times to Benchmark.ips. Allow HTTP::Client block initializer to be used when passing an URI. JSON.mapping and YAML.mapping getter/setter generation can now be controlled. Time is now serializable to JSON and YAML using ISO 8601 date-time format. Added IO::MultiWriter. Added String#index(Regex) and String#rindex(Regex). Added String#partition and String#rpartition. Added FileUt
0.20.024 Nov 2016 00:05 minor feature: (breaking change) Removed ifdef from the language. (breaking change) Removed PointerIO. . (breaking change) The body property of HTTP::Request is now an IO? (previously it was String). Use request.body.try( .gets_to_end) if you need the entire body as a String. (breaking change) MemoryIO has been renamed to IO::Memory. The old name can still be used but will produce a compile-time warning. MemoryIO will be removed immediately after 0.20.0. (breaking change) Char#digit? was split into Char#ascii_number? and Char#number?. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0. (breaking change) Char#alpha? was split into Char#ascii_letter? and Char#letter?. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0. (breaking change) The Iterable module is now generic. Many String and Char methods are now unicode-aware, for example String#downcase, String#upcase, Char#downcase, Char#upcase, Char#whitespace?, etc. Added support for HTTP client and server streaming. Added support for ARM. Added support for AArch64. Added support for LLVM 3.9. Added __END_LINE__ magic constant in method default arguments: will be the last line of a call (if the call has a block, it will be the last line of that block). Added @def inside macros that takes the value of the current method. API docs have a nicer style now, and notes like TODO and DEPRECATED are better highlighted. Slight improvement to deging support. Line numbers in backtraces (linux only for now). Added iteration times to Benchmark.ips. Allow HTTP::Client block initializer to be used when passing an URI. JSON.mapping and YAML.mapping getter/setter generation can now be controlled. Time is now serializable to JSON and YAML using ISO 8601 date-time format. Added IO::MultiWriter. Added String#index(Regex) and String#rindex(Regex). Added String#partition and String#rpartition. Added FileUt
0.19.408 Oct 2016 17:45 minor feature: Added support for OpenBSD. More iconv for FreeBSD. Changed how require works for the upcoming shards release (this is backwards compatible). See #2788 . Added Atomic and exposed all LLVM atomic instructions to Crystal (needed to implemented multiple-thread support). Added Process.executable_path. Added HTML.unescape. Added Char#+(Int) and Char#-(Int) . A few.
0.19.330 Sep 2016 20:25 minor feature: Generic type variables no longer need to be single-letter names (for example class Gen(Foo) is now possible). Added syntax to denote free variables: def foo(x : T) forall T. The old rule of single-letter name still applies but will be removed in the future. Removed the restriction that top-level types and constants can't have single-letter names. Added @ Extern attribute to mark regular Crystal structs as being able to be used in C bindings. Faster Char#to_s when it's ASCII: this improves the performance of JSON and CSV parsing. crystal spec: allow passing --release and other options. crystal spec: allow running all specs in a given directory. crystal playground: support custom workbook resources. crystal playground: standard output now understands ANSI colors. Added many more macro methods to traverse AST nodes. Error messages no longer include a type trace by default, pass --error-trace to show the full trace (the trace is often useless and makes it harder to understand error messages). Several.
0.19.217 Sep 2016 14:25 minor feature: Generic type variables no longer need to be single-letter names (for example class Gen(Foo) is now possible). Added syntax to denote free variables: def foo(x : T) forall T. The old rule of single-letter name still applies but will be removed in the future. Removed the restriction that top-level types and constants can't have single-letter names. Added @ Extern attribute to mark regular Crystal structs as being able to be used in C bindings. Faster Char#to_s when it's ASCII: this improves the performance of JSON and CSV parsing. crystal spec: allow passing --release and other options. crystal spec: allow running all specs in a given directory. crystal playground: support custom workbook resources. crystal playground: standard output now understands ANSI colors. Added many more macro methods to traverse AST nodes. Error messages no longer include a type trace by default, pass --error-trace to show the full trace (the trace is often useless and makes it harder to understand error messages). Several.
0.19.003 Sep 2016 14:05 minor feature: The compile command was renamed back to build. The compile 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 and enhancements.
0.18.707 Jul 2016 07:05 minor feature: The compile command was renamed back to build. The compile 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 and enhancements.
0.18.602 Jul 2016 23:25 minor feature: T? is now parsed as Union(T, Nil) outside the type grammar. Added String#sub overloads for replacing an index or range with a char or string. Several. Added OpenSSL::SSL::Socket#alpn_protocol . Added IO#copy(src, desc, limit). Added TypeNode#instance macro method. Several.
0.18.219 Jun 2016 20:45 minor feature: building Crystal from the source tarball. Spec: passing --profile shows the slowest 10 specs. Added StringLiteral# and StringLiteral# in macros. Several.
0.18.015 Jun 2016 10:25 minor feature: (breaking change) IniFile was renamed to INI, and its method load renamed to parse. . (breaking change) Process.getpgid was renamed to Process.pgid. . (breaking change) An Exception's backtrace is now set when it's raised, not when it's created: it's backtrace method raises if it's not set, and there's backtrace? 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 check Object#def_clone. . (breaking change) the method_missing macro only accepts a single argument: a Call now. The form that accepted 3 arguments was removed. (breaking change) the delegate macro must now be used like delegate method1, method2..., methodN, to: object. . (breaking change) Hash#each_with_index and Hash#each_with_object now yield a tuple (pair) and an index, because Hash is now Enumerable. Use do (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 example HTTP::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 this, add M - N nil fillers on the yield side (this makes it more explicit that nil was intended to be a block argument value). (breaking change) OpenSSL::SSL::Context and OpenSSL::SSL::Socket can no longer be used directly anymore. Use their respective subclasses OpenSSL::SSL::Context::Client. with OpenSSL::SSL::Socket::Client, OpenSSL::SSL::Context::Server with OpenSSL::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 to tls in HTTP::Client, HTTP::Server, H
0.17.427 May 2016 10:25 minor feature: Added string literals without interpolations nor escapes: q ... and
0.17.321 May 2016 17:25 minor feature: multiple macro runs executions didn't work well. incorrect formatting of underscore in unpacked block arguments. wrong codegen for global variable assignment in type declaration. initialize default arguments where evaluated at the class scope. 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.018 May 2016 03:16 minor feature: (breaking change) Macro defs are now parsed like regular methods. Enthe 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. Added docs for XML. Many.
0.16.006 May 2016 15:05 minor feature: (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. 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.
0.15.005 Apr 2016 07:05 minor feature: (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. Added Path#resolve method in macros. ... arguments to a macro call are now expanded before macro invocation. Special variables ( and ?) are now accessible after being defined in blocks. Some and regressions.
0.14.224 Mar 2016 08:05 minor feature: some regressions in the formatter. (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
0.14.123 Mar 2016 23:14 minor feature: (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. Allow initializing instance variables in non-generic module types. Spec: allow setting multiple output formatters. StringScanner: improved performance. Added foo. 0 = 1 and foo. 0 as valid syntax, similar to the one in . blocks. CSV: allow separate and quote characters different than comma and doble quote. YAML: support merge operator (
0.13.008 Mar 2016 03:15 minor feature: (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. Allow initializing instance variables in non-generic module types. Spec: allow setting multiple output formatters. StringScanner: improved performance. Added foo. 0 = 1 and foo. 0 as valid syntax, similar to the one in . blocks. CSV: allow separate and quote characters different than comma and doble quote. YAML: support merge operator (
0.12.017 Feb 2016 06:25 minor feature: (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. Array#push and Array#unshift can now accept multiple values and add the elements in an efficient way. Added default option to JSON.mapping. Added default option to YAML.mapping. 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. Added dns_timeout for HTTP::Client. Added dynamic width precision to sprintf. Markdown now supports blockquotes and 1 level of list nesting. p now accepts multiple arguments. Many and some optimizations.
0.11.128 Jan 2016 18:45 minor feature: #2054, #2057, #2059, #2064. . HTTP::Server::Response headers weren't cleared after each request. Formatter would incorrectly change property x :: Int32 to property x = uninitialized Int32.
0.11.024 Jan 2016 15:05 minor feature: (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 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 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. (breaking change) Renamed Enumerable#inject to Enumerable#reduce. . (breaking change) next and return semantic inside captured block has been swapped. 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. Security improvements to HTTP::StaticFileHandler. Moved seek, tell, pos and pos= from File to IO::FileDescriptor (affects Tempfile). URI.parse is now faster. Many, some really old ones involving with order of declaration.
0.10.108 Jan 2016 03:16 minor feature: Added Int#popcount. Added @ Naked attribute for ommiting a method's prelude. Check that abstract methods are implemented by subtypes. Some.
0.10.025 Dec 2015 12:45 minor feature: (breaking change) def arguments must always be enin parentheses. (breaking change) A space is now required before and after def return type restriction. (breaking change) Renamed Dir.working_dir to Dir.current. . (breaking change) Moved HTML::Builder to its own shard. . (breaking change) String#split now always keeps all results (never drops trailing empty strings). (breaking change) Removed Array#buffer, StaticArray#buffer and Slice#buffer. Use to_unsafe instead (so unsafe usages are easier to spot). (breaking change) Removed String#cstr. Use to_unsafe instead (so unsafe usages are easier to spot). Optimized Range#sum. Allow forward declarations for lib external vars. Added Int#to_s(base) for base = 62. JSON.parse now returns JSON::Any, which allows traversal of JSON objects with less casts. Added OpenSSL::PKCS5. MemoryIO can now be created to read/write from a Slice(UInt8). In this mode MemoryIO can't be exapnded, and can optionally be written. And when creating a MemoryIO from a String, it's non-resizeable and read-only. Added Object#! (the opposite of = ). at_exit now receives that exit status code in the block. Allow using Set in JSON mappings. Added File.executable?, File.readable? and File.writeable?. Array#sort_by and Array#sort_by! now use a Schwartzian transform. Added Array#each_permutation, Array#each_combination and Array#each_repeated_combination iterators. Added optional random argument to Array#sample and Array#shuffle . The delegate macro can now delegate multiple methods to an object. Added basic YAML generation.
0.9.131 Oct 2015 13:25 minor feature: Docs search now finds nested entries. Many corrections and changes to the formatter, for better consistency and less obtrusion. Added OpenSSL::Cipher and OpenSSL::Digest. Added Char#+(String). Added Hash#key and Hash#key?. Added Time::Span# and Time::Span#/. Added Slice#reverse_each. Added docs for Random and Tempfile. some.
0.9.017 Oct 2015 10:05 minor feature: (breaking change) The CGI module's funcionality has been moved to URI and HTTP::Params. . (breaking change) IO#read() is now IO#gets_to_end. Removed IO#read(count), added IO#skip(count). . (breaking change) json_mapping is now JSON.mapping. yaml_mapping is now YAML.mapping. . (breaking change) StringIO is now MemoryIO. . Added crystal tool format that automatically formats your code. protected methods can now be invoked between types inside a same namespace. Removed curses, you can use https://github.com/jreinert/ncurses-crystal . to_unsafe and numeric conversions are now also automatically performed in C struct and union fields. Added begin ... end as an alternative to if true ... end . Added ! operator. Added demetadata for char, float, bool and enums. Also for classes and structs (experimental). Dir.glob now works well with recursive patterns like. Added read_timeout and connect_timeout to HTTP::Client. Added Zlib. Added HTTP::DeflateHandler. Added ENV#fetch. Hash#new now accepts an initialize capacity argument. HTTP::Request provides access and mutation of query, path and query_params. Added XML::Node#content= and #name= . Allow passing handlers and a block to an HTTP::Server. crystal init now tries to use your github username if available. Added Hash#select, Hash#reject and their bang variant, and Hash#each_with_object. Added Hash#select(*keys) and Hash#reject(*keys) and their bang variant. Added Set#-, Set# , and Set#subtract. Allow running specs without colors. Added TypeNode#has_constant? and TypeNode#type_vars in macros. Added String#compare that allows case insensitive comparisons. Added File#truncate. CSV is now a class for iterating rows, optionally with headers access. Allow setting multiple before_request callbacks to an HTTP::Client . Added Dir.cd( block). Added Class#cast. and additions to WebSocket, like the possibility of streaming data. Added SemanticVersion class. loop now yields a counter. Added Array# =(ind
0.8.020 Sep 2015 00:15 minor feature: Renamed a couple of types: Channel- Channel::Error. UnbufferedChannel - Channel::Unbuffered, BufferedChannel - Channel::Buffered, DayOfWeek - Time::DayOfWeek, MonthSpan - Time::MonthSpan, TimeSpan - Time::Span, TimeFormat - Time::Format, EmptyEnumerable - Enumerable::EmptyError, SocketError - Socket::Error, MatchData - Regex::MatchData, SignedInt - Int::Signed, UnsignedInt - Int::Unsigned, FileDescriptorIO - IO::FileDescriptor, BufferedIO - IO::Buffered, CharReader - Char::Reader, PointerAppender - Pointer::Appender. (breaking change) All places that raised DomainError raise ArgumentError now. (breaking change) Renamed Type.cast to Type.new (for example, Int32.new instead of Int32.cast). (breaking change) Removed all macro instance variables except @type. . (breaking change) Removed undef. . (breaking change) Removed length() and count() methods from collections. The only method for this is now size. (breaking change) Removed the ability to invoke methods on a union class. Improved deger support. crystal deps now delegates to shards. Removed Projecfile support. Automatically convert numeric types when invoking C functions. Automatically define questions methods for enum members. Support quotes inside quoted symbols. Allow marking initialize as private. Added method_added macro hook. Added ArrayLiteral#includes?(obj) in macros. Added ASTNode#symbolize in macros. Added experimental yaml_mapping . Added nilable variants to Enumerable#max, Enumerable#min, and others. Added Iterator#flatten. Added setting a read timeout to HTTP::Client. Added Array#delete_at(index, count) and Array#delete_at(range). Added HTTP::Cookies. Added Tuple#reverse. Added Number#clamp. Added serveral socket options. Added WebSocket.open. Added Enum.flags macro. Added support for sending chunked content in HTTP server. Added future, lazy and delay concurrency methods. fork now returns a Process. Documented Set, and added a couple of methods. Nicer formatting in Benchmark.ips, and i
0.7.706 Sep 2015 02:25 minor feature: (breaking change) Reimplemented Process.run to allow configuring input, output and error, as well as behaving well regarding non-blocking IO. (breaking change) Removed the alias_method macro. (breaking change) Disallow declaring defs, classes and other declarations "dynamically" (for example inside an if... this of course didn't work, but incorrectly compiled). (breaking change) require is now only allowed at the top-level, never inside other types or methods. (breaking change) Removed Nil#to_i. . (breaking change) Changed API of Channel#select toward a thread-safe one. (breaking change) The two methods that IO must implement are now read(slice : Slice(UInt8)) and write(slice : Slice(UInt8)). New beautiful, searchable and more functional API docs. Thanks @rosylilly for the initial design, and @BlaxPirit for some improvements. CLI: Moved browser, hierarchy and types to crystal tool. . Added crystal tool context and crystal tool implementations for IDEs. Int# (amount) and Int#
0.7.614 Aug 2015 09:45 minor feature: (breaking change) removed support for trailing while/until (read this). (breaking change) Renamed Enumerable#drop to Enumerable#skip. . (breaking change) Renamed Time.at to Time.epoch, and Time#to_i and Time#to_f to Time#epoch and Time#epoch_f. . (breaking change) inherited macro now runs before a class' body. Renamed --no-build flag to --no-codegen . Allow interpolations in heredocs. Allow hash substitutions in String# and sprintf. Added SecureRandom.base64, SecureRandom.urlsafe_base64 and SecureRandom.uuid. Added File.link, File.symlink and File.symlink?. Added Enumerable#in_groups_of. Added Array#zip?. Added Array#permutations and Array#each_permutation. Added IO#gets(limit : Int) and IO#gets(delimiter : Char, limit : Int) . Added Iterator#compact_map, Iterator#take_while and Iterator#skip_while. Added StringLiteral#to_i macro method. Added Crypto::Bcrypt. Added Time.epoch_ms and Time#epoch_ms . Added BitArray#toggle and BitArray#invert. Fixed IO#reopen swapped semantic. Many bug fixes and improvements.
0.7.531 Jul 2015 07:05 minor feature: (breaking change) 0 is not a prefix for octal numbers anymore. Use 0o. . (breaking change) Renamed MissingKey to KeyError. . (breaking change) Renamed IndexOutOfBounds to IndexError. . Fixed all exception-handling related bugs. Allow nested and multiline ternary expressions. Allow assigning to _ (underscore), give error when trying to read from it. Macros can now also receive the following nodes: And, Or, Case, RangeLiteral and StringInterpolation. And and Or have left and right methods. Added -e option to hierarchy command to filter types by a regex. Added -v as an alias of --version . Added -h as an alias of --help . Added Array#transpose. Added Benchmark#ips. Added Hash#merge( block) and Hash#merge!( block). Added Hash#invert. Added Bool# . Added Enumerable#drop, Enumerable#drop_while and Enumerable#take_while. Added Enumerable#none?. Added Set#subset?, Set#superset? and Set#intersects?. Added Set#new(Enumerable). Added String#succ. Added Array#*. Added Char#===(Int) and Int#===(Char). Added StringLiteral#camelcase and StringLiteral#underscore in macros. Added Expressions#expressions in macros. Added Cast#obj and Cast#to in macros. Added ASTNode#class_name in macros. Added Array#push/Array#
0.7.424 Jun 2015 17:25 minor feature: Added Float module and remainder. Show elapsed time in HTTP::LogHandler. Added 0o as a prefix for octal numbers. Allow spaces before the closing tag of a heredoc. String#split(Regex) now includes captures in the results. Added union?, union_types and type_params in macro methods. Improved MatchData#to_s to show named groups. Optimized Base64 encode/decode. Added basic docs for spec. Added docs for Benchmark. Added ARGF. Non-matching regex captures now return nil instead of an empty string. Added 1?, 2?, etc., as a nilable alternative to 1, 2, etc. Added user, password, fragment and opaque to URI. HTTP::Client.exec now honors user/password info from URI. Set default user agent in HTTP::Client. Added String#chop. Fixed crystal deps behaviour with empty git repositories. Optimized HTTP::Headers and HTTP::Request parsing. FileDescriptorIO (superclass of File and Socket) has now buffering capabilities (use sync= and sync? to turn on/off). That means there's no need to use BufferedIO for these classes anymore. Allow pointerof with class and global variables, and also foo.@bar access. Optimized fibers performance. Added inline assembly support. The.crystal cache dir is now configurable with an ENV variable. Generic type variables names can now also be a single letter followed by a digit.
0.7.308 Jun 2015 08:25 minor feature: Added Tuple.from_json and Tuple.to_json. The method_missing macro now accepts a 1 argument variant that is a Call node. The 3 arguments variant will be deprecated. Flush STDOUT at program exit. Added Time#to_utc and Time#to_local. Time comparison is now correct when comparing local vs. utc times. Support timezone offsets in Time parsing and formatting. Added IO#gets(delimiter : String). Added String#chomp(Char) and String#chomp(String). Allow invoking debug() inside a macro to see what's being generated. IO#puts and IO#print now receive a splat. Added Process.kill and Process.getpgid. Signal is now an enum. Use it like Signal::INT.trap ... instead of Signal.trap(Signal::INT) ... . Added CSV.each_row (both in block and iterator forms). Important fixes to non-blocking IO logic.
0.7.003 May 2015 16:25 major feature: Crystal has evented IO by default. Added spawn and Channel . Correctly support the X86_64 and X86 ABIs. Now bindings to C APIs that pass and return structs works perfectly fine. Added crystal init to quickly create a skeleton library or application (thanks @waterlink) Added --emit flag to the compiler. Now you can easily see the generated LLVM IR, LLVM bitcode, assembly and object files. Added --no-color flag to supress color output, useful for editor tools. Added macro vars: var and var x, y create uniqely named variables inside macros. Added typed splats. Added Iterator and many methods that return iterators, like Array#each , Hash#each , Int#times , Int#step , String#each_char , etc. Added sprintf and improved String# to support floats and float formatting. Added more variants of String#gsub . Added Pointer#clear and use it to clear an Array 's values when doing pop and other shrinking methods. Added BigInt#to_s(base) , BigInt::cast and bit operators (thanks @Exilor) Allow invoking methods on a union class as long as all types in the union have it. Allow specifying a def's return type. The compiler checks the return type only for that def for now (not for subclasses overrding the method). The return type appears in the documentation. Allow constants and computed constants for a StaticArray length. Allow class vars in enums. Allow private and protected defs in enums. Allow reopening a lib and adding more @ Link attributes to it, even allowing duplicated attributes. Allow getting a function pointer to a lib fun without specifying its types (i.e. - LibC.getenv ) Allow specifying ditto for a doc comment to reuse the previous comment. Changed the semantic of : previously it meant remainder , not it means modulo , similar to Ruby and Python. Added Int#remainder . #to_s and #inspect now work for a union class. Spec: added global before_each and after_each hooks, which will simplify the use of mocking libraries like