Skip to content

Latest commit

 

History

History
460 lines (378 loc) · 25.9 KB

CHANGELOG.md

File metadata and controls

460 lines (378 loc) · 25.9 KB

0.7.1 (2015-04-30)

0.7.0 (2015-04-30)

  • 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 timecop.cr and webmock.cr.
  • Range(T) is now Range(B, E) again (much more flexible).
  • Improved Regex performance.
  • Better XML support.
  • Support LLVM 3.6.
  • Exception class is now shown on unhandled exceptions
  • The following types are now disallowed in generics (for now): Object, Value, Reference, Number, Int and Float.
  • Lots of bug fixes, enhancements and optimizations.

0.6.1 (2015-03-04)

  • The class method now works in all cases. You can now compare classes with == and ask their hash value.
  • Block variables can now shadow local variables.
  • Range(B, E) is now Range(T).
  • Added Number::[]. Now you can do Int64[1, 2, 3] instead of [1_i64, 2_i64, 3_u64].
  • Better detection of nilable instance variables, and better error messages too.
  • Added Crypto::Blowfish (thanks @akaufmann)
  • Added Matrix (thanks @Exilor)
  • Added CallConvention attribute for funs.
  • Macros: added constants so you can inspect a type's constants at compile time.
  • Macros: added methods, which lists a type's methods (without including supertypes).
  • Macros: added has_attribute? for enum types, so you can check if an enum has the Flags attribute on it.
  • Many more small additions and bug fixes.

0.6.0 (2015-02-12)

  • Same as 0.5.10

0.5.10 (transitional) (2015-02-12)

  • Note: This release makes core, breaking changes to the language, and doesn't work out of the box with its accompanying standard library. Use 0.6.0 instead.
  • Improved error messages related to nilable instance variables.
  • The magic variables $~ and $? are now method-local and concurrent-safe.
  • Tuple is now correctly considered a struct
  • Pointer is now correctly considered a struct
  • Renamed Function to Proc

0.5.9 (2015-02-07)

  • Random is now a module, with static methods that default to the Random::MT19937 class.
  • Added Random::ISAAC engine (thanks @ysbaddaden!)
  • Added String#size (thanks @zamith!)
  • Added limit to all String#split variants (thanks @jhass!)
  • Raising inside a Thread is now rescued and re-raised on join (thanks @jhass!)
  • Added path option to Projectfile for crystal deps (thanks @naps62!)
  • Many fixes towards making Crystal work on linux 32 bits.
  • Huge refactors, additions and improvements for sockets: Socket, IPSocket, TCPSocket, TCPServer, UDPSocket, UNIXSocket, UNIXServer (thanks @ysbaddaden!)
  • Allow regex with empty spaces in various places.
  • Added HTML.escape(String) (thanks @naps62!)
  • Added support for %w[...], %w{...}, %w<...> as alternatives to %w(...). Same goes for %i(...) (thanks @zamith!)
  • Added Enumerable#min_of, Enumerable#max_of and Enumerable#minmax_of, Enumerable#to_h, Dir.chdir and Number#fdiv (thanks @jhass!)
  • Added String#match, String#[], String#[]? and MatchData#[]? related to regexes (thanks @jhass!)
  • Allow T::Bar when T is a generic type argument.
  • Added subclasses and all_subclasses in macros.
  • Now you can invoke to_s and inspect on C structs and unions, making debugging C bindings much easier!
  • Added #to_f and #to_i to Time and TimeSpan (thanks @epitron!)
  • Added IO.select (thanks @jhass!)
  • Now you can use ifdef inside C structs and unions.
  • Added include inside C structs, to include other struct fields (useful for composition and avoiding an explicit indirection).
  • Added Char#in_set?, String#count, String#delete and String#squeeze (thanks @jhass!)
  • Added -D flag option to the compiler to set compile-time flags to use in ifdef.
  • More support for forward declarations inside C libs.
  • Rewritten some Function primitives in Crystal itself, and added methods for obtaining the pointer and closure data, as well as for recreating a function from these.
  • Added a Logger class (thanks @ysbaddaden!)
  • Lots of bugs fixed.

0.5.8 (2015-01-16)

  • Added Random and Random::MT19937 (Mersenne Twister) classes (thanks @rhysd).
  • Docs: removed automatic linking. To link to classes and methods surround with backticks.
  • Fixed #328: != bug.

