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

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

PDF
Cucumber in Practice(en)
Kyosuke MOROHASHI
 
PPTX
Introduction to go lang
Amal Mohan N
 
PDF
Search-Driven Programming
Ethan Herdrick
 
PDF
Golang
Saray Chak
 
PPTX
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
PPTX
Ruby And Ruby On Rails
AkNirojan
 
PDF
Introduction to Go
zhubert
 
PDF
Ruby tutorial
knoppix
 
PPT
A First Look at Google's Go Programming Language
Ganesh Samarthyam
 
PPT
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
PPTX
On the path to become a jr. developer short version
Antonelo Schoepf
 
PDF
welcome to gopherlabs - why go (golang)?
sangam biradar
 
PPT
Intro To Ror
myuser
 
PDF
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
PDF
Why use Go for web development?
Weng Wei
 
PDF
Ruby Metaprogramming - OSCON 2008
Brian Sam-Bodden
 
PPTX
Go for Rubyists. August 2018. RUG-B Meetup
Kirill Zonov
 
PDF
RubyMotion Inspect Conference - 2013. (With speaker notes.)
alloy020
 
PDF
Beyond the Hype: 4 Years of Go in Production
C4Media
 
PDF
Vim 讓你寫 Ruby 的速度飛起來
Chris Houng
 
Cucumber in Practice(en)
Kyosuke MOROHASHI
 
Introduction to go lang
Amal Mohan N
 
Search-Driven Programming
Ethan Herdrick
 
Golang
Saray Chak
 
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Ruby And Ruby On Rails
AkNirojan
 
Introduction to Go
zhubert
 
Ruby tutorial
knoppix
 
A First Look at Google's Go Programming Language
Ganesh Samarthyam
 
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
On the path to become a jr. developer short version
Antonelo Schoepf
 
welcome to gopherlabs - why go (golang)?
sangam biradar
 
Intro To Ror
myuser
 
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
Why use Go for web development?
Weng Wei
 
Ruby Metaprogramming - OSCON 2008
Brian Sam-Bodden
 
Go for Rubyists. August 2018. RUG-B Meetup
Kirill Zonov
 
RubyMotion Inspect Conference - 2013. (With speaker notes.)
alloy020
 
Beyond the Hype: 4 Years of Go in Production
C4Media
 
Vim 讓你寫 Ruby 的速度飛起來
Chris Houng
 

Recently uploaded (20)

PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 
PPTX
iaas vs paas vs saas :choosing your cloud strategy
CloudlayaTechnology
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PDF
Best Web development company in india 2025
Greenusys
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
PDF
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
PDF
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 
iaas vs paas vs saas :choosing your cloud strategy
CloudlayaTechnology
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Best Web development company in india 2025
Greenusys
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
Latest Capcut Pro 5.9.0 Crack Version For PC {Fully 2025
utfefguu
 
Ready Layer One: Intro to the Model Context Protocol
mmckenna1
 
Ad

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