In Ruby why does nil.id return 4?

后端 未结 4 593
陌清茗
陌清茗 2020-12-10 10:30

This is has been bugging me for quite some time.

>> nil.id
(irb):2: warning: Object#id will be deprecated; use Object#object_id
=> 4
4条回答
  •  醉酒成梦
    2020-12-10 10:39

    I'd always assumed it was a cool easter egg: In Japan 4 is the number of death.

提交回复
热议问题