www.digitalmars.com         C & C++   DMDScript  

D - Header files???

reply Erik Rounds <erikr aatrix.com> writes:
I noticed that D is not planning to support header files.  Will it be
more like Java where both the declarations and definitions are in the
same file.  If so, I think that could be a big mistake.  I personally
file header files useful as a visual interface to my classes and
functions without having to pour through so much miscilanious
implementation code.  Also header files are needed for distribution of
libraries where you don't feel like distributing your source code.

Anyway, just thought I'd add my two cents.  Everything else about D
seems real nice.  Thanks.
Aug 22 2001
parent reply "Brent Schartung" <bschartung home.com> writes:
Not to mention that closed-source libraries are often distributed as headers
and compiled object code.  Would it be possible for D to read the
implementation/source code and then generate a 'header' for purposes of
distribution & linking?

 - Brent



 I noticed that D is not planning to support header files.  Will it be
 more like Java where both the declarations and definitions are in the
 same file.  If so, I think that could be a big mistake.  I personally
 file header files useful as a visual interface to my classes and
 functions without having to pour through so much miscilanious
 implementation code.  Also header files are needed for distribution of
 libraries where you don't feel like distributing your source code.

 Anyway, just thought I'd add my two cents.  Everything else about D
 seems real nice.  Thanks.
Aug 23 2001
parent reply "Walter" <walter digitalmars.com> writes:
Actually, D will work if you make a "header" by replacing the function
bodies with ;. It's just that you don't have to do it that way.

Brent Schartung wrote in message <9m4em5$6jo$1 digitaldaemon.com>...
Not to mention that closed-source libraries are often distributed as
headers
and compiled object code.  Would it be possible for D to read the
implementation/source code and then generate a 'header' for purposes of
distribution & linking?

 - Brent



 I noticed that D is not planning to support header files.  Will it be
 more like Java where both the declarations and definitions are in the
 same file.  If so, I think that could be a big mistake.  I personally
 file header files useful as a visual interface to my classes and
 functions without having to pour through so much miscilanious
 implementation code.  Also header files are needed for distribution of
 libraries where you don't feel like distributing your source code.

 Anyway, just thought I'd add my two cents.  Everything else about D
 seems real nice.  Thanks.
Aug 24 2001
parent reply Erik Rounds <erikr aatrix.com> writes:
I'm glad to hear that.  Will there be different file extentions for
declaration and implementation files or just .d for everything.  Perhapse .dh
or something.

Thanks for the info.

Walter wrote:

 Actually, D will work if you make a "header" by replacing the function
 bodies with ;. It's just that you don't have to do it that way.

 Brent Schartung wrote in message <9m4em5$6jo$1 digitaldaemon.com>...
Not to mention that closed-source libraries are often distributed as
headers
and compiled object code.  Would it be possible for D to read the
implementation/source code and then generate a 'header' for purposes of
distribution & linking?

 - Brent



 I noticed that D is not planning to support header files.  Will it be
 more like Java where both the declarations and definitions are in the
 same file.  If so, I think that could be a big mistake.  I personally
 file header files useful as a visual interface to my classes and
 functions without having to pour through so much miscilanious
 implementation code.  Also header files are needed for distribution of
 libraries where you don't feel like distributing your source code.

 Anyway, just thought I'd add my two cents.  Everything else about D
 seems real nice.  Thanks.
Aug 24 2001
parent reply Russ Lewis <russ deming-os.org> writes:
Erik Rounds wrote:

 I'm glad to hear that.  Will there be different file extentions for
 declaration and implementation files or just .d for everything.  Perhapse .dh
 or something.
I think that they all should be .d files - you don't really want to make a distinction between normal source and these headers. In fact, these headers might be a mix of simple source code (wrappers) and links to external functions. Publish a .d file for the declarations, and a .o file for linking.
Aug 24 2001
parent reply "Sean L. Palmer" <spalmer iname.com> writes:
And what would be even better than that would be to just distribute the .o
file, and have the compiler automatically open it up and figure out the
class and function declarations.

The newfangled IDE could also open up a D  .o file and show browse
information, inheritance tree or whatever.

Old school programmers on out-of-date computers could always ship a "fake"
header file with their library, so people could check out the interfaces
without having to fire up an IDE.  Or a command-line tool could "extract"
the header from the .o file kinda like dumpbin.

Header files are so unnecessary it hurts.

Sean

"Russ Lewis" <russ deming-os.org> wrote in message
news:3B8696EE.579EC10E deming-os.org...
 Erik Rounds wrote:

 I'm glad to hear that.  Will there be different file extentions for
 declaration and implementation files or just .d for everything.
Perhapse .dh
 or something.
I think that they all should be .d files - you don't really want to make a distinction between normal source and these headers. In fact, these
headers
 might be a mix of simple source code (wrappers) and links to external
functions.
 Publish a .d file for the declarations, and a .o file for linking.
Oct 23 2001
parent reply "Walter" <walter digitalmars.com> writes:
Can't do that unless you're willing to define your own .o format. This is
infeasable for me as a matter of I don't have the resources to do it. Note
that Java did do this, with .class files.


"Sean L. Palmer" <spalmer iname.com> wrote in message
news:9r3hj6$btm$1 digitaldaemon.com...
 And what would be even better than that would be to just distribute the .o
 file, and have the compiler automatically open it up and figure out the
 class and function declarations.

 The newfangled IDE could also open up a D  .o file and show browse
 information, inheritance tree or whatever.

 Old school programmers on out-of-date computers could always ship a "fake"
 header file with their library, so people could check out the interfaces
 without having to fire up an IDE.  Or a command-line tool could "extract"
 the header from the .o file kinda like dumpbin.

 Header files are so unnecessary it hurts.

 Sean

 "Russ Lewis" <russ deming-os.org> wrote in message
 news:3B8696EE.579EC10E deming-os.org...
 Erik Rounds wrote:

 I'm glad to hear that.  Will there be different file extentions for
 declaration and implementation files or just .d for everything.
Perhapse .dh
 or something.
I think that they all should be .d files - you don't really want to make
a
 distinction between normal source and these headers.  In fact, these
headers
 might be a mix of simple source code (wrappers) and links to external
functions.
 Publish a .d file for the declarations, and a .o file for linking.
Feb 04 2002
parent reply "Pavel Minayev" <evilone omen.ru> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a3ln64$tsg$1 digitaldaemon.com...

 Can't do that unless you're willing to define your own .o format. This is
 infeasable for me as a matter of I don't have the resources to do it. Note
 that Java did do this, with .class files.
What about creating a separate, binary file that'd contain interface for the module (*.dmi), auto-generated on compilation. It'd load faster, and would make distribution of source codes and writing of "fake" module headers unnecessary.
Feb 04 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Pavel Minayev" <evilone omen.ru> wrote in message
news:a3mpf2$1glq$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:a3ln64$tsg$1 digitaldaemon.com...

 Can't do that unless you're willing to define your own .o format. This
is
 infeasable for me as a matter of I don't have the resources to do it.
Note
 that Java did do this, with .class files.
What about creating a separate, binary file that'd contain interface for the module (*.dmi), auto-generated on compilation. It'd load faster, and would make distribution of source codes and writing of "fake" module headers unnecessary.
That's certainly possible, but will have to wait until I get the language working fully. -Walter
Feb 04 2002
parent "Pavel Minayev" <evilone omen.ru> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a3mqmt$1hlj$1 digitaldaemon.com...

 That's certainly possible, but will have to wait until I get the language
 working fully. -Walter
Okay. I can live without it, all my libs are open-sourced anyhow =)
Feb 04 2002