[#99868] [Ruby master Bug#17144] Tempfile.open { ... } does not unlink the file — eregontp@...
Issue #17144 has been reported by Eregon (Benoit Daloze).
15 messages
2020/09/03
[ruby-core:100187] [Ruby master Feature#17195] Freeze Enumerator::ArithmeticSequence objects
From:
eregontp@...
Date:
2020-09-27 10:05:13 UTC
List:
ruby-core #100187
Issue #17195 has been updated by Eregon (Benoit Daloze). I just realized, this is problematic because `Enumerator::ArithmeticSequence` is a subclass of `Enumerator` and not of `Range`. If it was a subclass of Range then I think it would be fine to freeze it. But since it subclasses Enumerator, it has mutably methods like `Enumerator#next`: ```ruby [7] pry(main)> enum = (1..5).step(2) => ((1..5).step(2)) [8] pry(main)> enum.next => 1 [9] pry(main)> enum.next => 3 [10] pry(main)> enum.next => 5 [11] pry(main)> enum.next StopIteration: iteration reached an end from (pry):11:in `next' ``` @mrkn do you remember why ArithmeticSequence is an Enumerator subclass and not a Range subclass? ---------------------------------------- Feature #17195: Freeze Enumerator::ArithmeticSequence objects https://bugs.ruby-lang.org/issues/17195#change-87758 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal ---------------------------------------- Now, all Ranges are frozen (#15504). Enumerator::ArithmeticSequence is very similar to Range, just with an extra `step`. They're essentially already immutable, except that one could use set instance variables, but it seems of little use. So, should we make Enumerator::ArithmeticSequence frozen too? -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>