一个 REPL 将它们全部绑定? [英] One REPL to bind them all?

查看:14
本文介绍了一个 REPL 将它们全部绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有不特定于语言的 REPL.我花了很多时间研究 REPL(主要用于 Clojure、Scala 和 Haskell),而捆绑的那些或多或少都让我感到沮丧.REPL 的工作似乎非常通用,因为它们:

I'd like to know if there is a REPL which is not language-specific. I spend a lot of time dipping in and out of REPLs (mainly for Clojure, Scala and Haskell), and the bundled ones all frustrate me to a greater or lesser extent. It seems like the job of a REPL is quite generic in that they:

  • 阅读:获取用户输入
  • 评估:将输入传递给某个运行时进行处理
  • 打印:将结果打印到屏幕上
  • 循环:等待下一个用户输入

我不明白为什么不应该有一些与语言无关的 REPL,但我一直找不到这样的东西.我在理想的 REPL 中想要的一些东西:

I don't see why there shouldn't be some language-agnostic REPL, but I have been unable to find such a thing. Some things I would like in my ideal REPL:

  • Linux 命令行应用程序
  • 通过向上箭头可访问无限历史
  • 能够在重新运行之前编辑以前的命令
  • ctrl-r 用于历史搜索 就像 bash 一样
  • 一个 REPL 中有多个会话,因此我可以轻松地在它们之间切换

更乐观

  • 语法高亮、上下文感知代码完成

这个存在吗?

推荐答案

Bash 对 Cr 一无所知:它使用 readline,它可以做到这一点,以及向上箭头历史,对于它.听起来您正在寻找的 REPL 是 readline?只需使用 rlwrap 为您想要类似 REPL 的行为的命令添加前缀(如果您没有它,请安装它 - 这很棒),您应该很高兴.

Bash doesn't know anything about C-r: it uses readline, which does that, as well as up-arrow history, for it. It sounds like the REPL you're looking for is readline? Just prefix the command you want REPL-like behavior from with rlwrap (install it if you don't have it - it's great), and you should be good to go.

$ rlwrap java -jar clojure.jar

这篇关于一个 REPL 将它们全部绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