caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] example from manual FTBFS
@ 2016-09-07 10:38 Hendrik Boom
  2016-09-07 10:41 ` Frédéric Bour
  0 siblings, 1 reply; 3+ messages in thread
From: Hendrik Boom @ 2016-09-07 10:38 UTC (permalink / raw)
  To: OCaml

I took an example from 
http://caml.inria.fr/pub/docs/u3-ocaml/ocaml-objects.html

class amateur : object ('a)
  method play : 'a -> int -> 'a
end
class professional : object ('a)
  method level : int
  method play : 'a -> int -> 'a
end

and tried to compile it:

hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc tt.ml -o tt
File "tt.ml", line 4, characters 0-5:
Error: Syntax error
hendrik@notlookedfor:~/dv/ocaml/parse/priority$

Those five characters are the word "class" on the second class 
declaration. But it's not the word "class".  If I leave that second 
class declaration out, it still complains at the same point, at the 
end of file after the first class declaration.

Evidently, I'm doing something wrong.

hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc -version
4.01.0
hendrik@notlookedfor:~/dv/ocaml/parse/priority$ which ocamlc
/home/hendrik/.opam/4.01.0/bin/ocamlc
hendrik@notlookedfor:~/dv/ocaml/parse/priority$

-- hendrik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] example from manual FTBFS
  2016-09-07 10:38 [Caml-list] example from manual FTBFS Hendrik Boom
@ 2016-09-07 10:41 ` Frédéric Bour
  2016-09-07 12:31   ` Hendrik Boom
  0 siblings, 1 reply; 3+ messages in thread
From: Frédéric Bour @ 2016-09-07 10:41 UTC (permalink / raw)
  To: caml-list

Your snippet of code is a signature, not a structure.
Try renaming tt.ml to tt.mli.

On 09/07/2016 12:38 PM, Hendrik Boom wrote:
> I took an example from
> http://caml.inria.fr/pub/docs/u3-ocaml/ocaml-objects.html
>
> class amateur : object ('a)
>    method play : 'a -> int -> 'a
> end
> class professional : object ('a)
>    method level : int
>    method play : 'a -> int -> 'a
> end
>
> and tried to compile it:
>
> hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc tt.ml -o tt
> File "tt.ml", line 4, characters 0-5:
> Error: Syntax error
> hendrik@notlookedfor:~/dv/ocaml/parse/priority$
>
> Those five characters are the word "class" on the second class
> declaration. But it's not the word "class".  If I leave that second
> class declaration out, it still complains at the same point, at the
> end of file after the first class declaration.
>
> Evidently, I'm doing something wrong.
>
> hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc -version
> 4.01.0
> hendrik@notlookedfor:~/dv/ocaml/parse/priority$ which ocamlc
> /home/hendrik/.opam/4.01.0/bin/ocamlc
> hendrik@notlookedfor:~/dv/ocaml/parse/priority$
>
> -- hendrik
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] example from manual FTBFS
  2016-09-07 10:41 ` Frédéric Bour
@ 2016-09-07 12:31   ` Hendrik Boom
  0 siblings, 0 replies; 3+ messages in thread
From: Hendrik Boom @ 2016-09-07 12:31 UTC (permalink / raw)
  To: caml-list

On Wed, Sep 07, 2016 at 12:41:29PM +0200, Frédéric Bour wrote:
> Your snippet of code is a signature, not a structure.
> Try renaming tt.ml to tt.mli.

Yes.  That was it.  I'll have to read up further on that distinction, 
now that I know the problem. 

-- hendrik

> 
> On 09/07/2016 12:38 PM, Hendrik Boom wrote:
> >I took an example from
> >http://caml.inria.fr/pub/docs/u3-ocaml/ocaml-objects.html
> >
> >class amateur : object ('a)
> >   method play : 'a -> int -> 'a
> >end
> >class professional : object ('a)
> >   method level : int
> >   method play : 'a -> int -> 'a
> >end
> >
> >and tried to compile it:
> >
> >hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc tt.ml -o tt
> >File "tt.ml", line 4, characters 0-5:
> >Error: Syntax error
> >hendrik@notlookedfor:~/dv/ocaml/parse/priority$
> >
> >Those five characters are the word "class" on the second class
> >declaration. But it's not the word "class".  If I leave that second
> >class declaration out, it still complains at the same point, at the
> >end of file after the first class declaration.
> >
> >Evidently, I'm doing something wrong.
> >
> >hendrik@notlookedfor:~/dv/ocaml/parse/priority$ ocamlc -version
> >4.01.0
> >hendrik@notlookedfor:~/dv/ocaml/parse/priority$ which ocamlc
> >/home/hendrik/.opam/4.01.0/bin/ocamlc
> >hendrik@notlookedfor:~/dv/ocaml/parse/priority$
> >
> >-- hendrik
> >
> >
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 10:38 [Caml-list] example from manual FTBFS Hendrik Boom
2016-09-07 10:41 ` Frédéric Bour
2016-09-07 12:31   ` Hendrik Boom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).