Skip to content
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

ECS macro improvements #119

Open
heyx3 opened this issue Nov 18, 2023 · 2 comments
Open

ECS macro improvements #119

heyx3 opened this issue Nov 18, 2023 · 2 comments
Labels
META:internal Created by Billy RE:ECS Something within the ECS module SIZE:medium Conceptually easy but bigger in scope/conceptually hard but small in scope/medium in both TYPE:enhancement Adding something new to B+

Comments

@heyx3
Copy link
Owner

heyx3 commented Nov 18, 2023

1. CONSTRUCT_DEFAULT automatically defines a CONSTRUCT() which takes each field as a parameter.
2. CONSTRUCT_MANUAL gives you much more flexibility with the type signature by requiring you to manually invoke the super-type's constructor with SUPER().
3. Allow for component type parameters.
4. Allow for setting a field's initial value with @kwdef-like syntax, turning it from an ordered parameter to a named parameter
5. Allow child components to have an implicit constructor while their parents have explicit (just add the child fields as extra arguments, and peel them off when calling the parent constructor)
6. Combine doc-strings for fields and promises/configurables into the component's own doc-string

  • Ironically, the fact that we can't get doc-strings working for @component helps us out here: take the doc-string as a normal macro parameter and turn it into a @doc call in the emitted code.
  1. Double-check that every top-level statement is preceded by a line-number node, and if so, capture and emit those line-number nodes similarly to how we capture the doc-string at the top of the statement loop.
    8. Check that implemented promises and configurations have the same type signature as the original (for parameter typing, automatically insert the correct type if none is provided; otherwise assert the provided type is <: the original type) NOTE: This is no longer considered useful. Instead, child implementations are totally allowed to offer different type parameters than their parents, and both child and parent participate in overload resolution (with children usually having priority).
  2. Allow for marking configurable and promise implementations as final so that children can't override them.
  3. Allow for configuring the custom print(), for example making it multi-line with each field tabbed in
@heyx3 heyx3 added TYPE:enhancement Adding something new to B+ SIZE:medium Conceptually easy but bigger in scope/conceptually hard but small in scope/medium in both RE:ECS Something within the ECS module labels Nov 18, 2023
@heyx3
Copy link
Owner Author

heyx3 commented Nov 19, 2023

The constructors have been simplified and improved in order to get Drill8 working. There were too many edge-cases in my original design.

In the new design, there is a default constructor which takes each field's value, and if you define a custom constructor, then you must call SUPER(...) manually.

@heyx3 heyx3 added the META:internal Created by Billy label Feb 2, 2024
@heyx3
Copy link
Owner Author

heyx3 commented Mar 18, 2024

Type parameters have been added! (hopefully merging it into master tonight). And this work clarified a few other things about how promises and configurables should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
META:internal Created by Billy RE:ECS Something within the ECS module SIZE:medium Conceptually easy but bigger in scope/conceptually hard but small in scope/medium in both TYPE:enhancement Adding something new to B+
Projects
None yet
Development

No branches or pull requests

1 participant