Closed diegovdc closed 5 years ago
ooowow this is great! Is this sort of a "best practices" thing, or something that could be somehow added to the software?
I think that when a function is used as an input to a src/function/etc... it's output, upon execution, should be validated so that it is a valid value. If an invalid value is returned, such as a function, a nice error could be thrown. (I have noticed that this crash also takes place is an undefined value is passed in).
At the very least the error should be catched, to prevent Hydra from crashing, which would not be at all nice in the context of a performance, (as it would require a restart).
I have been getting familiar with the codebase, but am yet to find where the execution of the functions happen. I now believe it is somewhere in hydra-synth
. If you could point me where it takes place I'd be happy to open an pull request to work on a fix.
This is where the formatting of functions happens: https://github.com/ojack/hydra-synth/blob/6efcd8fefbcc49bc7fc1608a0ee58dc1f092a238/src/GeneratorFactory.js#L45
The executing of functions is handled within regl https://github.com/regl-project/regl
I am interested in understanding more about how this is happening!
If working with functions it might be easy to forget a function call, which will fatally crash Hydra and will require a restart.
e.g.
Although this example is very simple, it is easy to forget a call when a function is curried.