View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] parameters vs slots and use of "-initcmd"

From: <mail_at_xdobry.de>
Date: Thu, 05 Jul 2007 13:12:11 +0200

>Strictly speaking, an application programmer does not have
>to use parameter in the application program, therefore Artur is right.
>
>While the application program does not have to *define* slots,
>it is hard to do something useful in xotcl without *using* slots
>since methods like "superclass", "class", "mixin" etc.
>are implemented as slots.
>
Thanks for precise explanations.
I must confess that till now I have not consciously (bewußt) used slots.
It is indeed very powerful construct and I have noticed that is used
to implement of many of XOTcl features.
One reason, why I do not use slots and complex parameters is
that XOTclIDE has no support for it. I has not programmed it yet.
I have no idea how to define or visualize slots in XOTclIDE in
this way, that it suits to general concept.
Now XOTclIDE has already a problem with versioning of class definition (creation body).
Because definition bodies are not versioned like bodies of methods.
Using slots is even more complex.
Tutorial example:

Class create A -slots {
    Attribute foo -default 1 -proc assign {domain var value} {
      if {$value < 0 || $value > 99} {
        error "$value is not in the range of 0 .. 99"
      }
      $domain set $var $value
    }
}

Normally XOTclIDE let you view, change and redefine all items separately. But in this example complex items like method-body are part of class creation.
Is there a way to define such slots in iterative way.
I have tried following code but it was not OK.

Class A
Attribute A::slot::foo

this one seems to work

A slots {
   Attribute foo
}
A::slots::foo proc assign {...} {
   ....
}

I miss also possibility to obtain slot definition per introspection.
(similar to ::A info parameter)
Probably one the only one way is own code (::A::slot::foo info body assign).

Anyway!
Probably one of possible usage of slots will be implementing
MVC GUI Framework.
Complex parameters could be used to connection GUI Code with
Domain Code.
Similar approach I know from Smalltalk VisualWorks Framework
see also:
http://www.martinfowler.com/eaaDev/uiArchs.html
It use so called Attributes, which are objects and represent
a simple value (like Integer, String, Date).
UI-Controls can be connected to this attributes (per event framework).
These attributes are members of domain objects.

I have a question to another XOTcl users.
I am not sure how urgent and important is the support of slots
definition in XOTclIDE.
So any information about it are welcome.

Artur