Page 1 of 1
Please remove/split struct or array[struct] definitions
Posted: Sat Mar 08, 2025 1:26 am
by PennyJim
There's times I want to annotate a function to only take/return the struct, not the array possibility. The definition for the type being tied to it, is annoying.
I'd much rather the places that use it hold the responsibility to do the
type or array[struct] definition.
On the other hand, you can make a whole different type for it like
StatelessVisualisations.
As I understand how the json format works, this would also optimize its size. While not that important, it's still a positive :]
(though the
solution for size would be a special complex type)
Re: Please remove/split struct or array[struct] definitions
Posted: Fri May 09, 2025 1:53 pm
by Therenas
After consideration, we decided that we won't change this format. It would indeed be more straightforward to use the type that way, but it'll add a layer of indirection to the JSON/website that'll make it harder to understand and use.
You'll have to restrict the type yourself in code when you need that. Or maybe FMTK could get some sort of support for making this easier? I'm not sure.
Re: Please remove/split struct or array[struct] definitions
Posted: Fri May 09, 2025 6:36 pm
by curiosity
Or the docs builder could detect and handle the type or array of type case.
Re: Please remove/split struct or array[struct] definitions
Posted: Mon May 12, 2025 7:07 am
by Therenas
You mean the docs builder on our side?
Re: Please remove/split struct or array[struct] definitions
Posted: Mon May 12, 2025 7:53 am
by curiosity
Yes.
edit: Actually, from my cursory search, the docs are full of "type or array of type" cases. It's quite clear and has never caused any difficulty, at least for me. IDK what types the OP means, but they absolutely could (and should) be reworked. And I agree with you that things like StatelessVisualisations are the worst. They should also be changed to "type or array of type" at the place of use. Will make it more consistent.
Re: Please remove/split struct or array[struct] definitions
Posted: Mon May 12, 2025 2:01 pm
by Therenas
Oh you made me realize I only considered this part of the proposal:
On the other hand, you can make a whole different type for it like StatelessVisualisations.
and not this one:
I'd much rather the places that use it hold the responsibility to do the type or array[struct] definition.
This would be tedious and confusing to do manually on our side, but there are ways to automate it for the best of both worlds. We'll be working on that, and I'll move this back to unresolved until then.