This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-04
Channels
- # admin-announcements (33)
- # announcements (2)
- # beginners (10)
- # boot (200)
- # cider (25)
- # cljs-dev (13)
- # clojure (75)
- # clojure-canada (2)
- # clojure-czech (1)
- # clojure-dev (16)
- # clojure-japan (7)
- # clojure-russia (20)
- # clojurescript (206)
- # clr (1)
- # cursive (24)
- # datascript (1)
- # datomic (1)
- # editors (2)
- # hoplon (136)
- # ldnclj (54)
- # off-topic (9)
- # om (5)
- # onyx (8)
- # re-frame (66)
- # reagent (19)
- # yada (21)
with alpha4 you get the new elem+
anonymous custom element and the defining form defelem+
(div
(mylist
(loop-tpl :bindings [x xs]
x)))
;; or
(div
((mylist "one")
"two"
"three"))
;; etc.
which is not a problem unless you have external javascript libraries that are fishing around in the DOM and replacing things
so while i was on vacation i did some hammock time about dynamic cells
@alandipert: regale us
oh right
so yeah with any resource you have two options
manage everything manually, or opt for automatic manage… which isn’t totally automatic
you still have to describe to the management system the rules for release
in the average program language the management rules can be inferred from scoping rules in most cases
and in some cases not, which is where the edge cases are
not necessarily
well scopes, no
right
so if we want automated-something we need to figure out how to inform the thing
i think maybe ‘strong’ and ‘weak’ are the terms
weak cells are open for collection
strong cells never are
but yeah there are reasons to make strong cells even without io
like what we do sometimes with setting inputs in a watcher
to jump the graph
because the things you want to be able to GC are usually created by procedures, not explicitly
so i think the way to doing is with ::string meta
*strong
i’m not sure about how to relegate the 2 ways
a new namespace feels like a good first step
to experiment anyway
what’s the default type?
(loop-tpl :binding [x xs]
(binding [*weak* true]
(li :color (cell= (if somecell? "red" "blue")) x)))
i see, yes
so dependers on weak cells are themselves weak you were saying?
or weakness is contagious
(let [alloc (atom #{})]
(binding [*allocated-cells* alloc]
(li :color (cell= (if asdf? "red" "blue")) x)))
i mean the cell constructor would add a reference to ever new cell to *allocated-cells*
if it's bound to an atom
i’m not sure
it seems like the ideal thing is metadata ona cell that informs the machinery to disappear it when the machinery is the last reference
right, it’s for the user to decide somehow
and that decision needs to be visible somehow since scope doesn’t cut it
(def some-cell (cell 123 :meta {:strong true}))
actually in that case some-cell would never go away because it’s named
so js would not gc it
maybe the thing to research is the relationship between gc and closures that do io in v8
the only thing that makes that cell a candidate for collection is removing the li from the DOM
maybe for loop-tpl go through a reference-counting allocator?
the central thing is definitely io
creating new things and inserting them somewhere, then removing them later and expecting them to be collected by GC
it's interesting that dynamic allocation is pretty well isolated to loop-tpl
and whatnot
so i feel like we can figure a way to use that to transparently manage dynamic allocation of cells, too
what about making like a "crack" or a fissure between strong and weak subtrees of the dep graph?
like instead of the cells themselves being strong or weak, it could be the connection between the subtrees that is strong or weak
like what if each cell's .-sources
was always a weakmap or something that doesn't hold a strong reference in the VM
then i think you could set a boundary around the GC eligable cells in the graph by adding formulas to the weak .-sinks
of the dependency cells
yeah i think that division of sources and sinks is the way to do it
i’d be curious to hear about the kinds oft hings @ul is needing dynamism for
i imagine the use case would always be io to the screen somehow
generating formulas to back temporarily visible parts of the output
like using cell=
for decorating a string in your example