List Info

Thread: "ocaml_beginners"::[] stream syntax




"ocaml_beginners"::[] stream syntax again
user name
2006-11-24 12:04:36

On Fri, Nov 24, 2006 at 11:46:40AM +0100, Francois Colonna wrote:
> adding #load "camlp4o.cma";;
> helps in the socalled toplevel mode not in "batch" mode.

The '#...' directives only work in the toplevel. The main compiler
has several command line options to get the same effect. Take a look
at the manual here:

http://caml.inria.fr/pub/docs/tutorial-camlp4/tutorial001.html#toc2

Rich.

--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] stream syntax again
user name
2006-11-24 15:20:46

On Friday 24 November 2006 13:22, Chad Perrin wrote:
> considering the ml at the end of the language name OCaml stands
> for "meta-language"

It doesn't.

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] stream syntax again
user name
2006-11-24 21:23:02

On Fri, 24 Nov 2006, Francois Colonna wrote:

> Thanks for the reference.
> I do not understand why should I preprocess the *.ml file to use streams.
> Streams are part of the language, aren't they ?

Kind of
The Stream module is part of the standard library and allows to
manipulate streams without a particular syntax, which is not very
convenient.

That said, there has always been a special syntax to manipulate streams,
but it used to be available by default. It was documented as an
experimental extension of the language, which could be removed in future
versions. This is what actually happened.

At the same time, camlp4 had been included into the core OCaml
distribution. Camlp4 is a preprocessor for OCaml, so it parses the core
OCaml language, and also the special syntax for streams. This is what
should be used. The command which parses OCaml files written in the
standard syntax + streams is camlp4o.

Conclusions:

1) When compiling using OCamlMakefile, put this as the first line of the
files that use the stream syntax:

(*pp camlp4o *)

2) When compiling directly with ocamlfind, use this flag: -syntax camlp4o

3) When compiling without ocamlfind, pass this flag to ocamlopt or ocamlc:
-pp camlp4o

Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr

__._,_.___
.

__,_._,___
"ocaml_beginners"::[] stream syntax again
user name
2006-11-27 17:51:34

On Fri, 24 Nov 2006, Jon Harrop wrote:

> On Friday 24 November 2006 13:22, Chad Perrin wrote:
>> considering the ml at the end of the language name OCaml stands
>> for "meta-language"
>
> It doesn't.

Yeah, it doesn't really stand for anything. Originally, it was sort of a
mash-up detween Categorical Abstract Machine and Meta Language. These
days the CAM is gone, and Caml just means Caml.

Though it is still a dialet of ML, which does stand for Meta Language.

William D. Neumann

---

"There's just so many extra children, we could just feed the
children to these tigers. We don't need them, we're not doing
anything with them.

Tigers are noble and sleek; children are loud and messy."

-- Neko Case

Life is unfair. Kill yourself or get over it.
-- Black Box Recorder

__._,_.___
.

__,_._,___
[1-10] [11-14]

about | contact  Other archives ( Real Estate discussion Medical topics )