Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: g.o.d@zefix.tv
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] newbie problem with splitting code into files
Date: Fri, 23 May 2003 16:21:06 +0200	[thread overview]
Message-ID: <20030523162106.A17477@pauillac.inria.fr> (raw)
In-Reply-To: <20030523124814.GD5371@sfear.sc-networks.de>; from g.o.d@zefix.tv on Fri, May 23, 2003 at 02:48:14PM +0200

> i want to split code like for example the following into
> several files:

The following seems to do what you want:

----------- file test.mli -------------

class type test_type = object
        val mutable x:int
        method get_x:int
end
 
class test : test_type

----------- file test.ml --------------

class type test_type = object
        val mutable x:int
        method get_x:int
end
 
class test : test_type = object
        val mutable x = 0
        method get_x = x
end

----------- file main.ml --------------

open Test
open Printf

let main() = 
        let t=new test in
        printf "X: %d\n" t#get_x;; 
 
let _ = main()

---------------------------------------

Hope this helps,

- Xavier Leroy

-------------------
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


  reply	other threads:[~2003-05-23 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-23 12:48 g.o.d
2003-05-23 14:21 ` Xavier Leroy [this message]
2003-05-23 21:17   ` [Caml-list] Camlp4 for newbies TBraibant
2003-05-23 14:38 ` [Caml-list] newbie problem with splitting code into files Ken Rose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030523162106.A17477@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=g.o.d@zefix.tv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox