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](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]()
    
    
    Run

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.

Reply via email to