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

Need Ruby 2.2 specs #3264

Closed
YorickPeterse opened this issue Jan 1, 2015 · 10 comments

Comments

Projects
None yet
3 participants
@YorickPeterse
Copy link
Member

commented Jan 1, 2015

Pulled from the NEWS file

  • nil/true/false
    • nil/true/false objects are frozen - spec: 0d0d809 & implementation: 6580956
  • Binding
  • Dir
  • Enumerable
    • New methods:
    • Extended methods:
      • min (supports optional argument to return multiple elements) - spec: 47f8941 & implementation: #3420
      • min_by (supports optional argument to return multiple elements) - spec: 56cd372, 17f2186 & implementation: #3420
      • max (supports optional argument to return multiple elements) - spec: ef33baf & implementation: #3420
      • max_by (supports optional argument to return multiple elements) - spec: a8d91ea, 17f2186 & implementation: #3420
  • Float
  • File
  • File::Stat
    • New methods:
  • Kernel
    • New methods:
    • Improvements
      • Kernel#throw raises UncaughtThrowError, subclass of ArgumentError when
        there is no corresponding catch block, instead of ArgumentError. - spec: 89072db & implementation: 697d168
  • Process
    • Extended method:
      • Process execution methods such as Process.spawn opens the file in write mode for redirect from [:out, :err].
      • Process creation methods, such as spawn(), uses vfork() system call. vfork() is faster than fork() when the parent process uses huge memory.
  • String
    • New methods:
      • String#unicode_normalize
      • String#unicode_normalize!
      • String#unicode_normalized?
  • Symbol
    • Add syntax for { "abc": 123 } Moved to #3600
    • Improvements
      • Most symbols which are returned by String#to_sym and String#intern are GC-able. Moved to #3599
      • To spec GC'd Symbol, a possible spec uses ObjectSpace.each_object(Symbol)
  • Method
    • New methods:
      • Method#curry([arity]) returns a curried Proc. - spec: 0bc0390 & implementation: 6304e7d
      • Method#super_method returns a Method of superclass, which would be called when super is used. - spec: 4d34db2
@tak1n

This comment has been minimized.

Copy link
Member

commented May 27, 2015

@nirvdrum mentioned following in #3401 :

"It looks like in MRI 2.2+, nil is now frozen. I looked at making things match, but it creates problems in common/kernel.rb:175. If nil is frozen, that line prevents extending it with a module, but that should be allowed. I think it can be safely removed, since object_extend should catch any issues. But I'd appreciate feedback from someone more familiar with things before proceeding."

@chuckremes

This comment has been minimized.

Copy link
Member

commented Oct 14, 2015

The "nil/true/false" objects are frozen spec and implementation are done. There is also a side effect as mentioned by @tak1n above where methods can be added to those three objects even though they are frozen. That has also been implemented by a2d76f5 so no need to work on those anymore.

@YorickPeterse

This comment has been minimized.

Copy link
Member Author

commented Jan 22, 2016

I cleaned up https://github.com/rubysl/rubysl-unicode_normalize a bit (license wise and such), pushed it to RubyGems and updated the rubysl Gem to depend on it. In 7489a07 I made sure we're actually shipping these changes.

@brixen The unicode normalization code is loaded by default on MRI. Do we have a proper way to load a Gem during bootup? I suspect just dumping a require in the kernel code could break things.

@YorickPeterse

This comment has been minimized.

Copy link
Member Author

commented Jan 22, 2016

@tak1n In 008cd1e you added specs for redirecting output for Process.spawn. These specs currently seem to pass, are they related to the Process.spawn changes mentioned in the release notes?

@tak1n

This comment has been minimized.

Copy link
Member

commented Jan 22, 2016

@YorickPeterse I don't remember it exactly anymore, I'll take a closer look on it what exactly changed on MRI side and see if our behaviour currently is the same and the spec is ensuring this.

@tak1n

This comment has been minimized.

Copy link
Member

commented Jan 22, 2016

@YorickPeterse The redirection thing in Process#spawn is kinda confusing right now for me, but I used this script for testing:

spawn(RbConfig.ruby, "-eSTDERR.print :glark", :out => ["test", "w"], :err => [:child, :out])

Both MRI 2.2.4 and RBX 3.11.c7 are writing "glark" into a file called "test".
So I think this spec was here to ensure this behavior. Oddly enough I can't see anything which changed in the kernel code regarding for it, so it already behaved that way.

@YorickPeterse

This comment has been minimized.

Copy link
Member Author

commented Jan 22, 2016

@tak1n Thanks. In that case I'll just mark it as fixed. If it turns out to be otherwise we can fix it whenever brought up.

@tak1n

This comment has been minimized.

Copy link
Member

commented Jan 22, 2016

@YorickPeterse Oddly enough also MRI 2.1.7 behaves that way.

~ ❯❯❯ ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
~ ❯❯❯ cat test.rb
spawn(RbConfig.ruby, "-eSTDERR.print :glark", :out => ["test", "w"], :err => [:child, :out])
~ ❯❯❯ ruby test.rb
~ ❯❯❯ cat test
glark%
@YorickPeterse

This comment has been minimized.

Copy link
Member Author

commented Jan 22, 2016

Checked off vfork usage as well. While interesting this isn't really something exposed to Ruby and I don't think it's really worth our time at this point. Maybe in the future it's interesting but we should open a dedicated issue in that case.

@YorickPeterse

This comment has been minimized.

Copy link
Member Author

commented Feb 5, 2016

Moved remaining TODOs to separate issues, closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.