caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: art yerkes <ayerkes@speakeasy.net>
To: Yamagata Yoriyuki <yoriyuki@mbg.ocn.ne.jp>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] swig like library...
Date: Mon, 26 Apr 2004 10:17:46 -0500	[thread overview]
Message-ID: <20040426101746.4a1a1fdc.ayerkes@speakeasy.net> (raw)
In-Reply-To: <20040425.181100.78702024.yoriyuki@mbg.ocn.ne.jp>

On Sun, 25 Apr 2004 18:11:00 +0900 (JST)
Yamagata Yoriyuki <yoriyuki@mbg.ocn.ne.jp> wrote:

> From: art yerkes <ayerkes@speakeasy.net>
> Subject: Re: [Caml-list] swig like library...
> Date: Sat, 24 Apr 2004 20:24:43 -0500
> 
> > I agree that the lack of further automation is a bottleneck for SWIG
> > users. I have considered forking some of the core type functions into the
> > ocaml module for that reason.
> 
> I think swig is nice.  It does the supposed job, quick and dirty
> interface to C.
> 
> I have only minor complaints.  First, the access to structure fields
> involves searching assoc lists, using string as a key.  As a result,
> my program spends a lot of time in comparing strings.  A possible and
> easy improvement is making access functions for structure fields
> accessible from the outside.
> 
> Another problem, which may not be a swig problem, is that my program
> occasionally crash.  malloc in a structure creation function (new_*)
> causes seg fault.  Could you give me a suggestion where I have to
> look?

Please send me more details privately about the crash.  That may indeed
be a bug in my module.

You make a good point about method lookup, I will make that faster.
In order to make the accessors for structs available outside the object,
I would have to decorate some names in ugly, and possibly difficult to
remember ways.  I wonder if you (or other SWIG users) have any suggestions
which would eliminate that or make it easier.

The simplest way I considered was to have a repository of method names, as
I do with enum labels:

type methods_of_foo = [ `Constructor | `Foo | `foo | `_foo | `fOo ... 
                      | `operatorLessThanOrEqual ]

And then do the obvious thing in the method call function.  This means
that code written without camlp4 will be much uglier, and that you may
have to cast your method names.  The operators will also be uglified.

I could make member variable accessors different from the methods...
Would that be desirable?
-- 
Hey, Adam Smith, keep your invisible hands to yourself!

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


  parent reply	other threads:[~2004-04-26 15:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23 14:36 Michael
2004-04-23 15:07 ` Richard Jones
2004-04-23 15:47 ` Kenneth Knowles
2004-04-24  1:50 ` skaller
2004-04-24 17:12   ` Brandon J. Van Every
2004-04-24 20:11     ` skaller
2004-04-25  1:24       ` art yerkes
2004-04-25  2:56         ` skaller
2004-04-27  5:02           ` [Caml-list] " Jeff Henrikson
2004-04-25  9:11         ` [Caml-list] " Yamagata Yoriyuki
2004-04-25 10:30           ` skaller
2004-04-26 15:17           ` art yerkes [this message]
2004-05-17 17:03             ` Yamagata Yoriyuki
2004-04-23 15:48 HENRIKSON, JEFFREY
2004-04-24 19:16 ` art yerkes

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=20040426101746.4a1a1fdc.ayerkes@speakeasy.net \
    --to=ayerkes@speakeasy.net \
    --cc=caml-list@inria.fr \
    --cc=yoriyuki@mbg.ocn.ne.jp \
    /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).