--- Log opened Thu Feb 28 00:00:29 2008 |
01:17 | <@Reiver> | what be an atom? |
01:19 | <@McMartin> | A symbolic constant. |
01:20 | <@Vornicus> | a symbol looks like a name. |
01:20 | <@McMartin> | In LISP, stuff that's quoted, a la 'foo. |
01:20 | <@Vornicus> | It's kinda a string, but it's cheaper, and it's used most often to refer to named things without actually activating them or getting a reference. |
01:20 | <@McMartin> | Though, really, it's "foo" that's the atom there, but when dealing with them directly that's how you do it. |
01:21 | <@McMartin> | (cons 'foo (cons 'bar nil)) |
01:21 | <@McMartin> | There are five atoms there |
01:21 | <@McMartin> | cons, foo, bar, nil, and (hidden by the macros) quote. |
01:21 | <@Reiver> | Hm. |
01:22 | <@Reiver> | So 'nil' is an atom. Is 'null', or is that merely a constant? |
01:22 | <@McMartin> | In C, think of there being some global enum type that all symbolic constants live in. |
01:22 | <@McMartin> | "null" isn't defined in LISP. |
01:22 | <@McMartin> | nil is false and the null reference and the empty list. |
01:23 | <@Reiver> | Aah. Hokay. |
01:23 | <@Reiver> | I think I get the general idea; though proper grokking is impeded by my not knowing LISP or related languages very much. |
01:23 | <@Reiver> | Which is no-ones fault but my own~ |
01:23 | <@McMartin> | And they're an enum that lives in a global namespace, and some of them are bound to values (cons evaluates to a function, for instance). |
01:24 | | * McMartin suggests the first chapter or so of SICP. |
01:24 | <@Vornicus> | Let's work in a language other than lisp for a minute, so you can see what happens |
01:24 | <@Reiver> | OK |
01:25 | <@Vornicus> | Ruby is the first place I learned about symbols: if I go foo.getattr(bar) it will go hunting for blarg in current scope, and go "I don't know what you're looking for" |
01:26 | <@Vornicus> | if I go foo.getattr(:bar) it sees bar as a symbol, and knows to pass /the symbol/ to getattr. |
01:26 | <@McMartin> | ... that's another strike against Ruby, imo =P |
01:27 | <@McMartin> | Or rather, a place where Python does it better. |
01:27 | <@Vornicus> | Well, Python you'd have to throw it a string; Ruby you can also throw it a string, but the performance is balanced toward symbols. |
01:28 | <@McMartin> | If it's a constant, as in this case, you can also just refer to foo.bar. |
01:28 | <@Reiver> | So a symbol is a string that represents an object, without having that object called when referenced as a symbol? |
01:28 | <@Vornicus> | A symbol is a string that represents a name. |
01:28 | <@McMartin> | A symbol is actually an integer, once all is said and done. |
01:28 | <@Reiver> | hm |
01:28 | <@Vornicus> | But it's collapsed into an integer for performance reasons. |
01:29 | <@McMartin> | (Except in very special cases, symbols aren't allowed to be strings.) |
01:29 | <@Reiver> | And that integer refers to an object in your code somewhere. |
01:29 | <@McMartin> | Not necessarily. |
01:29 | <@Vornicus> | Well, no. |
01:29 | <@Vornicus> | I think we're screwing you up by talking about objects here |
01:29 | <@Vornicus> | A symbol looks like a name, except that it doesn't refer to things like names do. |
01:30 | <@Reiver> | OK. |
01:30 | <@McMartin> | In C, you can get this effect with "enum". |
01:30 | | MystUni [~c6b6cdfe@Nightstar-29731.dsl.in-addr.zen.co.uk] has quit [Quit: CGI:IRC] |
01:30 | <@McMartin> | If you say enum { foo, bar, baz }; somewhere, you've made them symbols |
01:30 | <@Vornicus> | Sort of. Most languages with symbols allow you to use symbols to get named items out of objects. |
01:30 | <@McMartin> | Including C, but C overconstrains it. |
01:31 | <@McMartin> | Make that enum { foo, bar, baz, NUM_SYMS }; |
01:31 | <@McMartin> | Now you can declare int array[NUM_SYMS] and say array[foo] or whatnot. |
01:31 | <@Vornicus> | PostScript uses symbols in its definition syntax - def takes a symbol and then another token, and makes the symbol into a name that represents the token. |
01:33 | <@Reiver> | ...Ohhhhh |
01:33 | | * Reiver eyes McM's example. |
01:33 | <@McMartin> | (C's overconstraint is that the programmer can know which integers the symbols will collapse to) |
01:34 | <@Reiver> | So, in C for the moment. |
01:34 | <@Reiver> | They're a bit like constants, or can be used as such to refer to a Specific Thing or Amount Of Thing? |
01:35 | <@McMartin> | That's part of the overconstraint. |
01:36 | <@McMartin> | They're constants, but they're necessarily any specific constant. |
01:36 | <@McMartin> | There's no guarantee, for instance, that a LISP compiler will use the bit pattern 0x00000000 to represent nil. |
01:36 | <@McMartin> | It probably will, but it doesn't have to. |
01:37 | <@McMartin> | Whereas in my example above, foo must have that bit pattern. |
01:37 | <@McMartin> | You don't care about its value. |
01:37 | <@McMartin> | You're using it as an index into something |
01:38 | <@McMartin> | When that something is a variable namespace, it effectively has a value at that point, but what it means to "have a value" depends on the semantics of the language. |
01:38 | <@McMartin> | To go again to C: |
01:38 | <@McMartin> | int foo() { printf ("Blah |
01:38 | <@McMartin> | ") |
01:38 | <@McMartin> | ; } |
01:38 | <@McMartin> | int bar() { int printf = 2*6; return printf; } |
01:39 | <@McMartin> | if "printf" is a symbol, it's referring to a function in foo() and to a value on the stack in bar(). |
01:39 | <@McMartin> | Languages like Ruby maintain a symbol->object map for their namespaces. Python uses strings for the purpose. |
01:40 | <@McMartin> | LISP also used symbols but since it generated assembly code there's a much more rigid distinction made between symbols and strings. |
01:40 | | * Reiver nods. |
01:41 | <@Reiver> | Okay, I get it, at least for C, now. |
01:41 | <@McMartin> | In LISP specifically, an "atom" is actually anything that isn't a list. |
01:42 | <@McMartin> | Because lists are the only divisible structure. |
01:42 | <@Reiver> | ... Aha. That makes the naming a bit more logical then. |
01:42 | <@McMartin> | http://mitpress.mit.edu/sicp/full-text/book/book.html |
01:54 | <@ToxicFrog> | So the Erlang atom and the Lisp atom are different things, in practice. |
01:54 | <@McMartin> | Yeah, in Lisp, 3 is an atom |
01:56 | <@Vornicus> | The difference between a symbol and a name in most languages is that a name is dereferenced immediately - it gets looked up in the scope pile. A symbol always stays a symbol, and can be explicitly dereferenced later. |
01:57 | <@McMartin> | Mmm. Lisp isn't one of those. |
01:57 | <@McMartin> | Lisp will evaluate symbols unless you quote them. |
01:57 | <@Vornicus> | I would call the "quoted" symbol a symbol, and the rest names. |
01:59 | <@McMartin> | Well |
01:59 | <@McMartin> | Quoting means "short-circuit the evaluator" |
01:59 | <@McMartin> | You can quote lists, too. |
02:00 | <@McMartin> | (car '('a 'b)) returns a. |
02:00 | <@McMartin> | Er, '(a b) |
02:00 | <@McMartin> | I think |
02:00 | | * McMartin doesn't have a scheme terp handy |
02:01 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has joined #code |
02:02 | < Reltzik> | *compiles his freshly-written code* Oh, hey! Only a single error in the whole thing! Not bad... |
02:02 | < Reltzik> | *fixes and compiles again* Huh, there's three errors now. |
02:02 | <@Vornicus> | And you haven't even done any unit testing, have you. :P |
02:02 | < Reltzik> | *fixes and compiles again* .... five. *again* ... eighteen. |
02:03 | <@Vornicus> | Relt: obviously, your IDE isn't yelling at you about syntax errors. |
02:03 | <@McMartin> | This tends to mean that the more severe errors were confusing the compiler to the point that it couldn't find the others. |
02:03 | <@ToxicFrog> | ... |
02:03 | <@ToxicFrog> | sh: /bin/dmesg: Input/output error |
02:04 | < Reltzik> | I don't have an IDE. I have a text editor and a command line compiler. |
02:04 | <@Vornicus> | Relt: what language? |
02:04 | < Reltzik> | java. |
02:04 | <@Vornicus> | Go get Eclipse. |
02:04 | < Reltzik> | McM: Well, yes, but when you put it that way the humor evaporates. |
02:04 | <@ToxicFrog> | rtorrent says "bus error: dumping stack" |
02:04 | <@ToxicFrog> | Something is very wrong |
02:10 | < Reltzik> | Huh. Guess I could get Eclipse. |
02:11 | | * Reltzik juggles "Having a better way of coding" with "Having to LEARN a better way of coding". |
02:11 | < Reltzik> | Eh, maybe. |
02:12 | <@Vornicus> | Eclipse will, for at least the bit about making code, be content to sit there and look over your shoulder and kvetch about syntax errors. |
02:13 | | ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out] |
02:13 | | * Reltzik will download it overnight, then. |
02:13 | < Reltzik> | ...... |
02:13 | | * Reltzik should probably put in comments. |
02:14 | <@Vornicus> | it will also generate javadoc, follow references around and find type errors, automatically run unit tests, and do a whole lot of other crap. |
02:16 | <@Vornicus> | It essentially Knows How Java Works, and will do a lot of the hard work of finding errors for you. |
02:16 | < Reltzik> | Doesn't sound like a good way of learning the language... |
02:17 | <@McMartin> | What is your goal? |
02:17 | <@Vornicus> | In the end, the language is a detail, compared to understanding how programming works. |
02:17 | <@McMartin> | If your goal is to memorize the standard library, You're Doing It Wrong. |
02:18 | <@McMartin> | Especially for Java, whose simple list of all standard classes and methods is several megabytes long. |
02:18 | <@McMartin> | Remembering how methods are spelled is one of the tasks for your army of robots, and Eclipse will do tab completion on that, like any halfway respectable IDE. |
02:19 | < Reltzik> | Actually, at the moment I'm kinda refreshing my memory of the basics (been putting "abstract" and "static" in the wrong places, for example) and figuring out generics, which got added since I first learned it. |
02:20 | <@McMartin> | Generics can actually be safely ignored. |
02:20 | <@Vornicus> | Remembering to close braces and parentheses, to put semicolons at the ends of statements, to make sure you're using "abstract" and "static" in the right places... these are tasks for your army of robots. |
02:20 | <@McMartin> | Also, wrong places? |
02:20 | <@McMartin> | There's no required order for qualifiers, just traditional ones. |
02:21 | | * McMartin also adds "handling import statements" to the Army of Robots list. |
02:21 | < Reltzik> | Huh. The compiler was shouting at me about something. Oh well. |
02:21 | <@Vornicus> | Copy the error. There are people in here who are /working on their doctorate/ in understanding Java. |
02:22 | <@McMartin> | If you mean about "failing to use generics", it's a complaint, not an actual error. |
02:22 | <@Vornicus> | That and most of us know how to beat your average compiler senseless. |
02:22 | | * Vornicus ponders. Rocket punches, of course. |
02:23 | < Reltzik> | That was a ways back. But the error I'm beating my head against now is "failing to use generics", and it's refusing to compile. |
02:23 | < Reltzik> | Something about unchecked/unsafe opperations. |
02:24 | <@Vornicus> | Oh, those are fun. Get out the pastebin. |
02:27 | | * Reltzik should probably add some explanatory comments first. |
02:27 | < Reltzik> | But, oh well! |
02:28 | <@Vornicus> | unchecked operations are things like indexing into an array without making sure the array is big enough yet. |
02:29 | <@McMartin> | No |
02:29 | <@Vornicus> | Or is it the throws stuff? |
02:29 | <@McMartin> | Unchecked/unsafe operations in Java means things like this: |
02:29 | <@McMartin> | Well |
02:29 | <@McMartin> | If the error is: |
02:30 | <@McMartin> | [javac] Note: /u/mcmartin/svnclient/blorple/src/java/net/sf/blorple/gui/MetadataModel.java uses unchecked or unsafe operations. |
02:30 | <@McMartin> | [javac] Note: Recompile with -Xlint:unchecked for details. |
02:30 | <@McMartin> | Then that's because you have a line like: |
02:30 | <@McMartin> | ArrayList foo = new ArrayList(); |
02:30 | <@McMartin> | It should not terminate compilation; it is only a warning |
02:30 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
02:30 | <@Vornicus> | What's wrong with that line? |
02:30 | <@McMartin> | Indeed, there are certain constructs that as near as I can tell cannot be written without causing either that or a genuine error. |
02:30 | <@McMartin> | What's wrong with that line is that it is not, say: |
02:31 | <@McMartin> | ArrayList<String> foo = new ArrayList<String>(); |
02:31 | <@McMartin> | However! |
02:31 | <@Vornicus> | aha |
02:31 | <@McMartin> | ArrayList<String> foo[] = new ArrayList<String>[3]; |
02:31 | <@McMartin> | Is in fact illegal and will not compile. I'm not sure why this is. |
02:31 | < Reltzik> | Okay, here's what the command line's shouting at me. |
02:31 | < Reltzik> | ((Gah. Someone voice me?)) |
02:32 | | mode/#code [+v Reltzik] by ChanServ |
02:32 | <+Reltzik> | http://rafb.net/p/3n65QK32.html |
02:32 | | mode/#code [+oooooo Attilla GeekSoldier|bed MyCatVerbs Raif Reltzik Serah] by Vornicus |
02:32 | <@McMartin> | Uh, so |
02:32 | | * Reltzik thinks it might be the extension of the generics causing a problem. |
02:32 | <@McMartin> | Are K and V defined? |
02:32 | <@McMartin> | Those are the internal names for the key and value types. |
02:33 | <@McMartin> | So, what's m? |
02:33 | <@Reltzik> | Yes, they're generics for the class. |
02:33 | <@Vornicus> | What /is/ ListenableHashMap.java:99 ? |
02:33 | <@Vornicus> | I think you're doing that. |
02:33 | <@Vornicus> | I think you're doing that wrong. But I can't tell you how you're doing it wrong until I see it. |
02:33 | <@McMartin> | Iterator<Map.Entry<K, V>> addList = m.entrySet().iterator(); is line 99 |
02:33 | <@Reltzik> | Hang on, I'll post the whole class in there. No comments, though, I usually add those last. |
02:34 | <@McMartin> | However, we need both the declaration of m and the declaration of the class for it to be visible. |
02:34 | | * McMartin suggest just erasing all the types and ignoring the Xlint:unchecked warning. |
02:34 | <@McMartin> | That said, post the class first |
02:35 | <@McMartin> | The error looks like some bits are being underspecified, and it's inferring types that are more general than the underlying library is willing to permit. |
02:36 | <@Reltzik> | http://rafb.net/p/z3RoqL68.html |
02:36 | <@Reltzik> | Be warned, no comments. |
02:36 | <@Vornicus> | Oh, gee. |
02:36 | <@McMartin> | Your problem is that m is of type Map<? extends K, ? extends v> |
02:36 | <@Vornicus> | public void putAll(Map<? extends K, ? extends V> m) |
02:36 | <@Reltzik> | It's probably something very dumb. |
02:37 | <@McMartin> | And so its entrySet().iterator() is of type Iterator<Map.Entry<? extends K, ? extends V>> |
02:37 | <@McMartin> | Which is not Iterator<Map.Entry<K,V>>. |
02:37 | <@Reltzik> | I tried that, though, didn't help. |
02:37 | <@McMartin> | That said |
02:37 | | * Reltzik tries it again, to see if the Murphey Repairman Corrolary kicks in. |
02:37 | <@McMartin> | What you want to do here is not to define an iterator specifically |
02:37 | <@McMartin> | I don't think. |
02:37 | <@McMartin> | ... also, is putAll supposed to annihilate m? |
02:38 | | * Reltzik squints at the code, eeks. |
02:38 | <@McMartin> | That method doesn't do what you think it does. |
02:38 | <@Reltzik> | Ah.... no, it's not. |
02:38 | <@McMartin> | Especially since it's advancing two steps through the list with each iteration. |
02:38 | <@McMartin> | I suggest simply not using an iterator at all. |
02:38 | <@McMartin> | Well, not explicitly. |
02:38 | <@Reltzik> | Well, it's convenient for the Collections. |
02:39 | <@McMartin> | No it's not. |
02:39 | <@McMartin> | Use the foreach loop. |
02:39 | <@Reltzik> | .... it's THERE for the collections? |
02:39 | <@McMartin> | foreach works on anything with the iterator() method, AIUI. |
02:39 | <@Reltzik> | Where's foreach? |
02:39 | <@McMartin> | That doesn't necessarily solve your K/V problem, though. |
02:40 | <@McMartin> | It would be something like |
02:40 | <@Reltzik> | No, it doesn't. *got distracted, will try extending* |
02:40 | <@McMartin> | for (Map.Entry<? extends K, ? extends V> entry : m) { |
02:40 | <@McMartin> | /* code referring to entry */ |
02:40 | <@McMartin> | } |
02:40 | <@McMartin> | Er. |
02:40 | <@McMartin> | m.entrySet(), rather. |
02:41 | <@Reltzik> | Which would? The K/V problem or the foreach? |
02:41 | <@McMartin> | In the foreach, where I have ": m) {" |
02:41 | <@McMartin> | That should of course be ": m.entrySet()) {" |
02:42 | | * Reltzik has never seen that before. He probably should have. Friggin newb. |
02:42 | <@McMartin> | It was introduced along with generics. |
02:42 | <@Reltzik> | Oh. |
02:42 | <@McMartin> | And now, dinner. |
02:42 | <@Reltzik> | Friggin ancient, then. |
02:42 | | * Reltzik WANTS that. Goes hunting for details. |
02:42 | <@McMartin> | Yes |
02:43 | | * McMartin is working on a Java-based side project ATM that gets to use 1.5 (his thesis work required 1.4 for reasons he won't go into) and has already forgotten how he ever lived without it. |
02:44 | <@Reltzik> | Okay, so.... am I right in guessing that works like this? |
02:45 | <@Reltzik> | for ([class type] [variable name] : [collection]) {block} |
02:47 | <@Reltzik> | Will iterate through every [class type] in [collection], calling it [variable name] within the scope of the code block, which it executes for each? |
02:47 | <@Reltzik> | Oh, and that extending thing didn't work. |
02:55 | | * Vornicus has never used java's foreach, but that looks sensible. |
02:55 | <@Vornicus> | If all else fails, Try It, and if it fails, it will tell you why. |
02:56 | | * Reltzik learned to code with Ansi C! Languages aren't allowed to change definitions every 3 years! It's just not fair! |
02:56 | <@Vornicus> | Heh. |
02:56 | <@Vornicus> | You seem to have forgotten about namespaces |
02:56 | <@Reltzik> | THERE ARE NO NAMESPACES. |
02:57 | | * Vornicus patpats Reltzik. |
02:57 | | Bellamy [Jennet@Nightstar-20631.216-254-250.iw.net] has joined #code |
02:57 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has joined #code |
02:57 | | mode/#code [+o Thaqui] by ChanServ |
03:27 | <@McMartin> | C's changed at least twice since ANSI C. |
03:28 | <@Reltzik> | Not faitr |
03:28 | <@Reltzik> | Not Fair! |
03:28 | | * McMartin smacks Reltzik with // comments. |
03:28 | <@Reltzik> | ..... okay, fine, those don't count. |
03:29 | <@Vornicus> | heh |
03:29 | <@McMartin> | Also, ANSI C has namespaces of a sort. Back In The Day, this wasn't legal: |
03:30 | <@McMartin> | typedef struct { int foo, bar } struct_1; |
03:30 | <@McMartin> | typedef struct { int bar, baz } struct_2; |
03:30 | <@McMartin> | Because "bar" was already defined, you see. |
03:30 | <@Reltzik> | "of a sort". |
03:31 | <@Vornicus> | ;_; |
03:31 | <@Reltzik> | Okay, foreach seems to have GREATLY simplified my code, but it still doesn't seem to want to work on the <? extends K> stuff. |
03:32 | <@Vornicus> | That's because you haven't fixed it. |
03:32 | <@Reltzik> | Oh, wait, nm, stupid bug. |
03:32 | <@Reltzik> | Yes, I had, I just introduced a NEW bug while I was doing it. |
03:34 | | Vornicus is now known as Finerty |
03:39 | | Bellamy is now known as Julia |
03:39 | <@Reltzik> | Grah. |
03:41 | | * Reltzik tries to figure out Serializability. It doesn't help that the Serializable interface API entry uses a *"serial"* word EIGHT TIMES in the first paragraph. |
03:42 | <@McMartin> | Ignore it for now. |
03:42 | <@Reltzik> | The compiler's grumbling about it. |
03:42 | <@McMartin> | It's whining about it. |
03:42 | <@Finerty> | what's it saying? |
03:43 | <@McMartin> | He's not defining a UUID for the version number. |
03:43 | <@Finerty> | Heh. |
03:43 | <@McMartin> | It's whining because if you do a memory dump and then try to read it back in after changing the class implementation, it might take longer for it to notice. |
03:44 | <@McMartin> | As a C programmer, you should be well-equipped to ignore compiler whining. |
03:44 | <@Reltzik> | Whine, grumble, whatever, it's a weird noise coming out from under the hood. |
03:44 | | * Reltzik is. But C's an old Yugo, and this is a brand new car. |
03:44 | <@McMartin> | No it's not~ |
03:45 | <@Reltzik> | Okay, fine, but it's not an old Yugo. |
03:45 | <@McMartin> | Anyway, to remove that warning add this: private static final long serialVersionUID = 1; |
03:46 | <@McMartin> | Alternately, don't inherit from HashMap and just carry one around in a private field and forward your methods to it via direct function call instead of via super() calls. |
03:46 | | * Reltzik wants to UNDERSTAND that warning, actually. |
03:46 | <@Reltzik> | And that'd require me to rewrite half the class. Pass. |
03:46 | <@McMartin> | Serializable is an interface with no methods. |
03:46 | <@McMartin> | If you implement it, you're announcing to the runtime that you may be written out to disk and reloaded later. |
03:47 | <@Reltzik> | So it's a bit like Object.equals(), in that you'd better override it? |
03:47 | <@McMartin> | No. |
03:47 | <@McMartin> | It's usually done entirely automatically. |
03:48 | <@McMartin> | Serializable has no methods. |
03:48 | <@McMartin> | It's just a marker. |
03:48 | <@Reltzik> | So why not use it with everything? |
03:48 | <@McMartin> | Not everything can be sensibly persisted. |
03:48 | <@Reltzik> | Okay. |
03:48 | <@McMartin> | In order to make it easier to detect when the underlying class has changed incompatibly, there's a magic static field named serialVersionUID that has some value that the programmer is supposed to change every time the class changes incompatibly. |
03:48 | <@Finerty> | (sockets, files, things that depend on them, cannot be persisted) |
03:49 | <@McMartin> | If it's not there, the JVM won't notice that it's using an out-of-date file until it tries to write/read somewhere it shouldn't and segfaults. |
03:49 | <@McMartin> | If it is, it fails immediately upon load. |
03:49 | <@McMartin> | There's a special keyword -- transient -- that you use to indicate that a field should not be persisted. |
03:50 | <@McMartin> | I would suggest that your list of listeners should probably not be persisted in this case. |
03:50 | <@Reltzik> | No? |
03:50 | <@McMartin> | No, because then each time you save a character sheet, you'll end up saving the whole ruleset with it. |
03:50 | <@McMartin> | Er, because if you do persist the listeners, rather |
03:51 | <@McMartin> | The listeners are part of the running program, not part of the data. |
03:51 | <@Reltzik> | AH. |
03:51 | <@Reltzik> | ..... huh. |
03:51 | | * Reltzik will have to think about that some. |
03:51 | <@McMartin> | And the reason it's popping up for you here is because your superclass, HashMap, is Serializable. |
03:51 | <@Finerty> | Is there a way to make your program know how to deserialize old data? |
03:51 | <@McMartin> | Finerty: Yes; you override some methods in Object(). |
03:52 | <@Finerty> | Okay. |
03:52 | <@McMartin> | That said, it's typically better, imo, to just develop a sensible file format and write reader/writer methods. |
03:52 | | * McMartin Does Not Like ObjectInputStreams. |
03:53 | <@McMartin> | It's the moral equivalent of calling fread then casting the resulting array to a struct. |
03:54 | <@Finerty> | Yeah |
03:54 | | * Reltzik might just have to make two versions of this thing, one with a transient list and one without. |
03:55 | <@Reltzik> | *transient listener set |
03:55 | <@Reltzik> | Meh. Details for the future. |
03:55 | <@McMartin> | If you're really itching to design a language, that kind of problem is one where it's easier to handle. |
03:55 | <@McMartin> | "This kind of data set is cared about by these kinds of operators" |
03:56 | <@Reltzik> | No, I got talked out of the language. I realized I could have the user construct rules in a special rule-editor GUI. |
03:57 | <@Finerty> | That's not really a good idea either. |
03:57 | <@Reltzik> | You know, select the rule-type from a list, select what it applies to from a list, that sort of thing. |
03:57 | <@Finerty> | Seriously: let the /programmers/ handle coding the rules. |
03:57 | <@Reltzik> | ..... is it a BETTER or WORSE idea than the language? |
03:57 | <@Finerty> | Better, but only marginally. |
03:59 | <@Reltzik> | Well, I'm eventually going to want something where DMs can make maps with events and stuff in them, so I'd need something like a level-design program. |
04:00 | <@Reltzik> | Really, you CAN'T leave that sort of thing to the programmers. It's run-time input. |
04:00 | <@Finerty> | Well, maps and events, there you use a sort-of minilanguage - look at the Starcraft map editor's thing. |
04:00 | <@Reltzik> | Yes, that's exactly the sort of thing I'm thinking of. |
04:01 | <@Finerty> | At which point you probably schlep over to Lua. |
04:11 | | ToxicFrog [~ben@Nightstar-20147.cpe.net.cable.rogers.com] has joined #code |
04:11 | | mode/#code [+o ToxicFrog] by ChanServ |
04:12 | | * Reltzik sighs, will implement this in Java, THEN see about learning Lua, and perhaps make a better, hybrid version. |
04:13 | <@McMartin> | Lua will talk to Java, IIRC. |
04:13 | <@Finerty> | (the reason we say work that in Lua is because you don't want your user-side programs crashing your actual java stuff, and writing in java breaks down certain barriers...) |
04:14 | <@Reltzik> | Aaaah. |
04:14 | <@ToxicFrog> | Indeed; there are both Lua bindings for Java so that each can talk to the other, and a complete Lua interpreter written in Java. |
04:14 | | * Reltzik ponders, MIGHT be possible to put up a sort of virtual wall, but even at first glance it looks painful. |
04:14 | <@ToxicFrog> | Although the latter is still alpha, IIRC. |
04:14 | <@McMartin> | Yeah |
04:15 | <@McMartin> | Without walls you can actually do Java stuff fairly easily with the dynamic loading tricks we mentioned last week, and then you can make "Lua-written stuff" be one of those. If you want to go all-out. |
04:16 | <@Reltzik> | Maybe. Don't know. I'd already been thinking sandboxes, though, namespaces, whatever. Don't want the user able to modify the core rules permanently, for example. Override them within a limited scope, yes, but not outright change them. |
04:20 | <@ToxicFrog> | Why not? |
04:22 | <@McMartin> | "Improved score potential for Mono characters" |
04:22 | <@McMartin> | REBALANC'D |
04:22 | <@Reltzik> | TF: Pardon? |
04:23 | <@ToxicFrog> | Why do you not want the user to be able to do this? |
04:23 | <@Reltzik> | Erm. Lemme be a bit more specific about what I'm thinking. |
04:24 | <@Reltzik> | The persistent version of the core rules would be static and unchanging (save by me, the programmer). However, in any given SESSION, the user could edit-away at will, and even save the changes in a different box for future sessions. |
04:25 | | ToxicFrog [~ben@Nightstar-20147.cpe.net.cable.rogers.com] has quit [Operation timed out] |
04:26 | <@Reltzik> | But the master copy would stay intact. |
04:26 | <@Reltzik> | ..... and he didn't read a word I wrote. |
04:26 | | ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code |
04:26 | | mode/#code [+o ToxicFrog] by ChanServ |
04:28 | | GeekSoldier|bed is now known as GeekSoldier|work |
04:29 | <@ToxicFrog> | Sorry. |
04:29 | <@ToxicFrog> | You were saying? |
04:29 | | * Reltzik PMed it to you. |
04:30 | <@ToxicFrog> | My question is why is this desireable. |
04:30 | <@ToxicFrog> | What benefit is gained by arbitrarily restricting the actions of the user? |
04:30 | <@ToxicFrog> | If they want to do horrible things to their copy of the software, why not? |
04:31 | <@Reltzik> | Because then they blame me for it? |
04:31 | <@Finerty> | Actually, looking at the use case, Relt's probably doing a server model with multiple games going on at once. |
04:31 | | * ToxicFrog kicks Reltzik in the balls. |
04:32 | <@Reltzik> | Basicly, the core rules would be the DEFAULT. They can modify their personal settings once you want. But they should always be able to start over from scratch. |
04:32 | <@ToxicFrog> | That. Is. The. Worst. Reason. For. Leaving. Out. A. Feature. EVER. |
04:32 | <@Reltzik> | *settings all they want. |
04:32 | | * Reltzik wasn't quite serious. |
04:32 | <@Finerty> | Where allowing users to modify the core rules would be Bad. |
04:33 | <@Reltzik> | Yeah, that's one model I'm playing with. Another would have an offline version. But again, Badness. |
04:33 | <@ToxicFrog> | If I had a source tree for every developer, especially game developers, who won't enable X or won't release X where X is some incredibly useful thing that would make 90% of their user base ecstatic because they're afraid of idiots misusing it and then whining their asses off to the support@ address, I wouldn't need for these things to be released, I'd just make them from source. |
04:34 | <@Finerty> | It's not so bad if you keep an archival copy of the core rules around, just in case. |
04:34 | <@ToxicFrog> | Finerty: or, say, if you just re-download it or keep the installer. |
04:34 | <@Finerty> | in the local model. |
04:34 | <@Reltzik> | TF: Now hold on! They can do ALL of this stuff. They just can't OVERWRITE the original, they have to save it somewhere else. |
04:34 | <@ToxicFrog> | If this is a distributed thing it makes more sense - you don't want one user to be able to break it for everyone else. |
04:34 | <@Reltzik> | It's like with java packages. You can make any package you want, but you can't overwrite java.lang |
04:34 | <@ToxicFrog> | But if this is a local app there is no excuse |
04:35 | <@ToxicFrog> | Reltzik: yes, and this has been a source of frequent frustration to me when working in Java |
04:35 | <@ToxicFrog> | The ability to redefine some of the core classes would make my life much easier |
04:36 | <@Reltzik> | But it's not even like that, because you can OVERRIDE the core rules, saying, "All right, under my current settings, which I can save and reload at will, I want THIS package to take java.lang's place". |
04:36 | <@Reltzik> | But you should always be able to go back to the original, is what I'm saying. |
04:36 | <@ToxicFrog> | ...so this is functionally completely indistinguishable from the ability to overwrite the original, except that there's a "restore defaults" button? |
04:36 | <@Reltzik> | YES! |
04:37 | <@Finerty> | Well, actually, it's more along the lines of there's a "use my rules" button. |
04:37 | <@Reltzik> | Sortof. Couple of reserved names. |
04:38 | <@Reltzik> | But yeah, that's exactly what it is, a restore-defaults option. |
04:38 | <@Reltzik> | Or rather, the thing which loads by default, but you can choose something else to load in its place. |
04:39 | <@Reltzik> | ((And I don't see any reason not to make that choice persistent, either.)) |
04:40 | <@Reltzik> | ((Er, not to be able to make it persistent.)) |
04:42 | <@Reltzik> | So, yeah. I am quite willing to arbitrarily restrict the user's ability to permanently delete/modify the master defaults. Temporarily or even routinely override them, sure, fine, but not eliminate them entirely. |
05:20 | | * Reltzik guesses TF withdrew his objection. |
05:21 | <@McMartin> | Well |
05:21 | <@McMartin> | He's objecting that it's easier to just keep the read-only version around somewhere and be able to reinstate it at will. |
05:22 | <@Reltzik> | Okay, fine. "Somewhere" is right smack with the rest of the program. Why go to all the trouble to head online to some central sever? Especially when that would require me, the programmer, to HAVE a central server? |
05:24 | | * jerith looks upward to see what the discussion is about. |
05:27 | <@jerith> | Oh. |
05:27 | <@jerith> | Yeah. |
05:28 | <@jerith> | I had a similar argument elsewhere about "sealed" (in C#, equivalent to "final" in Java) classes and methods. |
05:29 | <@jerith> | You don't ever want to restrict people. |
05:29 | <@Reltzik> | I might have a few reserved names, but other than that? Won't. |
05:29 | <@jerith> | You want to warn them about the dangers, but let them go ahead anyway. |
05:30 | <@jerith> | We have enough people whining on our support fora fecause they haven't read the docs already. |
05:30 | <@Reltzik> | And I don't suppose you're just allowed to have the four letters RTFM with a link to that part of the docs? |
05:31 | <@jerith> | Extra noise added by people who broke their stuff because we give them the code for the tools is negligible. |
05:31 | <@jerith> | Reltzik: We have a few community members who will happily do that for us. :-) |
05:31 | <@Reltzik> | Hehehe. |
05:31 | <@jerith> | I have to occasionally restrain myself. |
05:32 | | * Reltzik has no idea how he's going to get a job. He thought he knew java well enough to get employed. Clearly doesn't. |
05:32 | <@Reltzik> | Hell, I just figured out generics last week, and I'd never even heard of foreach until today. |
05:32 | <@jerith> | Especialy when they yell at us because they lost data because they didn't read the docs. |
05:33 | <@jerith> | What other languages do you have? |
05:33 | <@Reltzik> | Um.... C. |
05:33 | <@jerith> | And what part of the world are you in? |
05:33 | <@Reltzik> | SF Bay Area. |
05:33 | | * Reltzik is Doomed. |
05:33 | <@jerith> | Ah. |
05:33 | <@jerith> | Learn Python or Ruby. |
05:34 | <@ToxicFrog> | Or Scheme. |
05:34 | <@jerith> | Also, something functional. |
05:34 | <@Reltzik> | I've bumped into C++, 86/88 assembler, lisp, prolog, scheme, and SQL, but I can't claim to know any of them well. |
05:34 | <@ToxicFrog> | I would massively recommend Python over Ruby, espeically as your first high-level language. |
05:34 | <@jerith> | Yes. |
05:34 | <@Reltzik> | Isn't PHP somewhere in that list too? |
05:34 | <@ToxicFrog> | Ruby the language is very perl and Ruby the community is not safe for newbies. |
05:34 | <@ToxicFrog> | Hell no. |
05:34 | <@jerith> | Stay as far from PHP as you can. |
05:35 | <@Reltzik> | Okay, python. It's next on my list to learn anyway. |
05:36 | <@ToxicFrog> | Anyways. My suggestion would be to read SICP, which will get you Scheme and some useful theory and thought patterns, and then try out a high level imperative language (Python, Lua) and a functional language (Haskell, Erlang, ML) |
05:36 | <@Reltzik> | SICP? |
05:37 | <@Finerty> | Structure and Interpretation of Computer Programs |
05:37 | <@jerith> | I was going to let you know that we're hiring (if you can get through the interview), but we're in Cape Town and Seattle and I'm not sure if the Seattle team is hiring at present.\ |
05:38 | <@Reltzik> | At this point, I'm willing to relocate, but not for a job that I'll be fired from inside of a month for not knowing my stuff. |
05:38 | <@Reltzik> | ..... and not to South Africa. |
05:38 | <@jerith> | Oh, you won't /get/ the job if you don't know your stuff. |
05:38 | <@jerith> | Why not za?\ |
05:39 | <@ToxicFrog> | Reltzik: http://mitpress.mit.edu/sicp/full-text/book/book.html |
05:39 | <@jerith> | But "I don't grok the details of Java" isn't that much of an issue. |
05:39 | <@jerith> | Not having a dynamic language might be, but that's also not fatal. |
05:40 | | * Reltzik at least knows data structures and algorithms. |
05:40 | <@Reltzik> | So I guess college wasn't a COMPLETE waste... |
05:40 | <@jerith> | I didn't, much. |
05:40 | <@jerith> | Mostly because my degree was in EE, not CS. |
05:48 | | Finerty is now known as Vornicus |
05:50 | | * Reltzik pokes Vorn about those logs again; can't get the rest up until Vorn posts that missing gap. |
05:51 | | * Vornicus needs to actually concentrate on it, and hasn't been able to. |
05:51 | <@Reltzik> | Just so long as you don't forget. |
05:52 | <@ToxicFrog> | "Back around 1970-71, Unix on the PDP-11/20 ran on hardware that not only did not support virtual memory, but didn't support any kind of hardware memory mapping or protection, for example against writing over the kernel. This was a pain, because we were using the machine for multiple users. When anyone was working on a program, it was considered a courtesy to yell "A.OUT?" before trying it, to warn others to sav |
05:52 | <@ToxicFrog> | e whatever they were editing. |
05:52 | <@ToxicFrog> | [A substory: at some point several were sitting around working away. Bob Morris asked, almost conversationally, "what are the arguments to ld?" Someone told him. We continued typing for the next minute, as a thought began to percolate, not quite to the top of the brain-- in other words, not quite fast enough. The terminal stopped echoing before anyone could stop and say "Hold on Bob, what is it you're trying to |
05:52 | <@ToxicFrog> | do?"]" |
05:56 | <@jerith> | :-) |
05:57 | <@jerith> | Also, being 08h00, I must get out of bed. |
05:58 | <@Reltzik> | What'd ld do again? |
05:58 | <@McMartin> | That's the link program. |
05:59 | | * Reltzik is trying to get a sense of just what awful thing he might have been about to do. Has only the vaguest inkling, and that's probably impossible. |
06:00 | <@ToxicFrog> | He was in the final stages of compiling a program. |
06:00 | <@ToxicFrog> | First you run the compiler or assembler (or both) to generate object code; then you run the linker to combine the object files into an executable. |
06:01 | <@Reltzik> | Okay, so ordinary use. |
06:01 | <@ToxicFrog> | And then you run the executable and, in this case, the system crashes because the kernel is in unprotected memory and he mis-aimed a pointer or something. |
06:01 | <@ToxicFrog> | Hence the first paragraph, which explains this. |
06:01 | <@Reltzik> | So, it was the program he miswrote, not the linker he misused. |
06:01 | <@ToxicFrog> | Yes. |
06:02 | | * Reltzik was imagining some bizarro think along the lines of linking all executable files into one bizaro mega unworkable program, but knows that couldn't work. |
06:02 | <@Reltzik> | ....... but it's still ammusing. |
06:02 | | * Reltzik was reading too much into it. Oh well. |
06:03 | <@Reltzik> | Could have been worse. Could have been the Apollo computers. |
06:34 | | Reltzik [Reltzik@Nightstar-15817.dsl.pltn13.sbcglobal.net] has quit [Quit: DEATH TO THE UNDEAD!] |
07:03 | | You're now known as TheWatcher |
08:15 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
08:15 | | mode/#code [+o gnolam] by ChanServ |
08:18 | | You're now known as TheWatcher[afk] |
09:03 | | Chalcedon is now known as ChalcyZzz |
10:03 | | You're now known as TheWatcher |
10:10 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout] |
11:02 | | Thaqui [~Thaqui@Nightstar-123.jetstream.xtra.co.nz] has left #code [Leaving] |
11:33 | | You're now known as TheWatcher[d00m] |
12:28 | | You're now known as TheWatcher |
12:49 | | GeekSoldier|work is now known as GeekSoldier |
12:51 | | Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout] |
12:52 | | Attilla [~The.Attil@194.72.70.ns-11849] has joined #code |
13:02 | | AnnoDomini [AnnoDomini@83.21.70.ns-3684] has quit [Ping Timeout] |
13:09 | | AnnoDomini [AnnoDomini@83.21.7.ns-21068] has joined #Code |
13:09 | | mode/#code [+o AnnoDomini] by ChanServ |
13:43 | | C_tiger [~c_wyz@96.232.26.ns-11798] has quit [Ping Timeout] |
13:52 | | C_tiger [~c_wyz@96.232.26.ns-11798] has joined #code |
14:29 | | You're now known as TheWatcher[afk] |
15:51 | | Vornicus [~vorn@Admin.Nightstar.Net] has joined #code |
15:51 | | mode/#code [+o Vornicus] by ChanServ |
16:09 | | Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout] |
16:11 | | Attilla [~The.Attil@194.72.70.ns-11849] has joined #code |
16:54 | | GeekSoldier [~Rob@Nightstar-9088.dip.t-dialin.net] has quit [Ping Timeout] |
17:00 | | * AnnoDomini gets through basic file I/O in C++. Now to devise more advanced things, such as modifying tetx file content in specific ways. |
17:08 | <@ToxicFrog> | Text processing in C++ is made of ;.; |
17:11 | <@gnolam> | It's made of spiders? |
17:14 | <@ToxicFrog> | Yes. |
17:18 | | * AnnoDomini ponders replicating mIRC text handling functions, which he is already familiar with. |
17:19 | | * gnolam slaps AnnoDomini. |
17:20 | <@gnolam> | But in general, just stay clear of C++'s iostreams and use C's file I/O instead. |
17:22 | <@AnnoDomini> | What, that madness? |
17:22 | <@AnnoDomini> | No, thanks. I'd rather use something which I can understand how to use. |
17:23 | <@gnolam> | You actually... /prefer/ C++'s godawful stream interface? :o |
17:25 | <@AnnoDomini> | Yes. It works for me. |
17:28 | <@ToxicFrog> | |
17:29 | <@gnolam> | You are dead to me. |
17:33 | <@AnnoDomini> | Maybe you should present a reasoned argument on why you think one thing is better than another, rather than go "do this, because I say so" - it just encourages me to reciprocate with an analogous pattern of thought. |
17:35 | <@ToxicFrog> | C++ iostreams afford you very little control. For simple things they Just Work. For anything that isn't completely trivial, though, there's at best a lot of hoop jumping and at worst you end up re-implementing C's io interface anyways. |
17:36 | <@AnnoDomini> | But I actually do only need the simple things, and don't think I'll need more complex things for a long while yet. By that time, I'll probably have worked out how this whole language works a bit more. |
18:08 | | You're now known as TheWatcher |
18:14 | | GeekSoldier [~Rob@Nightstar-10414.dip.t-dialin.net] has joined #code |
18:44 | | GeekSoldier is now known as GeekSoldier|pub |
19:37 | | ChalcyZzz is now known as Chalcedon |
19:49 | | GeekSoldier|pub [~Rob@Nightstar-10414.dip.t-dialin.net] has quit [Ping Timeout] |
20:32 | <@Vornicus> | Okay. Using integer star locations gets me: 1. a guarantee that I will always get a valid location the first time, if such a location exists; 2. a guarantee that if no location exists, I know immediately. |
21:26 | <@Vornicus> | On the other hand, it makes movement calculations harder. |
21:43 | <@Vornicus> | A lot harder. |
21:44 | <@jerith> | How so? |
21:46 | <@Vornicus> | ...well, okay, it doesn't really make /movement/ calculations harder, but one thing it does make me do is keep lists of points within a certain distance of each star while I'm doing the generation. |
21:47 | <@Vornicus> | Which is liquid pain because I have to hand-write circle blitting algorithms. |
21:48 | <@Vornicus> | Which I used to know how to do, but I can't remember how any more. |
22:24 | | AnnoDomini [AnnoDomini@83.21.7.ns-21068] has quit [Quit: Violence is not the answer. Violence is the question. The answer is "YES!"] |
22:43 | | * gnolam hugs Maxima. |
23:43 | <@McMartin> | Can't you just recompute the distance on the fly? |
23:43 | <@Vornicus> | It's... how do I put this. |
23:43 | <@McMartin> | That's like two mults and a subtraction, right? |
23:44 | <@Vornicus> | The reason using integer star locations does the valid location thing first time is because I can actually maintain a list of all the valid locations for stars. |
23:44 | <@McMartin> | Aha |
23:45 | | You're now known as TheWatcher[t-2] |
23:45 | <@Vornicus> | Using floating point, it takes an average of about 20-30 attempts per star to find a valid location, using uniform distribution. |
23:46 | <@Vornicus> | And if I ever get trapped in a situation where I can't actually place any more stars, i can't actually tell. |
23:48 | <@Vornicus> | Whereas when I run out of locations in the integer model, I /know/ because there's /no locations/. |
23:48 | | You're now known as TheWatcher[zZzZ] |
23:51 | <@McMartin> | Right |
23:51 | <@McMartin> | I meant, "why do you need a circle blitter to do this integrally" |
23:52 | <@Vornicus> | I need the circle blitter because what the circle blitter does is it tells me all the positions within a certain distance of the star. |
23:54 | <@Vornicus> | Which is what i need - locations aren't valid if they're within 0.75 pc (7.5 units) of another star, for instance, or has less than two or more than five stars within 3.0 pc (30 units). |
--- Log closed Fri Feb 29 00:00:35 2008 |
--- Log opened Thu Feb 28 15:05:33 2008 |
15:05 | | TheWatcher [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
15:05 | | Irssi: #code: Total of 7 nicks [2 ops, 0 halfops, 0 voices, 5 normal] |
15:05 | | mode/#code [+o TheWatcher] by ChanServ |
15:06 | | Irssi: Join to #code was synced in 46 secs |
--- Log closed Fri Feb 29 08:58:00 2008 |
--- Log opened Thu Feb 28 15:13:12 2008 |
15:13 | | TheWatcher [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
15:13 | | Irssi: #code: Total of 7 nicks [2 ops, 0 halfops, 0 voices, 5 normal] |
15:13 | | mode/#code [+o TheWatcher] by ChanServ |
15:13 | | Irssi: Join to #code was synced in 46 secs |
--- Log closed Fri Feb 29 09:05:00 2008 |