Skip to content

Fix syntax highlighted code blocks in lists (en) #2536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions en/news/_posts/2020-09-25-ruby-3-0-0-preview1-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Ruby 3.0 ships with `rbs` gem, which allows parsing and processing type definiti

The following is a small example of RBS.

{% highlight rbs %}
``` rbs
module ChatApp
VERSION: String

Expand All @@ -38,7 +38,7 @@ module ChatApp
| (File, from: User | Bot) -> Message
end
end
{% endhighlight %}
```

See [README of rbs gem](https://github.com/ruby/rbs) for more detail.

Expand All @@ -54,7 +54,7 @@ The specification and implmentation are not matured and changed in future, so th

The following small program calculates `prime?` in parallel with two ractors and about x2 times faster with two or more cores than sequential program.

{% highlight ruby %}
``` ruby
require 'prime'

# n.prime? with sent integers in r1, r2 run in parallel
Expand All @@ -72,7 +72,7 @@ r2.send 2**61 + 15
# wait for the results of expr1, expr2
p r1.take #=> true
p r2.take #=> true
{% endhighlight %}
```

see [doc/ractor.md](https://github.com/ruby/ruby/blob/master/doc/ractor.md) for more detail.

Expand All @@ -99,32 +99,36 @@ Currently, there is a test scheduler available in [`Async::Scheduler`](https://g
## Other Notable New Features

* Rightward assignment statement is added.
{% highlight ruby %}

``` ruby
fib(10) => x
p x #=> 55
{% endhighlight %}
```

* Endless method definition is added.
{% highlight ruby %}

``` ruby
def square(x) = x * x
{% endhighlight %}
```

* Find pattern is added.
{% highlight ruby %}

``` ruby
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c"
p post #=> [2, "d", "e", "f", 3]
end
{% endhighlight %}
```

* `Hash#except` is now built-in.
{% highlight ruby %}

``` ruby
h = { a: 1, b: 2, c: 3 }
p h.except(:a) #=> {:b=>2, :c=>3}
{% endhighlight %}
```

* Memory view is added as an experimental feature

Expand All @@ -139,11 +143,12 @@ Currently, there is a test scheduler available in [`Async::Scheduler`](https://g
* Keyword arguments are separated from other arguments.
* In principle, code that prints a warning on Ruby 2.7 won't work. See the [document](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) in detail.
* By the way, arguments forwarding now supports leading arguments.
{% highlight ruby %}

``` ruby
def method_missing(meth, ...)
send(:"do_#{ meth }", ...)
end
{% endhighlight %}
```

* The feature of `$SAFE` was completely removed; now it is a normal global variable.

Expand Down