Open
Description
I'd like to start a bit of a discussion around the DSL syntax.
Multiple paths to one goal:
router.clear()
router.push(Route())
router {
clear() push Route()
}
router {
clear()
push(Route())
}
There are several ways to perform similar actions. The first way isn't correct, as it won't bundle up the actions as a single item, but my understanding is the last two ways are essentially the same. ̛I think it would be a better idea to have a single syntax, even if it means that a single "push" needs to be performed as:
router { push() }
Builder syntax:
router {
clear() push RouteA() push RouteB() push RouteC()
}
The builder continuation syntax that allows a user to push a series of routes like this is inconsistent with the use of infix functions, as a user is unable to split these onto different lines. The following code will not compile:
router {
clear() push RouteA()
push RouteB()
push RouteC()
}
I have two questions:
- Is the builder/continuation syntax actually useful? Could commands just be split onto different lines?
- If the builder/continuation syntax is useful, should the use of
infix
be removed, so a user can split the continuation over multple lines?
Metadata
Metadata
Assignees
Labels
No labels