Forum Discussion
EnTerr
9 years agoRoku Guru
Hey RokuJoel -
thanks for bringing this feedback! Alas, it does not help - since they did not address what was asked about, which is how to "inject" functions into an existing node. Luckily though I think we clarified the issue at hand in discussion with TheEndless (incl. some vigorous exchange behind the scenes) - and it seems there is no way currently in SG to do that.
My request therefore would be to consider adding the ability to dynamically add functions to components just like that can be already done with fields and children - can you pass that one up?
I think the easiest way would be to add "function" value type to the supported SG interface types (it's a primitive type like integer/float/string/boolean - plus immutable) and then to just use addField()/setField(), i.e. treat them as first-class citizens (aka 1st-class functions), see explanation above viewtopic.php?f=34&t=95412#p533852
I know, i know - the first reaction of SG engineer would be to wince, since that would mean functions can be transferred between interpreter contexts/threads - but if they could please, please give it a second thought! - functions are already immutable, non-GC-able literals in B/S, which makes them SAFE to share between threads, with no side effects nor race conditions! No extra compilation either...
thanks for bringing this feedback! Alas, it does not help - since they did not address what was asked about, which is how to "inject" functions into an existing node. Luckily though I think we clarified the issue at hand in discussion with TheEndless (incl. some vigorous exchange behind the scenes) - and it seems there is no way currently in SG to do that.
My request therefore would be to consider adding the ability to dynamically add functions to components just like that can be already done with fields and children - can you pass that one up?
I think the easiest way would be to add "function" value type to the supported SG interface types (it's a primitive type like integer/float/string/boolean - plus immutable) and then to just use addField()/setField(), i.e. treat them as first-class citizens (aka 1st-class functions), see explanation above viewtopic.php?f=34&t=95412#p533852
I know, i know - the first reaction of SG engineer would be to wince, since that would mean functions can be transferred between interpreter contexts/threads - but if they could please, please give it a second thought! - functions are already immutable, non-GC-able literals in B/S, which makes them SAFE to share between threads, with no side effects nor race conditions! No extra compilation either...
Related Content
- 10 months ago
- 2 years ago
- 11 months ago