1
4
Ruby 3.4.4 Released (www.ruby-lang.org)
submitted 1 month ago by [email protected] to c/[email protected]
2
10
submitted 1 month ago by [email protected] to c/[email protected]

I wasn't able to find any up-to-date information about tail call optimization support in Ruby, so I decided to post this hoping that it will pop up next time someone might also be searching for this topic...

What I was able to figure out is that TCO can be enabled in Ruby 3.4 via a compile option like so:

RubyVM::InstructionSequence.compile_option = {tailcall_optimization: true}

def tailSumUntil(n, m)
  n == 0 ? m : tailSumUntil(n - 1, n + m)
end

tailSumUntil(100_000_000, 0)
# => 5000000050000000
3
2
submitted 1 month ago by [email protected] to c/[email protected]
4
5
submitted 2 months ago by [email protected] to c/[email protected]
5
6
submitted 2 months ago by [email protected] to c/[email protected]
6
8
Ruby 3.4.1 Released (www.ruby-lang.org)
submitted 5 months ago by [email protected] to c/[email protected]
7
11
Ruby 3.4.0 Released (www.ruby-lang.org)
submitted 5 months ago* (last edited 5 months ago) by [email protected] to c/[email protected]
8
6
submitted 6 months ago by [email protected] to c/[email protected]

Hi
What is Primitive in the MRI context?

Why did a lot of things get rewritten into Primitive?
Is there some official documentation about it?

9
4
submitted 8 months ago by [email protected] to c/[email protected]
10
2
Ruby 3.4.0 preview2 Released (www.ruby-lang.org)
submitted 8 months ago by [email protected] to c/[email protected]
11
5
Ruby 3.3.5 Released (www.ruby-lang.org)
submitted 9 months ago by [email protected] to c/[email protected]
12
4
submitted 9 months ago by [email protected] to c/[email protected]
13
5
submitted 9 months ago by [email protected] to c/[email protected]
14
8
submitted 10 months ago by [email protected] to c/[email protected]
15
3
submitted 10 months ago by [email protected] to c/[email protected]
16
7
submitted 10 months ago by [email protected] to c/[email protected]
17
6
submitted 10 months ago* (last edited 10 months ago) by [email protected] to c/[email protected]
18
7
submitted 10 months ago* (last edited 10 months ago) by [email protected] to c/[email protected]
19
9
Ruby 3.2.5 Released (www.ruby-lang.org)
submitted 10 months ago by [email protected] to c/[email protected]
20
8
Ruby 3.3.4 Released (www.ruby-lang.org)
submitted 11 months ago by [email protected] to c/[email protected]
21
10
submitted 1 year ago by [email protected] to c/[email protected]
22
16
submitted 1 year ago by [email protected] to c/[email protected]

I saw a project a couple weeks back which allows writing and running Crystal methods inline inside a Ruby file. It’s a neat project, and I don’t want to take away from it but something in the README example looked off to me. require 'crystalruby' require 'benchmark' module Fibonnaci crystalize [n:

23
7
submitted 1 year ago by [email protected] to c/[email protected]
24
9
submitted 1 year ago by [email protected] to c/[email protected]

The Neonify challenge on Hack The Box is a small Sinatra(a Ruby web framework) app, that generates a glowing text of the submitted value:

25
15
submitted 1 year ago by [email protected] to c/[email protected]

All new applications using Rails 8 will have rubocop gem by default.

view more: next ›

Ruby

622 readers
1 users here now

A community for discussion and news about Ruby programming.

Learning Ruby?

Tools

Documentation

Books

Screencasts

News and updates

founded 2 years ago
MODERATORS