2007/02/21
IRC [01:30] *** tekbasse joined the chat.
IRC [03:29] *** holycow parted the chat.
IRC [10:58] *** holycow joined the chat.
IRC [11:19] *** siddfinch joined the chat.
IRC [11:20] *** siddfinch parted the chat.
IRC [15:25] <jim> what is this thing tcl internals refers to as a "hairy-monster"? I'm looking at... http://wiki.tcl.tk/14880
IRC [15:36] <Dossy> Hmm, not sure. You should ask dkf what he meant by that. :)
IRC [15:36] <Dossy> I don't know.
IRC [15:36] <Dossy> >> As a general rule, all Tcl commands should be considered to be Hairy-Monsters wrt the objects in the objv array.
IRC [15:48] <holycow> jim, it would be interesting to find out what that means :)
IRC [16:00] <jim> well
IRC [16:01] <jim> here's what I know so far
IRC [16:02] <jim> internally, tcl can keep these things called TclObj things (not objects in the OOP sense, at least not exactly)
IRC [16:02] <jim> they have defined types (so it could sorta be like a table definition)
IRC [16:04] <jim> but the main thing, is that tcl tries to be efficient by sharing data... that is, one copy in RAM, and could be more than one thing pointed at it
IRC [16:04] <jim> tcl uses a technique to keep track of when it's safe to get rid of the TclObj
IRC [16:04] <jim> which is called "reference counting"
IRC [16:05] <jim> all that means, is that every object has stored in it, the number of pointers pointed at it
IRC [16:06] <jim> so,
IRC [16:06] <jim> when you do somethign like set a $b
IRC [16:08] <jim> where $b has one of these object things and a is going to be yet another reference to $b
IRC [16:08] <jim> tcl gets lazy
IRC [16:09] <jim> and instead of making a copy of what's in $b
IRC [16:09] <jim> it just points a at $b
IRC [16:09] <jim> and adds one to $b's reference count
IRC [16:10] <jim> the way reference counts and these objects work,
IRC [16:10] <jim> is that when all the references go away, the reference count should go to zero
IRC [16:11] <jim> when that happens, the object is destroyed and reclamied
IRC [16:34] <jim> when you have to feed an object to a proc, you might have to be careful if the refcount on the object is zero
IRC [16:34] <jim> what does it depend on?
IRC [16:35] <jim> it depends on what the proc does (and, what other procs it calls does if it's being fed this object_
IRC [16:35] <jim> )
IRC [16:35] <jim> so how can you be careful?
IRC [16:36] <jim> by incrementing the refcount on the object before feeding it to the proc and decrementing the refcount after (so effectively it's not changed)
IRC [16:36] <jim> if you do this,
IRC [16:37] <jim> it's safe, even if the proc you feed it to is a hairy monster
IRC [18:02] <Dossy> yeah.
IRC [18:02] <Dossy> that way it keeps hairy monsters from eating your objects.
IRC [18:09] <Dossy> squee. my new 100G hard drive for my laptop and an external enclosure I ordered finally shipped!
IRC [18:09] <Dossy> I should have it by Friday. Squee!
IRC [18:53] *** MrWGW- joined the chat.
IRC [19:03] *** MrWGW- parted the chat.
IRC [19:10] *** holycow parted the chat.
IRC [20:00] *** jim parted the chat.