google/skylark

Unpack{Positional}Args with custom Value types

dbentley opened this issue · 4 comments

UnpackPositionalArg seems to not work if I have a custom type.

What should I do? Make my own UnpackArgs with my custom type(s)?

Use of reflect? Or some kind of Unpacker struct that lets me register the extra types?

Hi Dan. What do you mean by "not work"? UnpackArgs performs simple type checking based on the reflect type of the pointer, but for parameters that allow multiple types (e.g. string, int or None), you need to pass a pointer to a plain skylark.Value and do the type checking yourself once UnpackArgs has returned.

If you have ideas for how to make it more useful (but not significantly more complex or slower), I'm all ears.

cheers
alan

Sorry for being obtuse. I figured out what you mean; see #12.

LGTM; thanks.

Fixed by 04850cb.