Once again I am teaching a course on theory of programming languages in which we will use ocaml to implement mini-languages. And once again I face the question: which programming environment should we use?
I have so far tried to use (under Windows) 1. cygwin + ocaml + XEmacs 2. Eclipse + OcaIDE
The second solution worked better than the first, for the simple reason that XEmacs is a complete mystery to students. They really, really hate it. But even with the second soltion we had a lot of trouble, because Eclipse is really complicated, and OcaIDE is sort of experimental and not so good under Windows, so the whole setup was confusing and fragile.
The requirements are very simple: 1. easy access to toplevel (with line-editing) 2. editor which can send stuff to toplevel, points to errors in source code, and is not Emacs.
Any ideas what to do? We have dual-boot machines (Windows + Ubuntu).
Have you tried configuring a recent GNU Emacs to work like a normal editor? (e.g. with C-c, C-v editing shortcuts etc.) This shouldn't be difficult.
On Fri, Sep 26, 2008 at 1:30 PM, Andrej Bauer
<Andrej.Ba...@fmf.uni-lj.si> wrote: > Once again I am teaching a course on theory of programming languages in > which we will use ocaml to implement mini-languages. And once again I face > the question: which programming environment should we use?
> I have so far tried to use (under Windows) > 1. cygwin + ocaml + XEmacs > 2. Eclipse + OcaIDE
Depending on how flexible you are, nedit + shell might be a workable choice. It is a clean, intuitive, but sufficiently powerful editor. Emacs always left me annoyed.
I use, on a daily basis, a small script which acts as a front-end to `make' and automatically points you to the error in the code in nedit, highlighting the characters that the ocaml compiler complains about. It uses the existing nedit window if you have the file open already, or else opens it for you. The script also works with gcc instead of ocaml, and (though I can't vouch for it much) gvim instead of nedit. So my typical development environment consists of nedit and a shell in which I compile via the script.
If anyone is interested, I'd be happy to share this.
I guess the main question would be integrating the toplevel with nedit. I imagine there are a number of ways to do this, depending on your needs. You might be able to put something together using nedit's scripting language, or just do something entirely external to the editor.
> Once again I am teaching a course on theory of programming > languages in which we will use ocaml to implement mini-languages. > And once again I face the question: which programming environment > should we use?
> I have so far tried to use (under Windows) > 1. cygwin + ocaml + XEmacs > 2. Eclipse + OcaIDE
> The second solution worked better than the first, for the simple > reason that XEmacs is a complete mystery to students. They really, > really hate it. But even with the second soltion we had a lot of > trouble, because Eclipse is really complicated, and OcaIDE is sort > of experimental and not so good under Windows, so the whole setup > was confusing and fragile.
> The requirements are very simple: > 1. easy access to toplevel (with line-editing) > 2. editor which can send stuff to toplevel, points to errors in > source code, and is not Emacs.
> Any ideas what to do? We have dual-boot machines (Windows + Ubuntu).
Andrej Bauer wrote: > Once again I am teaching a course on theory of programming languages in > which we will use ocaml to implement mini-languages. And once again I > face the question: which programming environment should we use?
> I have so far tried to use (under Windows) > 1. cygwin + ocaml + XEmacs > 2. Eclipse + OcaIDE
> The second solution worked better than the first, for the simple reason > that XEmacs is a complete mystery to students. They really, really hate > it. But even with the second soltion we had a lot of trouble, because > Eclipse is really complicated, and OcaIDE is sort of experimental and > not so good under Windows, so the whole setup was confusing and fragile.
I am a satisfied user of Eclipse + OcaIDE on Ubuntu (64bit). Considering I am (still) a "newbie" in regards to Ocaml and functional programming in general, and have a allergy towards emacs, vi and friends, I would urge you to reconsider OcaIDE + Ubuntu.
To make things simpler you may: 0. Use ocamlbuild projects only. 1. Prepare ocamlbuild files (tags and myocamlbuild) if necessary. 2. Provide a workspace with an example project ready for compilation. 3. Let the students use only one project with various source files.
Point (0) will significantly ease the students experience if they need not configure any build files. Points (1) and (2) allow you to add references to used modules, libraries, etc. All the students do is create a new file, compile and execute.
Point (3) is easy because students need only add a single entry in the project properties dialogue box (Project targets). They need only then point and click on the executable to execute and/or debug.
Andrej Bauer wrote: > Hugo Ferreira wrote: >> To make things simpler you may: >> 0. Use ocamlbuild projects only. >> 1. Prepare ocamlbuild files (tags and myocamlbuild) if necessary. >> 2. Provide a workspace with an example project ready for compilation. >> 3. Let the students use only one project with various source files.
> Yes, we do all of this, but unfortunately ocamlbuild under Windows sucks > because the trick with symbolic links to executables does not work.
Yes, I am aware of this. Seen the reports in the forum.
> Has > this been fixed yet? (Also, ocamlbuild assumes bash is in the path, also > under Windows.)
Not that I am aware of. Their is a version that has *not* been put up onto the update site [1]. Maybe this may have additional corrections.
Please note that I am proposing you use Ubuntu because you mentioned dual boot machines:
"Any ideas what to do? We have dual-boot machines (Windows + Ubuntu)."
BTW, I just remembered that I use GODI. Don't know if that is possible for you.
If you have dual-boot machines, why not try Ocaml + Emacs + tuareg-mode in Ubuntu?
You can install tuareg-mode globally so that no one has to touch a .emacs or know about it. If it's the keyboard shortcuts that students are not used to, they can 1) deal or 2) you can remap some common shortcuts and wrap it in a shell script so they run Emacs-for-class instead of standard Emacs. Personally, I think they should just deal. A little exposure to a non-Windows environment, a little broadening of horizons, all good stuff.
When I took a programming languages class at UIUC, that is how we learned OCaml. I found it quite easy to pick up. Emacs has the best toplevel integration with OCaml and it sounds like you want to make heavy use of it.
Peng
PS. I just looked at IDLE and Emacs + OCaml blows it out of the water. I swear IDLE is like a mini-subset of Emacs. Even the keyboard shortcuts are the same. If you like IDLE, Emacs + OCaml can only be better.
On Friday 26 September 2008 07:30:00 am Andrej Bauer wrote:
> Once again I am teaching a course on theory of programming languages in > which we will use ocaml to implement mini-languages. And once again I > face the question: which programming environment should we use?
> I have so far tried to use (under Windows) > 1. cygwin + ocaml + XEmacs > 2. Eclipse + OcaIDE
> The second solution worked better than the first, for the simple reason > that XEmacs is a complete mystery to students. They really, really hate > it. But even with the second soltion we had a lot of trouble, because > Eclipse is really complicated, and OcaIDE is sort of experimental and > not so good under Windows, so the whole setup was confusing and fragile.
> The requirements are very simple: > 1. easy access to toplevel (with line-editing) > 2. editor which can send stuff to toplevel, points to errors in source > code, and is not Emacs.
> Any ideas what to do? We have dual-boot machines (Windows + Ubuntu).
On Fri, Sep 26, 2008 at 01:52:33PM +0200, Andrej Bauer wrote: > My teaching asistant showed the students how to do this, but it was only > partially successful, not to mention that this required extra > configuration. _Any_ initial configuration is a big pain, even just > putting a line in .emacs is a challenge ("Where is this file?", "How can > it have just an extension and no name?", "Why is the extension longer > than three letters", etc.)
I think I may have suggested this the last time, but is some sort of bootable live CD / live USB key an option? Our livecd-creator tool is especially flexible: you could build a live CD / key which has all the right packages installed and all the configuration files in the right place and starts up the editor of your choice when they log in.
> On Fri, Sep 26, 2008 at 01:52:33PM +0200, Andrej Bauer wrote: > > My teaching asistant showed the students how to do this, but it was only > > partially successful, not to mention that this required extra > > configuration. _Any_ initial configuration is a big pain, even just > > putting a line in .emacs is a challenge ("Where is this file?", "How can > > it have just an extension and no name?", "Why is the extension longer > > than three letters", etc.)
> I think I may have suggested this the last time, but is some sort of > bootable live CD / live USB key an option? Our livecd-creator tool is > especially flexible: you could build a live CD / key which has all the > right packages installed and all the configuration files in the right > place and starts up the editor of your choice when they log in.
Your problem is simplified by the fact you already have dual boot machines (if not, Richard's live CD idea is always a good option). Unix is Ocaml's natural habitat, and some of the problems you mentioned (like symlinks for Ocamlbuild) would simply go away if you boot into Ubuntu.
I got the impression your students are not too familiar with Unix. Well, if that's the case I think in the long term they can only benefit by being exposed to it. I once had to teach 3rd year Compsci students the fundamentals of Unix programming in C. Much to my surprise, some of them didn't even know how to use basic shell commands or to invoke gcc! I guess my predecessors had sheltered them too much from the "big bad Unix".
Now, I understand you may be reluctant to spend valuable class time teaching them the rudiments of Unix, but I reckon that if you provide them with the relevant configuration files they can be up and running in less than half an hour. And I bet that some of them may even discover that they prefer Unix.
Make sure your OCaml has prerequisites that involve some shittier language like C, which is taught in a Unix environment with xemacs. Once the students have seen how awful it can get and they associate the terrible learning experience with C (what's with the lack of love for emacs anyway? =/), then you come to the rescue. :-D
Btw, I wouldn't try to use OCaml with Ubuntu, or *any* recent language that has been in development. Support is generally flaky. The mainline OCaml that comes with Ubuntu is fine, but the gl+gtk support is broken. The version of Eclipse that ships with Ubuntu is freaking ancient and won't support the Scala plugin. From what I remember, 8.0.4 also shipped with some fossilized version of Scala itself.
On Fri, Sep 26, 2008 at 6:33 AM, Andrej Bauer <Andrej.Ba...@fmf.uni-lj.si>wrote:
>> To make things simpler you may: >> 0. Use ocamlbuild projects only. >> 1. Prepare ocamlbuild files (tags and myocamlbuild) if necessary. >> 2. Provide a workspace with an example project ready for compilation. >> 3. Let the students use only one project with various source files.
> Yes, we do all of this, but unfortunately ocamlbuild under Windows sucks > because the trick with symbolic links to executables does not work. Has this > been fixed yet? (Also, ocamlbuild assumes bash is in the path, also under > Windows.)
On Fri, Sep 26, 2008 at 09:15:14AM -0700, Arthur Chan wrote: > Make sure your OCaml has prerequisites that involve some shittier language > like C, which is taught in a Unix environment with xemacs. Once the > students have seen how awful it can get and they associate the terrible > learning experience with C (what's with the lack of love for emacs anyway? > =/), then you come to the rescue. :-D
For extra points, make sure they have to ensure that every error is checked and every error path out of the function must free up all resources that have been allocated ...
> Btw, I wouldn't try to use OCaml with Ubuntu, or *any* recent language that > has been in development. Support is generally flaky. The mainline OCaml > that comes with Ubuntu is fine, but the gl+gtk support is broken. The > version of Eclipse that ships with Ubuntu is freaking ancient and won't > support the Scala plugin. From what I remember, 8.0.4 also shipped with > some fossilized version of Scala itself.
[I'm going to diss Ubuntu here ... you know where I'm coming from]
Ubuntu's OCaml support is very flaky. They don't have developers committed to it and take a random snapshot of what's in Debian. This has in the past led to serious brokenness where they've taken a snaphot in the middle of a rebuild-the-world compiler upgrade. Instead go with Debian (or Fedora) where there are developers making sure you get a consistent, working OCaml.
Arthur Chan wrote: > I think we should think outside the box here.
Yes, this really is "outside the box": you suggest I should not use Ubuntu+Eclipse to teach ocaml because it does not support Scala, and you tell me I should teach C before I teach ocaml just so that people see how bad C is. Definitely outside the box ;-)
I only need pure ocaml, no graphics, no gui, no OS, no threads, just happy little language implementations (see http://andrej.com/plzoo/).
On Fri, Sep 26, 2008 at 06:17:29PM +0200, Andrej Bauer wrote: > By the way, Live CD is not really an option. I suspect the computer lab > computers are "protected" against that.
If you've got qemu installed in Ubuntu then:
qemu -m 512 -cdrom livecd.iso -boot d
You don't even need to be root. (Of course, if they have to type this at a command prompt, arguably you've lost the battle.)
On Friday 26 September 2008 12:17:29 pm Andrej Bauer wrote:
> As far as I see, there are two options:
> 1) Windows + Eclipse + OcaIDE
> 2) Linux.
> The students know next to nothing about Unix. If I dive into using > Linux, then I might as well setup anonymous subversion access to source > code. They could use gedit for editing (it has ocaml syntax hilight > mode), and the shell for ocamlbuild. The only unresolved question is how > to deal with compilation errors.
I want to say use Emacs here. You can configure it behave like gedit if you really want. Buut, I get the impression you're not willing to consider Emacs for whatever reason. So, if gedit has a programmatic interface you can write shell script to parse the compilation errors (just look for line numbers) and send a command to gedit to go to the appropriate line. I don't know if gedit has that capability, but certainly there may be other text editors that do.
> The generation that I am getting is very small (maybe 10 students), so > this might be doable with such a small number.
> I will think about it. Thanks for your suggestions.
> By the way, Live CD is not really an option. I suspect the computer lab > computers are "protected" against that.
That's too bad. But definitely find out, the Live CD option is great. Next to zero work for a perfect setup.
On Fri, Sep 26, 2008 at 09:15:14AM -0700, Arthur Chan wrote: > Btw, I wouldn't try to use OCaml with Ubuntu, or *any* recent language that > has been in development. Support is generally flaky. The mainline OCaml > that comes with Ubuntu is fine, but the gl+gtk support is broken. The
FWIW, OCaml support in Debian is on the other hand quite good (or at least that's what our users let us maintainers perceive), hence in theory one can imaging using Ubuntu with legacy Debian OCaml packages.
I believe that out of the box that could be tricky to achieve if one has already enabled Ubuntu universe (as there is no guarantee that the versions in Debian will be considered by apt higher than those in Ubuntu). Still, with pinning one can prioritize OCaml packages coming from Debian.
Actually, if anyone find a good setup for that, it is worth a FAQ entry somewhere (it will diminish the number of Ubuntu users complaining for bad OCaml support).
Cheers.
-- Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7 zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/ I'm still an SGML person,this newfangled /\ All one has to do is hit the XML stuff is so ... simplistic -- Manoj \/ right keys at the right time
Have you considered DrOCaml? It builds on top of the pedagogically oriented DrScheme environment. I think they've been using it at Brown for a year or two now, to good effect. I think Shriram Krishnamurthi is the guy at Brown who ran the class, so you should ask him.
I agree that getting a good pedagogical IDE for OCaml is an important goal. We'd love to fund a summer project working towards that goal. I suspect DrOCaml is the best step in that direction so far.
y
On Fri, Sep 26, 2008 at 8:41 AM, Andrej Bauer <Andrej.Ba...@fmf.uni-lj.si>wrote:
> How can there be no easy to use interface?! This is pathetic.
> Python has IDLE. Scheme has drscheme. Java has drjava. What does Haskell > have?
> I compiled Camelia (which required me to debug C++ code for the first time > in about 20 years). It's kind of ok. The user interface is a bit broken, > lots of uneccessary pop-up dialogs (e.g., for every error message).
Stefano Zacchiroli wrote: > On Fri, Sep 26, 2008 at 09:15:14AM -0700, Arthur Chan wrote: >> Btw, I wouldn't try to use OCaml with Ubuntu, or *any* recent language that >> has been in development. Support is generally flaky. The mainline OCaml >> that comes with Ubuntu is fine, but the gl+gtk support is broken. The
> FWIW, OCaml support in Debian is on the other hand quite good (or at > least that's what our users let us maintainers perceive), hence in > theory one can imaging using Ubuntu with legacy Debian OCaml packages.
After teaching OCaml for two years, I personally suggest * Ubuntu + GODI * Emacs + Emacs-goodies (slightly customised to obtain tabs, I can send you my .emacs) + Tuareg -- (Emacs is much better than XEmacs, at least for this -- and the tabs are a tremendous help) * OcamlBuild with a myocamlbuild.ml written by you.
On Fri, 2008-09-26 at 13:30 +0200, Andrej Bauer wrote: > Once again I am teaching a course on theory of programming languages in > which we will use ocaml to implement mini-languages. And once again I > face the question: which programming environment should we use?
> I have so far tried to use (under Windows) > 1. cygwin + ocaml + XEmacs > 2. Eclipse + OcaIDE
> The second solution worked better than the first, for the simple reason > that XEmacs is a complete mystery to students. They really, really hate > it. But even with the second soltion we had a lot of trouble, because > Eclipse is really complicated, and OcaIDE is sort of experimental and > not so good under Windows, so the whole setup was confusing and fragile.
> The requirements are very simple: > 1. easy access to toplevel (with line-editing) > 2. editor which can send stuff to toplevel, points to errors in source > code, and is not Emacs.
> Any ideas what to do? We have dual-boot machines (Windows + Ubuntu).
Camelia worked rather nicely for me under Windows. The required setup was not quite compatible with my needs, though, so I dropped it.
Cheers, David
On Fri, 2008-09-26 at 14:41 +0200, Andrej Bauer wrote: > How can there be no easy to use interface?! This is pathetic.
> Python has IDLE. Scheme has drscheme. Java has drjava. What does Haskell > have?
> I compiled Camelia (which required me to debug C++ code for the first > time in about 20 years). It's kind of ok. The user interface is a bit > broken, lots of uneccessary pop-up dialogs (e.g., for every error message).
<Andrej.Ba...@fmf.uni-lj.si> wrote: > Once again I am teaching a course on theory of programming languages in > which we will use ocaml to implement mini-languages. And once again I face > the question: which programming environment should we use?
I used to use nedit + shell and it worked quite well. I've got a good syntax highlighting mode and some support scripts. These days I've switched to jEdit but I use much the same workflow. It *is* possible to use the "console" and "error list" plugins for jedit to build programs and get automatic error message highlighting, but the OCaml error format makes it a bit sub-optimal. If you want to try it I can tell you how to configure things. You would still need to run the toplevel in an external shell.
The nice thing about jEdit is that it's cross-platform and not quite as bloated as Eclipse.
Also, using omake for your build system has some nice advantages. The '-P' flag causes the project to automatically rebuild when any project file changes on disk. After you fix a bug the next error message is already waiting for you.
Arthur Chan wrote: > Btw, I wouldn't try to use OCaml with Ubuntu,
I find the Ocaml support on Ubuntu to be excellent. This is mainly due to the hard word of the Debian Ocaml maintainers.
> Support is generally flaky.
Sorry, thats not my experience.
> The mainline OCaml that comes with Ubuntu is fine, but the gl+gtk > support is broken.
Use both lablgl and lablgtk (but not together) without problems.
What exactly is broken. Have you logged a bug with Ubuntu or with the Debian Ocaml maintainers.
> version of Eclipse that ships with Ubuntu is freaking ancient and won't > support the Scala plugin. From what I remember, 8.0.4 also shipped with > some fossilized version of Scala itself.
I don't use Scala or Eclipse so I can't comment on that.
Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "If you need a piece of paper and a pen to explain it, then its not bleedin' obvious" -- Erik's First Law