Goby is an object-oriented interpreter language deeply inspired by Ruby as well as its core implementation by 100% pure Go, plus standard libraries to several features such as Plugin system. Note that we do not intend to reproduce whole of the honorable works of Ruby syntax/implementation/libraries.
One of our goal is to provide web developers a sort of small and handy environment that mainly focus on creating API servers or microservices. For this, Goby includes the following native features:
- Tough thread/channel mechanism powered by Go's goroutine
- Builtin high-performance HTTP server
- Builtin database library (currently only support PostgreSQL adapter)
- JSON support
- Plugin system that can load existing Go packages dynamically (Only for Linux by now)
- Accessing Go objects from Goby directly
Note: Goby had been formerly known as "Rooby", which was renamed in May 2017.
- Demo and sample Goby app
- Aspects
- Installation
- Usage
- Sample codes
- Documentation
- Joining to Goby
- Maintainers
- Support us
- References
New! Check-out our sample app built with Goby. Source code is also available here.
Goby has several aspects: language specification, design of compiler and vm, implementation (just one for now), library, and the whole of them.
Language: Class-based, straignt-ahead object-oriented script language. Syntax is influenced by Ruby language (and by Go a bit), but has been condensed and simplified (and slightly modified) to keep Goby VM simple and concise. Several aspects of Ruby such as meta-programming (known as 'magic'), special variables with $, or like that, have been dropped for now, but note that we might resurrect some of them with a different form or implementation in a future.
Class: Single inheritance. Module is supported for mixin with #include or #extend. Defining singleton class and singleton method is also supported. Goby has internally two kinds of class: native class and standard class. Native class (or builtin class) provides fundamental classes such as Array or String. Object class is a superclass of any other native/standard classes including Class class. Class class contains most common methods such as #puts. Standard class (or standard library) can be loaded via require and provides additional methods. Standard classes are often split internal Go code and external Goby code in order to make implementation easier. Both kind of classes are transparent to Goby developers and can be overridden by child classes. Any classes including Class class are under Object class.
Compiler: Consists of AST, lexer, parser, and token. Pretty conventional and should be familiar to language creators. These components are all written in 100% pure Go, instead of using conventional static yacc/lex/bison conversion with a mess of ad-hoc macros. This makes Goby's codes far smaller, concise, and legible. You can inspect, maintain, or improve Goby codes more easily, being free from pains like C/C++ era.
VM: YARV-conscious, including stack and call_frame, as well as containing Goby's native classes, plus some standard library and additional components. All are written in Go as well.
Implementation: Built in a monolithic Go binary executable, which equips several native features such as a tough thread/channel mechanism powered by goroutine, a very new experimental Plugin system to manage existing Go packages dynamically from Goby codes, igb (REPL) powered by readline package. Goby contains some standard or third-party Go packages, but the dependency to them is not high. These packages contain no CGO codes (at least by now) thus cross-compile for any OS environments that Go supports should work fine.
Library: Provides some lean but sufficient standard libraries to support developers, including threaded high-performance HTTP server, DB adapter, file or JSON. Curiously, most of them are split into Go and Goby codes, and Goby codes are not within Goby executable but placed under lib directory as Goby script files. Of course you can create custom libraries and include them to your codes. Thanks to the flexibility of Plugin system, we expect that you can quickly import most of existing Go packages to your Goby scripts without creating additional libraries from scratch in almost all cases.
Let's improve Goby together!: We are optimizing and expanding Goby all the time. Toward the first release, we've been focusing on implementing Goby first.
- 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)
Perhaps Goby should be far easier for Rubyists to comprehend. You can use Ruby's syntax highlighting for Goby as well😀
- 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
VarorVAR - global if defined on top-level
- not reentrant
- (special variables with
$are unsupported)
- Starts with uppercase like
- Methods
- Evaluation with arguments
- Evaluation without arguments
- Evaluation with block (closure)
- Defining singleton method
- Block
do-end
- Flow control
if,else,elsifwhile
- IO
#putsARGV
- Import files
require(Just for standard libraries by now)require_relative
- Thread (not a class!)
- Goroutine-based
threadmethod to create a new thread - Works with
Channelclass for passing objects between threads, likechanin Go - See this sample: One thousand threads
- Goroutine-based
Written in Go.
ClassIntegerStringBooleanNull(nil)HashArrayRangeURIChannelGoObject(provides#go_functhat wraps pure Go objects or pointers for interaction)
written in Go and Goby.
- Loadable class
FileDB(only for PostgreSQL by now)Plugin
- Loadable module
- NET
Net::HTTP:RequestNet::HTTP:ResponseNet::SimpleServer(try sample Goby app and source, or sample code!)
- NET
Confirmed Goby runs on Mac OS and Linux for now. Try Windows and let us know the result.
Note: Please check the latest release before installing Goby via Homebrew
brew tap goby-lang/goby
brew install goby
In the case, $GOBY_ROOT is automatically configured.
Try this if you'd like to contribute Goby! Skip 1 if you already have Golang in your environment.
- Prepare Golang environment
1-1. Install Golang
1-2. Make sure
$GOPATHin your shell's config file( like .bashrc) is correct 1-3. Add you$GOPATH/binto$PATH - Run
go get github.com/goby-lang/goby - Set the Goby project's exact root path
$GOBY_ROOTmanually, which should be:
$GOPATH/src/github.com/goby-lang/goby
- Run
goby -vto see the version. - Run
goby -ito launch igb REPL. - Type
require "file"in igb.
FYI: You can just run brew test goby to check Homebrew installation.
If you have any issue installing Goby, please let us know via Github issues
Goby has official docker image as well. You can try the Plugin System using docker.
- Built a stack data structure using Goby
- Running a "Hello World" app with built in server library
- Sending request using http library
- Running load test on blocking server (This shows
Goby's simple server is very performant and can handle requests concurrently) - One thousand threads
More sample Goby codes can be found in sample directory.
- User Manual (WIP)(Gitbooks)
- API Documentation -- needs update the build script. See the guide for API doc if you'd like to contribute.
See the guideline.
- @st0012
- @hachi8833
- @Maxwell-Alexius
Support us with a monthly donation and help us continue our activities. [Become a backer]
(We'll release first beta version in August, please checkout this issue for what features Goby will support.)
Supporting Goby by sending your first PR! See contribution guideline
Or support us on opencollective (I quit my job to develop Goby in full-time, so financial support are needed 😢)
The followings are the essential resources to create Goby; I highly recommend you to check them first if you'd be interested in building your own languages:


