asJsExp overrides are limiting type
Consider the asJsExp field defined in BaseMappedField -- it returns JsExp.
Then consider cases where subclasses override this field:
Note that in both of these cases, the new type is now a Num. (A JE.Num is a subclass of JsExp.)
The problem is that I can not override a MappedEnum's asJsExp field to return a JsExp (like Str) because the subclass needs to declare an explicit type of JsExp (rather than use inference).
For an enum, I'm interested in returning the enum's string value; and for a date-time, I'm interested in returning an alphanumeric time code (not a long integer).
Then consider cases where subclasses override this field:
Note that in both of these cases, the new type is now a Num. (A JE.Num is a subclass of JsExp.)
The problem is that I can not override a MappedEnum's asJsExp field to return a JsExp (like Str) because the subclass needs to declare an explicit type of JsExp (rather than use inference).
For an enum, I'm interested in returning the enum's string value; and for a date-time, I'm interested in returning an alphanumeric time code (not a long integer).
Leave a comment
(In revision:30ba7293db7639fcb3c34881e36fa6206a56b93c) Closes #482. the return type of asJsExp is explicitly defined so subclassing is easier
Branch: master
Branch: master