rascal
rascal copied to clipboard
Rename reifyType and reifiedType operators for better understandability
Describe the bug
These two expression operators are confusing and their (static) semantics is sometimes unclear:
# Typetype(Symbol symbol,map[Symbol,Production] definitions)
This is their grammar rules in Rascal.rsc:
syntax Expression
= ...
| reifiedType : "type" "(" Expression symbol "," Expression definitions ")"
...
| reifyType : "#" Type type !>> "[" !selector
The enhancement proposal is to:
- change their name in the syntax definition
- fix all impacted source code in Rascal and Java downstream
- also rename the operators in the documentation
We might start by only the documentation, but eventually we should fix the implementation names as well.
The renaming:
syntax Expression
= ...
| typeValue : "type" "(" Expression symbol "," Expression definitions ")"
...
| typeLiteral : "#" Type type !>> "[" !selector
and corresponding changes in the definition of Pattern.
The rationale is clear in itself:
type(Symbol,map[...])is indeed a value representation of all Rascal types based onSymbolandProduction, completely dynamic and so the static type istype[value]- and
#Typeis a special literal type version of the above, where the user gets theSymbolvalue representation for free and the type can be statically asserted to be as concrete astype[Type]for every#Type.
IOW, the word "reify" does not carry as much meaning as one might expect ;-) "value" and "type" and "types as values" makes more sense IMHO. @PaulKlint @tvdstorm wdyt?