E07230: 'default' with an operator must not have signature or body
What went wrong
You've added parameters or implementation to a 'default' operator. Default operators are AUTO-GENERATED - you can't customize them.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 835 (Why can't I provide a signature or body when using 'defau...)
Rationale
'default' means "generate it for me" - you don't get to customize it.
How to fix it
- Remove parameters and body from default operator
- Or remove 'default' and provide full implementation
Common causes
- Trying to customize default operator behavior
- Copy/paste from regular operator
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07230: 'default' with an operator must not have signature or body
#!ek9 defines module error.e07230.bad defines record Label text <- String() //'default' generates the whole operator: no signature, no body default operator ? default operator $ as pure <- rtn as String: text
Fixed: Either 'default operator $' alone, or the operator written without 'default'
#!ek9 defines module error.e07230.good defines record Label text <- String() //Either generate it... default operator ? default operator $ //...or write it in full, without 'default' operator $$ as pure <- rtn as JSON: JSON("text", JSON(text))
Questions and answers
These Q&A entries show E07230 and its fix: