ID:2960996
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
It's currently not possible to use call() with (most? all?) built-in global functions.

We can give them wrapper procs in user code, but that has its issues — not least that special cases have to be reimplemented and we don't have some niceties like arglist for brevity.

Taking rand as an example:
/proc/callable_rand(L, H)
return rand(L, H)
- Cannot produce a float without a second call; rand() seems distinct from rand(...) at compile.
- Doesn't match the documented behavior with arguments. We need to make it run from 0 to L when H is null.
Leaving us with
/proc/callable_rand(L, H)
if (isnull(H))
if (isnull(L))
return rand()
H = L
L = 0
return rand(L, H)
Not terrible (outside of bugbait callable_rand(null, null) being indistinguishable from callable_rand(); c'est la vie), but that's a simpler example and covering the whole API introduces a maintenance burden while presumably losing twice over to compiled uses on performance.

I don't keep up with dm to bytecode stuff. From the exhibited behavior I think they're part of the language as macros protected by keywords, so I could see this being a non-starter for a couple of reasons. Even so, worth an ask.

Login to reply.