Drasil
Drasil copied to clipboard
Rename chunks named in the form "XChunk" as just "X"
In #3017, we established that we will continue to use the name "Chunk" to refer to information Drasil works with. If we think of "chunks" as instances of our Haskell types (which is how we build them in Drasil), then we also have "chunk types" (or categories/classifications/etc). I believe we also have an assumption that all data types we build are chunks too. So, it feels redundant when we have chunks (such as those listed below) with "Chunk" in their type's name. Should we rename these chunks?
rg "data [a-zA-Z]+Chunk "
drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs
40:data NamedChunk = NC {
drasil-lang/lib/Language/Drasil/Chunk/Unital.hs
30:data UnitalChunk = UC { _defq' :: DefinedQuantityDict
drasil-lang/lib/Language/Drasil/Chunk/UncertainQuantity.hs
33:data UncertainChunk = UCh { _conc :: ConstrainedChunk , _unc' :: Uncertainty }
drasil-lang/lib/Language/Drasil/Chunk/Constrained.hs
36:data ConstrainedChunk = ConstrainedChunk { _qd :: QuantityDict
drasil-lang/lib/Language/Drasil/Chunk/Unitary.hs
29:data UnitaryChunk = UC { _quant :: QuantityDict
drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs
32:data ConceptChunk = ConDict { _idea :: IdeaDict -- ^ Contains the idea of the concept.
drasil-code-base/lib/Language/Drasil/Chunk/CodeBase.hs
43:data CodeChunk = CodeC { _qc :: QuantityDict
67:data CodeVarChunk = CodeVC {_ccv :: CodeChunk,
drasil-code/lib/Language/Drasil/Chunk/Parameter.hs
15:data ParameterChunk = PC {_pcc :: CodeChunk
(Not assigning anyone, but pinging @smiths and @JacquesCarette in particular.)
My initial concern is about readability. Especially pertaining to at least some of the chunks if the chunk descriptor is removed.
Readability might be an issue for some of them, but they might just need to be renamed to something else that better describes them (“NamedChunk” in particular).
Keeping “Chunks” in the suffix seems odd, it feels akin to adding “Type” to the end of each type name in any typed language -- we should know it's a type/chunk by its definition.
they might just need to be renamed to something else that better describes them
I agree with this.
Yes, it is redundant to have 'Chunk' in those names, and they should be renamed. Most of them should just have the Chunk
part deleted. Some need renamed (Constrained
stands out to me as one such - not because the word 'Constrained' is bad, but because it is an adjective while chunk descriptors should be nouns).
Roughly speaking, HasUID
is a pretty good predicate for spotting when a structure is a chunk or not.
What's the rationale for removing the newcomers label from this issue? I feel like a newcomer could take a look and at least propose some new names? Just happened upon it looking for something else and was curious lol
Hmm, I think that might have been an accident. If no, then I don't remember what my rationale was. Thanks @samm82 !
I have some ideas for better names. Change ParameterChunk with Param since Parameter is already used. Remove the Chunk off of CodeVarChunk and CodeChunk, I feel these are the most suitable names for both. Jason mentioned that ExplainedIdea would be a good fit for ConceptChunk which makes sense as a concept in this case is the same as an explained idea. I feel that ConstrainedValue is good for ConstrainedChunk more than ConstrainedQuanity as a string is a value not a quantity. Change UnitalChunk with UnitDefinedQuantity as they are concepts with quantities that must have a unit definition. Change UnitaryChunk with QuantifiedUnit as A Unitary is a quantity that must have a unit.
Knowing the relationship between these chunk types would help inform this discussion: for example, if ConstrainedChunk
builds off of ConceptChunk
, then perhaps ConstrainedIdea
would be a more consistent/descriptive name.
Similar to this comment, I don't think UnitaryChunk
should be described as a QuantifiedUnit
. Slightly related: what is the difference between having a "unit" and having a "unit definition" (i.e., what is the difference between UnitalChunk
and UnitaryChunk
)?
@samm82 since all the Chunks are built from IdeaDict would it be more fitting to just replace Chunk with Idea? Except for ConceptChunk which I think would make sense to change with ExplainedIdea.
That's definitely an idea (pun unintended) 🤔 I personally think there is a distinction between a pure "idea" and a "quantity" (as I think you've alluded to before) that we could also investigate, but I personally would be hesitant to say that a given renaming is "right" without some more discussion about its design implications/how it changes how we think about these chunks and how they're built 😅
I've added this issue to our agenda for Monday (#3730) under the topic of the redesign of chunks and attributes. @NoahCardoso for the meeting it would be great if you could have your best guess for the renaming. I'm optimistic that we'll be able to make some decisions as a group that are difficult to make over the issue tracker.