[Laszlo-dev] design question, what to do if someone wants to instantiate a new dataset with same name as the old one?
Henry Minsky
henry.minsky at gmail.com
Tue Nov 20 08:14:20 PST 2007
This is a question regarding an issue raised by this bug which Andre
reported
http://jira.openlaszlo.org/jira/browse/LPP-4688
In his test case, he has code which creates a (globally) named dataset ,
creates a view which uses it in a datapath,
then destroys the datapath and creates a new one with the same name
<method name="createDataset" args="name, local, text" ><![CDATA[
var ds = new LzDataset(local ? this : canvas, {"name":name});
ds.appendChild(new LzDataElement("test", {}, [new
LzDataText(text)]));
return ds;
]]></method>
<method name="test_1" ><![CDATA[
var ds = this.createDataset("dsdyn1", false, "foo");
var text = new lz.text(this, {id:"leak1",
datapath:"dsdyn1:/test/text()", visible:false});
ds.destroy();
ds = this.createDataset("dsdyn1", false, "bar");
There's two issues, one is how to make sure that when you destroy a dataset,
all the views which are bound to it
release their pointers.
The other issue is should there be some mechanism so that if a new dataset
is created with the same name, that
views which reference it in their datapath should rebind to the new dataset
automatically? That seems like a hard
problem to me, and aside from the cost and complexity to maintain it. I
don't know how often people
destroy and create datasets, but I always considered them as permanent, in
that you can
reload them or clear out their contents, but destroying and recreating one
with the same
name is something I had not considered.
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20071120/3430aa00/attachment.html
More information about the Laszlo-dev
mailing list