--- Log opened Sat Nov 03 00:00:58 2007 |
00:06 | < Attilla> | The programming and sci-fi novelist industry were very linked in their origins, it seems :p |
00:11 | <@gnolam> | That's one interpretation. |
00:12 | < ReivSLEP> | Worlds most impractical bra? |
00:13 | | Vornotron [~vorn@64.252.64.ns-4134] has joined #code |
00:14 | | You're now known as TheWatcher[T-2] |
00:15 | | Vornicus [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout] |
00:16 | <@McMartin> | I'm mostly laughing because it's Forth. |
00:18 | | You're now known as TheWatcher[zZzZ] |
00:19 | <@gnolam> | :) |
00:19 | <@gnolam> | But now that you mention it... why on Earth would someone need a /book/ for learning Forth? |
00:20 | <@gnolam> | The whole point of the language is that it's so simple you can _implement_ it in a couple of hours on a platform you've never seen before. |
00:20 | <@McMartin> | The book appears to be "Teach yourself programming using Forth." |
00:21 | <@gnolam> | (Well, I've only written a Forth compiler for 68k, but that took me about... 2 hours) |
00:21 | < ReivSLEP> | (What is Forth?) |
00:21 | <@McMartin> | (A language for controlling telescopes that PostScript drew inspiration from) |
00:22 | <@McMartin> | Also, it's for the Atari, so it's almost certainly "A collection of generally useful or fun FORTH programs." |
00:23 | < ReivSLEP> | ...telescopes |
00:25 | <@McMartin> | Every popular language started out as something horrifically mundane, really. |
00:26 | <@McMartin> | ML was for theorem proving, Python was for config files, C was patching some Pascal-y stuff onto a language designed to be simpler than assembler for teaching purposes... |
00:45 | | Mischief [~Genesis@74.5.52.ns-26501] has joined #code |
00:45 | < Mischief> | Hey guys |
00:49 | < Mischief> | I have an inquirey |
00:49 | < Mischief> | What type of OS would be required for an Intel Quad-Core CPU? |
00:50 | < Vornotron> | pretty much any OS can handle it. |
00:50 | < Mischief> | Well, I tried loading up a Windows XP boot CD (tw of them, one SP1 one SP2) |
00:50 | < Mischief> | They both BSOD'ed |
00:51 | < Vornotron> | Have you made sure that the hardware works? |
00:51 | < Mischief> | It's a completely new PC |
00:51 | < Mischief> | They got to the "loading Windows" screen in the installation of XP |
00:51 | < Mischief> | And then crashed |
00:52 | < Mischief> | I tried a 64-bit version of Linus, and it jsut goes to a black screen with a blinking underscore |
00:52 | < Mischief> | Linux* |
00:53 | < ReivSLEP> | Have you made sure that the hardware works? |
00:53 | < Mischief> | I can't. It works as far as I can see |
00:54 | < Mischief> | Which was my answer in "It's a new PC" It boots. It passes CMOS boot, it boots the CD. |
00:55 | < Vornotron> | Try a regular version of Linux. |
00:55 | < Vornotron> | also, try memtest86. |
00:56 | < Mischief> | Right |
00:56 | < Mischief> | Thanks |
01:04 | < Mischief> | I thinik _something_ is wrong with it |
01:04 | < Mischief> | Half the time, it doesn't even boot video |
01:09 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
01:47 | <@ToxicFrog> | Ok, java method dispatch semantics question for the Java gurus among us. |
01:48 | <@ToxicFrog> | I have an abstract class, Creature. It implements a method frob(StoryElement object), and a method move() which may call frob(). |
01:49 | <@ToxicFrog> | I have a concrete class Player extends Creature. It implements frob(Item), frob(StoryElement) and frob(Creature). |
01:49 | <@ToxicFrog> | Note that Item and Creature are both subclasses of StoryElement. |
01:49 | <@ToxicFrog> | It does not, however, reimplement move(). |
01:50 | <@ToxicFrog> | When player.move() is called, it ends up calling Creature.frob(StoryElement), even when passed an Item (and thus the desired behaviour is Player.frob(Item)). |
01:50 | <@ToxicFrog> | Is this fixable? |
02:08 | <@ToxicFrog> | Oh. Note also that the type of the variable passed to frob() is StoryElement, but the value is an Item. |
02:08 | <@ToxicFrog> | In effect, I am asking for runtime rather than compile time method dispatch. |
02:11 | <@McMartin> | Only on "this". |
02:11 | <@McMartin> | Only Common Lisp and Inform 7 have dynamic dispatch on arguments that aren't argument zero. |
02:11 | <@McMartin> | To fix your problem, you must either (a) use Visitor patterns (not recommended here), or (b) make it frob(Object) in the Interface, implement that, and check values with instanceof. |
02:15 | <@ToxicFrog> | ;.; |
02:15 | <@ToxicFrog> | I wonder if I could do something perverse with java.lang.reflect here. |
02:16 | <@McMartin> | No |
02:16 | <@ToxicFrog> | return this.getMethod("frob", object.getClass()).call(object) |
02:16 | <@ToxicFrog> | Aah well. |
02:16 | <@McMartin> | I suggest an instanceof switch |
02:16 | <@McMartin> | Otherwise, use Visitors |
02:17 | <@McMartin> | But Visitors are ugly as Hell |
02:17 | <@McMartin> | And it's all Simula's fault. |
02:17 | <@McMartin> | And possibly Smalltalk's. |
02:18 | <@McMartin> | For an example of a (large) Visitor framework, see http://pql.svn.sourceforge.net/viewvc/pql/trunk/pql/net/sf/pql/parser/AST.java?r evision=122&view=markup |
02:18 | <@McMartin> | Note StatementVisitor with its many individual methods |
02:18 | <@McMartin> | And then note how Statement and its subclasses have an "accept" method. |
02:19 | <@McMartin> | That's basically the only way to do multiple dispatch in a single-dispatch language like C++, Java, or C#. |
02:19 | <@ToxicFrog> | Yeah, I'd really rather stick my leg in a meat grinder. |
02:19 | <@McMartin> | Alternately, move frob to Item() and its cousins. |
02:19 | <@McMartin> | And make it a simple method call on that argument. |
02:20 | <@ToxicFrog> | Except it really is multiple dispatch here; Monster.frob(Item) and Player.frob(Item) are very different, as are Player.frob(Item) and Player.frob(Monster) |
02:20 | <@ToxicFrog> | So moving it into the target class just changes what I'm doing the instanceof switch on, it doesn't eliminate the problem. |
02:21 | <@McMartin> | Do Items ever frob things? |
02:21 | <@McMartin> | If not, FrobbedByPlayer (foo) and FrobbedByMonster (foo). |
02:21 | <@McMartin> | Well, or FrobbedByItem (foo). |
02:21 | <@ToxicFrog> | Incidentally, why can't I use reflection here? I know you can get an object's class at runtime, and I thought that you could get methods out of a class using name + signature. |
02:21 | <@McMartin> | Well, you can |
02:21 | <@McMartin> | But it's about a 400x slowdown or worse. |
02:21 | <@ToxicFrog> | ... |
02:22 | <@McMartin> | And you have to guard against about eighteen checked exceptions. |
02:22 | <@ToxicFrog> | ... |
02:22 | | * ToxicFrog opens one of his six mouths and sings the song that ends the earth |
02:22 | <@McMartin> | Bear in mind that since this is a straight-up virtual function call, without reflection you're talking one INVOKEVIRTUAL instruction resolved at linktime into, probably, four machine instructions. |
02:22 | <@McMartin> | If that. |
02:23 | <@McMartin> | It might even just be JITted to "CALL (address)" |
02:23 | <@ToxicFrog> | This game is turn-based in any case; performance isn't a huge consideration. |
02:23 | <@ToxicFrog> | However, brain-raping exception signatures are. |
02:23 | <@ToxicFrog> | Reflection is only worth using if it's easier than doing it wrong, after all. |
02:24 | <@McMartin> | Meanwhile, the reflection approach involves building several strings, looking them up in each class's constant pool, throwing exceptions if they aren't there, and only after all that getting an actual address. |
02:24 | <@McMartin> | Well, you could just catch (Exception e). |
02:24 | <@ToxicFrog> | Yeah, but that's still Doing It Wrong. |
02:24 | <@McMartin> | catch (Exception _) { throw new RuntimeException(_); } |
02:25 | <@ToxicFrog> | So in effect, I've changed one headache for a different one and a performance hit. |
02:25 | <@McMartin> | Visitors are apparently accepted practice for this, but this is one of many reasons you don't see me ever extolling OO as a Wonderful Paradigm. |
02:25 | <@ToxicFrog> | And I can't even do that, because if it can't find, say, frob(Item) it needs to fall back to frob(StoryElement) |
02:25 | <@ToxicFrog> | I would argue that this is more a problem with OO implementations failing to provide multiple dispatch, than with OO as a concept~ |
02:26 | <@McMartin> | I suggest revising your architecture to match the capabilities of languages that aren't Common LISP. |
02:26 | <@McMartin> | Because you'd hit the same problems in C++ and Python. |
02:26 | <@McMartin> | ... and if you want the fallback, even reflection won't work |
02:26 | <@McMartin> | Because instead of getting frob(StoryElement) you'll get NoSuchMethodException. |
02:27 | <@ToxicFrog> | Yeah. |
02:27 | <@ToxicFrog> | Which is why I can't just re-throw. |
02:27 | <@McMartin> | The reason you're getting bizarre behavior, however, is because you want multiple dispatch and you have overloading. |
02:28 | <@ToxicFrog> | As for changing the architecture, the engine has to handle attempts by two entities to occupy the same square, and it handles this differently depending on the types of both objects, so no matter how you slice it this is a multiple dispatch problem of some description. |
02:29 | <@McMartin> | Well, in ML or Haskell I'd do it with a series of pattern matches within a single function~ |
02:29 | <@ToxicFrog> | Also, half the program is provided in binary form which we aren't allowed to alter, and the rest has to be made to fit with that. |
02:29 | <@McMartin> | Joy |
02:29 | <@McMartin> | Though as a TA I recognize the necessity for this. |
02:30 | <@ToxicFrog> | A state of affairs that has, in fact, largely made me more mellow working with Java, as I have no rage left for the language after considering the project I'm using the language for. |
02:30 | <@ToxicFrog> | Oh, it's nice in theory. |
02:30 | <@McMartin> | It's nice in practice, too, assuming you like to get your marks back before 2015. |
02:30 | <@ToxicFrog> | Where it falls apart is where the design is intrinsically flawed and the documentation doesn't actually match the binaries. |
02:31 | <@ToxicFrog> | Hence my desire for something that can rip method signatures out of a .class file earlier. |
02:31 | <@McMartin> | Nod |
02:31 | <@McMartin> | Also, um, not providing source for the framework is insanity. |
02:31 | <@ToxicFrog> | The documentation for this phase has been in sync so far, but the design problems are still there. |
02:32 | <@ToxicFrog> | So, yeah, the project requirements themselves totally overshadow any issues I have with the language. |
02:33 | <@McMartin> | So far, the issues you have with the language are by no means unique to Java. |
02:33 | <@ToxicFrog> | True. |
02:33 | <@ToxicFrog> | You'll note that I avoid C, C++, and Python as well~ |
02:34 | <@ToxicFrog> | Although multiple dispatch doesn't work in Lua either, which makes me sad. |
02:34 | <@McMartin> | (Actually, even I7's "multiple dispatch" is closer to ML/Haskell's pattern matching) |
02:34 | <@ToxicFrog> | Earlier, the lack of first-class method closures was driving me up the wall, but I suspect faking that with reflection will be far, far more trouble than it's worth even if it's possible. |
02:35 | <@ToxicFrog> | Even compared to creating a dozen tiny one-method private classes with doTheThingy() methods. |
02:35 | <@McMartin> | You can make those inline, you know. |
02:35 | <@ToxicFrog> | (I consider Haskellian pattern matching to be a form of multiple dispatch, so) |
02:36 | <@McMartin> | Applicable x = new Applicable { void apply() { .... } }; |
02:36 | <@McMartin> | I think I may be missing some parens in there, but. |
02:36 | <@ToxicFrog> | Yeah, but that doesn't make it any prettier. |
02:36 | <@McMartin> | True, but it makes me angry when I have to do C++ work~ |
02:36 | <@ToxicFrog> | The alternate form is just switch()ing on State, which I may end up doing anyways. |
02:37 | <@McMartin> | Though C++ does, sort of, let you take pointers to menu functions. |
02:37 | <@McMartin> | Er, member functions |
02:37 | <@McMartin> | But I don't think they actually end up binding environments usefully. |
02:37 | <@ToxicFrog> | Since I can neither Map<State, Closure> nor just toss anonymous functions around which are called as appropriate. |
02:37 | <@ToxicFrog> | (which are my normal ways of handling this) |
02:38 | | * McMartin nods |
02:38 | <@McMartin> | But then, I speak with a functional accent |
02:38 | | * McMartin <_< at his current emacs buffer, which basically has map() in 6502 assembly |
02:38 | <@ToxicFrog> | So do I, and I think more so after playing with Haskell. |
02:39 | <@ToxicFrog> | This is, I suspect, one reason I have so much trouble with Java. |
02:39 | <@McMartin> | Yeah |
02:39 | | * McMartin hasn't done anything Serious in Java for quite some time now, actually. |
02:39 | <@McMartin> | Other than running things. |
02:39 | <@ToxicFrog> | Pity I can't switch(object.getClass()) |
02:40 | <@ToxicFrog> | But that fails for subclasses, since Creature != GridBug |
02:40 | <@McMartin> | ... what if you use, say, Item.class as the constant? |
02:40 | <@McMartin> | Ah, yes, point. |
02:40 | <@McMartin> | ML doesn't handle cases like that well either, though. |
02:41 | <@ToxicFrog> | ML I have yet to play with. |
02:41 | <@McMartin> | Which is one thing that's been delaying me finishing my Java Disassembler. |
02:41 | <@ToxicFrog> | Every time I look at it, I look at the lack of operator overloads of any kind and flee screaming. |
02:41 | <@McMartin> | ML is very, very close to Haskell, except it doesn't have type classes and it does have a sane I/O system. |
02:41 | <@ToxicFrog> | Also, I love Haskell's typeclasses to bits. |
02:41 | <@McMartin> | Yes. |
02:42 | <@ToxicFrog> | [java] MOVE EAST |
02:42 | <@McMartin> | You can tell that Haskell came much later, because it's the one where they got everyone in the relevant chunk of academia together and said "OK, let's do this right." |
02:42 | <@ToxicFrog> | [java] You pick up the rogueModel.Item@ffac0b |
02:42 | <@ToxicFrog> | Success! |
02:43 | <@McMartin> | Pleaase fail to submit this to the Comp when done. |
02:43 | | * McMartin came this close last year to hunting down the Stanford student who submitted his homework to the comp. |
02:43 | <@ToxicFrog> | It's a roguelike anyways, not if. |
02:43 | <@ToxicFrog> | MOVE EAST is debugging output from move()/canMove()/tick() |
02:44 | <@McMartin> | Nod |
02:44 | | * McMartin winces, calls up some documentation on iostream |
02:44 | <@ToxicFrog> | Oh dear. |
02:44 | <@McMartin> | I'm going to need to hit C++ to finish this retro project properly. |
02:44 | <@ToxicFrog> | My sympathies. |
02:44 | <@McMartin> | But actually, I think I'll finish the 6502 part first. =P |
02:46 | <@McMartin> | This is a general sprite rendering/update engine. The C++ portion is a standalone graphics editor, that produces binary data the 6502 engine can read and interpret. |
02:47 | <@McMartin> | And I'm using C++ instead of C because vector<> is worth the hassle. |
02:48 | <@ToxicFrog> | If it's standalone, why does it need to be C++? |
02:49 | <@McMartin> | The only acceptable alternative for portability was C, and since I need expandable arrays, that's out. |
02:49 | <@McMartin> | If I use C++ I can make it tri-platform in my sleep. |
02:49 | <@McMartin> | Pygame not so much. |
02:49 | <@ToxicFrog> | Aah. |
02:49 | | GeekSoldier is now known as GeekSoldier|bed |
02:49 | <@McMartin> | (Also, most of the core logic was already there in C to begin with.) |
02:51 | | * ToxicFrog nods |
03:02 | <@ToxicFrog> | And now: PASTA |
03:15 | <@McMartin> | Yay, it works |
03:29 | | Mischief [~Genesis@74.5.52.ns-26501] has quit [Ping Timeout] |
04:40 | | GeekSoldier|bed [~Rob@Nightstar-3813.pools.arcor-ip.net] has quit [Ping Timeout] |
04:50 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has joined #code |
04:50 | | mode/#code [+o Thaqui] by ChanServ |
05:21 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has quit [Quit: Leaving] |
05:26 | | ReivSLEP is now known as ReivClass |
05:26 | | ReivClass is now known as ReivOut |
05:51 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has joined #code |
05:51 | | mode/#code [+o Thaqui] by ChanServ |
06:05 | | Vornotron is now known as Vornicus-Latens |
06:09 | | Forj [~Forj@Nightstar-9586.ue.woosh.co.nz] has joined #code |
06:09 | | mode/#code [+o Forj] by ChanServ |
06:10 | | Chalcedon [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has joined #code |
06:10 | | mode/#code [+o Chalcedon] by ChanServ |
07:26 | | You're now known as TheWatcher |
08:12 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
08:12 | | mode/#code [+o gnolam] by ChanServ |
08:14 | | You're now known as TheWatcher[afk] |
08:22 | | GeekSoldier|bed [~Rob@Nightstar-3561.pools.arcor-ip.net] has joined #code |
08:38 | | GeekSoldier|bed is now known as GeekSoldier |
10:44 | | You're now known as TheWatcher |
10:58 | | Forj [~Forj@Nightstar-9586.ue.woosh.co.nz] has quit [Quit: Gone] |
11:03 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep] |
11:13 | | Chalcedon [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has quit [Quit: Gone] |
11:45 | | ReivOut is now known as Reiver |
11:53 | | You're now known as TheWatcher[afk] |
11:54 | | You're now known as TheWatcher[zZzZ] |
11:54 | | You're now known as TheWatcher |
12:25 | | AnnoDomini [AnnoDomini@Nightstar-29758.neoplus.adsl.tpnet.pl] has quit [Quit: Don't trust the skull.] |
12:31 | | AnnoDomini [AnnoDomini@Nightstar-29758.neoplus.adsl.tpnet.pl] has joined #Code |
12:31 | | mode/#code [+o AnnoDomini] by ChanServ |
13:19 | | Vornicus-Latens is now known as Vornicus |
13:20 | | Vornicus is now known as NSGuest-2147 |
13:21 | | NSGuest-2147 is now known as Vornicus |
17:09 | | You're now known as TheWatcher[afk] |
17:14 | | AnnoDomini [AnnoDomini@Nightstar-29758.neoplus.adsl.tpnet.pl] has quit [Ping Timeout] |
17:20 | | AD [AnnoDomini@Nightstar-6898.neoplus.adsl.tpnet.pl] has joined #Code |
17:31 | | Chalcedon [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has joined #code |
17:31 | | mode/#code [+o Chalcedon] by ChanServ |
--- Log closed Sat Nov 03 18:05:45 2007 |
--- Log opened Sat Nov 03 18:05:50 2007 |
18:05 | | TheWatcher[afk] [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
18:05 | | Irssi: #code: Total of 16 nicks [8 ops, 0 halfops, 0 voices, 8 normal] |
18:05 | | mode/#code [+o TheWatcher[afk]] by ChanServ |
18:06 | <@jerith> | :-( |
18:06 | | Irssi: Join to #code was synced in 42 secs |
18:06 | | * jerith hands ToxicFrog a clue-by-four. |
18:16 | <@ToxicFrog> | So the correct answer to "player must be able to pick up items and move down stairs", for example, is "player must automatically pick up items/descend stairs when walking over them and cannot drop items, because getting an item to appear on a square that the player has passed over requires an ugly hack for which you will be penalized" |
18:42 | | You're now known as TheWatcher |
18:50 | | Chalcy [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has joined #code |
18:50 | | mode/#code [+o Chalcy] by ChanServ |
18:51 | | Chalcedon [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has quit [Ping Timeout] |
18:54 | | Forj [~Forj@Nightstar-9586.ue.woosh.co.nz] has joined #code |
18:54 | | mode/#code [+o Forj] by ChanServ |
19:06 | | Chalcy is now known as Chalcedon |
19:10 | | AD is now known as AnnoDomini |
19:10 | | mode/#code [+o AnnoDomini] by ChanServ |
19:48 | | Chalcedon [~Chalcedon@Nightstar-9586.ue.woosh.co.nz] has quit [Quit: Gone] |
19:49 | | Forj [~Forj@Nightstar-9586.ue.woosh.co.nz] has quit [Connection reset by peer] |
20:22 | < Vornicus> | jerith: have you solved the euler project thing with long division? |
20:22 | <@jerith> | Which number? |
20:23 | <@jerith> | I've done up to 25. |
20:23 | <@jerith> | Oh, the one I asked about? |
20:23 | < Vornicus> | Yeah |
20:23 | <@jerith> | Haven't really looked at it since then. |
20:23 | | * Vornicus has Python code for it. |
20:23 | <@jerith> | I toyed with long division but then went out on errands. |
20:27 | | * Vornicus appears to have a whirlwind tour of number theory and algorithms, now. |
21:04 | | GeekSoldier_ [~Rob@Nightstar-3561.pools.arcor-ip.net] has joined #code |
21:05 | | GeekSoldier [~Rob@Nightstar-3561.pools.arcor-ip.net] has quit [Ping Timeout] |
21:21 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has joined #code |
21:21 | | mode/#code [+o Thaqui] by ChanServ |
21:29 | | GeekSoldier_ is now known as GeekSoldier |
21:59 | | Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>] |
22:09 | | Attilla [~The.Attil@194.72.70.ns-11849] has joined #code |
22:36 | | GeekSoldier is now known as GeekSoldier|bed |
22:41 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep] |
22:43 | | Thaqui [~Thaqui@Nightstar-13312.jetstream.xtra.co.nz] has joined #code |
22:43 | | mode/#code [+o Thaqui] by ChanServ |
22:43 | | GeekSoldier|bed [~Rob@Nightstar-3561.pools.arcor-ip.net] has quit [Ping Timeout] |
23:31 | | jerith [~jerith@IRCop.Nightstar.Net] has quit [Ping Timeout] |
23:34 | | jerith [~jerith@Nightstar-21563.slipgate.za.net] has joined #code |
--- Log closed Sun Nov 04 00:00:46 2007 |