From: "ioquatix (Samuel Williams)" Date: 2022-10-31T05:01:04+00:00 Subject: [ruby-core:110554] [Ruby master Bug#19094] `sleep(nil)` vs `sleep()` and replicating the default implementation. Issue #19094 has been reported by ioquatix (Samuel Williams). ---------------------------------------- Bug #19094: `sleep(nil)` vs `sleep()` and replicating the default implementation. https://bugs.ruby-lang.org/issues/19094 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- ``` > sleep(nil) (irb):1:in `sleep': can't convert NilClass into time interval (TypeError) ``` However, I feel that this makes implementing a compatible sleep method a little difficult. ```ruby def sleep(time = nil) if time sleep_some(time) else sleep_forever end end ``` Can we consider allowing `sleep(nil)` and `sleep(false)` to be the same as `sleep()` to simplify this behaviour? -- https://bugs.ruby-lang.org/ Unsubscribe: