SlideShare a Scribd company logo
What would your own
version of Ruby look like?
Stan Lo
About Me
• GitHub: st0012
• Twitter: @_st0012
• Work at Ticketsolve
I have my own version of Ruby
https://github.com/goby-lang/goby
Today I want to share my visions of Goby
And how do they make Goby different from
Ruby
Outline
• Introduction about my language - Goby
• How does it feel to have my own language
• My visions and plans for Goby
• Extensibility
• Productivity
What’s Goby
What’s Goby
• It’s an object-oriented scripting language
• It’s written in Go
• It’s largely inspired by Ruby, from syntax to
internal designs
Project Status
• It’s one year old now
• Version 0.1.9 just released last month (0.1.10
is coming)
• It has built-in libraries required for writing
web applications
• You can already write simple web applications
How does it feel to have my
own language
It’s a very good opportunity for learning
I had a deeper understanding about
• The model language - Ruby
• The host language - Go
Also good for broadening my knowledge
Parser,
Exception handling
Concurrency and Thread-safety
…etc.
Writing Documents,
Managing Tasks,
Fixing Issues,
Reviewing PRs,
Preparing Talks
What would your own version of Ruby look like? (RubyKaigi)
Visions
• It should make users as productive as
possible
• I want it to have great concurrency support
• It can be extended with “existing” resources
Core Values
• Productivity
• Concurrency
• Extensibility
But Goby is just one year old
We don’t have enough statistics about its
concurrency performance
We’re still looking forward to optimize its
concurrency
Core Values
•Productivity
•Extensibility
Core Values
• Productivity
• Extensibility
Extensibility
Ruby and Go both have mature communities
and a lot of resources (libraries)
From https://octoverse.github.com
870k + 285k > 1m
I believe it would be great if we can use
those resources in an easy way
• Plugin Library
• Ruby-like Syntax and Internal Design
Plugin Library
We can call Go’s packages using 100% Goby,
and it’s very easy
Using go packages to ping a database
Generating a plugin
Importing packages and linking functions
Calling function on a plugin
Calling function on a Go’s pointer (or object)
This feature is now supported on both
macOS and Linux
But why being able to call Go libraries is
important for Goby?
Go is one of the most popular languages
for writing high-traffic web applications
I thought Goby should include Go's
concurrency support and libraries for helping
build high-traffic apps
With Goby, you will be able to write high-traffic
applications using Ruby-like syntax and object
system
Ruby Compatible Syntax and Internal Design
What would your own version of Ruby look like? (RubyKaigi)
(from my personal experience on Ruby)
80% of our code are
• Defining classes
• Defining modules
• Defining methods
• Calling methods
So theoretically, if we can provide same syntax
and mechanism for doing above things
Users can easily port most of the Ruby gems
to Goby with a few modifications
Why don't we support Rubygem directly?
We will introduce a library management tool
for Goby’s library in next release
And integrate Go’s dependency management tool
in the future
Productivity
1. Readability
2. Consistency
3. Predictability
1. Readability
How semantical a language is
I think Ruby’s syntax is perfectly semantical
This is why Goby has Ruby compatible syntax 😄
2. Consistency
How many ways can a developer write the
same program
In Ruby, there usually are several ways
Because Ruby is very flexible
But for Goby, I want to let it be less flexible
Because I’m sick of “best practices” or “style guides”
It takes time for community to create them
For individual developers, it also takes time
to learn those practices
Most importantly, developers including me still
need to adjust Rubocop settings by projects!
Let’s take a look at two Ruby “best practice”
examples
Those examples are all from
https://github.com/bbatsov/ruby-style-guide
Good
Bad
Reference: bbatsov/ruby-style-guide
Good
Bad
Reference: bbatsov/ruby-style-guide
Obviously, those two bad practices can be
forbidden on language level
Here’s our feature and plan to make Goby
programs consistent
Having Strict Syntax Rules
Let’s use ‘if’ statement as our example
• No unless keyword
• No inline condition
• Only one way to go
Let’s take a look at our second example
The Parameter’s Order
Why does this matter?
Reference: bbatsov/ruby-style-guide
So in Goby, you need to define different
types of parameters in certain order
1. normal parameters
2. normal parameters with default value
3. keyword parameters
4. keyword parameters with default value
5. splat parameters
1 2 3 4 5
This keeps method definitions consistent
And prevents unexpected behaviors
These two examples explain about how
Goby’s syntax rules are designed
Plan: Official Coding Style and Practices
• Coding Style (indentation, code
alignment...etc.)
• Coding Practices (naming conventions, doc
comment formation...etc.)
We will have these guidances once the
community grows bigger
Plan: Providing Official Formatter and Linter
Because we know programmers are lazy
So we will let users format their code with
only one command
Our goal is to eliminate Rubocop settings and
reduce arguments
3. Predictability
I want to make Goby follow the
“Principle of Least Astonishment”
“In general engineering design contexts, the principle
means that a component of a system should behave
in a way that users expect it to behave; that is,
users should not be astonished by its behavior”
https://en.wikipedia.org/wiki/Principle_of_least_astonishment
In Ruby, some features can sometimes make
it hard to predict the code’s behaviors
For example:
monkey-patching, method_missing…etc
Limiting the Affected Scope
I think Ruby is already using this strategy to
make some features more predictable
Like ‘Refinements’
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
“Refinements are designed to reduce the impact of
monkey patching on other users of the monkey-patched
class. Refinements provide a way to extend a class locally.”
From: http://ruby-doc.org
“Refinements are designed to reduce the impact of monkey
patching on other users of the monkey-patched class.
Refinements provide a way to extend a class locally.”
From: http://ruby-doc.org
Ruby uses refinements to limit the scope of
monkey-patching
And I want to experiment the same idea on
method_missing
So I made method_missing non-inheritable
by default
If you don’t explicitly say you want to use
method_missing, you won’t get unexpected
behaviors
Bar#method_missing
Foo#method_missing
Method Missing In Ruby
Bar.new.foo Bar#method_missing
Foo#method_missing
Bar.new.foo
Method Missing In Goby
Bar#method_missing
Foo#method_missing
Bar.new.foo
In this way, we can prevent unexpected
method_missing behaviors from ancestor
classes or included modules
However
Sometimes we still need method_missing to
be inheritable.
E.g. When ‘Foo’ is an abstract class
Then you can explicitly enable it in every children
classes
And now the method_missing is inherited
Because you need to explicitly enable
inheritance of method_missing
You can always see what class will trigger
method_missing just by looking at its
definition
Exception Handling
What would your own version of Ruby look like? (RubyKaigi)
Imagine you have your own language
Will you give it Ruby’s exception handling
mechanism? Why?
How will your language handle errors?
We tend to not support exception handling in Goby
Because it’s expensive
Also because it creates hidden control-flow paths
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
foo
from_library from_app
x
Rescue
foo
from_library from_app
x
Rescue
Error
foo
from_library from_app
x
Rescue
Error
Error!
foo
from_library from_app
x
Rescue
foo
from_library from_app
x
Rescue
Error
Error!
How should we deal with error if we don’t use
exception handling?
We can use error object
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
It forces you deal with the error from the nearest
place
So what’s our plan?
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
What would your own version of Ruby look like? (RubyKaigi)
This feature is still work in progress, so we’re
looking forward to receive any feedback
And if I had a chance, I’d be glad to share the
result with you in next year’s Kaigi
To Summarize
We tend to make Goby have strict syntax rules,
and provide official coding guidance
This way, developers can collaborate with each
other more easily and reduce arguments
• To limit the method_missing’s affecting
scope
• But can be enabled explicitly
Forbidding method_missing’s inheritance by default
• Treat errors as values
• Avoid checking error with ‘if’ statement
Developing a new class to help handling errors
• Treat errors as values
• Avoid checking error with ‘if’ statement
Developing a new class to help handling errors
Useful resources
• “Writing An Interpreter In Go” - https://interpreterbook.com
• “From NAND to Tetris - part 2” - http://nand2tetris.org
• “Ruby Under a Microscope” - http://patshaughnessy.net/ruby-
under-a-microscope
We are looking for more
people to join us
Join us plz
• GitHub: https://github.com/goby-lang/goby
• Slack: https://goby-lang-
slackin.herokuapp.com
• Official Site: http://goby-lang.org
• Twitter: https://twitter.com/goby_lang
Thanks for you listening

