-
Notifications
You must be signed in to change notification settings - Fork 2
Proposal: Prefix-based HTML DSL #8
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
Conversation
|
why not just single letter modules and double ticked for reserved keywords? https://stackoverflow.com/questions/6639688/using-keywords-as-identifiers-in-f let myComponent =
m.div [ a.``class`` "container" ] [
m.h1 [ a.id "title" ] [ "Hello World" ]
m.p "This is a paragraph"
] |
I appreciate the feedback! It's not a matter of the protected keywords, those are dealt with currently using single quote ticks (i.e., |
|
After careful consideration and refinement, I am confident in the implementation and its benefits. The prefix-based HTML DSL for Falco.Markup achieves the goals of reducing visual noise, avoiding naming conflicts, and maintaining backward compatibility. The unified DSL module introduces consistent prefix-based naming conventions for elements, text shortcuts, and attributes, making code cleaner and more readable. The example usage demonstrates how this approach simplifies markup creation while preserving the flexibility of the original modules. I believe this enhancement will significantly improve the developer experience for Falco.Markup users. As the PR has been open for some time and no further concerns have been raised, I am happy with the result and ready to move forward. Thank you again for your support and collaboration! |
Proposal: Prefix-based HTML DSL for Falco.Markup
Problem Statement
Currently, Falco.Markup users need to use prefix notation (i.e.,
Elem.div, or self alias) for both theElemandAttrmodules. When the complexity of the markup increases, the level of noise created is substantial.Proposed Solution
Full implementation can be found here.
Implement a unified DSL module with consistent prefix-based naming:
_) prefix for text elements (i.e.,_text)_) prefix for HTML elements (i.e.,_div)Text.h1 "here"becomes_h1' "here"_) prefix and suffix for attributes (i.e.,_class_)Implementation Details
Benefits
Example Usage
Migration
No breaking changes - existing code continues to work while new code can adopt the prefixed approach.