Ruby 3.0.0 Preview 1 Released

27 days ago - Direct link

We are pleased to announce the release of Ruby 3.0.0-preview1.

It introduces a number of new features and performance improvements.

RBS

RBS is a language to describe the types of Ruby programs.
Type checkers including type-profiler and other tools supporting RBS will understand Ruby programs much better with RBS definitions.

You can write down the definition of classes and modules: methods defined in the class, instance variables and their types, and inheritance/mix-in relations.
The goal of RBS is to support commonly seen patterns in Ruby programs and it allows writing advanced types including union types, method overloading, and generics. It also supports duck typing with interface types.

Ruby 3.0 ships with rbs gem, which allows parsing and processing type definitions written in RBS.

The following is a small example of RBS.

module ChatApp

VERSION: String

class Channel
attr_reader name: String
attr_reader messages: Array[Message]
attr_reader users: Array[User | Bot] # `|` means union types, `User` or `Bot`.

def initialize: (String) -> void

def post: (String, from: User | Bot) -> Message # Method overloading is supported.
| (File, from: User | Bot) -> Message
end
end

See README of rbs gem for more detail.

Ractor (experimental)

Ractor is an Actor-model like concurrent abstraction designed to provide a parallel execution feature without thread-safety concerns.

You can make multiple ractors and you can run them in parallel. Ractor enables to make thread-safe parallel progr...


Go to article →

Links in this thread

ruby/rbs
Type Signature for Ruby. Contribute to ruby/rbs development by creating an account on GitHub.


ruby/ruby
The Ruby Programming Language [mirror]. Contribute to ruby/ruby development by creating an account on GitHub.


Scheduler implementation by ioquatix · Pull Request #56 · socketry/async
This is a prototype of the scheduler which uses the interface provided by ruby/ruby#3032 At the present time, the scheduler is an optional set of hooks for implementing non-blocking IO. However, in the future, the scheduler might form the core of the reactor, replacing the selector entirely.


ruby/ruby
The Ruby Programming Language [mirror]. Contribute to ruby/ruby development by creating an account on GitHub.


Separation of positional and keyword arguments in Ruby 3.0
In Ruby 3.0, positional arguments and keyword arguments will be separated. Ruby 2.7 will warn for behaviors that will change in Ruby 3.0. If you see the following warnings, you need to update your code:


Build software better, together
GitHub is where people build software. More than 50 million people use GitHub to discover, fork, and contribute to over 100 million projects.


ruby/ruby
The Ruby Programming Language [mirror]. Contribute to ruby/ruby development by creating an account on GitHub.


https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-preview1.tar.bz2


https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-preview1.tar.gz


https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-preview1.tar.xz


https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-preview1.zip


mame/ruby-type-profiler
An experimental type-level Ruby interpreter for testing and understanding Ruby code - mame/ruby-type-profiler


Ruby 3.0.0 Preview 1 Released
RBS is a language to describe the types of Ruby programs. Type checkers including type-profiler and other tools supporting RBS will understand Ruby programs much better with RBS definitions.


Ruby 3.0 Preview 1 | Hacker News
- Ractor: Wohooo! I'm writing a DAG library where I was thinking of implementing something like this, good to know I can use it and get real parallelism on top.