0.5.7 (2015-01-02)

  • Fixed: doc command had some hardcoded paths and didn't work
  • Added: private def at the top-level of a file is only available inside that file

0.5.6 (2014-31-12)

  • Added a crystal doc command to automatically generate documentation for a project using Markdown syntax. The style is still ugly but it's quite functional. Now we only need to start documenting things :-)
  • Removed the old @: attribute syntax.
  • Fixed #311: Issues with invoking lib functions in other ways (thanks @scidom).
  • Fixed #314: NoReturn information is not lazy.
  • Fixed #317: Fixes in UTF-8 encoding/decoding (thanks @yous).
  • Fixed #319: Unexpected EOF (thanks @Exilor).
  • {{yield}} inside macros now preserve the yielded node location, leading to much better error messages.
  • Added Float#nan?, Float#infinite? and Float#finite?.
  • Many other bug fixes and improvements.

0.5.5 (2014-12-12)

  • Removed src and crystal compiler libs directory from CRYSTAL_PATH.
  • Several bug fixes.

0.5.4 (2014-12-04)

  • (breaking change) require "foo" always looks up in CRYSTAL_PATH. require "./foo" looks up relative to the requiring file.
  • (breaking change) Renamed Json to JSON, Xml to XML and Yaml to YAML to follow a convention.
  • (breaking change) To use HTTP types do, for example, require "http/client" instead of the old require "net/http".
  • Added alias_method macro (thanks @Exilor and @jtomschroeder).
  • Added some Complex number methods and many math methods, refactors and specs (thanks @scidom).
  • Inheriting generic classes is now possible.
  • Creating arrays of generic types (i.e.: [] of Thread) is now possible.
  • Allow using an alias in a block type (i.e.: alias F = Int32 ->, &block : F).
  • json_mapping macro supports a simpler syntax: json_mapping({key1: Type1, key2: Type2}).
  • Spec: added be_a(type) matcher.
  • Spec: added be > ... and similar matchers for >=, < and <=.
  • Added File::file? and File::directory?.
  • CSV parser can parse from String or IO.
  • When invoking the compiler like this: crystal foo.cr -o foo the build command is assumed instead of run.
  • Added short symbol notation for methods that are operators (i.e. :+, :*, :[], etc.).
  • Added TimeSpan#ago, TimeSpan#from_now, MonthSpan#ago and MonthSpan#from_now.

0.5.3 (2014-11-06)

  • Spec: when a should or should_not fail, the filename and line number, including the source's line, is included in the error message.
  • Spec: added -l switch to be able to run a spec defined in a line.
  • Added crystal spec file:line
  • Properties (property, setter, getter) can now be restricted to a type with the syntax property name :: Type.
  • Enums can be used outside lib. They inherit Enum, can have methods and can be marked with @[Flags].
  • Removed the distinction between lib enums and regular enums.
  • Fixed: it was incorrectly possible to define class, def, etc. inside a call block.
  • The syntax for specifying the base type of an enum, enum Name < BaseType has been deprecated. Use enum Name : BaseType.
  • Added Array#<=> and make it comparable to other arrays.

0.5.2 (2014-11-04)

  • New command line interface to the compiler (crystal build ..., crystal run ..., crystal spec, etc.). The default is to compiler and run a program.
  • crystal eval without arguments reads from standard input.
  • Added preliminar crystal deps command.
  • __FILE__, __DIR__ and __LINE__, when used as def default arguments, resolve to the caller location (similar to D and Swift)
  • Allow as to determine a type even if the casted value doesn't have a type yet.
  • Added is_a? in macros. The check is against an AST node name. For example node.is_a?(HashLiteral).
  • Added emit_null property to json_mapping.
  • Added converter property to json_mapping.
  • Added pp in macros.
  • Added to_pretty_json.
  • Added really basic CSV.parse.
  • Added Regex.escape.
  • Added String#scan.
  • Added -e switch to spec, to run specs that match a pattern.
  • Added --fail-fast swtich to spec.
  • Added HTTPClient#basic_auth.
  • Added DeclareVar, Def and Arg macro methods.
  • Added Time and TimeSpan structs. TimeWithZone will come later.
  • Added Array#fill (thanks @Exilor).
  • Added Array#uniq.
  • Optimized File.read_lines.
  • Allow any expression inside {% ... %} so that you can intepret code without outputting the result.
  • Allow \ at the end of a line.
  • Allow using if and unless inside macro expressions.
  • Allow marking a fun/def as @[Raises] (useful when a function can potentially raise from a callback).
  • Allow procs are now considered @[Raises].
  • OAuth2::Client supports getting an access token via authorization code or refresh token.
  • Consecutive string literals are automatically concatenated by the parser as long as there is a \ with a newline between them.
  • Many bug fixes.

0.5.1 (2014-10-16)

  • Added json_mapping macro.
  • Added Signal module.
  • Added Tempfile class.
  • Enhanced HTTP::Client.
  • Added OAuth::Consumer.
  • Added OAuth2::Client.
  • Added OpenSSL::HMAC.
  • Added SecureRandom.
  • New syntax for array/hash-like classes. For example: Set {1, 2, 3} and HTTP::Headers {"content-type": "text/plain"}. These just create the type and use << or []=.
  • Optimized Json parsing performance.
  • Added a CSV builder.
  • XML reader can parse from an IO.
  • Added Dir::glob and Dir::Entries (thanks @jhass)
  • Allow ensure as an expression suffix.
  • Fixed #219: Proc type is not inferred when passing to library fun and the return type doesn't match.
  • Fixed #224: Class#new doesn't pass a block.
  • Fixed #225: ICE when comparing void to something.
  • Fixed #227: Nested captured block looses scope and crashes compiler.
  • Fixed #228: Macro expansion doesn't retain symbol escaping as needed.
  • Fixed #229: Can't change block context if defined within module context.
  • Fixed #230: Type interference breaks equality operator.
  • Fixed #233: Incorrect no block given message with new.
  • Other bug fixes.

0.5.0 (2014-09-24)

  • String overhaul, and optimizations

