Ocaml representation of values - Atoms
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I looked at the internal representation of some OCaml values. The representation of an empty array is an atom(0) , i.e. a block with tag=0 and size=0 . Empty arrays of floats are represented by an atom(0) too. Is there any OCaml value represented by an atom with tag > 0 ? If not: for what purpose the OCaml bytecode set contains the ATOM n instruction? 回答1: A tag > 0 is used for constructors with arguments, which would make them not atoms. Constructors without arguments on the other hand are stored as int instead of blocks so again not atoms.