[#19261] lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@...

なかだです。

29 messages 2003/01/01
[#19360] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "K.Kosako" <kosako@...> 2003/01/15

nobu.nakada@nifty.ne.jpさんの

[#19361] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/15

なひです。

[#19364] Re: lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@... 2003/01/17

なかだです。

[#19366] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/17

なひです。

[#19299] [BUG] errno == 0 — Kazuhiro Yoshida <moriq@...>

もりきゅうです。win32だけかもしれません。

22 messages 2003/01/04
[#19301] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19302] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19303] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19304] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19306] Re: [BUG] errno == 0 — nobu.nakada@... 2003/01/05

なかだです。

[ruby-dev:19264] Re: ruby-1.8.0 / yield(nil)とyield()のちがい

From: matz@... (Yukihiro Matsumoto)
Date: 2003-01-01 01:06:07 UTC
List: ruby-dev #19264
まつもと ゆきひろです

In message "[ruby-dev:19219] Re: ruby-1.8.0 / yield(nil)とyield()のちがい"
    on 02/12/28, Yukihiro Matsumoto <matz@ruby-lang.org> writes:

|おとといから悩んでるんですが、異様に難しいです。が、そのうち
|になんとかします。

なんとかなったみたいです。以下のtest suiteが動作します。もう
じきコミットします。

# 次は定数問題[ruby-talk:59972]だ。

def test_ok(a, b)
  if a != b
    print "failed at ", caller(0)[1], "<a:", a.inspect, "> != <b:", b.inspect, ">\n"
  end
end

a = nil; test_ok(a, nil)
a = 1; test_ok(a, 1)
a = []; test_ok(a, [])
a = [1]; test_ok(a, [1])
a = [nil]; test_ok(a, [nil])
a = [[]]; test_ok(a, [[]])
a = [1,2]; test_ok(a, [1,2])
a = [*[]]; test_ok(a, [])
a = [*[1]]; test_ok(a, [1])
a = [*[1,2]]; test_ok(a, [1,2])

a = *nil; test_ok(a, nil)
a = *1; test_ok(a, 1)
a = *[]; test_ok(a, nil)
a = *[1]; test_ok(a, 1)
a = *[nil]; test_ok(a, nil)
a = *[[]]; test_ok(a, [])
a = *[1,2]; test_ok(a, [1,2])
a = *[*[]]; test_ok(a, nil)
a = *[*[1]]; test_ok(a, 1)
a = *[*[1,2]]; test_ok(a, [1,2])

*a = nil; test_ok(a, [nil])
*a = 1; test_ok(a, [1])
*a = []; test_ok(a, [])
*a = [1]; test_ok(a, [1])
*a = [nil]; test_ok(a, [nil])
*a = [[]]; test_ok(a, [[]])
*a = [1,2]; test_ok(a, [1,2])
*a = [*[]]; test_ok(a, [])
*a = [*[1]]; test_ok(a, [1])
*a = [*[1,2]]; test_ok(a, [1,2])

*a = *nil; test_ok(a, [nil])
*a = *1; test_ok(a, [1])
*a = *[]; test_ok(a, [])
*a = *[1]; test_ok(a, [1])
*a = *[nil]; test_ok(a, [nil])
*a = *[[]]; test_ok(a, [])
*a = *[1,2]; test_ok(a, [1,2])
*a = *[*[]]; test_ok(a, [])
*a = *[*[1]]; test_ok(a, [1])
*a = *[*[1,2]]; test_ok(a, [1,2])

a,b,*c = nil; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = 1; test_ok([a,b,c], [1,nil,[]])
a,b,*c = []; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = [1]; test_ok([a,b,c], [1,nil,[]])
a,b,*c = [nil]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = [[]]; test_ok([a,b,c], [[],nil,[]])
a,b,*c = [1,2]; test_ok([a,b,c], [1,2,[]])
a,b,*c = [*[]]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = [*[1]]; test_ok([a,b,c], [1,nil,[]])
a,b,*c = [*[1,2]]; test_ok([a,b,c], [1,2,[]])

a,b,*c = *nil; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = *1; test_ok([a,b,c], [1,nil,[]])
a,b,*c = *[]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = *[1]; test_ok([a,b,c], [1,nil,[]])
a,b,*c = *[nil]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = *[[]]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = *[1,2]; test_ok([a,b,c], [1,2,[]])
a,b,*c = *[*[]]; test_ok([a,b,c], [nil,nil,[]])
a,b,*c = *[*[1]]; test_ok([a,b,c], [1,nil,[]])
a,b,*c = *[*[1,2]]; test_ok([a,b,c], [1,2,[]])

def f; yield; end; f {|a| test_ok(a, nil)}
def f; yield nil; end; f {|a| test_ok(a, nil)}
def f; yield 1; end; f {|a| test_ok(a, 1)}
def f; yield []; end; f {|a| test_ok(a, [])}
def f; yield [1]; end; f {|a| test_ok(a, [1])}
def f; yield [nil]; end; f {|a| test_ok(a, [nil])}
def f; yield [[]]; end; f {|a| test_ok(a, [[]])}
def f; yield [*[]]; end; f {|a| test_ok(a, [])}
def f; yield [*[1]]; end; f {|a| test_ok(a, [1])}
def f; yield [*[1,2]]; end; f {|a| test_ok(a, [1,2])}

def f; yield *nil; end; f {|a| test_ok(a, nil)}
def f; yield *1; end; f {|a| test_ok(a, 1)}
def f; yield *[]; end; f {|a| test_ok(a, nil)}
def f; yield *[1]; end; f {|a| test_ok(a, 1)}
def f; yield *[nil]; end; f {|a| test_ok(a, nil)}
def f; yield *[[]]; end; f {|a| test_ok(a, [])}
def f; yield *[*[]]; end; f {|a| test_ok(a, nil)}
def f; yield *[*[1]]; end; f {|a| test_ok(a, 1)}
def f; yield *[*[1,2]]; end; f {|a| test_ok(a, [1,2])}

def f; yield; end; f {|*a| test_ok(a, [])}
def f; yield nil; end; f {|*a| test_ok(a, [nil])}
def f; yield 1; end; f {|*a| test_ok(a, [1])}
def f; yield []; end; f {|*a| test_ok(a, [])}
def f; yield [1]; end; f {|*a| test_ok(a, [1])}
def f; yield [nil]; end; f {|*a| test_ok(a, [nil])}
def f; yield [[]]; end; f {|*a| test_ok(a, [[]])}
def f; yield [*[]]; end; f {|*a| test_ok(a, [])}
def f; yield [*[1]]; end; f {|*a| test_ok(a, [1])}
def f; yield [*[1,2]]; end; f {|*a| test_ok(a, [1,2])}

def f; yield *nil; end; f {|*a| test_ok(a, [nil])}
def f; yield *1; end; f {|*a| test_ok(a, [1])}
def f; yield *[]; end; f {|*a| test_ok(a, [])}
def f; yield *[1]; end; f {|*a| test_ok(a, [1])}
def f; yield *[nil]; end; f {|*a| test_ok(a, [nil])}
def f; yield *[[]]; end; f {|*a| test_ok(a, [])}
def f; yield *[*[]]; end; f {|*a| test_ok(a, [])}
def f; yield *[*[1]]; end; f {|*a| test_ok(a, [1])}
def f; yield *[*[1,2]]; end; f {|*a| test_ok(a, [1,2])}

def f; yield; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield nil; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield 1; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield []; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield [1]; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield [nil]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield [[]]; end; f {|a,b,*c| test_ok([a,b,c], [[],nil,[]])}
def f; yield [*[]]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield [*[1]]; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield [*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c], [1,2,[]])}

def f; yield *nil; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield *1; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield *[]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield *[1]; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield *[nil]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield *[[]]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield *[*[]]; end; f {|a,b,*c| test_ok([a,b,c], [nil,nil,[]])}
def f; yield *[*[1]]; end; f {|a,b,*c| test_ok([a,b,c], [1,nil,[]])}
def f; yield *[*[1,2]]; end; f {|a,b,*c| test_ok([a,b,c], [1,2,[]])}


class IterTest
  def initialize(e); @body = e; end

  def each0(&block); @body.each(&block); end
  def each1(&block); @body.each {|*x| block.call(*x)} end
  def each2(&block); @body.each {|*x| block.call(x) } end
  def each3(&block); @body.each {|x| block.call(*x) } end
  def each4(&block); @body.each {|x| block.call(x)  } end
  def each5; @body.each {|*x| yield(*x)} end
  def each6; @body.each {|*x| yield(x) } end
  def each7; @body.each {|x| yield(*x) } end
  def each8; @body.each {|x| yield(x)  } end

  def f(a)
    test_ok(a, [1])
  end
end
IterTest.new(nil).method(:f).to_proc.call([1])

IterTest.new([0]).each0 {|x| test_ok(x, 0)}
IterTest.new([1]).each1 {|x| test_ok(x, 1)}
IterTest.new([2]).each2 {|x| test_ok(x, [2])}
IterTest.new([3]).each3 {|x| test_ok(x, 3)}
IterTest.new([4]).each4 {|x| test_ok(x, 4)}
IterTest.new([5]).each5 {|x| test_ok(x, 5)}
IterTest.new([6]).each6 {|x| test_ok(x, [6])}
IterTest.new([7]).each7 {|x| test_ok(x, 7)}
IterTest.new([8]).each8 {|x| test_ok(x, 8)}

IterTest.new([[0]]).each0 {|x| test_ok(x, [0])}
IterTest.new([[1]]).each1 {|x| test_ok(x, 1)}
IterTest.new([[2]]).each2 {|x| test_ok(x, [2])}
IterTest.new([[3]]).each3 {|x| test_ok(x, 3)}
IterTest.new([[4]]).each4 {|x| test_ok(x, [4])}
IterTest.new([[5]]).each5 {|x| test_ok(x, 5)}
IterTest.new([[6]]).each6 {|x| test_ok(x, [6])}
IterTest.new([[7]]).each7 {|x| test_ok(x, 7)}
IterTest.new([[8]]).each8 {|x| test_ok(x, [8])}

IterTest.new([[0,0]]).each0 {|x| test_ok(x, [0,0])}
IterTest.new([[8,8]]).each8 {|x| test_ok(x, [8,8])}

In This Thread