#156 eval() macro

open
nobody
None
5
2007-01-19
2007-01-19
Bert Wesarg
No

unlike any other interpreted language, the nedit macro language suffer from the eval() function. so here is a rough copy'n'paste patch

syntax:
eval(string)

Discussion

  • Bert Wesarg
    Bert Wesarg
    2007-01-19

     
    Attachments
  • Thorsten Haude
    Thorsten Haude
    2007-01-20

    Logged In: YES
    user_id=119143
    Originator: NO

    Good thing!

     
  • Bert Wesarg
    Bert Wesarg
    2007-01-20

    Logged In: YES
    user_id=122956
    Originator: YES

    the most natural macro menu entry:

    eval:Alt+E:e:: {\n\ macro = string_dialog("Enter Macro to execute:", "Execute", "Cancel")\n\ if ($string_dialog_button == 1 && macro != "") {\n\ eval(macro)\n\ }\n\ }\n

     
  • Bert Wesarg
    Bert Wesarg
    2007-01-21

    Logged In: YES
    user_id=122956
    Originator: YES

    Note: this isn't the way an eval() should work, its a function not a language construct, so its not possible to write something like this:

    define test {
    eval("t_print(\"test called with \" $n_args \" arguments\")")
    }

    eval() should execute the argument in the current frame and not start a new one. so this should pushed down to the parser/interpreter level.