0.16.0

@asterite asterite released this May 5, 2016 · 1588 commits to master since this release

  • (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

Downloads