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
What would your own version of Ruby look like?
What would your own version of Ruby look like?
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
• It has built-in libraries required for writing web
applications
• You can already write simple web applications
Project Status
• More than 2600 stars
• 4~6 regular contributors
• 40+ slack members
• https://goby-lang-slackin.herokuapp.com
Built-in test framework
Official Documents
http://goby-lang.org
Editor Plugins
How does it feel to have my own language
It feels quite heavy
I have lots things to learn
Go,
Parser,
Concurrency and Thread-safety
…etc.
I also have lots things to plan
Next release,
Next 3 months,
Next year
Besides these, I have more things to do
Writing Documents,
Managing Tasks,
Fixing Issues,
Reviewing PRs,
Preparing Talks
What would your own version of Ruby look like?
But on the other hand, I also gained a lot
from developing Goby
I can meet some brilliant engineers
It feels great when people recognize your
work
I can apply my ideas on the language
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?
(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
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
• Readability
• Consistency
• Predictability
Readability
How semantical a language is
I think Ruby’s syntax is perfectly semantical
This is why Goby has Ruby compatible syntax 😄
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
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
Goby’s two approaches to be more
‘predictable’
Limiting the Affected Scope
And
Making the Target Explicit
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?
What would your own version of Ruby look like?
What would your own version of Ruby look like?
What would your own version of Ruby look like?
What would your own version of Ruby look like?
“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
I want to make 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
Making the Target Explicit
‘Super’ With Explicit Target
Actually, I want to replace ‘super’ with
‘super_from’
super super_from
The only difference will be that you need to
specify your 'super' target in the first
argument
super super_from
This has two benefits
You can easily understand where to find the
‘super’ed method
I will explain the origin of this idea using my
personal experiences
One day I was trying to find a super’s source
from our codebase’s monkey-patching
I think it might refer to another module
in ActiveRecord
So I checked the source code, and found this
What would your own version of Ruby look like?
What would your own version of Ruby look like?
I found that ActiveRecord includes 30+
modules
And none of them implement the ‘to_json’
method
It turns out the 'super' refers to
ActiveSupport::ToJsonWithActiveSupportEncoder
So I was thinking
It would be great if the ‘super' can just tell us
where it refers to
Like this
It will be a little verbose
But also makes it far more easier to predict
the code’s behaviors
The freedom to specify any ancestors as
source
What would your own version of Ruby look like?
What would your own version of Ruby look like?
These two features will be implemented in
Goby in next few months
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
• To force users to specify super’s source
• Also allows users to choose source
Use ‘super_from' to replace ‘super’
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? (RubyKaigi)
PDF
Realtime Apps with Django
KEY
CommonJS via PINF JavaScript Loader - Introduction
PDF
Metaprogramming in Ruby
PPTX
Ruby -the wheel Technology
PDF
How to Begin to Develop Ruby Core
PDF
Ruby training day1
PDF
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
What would your own version of Ruby look like? (RubyKaigi)
Realtime Apps with Django
CommonJS via PINF JavaScript Loader - Introduction
Metaprogramming in Ruby
Ruby -the wheel Technology
How to Begin to Develop Ruby Core
Ruby training day1
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...

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

PPTX
Day 1 - Intro to Ruby
PDF
The details of CI/CD environment for Ruby
KEY
Intro to Ruby (and RSpec)
ODP
ZIP
Meta Programming in Ruby - Code Camp 2010
PDF
Practical Testing of Ruby Core
KEY
An introduction to Ruby
PDF
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
PPT
Rubyforjavaprogrammers 1210167973516759-9
PPT
Rubyforjavaprogrammers 1210167973516759-9
PDF
Introduction to Ruby
PDF
Write your Ruby in Style
KEY
Introducing Ruby
PDF
Ruby tutorial
KEY
Rubyspec y el largo camino hacia Ruby 1.9
PPTX
Ruby from zero to hero
PDF
Funtional Ruby - Mikhail Bortnyk
PDF
Functional Ruby
PDF
An introduction and future of Ruby coverage library
PDF
Ruby seen from a C# developer
Day 1 - Intro to Ruby
The details of CI/CD environment for Ruby
Intro to Ruby (and RSpec)
Meta Programming in Ruby - Code Camp 2010
Practical Testing of Ruby Core
An introduction to Ruby
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Rubyforjavaprogrammers 1210167973516759-9
Rubyforjavaprogrammers 1210167973516759-9
Introduction to Ruby
Write your Ruby in Style
Introducing Ruby
Ruby tutorial
Rubyspec y el largo camino hacia Ruby 1.9
Ruby from zero to hero
Funtional Ruby - Mikhail Bortnyk
Functional Ruby
An introduction and future of Ruby coverage library
Ruby seen from a C# developer
Ad

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
assetexplorer- product-overview - presentation
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Introduction to Artificial Intelligence
PPTX
ai tools demonstartion for schools and inter college
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Transform Your Business with a Software ERP System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
L1 - Introduction to python Backend.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Reimagine Home Health with the Power of Agentic AI​
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
assetexplorer- product-overview - presentation
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Introduction to Artificial Intelligence
ai tools demonstartion for schools and inter college
wealthsignaloriginal-com-DS-text-... (1).pdf
Computer Software and OS of computer science of grade 11.pptx
Design an Analysis of Algorithms II-SECS-1021-03
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms I-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Understanding Forklifts - TECH EHS Solution
Transform Your Business with a Software ERP System
How to Migrate SBCGlobal Email to Yahoo Easily
L1 - Introduction to python Backend.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Reimagine Home Health with the Power of Agentic AI​
Ad

What would your own version of Ruby look like?