- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wanted to use the API to create a function (or subroutine) that could be used when defining user parameters.
There are two cases: 1) the function consists only of expressions that can be represented with the existing expression language and 2) the function computation requires some control flow.
The first case could be done completely within your existing expression evaluation engine (i.e., it's a subroutine). If a user invokes a user defined function then you do macro expansion and proceed in the normal fashion. You might require some special syntactic convention for user defined functions (if that helps). But this could hide a great deal of clutter and more importantly facilitate "code-reuse" for the expressions used in user parameters. I have an example where I'm doing non-isomorphic scaling. Each time I do this it only require 3 or 4 sub-expressions, but I do this a dozen (or two dozen) times. If I write it all out manually the clutter is confusing (especially to someone maintaining my design), but worse, I spend a lot of time tracking down silly, but subtle, mistakes.
The second case requires you to call my code. Which is fine by me, but it will prevent you from doing symbolic optimizations (if that is in the roadmap) and it could livelock or deadlock if my code does something unexpected. (And there are security implications).
I've read a bunch in the API document and can't find anyway to do anything like this. Can someone confirm that this is correct, it's not just that I'm overlooking something. I would not argue that this is more urgent than other things, but I had a need. Is it on the roadmap?
Solved! Go to Solution.