From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!post02.iad01!roadrunner.com!not-for-mail Sender: kst@nuthaus.mib.org Newsgroups: comp.lang.ada Subject: Re: How come Ada isn't more popular? References: <1169531612.200010.153120@38g2000cwa.googlegroups.com> <51m6rqF1kqpr0U1@mid.individual.net> From: Keith Thompson Organization: None to speak of Date: 25 Jan 2007 18:50:13 -0800 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rr.com Xref: g2news2.google.com comp.lang.ada:8579 Date: 2007-01-25T18:50:13-08:00 List-Id: "Dr. Adrian Wrigley" writes: [...] > I think this is critical. Why can't we just say: > > with stdio; > > pragma import (C, stdio, "stdio.h"); > > and be able to get structs, functions, constants, variables from C in > an obvious and reasonably reliable way? [...] Probably because there is no "obvious and reasonably reliable way" to do this. Presumably the above is intended to import the contents of the C standard header . The problem is that, assuming it works by processing the actual file (typically "/usr/include/stdio.h" on Unix-like systems), it's going to pick up a huge amount of irrelevant cruft. For example, files in C are handled via the type "FILE*", which is a pointer to an object of type FILE. The C standard doesn't say what's in a FILE object (it only requires it to be an object type), and the actual contents can vary from one implementation to another. C programs are expected to use only FILE* objects, and only via the manipulation functions defined by the standard (fopen, fclose, etc.). In effect, FILE is an opaque type (and C programmers actually tend to avoid writing code that depends on the unspecified internal details). But C has no good way to express this in the language, so you're probably going to import the actual definition of type FILE for the current system, translated into an Ada record declaration. You really want type FILE is private; but I don't see how you can get it. Ideally, I suppose you'd like to be able to automatically translate the contents of into an Ada interface that's about as clean as the C interface *as defined in the C standard*. I'm not convinced that it's practical to do that automatically. -- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this.