Skip to content
thejohnfreeman edited this page Nov 29, 2012 · 2 revisions

Writers

It is possible to semantically "write" a computed variable by changing its dependencies. As a convenience, hd.computed accepts a second function, a writer, to do just that. The writer will be called upon any attempt to write the computed variable through its proxy. The writer should accept a single argument (the desired value of the computed variable):

[ Example to come. ]

This feature does not lift the restriction that no multi-way constraint method may write to a computed variable. Do not think that defining a writer will let you use a value binder with the variable because some of them implicitly create two-way constraints.

[WARNING] Use of this feature is discouraged. It is an optimization in some situations, but quite brittle. Use a two-way constraint instead.

Clone this wiki locally