* [Caml-list] weird compilation problem
@ 2003-09-05 22:09 Olivier Ricordeau
2003-09-05 22:45 ` Olivier Andrieu
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Ricordeau @ 2003-09-05 22:09 UTC (permalink / raw)
To: caml-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
I have a weird compilation problem. ocamlc complains that it doesn't
find a class, and I really don't know what mistake I made...
FYI, it used to compile fine until I tried to write some interfaces.
(* Compilation error *)
olivier@freedom libnn > make byte
make[1]: Entering directory `/home/olivier/projects/marvin/src/libnn/misc'
+ making interface in misc ...
ocamlc -c -g -I ../misc -I ../networks -w A corpus.mli
[...]
+ making byte in misc ...
ocamlc -c -g -I ../misc -I ../networks -w A corpus.ml
[...]
make[1]: Leaving directory `/home/olivier/projects/marvin/src/libnn/misc'
make[1]: Entering directory
`/home/olivier/projects/marvin/src/libnn/networks'
+ making interface in networks ...
ocamlc -c -g -I ../misc -I ../networks -w A nn.mli
+ making byte in networks ...
ocamlc -c -g -I ../misc -I ../networks -w A nn.ml
File "nn.ml", line 68, characters 24-34:
Unbound class corpus
make[1]: *** [nn.cmo] Erreur 2
(* FYI *)
olivier@freedom libnn > ls misc/corpus.*
misc/corpus.cmi misc/corpus.cmo misc/corpus.ml misc/corpus.mli
olivier@freedom libnn > ocamlc -v
The Objective Caml compiler, version 3.06
Standard library directory: /usr/lib/ocaml/3.06
(* Code *)
http://freefolks.org/tmp/corpus.mli
http://freefolks.org/tmp/corpus.ml
http://freefolks.org/tmp/nn.ml
http://freefolks.org/tmp/nn.mli
If someone has an idea of what I did wrong, I'm interested! I'm quite
stuck for now.
Oliv
- --
- -= *Olivier RICORDEAU* =- http://freefolks.org
< LibNN addict http://libnn.org >
lynx -source http://freefolks.org/key.asc | gpg --import
olivier.ricordeau@wanadoo.fr _May the source be with you_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/WQmnDFRYKP6DJEwRAtmSAKCnHY/8nbQ2Qdf/S3J8JGLf4C09AwCghtsg
x6BjeSpWdMGtpatUtkqtZRg=
=A4xo
-----END PGP SIGNATURE-----
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] weird compilation problem
2003-09-05 22:09 [Caml-list] weird compilation problem Olivier Ricordeau
@ 2003-09-05 22:45 ` Olivier Andrieu
2003-09-06 1:22 ` Olivier Ricordeau
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Andrieu @ 2003-09-05 22:45 UTC (permalink / raw)
To: Olivier Ricordeau; +Cc: caml-list
Olivier Ricordeau [Saturday 6 September 2003] :
> Hi!
> I have a weird compilation problem. ocamlc complains that it doesn't
> find a class, and I really don't know what mistake I made...
> FYI, it used to compile fine until I tried to write some interfaces.
> If someone has an idea of what I did wrong, I'm interested! I'm quite
> stuck for now.
[ je te l'ai déjà dit mais bon ... ]
You're confusing class specification and class type.
In corpus.ml you define a class, but in corpus.mli you put a class
type. A class type gives a "signature" of a class, listing its methods
and instance variable but a class type doesn't necessarily come with
an implementation (an actual class). So, when you try to use your
Corpus module, you only see a class type and you cannot create an
object with new or define a derived class. What you want is a class
specification.
Class definition (in .ml files) :
class foo = object method bar = some_expr end
Class specification (in .mli files) :
class foo : object method bar : some_type_expr end
Class type (in .ml and/or .mli files) :
class type foo = object method bar : some_type_expr end
Also, you do not really need to write a .mli if you're not hiding
anything from the .ml file.
--
Olivier
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] weird compilation problem
2003-09-05 22:45 ` Olivier Andrieu
@ 2003-09-06 1:22 ` Olivier Ricordeau
0 siblings, 0 replies; 3+ messages in thread
From: Olivier Ricordeau @ 2003-09-06 1:22 UTC (permalink / raw)
To: caml-list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Olivier Andrieu wrote:
> Olivier Ricordeau [Saturday 6 September 2003] :
> > Hi!
> > I have a weird compilation problem. ocamlc complains that it doesn't
> > find a class, and I really don't know what mistake I made...
> > FYI, it used to compile fine until I tried to write some interfaces.
>
> > If someone has an idea of what I did wrong, I'm interested! I'm quite
> > stuck for now.
>
> [ je te l'ai déjà dit mais bon ... ]
>
> You're confusing class specification and class type.
>
> In corpus.ml you define a class, but in corpus.mli you put a class
> type. A class type gives a "signature" of a class, listing its methods
> and instance variable but a class type doesn't necessarily come with
> an implementation (an actual class). So, when you try to use your
> Corpus module, you only see a class type and you cannot create an
> object with new or define a derived class. What you want is a class
> specification.
>
>
> Class definition (in .ml files) :
> class foo = object method bar = some_expr end
>
> Class specification (in .mli files) :
> class foo : object method bar : some_type_expr end
>
> Class type (in .ml and/or .mli files) :
> class type foo = object method bar : some_type_expr end
>
>
> Also, you do not really need to write a .mli if you're not hiding
> anything from the .ml file.
>
It works! Thx a lot.
- --
- -= *Olivier RICORDEAU* =- http://freefolks.org
< LibNN addict http://libnn.org >
lynx -source http://freefolks.org/key.asc | gpg --import
olivier.ricordeau@wanadoo.fr _May the source be with you_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/WTa/DFRYKP6DJEwRAtNXAJ9uN1S4AHcy8MA42ctGi0tT4rCCaACghXxd
x3PeHeCE4uBeA/t9Xo9M7J0=
=TUBX
-----END PGP SIGNATURE-----
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-06 1:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-05 22:09 [Caml-list] weird compilation problem Olivier Ricordeau
2003-09-05 22:45 ` Olivier Andrieu
2003-09-06 1:22 ` Olivier Ricordeau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox