You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should allow for developers to re-use common expressions, thus allowing them to avoid copy-pasting functionality in the layout files. How we achieve this is up to those who should implement it, but my suggestion is below:
Suggested solution
We add a new file that can be configured on the top-level of each app, which contains a simple JSON object with function names as keys and expressions as values. Upon loading the app, app-frontend-react asks the backend for this file (if the feature is implemented there), and loads it.
Loading the file populates a user-provided set of functions into the expression engine. If any custom function conflicts with our internal function names, user expressions should always load the custom expression - but our own implementation should always run the hard coded expression. That way we should allow for forwards-compatibility in such a way that we can supply new functions without checking if any app already defines that function - a function call in an app would simply use the custom function and the app developer would need to rename it to start using ours. But in cases where our own engine calls other functions, that should not crash if a custom function has been provided.
New functionality needed
argv function, to fetch any arguments in a custom function and use them as parameters/manipulate them.
Example
This implements a custom function with the signature ["max", number, limit] which returns the input number, but limits it to limit.
We should allow for developers to re-use common expressions, thus allowing them to avoid copy-pasting functionality in the layout files. How we achieve this is up to those who should implement it, but my suggestion is below:
Suggested solution
We add a new file that can be configured on the top-level of each app, which contains a simple JSON object with function names as keys and expressions as values. Upon loading the app,
app-frontend-react
asks the backend for this file (if the feature is implemented there), and loads it.Loading the file populates a user-provided set of functions into the expression engine. If any custom function conflicts with our internal function names, user expressions should always load the custom expression - but our own implementation should always run the hard coded expression. That way we should allow for forwards-compatibility in such a way that we can supply new functions without checking if any app already defines that function - a function call in an app would simply use the custom function and the app developer would need to rename it to start using ours. But in cases where our own engine calls other functions, that should not crash if a custom function has been provided.
New functionality needed
argv
function, to fetch any arguments in a custom function and use them as parameters/manipulate them.Example
This implements a custom function with the signature
["max", number, limit]
which returns the input number, but limits it tolimit
.The text was updated successfully, but these errors were encountered: