--- Log opened Sat Apr 10 00:00:23 2010 |
--- Day changed Sat Apr 10 2010 |
00:00 | < Namegduf> | I find that switch in C tends to smell. |
00:00 | <@McMartin> | Yeah, it's a secret computed goto |
00:00 | < Namegduf> | I was thinking more that people use massively long switches where a lookup table would be better. |
00:01 | | * TheWatcher notes that in his C course, there is a button to go to a section on Goto. Clicking on it diesn't actually do anything. |
00:01 | <@Derakon> | Anyone know of other languages that support negative array indices like Python does? Where -1 means "last element", -2 means "second to last element", etc. |
00:01 | < Namegduf> | Haha. |
00:01 | <@McMartin> | Oh god |
00:01 | < Namegduf> | Hmm. |
00:01 | <@Derakon> | TW: har. |
00:01 | <@TheWatcher> | *doesn't |
00:01 | < Namegduf> | TheWatcher: For some reason, the raptors are having trouble reaching you. |
00:01 | <@McMartin> | UQM did that in C, to mean "smash the stack and read the field before you" |
00:01 | <@McMartin> | We refactored that away, oh yes |
00:01 | <@Derakon> | Namegduf: come to think, I tend to use maps of * to functions in Python, which doesn't have switch statements. |
00:02 | <@McMartin> | A map of * to function is a virtual method call~ |
00:02 | <@TheWatcher> | Namegduf: I might actually email Randall and ask if I can put that strip in the course >.> |
00:02 | <@Derakon> | McM: well, yes, clearly C will let you use any kind of index you like. |
00:02 | <@Derakon> | I meant specifically recognizing a negative array index and counting from the end. |
00:02 | <@McMartin> | Yeah |
00:02 | <@McMartin> | I just had flashbacks~ |
00:02 | < Namegduf> | Perl. |
00:02 | | * Namegduf checked, because his memory was vague. |
00:03 | <@Derakon> | I just tried a negative array index in Perl and it gave me nuttin'. |
00:04 | <@Derakon> | Also, McM: I meant more like "valueToFuncMap = {0: handleZero, 1: handleOne, 2: handleTwo, etc.}; valueToFuncMap[someValue]()" |
00:04 | < Namegduf> | http://www.perl.com/doc/FMTEYEWTK/style/slide16.html |
00:04 | <@McMartin> | Derakon: Yeah. That's for all practical purposes what a virtual function call looks like under the hood |
00:04 | <@Derakon> | As opposed to "if someValue == 0: handleZero(); elif someValue == 1: handleOne; etc." |
00:04 | <@Derakon> | Ah. |
00:05 | <@Derakon> | Namegduf: ahh, my test case must've been invalid. |
00:05 | <@Derakon> | I was trying to use a hacked-together fake REPL. |
00:05 | < Namegduf> | Ah. |
00:05 | <@Derakon> | Hmm...no, still doesn't work. |
00:05 | <@Derakon> | Try running this: "$foo = [1, 2, 3]; print $foo[-1] . "\n";" |
00:06 | < Namegduf> | Weird. |
00:06 | | * TheWatcher notes that that slide doesn't make it explicit, but any negative should work: perl -e '@vals = (1, 2, 3, 4, 5); print $vals[-2];' = 4 |
00:06 | <@Derakon> | ...d'oh. |
00:06 | <@Derakon> | @ for arrays, $ for scalars. |
00:06 | < Namegduf> | Oh, right. |
00:06 | <@TheWatcher> | foo is an arrayref, try print $foo -> [-1]; |
00:06 | <@Derakon> | So now I get "ARRAY(0x800174)". |
00:07 | <@Derakon> | ...oh, wait, arrays in Perl use (), not []. |
00:07 | <@Derakon> | Arrayref style works, as does proper parens. |
00:07 | <@Derakon> | Man, I'm rusty with Perl. |
00:07 | < Namegduf> | I've mostly forgotten it. |
00:07 | <@Derakon> | It's been a couple years now since I worked in it heavily. |
00:08 | < Namegduf> | I try to avoid it, because I've decided that it's kind of disgusting. |
00:08 | < Namegduf> | CPAN brings me back, though. |
00:08 | <@TheWatcher> | Bah |
00:08 | <@Derakon> | Heh. |
00:08 | <@Derakon> | You can make disgusting code in Perl. Doesn't mean you have to. |
00:08 | <@TheWatcher> | It's only as disgusting as you write it to be. |
00:08 | <@Derakon> | You can make disgusting code in Python, too, as I know all too well. It's just a bit harder. |
00:09 | < Namegduf> | I'm sorry, I just can't accept zero but true. |
00:10 | < Namegduf> | I mean, it being a theoretical possibility caused by bad interaction of features is one thing. |
00:10 | < Namegduf> | But people using it... |
00:10 | | * Derakon heads off |
00:10 | | Derakon [Derakon@Nightstar-1ffd02e6.ucsf.edu] has quit [[NS] Quit: Leaving] |
00:10 | < Namegduf> | It's okay, I dislike most automatic-cast-between-string-and-number languages. |
00:11 | < Namegduf> | Well, string-to-number. |
00:11 | < Namegduf> | Number to string is safe and east. |
00:14 | | You're now known as TheWatcher[T-2] |
00:15 | < Namegduf> | Maybe my statement was a bit extreme, it's not that bad. I just prefer, say, Python. :P |
00:18 | | You're now known as TheWatcher[zZzZ] |
00:46 | | Zed_ [Zed@Nightstar-d7ade99d.or.comcast.net] has joined #code |
00:49 | | Derakon[AFK] is now known as Derakon |
00:55 | | Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has joined #code |
00:59 | | ryan [revfitz@Nightstar-23a13631.scrm01.sbcglobal.net] has joined #code |
01:03 | < ryan> | having trouble dealing with syntactic and scope issues in making an array of function pointers |
01:03 | < ryan> | http://pastebin.starforge.co.uk/249 |
01:03 | < ryan> | this doesn't compile because you can't use the {{}} syntax after an array's already been declared, but I have absolutely no idea how else to do this |
01:05 | < ryan> | the idea, if it's not clear, is that later on I can write (*table[2][3])("") or whatever to call a particular function instead of having to use a ton of switch statements |
01:05 | < celticminstrel> | Are you using GCC? |
01:05 | < ryan> | uh I guess table probably isn't the best name for that in retrospect, but that's kind of beside the point |
01:05 | < ryan> | yeah |
01:06 | < celticminstrel> | And what's the type of table? |
01:06 | < celticminstrel> | (By the way, table[2][3]("") would be sufficient.) |
01:06 | < ryan> | the type of table is an array of funcPtr |
01:06 | < celticminstrel> | 2D array? |
01:06 | < ryan> | which is a member function pointer to a member of RPNConverter |
01:06 | < ryan> | yeah |
01:06 | < celticminstrel> | So... |
01:06 | < celticminstrel> | dimensions? |
01:07 | < ryan> | I'm not sure I follow? are the dimensions backwards? |
01:07 | < celticminstrel> | Show me the declaration. |
01:07 | < ryan> | it's in the .h part there |
01:08 | < celticminstrel> | Ah, I see it now. Sorry. |
01:08 | < ryan> | np |
01:08 | < celticminstrel> | Okay, first, does "funcPtr[6][8] table;" actually compile ? o_O |
01:09 | < ryan> | uh, it might not, come to think of it, one second |
01:09 | < celticminstrel> | Because that's a Java-style array declaration, not a C-style array declaration. |
01:09 | < ryan> | ha ha |
01:09 | < ryan> | well that would make sense |
01:09 | < ryan> | what should it look like? |
01:09 | < celticminstrel> | funcPtr table[6][8]; |
01:09 | < ryan> | oh ok |
01:09 | < celticminstrel> | Which Java also allows, incidentally. |
01:09 | < celticminstrel> | So, the type of table is, I think, funcPtr[6][8]. |
01:10 | < ryan> | yeah that sounds right |
01:10 | < celticminstrel> | Do you need your code to compile under compilers other than GCC? |
01:10 | < ryan> | no |
01:10 | < ryan> | is there a flag to allow the curly braces or something? |
01:10 | < ryan> | and if so, what is even the point of prohibiting that? |
01:10 | < ryan> | actually, just in general, what is the point of prohibiting that? |
01:11 | < ryan> | I have never understood the issue there |
01:11 | < celticminstrel> | No way to determine the type. |
01:11 | <@McMartin> | "allow the curly braces"? |
01:11 | < ryan> | yeah, that is my retardo way of saying |
01:11 | <@Vornicus> | arg how do I let jerith do this to me |
01:11 | < celticminstrel> | I dunno if this'll work, but GCC has an extension that allows curly braces if you precede them by an explicit cast. It works for struct types. I have never tried it for arrays. |
01:11 | < ryan> | that the syntax to assign every value at once is restricted to declarations |
01:11 | < ryan> | hmm |
01:11 | < ryan> | so like |
01:11 | < celticminstrel> | So, try "table = (funcPtr[6][8]) {{ ...." |
01:11 | < ryan> | table - |
01:11 | < ryan> | yeah that |
01:11 | < ryan> | I'll see if it compiles, thanks |
01:12 | < celticminstrel> | As I said, I haven't tried this with arrays before. |
01:12 | < ryan> | oh uh forgot to ask how to turn it on |
01:12 | < celticminstrel> | In my experience it's on by default, so I couldn't help you there... |
01:12 | < ryan> | oh OK, sorry |
01:13 | < ryan> | oh, that actually seems like it works |
01:13 | < ryan> | except that now I am getting a ton of scope errors |
01:13 | < ryan> | it wants &RPNConverter:: in all the table entries |
01:13 | < ryan> | which I really don't want to do :( |
01:14 | < ryan> | e.g. RPNConverter.cpp:15: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say '&RPNConverter::s2' |
01:14 | < celticminstrel> | Yeah, pretty sure there's no way around that. |
01:14 | < celticminstrel> | BUT |
01:14 | < gnolam> | The first rule of C++ function pointers is you do not use C++ function pointers. |
01:15 | < celticminstrel> | Probably that's not actually what you want. |
01:15 | <@McMartin> | virtual functions exist for the express purpose of never needing to explicitly use function pointers ever again. |
01:15 | < celticminstrel> | Each RPNConverter has its own table, so &this->s2 is probably what you want. |
01:15 | < celticminstrel> | (I won't deny there might be a better way to do this though.) |
01:16 | < celticminstrel> | Though actually, that probably would not be allowed either, because the function exists only once. |
01:17 | < ryan> | if making it static or something would help, that would be fine |
01:17 | < ryan> | or even putting it outside the class and just letting the class use it |
01:17 | < ryan> | I really don't care, it will never change or anything |
01:18 | < ryan> | at this point the effort expended on this is rapidly approaching the effort it would take to just make a horrible labyrinth of switches, so I guess I could just do that, but this would be so cool if I could make it work right :( |
01:18 | < celticminstrel> | Yeah, static is probably better. |
01:19 | < celticminstrel> | And then you might not need the RPNConverter:: bit. |
01:19 | < ryan> | I think I had it static before, and changed it because I was hoping that putting it inside a class function would avoid having to add the scope identifier? |
01:19 | < ryan> | but obvs it wasn't compiling for other reasons so I'll see if that helps now |
01:20 | < celticminstrel> | Of course, if it's static, you probably want to initialize it statically, which means you don't actually need the GCC extension mentioned... |
01:25 | < ryan> | oh god everything is horrible |
01:25 | < ryan> | but at the very least, making it static didn't help the scoping issue |
01:26 | < ryan> | so I guess I'm screwed. |
01:26 | < celticminstrel> | Lemme see? |
01:28 | | Attilla [Attilla@FBC920.482E2D.971EED.6317D6] has quit [Client closed the connection] |
01:28 | < ryan> | oh ok, I fixed everything except the scope issue. it was doing some weird stuff related to the strings being passed by reference. for some reason I couldn't say typedef void (RPNConverter::*funcPtr)(std::string); |
01:28 | < ryan> | uh |
01:28 | < ryan> | with a & in front of std::string |
01:28 | < ryan> | so I just made the functions pass by value for now, even though that's kind of awful |
01:28 | < celticminstrel> | Repeat that typedef? |
01:29 | < ryan> | well, it complained (rightly) when I had the typedef as written on the pastebin, because the methods were taking &string arguments |
01:29 | < ryan> | but when I changed the typedef to typedef void (RPNConverter::*funcPtr)(&std::string); |
01:29 | < ryan> | it said |
01:29 | < celticminstrel> | There you go, you need the & after the string. |
01:29 | < ryan> | oh god |
01:29 | < ryan> | fucking c++ is going to be the death of me |
01:29 | < ryan> | I could have taken this class in java too |
01:30 | < ryan> | thank you |
01:30 | < celticminstrel> | Java doesn't have function pointers. <_< |
01:30 | < ryan> | yeah, then I wouldn't be tempted |
01:30 | < celticminstrel> | Hehe. |
01:30 | < celticminstrel> | True |
01:30 | < ryan> | also if I had never used python I wouldn't have been like "man why doesn't c++ have first-class functions, that would be perfect for this problem" |
01:30 | < ryan> | and accidentally found out about function pointers |
01:31 | < ryan> | and then my life would be so much better right now |
01:31 | < celticminstrel> | Functors. |
01:31 | <@McMartin> | A dangerous word |
01:31 | < ryan> | yeah, nobody had ever told me about any of this though |
01:32 | < ryan> | for what are now obvious reasons |
01:32 | < ryan> | because they're awful |
01:32 | < celticminstrel> | Which is the dangerous word? |
01:32 | <@McMartin> | "functor" |
01:32 | < ryan> | functors I'm guessing |
01:32 | <@McMartin> | Has many, many definitions, and C++'s is not one of the usual ones. |
01:33 | <@McMartin> | That said, yes; a instance of a class that implements operator() is almost indistinguishable from a lambda expression embedded in an execution environment. |
01:33 | <@McMartin> | So it's strictly more powerful than Python's first-class functions, and co-equal with LISP or ML. |
01:33 | <@McMartin> | (Past a certain complexity which escapes me at the moment Python will insist you switch to a class that implements __call__.) |
01:34 | < ryan> | I think python's lambdas only allow an expression |
01:34 | < ryan> | not statements |
01:34 | < ryan> | unless I'm misunderstanding what you mean |
01:34 | < celticminstrel> | Yeah, but you can def anywhere. |
01:35 | <@McMartin> | It's defs that want to write to locals in their defining context that's where Python tells you to stop dicking around with LISPy things and Object Up. |
01:36 | < ryan> | just for fun, I'm going to %s// an &RPNConverter:: onto each of those table entries and see if that actually compiles |
01:36 | < ryan> | at that point it's so hideous that I'd be kind of embarrassed to do it though |
01:37 | < celticminstrel> | <_< #define R RPNConverter /* stuff */ #undef R |
01:37 | < ryan> | /turn it in |
01:37 | < ryan> | oh man |
01:37 | < ryan> | that is a pretty great idea actually |
01:37 | < celticminstrel> | ? |
01:37 | < celticminstrel> | Well, unless your teacher has told you to "never use #defines". |
01:38 | < ryan> | could I do something really stupid like uh |
01:38 | < ryan> | #define ` &RPNConverter:: |
01:38 | < ryan> | casting about for punctuation marks that don't mean anything here |
01:38 | < celticminstrel> | No, I'm pretty sure that would not work. |
01:38 | < celticminstrel> | You could try it, I suppose. |
01:40 | < ryan> | haha nope |
01:42 | < ryan> | #define R &RPNConverter:: |
01:42 | < ryan> | does though |
01:42 | < ryan> | looks kind of dumb but quite an improvement |
01:42 | < ryan> | and it even compiles now ! |
01:43 | < celticminstrel> | Yay! |
01:44 | | Zed_ [Zed@Nightstar-d7ade99d.or.comcast.net] has quit [Ping timeout: 121 seconds] |
01:55 | | gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?] |
02:05 | | Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Ping timeout: 121 seconds] |
02:17 | | Derakon is now known as Derakon[AFK] |
02:32 | | Orthia [orthianz@Nightstar-cb5ab605.xnet.co.nz] has joined #code |
03:00 | < Rhamphoryncus> | bluh my DNS is broken |
03:19 | < Serah> | There is only one solution! SALSA! |
03:19 | | * Serah dances. |
03:20 | < Rhamphoryncus> | heh |
03:20 | < Rhamphoryncus> | Can you tell me the IP of a public DNS server? I believe google runs some |
03:22 | <@Vornicus> | 8.8.8.8 and 8.8.4.4 |
03:22 | < Rhamphoryncus> | sounds familiar heh |
03:24 | < Rhamphoryncus> | Blah I hate debugging DNS. Anybody know how to get useful diagnostics? |
03:26 | < Rhamphoryncus> | oi. Apparently this version of gnome has no way to turn on a network connection :P |
03:26 | < Rhamphoryncus> | I can turn everything on or off, but not pick an option |
03:27 | < Rhamphoryncus> | There we go |
03:29 | < Rhamphoryncus> | Thanks, I have DNS again :) |
03:29 | < Rhamphoryncus> | 'course everybody else in the house might be broken. Not sure |
03:30 | < Rhamphoryncus> | Picking an option was apparently PEBKAC. Thought I tried left-clicking but apparently not |
04:02 | | GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #code |
04:13 | | * Reiver decides he is regretting not having done more math. |
04:19 | | Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code |
04:19 | | mode/#code [+o Kazriko] by Reiver |
04:39 | | celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!] |
05:35 | | Zed_ [Zed@Nightstar-d7ade99d.or.comcast.net] has joined #code |
05:56 | | Serah [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds] |
06:14 | | Serah [Z@5E691D.FC7C16.9F8D82.CBBA6F] has joined #code |
06:15 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving] |
06:16 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code |
06:16 | | mode/#code [+o Vornicus] by Reiver |
06:21 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code |
06:27 | < ryan> | I am having the weirdest issue with my linked list class for some reason |
06:27 | < ryan> | http://pastebin.starforge.co.uk/250 |
06:29 | < ryan> | hopefully it is self-explanatory but the effect is that it's returning true even though I can even confirm right at the if test that it should be returning false |
06:29 | < ryan> | and it looks like it's going through both lines somehow?? |
06:30 | | Serah [Z@5E691D.FC7C16.9F8D82.CBBA6F] has quit [Ping timeout: 121 seconds] |
06:46 | | Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code |
06:46 | | * jerith sads at being the cause of Vorn's woe. |
07:24 | | Derakon[AFK] is now known as Derakon |
07:24 | <@Vornicus> | Why do I let people do that to me? I know I can't build a game of that complexity. |
07:25 | <@jerith> | You can. You just can't do it in a day. |
07:26 | <@jerith> | It took four of us a week to build the first (crap) version of OFS. |
07:35 | <@Vornicus> | I just look at the list of things I have to be able to do in order to get /any/ of this working and there's a dozen of them on here that I haven't an inkling about. |
07:36 | <~Reiver> what's this? |
07:37 | <@Vornicus> | "Hallow", a territory-control game based on a thought Half had. |
07:38 | <@Vornicus> | Essentially you get gas emitters and so does the enemy, and when the gases meet they react violently with each other. |
07:38 | <@Vornicus> | And then other stuff happens too but there it got complicated. |
07:41 | <@Vornicus> | It's called Hallow mostly because it's actually altars and "sacred ground" |
07:41 | <~Reiver> Ah, I see |
07:49 | <@Vornicus> | But then the creature feeped. |
07:51 | | Derakon is now known as Derakon[AFK] |
08:14 | | Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds] |
08:16 | <@Vornicus> | But I mean, why can't i ever seem to come up with /one/ mechanic for a game. |
08:17 | <@Vornicus> | it's always like half a dozen. |
08:25 | | * Vornicus grahs at bedtime. |
08:27 | | Vornicus is now known as Vornicus-Latens |
08:58 | | ryan [revfitz@Nightstar-23a13631.scrm01.sbcglobal.net] has quit [[NS] Quit: leaving] |
08:59 | | Orth [orthianz@Nightstar-3a382877.xnet.co.nz] has joined #code |
09:01 | | Orthia [orthianz@Nightstar-cb5ab605.xnet.co.nz] has quit [Ping timeout: 121 seconds] |
09:59 | | You're now known as TheWatcher |
10:59 | | Tarinaky [Tarinaky@Nightstar-83f5e5c6.adsl.virginmedia.net] has joined #code |
11:35 | | gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code |
12:14 | < Namegduf> | http://www.nubuilder.com/nubuilderwww/ <-- This is like a framework for the kind of horrible system you see on TDWTF. |
12:16 | < Namegduf> | It's horrifying, because it looks dumbed down enough that I can imagine someone using it. |
13:28 | <@TheWatcher> | The forums seem a positive hive, a hive I tell you, of frenzied activity certainly... |
14:13 | | celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code |
14:14 | | Attilla [Attilla@FBC920.482E2D.971EED.6317D6] has joined #code |
14:14 | | mode/#code [+o Attilla] by Reiver |
14:25 | | Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code |
14:31 | | hobbitprog [hobbit@Nightstar-c7528f30.ok.cox.net] has joined #code |
16:00 | | Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds] |
16:18 | | Orth [orthianz@Nightstar-3a382877.xnet.co.nz] has quit [Connection reset by peer] |
16:21 | | Orthia [orthianz@Nightstar-4d7f48c6.xnet.co.nz] has joined #code |
16:36 | | hobbitprog [hobbit@Nightstar-c7528f30.ok.cox.net] has quit [Connection closed] |
16:53 | | Vornicus-Latens is now known as Vornicus |
17:36 | < celticminstrel> | optparse is all very nice-looking, but it's too constraining. |
17:41 | | cpux is now known as shade_of_cpux |
17:47 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code |
17:56 | | GeekSoldier_ [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #code |
17:58 | | GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Ping timeout: 121 seconds] |
18:12 | | Derakon[AFK] is now known as Derakon |
18:20 | <@Derakon> | Celticminstrel: constraining how? |
18:20 | < celticminstrel> | Doesn't support non-conventional options. |
18:20 | <@Derakon> | Give an example? |
18:21 | < celticminstrel> | An option beginning with + |
18:21 | < celticminstrel> | instead of - |
18:21 | <@Derakon> | Ah. |
18:21 | | * Derakon tries to think of programs he knows that use that scheme. |
18:21 | <@Derakon> | I think ImageMagick's convert has a few options that work that way? |
18:22 | < celticminstrel> | I'm using it because there are pairs of options that are opposite. |
18:22 | < Namegduf> | celticminstrel: That's because, largely, consistency in how UNIX-like OS programs accept parameters is considered a good thing. |
18:22 | < celticminstrel> | One +, one - |
18:22 | <@Derakon> | Hm. What are these options doing? |
18:22 | < Namegduf> | So making up your own arbitrary stuff is considered bad. |
18:22 | < celticminstrel> | Add/remove something. |
18:22 | < Namegduf> | --enable-foo, --disable-foo or --foo, --disable-foo are a common convention. |
18:23 | <@Derakon> | Yeah. |
18:23 | < celticminstrel> | It's not that bad to make up your own arbitrary stuff, as long as you document it. |
18:23 | <@Derakon> | And generally one is considered the default and doesn't usually need to be specified. |
18:23 | < Namegduf> | It really is that bad. |
18:23 | < celticminstrel> | Not here. |
18:23 | <@Derakon> | It's still violating the principle of least surprise. |
18:23 | <@Derakon> | How can you have a boolean setup where neither state is the default? |
18:24 | < Namegduf> | There's dozens of programs on the average Linux system taking things in the -f, --foo manner and associated conventions. |
18:24 | < Namegduf> | Having to learn conventions per program would be hellish. |
18:24 | < celticminstrel> | Not boolean. Add/remove. |
18:24 | < celticminstrel> | Completely different. |
18:24 | < celticminstrel> | Some of them take arguments. |
18:24 | <@Derakon> | I have a set A. I wish to add X to A. That implies that A does not currently have X. |
18:25 | <@Derakon> | Alternately, I have a set A. I wish to remove X from A. That implies that X is currently in A. |
18:25 | < celticminstrel> | ? |
18:25 | <@Derakon> | I think we're gonna need a more detailed example of what your use case is. |
18:25 | < Namegduf> | What Derakon is saying is that unless you can have multiple examples of each item, add/remove is altering a boolean. |
18:26 | < Namegduf> | (i.e. unless the set analogy doesn't work) |
18:31 | < celticminstrel> | s.pop() <=> s.pop(0), right? |
18:32 | <@Derakon> | Um, language? |
18:32 | < celticminstrel> | Python. |
18:32 | <@Derakon> | No. |
18:32 | <@Derakon> | foo.pop() removes the last element. |
18:32 | <@Derakon> | foo.pop(0) removes the first element. |
18:32 | < celticminstrel> | Oh, okay. |
18:33 | < celticminstrel> | Good thing I asked. |
18:33 | <@Derakon> | You know how I know this? |
18:33 | <@Derakon> | % python |
18:33 | <@Derakon> | > foo = range(10) |
18:33 | <@Derakon> | > foo.pop() |
18:33 | <@Derakon> | 9 |
18:33 | <@Derakon> | > foo.pop(0) |
18:33 | <@Derakon> | 0 |
18:33 | < celticminstrel> | <_< |
18:34 | <@Derakon> | Python's REPL is very useful for answering simple questions like this. |
18:34 | < celticminstrel> | REPL? |
18:34 | <@Derakon> | Read-evaluate-print loop. |
18:34 | <@Derakon> | Basically what you get when you run 'python' on the command line with no arguments. |
18:34 | < celticminstrel> | I'd call that CLI... |
18:34 | <@Derakon> | It reads input, executes the input as code when you hit enter, and then prints the result. |
18:35 | < celticminstrel> | Or something. |
18:35 | <@Derakon> | They're similar in concept, yes. |
18:35 | <@Vornicus> | foo.pop() is equivalent to foo.pop(-1) |
18:35 | <@Derakon> | But commandlines are usually used when interacting with multiple programs. |
18:35 | <@Derakon> | The REPL is inside a single program that doesn't interact with others much, if at all. |
18:36 | | * Derakon ducks out for a bit. |
18:36 | < celticminstrel> | Ah yes, the difference between a shell and an interpreter. |
18:36 | | Derakon is now known as Derakon[AFK] |
18:39 | <@ToxicFrog> | I would say that the python(1) REPL is the command line interface to python. |
18:39 | <@ToxicFrog> | Something doesn't have to be a shell to be a CLI. |
18:39 | <@ToxicFrog> | (that said, the use of "the CLI" without qualifiers is generally taken to mean "the shell") |
18:39 | < Namegduf> | Saying that it's Python's CLI or a "a CLI" is meaningful, just "CLI" on its own is about as meaningful as "GUI". |
18:52 | | Derakon[AFK] is now known as Derakon |
18:53 | <@Derakon> | Anyway, REPL is more specific. |
19:47 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Client closed the connection] |
19:49 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code |
20:02 | | Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Client closed the connection] |
20:25 | | Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has quit [Client exited] |
20:29 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Client closed the connection] |
20:30 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code |
20:49 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Client closed the connection] |
20:51 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code |
21:08 | | Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds] |
21:56 | | Serah [Z@2C3C9C.B2A300.F245DE.859909] has joined #code |
22:59 | | AnnoDomini [annodomini@Nightstar-e6fd50b5.adsl.tpnet.pl] has joined #code |
22:59 | | mode/#code [+o AnnoDomini] by Reiver |
--- Log closed Sun Apr 11 00:00:53 2010 |