Thank to all for comment. Ralf raised most important points,
so I will answer this first.
On Wed, Jun 11, 2025 at 08:59:14PM +0200, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote:
>
> as you know, I would like to let HyperDoc die.
> But, maybe that sound too extreme for what I actually mean.
> And I agree to some extend to your plan for a new hyperdoc.
>
> Let me explain my wishes.
>
> FriCAS should have an interface (in LISP or SPAD) that let's
> SPAD or external programs get information about
> categories/domains/packages/documentation.
> From such an interface it should be easy to generate any output format
> be it html, rst or pdf.
>
> I think this can be started without changing any code for hyperdoc.
> Such an interface should already contain code to compute a datastructure
> representing the data for a page (not actually rendered in any format), in
> particular, conditional exports should be computed and the datastructure
> should have enough information to produce links to other data.
>
> Yes, that is good for a getting a "static" view of a constructor similar to
> what is presented at
fricas.io/api, but computable on-the-fly.
>
> You also want such a view in a "dynamic" form, i.e. (similar to what current
> hyperdoc provides) getting information about
> - usage of domains
> - fuction implementation (in which package/domain)
> - etc.
>
> Shouldn't it be possible to create an API that let's query such information
> by just sending strings to specify the arguments?
Yes, that is part of my plan, with possibly not so important
difference that I want Symbol-s in many places.
> Why would that need Boot code if there is a function that translates the
> string "Polynomial Integer" into the respective domain and uses that in
> querying the various places where the wanted information is stored in
> FriCAS?
My point is about doing change in incremental way. There is about
6000 lines of Boot code doing things related to HyperDoc, ')show'
and similar. Replacement preserving functionality may be smaller,
but also may be bigger. There are redundancies in existing code
so we may be able to delete some code. But Spad needs declarations,
type differences may force some duplication, so there is good
chance that Spad version may be bigger.
Doing change of this scale at "one shot" is likely to be a failure.
Keeping parallel "old" and "new" versions is a pain. That is
why I want new code to work smootly with old, in particular
using the same data structures in both.
> Whether you then program in interface to present such information, is
> another business. I wouldn't do that but rather rely on ordinary webbrowsers
> to display such information. One can probably extent jfricas to start
> queries and have examples executed in a notebook interface.
>
> Yes, I like to be able to get more information out of FriCAS than just a
> static API page (although I think that having them static on the web is
> still a good idea). What I am not in favour of is the current HyperDoc
> window. That looks old and not very attractive. That should die. Not the
> information it shows, of course.
Well, current HyperDoc window has its problems. But I hear "old
and not very attractive", but did not see mention of what I consider
to be main problem. So most of HyperDoc critique looks shallow
to me. I like fact that HyperDoc executable is quite lightweight
by modern criteria.
> At the same time, I would like to put the HyperTeX format to sleep.
> This format was interesting 30 years ago, but now there are better formats
> like rst of markdown or ... Why should we keep our specific HyperTeX-Format
> that nobody outside FriCAS cares about?
There are rather strong reasons to have format that "nobody outside
FriCAS cares about", that is format that _we_ control. Namely, in
opposite case we have to deal with changes, regardless if like
them or not. If we need extra features we can add them, we can
implement extra features. HyperTeX is a subset of TeX, which
puts some limitations, but TeX format is quite extensible so
that is not a big problem and we get advantage of reusing
existing machinery.
> I do not know whether my code is good to be adapted, because initially, I
> only had the presentation into an .rst page in my mind. I think one should
> carefully separate code that "provides" information from code that
> translates that into a certain format.
>
> Can we create a new branch and work (as a first step) at an interface
> that provides all the necessary information in form of SExpression?
Well, branch implies extra effort and I would prefer to avoid it
if possible. I started from different point, that is communitation
with HyperDoc window and now I moving towards core part, that is
search functionality. So, the interface should appear, but there
is more code than this.
> > As I wrote I have part of HyperDoc code in Spad. HyperDoc
> > page has the following representation:
> >
> > Rep := Record(name : Symbol, domain_conditions : LSE,
> > variable_alist : ALS, pattern_vars : List(PSR),
> > radio_buttons : ALS, input_areas : ALS,
> > property_list : ALS, page_description : LSE,
> > work_area : List(String))
>
> That is seemingly taylored for a hyperdoc page. Why should one have
> radio_buttons in an information record?
This record describes single page of interface. Such pages are
supposed to be interactive, so may contain buttons. For example
"Detailed search" page contains buttons for various options
affecting search. Also, HyperDoc handles example pages and
those pages also contain buttons.
As I wrote, this is rather unbalanced, most features are crammed
into 'property_list' and 'page_description' and most pages have
empty list as 'domain_conditions, 'variable_alist', 'pattern_vars',
'radio_buttons' and 'input_areas' but ATM this is needed for
compatibility with Boot code. 'work_area' is new thing, I
need it to avoid global variables used in old Boot code.
> I would rather have several data
> structures like
>
> FUN ==> Record(
> name: Symbol,
> source: SEX,
> target: SEX,
> doc: String,
> condition: SEX)
>
> CAT ==> Record(
> name: Symbol,
> args: List SEX,
> cats: List Record(cat: CAT, condition: SEX)
> funs: List FUN)
>
> etc. (Don't take that too serious. It's just a draft.)
>
> Anyhow, we should come up with a good datastructure that provide
> easy access to the information.
Well, it is not clear to me what types will be best for quering
(searching). The type I showed has quite different purpose,
it represents basic unit (that is page) of user interface.
> If you want a datastructure that is just representing the current hyperdoc
> structure, I am not interested. That is too much presentation oriented
> already.
Yes, it is presentation oriented. I would like to make it more
logical, but I do not know how far one can go in this direction
without excessive effort. However, presentation part is
necessary. Simply I want to decouple search and gathering of
information from presentation part. Currently search and
gathering of information is partly intertwined with presentation.
In better structured code presentation part should call
search and information gathering routines. Technically,
calling Boot from Spad is easier than calling Spad from
boot, that is why I prefer to start at presentation layer
and work toward more fundamental layers (and not in
opposite direction).
> > this, but I am not sure if this will be possible: Ralf uses
> > data structures (in particular XHashTable) which are problematic
> > to access from Boot.
>
> There is nothing specific about XHashTable. Any hash structure will do. Use
> an association list, if you like.
>
> > Extra remarks: my goal is to allow dynamic interface either using
> > current C code or a web browser (depending on user choice).
>
> As I said, I would rather like a generic interface to all the information,
> separated from code that does the presentation.
Yes, I want such an interface too. Simply I want woring code
in intermediate stages and staring from presentation looks
easier. Also, having working presentation gives me assurance
that I did not forget something important for presentation.
--
Waldek Hebisch