DevelopersMeeting20151109Japan

https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20151109Japan

Attendees: matz, nobu, hsbt, akr, naruse, sorah, yuki, ko1

Next meeting

2015/12/07 Mon 14:00 JST at SFDC

[Feature #8976] file-scope freeze_string directive

freeze dynamic string literal or not?

debugging option implemeted by ko1

[Feature #4840] Allow returning from require

### Before

unless cond

  class C

  end

end

# … or …

class C

end unless cond

### After

return if cond

class C

end

Discussed use cases, examples

# OK

if xxx

  return

end

while xxx

  return

end

begin

  raise

rescue

  return

ensure

  return

end

# NG

1.times{

  return

}

Class.new do

  return

end

pr = Proc.new{

  return

}

def foo

  return

end

[Feature #9098] Indent heredoc against the left margin by default when "indented closing identifier" is turned on.

# 2 spaces

  str =<<~EOS

  hello

  EOS

#=>”\nhello\n”

Matz: acecptable, but there could be a problem if hard tabs and spaces are both used in one heredoc.

Nishijima-san suggested another way to write strings like DATA for each files. It will be proposed as another ticket.

[Feature #11643] A new method on Hash to grab values out of nested hashes, failing gracefully

Matz: acceptable, but name is problem.

Candidates:

Example:

h = {a: {b: {c: 1}}}

h.dig(:a, :b, :c) #=> 1

h.fetch_in(:a, :b, :c) #=> 1

Note that Matz doesn’t like &.[] (safe navigation operator with []).

Nishijima-san mentioned past rejected proposals in Rails [1] [2], they were rejected because such object in use cases should be wrapped with proper objects.

[Feature #11665] Support nested functions for better code organization

class C

  def foo

        # current

        x = 1

        bar = lambda { x = 10 }

        bar.call

        p x #=> 10

        # proposed

        x = 1

        def bar; x = 10; end # isolated from outer scope

        bar()

        p x #=> 1

  end

end

[Feature #11666] IPAddr#private?

Matz accepted this feature. Pass to knu -san (maintainer).

[Feature #11588] Implement structured warnings

[Feature #11653] Add to_proc on Hash

class Hash

  def to_proc

    proc{|key| self[key]}

  end

end

h = {1 => 10,

         2 => 20,

         3 => 30}

p [1, 2, 3].map(&h) #=> [10, 20, 30]

Matz: acceptable

Matz: to_proc is intended for & argument operator. So it is reasonable to add.

[Feature #10984] Hash#contain? to check whether hash contains other hash

Matz: Feature is acceptable. But naming issue;

Method name candidates:

Matz: I vote for “<”, “>”, “<=” and “>=” (no “<=>” and “===”).

[Feature #9108][Feature #8499] Importing Hash#slice, Hash#slice!, Hash#except, and Hash#except! from ActiveSupport

Current status: naming issue, select and reject are acceptable for Matz.

no conclusion yet