www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Header file generation.

reply Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= <dawid.ciezarkiewicz gmail.com> writes:
I see lot of discussion about making "header files". I haven't read all
posts about it, but I'm very interested in this topic. Pleas correct me if
I say something untrue.

The problem is to automaticaly generate header files for libraries etc. . D
is cool because whe have one .d file and not pair .h + .cpp , but ...
sometimes this diversion would be useful.

Because of this the -H parameter was add to help generate "striped" d
sources, but this in this "mode" parser does not know what to do export and
what to leave so it just write out almost everything (after striping of
course).


If above is true, why not to help this switch. Maybe there should be a way
to show what part of source is "interface" and what is just
"implementation".

Looking for an easy way to do that I see two ways:

-- keyword
(this may be new or other keyword, but I propose "out" keyword). It's never
used in scope that I'd like to propose, so maybe this would not break
parsing rules.

out export C {
  out void willBeInInterfaceTo();
}

out const MAGIC_CONSTANT = 5;

class L {
 public:
   out Enum TYPE {
     ONE, TWO
   }
   out this() {
     ...
   }
   void publicButNotInInterface() {
      ..
   }
   out void CallMeFromExternalSources(Type i) {
      ...
   }
}

This way, generated .di files could always have what is realy needed. All
"things" from global namespace can be prefixed with "out" without
interfering with current language standards.

-- DDoc
If the keyword solution isn't good enough, there could be DDoc section, like
"Interface: yes", that would act same as "out" from previous paragraph.

What do you think? 
Jan 03 2006
parent Dawid =?UTF-8?B?Q2nEmcW8YXJraWV3aWN6?= <dawid.ciezarkiewicz gmail.com> writes:
Sorry - NTG, please answer at digitalmars.D .
Jan 03 2006