User loginNavigation |
Nesting imperative into functional codeDid you ever try to do that? Nesting functional into imperative code is easy, you just do the FP magic when you call the function. But how to do it the other way around? Assume that you have a functional code as a base and some imperative code here and there, maybe even stored as strings in variables. Now you have to call something like Javascript "eval" when you want to run the imperative code. But when to do it? Note that imperative code doesn't have to be in a form of a function that returns some value. It can setup some event actions or mess around with some shareable memory states. When to call such an imperative processes? I guess some event would apply, but what? In fact I'm working on a functional language that can easily translate any abstract syntax tree (AST) into another AST. The language is interpreted inside javascript (maybe I'll try to do a native version in the future) and in a runtime of interpreting it I want to occasionally translate arbitrary imperative language AST into javascript AST (or assembler AST in the future) and execute it. The problem is how and when to trigger this execution. Maybe someone could help me with this problem? By Ivan V. at 2015-11-29 22:35 | LtU Forum | previous forum topic | next forum topic | other blogs | 10061 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
23 weeks 30 min ago
23 weeks 36 min ago
45 weeks 1 day ago
49 weeks 3 days ago
51 weeks 8 hours ago
51 weeks 8 hours ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago