I started learning OCaml several days ago. I installed everything and tested a small program on Atom which worked ok.
But I don't really understand how to work on VSC. I created a file 'test.ml',but how can I run it ?
Thanks in advance
Assuming VSC is Visual Studio Code (and you're on a Unix-like system):
If you want editing support such as auto-completions, you need to install OCaml Platform extension for VS Code by following installation steps outlined here. Note that the instructions indicate that you need to also have ocaml-lsp-server installed.
If you need to run test.ml as a program, you should do in the VS Code terminal:
$ ocamlc -o test test.ml # compile 'test.ml' into an executable 'test'
$ ./test # to run the program
Note that VS Code doesn't have a ready button to run an OCaml file as an executable (not yet at least).
Newcomers to OCaml are recommended to explore language either with ocaml or utop REPL.
How to get utop: Assuming you have opam installed, you should opam install utop. Aforementioned opam is a package manager for OCaml, that can also help you manage OCaml versions and is indispensable if you want to get serious about OCaml development.
Then you'll be able to launch utop in terminal, and inside utop, you can execute test.ml with
#use "test.ml"
assuming that utop was launched from the folder containing test.ml.
You should be able to do the same with ocaml REPL that is installed along with OCaml compiler, but it's much less convenient.
I've used Emacs for all my coding projects so far. Soon I will start some python projects for the first time and would love to stick to Emacs for these as well.
I was looking into elpy which seems to provide already alot of desired functionality. The part I was not able to figure out completely is the following. I like to define virtual environments and python version to be used on a project basis. Let's say I start a project A, then I would use pyenv-virtualenv or pyenv-virtualenvwrapper to set it up
pyenv virtualenv 3.4.2 my-virtual-env-3.4.2
by doing this I've linked the python version 3.4.2 to that specific virtualenv / project. I have two questions regarding this in combination with elpy.
Question: This is a rather basic one. All the above can be achieved via the terminal. What is the advantage to emacs to support this? The workflow for me would be: Create project with associated virtualenv and python version. Activate virtualenv and start coding in emacs. If I need to install a package I will run pip in the terminal to ensure virtualenv is captured properly. There must be a reason why it's beneficial to support this in emacs. With my lack of knowledge I just don't see it :)
As pointed out there is for sure a good reason why we want emacs / elpy to support this. My second question would then be
**Question: How can I achieve this in emacs? Lokks like this blog has a solution. I was wondeirng if someone already tried this setup if it is a neat solution with makes sense conceptually. **
Well I strongly guess the goal is to use more features than just syntax highlighting: flycheck/flake8/linting, refactoring, elpy's test runner to use the right python version, install a pip package directly from emacs, stuff like this. You can carry on doing this in the terminal, but once you want an emacs feature, you'll need to set it up.
I found two modes to do that (see wikemacs python page and doubled-checked on melpa): pyenv-mode (in melpa) and pyenv-mode-auto (change the version when there is a .python-version file).
When compiling a project via a makefile using the Emacs compile command, when gdb is run on the resultant binary the application can be stepped through. However, when building using a large project with SCons, attempting to step through does not work in that Emacs doesn't seem to know which files to load or how they're related to the binary.
What does one have to do to do step through in Emacs? If Emacs can't support SCons natively then how can this be done manually; make must be using some mechanism to alert Emacs to a file's presence.
Are you sure your make and scons compile options are the same? It sounds like your scons build is lacking debug symbols (in gcc, use the -g option).
I don't use Scons. I can't help but ask if you have done the Scons IDEIntegration as given in the Working within Emacs and XEmacs section. It says Scons builds in a different directory that Emacs does not look at by default, so you have to move the files to make Emacs look at them. But that is for navigating through build error messages. I hope it works for gdb too.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 months ago.
Improve this question
I develop applications using PHP or Java and will study Perl for the first time.
For PHP and Java, there are integrated development environments such as Eclipse, and debugging environment was regulated well, but, in the case of Perl, what kind of development environment do people use?
Is there a recommended IDE?
I would prefer a free debugging environment.
As Sinan stated, there are some IDEs for Perl. Padre is worth a mention. It is being actively developed by the Perl community.
From perlfaq3: Is there an IDE or Windows Perl Editor?, where it looks much nicer.
If the Padre people want their stuff in here, just add the right bits. The source lives in my perlfaq github repo. You can fork it, edit the file right in GitHub, and send me a pull request.
Is there an IDE or Windows Perl Editor?
Perl programs are just plain text, so any editor will do.
If you're on Unix, you already have an IDE--Unix itself. The Unix
philosophy is the philosophy of several small tools that each do one
thing and do it well. It's like a carpenter's toolbox.
If you want an IDE, check the following (in alphabetical order, not
order of preference):
Eclipse
The Eclipse Perl Integration Project integrates Perl
editing/debugging with Eclipse.
Enginsite
Perl Editor by EngInSite is a complete integrated development
environment (IDE) for creating, testing, and debugging Perl
scripts; the tool runs on Windows 9x/NT/2000/XP or later.
Komodo
ActiveState's cross-platform (as of October 2004, that's Windows,
Linux, and Solaris), multi-language IDE has Perl support, including
a regular expression debugger and remote debugging.
Open Perl IDE
Open Perl IDE is an integrated development environment for writing
and debugging Perl scripts with ActiveState's ActivePerl
distribution under Windows 95/98/NT/2000.
OptiPerl
OptiPerl is a Windows IDE with simulated CGI environment, including
debugger and syntax highlighting editor.
PerlBuilder
PerlBuidler is an integrated development environment for Windows
that supports Perl development.
visiPerl+
From Help Consulting, for Windows.
Visual Perl
Visual Perl is a Visual Studio.NET plug-in from ActiveState.
Zeus
Zeus for Window is another Win32 multi-language editor/IDE that
comes with support for Perl
For editors: if you're on Unix you probably have vi or a vi clone
already, and possibly an Emacs too, so you may not need to download
anything. In any Emacs, the cperl-mode (M-x cperl-mode) gives you
perhaps the best available Perl editing mode in any editor.
If you are using Windows, you can use any editor that lets you work
with plain text, such as NotePad or WordPad. Word processors, such as
Microsoft Word or WordPerfect, typically do not work since they insert
all sorts of behind-the-scenes information, although some allow you to
save files as "Text Only". You can also download text editors designed
specifically for programming, such as Textpad
and UltraEdit, among others.
If you are using Mac OS, the same concerns apply. MacPerl (for Classic
environments) comes with a simple editor. Popular external editors are
BBEdit or Alpha. Mac OS X users can use Unix editors as well.
GNU Emacs
MicroEMACS
XEmacs
Jed
or a vi clone such as
Elvis FTP, WWW
Vile
Vim
For vi lovers in general, Windows or elsewhere: vi
nvi (available from CPAN in src/misc/) is
yet another vi clone, unfortunately not available for Windows, but in
Unix platforms you might be interested in trying it out, firstly
because strictly speaking it is not a vi clone, it is the real vi, or
the new incarnation of it, and secondly because you can embed Perl
inside it to use Perl as the scripting language. nvi is not alone in
this, though: at least also vim and vile offer an embedded Perl.
The following are Win32 multilanguage editor/IDESs that support Perl:
Codewright
MultiEdit
SlickEdit
There is also a toyedit Text widget based editor written in Perl that
is distributed with the Tk module on CPAN. The ptkdb is a Perl/tk based debugger that acts
as a development environment of sorts. Perl Composer is an IDE for Perl/Tk GUI
creation.
In addition to an editor/IDE you might be interested in a more powerful
shell environment for Win32. Your options include
Bash from the Cygwin package
Ksh from the MKS Toolkit, or the Bourne shell
of the U/WIN environment
Tcsh, see also Using csh & tcsh
Zsh
MKS and U/WIN are commercial (U/WIN is free for educational and
research purposes), Cygwin is covered by the GNU Public License (but
that shouldn't matter for Perl use). The Cygwin, MKS, and U/WIN all
contain (in addition to the shells) a comprehensive set of standard
UNIX toolkit utilities.
If you're transferring text files between Unix and Windows using FTP be
sure to transfer them in ASCII mode so the ends of lines are
appropriately converted.
On Mac OS the MacPerl Application comes with a simple 32k text editor
that behaves like a rudimentary IDE. In contrast to the MacPerl
Application the MPW Perl tool can make use o Shell f the MPW itself as
an editor (with no 32k limit).
Affrus is a full Perl development environment with full debugger support.
Alpha is an editor, written and extensible in Tcl, that nonetheless has built in support for several popular markup and programming
languages including Perl and HTML.
BBEdit and BBEdit Lite are text editors for Mac OS that have a Perl sensitivity mode.
Pepper and Pe are programming language sensitive text editors for Mac
OS X and BeOS respectively.
Perl has very good debugging support. Read perldoc perldebug for details.
There are a bunch of IDEs such as ActiveState's Komodo, EPIC etc but I prefer to combine GVim (see also .vimrc for Perl programmers) with the command line. Others prefer Emacs.
Padre is getting better, but it's currently not quite up there with Komodo or EPIC.
That said, it is comparable with Ultraedit or Notepad++ at this point, less than a year after the first line of code was written.
With about 30 people actively committing, 35-40 plugins either released or in development, and translations in 20 languages, it is also moving ahead incredibly quickly.
So right now, I agree that EPIC is probably the way to go, since you've used Eclipse already.
But by this time next year it's probably going to be a different story.
If you're already familiar with debugging in Eclipse, then the EPIC plugin is exactly what you're looking for.
It's got stepped debugging within the Debug perspective, like with other languages in Eclipse. It's not as strong as the Java support, but it's got an easier learning curve than e.g. "perl -d" (the 'standard' way to debug Perl), or even learning a new editor like Emacs, with its Perl debugging integration.
What I use -- and what I've gotten the impression that most other serious Perl developers use -- is a good text editor. The only "integration" I have is via user-defined tools. For Perl, that's these:
perl -Mstrict -cw <file> # Perl "lint"
perl <file> # run file
perl -d <file> # run file in debugger
I have others for checking files in/out of version control, browsing history, etc. A good configurable editor (I'm partial to UltraEdit) will allow you to build your own environment using the tools you want instead of foisting an all-encompassing solution on you.
Komodo Edit is a free editor from Active State, probably not as feature rich as the full IDE but I find it very useful for Perl development, and it supports multiple languages.
You didn't specify which platform you're on, but on the Macintosh, TextMate is a very popular choice for Perl development. It's completely replaced Vim for me, and while it's not a full IDE, it's got alot of neat integrations in bundles specially targeted towards Perl development.
I'm working on a project that include both Java (on the client side) and Perl (on the server side), and I would really like to use Eclipse to edit my Perl scripts instead of going to another editor. I've tried to use the EPIC plugin. However, I have no way of setting up a run environment for these scripts on my local machine, so the plugin displays all kinds of errors related to missing libraries and other external dependencies.
I just want a text editor with nice syntax highlighting for Perl. Any suggestions? Any way that you can turn off the runtime error checking when using the EPIC plugin? I wasn't able to find anything with a quick search.
It isn't a setting, per se, in the workbench. It's a per-project setting.
While in your Perl project, select Project->Properties. In that dialog, click on "Builders". You probably have just the one-- "Perl Auto Builder". De-select it and click "Ok".
Unfortunately, you'll have to do this for each separate Perl project.
You could try Perlipse, which appears to be an active project.
You didn't indicate your OS. Try Padre - it is cross-platform. It can be installed with the CPAN shell (if you use Strawberry Perl on Windows, you will need at least the version from October). Padre is still rapidly evolving, but already has support for Perl 5 and 6 (6 will require a plugin). HTML, JavaScript and CSS (also with plugins). Many other plugins are already written, for example for Perl::Critic.
Emacs is a great text editor for Perl.
cperl-mode has the best Perl syntax highlighting support of any
editor (even Padre), and Emacs should meet all of your editing needs.
It is easily scriptable, and there are thousands of extensions
available for it. (Some even make support for Perl better, like Stylish::REPL.)
Use EditPlus, simplest editor for syntax highlighting. Works well for Perl.