You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that in the toy_lang_ast domain, the type element of the term product is an instance of the data_type sum from the toy_lang_types domain.
Part of the motivation for this:
Without this, data_type would have to be defined within toy_lang_ast. Every permutation of toy_lang_ast then would have new Kotlin classes generated. This means that Kotlin code that works on DataType defined in one domain cannot be used on instances of DataType from a permuted domain, which is a real shame since can lead to code duplication. The proposed feature reduces this significantly, though does not entirely eliminate it.
Once Add include_file #57 has been completed, it will be extremely useful to be able to reference a data type defined in another file, such as domains that are designed to contain schema meta data.
This feature also reduces the amount of code generated by permuted domains since some parts of the domains which don't change from permutation to permutation can be placed in another domain which doesn't get permuted as often.
One possible area of complexity I see here is that we will have to consider how this will work with regard to our three different types of visitors. I believe generated visitors do not need to invoke visitors for other domains. If the user requires this they can override the appropriate method from one of the generated visitors and invoke the visitor manually.
The text was updated successfully, but these errors were encountered:
We should consider adding the ability to refer to types in other domains. I can add more details to this later if needed but this is the gist of it.
Note that in the
toy_lang_ast
domain, thetype
element of theterm
product is an instance of thedata_type
sum from thetoy_lang_types
domain.Part of the motivation for this:
data_type
would have to be defined withintoy_lang_ast
. Every permutation oftoy_lang_ast
then would have new Kotlin classes generated. This means that Kotlin code that works onDataType
defined in one domain cannot be used on instances ofDataType
from a permuted domain, which is a real shame since can lead to code duplication. The proposed feature reduces this significantly, though does not entirely eliminate it.One possible area of complexity I see here is that we will have to consider how this will work with regard to our three different types of visitors. I believe generated visitors do not need to invoke visitors for other domains. If the user requires this they can override the appropriate method from one of the generated visitors and invoke the visitor manually.
The text was updated successfully, but these errors were encountered: