Hello is it possible to encapsulate the name of a PROC in a string field, then call a proc directly with this field in OS400 it is possible to do ex: call "pgdate" or call &var directly without making a 'CASE / IF' field etc ...
or example: file field.type (country) field.proc (pgspecific control) access file country call field.proc
One way to do that is to add them to some sort of structure like a hash table:
https://play.nim-lang.org/#ix=2m18
import tables
var calls: Table[string, proc()]
proc hi() = echo "hi"
proc bye() = echo "bye"
calls["hi"] = hi
calls["bye"] = bye
let s = "bye"
calls[s]()
Nim is not a dynamic language so you kind of have to implement/fake dynamic language features.
Why do you want todo that? There might be better static and idiomatic ways to accomplish what you want.
Thank you for answer ;)
I make a software, or I would like to give the possibility of putting a proc in a field, to make a little as I described, that would open important perspectives.
Thank you for answer ;)
I make a software, or I would like to give the possibility of putting a proc in a field, to make a little as I described, that would open important perspectives.