`
mryufeng
  • 浏览: 982433 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Internal Representation of Records

阅读更多
8.7 Internal Representation of Records

Record expressions are translated to tuple expressions during compilation. A record defined as

-record(Name, {Field1,...,FieldN}).

is internally represented by the tuple

{Name,Value1,...,ValueN}

where each ValueI is the default value for FieldI.

To each module using records, a pseudo function is added during compilation to obtain information about records:

record_info(fields, Record) -> [Field]
record_info(size, Record) -> Size

Size is the size of the tuple representation, that is one more than the number of fields.
分享到:
评论
2 楼 mryufeng 2009-03-06  
不多余 因为类似is_record(xxx)什么的需要这个信息
1 楼 cryolite 2009-03-06  
好多数据结构底层都是tuple实现的,例如gb_trees
有个疑问:record存放到mnesia数据库中时,record的Name岂不是太多余了,纯粹浪费磁盘空间?

相关推荐

Global site tag (gtag.js) - Google Analytics