加快Erlang编辑,编译,运行/调试循环 [英] Speeding up the Erlang Edit, Compile, Run/Debug cycle

查看:214
本文介绍了加快Erlang编辑,编译,运行/调试循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑Erlang应用程序的最快方式是什么,编译代码并查看运行结果?最好在最后一步跳进Erlang shell。

What is the fastest way to edit an Erlang application, compile the code and see the running result? Preferably jumping in the Erlang shell on the last step.

我目前的新手设置:


  • 编译应用程序并启动erl shell的脚本。

  • 然后我输入应用程序:start(foo)。

  • 当我修复打字错误时,我用c('module')和重新启动应用程序。

有更快的方法吗? BTW。我的编辑器是Emacs。

Is there a faster way? BTW. my editor of choice is Emacs.

推荐答案

这是我的设置:


  • 在开发过程中,我将Erlang shell在一个单独的终端窗口中打开。

  • 我从编辑器开始编译(使用组合键)在源目录中输入 make

  • 编译后,我可以通过键入 l一次加载所有更改的模块()在Erlang shell中。你可以在这里找到这个和其他一些有用的宏: http://www.snookles.com/erlang/ user_default.erl

  • While developing, I keep the Erlang shell open in a separate terminal window.
  • I start compilation from the editor (using an key combination), or just by typing make in the source directory.
  • After compilation, I load all changed modules at once by typing l() in Erlang shell. You can find this and some other useful macros here: http://www.snookles.com/erlang/user_default.erl

很少需要重新启动整个Erlang应用程序。重新加载更改的模块是一个更常见的用例,通常足以应用您的更改。

There's rarely a need to restart the whole Erlang application. Reloading changed modules is a more common use-case and it is usually enough to apply your changes.

关于应用程序启动:如果您的应用程序依赖于其他应用程序,应用程序:启动()将失败,直到您启动所有依赖关系。因此,编写助手函数< your-app-name>:start()是很常见的。以下是示例。另一个有用的功能是< your-app-name>:stop()

Regarding application start: if your application depends on other applications, application:start() will fail, until you start all the dependencies. Because of that, it is common to write a helper function <your-app-name>:start(). Here's an example. Another useful function is <your-app-name>:stop().

工作流将如下所示:


  • 启动Erlang shell并保持打开;键入< your-app-name>:start()。

  • 进行更改;运行汇编在您的Erlang shell中键入 l()

  • 当更改需要重新启动应用程序时,键入< your- app-name>:stop(),< your-app-name>:start()。

  • Start the Erlang shell and keep it open; type<your-app-name>:start().
  • Make changes; run compilation; type l() in your Erlang shell.
  • When changes require application restart, type <your-app-name>:stop(), <your-app-name>:start().

这篇关于加快Erlang编辑,编译,运行/调试循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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