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

Weblog Page

Showing 71 - 80 of 1561 Postings (summary)

Re: [Xotcl] TIP #257: Object Orientation for Tcl

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Tue, 27 Sep 2005 03:21:54 +0300

On 27 Sep 2005, at 03:05, Will Duquette wrote:
>
> It's really an aesthetic issue rather than a technical
> issue; I find many OO APIs to be terribly cluttered (Java,
> I'm looking at *you*) such that it becomes hard to tell
> which methods are important amid all of the ones which
> are only occasionally of interest.

I think this is a worthy sentiment and one I would subscribe to.
[define] is definitely not a bad solution at all. It feels like a
slot-based system. The aesthetics is why I'd prefer having
constructors and destructors as real methods. Then they become really
simple to describe. No specials required. Also, a Neil pointed out in
his own notes, there are reasons why one would want to have
assertions with destructors (and why not constructors too).

            / http://www.fishpool.com/~setok/

Re: [Xotcl] new methods, request for comment

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Victor Mayevski <vitick_at_gmail.com>
Date: Thu, 23 Apr 2015 10:08:59 -0700

On Sun, Apr 19, 2015 at 2:25 PM, Gustaf Neumann <neumann_at_wu.ac.at> wrote:

> Am 19.04.15 um 22:21 schrieb Victor Mayevski:
>
>> Recently I encountered a need for two methods in my code:
>>
>> "info siblings"
>> "info root" -- similar to "info parent" but travels down the object tree
>> to find the first object or root (of a tree OR a branch).
>>
>> I realize that it is very trivial to script them in myself but I am
>> dealing with thousands (if not millions in the future) of objects and would
>> like to squeeze as much performance from the code as possible. Hence, I
>> propose to add those methods in C code (to NSF), provided that coding them
>> in C will indeed speed things up. Also, having those methods seems to be
>> natural, just like having "info parent" or "info children".
>>
>
> is this, what you have in mind?
> The questionable parts are the ones, where namespaces are used, which do
> not correspond
> to objects. i would not expect huge differences in performance when coding
> this in C.
>
> ================================================
> package req nx::test
>
> nx::Object public method "info root" {} {
> set parent [:info parent]
> if {![nsf::is object $parent]} {
> return [self]
> }
> return [$parent info root]
> }
>
> nx::Object public method "info siblings" {} {
> set parent [:info parent]
> set self [self]
> set siblings {}
> foreach c [info commands ${parent}::*] {
> if {[nsf::is object $c] && $c ne $self} {
> lappend siblings $c
> }
> }
> return $siblings
> }
>
> #
> # Some test cases
> #
> namespace eval ::test {
> nx::Object create o
> nx::Object create o::p
> nx::Object create o::p::q
> nx::Object create o::i
> nx::Object create o::j
> nx::Object create o2
> nx::Object create o3
>
> ? {o info root} ::test::o
> ? {o::p::q info root} ::test::o
>
> ? {lsort [o info siblings]} {::test::o2 ::test::o3}
> ? {lsort [o::p info siblings]} {::test::o::i ::test::o::j}
> }
> ================================================
>
> Another proposal, (tongue-in-cheek, since it probably benefits only my
>> code), is to add a timestamp (microseconds) to every object upon creation.
>> I have a need to list the object (thousands, if not millions) in the order
>> of creation. Again, it is trivial to script it in, but performance is an
>> issue.
>>
> By adding time stamps to the code, the size of every object will increase,
> which we really want to avoid.
>
> How about the following approach. this is like an implementation of "new"
> which
> uses the creation time as object name. To avoid confusions with digit
> overflows,
> one needs in the general case a custom sort function, or a "format" for the
> name generation, but that should be pretty straight-forward.
>
> #
> # Keep order of creation
> #
> nx::Class create C
>
> for {set i 0} {$i < 100} {incr i} {
> C create [clock clicks -microseconds]
> }
> puts [lsort [C info instances]]
>
>
> If you use huge trees, i am not sure that using nested tcl namespaces is
> memory-wise the best approach - but i do not know the requirements
> of your application, and the structure (width, depth, size) of the object
> trees.
>




>
> Maybe it is better to use ordered composites to avoid high number of
> namespaces
> and huge object names like e.g.:
>
>
> https://next-scripting.org/xowiki/file/docs/nx/examples/container.html?html-content=1
>
> http://openacs.org/api-doc/procs-file-view?path=packages%2fxotcl-core%2ftcl%2f20-Ordered-Composite-procs.tcl&version_id=4193140&source_p=1
>
> nx/xotcl objects require much less memory when these are namespace-less
> (contain no children or per-object methods).
>

I am trying to create a generic mechanism for ordered nested objects.
Although it is true that objects with namespaces use more memory, I accept
it as a trade off for flexibility I get. I really strive for a "natural"
order of objects (after all that's what objects are supposed to do: be an
analog for the real world). I am also trying to make it as unobtrusive as
possible (without a tracking mechanism etc). The reason I wanted timestamps
is that I could have naturally named objects, when needed.

Per your suggestions, I am thinking that instead of using timestamps for
each object, use a hybrid name+timestamp ("-prefix name" option). Also
[lsort [Class info instances]] seems to be the fastest way to list objects
in order, instead of having to track each object. In addition to that I can
also implement a caching mechanism to speed things up even further.

Thanks.


>
> All the best
> -g
>
>
>

[Xotcl] Children object shadows parent objects method

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: V.K.Vallinayagam <valli_at_ezorder.in>
Date: Wed, 22 Nov 2006 06:30:01 -0800

Hi,
 I just joined this list to get this help. I am seeing this behaviour.
It is giving lot of inconvenience to me. I want to know if it is a bug
or not -?.
 In short, if I have a children object as the same name as parent
object's proc/instproc . The parent object's method is not getting called.
 
 Here is a sample code.

  Object a
  Object a proc name {} {
   return "I am valli"
  }
  a name # returns "I am valli"
  Object a::name # Child object with same name as the proc
  a name # returns ::a::name and not the previous message

 Is this the desired behaviour. Is there any workaround.

Regards
Vallinayagam
valli_at_ezorder.in

Re: [Xotcl] Interested in OO for tcl.

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Artur Trzewik <mail_at_xdobry.de>
Date: Mon, 04 Dec 2006 21:13:48 +0100

Jeff Hobbs schrieb:
>> Many of XOTcl features are only interesting for special
>> scenarios such as OO-frameworks or wrapping techniques.
>>
>> For OO-Beginners these XOTcl-Features might be not interesting:
>> - method forwarding
>> - filters
>> - meta classes
>> - slots
>> - mixins
>> - assertions, pre/post condition
>> - non positional arguments
>> - object aggregation
>> I have ordered the features from most advenced to quite
>> practical in my opionion.
>>
>
> Method forwarding (aka delegation) is an absolute must and common feature for
> megawidget development (fwiw).
>
>
Yes. But there is a difference between megawidget developer and
developer who only use magawidget.
For using megawideg you do need to now nothing about internals of it.
Not everyone must be Tcl guru for using it.

Artur Trzewik

Re: [Xotcl] NX question

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Wed, 27 Oct 2010 08:39:25 +0200

Certainly, all attributes can be set using the dash notation.
The attributes do not have the variable arguments problem,
for setting, always exactly one argument is required.

Although syntactically the same, there is a big difference
between XOTcl 1.* and nx concerning attributes:
in xotcl, calls like "-a 1" in "C new -a 1" were plain
method calls;
in nx, these are object parameters, which are set using the
same mechanism as setting nonpositional arguments for
a method (using the same value checker, default
mechanisms, can be set optional or not etc.). With nx,
it is possible to define e.g. protected setter functions, etc.

On 26.10.10 22:37, Victor Mayevski wrote:
> Thank you Gustaf, that makes sense. I have also found that I can still do attribute settings the old - "dash" way, so, most of my code should be fine.
if you use XOTcl 2.0, practically everything is compatible.
Since it is possible to use nx and XOTcl 2.0 in the
same interpreter, migration does not mean to change
everything on a certain date, but it can be done in a
piecemeal manner.

-gustaf neumann

[Xotcl] Registration Open for 19th Annual Tcl/Tk Conference (Tcl'2012)

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Andreas Kupries <andreask_at_activestate.com>
Date: Mon, 10 Sep 2012 11:55:10 -0700

19th Annual Tcl/Tk Conference (Tcl'2012)
http://www.tcl.tk/community/tcl2012/

November 12 - 16, 2012
Sessions:
    National Museum of Health and Medicine Chicago
    175 W. Washington
    Chicago, IL 60602

Rooms:
    Holiday Inn Chicago Mart Plaza
    350 West Mart Center Drive
    Chicago, Illinois, USA

Map/Transport:
    https://maps.google.com/maps/ms?msid=204739899073144451536.0004c144222a9036c99f6&msa=0&ll=41.885266,-87.633734&spn=0.008443,0.018818
    http://wiki.tcl.tk/28843#pagetoca7e55932


I am pleased to announce that registration for the Conference is now
open at

        http://www.tcl.tk/community/tcl2012/reg.html

To book a room at the conference hotel at reduced rates please follow
the instructions on that page. Note that the offer of reduced rates
expires on October 20. Book early.

Our schedule can be found at

        http://www.tcl.tk/community/tcl2012/schedule.html

Conference Committee

Clif Flynt Noumena Corp General Chair, Website Admin
Andreas Kupries ActiveState Software Inc. Program Chair
Cyndy Lilagan Nat. Museum of Health & Medicine, Chicago Site/Facilities Chair
Arjen Markus Deltares
Brian Griffin Mentor Graphics
Donal Fellows University of Manchester
Gerald Lester KnG Consulting, LLC
Jeffrey Hobbs ActiveState Software Inc.
Kevin Kenny GE Global Research Center
Larry Virden
Mike Doyle National Museum of Health & Medicine, Chicago
Ron Fox NSCL/FRIB Michigan State University
Steve Landers Digital Smarties

Contact Information tclconference_at_googlegroups.com


Tcl'2012 would like to thank those who are sponsoring the conference:

ActiveState Software Inc.
Buonacorsi Foundation
Mentor Graphics
Noumena Corp.
SR Technology
Tcl Community Association

Re: [Xotcl] Java to XOTcl translator

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Kristoffer Lawson <setok_at_scred.com>
Date: Mon, 15 Dec 2008 11:00:53 +0200

On 15 Dec 2008, at 10:08, Gustaf Neumann wrote:

> Dear XOTcl community,
>
> some of you might be intersted in the Java to XOTcl source code
> translator
> by Mykhaylo Sorochan. It is a very new development looking quite
> promising.
>
> http://macroexpand.org/doku.php/txl:projects:java2tcl:start

Cool idea :-)

For what it's worth, I've had to use Python lately for work and I have
to say I'd still use XOTcl for any of my own projects. Python just
seems wrong and even somewhat limited compared to the straightforward
power of XOTcl.

            / http://www.scred.com/
            / http://www.fishpool.com/~setok/

Re: [Xotcl] two procs (-proc) for Attribute

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Stefan Sobernig <stefan.sobernig_at_wu.ac.at>
Date: Mon, 20 Jul 2009 12:50:39 +0200

Mykhaylo,

> How to define several procs for one Attribute in class definition?
> Particularly, I want to define both assign and get procs at once.

i am not entirely confident that i grasbed the meanings of "serveral
procs for one Attribute" and "at once". Do you mean:

a) define 2 or more (per-object methods, i.e., procs) per slot object
"at once"?

b) define 2 (per-instance methods, i.e., instprocs) per family of slot
objects "at once"?

anyways, maybe some of the following is helpful to you:

#
# ad a)
#
Class create C -slots {
   Attribute create a1 -proc assign args {
     puts "[self]->[self proc] called"
     next
   } -proc get args {
     puts "[self]->[self proc] called"
     next
   }
}

C create c
c a1 1
c a1

#
# ad b)
#
Class MyAttribute -superclass Attribute \
     -instproc assign args {
       puts "[self]->[self proc] called"
       next
     } -instproc get args {
       puts "[self]->[self proc] called"
       next
     }

Class create D -slots {
   MyAttribute create a1
   Attribute create a2
}

D create d
d a1 1
d a1

XOTcl/NX mailing list by object move?

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Sat, 18 Mar 2006 01:48:34 +0100

Scott Gargash schrieb:

> I've been thinking along somewhat different lines, the classic "extra
> level of indirection" that solves all problems. What about using
> interpreter aliases as an indirection? What would happen if all
> objects were created as anonymous commands inside (say) the xotcl
> namespace, and the object name was just an alias to the anonymous object?
>
you can do this easily by your own in xotcl. redefine e.g. unknown for
classes (or provide a mixin for create),
and create objects via new and add the alias.

====================================
Class instproc unknown {name args} {
 set o [eval my new $args]
 ::interp alias {} $name {} $o
 return $name
}
====================================

so, now we can test the aliased content. it behaves in many respects
the same, but when it comes to refer to "self" or to namespaces
one would notice a different behavior:
====================================
Class create Person -parameter {age}
Person p1 -age 123

puts [p1 age]
puts [p1 self]
====================================

As you noted, one can switch in such a universe the aliases
to "move" objects quickly.
====================================
Object instproc move {newname} {
 foreach a [::interp aliases] {
   if {[::interp alias {} $a] eq [self]} {set oldname $a;break}
 }
 ::interp alias {} $newname {} [self]
 ::interp alias {} $oldname {}
}
p1 move p2

puts [p2 age]
puts [p2 self]
====================================

most probably, an associative array to keep the aliases is more
efficient than the loop through all aliases, once there are
many objects.

Note, that "self" remains the same.

If you need this kind of behavior for certain kind of objects, you
can certainly use a base-class RefObject or whatever, and subclass
the application classes from it.... This kind of objects will vertainly
need a destroy method to delete the alias as well.

-gustaf neumann

[Xotcl] IDE and objects

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Krzysztof Frukacz <frukacz.krzysztof_at_gmail.com>
Date: Mon, 10 Jan 2011 11:07:49 +0100

Hello,

Two questions about xotcl. First one: what IDE would you recommend?
Currently I am using Eclipse with XOTCL plugins. I like this IDE, but as
it comes for TCl and XOTCL the plugins do not work very well.
I found XOTclIDE, but it looks a little bit exotic...maybe there are
some other plugins for Eclipse? I am using standard ones from Galileo
repository.

Second question: lets assume that I want to check if particular variable
contains a TCL object of given class: $var istype MyClass. It works
good, assuming that $var contains an object, but if there is a value
like "15" we get an error.
Is there a nice way to check if a variable contains an object of given
class and at the same time just get a false answer in case it does not
contains a XOTCL object?

-- 
Krzysztof Frukacz

Next Page