How can I customize the SML/NJ interactive loop?

房东的猫 提交于 2019-12-05 20:13:23

How do I make this all load automatically at runtime so that when I invoke "sml" it's in my default environment?

You need to create a heap image to be run by the sml script, which you can then symbolically link to. To avoid complications of bootstrapping, I usually give my heap image a different name; for example; sml-nw for SML/NJ with support for noweb.

The basic primitive you need to create a heap image is SMLofNJ.exportML. Here's how you use it:

  1. Set up everything the way you want it by, e.g., open IntInf and setting all your Control.Print variables. (You could try setting Control.Printthings tovalOf Int.maxInt`, which is the closest thing to infinity.)

  2. Create a new heap image by SMLofNJ.exportML "mysml". When you start your customized version, you'll begin right after the call to exportML. Read the documentation. Play around; there are a lot of ways to use this primitive.

  3. Copy the heap image (maybe mysml.x86-linux) to the installation directory for heap images (on my installation, /usr/lib/smlnj/bin/.heap, but you can follow clues in the sml script to be sure)

  4. Create a script mysml that is a symbolic link to the sml script.

In the old days this was enough, but I haven't been using SML/NJ for several years now. I also found a somewhat outdated example on the web.

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