-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesigning Choices
to enable new input patterns
#3781
Comments
Choices
for new input patternsChoices
to enable new input patterns
@smiths had a good idea in related discussion #3780. Rather than giving the user full control over every aspect of the code, we could create a curated list of decisions that fit well together, and just offer those. This would simplify the structure of |
One change to The other reason is that the currently available design choices that involve We should probably wait to make changes until we have an overall direction, but I just thought I should mention this piece here. |
So one way to handle "dependent choices" is to have the data-structures direct them. Let me take |
@JacquesCarette I've been thinking a bit about your comment, and this is currently the set of choices that makes sense to me: Dependent choices hierarchy
Pre-defined semanticsThere's still some flexibility that we can't express, so here are the semantics that I would choose to stick with:
Pros
Cons
I think that if we want to allow the full set of choices, this is (hopefully) on the right track. I need to think some more if there's a good way of preventing complexity (#3780), but if this is the way we want to go then I think we might be able to figure that part out. |
A few notes from yesterday's meeting:
|
Thank you for the summary @B-rando1. That is a great habit! |
I'm having some technical difficulties with getting Drasil/code/drasil-code/lib/Language/Drasil/Code/Imperative/Modules.hs Lines 410 to 435 in 8ae2f82
The issue is that, as you might expect, interleaving the parsing and validation is not as straightforward. From reverse-engineering the code a bit, Based on that, what makes the most sense to me is to change the types of these variables form If we could get things to that point, then we could build up a Does this sound like a smart way of doing it? I'm hoping that this way is doable, but there are a lot of parts to the code that I don't understand yet. I'll have to become friends with the |
I may have found a problem with interleaved constraints. As I described in my last comment, we need some way of keeping track of which variables have been defined, and which variables each input constraint depends on. The first one seems just about possible (I got it working for derived inputs, and in theory parsed inputs should be similar). The problem is that, as far as I can tell, each constraint is tied to a single variable, even if it depends on multiple variables. Take, for example, this example from Unitals.hs in PD Controller: Because If we want to have interleaved parsing and constraint-checking, we'll need a better system of keeping track of all variables involved with constraints. It might be possible to reason it out under this current system, but I do wonder it would be better to make constraints their own thing (rather than a part of |
Having constraints as a separate thing that explicitly lists the variables that it depends on is an excellent idea. Then we could do a topological sort and output things in the dependency order. |
I was talking with @balacij and @NoahCardoso about this, and we found a function eNamesRI that finds all |
I just thought I should say something on this before the end of the summer. If I remember correctly, this issue was originally created because we were trying to 'fake' classes in Julia using structs. We found that not all constructor patterns could easily be translated to struct constructors, so I suggested we create some constructor patterns that would translate well. From there it snowballed a bit, and we decided to try adding the 'full suite' of input patterns. In the end, I didn't get very far.
I stopped working on it for a couple of reasons.
Next steps
|
As discussed in #3752, we want to add new input patterns to Drasil. From looking at drasil-code it seems that we need to change
Choices
in order to allow users to express the input patterns they would like. I have a design, but it has flaws so I would like some advice.Changes to
Choices
Choices
already has a couple of relevant properties:architecture :: Architecture
contains information about whether the parsing and validation functions are in the same class or in separate classes.dataInfo :: DataInfo
contains information about whether the input is bundled in a class or contained in separate variables.I created a new datatype
data LogicLoc = InCons | InMthd | InFunc
. I then added two fields of this type toChoices
:parseLoc
andvalidateLoc
. (I'm not too sure about any of these names, feel free to suggest better ones 😄). The idea is that we can specify whether parsing and validation are done directly in the constructor, in a method to be called by the constructor, or in an external function.Notes
Unbundled
, then only theInFunc
option for parsing and validation makes sense.It's possible I'm overanalyzing this, but it just seems like a better design of
Choices
would lead to fewer edge-cases to deal with.The text was updated successfully, but these errors were encountered: