Hi,

On Wed, Nov 14, 2012 at 05:12:15PM -0800, Lawrence Crowl wrote:
> Diego and I seek your comments on the following (loose) proposal.
> 
> 
> It is sometimes hard to remember which printing function is used
> for debugging a type, or even which type you have.

Yeah, from time to time a still need to look into my list.  I like the
goal, however...

> 
> We propose to rely on overloading to unify the interface to a small
> set of function names.  Every major data type should have associated
> debug/dump functionality.  We will unify the current *_dump/*_debug
> functions under the same common overloaded name.
> 
> We intend to only apply this approach to functions that take the
> type to display as an argument, and that are routinely used in
> debugging.
> 
> We propose to provide several function overload sets, as below.
> 
> 
> dump_pretty
> 
>     This function overload set provides the bulk of the printing.
>     They will use the existing pretty-printer functions in their
>     implementation.

So you do not plan to replace/rename at least some of them?  This
seems like unnecessary and confusing layering just to avoid the work
to do the right thing.

> 
> dump_raw
> 
>     This function overload set provides the raw oriented dump,
>     e.g. a tuple.

I'm not sure I understand the whole raw thing.

> 
> dump_verbose
> 
>     This function overload set provides the extra details dump.
> 

> 
> All of these functions come in two forms.
> 
>     function (FILE *, item_to_dump, formatting)
>     function (item_to_dump, formatting)
> 

I'm afraid we can't really always rely on overloading.  For example,
even though I often use debug_tree to examine a tree, probably even
more often I just use debug_generic_expr.  When I write stuff into a
dump file, I rarely ever use the verbose variants but I certainly want
them to exist.  And there might be other similar cases, like the
.*_brief dumping functions that are sometimes also used.

Nevertheless, it would be great if we had fewer and consistent names
of dumping functions, even though perhaps not just three.  It would
also be nice if all the file variants had an integer indent parameter
;-)

Thanks,

Martin

> If the FILE* is not specified, the output is to stderr.  The
> formatting argument is optional, with a default suitable to the kind
> of item to dump.
> 
> 
> We should remove tree-browser.c.  It is not used at all and it is
> likely broken.
> 
> -- 
> Lawrence Crowl

Reply via email to