开发者

Auto-self modifying function in virtual runtime environment in Rebol

开发者 https://www.devze.com 2023-01-26 18:08 出处:网络
I want to auto-modify a function once it has executed itself (context is remote execution in a virtual runtime environment that shares a code-block which simulate stack of functions (because this stac

I want to auto-modify a function once it has executed itself (context is remote execution in a virtual runtime environment that shares a code-block which simulate stack of functions (because this stack is shared I want to reset everything each time for next command call) see http://askblogautomation.com/developer开发者_运维知识库s-guide/) like this for example ( for full context see http://askblogautomation.com/install-wordpress/):

install-wordpress
set 'install-wordpress func[][do read http://askblogautomation.com/install-wordpress/]

I want to genericize the above lines with

execute 'install-wordpress

Where execute is as below

execute: func[lit-word-command [lit-word!]][
  do get lit-word-command
  block-command: []
  append block-command [do read]
  append block-command to-url rejoin [http://askblogautomation.com/ lit-word-command]
  set lit-word-command func[] block-command
]

But when I tried it, it gives error:

** Script Error: execute expected lit-word-command argument of type: lit-word

How to fix this ?


Either change the invoking line:

 execute to-lit-word 'install-wordpress

Or change the function spec:

execute: func[lit-word-command [word!]][

But not both!

0

精彩评论

暂无评论...
验证码 换一张
取 消