ele*_*ele 2 textmate node.js coffeescript read-eval-print-loop
请原谅noob问题,但为什么我不能(几乎)从coffeeREPL中调用(几乎)任何标准函数(或者从TextMate中编写并运行的文件)?
变量赋值工作,函数没有.
例子:
coffee> string = "string"
'string'
coffee> list = [1,2,3]
[ 1, 2, 3 ]
coffee> num = 42
42
coffee> opposite = true
true
coffee> num = -42 if opposite
-42
Run Code Online (Sandbox Code Playgroud)
但
coffee> alert "Hello, World"
ReferenceError: alert is not defined
at repl:1:5
at REPLServer.replDefaults.eval (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:33:28)
at repl.js:239:12
at Interface.<anonymous> (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:62:9)
at Interface.EventEmitter.emit (events.js:117:20)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:117:20)
Run Code Online (Sandbox Code Playgroud)
和
coffee> print "Hello"
ReferenceError: print is not defined
at repl:1:5
at REPLServer.replDefaults.eval (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:33:28)
at repl.js:239:12
at Interface.<anonymous> (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:62:9)
at Interface.EventEmitter.emit (events.js:117:20)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:117:20)
Run Code Online (Sandbox Code Playgroud)
真正让我感到的是:
coffee> console.log "Help!"
Help!
undefined
Run Code Online (Sandbox Code Playgroud)
我通过Homebrew和CoffeeScript安装了Node(全局)通过npm.
| 归档时间: |
|
| 查看次数: |
1499 次 |
| 最近记录: |