Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enumerator's Yielder does not pass through one-elt array properly #4108

Closed
headius opened this issue Aug 24, 2016 · 4 comments
Closed

Enumerator's Yielder does not pass through one-elt array properly #4108

headius opened this issue Aug 24, 2016 · 4 comments

Comments

@headius
Copy link
Member

headius commented Aug 24, 2016

This is the continuation of #3814.

See the discussion there for the long form.

Short form, the following script should produce the given result. Two fail as shown by specs in #3814, and one works currently but may be the incorrect fix (#2458).

class Enumerator::Yielder
    def yield(*args)
      @proc.call(*args)
    end
end

module Enumerable
  def first
    val = nil
    catch(:foo) do
      each do |x|
        val = x
        throw :foo
      end
    end
    val
  end
end

p Enumerator.new {|y| y.yield([1])}.to_a
p Enumerator.new {|y| y << [1]}.to_a
p Enumerator.new {|y| y.yield([1])}.map {|e| e}.to_a
p Enumerator.new {|y| y.yield([1])}.lazy.map {|e| e}.to_a
p Enumerator.new {|y| y.yield [1]}.first
$ jruby blah.rb
[[1]]
[[1]]
[[1]]
[[1]]
[1]
@glebm
Copy link
Contributor

glebm commented Nov 12, 2018

I think one of these Enumerable issues prevents sassc and sassc-rails from working on JRuby (wrong number of arguments (1 for 3)), while the Ruby version of Sass is deprecated and EOL next March.

@enebo enebo modified the milestones: JRuby 9.2.4.0, JRuby 9.2.5.0 Nov 13, 2018
@headius
Copy link
Member Author

headius commented Nov 20, 2018

Well, I'm thrilled to see that the native replacement for sass is going to be FFI around libsass! We should prioritize getting this fixed in 9.3 or a 9.2 update by early next year.

@headius
Copy link
Member Author

headius commented Nov 20, 2018

@glebm Can you give us a reproduction of that error?

@headius
Copy link
Member Author

headius commented Nov 20, 2018

@glebm Oh I just noticed sass/sassc-rails#92 👍

@enebo enebo modified the milestones: JRuby 9.2.5.0, JRuby 9.2.6.0 Dec 6, 2018
@enebo enebo modified the milestones: JRuby 9.2.6.0, JRuby 9.2.7.0 Dec 19, 2018
@enebo enebo modified the milestones: JRuby 9.2.7.0, JRuby 9.2.8.0 Jan 9, 2019
kares added a commit that referenced this issue Aug 2, 2019
also from comments GH-3814 which are now passing

`Enumerator.new { |y| y.yield([1]) }.lazy.map { |e| e }.to_a`
seems to be left not working as in MRI
@enebo enebo closed this as completed Aug 6, 2019
Adithya-copart pushed a commit to Adithya-copart/jruby that referenced this issue Aug 25, 2019
also from comments jrubyGH-3814 which are now passing

`Enumerator.new { |y| y.yield([1]) }.lazy.map { |e| e }.to_a`
seems to be left not working as in MRI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants