goby (rooby)
Goby is a Ruby-like object oriented language written in Go. And it's not a new Ruby implementation. Instead, it should be a language that help developer create api server or microservice efficiently.
It will have Ruby's syntax (I'll try to support all common syntaxes) but without most of Ruby's meta-programming magic to make the VM simple. It will also have built in http library that is built upon Go's efficient http package. And I'm planning to do more optimization by using goroutine directly.
Supporting Goby by sending your first PR! See contribution guideline
Or support us by donation (I quit my job to develop Goby
in full-time, so financial support are needed 😢)
(We'll release first beta version in August, please checkout this issue for what features Goby
will support.)
Table of contents
Supported Features
- Can be compiled into bytecode (with
.gbbc
extension)
- Can evaluate bytecode directly
- Everything is object
- Support comment
- Object and Class
- Top level main object
- Constructor
- Support class methods
- Support inheritance
- Support instance variable
- Support
self
- Module
- Namespace
- Variables
- Constant
- Local variable
- Instance variable
- Method
- Support evaluation with arguments
- Support evaluation without arguments
- Support evaluation with block (closure)
- BuiltIn Data Types (All of them are classes 😀)
- Class
- Integer
- String
- Boolean
- nil
- Hash (with built in
to_json
method)
- Array
- Flow control
- If statement
- while statement
- Import other files
- require_relative
- require (only for standard libraries now)
- Standard Libraries (all of them are at very early stage)
URI
Net::HTTP
Net::SimpleServer
(This is very cool and quite performante, check the sample)
File
- IO
- Thread (this should work but the implementation is quite naive and will be refined in the future)
- Support
thread
method to create a new thread (like goroutine
)
- Has
Channel
class for passing objects between threads (like chan
in Go)
- See this sample: One thousand threads
(You can open an issue for any feature request)
Install
Setup $GOBY_ROOT
Goby requires environment variable $GOBY_ROOT
for installing libraries. Add the following line to your shell config file, either ~/.bashrc
, ~/.bash_profile
, or ~/.zshrc
if you're using zsh.
export GOBY_ROOT=/usr/local/goby
You can set any path as your $GOBY_ROOT
.
The most common messages you'll see if you do not set $GOBY_ROOT
are 'library not found'. For example:
require 'net/http'
# => Internal Error: open lib/net/http/response.gb: no such file or directory
From Source
- You must have Golang installed
- You must have set $GOPATH
- Add your $GOPATH/bin into $PATH
- Run following command
$ go get github.com/goby-lang/goby
- Run
goby -v
to verify.
Via homebrew
Please checkout the latest release before using this approach
brew tap goby-lang/goby
brew install goby
For now, we recommend install Goby
from source directly because it evolves really quick and we don't have time to release it frequently.
Usage
$ goby ./samples/server.gb
Samples
See sample directory for sample code snippets, like:
Documentations
Check out our API Documentation.
There is still a lot of document to add. Feel free to contribute following this guide.
Contribute
See the guideline.
Maintainers
- @st0012
- @janczer
- @adlerhsieh
- @hachi8833
- @shes50103
Support Us
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
References
I can't build this project without these resources, and I highly recommend you to check them out if you're interested in building your own languages: