Skip to content

Conversation

DhairyaLGandhi
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Ref #3734

Add any other context about the problem here.

Are there cases where there are expression evaluations anywhere for the model parsing? Currently everything is delayed, but that means local variables are not referred to properly, and esc will simply convert the escaped expression, whereas we need it as parse/ expansion time.

Comment on lines +1050 to +1067
struct Author end
struct MyVersion end
struct License end
struct Category end
struct Tags end
struct MyBool end
struct NewInt end

@mtkmodel TestMetadataModel begin
@metadata begin
Author = "Test Author"
MyVersion = "1.0.0"
License = "MIT"
Category => "example"
Tags = ["test", "demo", "metadata"]
MyBool => false
NewInt => 1
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these have to be structs? Can we have some docs around this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was requested this API to avoid potential key overwrites. The setmetadata utility also explicitly only has dispatches for ::DataType. The intial version of the PR was a more standard Dict{Symbol, Any}. We could have checked for existing keys when setting too imo, and reject overwrites that way.

Cc @AayushSabharwal

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in line with how symbolic metadata is stored. They don't have to be structs, just types. The reason is that this automatically avoids name conflicts since identically named types in different modules are different types, avoiding the necessity for name mangling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants