All Versions
118
Latest Version
Avg Release Cycle
46 days
Latest Release
598 days ago

Changelog History
Page 12

  • v0.3.5 Changes

    July 29, 2014
    • (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*.
  • v0.3.4 Changes

    July 21, 2014
    • ๐Ÿ›  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)
  • v0.3.3 Changes

    July 14, 2014
    • ๐Ÿšš 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.
  • v0.3.2 Changes

    July 10, 2014
    • 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
  • v0.3.1 Changes

    July 09, 2014
    • (breaking change) Replaced @name inside macros with @class_name.
    • (breaking change) Instance variables inside macros now don't have the @ symbols in their names.
  • v0.3.0 Changes

    July 08, 2014
    • โž• 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 omitting 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
  • v0.2.0 Changes

    June 24, 2014
    • โœ‚ 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 column 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 :-)

  • v0.1.0 Changes

    June 18, 2014
    • ๐Ÿš€ First official release