More Related Content

PDF
What would your own version of Ruby look like?
PDF
Automating boring and repetitive UbuCon Asia video and subtitle stuffs
KEY
Ruby On Rails Overview
PDF
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
PPTX
C# .NET - Um overview da linguagem
PDF
Python overview
PDF
Engaging new l10n contributors through Open Source Contributhon
PPTX
C c#
What would your own version of Ruby look like?
Automating boring and repetitive UbuCon Asia video and subtitle stuffs
Ruby On Rails Overview
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
C# .NET - Um overview da linguagem
Python overview
Engaging new l10n contributors through Open Source Contributhon
C c#

Similar to What would your own version of Ruby look like? (RubyKaigi) (20)

PDF
Metaprogramming in Ruby
PDF
Ruby training day1
PPTX
Ruby -the wheel Technology
PDF
The details of CI/CD environment for Ruby
ODP
PDF
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
PPTX
Day 1 - Intro to Ruby
PDF
How To Think In Go
PDF
Ruby tutorial
PDF
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
PDF
RubyConf Portugal 2014 - Why ruby must go!
PDF
Rubinius - A Tool of the Future
KEY
Intro to Ruby (and RSpec)
ZIP
Meta Programming in Ruby - Code Camp 2010
PDF
How to Begin to Develop Ruby Core
KEY
Introducing Ruby
PDF
Introduction to Ruby
KEY
Rubyspec y el largo camino hacia Ruby 1.9
KEY
Ruby codebases in an entropic universe
PPTX
Metaprogramming in Ruby
Ruby training day1
Ruby -the wheel Technology
The details of CI/CD environment for Ruby
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
Day 1 - Intro to Ruby
How To Think In Go
Ruby tutorial
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
RubyConf Portugal 2014 - Why ruby must go!
Rubinius - A Tool of the Future
Intro to Ruby (and RSpec)
Meta Programming in Ruby - Code Camp 2010
How to Begin to Develop Ruby Core
Introducing Ruby
Introduction to Ruby
Rubyspec y el largo camino hacia Ruby 1.9
Ruby codebases in an entropic universe
Ad

Recently uploaded (20)

PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPT
Introduction Database Management System for Course Database
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
System and Network Administraation Chapter 3
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
assetexplorer- product-overview - presentation
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
ai tools demonstartion for schools and inter college
PDF
Nekopoi APK 2025 free lastest update
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Digital Systems & Binary Numbers (comprehensive )
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Introduction Database Management System for Course Database
CHAPTER 2 - PM Management and IT Context
System and Network Administraation Chapter 3
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PTS Company Brochure 2025 (1).pdf.......
wealthsignaloriginal-com-DS-text-... (1).pdf
top salesforce developer skills in 2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Softaken Excel to vCard Converter Software.pdf
assetexplorer- product-overview - presentation
Wondershare Filmora 15 Crack With Activation Key [2025
ai tools demonstartion for schools and inter college
Nekopoi APK 2025 free lastest update
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Ad

What would your own version of Ruby look like? (RubyKaigi)