Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Clojure Design
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
Colour
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Undo
Redo
Keyboard Shortcuts Help
<h1 style="margin-left: 15.0px;">Problems</h1><ol><li>Want better parity with JVM Clojure</li><li>async Javascript (ie. nearly all Javascript) makes the binding macro effectively useless without bound-fn</li><li>Some common Clojure behaviors, like printing to a dynamically bound *out*, can't currently exist across an async boundary. See *print-fn* in CLJS</li><li>I'd like to create a dom manipulation library that has a *dom* dynamic variable, which acts like current working directory for dom manipulation functions. I've got some crazy ideas that I want to experiment with here, especially once I implement add-watch: I think I can achieve pretty seamless UI data binding.</li></ol><h2 style="margin-left: 15.0px;">Design</h2><ul><li><strong>Are Vars still useful without threads?</strong><ul><li>Yes! Async callbacks and threads have a lot of common design considerations</li><li>Several interactive development use cases<ul><li>Vars are invokable, so you can preserve the indirection with the #'var special form<ul><li>(comp f #'g) ; returns a function that dynamically updates with g, but not with f.</li></ul></li><li>IWatchable can be used to instantly re-test a function in a live browser</li></ul></li></ul></li></ul><ul><li><strong>Performance</strong></li><ul><li>Price is equivalent to that of JVM Clojure</li><ul><li>Extra indirection for def and deref</li><li>Shared stack of dynamic binding frames</li><li>Hash lookup on each access</li></ul><li>Opt-in price for the Var indirection</li><li>Treat ^:dynamic as that opt-in mechanism; no impact for static vars</li><li>Potential optimization: Leverage Javascript's prototypical inheritance instead of Frame type</li></ul><li><strong>Required compiler analysis</strong></li><ul><li>Metadata for resolved vars</li><li>Not available for external libraries</li><ul><li>OK, because we only care about ^:dynamic vars</li></ul></ul><li><strong>Interop</strong></li><ul><li>Vars declared as ^:dynamic differ from static ones: they are wrapped in the Var type</li><li>binding, etc are only applicable to dynamic vars, not useful to non-ClojureScript callers</li><li>External callers can still use deref and alter-var-root</li></ul></ul><ul><li><strong>Impact</strong></li><li style="margin-left: 15.0px;">Breaking change for binding macro</li><ul><li style="margin-left: 15.0px;">New behavior matches JVM clojure: binding only works on dynamic vars</li><li style="margin-left: 15.0px;">Simply marking any affected vars as ^:dynamic should be enough to upgrade</li></ul><li style="margin-left: 15.0px;">Potentially breaking changes for any cljs.core vars that are changed to ^:dynamic</li><ul><li style="margin-left: 15.0px;">*print-fn* and other printing vars</li><li style="margin-left: 15.0px;">Only breaking for Javascript interop usages, still source compatible</li></ul></ul>
Attachments
Labels
Location
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced