-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlowContent and PhrasingContent separation is useless #23
Comments
Very simple suggestion is to declare all tag-functions for the Pros:
Cons:
|
Just faced the same problem. |
It is going to be fixed with upcoming release (will be aligned to kotlin 1.1 release) |
You can use |
@cy6erGn0m Just tested it. And yes, version 0.6+ works very well. Seems like you've completely refactored the inheritance architecture of the library. Thank you! |
@kosiakk can we close it? Are your use-cases satisfied now? |
Yes, |
Apparently those contents come from XSD, but in the end of the day, they are quite useless and very confusing in kotlinx.html.
It does not help with static type check
if I write something invalid according to XSD, like
body > span > div
it is still silently accepted by the compiler and even leads to obscure
IllegalStateException("You can't change tag attribute because it was already passed to the downstream")
if I try to change attributes.To me this seems like a general problem of 'fall-through' builder design.
It breaks the abstraction
Both functions,
FlowContent.i
andPhrasingContent.i
are identical: they produce the sameI
object.But there's no common abstraction between those two functions. Which leads to the third problem.
It prevents reusable code
I chose to use
Tag
as a basis for my DSL, which seemed like a good base class. But in the end I had to write the ugliest code in a decade of my career:Both
if
andelse
part are identical, but functionsi
andspan
are different.Condition like
if (this is FlowContent || this is PhrasingContent)
cannot work, of course.The text was updated successfully, but these errors were encountered: