This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
Leo pointed out that C++20’s std::chrono overloads the `/` operator to provide date creation syntax. Surely Ruby can do better? ``` >> module ISO8601 Month = Data.define(:y, :m) { def -(d) = Date.new(y, m, d) } refine(Integer) { def -(m) = Month.new(self, m) } end >> using ISO8601 >> 2025-12-29 => #<Date: 2025-12-29 ((2461039j,0s,0n),+0s,2299161j)> ```
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.