General

Profile

sos4nt (Stefan Schüßler)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 7 17 24

Activity

04/19/2022

02:42 PM Ruby Bug #18743 (Closed): Enumerator#next / peek re-use each others stacktraces
I encountered an odd behavior.
If I rescue the `StopIteration` exception from `peek` and call `next` afterwards: (or vice-versa)
```ruby
# enum.rb # 1
# 2
enum = [].each # 3
enum.peek re...
sos4nt (Stefan Schüßler)

06/10/2020

10:00 AM Ruby Feature #16946 (Open): Add an `intersperse` method
Haskell has an `intersperse` function which adds a separator between elements of a list.
It would be pretty useful to have such method(s) in Ruby, too.
Examples for `Array` and `String`:
```ruby
[1, 2, 3].intersperse(0)
#=> [1, ...
sos4nt (Stefan Schüßler)

03/24/2020

02:24 PM Ruby Bug #16737 (Closed): File::BINARY doesn't work
`File.open` takes a `mode` argument which can be given as a string or as an integer using `File::Constants`.
When using the latter, the constant `File::BINARY` doesn't have any effect:
```ruby
# this works:
File.open('foo', 'wb')...
sos4nt (Stefan Schüßler)

05/24/2019

09:08 AM Ruby Bug #15872 (Rejected): CSV.parse omits close call when block is given – intended or bug?
The current implementation of `CSV.parse` doesn't call `close` when a block is given:
```ruby
def self.parse(*args, &block)
csv = new(*args)
return csv.each(&block) if block_given?
begin
csv.read
ensure
csv.cl...
sos4nt (Stefan Schüßler)

05/15/2019

08:26 AM Ruby Feature #15848: Silence warning when conditional assignments are wrapped in parentheses
nobu (Nobuyoshi Nakada) wrote:
> No, it doesn't.
> ...
It didn't occur to me the warning is aware of that. I should have tested with the actual example code. Thanks for the clarification nobu!
And thanks for closing it as a duplicat...
sos4nt (Stefan Schüßler)

05/14/2019

10:35 AM Ruby Feature #15848: Silence warning when conditional assignments are wrapped in parentheses
shevegen (Robert A. Heiler) wrote:
> I can't think of a simple way to controls warnings though :( - I guess if we may have some
> ...
A per-file setting is too broad. Given:
```ruby
if (a = foo)
do_this if a == x
do_that if a =...
sos4nt (Stefan Schüßler)
09:08 AM Ruby Feature #15848: Silence warning when conditional assignments are wrapped in parentheses
sawa (Tsuyoshi Sawada) wrote:
> Why do the parentheses indicate that assignment is intended, and not comparison?
It's a convention used in C compilers. The explicit optional parentheses are seen as a hint that this is what the develo...
sos4nt (Stefan Schüßler)
07:51 AM Ruby Feature #15848 (Rejected): Silence warning when conditional assignments are wrapped in parentheses
Sometime it's convenient to have an assignment in an `if`-condition. The Ruby documentation even contains an example showing this *"most common use of side-effect"* practice:
http://ruby-doc.org/core-2.6.3/doc/syntax/control_expressio...
sos4nt (Stefan Schüßler)

03/22/2019

07:22 PM Ruby Misc #15723: Reconsider numbered parameters
@matz wrote:
> I am not fully satisfied with the beauty of the code with numbered parameters, so I call it a compromise.
@shevegen wrote:
> ...
Sorry, but it sounds like the new feature is an ugly compromise ...
I learned Ruby – ...
sos4nt (Stefan Schüßler)
01:11 PM Ruby Feature #4475: default variable name for parameter
Since this ticket is closed, I've opened a new one to express my concerns:
https://bugs.ruby-lang.org/issues/15723
sos4nt (Stefan Schüßler)

Also available in: Atom