@st0012 st0012 released this Jul 7, 2018 · 232 commits to master since this release

Assets 3

Goby 0.1.10 release note

Performance Improvement

Compare to the first commit (d5f5fc) that introduces the benchmark

benchmarking d5f5fc591bdbd3cd8f35cfe4e753f977478eecf8
benchmarking e22beaebdea18ea8670d98d56f4e4f39eed444e8
x86_64-darwin17
benchmark                         old ns/op     new ns/op     delta
BenchmarkBasicMath/add-4          7178          5299          -26.18%
BenchmarkBasicMath/subtract-4     7185          5336          -25.73%
BenchmarkBasicMath/multiply-4     7185          5298          -26.26%
BenchmarkBasicMath/divide-4       7158          5292          -26.07%

benchmark                         old allocs     new allocs     delta
BenchmarkBasicMath/add-4          78             75             -3.85%
BenchmarkBasicMath/subtract-4     78             75             -3.85%
BenchmarkBasicMath/multiply-4     78             75             -3.85%
BenchmarkBasicMath/divide-4       78             75             -3.85%

benchmark                         old bytes     new bytes     delta
BenchmarkBasicMath/add-4          3792          3152          -16.88%
BenchmarkBasicMath/subtract-4     3792          3152          -16.88%
BenchmarkBasicMath/multiply-4     3792          3152          -16.88%
BenchmarkBasicMath/divide-4       3792          3152          -16.88%

Features

Classes

APIs

  • Object#respond_to? - #651
  • Integer#to_d - #649
  • Class#method_missing - #672
  • Class#inherits_method_missing - #676
  • Class#Constants - #686
  • Object#print - #694

Fixes

  • Fixed some documentation mistakes
  • Fixed panic when a library file is not found on startup
  • Fixed #643
  • Fixed #679

Other changes

  • Moved db related code out of vm package

@st0012 st0012 released this Apr 3, 2018 · 360 commits to master since this release

Assets 3

Features

Builtin Test Framework

Now you can use built-in test framework: spec to write specs for Goby program! For example:

require "spec"

Spec.describe Spec do
  describe "comparison" do
    describe "#to eq" do
      it "compares if two values are equal" do
        expect(1).to eq(1)
      end
    end

    describe "#not_to eq" do
      it "compares if two values are not equal" do
        expect(1).not_to eq(2)
      end
    end
  end

  describe "indentation" do
    it "indents four spaces" do
    end
    describe "nest another level" do
      it "indents six spaces" do
      end
    end
  end
end

And to run the spec, use goby test FILE_OR_DIRECTORY_PATH.
Then it will run the spec and print the output like:

Spec
  comparison
    #to eq
      it "compares if two values are equal"
    #not_to eq
      it "compares if two values are not equal"
  indentation
    it "indents four spaces"
    nest another level
      it "indents six spaces"

Support Descending Range

Thanks to @ear7h, this is a feature that does not exist in Ruby but now in Goby!
Take the following code as an example:

sum = 0
(2..-9).step(3) do |i|
  sum = sum + i
end
puts(sum)

In Ruby it returns 0 cause it does not support descending range.
But in Goby it will return -10 😁

New APIs

Fixes (thanks to @shes50103)

@st0012 st0012 released this Mar 11, 2018 · 423 commits to master since this release

Assets 3

The major fix is to make splat parameter returns an empty array instead of nil when no argument is passed.

def foo(*x)
  x
end

# before fix
foo #=> nil

# after fix
foo #=> []

@st0012 st0012 released this Mar 4, 2018 · 441 commits to master since this release

Assets 3

Upgrade Go's version to 1.10

Features

Support String's range indexing

s = "Hello!"
puts(s[1..3]) #=> ell

Fixes

Testing

Add AST testing helpers

For example, to test

def add(x, y)
  x + y
end

We can now write it like:

firstStmt := program.FirstStmt().IsDefStmt(t)
firstStmt.ShouldHasName("add")
firstStmt.ShouldHasNormalParam("x")
firstStmt.ShouldHasNormalParam("y")

