* [Caml-list] non-exported functions @ 2003-10-28 20:02 Dustin Sallings 2003-10-28 21:07 ` Richard Jones 0 siblings, 1 reply; 10+ messages in thread From: Dustin Sallings @ 2003-10-28 20:02 UTC (permalink / raw) To: caml-list I've got a module that contains a few helper functions that should only be used internally. Is there a way to prevent them from being exported and/or included in ocamldoc output? -- Dustin Sallings ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-28 20:02 [Caml-list] non-exported functions Dustin Sallings @ 2003-10-28 21:07 ` Richard Jones 2003-10-28 21:10 ` Maxence Guesdon 0 siblings, 1 reply; 10+ messages in thread From: Richard Jones @ 2003-10-28 21:07 UTC (permalink / raw) To: Dustin Sallings; +Cc: caml-list On Tue, Oct 28, 2003 at 12:02:40PM -0800, Dustin Sallings wrote: > > I've got a module that contains a few helper functions that should > only be used internally. Is there a way to prevent them from being > exported and/or included in ocamldoc output? Define an .mli file for your module. Anything not listed explicitly in the .mli file won't be exported. In addition you can control what ocamldoc produces either by using (* vs (**, or by using various flags which are detailed in the ocamldoc manual. Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. MONOLITH is an advanced framework for writing web applications in C, easier than using Perl & Java, much faster and smaller, reusable widget-based arch, database-backed, discussion, chat, calendaring: http://www.annexia.org/freeware/monolith/ ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-28 21:07 ` Richard Jones @ 2003-10-28 21:10 ` Maxence Guesdon 2003-10-29 0:11 ` Dustin Sallings 0 siblings, 1 reply; 10+ messages in thread From: Maxence Guesdon @ 2003-10-28 21:10 UTC (permalink / raw) To: Richard Jones; +Cc: Dustin Sallings, caml-list On Tue, 28 Oct 2003 21:07:57 +0000 Richard Jones <rich@annexia.org> wrote: > On Tue, Oct 28, 2003 at 12:02:40PM -0800, Dustin Sallings wrote: > > > > I've got a module that contains a few helper functions that should > > only be used internally. Is there a way to prevent them from being > > exported and/or included in ocamldoc output? > > Define an .mli file for your module. Anything not listed explicitly in > the .mli file won't be exported. This works. > In addition you can control what ocamldoc produces either by using (* > vs (**, or by using various flags which are detailed in the ocamldoc > manual. This won't prevent the functions to appear in the doc output in they are in the .mli. You can use the (**/**) special comment to tell ocamldoc not to show elements placed after this comment, in the current module, module type, class or class-type. -- Maxence Guesdon ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-28 21:10 ` Maxence Guesdon @ 2003-10-29 0:11 ` Dustin Sallings 2003-10-29 6:50 ` Jean-Baptiste Rouquier 2003-10-29 18:25 ` skaller 0 siblings, 2 replies; 10+ messages in thread From: Dustin Sallings @ 2003-10-29 0:11 UTC (permalink / raw) To: Maxence Guesdon; +Cc: Richard Jones, caml-list On Tue, 28 Oct 2003 21:07:57 +0000 Richard Jones <rich@annexia.org> wrote: > On Tue, Oct 28, 2003 at 12:02:40PM -0800, Dustin Sallings wrote: >> >> I've got a module that contains a few helper functions that should >> only be used internally. Is there a way to prevent them from being >> exported and/or included in ocamldoc output? > > Define an .mli file for your module. Anything not listed explicitly in > the .mli file won't be exported. I kinda liked automatically generating my .mli, but I guess I can live with that. On Tuesday, Oct 28, 2003, at 13:10 US/Pacific, Maxence Guesdon wrote: > This won't prevent the functions to appear in the doc output in they > are in the .mli. > You can use the (**/**) special comment to tell ocamldoc not to show > elements placed after this comment, in the current module, module type, > class or class-type. I rearranged my definitions to allow me to do this, but it prevents me from actually using them myself. I get an ``Unbound value'' error. Does this mean I can't have both a section of undocumented code and use that code from the documented code? -- Dustin Sallings ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 0:11 ` Dustin Sallings @ 2003-10-29 6:50 ` Jean-Baptiste Rouquier 2003-10-29 7:52 ` Dustin Sallings 2003-10-29 18:25 ` skaller 1 sibling, 1 reply; 10+ messages in thread From: Jean-Baptiste Rouquier @ 2003-10-29 6:50 UTC (permalink / raw) To: caml-list > I kinda liked automatically generating my .mli, ocamlc -i foo.ml > foo.mli ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 6:50 ` Jean-Baptiste Rouquier @ 2003-10-29 7:52 ` Dustin Sallings 2003-10-29 10:00 ` David Brown 2003-10-29 18:31 ` skaller 0 siblings, 2 replies; 10+ messages in thread From: Dustin Sallings @ 2003-10-29 7:52 UTC (permalink / raw) To: Jean-Baptiste Rouquier; +Cc: caml-list On Oct 28, 2003, at 10:50 PM, Jean-Baptiste Rouquier wrote: >> I kinda liked automatically generating my .mli, > ocamlc -i foo.ml > foo.mli Right, like that. If I have to make a custom mli, I have to take this out of my build system. :) -- Dustin Sallings ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 7:52 ` Dustin Sallings @ 2003-10-29 10:00 ` David Brown 2003-10-29 18:31 ` skaller 1 sibling, 0 replies; 10+ messages in thread From: David Brown @ 2003-10-29 10:00 UTC (permalink / raw) To: Dustin Sallings; +Cc: Jean-Baptiste Rouquier, caml-list On Tue, Oct 28, 2003 at 11:52:03PM -0800, Dustin Sallings wrote: > > On Oct 28, 2003, at 10:50 PM, Jean-Baptiste Rouquier wrote: > > >>I kinda liked automatically generating my .mli, > >ocamlc -i foo.ml > foo.mli > > Right, like that. If I have to make a custom mli, I have to take > this out of my build system. :) If you wanted to feel more Haskell-like, you could have your build system search for some specially formatted comment with an exports line in it. That way you could declare the things you want to export, and filter the output of ocamlc -i. You also want to make sure you write the output to a temporary file, and only overwrite the foo.mli if it has changed, otherwise you will rebuild way too much. Dave ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 7:52 ` Dustin Sallings 2003-10-29 10:00 ` David Brown @ 2003-10-29 18:31 ` skaller 1 sibling, 0 replies; 10+ messages in thread From: skaller @ 2003-10-29 18:31 UTC (permalink / raw) To: Dustin Sallings; +Cc: Jean-Baptiste Rouquier, caml-list On Wed, 2003-10-29 at 18:52, Dustin Sallings wrote: > On Oct 28, 2003, at 10:50 PM, Jean-Baptiste Rouquier wrote: > > >> I kinda liked automatically generating my .mli, > > ocamlc -i foo.ml > foo.mli > > Right, like that. If I have to make a custom mli, I have to take this > out of my build system. :) That command is guarranteed to be useless in a build system. The generated interface is exactly the same as the one that is extracted from the compiled ml file anyhow. The -i command is only to get a text file for the purpose of subsequent manual editing. Mli files are ONLY needed when there's an actual constraint. Every ml file I write has a manually constructed mli file, because almost invariably I *do* have helper functions I dont wish to expose to clients. I sometime use ocamlc -i to get the interface generated by a functor application .. (is there another way to do that, its woefully crude ..) ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 0:11 ` Dustin Sallings 2003-10-29 6:50 ` Jean-Baptiste Rouquier @ 2003-10-29 18:25 ` skaller 2003-10-29 21:09 ` Richard Jones 1 sibling, 1 reply; 10+ messages in thread From: skaller @ 2003-10-29 18:25 UTC (permalink / raw) To: caml-list On Wed, 2003-10-29 at 11:11, Dustin Sallings wrote: > On Tue, 28 Oct 2003 21:07:57 +0000 > Richard Jones <rich@annexia.org> wrote: > > > On Tue, Oct 28, 2003 at 12:02:40PM -0800, Dustin Sallings wrote: > >> > >> I've got a module that contains a few helper functions that should > >> only be used internally. Is there a way to prevent them from being > >> exported and/or included in ocamldoc output? > > > > Define an .mli file for your module. Anything not listed explicitly in > > the .mli file won't be exported. > > I kinda liked automatically generating my .mli, but I guess I can live > with that. Aw, its kind of annoying. Two or three extra keywords might fix 95% of cases: let private x = ... Just don't put x in the interface type abstract x = .. put x in the interface as type x Now you may need an mli in the unusual case a function of type A -> B is constrained to type C -> D in the module and to type E -> F in the interface. Explicit interfaces are of course still needed for more complex constraints. ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] non-exported functions 2003-10-29 18:25 ` skaller @ 2003-10-29 21:09 ` Richard Jones 0 siblings, 0 replies; 10+ messages in thread From: Richard Jones @ 2003-10-29 21:09 UTC (permalink / raw) To: skaller; +Cc: caml-list On Thu, Oct 30, 2003 at 05:25:47AM +1100, skaller wrote: > Aw, its kind of annoying. Two or three extra keywords might > fix 95% of cases: > > let private x = ... > > Just don't put x in the interface > > type abstract x = .. > > put x in the interface as > > type x This is a good idea (although in practice writing .mli files isn't too much of a bind for me). Still, every little bit helps. For classes I've started ALWAYS doing .mli files because that way you can control private/protected/public methods very accurately. See the other thread on this issue. Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. 'There is a joke about American engineers and French engineers. The American team brings a prototype to the French team. The French team's response is: "Well, it works fine in practice; but how will it hold up in theory?"' ------------------- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-10-29 21:09 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-10-28 20:02 [Caml-list] non-exported functions Dustin Sallings 2003-10-28 21:07 ` Richard Jones 2003-10-28 21:10 ` Maxence Guesdon 2003-10-29 0:11 ` Dustin Sallings 2003-10-29 6:50 ` Jean-Baptiste Rouquier 2003-10-29 7:52 ` Dustin Sallings 2003-10-29 10:00 ` David Brown 2003-10-29 18:31 ` skaller 2003-10-29 18:25 ` skaller 2003-10-29 21:09 ` Richard Jones
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).