[#37041] [ANN] Exerb/Exerb-CC 2.6.0 — Yuya Kato <yuya-ml@4th.to>

未踏ユース終了まで1ヶ月を切って、焦り気味のYuyaです。

27 messages 2003/02/02
[#37202] Re: [ANN] Exerb/Exerb-CC 2.6.0 — "TOYOFUKU Chikanobu" <toyofuku@...> 2003/03/02

豊福です。

[#37206] Re: [ANN] Exerb/Exerb-CC 2.6.0 — Yuya Kato <yuya-ml@4th.to> 2003/03/04

Yuyaです。

[#37058] Re: Local variables & blocks — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

27 messages 2003/02/05
[#37059] Re: Local variables & blocks — ichimal@... 2003/02/06

皆様、初めまして鈴木です。

[#37063] Re: Local variables & blocks — matz@... (Yukihiro Matsumoto) 2003/02/07

まつもと ゆきひろです

[#37110] Re: Local variables & blocks — ichimal@... 2003/02/16

鈴木です。

[#37115] Re: Local variables & blocks — Tanaka Akira <akr@...17n.org> 2003/02/17

In article <200302161629.h1GGTvJ5008901@fenix.ne.jp>,

[#37123] 私はこれにハマリました。 — Shin-ichiro HARA <sinara@...> 2003/02/18

原です。

[ruby-list:37058] Re: Local variables & blocks

From: matz@... (Yukihiro Matsumoto)
Date: 2003-02-05 10:07:48 UTC
List: ruby-list #37058
まつもと ゆきひろです

In message "Re: Local variables & blocks"
    on 03/02/05, Yukihiro Matsumoto <matz@ruby-lang.org> writes:

||>Hmm, this is interesting issue.  If you're OK, shall we discuss at the
||><ruby-list@ruby-lang.org> list in Japanese?
||
||  I'm Okay.
|
|OK, let's move.  Honestly, it's kinda hard for me to discuss.

ということで、引っ越してきました。やはり英語で難しいことを話
すのはツラいです。

元々はnilが偽なのは良くないのでは、という話です(末尾参照)。

Schemeでは「未初期化の変数値」である#<undef>(Gaucheの場合)は
偽ではなく真です。だから、Rubyでもそうあるべきでは、という主
張なのだと理解しました。

それに対する私の返答は

  * RubyはRuby、SchemeはSchemeなので、Schemeの#<undef>が真だ
    からといってRubyのnilが真でなければならない理由にはなら
    ない。

というものです。さらに言えば(ruby-talkでは書かなかったけど)、

  * nilを真にするというのは(Schemeでなく)Lispの伝統に反する。
  * 互換性で大問題が起きる
  * nilは3値論理(真、偽、未定義)を表現するのに都合が良い

などの状況もあります。ということで、nilを真にすることも、nil
を唯一の偽の値にすることもRubyについてはありえないかなあと考
えています。ちなみに昔はnilは唯一の偽値でした。

とはいうものの、「#<undef>は偽であってはならない理由」という
のに興味はありますから(R5RSにも理由の説明はないし)、ぜひとも
聞きたいなあと思っているのです。

				まつもと ゆきひろ /:|)


In message "Re: Local variables & blocks"
    on 03/02/05, ichimal@fenix.ne.jp <ichimal@fenix.ne.jp> writes:
|
|Hi,
|
|In message "Re: Local variables & blocks"
|    on 03/02/04, matz writes:
|
|>Hmm, this is interesting issue.  If you're OK, shall we discuss at the
|><ruby-list@ruby-lang.org> list in Japanese?
|
|  I'm Okay.
|
|>|>What's wrong with that?
|>|
|>|  Is it meaning that Scheme is just Scheme, Ruby is just Ruby?
|>
|>Maybe.  Scheme is not an excuse for me.  I'm interested in whether
|>there's any other reason to "separate false and nil".
|
|  I think, nil in Ruby is representative value of "{unavailable|invalid|
|no effect} in this context" rather than "not initialized".
|
|  I think, following representation is valid:
|    a variable points to nil.
|
|  But following representation is not good:
|    a variable points to non-initialized value.
|It should be: a variable is not initialized. 
|  
|# But, we can initialize a variable with non-initialized value
|# explicitlly by tricky way s.t. (set! x (if #f #f)) in scm, and it
|# should not be forbidden. It's programmer's responsibility.
|## Note for reader who don't know scm:
|## (set! x (if #f #f)) => #<unspecified>,
|## (set! x #<unspecified>) => error.
|## It may be great policy. This is why I said "tricky way".
|
|  Then, the semantics "nil is also false" restricts the meaning of
|{unavailable|invalid|no effect}. It's default value of the default
|value for {unavailable|invalid|no effect} but the default^2 shuold
|belong to programmer, not to PL, I think.
|
|  e.g.
|  def questionnaire
|    print_somewhat_Q
|    str = gets
|    parse_answer(str) if str
|  end
|
|  This method should return nil as "non-effective answer" or somewhat
|effective answer including boolean. When a programmer sets the default
|answer to false, the programmer may save an extra test because "nil is
|also false" :-P
|
|Thanks.
|
|---- 
|1002.(ichimal)
|SUZUKI Shingo.

In This Thread

Prev Next