Kernel#[]

定義はできるけど,Object#__send__使わないと配列のリテラルと判断されて実行できないようです。

def [](val)
 "hello world"
end
  #=> nil

[1]
  #=> [1]

[](1)
SyntaxError: compile error
(irb):11: parse error, unexpected '(', expecting $
[](1)
   ^
        from (irb):11
[] 1
SyntaxError: compile error
(irb):12: parse error, unexpected tINTEGER, expecting $
        from (irb):12
__send__ "[]", 1
  #=> "hello world"