Can we consider allowing sleep(nil) and sleep(false) to be the same as sleep() to simplify this behaviour?
Otherwise, it's hard to proxy (e.g. fiber scheduler, or even just a plain old variable argument).
e.g.
classSleeperdefinitialize(time=nil)@time=timeenddefsleepKernel::sleep(@time)# Hard to get the behaviour of `sleep()` here without explicitly handling/checking.endend
Haha, great, but I think it's odd you can't just write sleep(nil). I guess Ruby uses Qundef internally, but user can't write sleep(undef), but sleep(*nil) is close. Actually, I didn't even know you can write sleep(*nil) to get that behaviour, so I think it's not a good solution in general, it's too obscure.
Mutex#sleep accepts an explicit nil argument and it's documented.
+1, this inconsistency is rather weird (and rather messy to implement in TruffleRuby).
I don't know about false though, that's can't convert FalseClass into time interval (TypeError) for both sleep methods which seems fair.