hack-codegen icon indicating copy to clipboard operation
hack-codegen copied to clipboard

Support renderers for args in addMultilineCall

Open simonwelsh opened this issue 7 years ago • 3 comments

For our current use of addMultilineCall, it's fairly common to pass literals as arguments, including nested arrays. Would be nice if we could use HackBuilderValues::export() rather than having to do it manually.

simonwelsh avatar Nov 28 '17 00:11 simonwelsh

I'm not sure how to design this in a way that works reasonably well for both all-args-have-same-renderer and different-renderer-per-arg.

It might be best to add a HackBuilderValue type which includes both a T and a IHackBuilderValueRenderer<T>, and take multiple hackbuildervalues

fredemmott avatar Nov 01 '18 19:11 fredemmott

This is probably worth looking at v5, which hopefully won't be as long away as v3 => v4 :)

fredemmott avatar Nov 01 '18 19:11 fredemmott

Waking this issue from its multi year slumber. My instinct says: Why not both?

Keep the current addMultilineCall() around, since requiring a builder for a true literal would be cumbersome. Add a new method which takes on builder and apply it to all arguments.

I am not sure a third version taking builder+value pairs would be much more convenient than using the builders at the call site. There is no need to add this in the same PR, so that may/might be postponed (indefinitely?).

lexidor avatar May 25 '23 07:05 lexidor