2013年8月8日木曜日

[Ruby Tutorial] Some Features of Ruby

  • http://rubylearning.com/satishtalim/features.html
  • Statement delimiters
    • This tutorial says "a linefeed is treated like a semicolon." Then, how about a carige return?A little bit interesting.
    • The ruby specification, http://www.ruby-doc.org/core-2.0/doc/syntax/miscellaneous_rdoc.html, says "Ruby uses a newline as the end of an expression." Then, what's a newline? Perhaps, there is no standardized rule for this topic but UTR#13, an effort in Unicode, is worth referencing: http://www.unicode.org/standard/reports/tr13/tr13-5.html
    • The tutorial uses the word "statement" while the spec uses "expressions." AFAIK, statements and expressions are different entities in computer languages. Also, I'm not sure Ruby has statements.
    • Consequently the description in the tutorial is incorrect or insufficient.
    • I'm not a "language lawyer." I just wandered why the author didn't use the original description in the spec: "Ruby uses a newline as the end of an expression." This is more concise and informative than the author's explanation.
  • Keywords
    • I don't understand why the author included a description about truth value treatment of Ruby here, esp. in an item about Keywords.
    • As for truth values, Ruby and CL looks quite similar. CLers expect the truth value of everything other than nil or '() is non-nil.

0 件のコメント: