Comments (8)
It would be nice to have defnode and defcnode as well in that file.
from dommy.
This should work:
(defmacro deftempl [name args node-form]
`(defn ~name ~args
(dommy.template/node ~node-form)))
(defmacro defctempl [name args node-form]
`(defn ~name ~args
(dommy.template-compile/node ~node-form)))
(defmacro defnode [name node-form]
`(def ~name
(dommy.template/node ~node-form)))
(defmacro defcnode [name node-form]
`(def ~name
(dommy.template-compile/node ~node-form)))
from dommy.
Why would you want to use deftemplate with the non-compiled (runtime) templating? Why would you not take the policy of compile as much of what you can that deftemplate does?
from dommy.
The convenience of the macro is useful for when you can use the compiled version of node, but also when you cannot. My understanding is that the compiled version cannot be used when you need looping, which is the largest case for me, since I'm doing 100% client-side templating.
On Mar 22, 2013, at 2:35 PM, Aria Haghighi [email protected] wrote:
Why would you want to use deftemplate with the non-compiled (runtime) templating? Why would you not take the policy of compile as much of what you can that deftemplate does?
—
Reply to this email directly or view it on GitHub.
from dommy.
No. deftemplate should always work and fall back to runtime when it can no
longer compile stuff (when you stop using literals); take a look the code
and see where it calls the runtime when it no longer can parse. So
deftemplate should always work regardless. Are you seeing a case where
it's not.
On Fri, Mar 22, 2013 at 11:39 AM, David Sargeant
[email protected]:
The convenience of the macro is useful for when you can use the compiled
version of node, but also when you cannot. My understanding is that the
compiled version cannot be used when you need looping, which is the largest
case for me, since I'm doing 100% client-side templating.On Mar 22, 2013, at 2:35 PM, Aria Haghighi [email protected]
wrote:Why would you want to use deftemplate with the non-compiled (runtime)
templating? Why would you not take the policy of compile as much of what
you can that deftemplate does?—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-15314279
.
website: http://aria42.com
from dommy.
I'm not sure I fully understand what you are saying. The bottom line I believe is that the macro does not reference a specific version of node, and is not fully qualified, so the ambiguity is a problem if you want to use both versions of node.
On Mar 22, 2013, at 2:50 PM, Aria Haghighi [email protected] wrote:
No. deftemplate should always work and fall back to runtime when it can no
longer compile stuff (when you stop using literals); take a look the code
and see where it calls the runtime when it no longer can parse. So
deftemplate should always work regardless. Are you seeing a case where
it's not.On Fri, Mar 22, 2013 at 11:39 AM, David Sargeant
[email protected]:The convenience of the macro is useful for when you can use the compiled
version of node, but also when you cannot. My understanding is that the
compiled version cannot be used when you need looping, which is the largest
case for me, since I'm doing 100% client-side templating.On Mar 22, 2013, at 2:35 PM, Aria Haghighi [email protected]
wrote:Why would you want to use deftemplate with the non-compiled (runtime)
templating? Why would you not take the policy of compile as much of what
you can that deftemplate does?—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-15314279
.website: http://aria42.com
—
Reply to this email directly or view it on GitHub.
from dommy.
But why would you want to use both versions since the macro-variant will fallback to the runtime node (dommy.core/node) when the expression isn't compile-time parseable. Why wouldn't you prefer macro-compile when possible?
from dommy.
I didn't know that it worked that way. That sounds like a good solution as far as I understand things.
On Mar 24, 2013, at 5:54 PM, Aria Haghighi [email protected] wrote:
But why would you want to use both versions since the macro-variant will fallback to the runtime node (dommy.core/node) when the expression isn't compile-time parseable. Why wouldn't you prefer macro-compile when possible?
—
Reply to this email directly or view it on GitHub.
from dommy.
Related Issues (20)
- set-class! returns the class name instead of the element
- Listening to js/window :load breaks with :advanced optimizations
- html2hiccup
- HTML to Hiccup
- Click Events do not work HOT 1
- dommy breaks when Polymer is in use HOT 9
- Add support for Custom Elements HOT 12
- Tests broken in Firefox with attr/style
- Any plan to cut a release? HOT 3
- Android 4.0 stock browser compatibility with Dommy? HOT 1
- Listen to keypress HOT 1
- Request for CLJS version doc HOT 7
- Compilation warnings on Clojure 1.7 HOT 10
- Huge number of warnings HOT 1
- append! requires a DOM node, documentation says otherwise HOT 1
- Delegated event handling
- Tagged releases
- Prose documentation HOT 2
- Length of children HOT 2
- interested in a dispatch! function?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dommy.