General

Profile

owst (Owen Stephens)

  • Login: owst
  • Registered on: 02/20/2017
  • Last sign in: 07/11/2018

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 2 3

Activity

08/03/2018

10:52 AM Ruby Feature #14473: Add Range#subrange?
Great, thank you tarui owst (Owen Stephens)

08/01/2018

11:41 PM Ruby Feature #14473: Add Range#subrange?
I agree that the max performance issue is likely to be a rare case; I am happy to leave it as-is.
Apologies on the second issue - I originally misunderstood "ignore" to mean "don't rescue".
I've attached another updated patch - it ...
owst (Owen Stephens)

07/31/2018

12:29 AM Ruby Feature #14473: Add Range#subrange?
Hi tarui, thank you for reviewing and your suggestion/question.
In fact, with my v4 patch in the case you describe there is a bug: `(1..3).cover?(1.0...4.0)` is `true` not `false`. This is prevented using `b >= (c...d).max` as you su...
owst (Owen Stephens)

07/19/2018

12:03 AM Ruby Feature #14473: Add Range#subrange?
Thank you for your proposal Matz, having thought about it over the last few months, I agree.
I have updated my patch accordingly (which has greatly simplified/improved it), I welcome any comments.
owst (Owen Stephens)

05/19/2018

09:22 AM Ruby Feature #14777 (Open): Add Range#offset ?
Hi,
As mentioned in https://bugs.ruby-lang.org/issues/14473#note-17 an addition to Range that we find useful is an `Range#offset(n)` method that adds (or subtracts) `n` to the range, for example:
~~~ruby
(1..10).offset(2) # => (...
owst (Owen Stephens)

05/17/2018

02:02 PM Ruby Feature #14473: Add Range#subrange?
Hi Matz!
A slightly contrived example - imagine we want to filter candidates for a new job position and harshly reject any who have a salary requirement that is not covered by our predetermined position salary range:
~~~ruby
Candi...
owst (Owen Stephens)

03/25/2018

03:56 PM Ruby Feature #14473: Add Range#subrange?
I've attached an updated patch; it includes the renamed (by `s/set/range/`) methods and a performance improvement for `strict_subset?` (before, we would calculate `max` on the receiver twice, which is potentially slow when the receiver ... owst (Owen Stephens)

03/17/2018

10:32 PM Ruby Feature #14473: Add Range#subrange?
Are there any further thoughts on my latest patch? Based on the discussion above, I think I should rename the added methods: `s/set/range/` and perhaps also prevent the "bad performance" cases where either range has `exclude_end?` true a... owst (Owen Stephens)

02/23/2018

05:53 PM Ruby Feature #14473: Add Range#subrange?
Good point v.ox, I did consider implementing `subset?` as an overloading of `include?` (or possibly `cover?` ?), as one can't have a range-of-ranges (so there is no ambiguity).
How would you distinguish between strict/non-strict - a `...
owst (Owen Stephens)
05:43 PM Ruby Feature #14473: Add Range#subrange?
Thanks for your thoughts al2o3cr, your "bigger point" is interesting:
> So range_1 claims to be a subset of range_2, but no elements of range_2 are included in range_1.
My thinking here was that the empty set is a subset of all set...
owst (Owen Stephens)

Also available in: Atom