Replies: 1 comment
-
Yeah, this looks pretty nice, though your example doesn't work for me (having the reference within a closure or not doesn't change anything for me):
Other shortcomings (that might not be relevant and can be easily avoided in many cases) are:
That said, I intentionally moved |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently the grammars in the examples look like this:
With dart 2.12's
late final
variables, they could look like this:The cool thing about
late final
is that:dynamic
AFAICT).The only thing ugly about it is recursive rules, because
ref0(() => myRule)
looks ugly. But honestly,ref0(myRule)
looks ugly too, and the good thing about usinglate final
variables is that the dart analyzer warns you when you have a cycle in the initializers, so you can just completely omit theref0
's and only put them in place when necessary (which is when the analyzer warns you). That means in total, the code looks much cleaner.Overriding them works as expected too.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions