Drasil icon indicating copy to clipboard operation
Drasil copied to clipboard

`ShortName`: Redesign and move to `drasil-docLang` or `drasil-printers`

Open balacij opened this issue 8 months ago • 1 comments

https://github.com/JacquesCarette/Drasil/blob/5705da6c270bd1839801037c71a5e8466072e655/code/drasil-lang/lib/Language/Drasil/ShortName.hs#L8-L28

rg "instance\s+HasShortName" -ths

drasil-lang/lib/Language/Drasil/Document/Core.hs
113:instance HasShortName  LabelledContent where shortname = shortname . view ref

drasil-theory/lib/Theory/Drasil/Theory.hs
96:instance HasShortName       TheoryModel where shortname = lb

drasil-theory/lib/Theory/Drasil/GenDefn.hs
48:instance HasShortName       GenDefn where shortname     = view sn

drasil-theory/lib/Theory/Drasil/InstanceModel.hs
59:instance HasShortName       InstanceModel where shortname = lb

drasil-theory/lib/Theory/Drasil/DataDefinition.hs
94:instance HasShortName       DataDefinition where shortname = (^. ddPkt pktSN)

drasil-lang/lib/Language/Drasil/DecoratedReference.hs
38:instance HasShortName  DecRef where shortname (DR r _) = shortname r

drasil-lang/lib/Language/Drasil/Document.hs
54:instance HasShortName  Section where shortname = shortname . view lab

drasil-lang/lib/Language/Drasil/Reference.hs
39:instance HasShortName  Reference where shortname = sn

drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs
73:instance HasShortName  ConceptInstance where shortname = shnm

drasil-lang/lib/Language/Drasil/Chunk/Citation.hs
56:instance HasShortName Citation where shortname = sn

A ShortName is the human-readable reference address/symbol of a displayed chunk. For example, for an InstanceModel, it is of the form "IM:X," and for a bibtex entry, it is the key itself. Both are immediately shown in the rendered SRS documents. This is not fundamentally important knowledge to writers of theories and it is not a decision that should be imposed at time of creating a theory (though perhaps at time of declaring which theories are IMs/TMs/DDs/GDs).

What we really care about when it comes to ShortNames is having a strategy for giving display names for certain chunks we render in the SRS. That is important after the theories are created. In the code itself, when making theories, we might do these two actions at the same time, but that would come in some sort of WrappedTheory (which might end up being our existing IM/TM/GD/DD containers!) rather than a pure theory itself (which we want to move IMs/TMs/GDs/DDs to).

Should HasShortName and ShortName stay the way they are? I don't think so. I think HasShortName should be changed to something along the lines of ReferenceNameStrategy.

Further Notes:

  • This might also be something we redesign entirely at the same time as the referencing system.
  • ShortName should be wrapping an NP rather than a Sentence.
  • I tend towards moving this to drasil-docLang where all other display knowledge related to the SRS lies. However, if we're rebuilding this alongside the the references, HasShortName and ShortName to drasil-printers while the instances of HasShortName remain alongside the WrappedTheory (or IMs/TMs/DDs/GDs -- but perhaps these need to be moved too, towards drasil-docLang).

balacij avatar Apr 28 '25 18:04 balacij

I agree with the analysis (of what a ShortName is). And thus that maybe it is information that should be given to various items at the use site instead of at the definition site.

Maybe we need "semantic theories" and "displayable theories"? A displayable theory would wrap a semantic one -- indeed, like your proposed WrappedTheory).

I would tend to not wait. Fixing this now will still be an improvement, even if it gets further redesigned later.

JacquesCarette avatar Apr 30 '25 21:04 JacquesCarette