MAIN not executed by Factor on command line

让人想犯罪 __ 提交于 2019-12-06 16:25:05

MAIN: defines an entry point for a vocabulary when the vocabulary is passed to run, not necessarily when it is "loaded" from the command line, as you're doing above. The easiest way to make this work is to simply issue "hello" run from the UI listener.

To actually call the hello word as a script, simply place a call in the top level, like so:

USE: io
IN: hello

: hello ( -- ) "Hello World!" print ;

! This is the important part
hello

Alternatively, you can load and run the vocabulary from the command line with the -run=vocab command line argument. For instance, factor -run=hello.

There is some more information on this in the docs. Try running "command-line" about in the listener.

Factor now executes a MAIN function for command line scripts that specify one. (See GitHub)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!