Skip to content

Ruby 2.3 specs #175

@eregon

Description

@eregon

We should aim to write specs for all new features, as usually the coverage is rather limited and it would greatly help other implementations to get the behavior right and faster.

From https://github.com/ruby/ruby/blob/v2_3_0/NEWS:
Only relevant items are kept for brevity.

Changes since the 2.2.0 release

Language changes

  • frozen-string-literal pragma:
    • 8a76900 new pragma, frozen-string-literal has been experimentally introduced.
      Feature #8976
    • b9c349e besides, --enable/--disable=frozen-string-literal options also have
      been introduced. Feature #8976
    • a0e55db command line options --debug or --debug=frozen-string-literal enable
      additional debugging mode which shows created location with at frozen
      object error (RuntimeError).
      Feature #11725
  • safe navigation operator:
    • Add specs for a safe navigator. #274 new method call syntax, object&.foo, method #foo is called on
      object if it is not nil.
      this is similar to try! in Active Support, except:
      • method name is syntactically required
        obj.try! {} # valid
        obj&. {} # syntax error
      • arguments are evaluated only if a call is made:
        obj.try!(:foo, bar()) # bar() is always evaluated
        obj&.foo(bar()) # bar() is conditionally evaluated
      • attribute assignment is valid
        obj&.attr += 1
        Feature #11537
  • the did_you_mean gem:
    • DidYouMean specs for ruby 2.3 #351 When a NameError or NoMethodError occurs because of a typo in the name,
      the did_you_mean gem automatically suggests other names similar to the
      method name.
      "Yuki".starts_with?("Y")
      # => NoMethodError: undefined method `starts_with?' for "Yuki":String
      #    Did you mean?  start_with?
  • indented here document:

Core classes updates (outstanding ones only)

Core classes compatibility issues (excluding feature bug fixes)

Stdlib updates (not pure-Ruby changes as these just depend on existing features)

  • OpenSSL
    • (no specs) OpenSSL::SSL::SSLSocket#accept_nonblock and
      OpenSSL::SSL::SSLSocket#connect_nonblock supports exception: false.
  • Socket
    • 600d305 Socket#connect_nonblock, Socket#accept_nonblock,
      TCPServer#accept_nonblock, UNIXServer#accept_nonblock,
      BasicSocket#recv_nonblock, BasicSocket#recvmsg_nonblock,
      BasicSocket#sendmsg_nonblock all support exception: false to return
      :wait_readable or :wait_writable symbols instead of raising
      IO::WaitReadable or IO::WaitWritable exceptions
      [Feature #10532] Feature #11229
    • e000de6 BasicSocket#recv and BasicSocket#recv_nonblock allow an output
      String buffer argument like IO#read and IO#read_nonblock to reduce
      GC overhead Feature #11242
  • StringIO
    • 2a0bcb8 In read-only mode, StringIO#set_encoding no longer sets the encoding
      of its buffer string. Setting the encoding of the string directly
      without StringIO#set_encoding may cause unpredictable behavior now.
      Bug #11827

Stdlib compatibility issues (not pure-Ruby changes as these just depend on existing features)

C API updates

  • 1b4d6a2 rb_define_class_id_under() now raises a TypeError exception when the
    class is already defined but its superclass does not match the given
    superclass, as well as definitions in ruby level.
  • ed92645 rb_timespec_now() is added to fetch current datetime as struct timespec.
    Feature #11558
  • e976989 rb_time_timespec_new() is added to create a time object with epoch,
    nanosecond, and UTC/localtime/time offset arguments. Feature #11558

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions