8000 _create builder methods should have arguments in id order · Issue #81 · dvidelabs/flatcc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
_create builder methods should have arguments in id order #81
Closed
@mikkelfj

Description

@mikkelfj

The arguments should be ordered according to the id attribute when present.

In the monster_test.fbs this would be:

ns(Monster_create(pos, mana, hp, name, ...))

because pos has id:0, mana has id: 1, hp has id: 2, and name has id: 3.

but is currently sorted according to the literal text order in the schema:

ns(Monster_create(pos, hp, mana, name, ...))

This is not compatible with Googles C++ create call and can break code if the schema is later rearranged.

In any case it is not possible to add new fields to the schema without a compile error because the create call is not vararg, but this is still safe, unlike the ordering.

This is not trivial to fix because it might break existing code.
Suggestions are welcome.

NOTE: this also potentially relates to JSON parsing because argument vectors might be supported so a Monster table could be given as [pos, hp, mana, name, ...] as opposed to { "pos":pos, "hp":hp, "mana":mana, "name":name}. Since this feature is not currently avaialable it cannot break anything, but if added, it would be inconsistent with the current _create call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0