Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
ξ;゜ー゜)ξ { 遅レス。 - 日記書くか
[go: Go Back, main page]

ξ;゜ー゜)ξ { 遅レス。 このページをアンテナに追加 RSSフィード

2005-03-12 日記書くか

いつまで続くかわからないが始めてみる。

これで別エントリになるのかな?


ならねぇな。おとなしくはてなダイアリーのヘルプを読むか。


アスタリスクでなるのか 21:33 このエントリーを含むブックマーク

RDかTextileで入力できねぇかな?


[] 翻訳予定 21:46 このエントリーを含むブックマーク

あー、

を、翻訳しなくちゃ。

草稿をここに載せるようにしようかな、うん、そうしよう。

もしかしたら、英語の間違いを指摘してくれる人がいるかもしれないし。


[] Ruby 2.0 block local variable 01:44 このエントリーを含むブックマーク

草稿出来。間違い等ございましたら、コメントTrackbackしてもらえると嬉しいです。

明日夜に Redhanded に載せようかと思います。

This is a topic I wanna talk about the meeting on yesterday[1] but I didn't because it didn't warm up so much.


I've been thinking about Ruby's block scope for a long time. I couldn't single out easily in various ideas. In these days, It's thought that I find the one hit the spot.


The specification is as follows.

  • Block parameters are only local valiables.
  • The scope of block parameter is block local.
  • If the name of block parameter is overlapped outside local variable, then it's error.("Shugo Maeda":http://shugo.net/jit/ won.) *
  • You can set a variable that is enable in the block using syntax like "; var" after block parameters. *
  • Overlapping of these variables is error.
  • The scope of a variable appears first in the block is block local (according to the current). *
  • The reference to the variable in which the scope used in the method has ended is warned. *

Though it's different that I've declared about Ruby 2.0 upto now (especially, part of *), I seem the compatibility is higher and the usability is not worsend.

Especially, dblack has been opposed applying the method scope in the point of "The scope of a variable appears first" might be pleased.


Now, as a result,

3.times {|i; a|
  a = 5
  p [i, a]
}

is ok.


3.times {|i; a=5|
  p [i, a]
}

A syntax with initializing is more better. But "|" is the operator might be in an expression. Thus,

  • We give it up.
  • Only primary one(literal, variable, expression bundled by parentheses, etc) be permitted at initialization.

It seems to become either.


As for the rest, it depends on whether we accept that the below is error or not.

3.times {|i; a=2+3|
  p [i, a]
}


fn1. Matz organized a mini meeting "Meetup for The Matsue Ruby Meetup Group":http://www.rubyist.net/~matz/20050308.html#p03 . Matz belongs among "Matsue Ruby Meetup Group":http://ruby.meetup.com/48/ .

[] 思いつき 03:05 このエントリーを含むブックマーク

あー、なんかこれは訳さないで良いような気がしてきた。実装された時に話題になると思うし。つーことで今週はこのぐらいで。

トラックバック - http://d.hatena.ne.jp/babie/20050312