0.4.5 (2014-09-24)

  • Define backtick (`) for command execution.
  • Allow string literals as keys in hash literals: {"foo": "bar"} # :: Hash(String, String)
  • Allow ifdef as a suffix.
  • Integer division by zero raises a DivisionByZero exception.
  • Link attributes are now only processed if a lib function is used.
  • Removed the type Name : Type syntax (use type Name = Type instead).
  • Removed the lib Lib("libname"); end syntax. Use @[Link] attribute instead.
  • Fixed some require issues.
  • String representation includes length.
  • Upgraded to LLVM 3.5.

0.4.4 (2014-09-17)

  • Fixed #193: allow initializing an enum value with another's one.
  • The record macro is now variadic, so instead of record Vec3, [x, y, z] write record Vec3, x, y, z.
  • The def_equals, def_hash and def_equals_and_hash macros are now variadic.
  • The property, getter and setter macros are now variadic.
  • All String methods are now UTF-8 aware.
  • String#length returns the number of characters, while String#bytesize return the number of bytes (previously length returned the number of bytes and bytesize didn't exist).
  • String#[](index) now returns a Char instead of an UInt8, where index is counted in characters. There's also String#byte_at(index).
  • Removed the \x escape sequence in char and string literals. Use \u instead.
  • initialize methods are now protected.
  • Added IO#gets_to_end.
  • Added backticks (...) and %x(...) for command execution.
  • Added %r(...) for regular expression literals.
  • Allow interpolations in regular expresion literals.
  • Compiling with --release sets a release flag that you can test with ifdef.
  • Allow passing splats to C functions
  • A C type can now be declared like type Name = Type (type Name : Type will be deprecated).
  • Now a C struct/union type can be created with named arguments.
  • New attributes syntax: @[Attr(...)] instead of @:Attr. The old syntax will be deprecated in a future release.
  • New link syntax for C libs: @[Link("name")] (uses name as pkg-config name if available or -lname instead), @[Link(ldflags: "...")] to pass raw flags to the linker, @[Link("name", static: true)] to try to find a static library first, and @[Link(framework: "AppKit")] (for Mac OSX).
  • Added an exec method to execute shell commands. Added the system and backtick similar to Ruby ones.
  • Added be_truthy and be_falsey spec matchers. Added Array#zip without a block. (thanks @mjgpy3)
  • Added getter? and property? macros to create methods that end with ?.
  • Added a CGI module.
  • The compiler now only depends on cc for compiling (removed dependency to llc, opt, llvm-dis and clang).
  • Added IO#tty?.
  • Some bug fixes.

0.4.3 (2014-08-14)

  • Reverted a commit that introduced random crashes.

0.4.2 (2014-08-13)

  • Fixed #187: mixing yield and block.call crashes the compiler.
  • Added \u unicode escape sequences inside strings and chars (similar to Ruby). \x will be deprecated as it can generate strings with invalid UTF-8 byte sequences.
  • Added String#chars.
  • Fixed: splats weren't working in initialize.
  • Added the private and protected visibility modifiers, with the same semantics as Ruby. The difference is that you must place them before a def or a macro call.
  • Some bug fixes.

0.4.1 (2014-08-09)

  • Fixed #185: -e flag stopped working.
  • Added a @length compile-time variable available inside tuples that allows to do loop unrolling.
  • Some bug fixes.

0.4.0 (2014-08-08)

  • Support splats in macros.
  • Support splats in defs and calls.
  • Added named arguments.
  • Renamed the make_named_tuple macro to record.
  • Added def_equals, def_hash and def_equals_and_hash macros to generate them from a list of fields.
  • Added Slice(T), which is a struct having a pointer and a length. Use this in IO for a safe API.
  • Some StaticArray fixes and enhancements.

0.3.5 (2014-07-29)

  • (breaking change) Removed the special -> operator for pointers of structs/unions: instead of foo->bar use foo.value.bar; instead of foo->bar = 1 use foo.value.bar = 1.
  • Added colorize file that provides methods to easily output bash colors.
  • Now you can use modules as generic type arguments (for example, do x = [] of IO).
  • Added SSL sockets. Now HTTP::Server implements HTTPS.
  • Macros have access to constants and types.
  • Allow iterating a range in macros with for.
  • Use cpu cycle counter to initialize random.
  • method_missing now works in generic types.
  • Fixed #154: bug, constants are initialized before global variables.
  • Fixed #168: incorrect type inference of instance variables if not assigned in superclass.
  • Fixed #169: responds_to? wasn't working with generic types.
  • Fixed #171: ensure blocks are not executed if the rescue block returns from a def.
  • Fixed #175: invalid code generated when using with/yield with structs.
  • Fixed some parser issues and other small issues.
  • Allow forward struct/union declarations in libs.
  • Added String#replace(Regex, String)
  • Added a Box(T) class, useful for boxing value types to pass them to C as Void*.

0.3.4 (2014-07-21)

  • Fixed #165: restrictions with generic types didn't work for hierarchy types.
  • Allow using a single underscore in restrictions, useful for matching against an n-tuple or an n-function where you don't care about the types (e.g.: def foo(x : {_, _}).
  • Added a generate_hash macro that generates a hash methods based on some AST nodes.
  • Added very basic previous_def: similar to super, but uses the previous definition of a method. Useful to decorate existing methods (similar to alias_method_chain). For now the method's type restrictions must match for a previous definition to be found.
  • Made the compiler a bit faster
  • Added env in macros, to fetch an environment value. Returns a StringLiteral if found or NilLiteral if not.
  • Make return 1, 2 be the same as return {1, 2}. Same goes with break and next.
  • Added Pointer#as_enumerable(size : Int) to create an Enumerable from a Pointer with an associated size, with zero overhead. Some methods removed from Pointer: each, map, to_a, index.
  • Added StaticArray::new, StaticArray::new(value), StaticArray::new(&block), StaticArray#shuffle! and StaticArray#map!.
  • Faster Char#to_s(io : IO)

0.3.3 (2014-07-14)

  • Allow implicit conversion to C types by defining a to_unsafe method. This removed the hardcoded rule for converting a String to UInt8* and also allows passing an Array(T) to an argument expecting Pointer(T).
  • Fixed .is_a?(Class) not working (#162)
  • Attributes are now associated to AST nodes in the semantic pass, not during parsing. This allows macros to generate attributes that will be attached to subsequent expressions.
  • (breaking change) Make ENV#[] raise on missing key, and added ENV#[]?
  • (breaking change) Macro defs are now written like macro def name(args) : ReturnType instead of def name(args) : ReturnType, which was a bit confusing.

0.3.2 (2014-07-10)

  • Integer literals without a suffix are inferred to be Int32, Int64 or UInt64 depending on their value.
  • Check that integer literals fit into their types.
  • Put back Int#to_s(radix : Int) (was renamed to to_s_in_base in the previous release) by also specifying a restriction in Int#to_s(io : IO).
  • Added expect_raises macros in specs

0.3.1 (2014-07-09)

  • (breaking change) Replaced @name inside macros with @class_name.
  • (breaking change) Instance variables inside macros now don't have the @ symbols in their names.

0.3.0 (2014-07-08)

  • Added Array#each_index
  • Optimized String#* for the case when the string has length one.
  • Use GC.malloc_atomic for String and String::Buffer (as they don't contain internal pointers.)
  • Added a PointerAppender struct to easily append to a Pointer while counting at the same time (thanks @kostya for the idea).
  • Added a Base64 module (thanks @kostya)
  • Allow default arguments in macros
  • Allow invoking new on a function type. For example: alias F = Int32 -> Int32; f = F.new { |x| x + 1 }; f.call(2) #=> 3.
  • Allow ommiting function argument types when invoking C functions that accept functions as arguments.
  • Renamed @name to @class_name inside macros. @name will be deprecated in the next version.
  • Added IO#read_fully
  • Macro hooks: inherited, included and extended
  • method_missing macro
  • Added {{ raise ... }} inside macros to issue a compile error.
  • Started JSON serialization and deserialization
  • Now at_exit handlers are run when you invoke exit
  • Methods can be marked as abstract
  • New convention for to_s and inspect: you must override them receiving an IO object
  • StringBuilder and StringBuffer have been replaced by StringIO

0.2.0 (2014-06-24)

  • Removed icr (a REPL): it is abandoned for the moment because it was done in a hacky, non-reliable way

  • Added very basic String#underscore and String#camelcase.

  • The parser generates string literals out of strings with interpolated string literals. For example, "#{__DIR__}/foo" is interpolated at compile time and generates a string literal with the full path, since __DIR__ is just a (special) string literal.

  • (breaking change) Now macro nodes are always pasted as is. If you want to generate an id use {{var.id}}.

    Previously, a code like this:

    macro foo(name)
      def {{name}}; end
    end
    
    foo :hello
    foo "hello"
    foo hello

    generated this:

    def hello; end
    def hello; end
    def hello; end

    With this change, it generates this:

    def :hello; end
    def "hello"; end
    def hello; end

    Now, to get an identifier out of a symbol literal, string literal or a name, use id:

    macro foo(name)
      def {{name.id}}; end
    end

    Although it's longer to type, the implicit "id" call was sometimes confusing. Explicit is better than implicit.

    Invoking id on any other kind of node has no effect on the pasted result.

  • Allow escaping curly braces inside macros with \{. This allows defining macros that, when expanded, can contain other macro expressions.

  • Added a special comment-like pragma to change the lexer's filename, line number and colum number.

    # foo.cr
    a = 1
    #<loc:"bar.cr",12,24>b = 2
    c = 3

    In the previous example, b = 2 (and the rest of the file) is considered as being parsed from file bar.cr at line 12, column 24.

  • Added a special run call inside macros. This compiles and executes another Crystal program and pastes its output into the current program.

    As an example, consider this program:

    # foo.cr
    {{ run("my_program", 1, 2, 3) }}

    Compiling foo.cr will, at compile-time, compile my_program.cr and execute it with arguments 1 2 3. The output of that execution is pasted into foo.cr at that location.

  • Added ECR (Embedded Crystal) support. This is implemented using the special run macro call.

    A small example:

    # template.ecr
    Hello <%= @msg %>
    # foo.cr
    require "ecr/macros"
    
    class HelloView
      def initialize(@msg)
      end
    
      # This generates a to_s method with the contents of template.ecr
      ecr_file "template.ecr"
    end
    
    view = HelloView.new "world!"
    view.to_s #=> "Hello world!"

    The nice thing about this is that, using the #<loc...> pragma for specifying the lexer's location, if you have a syntax/semantic error in the template the error points to the template :-)

0.1.0 (2014-06-18)

  • First official release