firstExpression := firstStmt.MethodBody().NthStmt(1).IsExpression(t)
infixExp := firstExpression.IsInfixExpression(t)
infixExp.ShouldHasOperator("+")
infixExp.TestableLeftExpression().IsIdentifier(t).ShouldHasName("x")
infixExp.TestableRightExpression().IsIdentifier(t).ShouldHasName("y")

Add Integration tests for simple server

See #604

Add t.Helper() to test helper functions

@st0012 st0012 released this Jan 30, 2018 · 588 commits to master since this release

Assets 3

v0.1.7 release note

New Keywords

  • get_block: let you retrieve a block as an object
  • break: break current loop or block execution

New APIs

  • Array#lazy
  • Array#to_enum
  • Object#raise
  • Range#lazy
  • Range#map
  • Range#to_enum

New Classes

  • LazyEnumerator
  • ArrayEnumerator
  • RangeEnumerator

Fixes

Deprecations

  • then keyword

@st0012 st0012 released this Dec 4, 2017 · 677 commits to master since this release

Assets 3

New BuiltIn Types

  • Float
  • GoMap
  • Decimal
  • MatchData
  • Regex

New Libraries

  • Concurrent::Array
  • Concurrent::Hash
  • Concurrent::RWLock

Syntax Change

  • Add _ for unused variable
  • Support float literal like 1.0
  • Support Keyword Argument (unstable)
  • Support Case expression
  • Prohibit capitalized method call like Foo()
  • Drop support of ++
  • Support += or -= syntactic sugars
  • Support ~= operator

Others

  • Stack Traces support (unstable)
  • A lot bug fixes (too many to list)

@st0012 st0012 released this Sep 18, 2017 · 1016 commits to master since this release

Assets 3
  • File is now builtin class instead of standard library now
  • Added some new APIs to Array class
  • Added Object#send
  • Channel's performance should be improved due to upgrading Go to version 1.9
  • Fixed some edge case issues
  • Largely improve http library

@st0012 st0012 released this Sep 3, 2017 · 1121 commits to master since this release

Assets 3
  • Upgrade to Go 1.9
  • Support splat arguments
  • Add dup and splat_array instructions
  • Restrict parameters define order: normal arg > optioned arg > splat arg (last)
  • Suspend using duplicated parameter name when defining methods - by @shuheiktgw
  • Refactor lexer to better support string escaping - by @Maxwell-Alexius
  • Fix REPL's display issue on Windows OS - by @mattn

@st0012 st0012 released this Aug 24, 2017 · 1190 commits to master since this release

Assets 3
v0.1.1

Bump version to 0.1.1

@st0012 st0012 released this Aug 24, 2017 · 1191 commits to master since this release

Assets 3

Full features for version 0.1.0

Special Features

  • Plugin system
    • Allows to use Go libraries (packages) dynamically
    • Allows to call Go's methods from Goby directly (only on Linux for now)
  • Builtin multi-threaded server and DB library
  • REPL (run goby -i)

Normal Language Features

  • Everything is object
  • Object and Class
    • Top level main object
    • Constructor
    • Class/instance method
    • Class
      • Inheritance
      • Singleton class is now supported
    • self
  • Module
    • #include
    • #extend
    • :: for namespace
  • Variable: starts with lowercase letter like 'var`
    • Local variable
    • Instance variable
  • Constant
    • Starts with uppercase like Var or VAR
    • global if defined on top-level
    • not reentrant
    • (special variables with $ are unsupported)
  • Methods
    • Evaluation with arguments
    • Evaluation without arguments
    • Evaluation with block (closure)
    • Defining singleton method
  • Block
    • do - end
  • Flow control
    • if, else, elsif
    • while
  • IO
    • #puts
    • ARGV
  • Import files
    • require (Just for standard libraries by now)
    • require_relative
  • Thread (not a class!)
    • Goroutine-based thread method to create a new thread
    • Works with Channel class for passing objects between threads, like chan in Go
    • See this sample: One thousand threads