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

Forgetting to call a function will crash Hydra #35

Closed
diegovdc opened this issue Jan 26, 2019 · 4 comments
Closed

Forgetting to call a function will crash Hydra #35

diegovdc opened this issue Jan 26, 2019 · 4 comments

Comments

@diegovdc
Copy link

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.

var myfunc = () => 5
osc(() => myfunc).out()

Although this example is very simple, it is easy to forget a call when a function is curried.

var timeMod= mod => ({time}) =>  time%mod

osc(timeMod(60)).out() // all good

osc(params => timeMod(60)).out() //ups, forgot to pass params, will crash
@ojack
Copy link
Member

ojack commented Jan 29, 2019

ooowow this is great! Is this sort of a "best practices" thing, or something that could be somehow added to the software?

@diegovdc
Copy link
Author

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.

@ojack
Copy link
Member

ojack commented Jan 31, 2019

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!

@ojack
Copy link
Member

ojack commented Jun 30, 2019

Fixed at hydra-synth/hydra-synth#17

@ojack ojack closed this as completed Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants