I'm trying to straighten out the confusion regarding how <datapath> elements
and "datapath" attributes are
handled on nodes and user-defined classes.

Background is http://www.openlaszlo.org/jira/browse/LPP-5193
which really goes back to this bug
http://www.openlaszlo.org/jira/browse/LPP-4386


Tucker's suggestion is that using a <datapath> tag should be exactly
equivalent to using a
"datapath=..." attribute, and I agree.

The compiler treats them pretty differently now; a <datapath> tag is
converted into a special
node-constructor list, which is stashed on the $datapath attribute to the
node constructor. A
"datapath" attribute is just passed in as  the "datapath" attribute.

There are two places that a datapath gets created right now in LzNode. There
is a "early setter"
for  '$datapath'  , LzNode.__LZmakeDatapath.

The  'datapath' attribute gets the regular setter, LzNode.setDatapath.

What if we got rid of the setter of $datapath, and make setDatapath
check for the $datapath attribute if there is one. The compiler can always
place a value in the "datapath" attribute, in both the case of a <datapath>
tag, or 'datapath' attribute. If there is a <datapath> tag, the xpath will
be placed in the "datapath" attribute, and the complete set of args will
be placed in the $datapath attribute. That way the setDatapath setter gets
triggered in all cases where you specified a datapath.

I'm going to try this. The only worry I have is if someone is
depending on the "earlySetter" behavior somehow. It would be bad if
they are, because the behavior is different in the two cases.


-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to