caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Michal Moskal <malekith@pld-linux.org>
To: art yerkes <ayerkes@speakeasy.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Using -dtypes output in conjunction with a preprocessor
Date: Fri, 22 Aug 2003 11:05:18 +0200	[thread overview]
Message-ID: <20030822090518.GA4616@roke.freak> (raw)
In-Reply-To: <20030822023949.16fae994.ayerkes@speakeasy.net>

On Fri, Aug 22, 2003 at 02:39:49AM -0500, art yerkes wrote:
> While I know it's not really intended for this, I've been giving some thought
> to streamlining SWIG's Ocaml support.  To this end, I notice that -dtypes
> has been added to ocamlc in order to support type browsing in emacs.
> 
> What I'm interested in finding out is if this output is expected to be stable,
> or if there is another way to get this sort of deep type information from a
> source file.  I intend to use this information as hints to a camlp4 module
> that will recognize and rewrite references to C++ externals in order to emulate
> C++ style overloading.  
> 
> As far as I can see, I will need the ocaml compiler to tell me what type is
> expected for a certain application, 

Expected type? Hmm...

> then insert marshalling code that produces
> and consumes the types indicated in the hint.
> 
> For example, I might produce:
> 
> let _ = print_endline 
>   (string_of_int 
>     (get_int (__swig__wrapped_foo (C_list [(C_int a) (C_int b)]))
> 
> from:
> 
> let _ = print_endline (string_of_int (foo 1 2))
> 
> Given that the detected type of foo will be "int -> int -> int"
> 
> Is using the -dtypes output the best way to get the right info?

How about:

let f x y = foo x y

and:

let g x y = 
  let baz = foo x y in
  let qux = foo baz baz in
  x + 1

You probably should find out how type inference works.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h

-------------------
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-08-22  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-22  7:39 art yerkes
2003-08-22  9:05 ` Michal Moskal [this message]
2003-08-22 14:27   ` art yerkes
2003-08-24 15:14 ` [Caml-list] GlSurf 2.0 Christophe Raffalli

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=20030822090518.GA4616@roke.freak \
    --to=malekith@pld-linux.org \
    --cc=ayerkes@speakeasy.net \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).