From: Jeff Meister <nanaki@gmail.com>
To: Hongbo Zhang <bobzhang1988@gmail.com>
Cc: Jon Harrop <jon@ffconsultancy.com>, Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] LLVM OCaml bindings
Date: Thu, 14 Nov 2013 11:29:24 -0800 [thread overview]
Message-ID: <CAHaHOqSiTOgYyjH7HK7FZ9a_u7xU1gZ+8ziO8hnrgRdoGMDYmA@mail.gmail.com> (raw)
In-Reply-To: <5284F4FF.2000900@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]
There is basically no extra complexity, just refactoring. The only
difference is that, for example, setting the initializer for a
GlobalVariable.c statically requires a Constant.c, not just any llvalue as
allowed by the existing bindings. I don't see this as additional
complexity, because you have to know the real types anyway to work with the
current bindings. I'm simply making them explicit in the interface. There
is unfortunately the annoyance of frequent upcasts: to past your Constant.c
x to a function that expects a Value.c, you must write (x :> Value.c). But
that limitation of the OCaml language can be removed, and it already has
been in the implicit_subtyping branch. I would love to see those changes
integrated into mainline OCaml, or at least updated to work with the latest
release! :)
You guys are right that I was too sweeping with my statement about type
safety... the other features you mentioned are great reasons to prefer
OCaml, and they're important to me too. What I should have said was, I
don't want to have to sacrifice type safety of the bindings so I can work
in OCaml, especially when I see no fundamental reason why that sacrifice is
necessary. Frankly I was very surprised when I first discovered that the
bindings are so inadequate in this respect, and that no one had done
anything about it. Maybe that's because no one cares, but I doubt it. It
may not be the most important thing, but I see it as free help from OCaml's
type and module systems, and I'll take that help, especially when working
with such a large and complex project like LLVM.
On Thu, Nov 14, 2013 at 8:06 AM, Hongbo Zhang <bobzhang1988@gmail.com>wrote:
> On 11/13/13, 2:00 PM, Jon Harrop wrote:
>
>> Jeff Meister wrote:
>>
>>> If I have
>>> to give up static type safety to work with LLVM in OCaml, then I might
>>> as well not use OCaml on that project.
>>>
>>
>> Peter Zotov wrote:
>>
>>> Speed? :)
>>>
>>
>> I use OCaml+LLVM for the algebraic data types, pattern matching,
>> functional programming and so on. Type safety of the bindings is way down
>> on the list for me.
>>
>
> agreed, the major benefit for me compared with c++, is compile time
> performance, pattern matching and toplevel -- the type safety of the
> bindings is nice
> but not necessary if it brings too much complexity to the API
>
>
> Cheers,
>> Jon.
>>
>>
>>
>>
>
> --
> 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
>
[-- Attachment #2: Type: text/html, Size: 3776 bytes --]
prev parent reply other threads:[~2013-11-14 19:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 4:23 Peter Zotov
2013-11-05 8:12 ` Gabriel Kerneis
2013-11-05 8:18 ` Peter Zotov
2013-11-05 11:09 ` Jacques-Pascal Deplaix
2013-11-05 11:32 ` Peter Zotov
2013-11-05 21:00 ` Jeff Meister
2013-11-06 7:19 ` Peter Zotov
2013-11-06 7:54 ` Jeff Meister
2013-11-05 21:30 ` Jacques-Pascal Deplaix
2013-11-06 7:06 ` Peter Zotov
2013-11-08 9:36 ` Jon Harrop
2013-11-08 10:18 ` Peter Zotov
2013-11-08 11:31 ` Jon Harrop
2013-11-08 11:44 ` Peter Zotov
2013-11-12 3:44 ` Jeff Meister
2013-11-12 14:13 ` Peter Zotov
2013-11-13 19:00 ` Jon Harrop
2013-11-14 16:06 ` Hongbo Zhang
2013-11-14 19:29 ` Jeff Meister [this message]
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=CAHaHOqSiTOgYyjH7HK7FZ9a_u7xU1gZ+8ziO8hnrgRdoGMDYmA@mail.gmail.com \
--to=nanaki@gmail.com \
--cc=bobzhang1988@gmail.com \
--cc=caml-list@inria.fr \
--cc=jon@ffconsultancy.com \
/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