JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Making Glassbr compatible with Strict Data #3818

Closed NoahCardoso closed 2 months ago

NoahCardoso commented 3 months ago

In glassbr.unitals the ConstrainedChunk nomThick is self-referential creating an infinite loop when used with strict data. To prevent this, I created a new function called nomThick' that gives the displayDblConstrntsAsSet function in nomThick the information it needs to properly display the nominal thickness constraints as a set.

samm82 commented 3 months ago

Is there a specific reason this was the approach taken? displayDblConstrntsAsSet only needs a Quantity, so we shouldn't have to make a whole new ConstrainedChunk. How else does the Quantity portion of nomThick get used? Does it make sense to have a separate Quantity, or should this "helper" object be inlined?

NoahCardoso commented 3 months ago

I argee I think it looks better when inlined. I changed it to a QuantityDict since making it a ConstrainedChunk adds unnecessary information.

nomThick = cuc "nomThick" 
  (nounPhraseSent $ S "nominal thickness" +:+ displayDblConstrntsAsSet 
    `(mkQuant "nomThick" (nounPhraseSent $ S "nominal thickness") lT Rational Nothing Nothing)` nominalThicknesses)
  lT millimetre {-Discrete nominalThicknesses, but not implemented-} Rational 
  [{- TODO: add back constraint: enumc nominalThicknesses -}] $ exactDbl 8
balacij commented 3 months ago

@NoahCardoso and I had a discussion just before 5pm on Friday, so the discussion didn't hit here yet, but we're going to look into removing the problematic part of the description entirely. Right now, the description of "t / nominal thickness" is "nominal thickness t \in {....}", which carries information about a constraint (i.e., #2655). So, it looks like we need to...

  1. Add Set support to *Expr and Space
  2. Add basic Set support to GOOL (@B-rando1 mentioned he can help us with this :slightly_smiling_face: )
  3. Add back the constraint
  4. Remove the constraint from the description

Then, we end up completely avoiding the issue by removing it's need for existence (i.e., ~ remembering to add in a feature).

balacij commented 2 months ago

Closing in favour of (new) work towards #2655.