[Xotcl] Differences between XOTcl 1 and XOTcl 2 setter and getter methods for slots?
Michael Aram
michael at aram.at
Mon Oct 19 13:20:05 CEST 2015
...in response to "
http://alice.wu-wien.ac.at:8000/xotcl-mailing-list/2992.html"...
Dear Prof. Neumann,
thank you very much for the detailed answer; your "patch" seems to solve
the problem.
For the time being, I will leave it as it is; if I encounter other unwanted
side effects during testing I will have to delve deeper (which can be seen
as a precondition to being able to answer your questions).
All the best,
Michael
On Mon, Oct 12, 2015 at 5:10 PM, Michael Aram <michael at aram.at> wrote:
> Dear XOTcl/NX/NSF community,
>
> I am in the process of upgrading one of our OpenACS based systems to XOTcl
> 2 and stumbled over the following legacy code:
>
> Class create Person -slots {
> foreach e {username first_names last_name email etcetera} {
> Attribute $e -default "" -proc assign {o var value} {$o changed_var
> $var $value}
> }
> }
>
> Person ad_instproc -private changed_var {var value} {} {
> my instvar __changed_vars
> lappend __changed_vars $var
> my instvar $var
> set $var $value
> }
>
>
> The intention of this not-so-pretty code mainly seems to be that the
> Person->save method called by code like the following can recognize which
> attributes have actually changed during the last request, and update the
> database accordingly...
>
> Person john
> john last_name doe
> john save
>
>
> For some reason, now that I have upgraded the system to XOTcl 2, this does
> not work anymore. The list __changed_vars is not updated (in the example
> above, it would not contain last_name; for debugging purposes, I have put a
> log statement into the "assign" proc, it seems that it does not get called.)
>
> As the update process introduced many many other changes as well (compared
> to the old and adapted OpenACS we had there), including changes in
> xotcl-core, it could certainly be the case that this is simply a the
> side-effect of some other change / or messed-up merge. So, my question is,
> SHOULD this work anyway in the latest stable version of XOTcl 2, or did the
> interface change?
>
> Thanks for your help,
> Michael :-)
>
More information about the Xotcl
mailing list