Drasil icon indicating copy to clipboard operation
Drasil copied to clipboard

Use concepts for field names

Open samm82 opened this issue 1 year ago • 5 comments

In #3389, it was noted that we hardcode a bunch of field names as strings instead of using their associated concepts, which should be fixed.

https://github.com/JacquesCarette/Drasil/blob/3725db2ce30e5eb47c0ba9f93f96549d4f61ea21/code/drasil-docLang/lib/Drasil/DocumentLanguage/Definitions.hs#L216-L229

Note that simply mapping from a Sentence to a String is a code smell, so some other solution should be developed.

samm82 avatar May 09 '23 14:05 samm82

Similar to what was done by @harmanpreet-sagar in #3389, we might also need to do the same with all of those other raw Strings too.

balacij avatar May 09 '23 14:05 balacij

@samm82 is there any way to convert a NamedIdea to a String I know phrase can be used to get a Sentence but I did not find a way to convert that to a string.

janim2-2004 avatar May 31 '23 14:05 janim2-2004

I can't find the specific comment, but @JacquesCarette previously told me that trying to extract a String from a Sentence (or something that has a Sentence) is a hack and indicates that there is something weird going on at the design level. My guess is that if we want to reuse concepts for the names of the fields, we won't be able to use the Show instance for the class. This is similar to what @balacij suggested in this comment: "we should try to remove the Show instance and see what breaks".

samm82 avatar May 31 '23 15:05 samm82

Right: wherever you encounter this, probably the issue is that whoever wants a String should want a Sentence instead. Well, 80% of the time. So the details of the situation matter, to find those other 20%.

JacquesCarette avatar May 31 '23 18:05 JacquesCarette

Refer to #3455 for progress on this issue

janim2-2004 avatar Aug 11 '23 13:08 janim2-2004