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

"xo" needs a means of handling lists and instances #61

Closed
philshafer opened this issue Sep 11, 2018 · 1 comment
Closed

"xo" needs a means of handling lists and instances #61

philshafer opened this issue Sep 11, 2018 · 1 comment
Assignees
Labels

Comments

@philshafer
Copy link

See https://lists.freebsd.org/pipermail/freebsd-hackers/2018-September/053304.html

  1. "machines" is an object, which erroneously contains 2 "machine" keys

This is a bug. "xo" lacks a means of knowing that an object is a
list. One might expect that labeling "name as a key would perform
this, but it doesn't, and it's not clear that this is enough
information. Since "xo" is stateless, it cannot really handle
that "--wrapper machine" applies only to the first item. It
would have to know not to generate the closing "}" for machine,
but it's stateless, so I'd need a means of telling it that.

In C code, we have "xo_open_list" and "xo_open_instance", like:

https://libxo.readthedocs.io/en/latest/api.html?highlight=xo_open_instance#lists-and-insta
nces

But with "xo" I don't have lists and instances. I'll need to
find a means of adding these, though that would make "xo" more
cumbersome and it would lack the FSM (and the stack) that catches
missing calls in libxo.

    xo $opts --open-list machine
    for name in red green blue; do
        xo $opts --open-instance machine
        xo $opts "Machine {k:name} has {:memory}\n" $name `get-mem ~name`
        xo $opts --close-instance machine
    done
    xo $opts --close-list machine

Which is very exact but less that beautiful.

Thanks,
Phil

@philshafer philshafer added the bug label Sep 11, 2018
@philshafer philshafer self-assigned this Sep 11, 2018
@philshafer
Copy link
Author

Fixed in develop branch

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