For review: Term display helper
Mark Anthony BROWN
dougl at cs.mu.OZ.AU
Sat Feb 28 13:08:24 AEDT 1998
>
> On 27-Feb-1998, Waye-Ian CHIEW <wchi at students.cs.mu.OZ.AU> wrote:
> > Hello.
> >
> > This is the term display helper, which takes univ terms and displays them in a
> > choice of pretty formats.
> >
> > It is not finished and not really useable; some critical additions, like
> > the scripting language and the interactive browser, haven't been implemented
> > yet.
> >
> > -- Ian!!
>
> Uh, the scripting language?!?
>
> Does it make the coffee too? How about a builtin mail reader? ;-)
Of course it makes coffee. Why else would it be called critical? ;-) ;-)
> I'm not sure that it would be a good idea to reuse "cd" as the name
> for this command. Something else might be a better idea.
> Perhaps "goto".
IMO, the analogy with directory trees is a good one. In particular,
I imagine users would like to be able to refer to both absolute and
relative "pathnames". If a name is to be reused, "goto" is probably
a less helpful choice.
Still, "cd" means "change directory" so unless you are actually going
to refer to subterms as directories all the time, this acronym may
be misleading.
>
> > X quit
> > X Quits and returns the user-modified visibility tree and
> > X preferences to the caller.
> > X
> > X quit!
> > X Quits and returns the original visibility tree and user
> > X preferences to the caller.
There's not much typographical distance between these two, considering
that one of them saves and exits, while the other forgets changes.
How about:
done
Exit with user-modified visibility tree and prefs
quit
If no changes have been made, quit and return the original
quit!
Quit and return the original, forget any changes
and appropriate abbreviations.
>
> The name `portray' has an existing meaning in Prolog,
> as the "hook" predicate used by `print'.
> The current plan is to eventually make it mean the same thing in Mercury.
> (Although arguably it might be better to use `print_hook';
> that would allow the use of a consistent convention of
> using `foo_hook' as the hook predicate for `foo'.)
>
> So it might be better to use a name other than `portray'.
> Unfortunately most of the good ones -- e.g. `print', `write', `display',
> and `format' -- are already taken. I guess you could use `show'. Hmm...
>
> I guess it might eventually be a good idea to use this code for
> `io__print', so maybe you could call it `print'.
I agree.
> Anyone else have any suggestions/comments about this naming issue?
There seems to be two distinct ways that you would want to output
a term:
- so that it can be parsed to retrieve the original
(guaranteed for _any_ term for which this is possible)
- so that it looks neat and is convenient for a human to
read
It is hard to satisfy both with one predicate (anybody got any ideas?).
io__write already satisfies the first point. IMHO, 'print' is a
good name for something which places the emphasis on the second
point, which is exactly what the term display library does.
Cheers,
Mark.
More information about the developers
mailing list