code logs -> 2007 -> Wed, 01 Aug 2007< code.20070731.log - code.20070802.log >
--- Log opened Wed Aug 01 00:00:03 2007
00:46 ReivZzz is now known as ReivClass
02:05 Chalcedon is now known as ChalcyAFK
02:27 ChalcyAFK is now known as Chalcedon
02:32 ReivClass is now known as Reiver
03:02 Chalcedon is now known as ChalcyAFK
04:19 Reiver is now known as ReivClass
05:13 Vornicus is now known as Vornicus-Latens
05:35 Forj [~Forj@Nightstar-9938.ue.woosh.co.nz] has joined #code
05:41 ChalcyAFK is now known as ChalcyOut
06:30 ChalcyOut is now known as Chalcedon
07:25 ReivClass is now known as Reiver
08:57 KBot [~fark.off@87.72.35.ns-3885] has joined #Code
08:57 KarmaBot [~fark.off@87.72.35.ns-3885] has quit [Connection reset by peer]
08:58 KBot is now known as KarmaBot
09:24 Forj [~Forj@Nightstar-9938.ue.woosh.co.nz] has quit [Quit: Gone]
09:40 Chalcedon [~Chalcedon@Nightstar-9938.ue.woosh.co.nz] has quit [Quit: Gone]
11:54 Reiver is now known as ReivZzz
14:09 MyCatVerbs [~rb6822@Nightstar-1463.cs.bris.ac.uk] has joined #code
14:12 AnnoDomini [~farkoff@Nightstar-29261.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
14:19 AnnoDomini [~farkoff@Nightstar-29519.neoplus.adsl.tpnet.pl] has joined #Code
14:41 mode/#code [+o AnnoDomini] by ChanServ
14:41 mode/#code [+o AnnoDomini] by ChanServ
14:42 mode/#code [+oooooo EvilDarkLord jerith MyCatVerbs Raif ReivZzz Serah] by AnnoDomini
14:42 mode/#code [+o Syloqs-AFH] by AnnoDomini
16:03 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
16:04 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
16:04 mode/#code [+o ToxicFrog] by ChanServ
16:06 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
16:07 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
16:07 mode/#code [+o ToxicFrog] by ChanServ
16:40
<@ToxicFrog>
Argh, this design problem is killing me
16:43 MyCatVerbs [~rb6822@Nightstar-1463.cs.bris.ac.uk] has quit [Quit: Swim, swim, hungry!]
17:07 * jerith needs a shower.
17:07
<@jerith>
I've just written code like this:
17:07
<@jerith>
class ClassToTest # We want to test these private methods, so make them public public :private_method_1 public :private_method_2
17:07
<@jerith>
Umm, stupid paste.
17:08
<@jerith>
I've just written code like this:
17:08
<@jerith>
class ClassToTest
17:08
<@jerith>
# We want to test these private methods, so make them public
17:08
<@jerith>
public :private_method_1
17:08
<@jerith>
public :private_method_2
17:08
<@jerith>
end
17:19
<@ToxicFrog>
....
17:20
<@jerith>
It's not so bad in that it's test code.
17:21
<@jerith>
I also do similar stuff with adding accessors for private instance variables because I don't want to have to do the whole nasty .instance_variable_set() thing.
17:26
<@ToxicFrog>
One would think you could just tell Object that UnitTest is a friend class of everything or something.
17:26
<@jerith>
Ruby doesn't have such things.
17:27
<@jerith>
That code is about the sanest way to do it, actually.
17:28
<@jerith>
And on further reflection, it's actually not so bad in a test module.
17:28
<@jerith>
It just bothers me that it's so easy to do in Ruby.
17:28
<@jerith>
I'd much rather have a "make this private method public" call on an object.
17:29
<@jerith>
Of course, that's simple enough to add. But messing with Object feels even dirtier.
17:33 * ToxicFrog flails at this bot framework
17:34
<@ToxicFrog>
I'm having a bastard of a time coming up with a good design for the event handling core.
17:34
<@jerith>
And those two private methods are pretty much all I can unit-test in this code.
17:35
<@jerith>
Everything else screws with the filesystem and such.
17:35
<@jerith>
And I'm *not* stubbing out File.
17:36
<@ToxicFrog>
Heh.
17:41
<@ToxicFrog>
Ok, so, how's this for a design:
17:41
<@ToxicFrog>
The user creates some number of server contexts, registers callbacks on them, and then invokes the main loop.
17:42
<@jerith>
Server contexts?
17:42
<@ToxicFrog>
The library maintains an event buffer for each server context. The main loop grabs events from these buffers, sending them to the relevant servers, until all buffers are empty; then it select()s on the servers' sockets until traffic occurs, which it converts into events.
17:42
<@ToxicFrog>
Represents a connection to an IRC server.
17:43
<@ToxicFrog>
Contains information about the connection itself (fd, host, port), about the server, and about the client information.
17:43
<@ToxicFrog>
Also responsible for managing callbacks.
17:47
<@ToxicFrog>
I think the sticking point I keep running into is that the event queue is part of the server context, but it has to be managed by the eventloop
17:48 * jerith ponders.
18:19 Vornicus-Latens is now known as Vornicus
18:57 Forj [~Forj@Nightstar-9938.ue.woosh.co.nz] has joined #code
19:44 Forj [~Forj@Nightstar-9938.ue.woosh.co.nz] has quit [Connection reset by peer]
20:16
<@ToxicFrog>
haHA!
20:16
<@ToxicFrog>
We don't need no steenking macros!
20:16
<@ToxicFrog>
class "Foo" (Bar)
20:16
<@ToxicFrog>
member = value
20:16
<@ToxicFrog>
function method(self, ...)
20:16
<@ToxicFrog>
...
20:16
<@ToxicFrog>
end
20:16
<@ToxicFrog>
endclass()
20:17 AnnoDomini is now known as Annoomini
20:17 * jerith ponders that code.
20:18
<@ToxicFrog>
Yes?
20:18 Annoomini is now known as AnnoDomini
20:18 AnnoDomini is now known as DrownedNinja
20:18
<@jerith>
Nah, just random ponderage.
20:20
<@ToxicFrog>
Yes, but why?
20:21
<@jerith>
It looks vaguely familiar.
20:22
<@ToxicFrog>
Well, it's a refinement of a Lua library I've been working on for a while
20:23
<@jerith>
It looks like the bastard child of Ruby and Python, actually.
20:24
<@ToxicFrog>
Well, I'm modeling it after the Lua function syntax:
20:24
<@ToxicFrog>
function foo(bar)
20:24
<@ToxicFrog>
code goes here
20:24
<@ToxicFrog>
end
20:24
<@ToxicFrog>
(which is just a syntactic sugar for foo = function(bar) ... end)
20:25
<@ToxicFrog>
However, I'm not actually modifying the parser
20:25
<@ToxicFrog>
So I have to do some cunning tricks - class is a function that returns a function that modifies the caller's environment so that subsequent assignments modify the class definition.
20:26
<@jerith>
That sounds... arcane. Also cunning.
20:27
<@ToxicFrog>
Modifying the parser would make it prettier:
20:27
<@ToxicFrog>
class Foo(Bar) ... end
20:27
<@ToxicFrog>
As a sugar for Foo = Class(Bar) ... end
20:27
<@ToxicFrog>
However, this approach means it will run on an unmodified interpreter.
20:27 DrownedNinja is now known as DeadNinja
21:02
<@ToxicFrog>
jerith: it gets worse, too
21:02
<@ToxicFrog>
class(1)(Bar) -- now you have a class called 1 - the number, not the string.
21:02
<@jerith>
It does?
21:02
<@jerith>
Hmm...
21:03
<@ToxicFrog>
I actually have a program that does this, generating classes at runtime with names like <$%x%x>
21:03
<@ToxicFrog>
But in practice you wouldn't do this for user-written classes~
21:34 Chalcedon [~Chalcedon@Nightstar-9938.ue.woosh.co.nz] has joined #code
21:34 mode/#code [+o Chalcedon] by ChanServ
21:46 ReivZzz is now known as Reiver
22:10 * ToxicFrog kills texinfo right in the goddamn face
22:13 * Chalcedon cookies TF
22:14
<@ToxicFrog>
Cookies!
22:14 * ToxicFrog nrom, pies Chalcy
22:14 * Chalcedon nrom!
22:14 * jerith hands ToxicFrog a well-written man page.
22:16
<@ToxicFrog>
jerith: the problem here isn't reading it, it's a build failing because it needs some obscure program from the texinfo package
22:16
<@jerith>
Ah.
22:17 * jerith recommends smitage.
22:18
<@ToxicFrog>
Smiting the authors of binutils would be counterproductive~
22:18
<@jerith>
Indeed.
22:19
<@jerith>
Smite the texinfo people instead?
22:19
<@ToxicFrog>
Gladly.
22:20 * jerith hands ToxicFrog the orbital lance controls.
22:21
<@Vornicus>
...gnar. Okay, some of my sample code needs refactoring.
22:22 * jerith hands Vornicus an appropriately-configuted set of multiplication tables.
22:27
<@Vornicus>
pff
22:28
<@Chalcedon>
Vorn, can I borrow you for some calculus?
22:28 * jerith points to #math. :-)
22:28 * Vornicus is borrowed.
22:53 You're now known as TheWatcher[T-2]
22:58 You're now known as TheWatcher[zZzZ]
23:00 Reiver is now known as ReivClass
--- Log closed Thu Aug 02 00:00:10 2007
code logs -> 2007 -> Wed, 01 Aug 2007< code.20070731.log - code.20070802.log >