Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

未实现在 Array of Tables 中嵌套 table #2

Closed
achun opened this issue Apr 16, 2014 · 1 comment
Closed

未实现在 Array of Tables 中嵌套 table #2

achun opened this issue Apr 16, 2014 · 1 comment
Labels

Comments

@achun
Copy link
Owner

achun commented Apr 16, 2014

[[fruit]]
  name = "apple"

  [fruit.physical]
    color = "red"
    shape = "round"

  [[fruit.variety]]
    name = "red delicious"

  [[fruit.variety]]
    name = "granny smith"

[[fruit]]
  name = "banana"

  [[fruit.variety]]
    name = "plantain"
@achun achun added the question label Apr 16, 2014
@achun achun changed the title 在 Array of Tables 中嵌套 table 未实现在 Array of Tables 中嵌套 table Apr 17, 2014
@achun
Copy link
Owner Author

achun commented Apr 18, 2014

采用 map 存储是问题的根本原因

map 更多的是表现平板式的数据结构, 没有太深的嵌套. 你可以用

tm["a.b.c.d.foo"]  // 一下就访问到最终的目标
// 而不用像这样
tm.Get("a").Get("b").Get("c").Get("d").Get("foo")

TOML v0.2.0 的定义中, Table/ArrayOfTables 是可以深层嵌套的.

参见 toml-lang/toml#153

用 map 完全实现 TOML 的标准访问的时候必然产生一些语义上的差异. 目前还没有想清楚用 map 如何很好的支持这种嵌套

achun added a commit that referenced this issue May 2, 2014
@achun achun closed this as completed Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant