--- Log opened Wed Apr 09 00:00:21 2014 |
00:07 | | Turaiel[Offline] is now known as Turaiel |
00:46 | <@celticminstrel> | I wonder if it's safe to never call runModalSession. It seems to work without it. |
00:50 | <@celticminstrel> | Maybe it's for when the window contains controls that are managed by the operating system, or something. |
00:53 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has quit [Ping timeout: 121 seconds] |
00:54 | | Orthia [orthianz@Nightstar-3tp.juj.184.203.IP] has joined #code |
00:54 | | mode/#code [+o Orthia] by ChanServ |
01:06 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
01:14 | | Kindamoody[zZz] is now known as Kindamoody |
01:19 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
01:19 | | mode/#code [+o himi] by ChanServ |
01:43 | <&ToxicFrog> | Ok, new python question. |
01:44 | <&ToxicFrog> | There's this new string.format that can take {key}s. |
01:44 | <&ToxicFrog> | However, it wants kwargs, rather a dict, for some godforsaken reason. |
01:44 | <&ToxicFrog> | So you can't just pass it something dict-like that creates the values on-demand using __getitem__, because those items don't exist when the function is actually called. |
01:44 | <&ToxicFrog> | Is there any way around this? |
01:48 | <&ToxicFrog> | I swear every single python builtin library or language feature has some incredibly infuriating flaw. |
01:56 | | Thalass [thalass@Nightstar-90oetb.bigpond.net.au] has joined #code |
01:56 | | mode/#code [+o Thalass] by ChanServ |
01:59 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
02:11 | <@RchrdB> | ToxicFrog, I can not believe how much hatred you have for Python for someone who hasn't mentioned packaging (setuptools, distribute, virtualenv, zc.buildoutâ¦) even once yet. |
02:11 | <@RchrdB> | Not that I don't think your complaints now are legitimate, I just think that they'll all vanish into insignificance if you ever have to interact with the packaging in any meaningful way. |
02:12 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
02:12 | | mode/#code [+o himi] by ChanServ |
02:13 | <@RchrdB> | ToxicFrog, anyway. If f() wants kwargs and you have a dict x, then f(**x) splats x into kwargs and that's fine. I don't offhand know what subset of dict methods a class needs to implement in order to be splattable. |
02:13 | <&ToxicFrog> | RchrdB: thankfully, for small programs I just use python's run-from-zip for packaging, and for large programs I'm writing them at work and our build environment handles all of that for me |
02:13 | <&ToxicFrog> | Although I have found run-from-zip kind of flaky, in that it works with zips created with 'zip' but not created by 'git archive' |
02:14 | <&ToxicFrog> | RchrdB: so, the problem with that is that the splatting happens at call time |
02:14 | <@RchrdB> | I prefer instead of str.format() to use good old fashioned "%s, %s." % ("Hello", "world"), which isn't what you want because it's only positional. |
02:14 | <&ToxicFrog> | So, if x inherits dict, but x['foo'] doesn't actually exist until you request it (because it's generated on the fly by __getitem__), f(**x) does not pass in a keyword argument foo. |
02:15 | <&ToxicFrog> | And the kwargs object that f gets is not x, but something else containing (ostensibly) the same contents. |
02:15 | <@RchrdB> | However, "%(greeting)s, %(noun)s." % {'greeting': "Hello", 'noun': "world"} # *is* a thing and will very happily accept anything that has a __getitem__ on the RHS of the % operator. |
02:16 | <@RchrdB> | ToxicFrog, according to http://stackoverflow.com/questions/11890066/making-custom-containers-work-with-k wargs-how-does-python-expand-the-args - you want to avoid inheriting from dict. :( |
02:16 | <&ToxicFrog> | Part of the reason I want to use .format here is that the format string is coming from the user and {foo} is generally more readable and harder to fuck up than %-style format strings. |
02:16 | <@RchrdB> | Because various parts of Python's C runtime go, "oh look, it's a dict!", skip your __getitem__() and just reach directly into the superclass's shit. |
02:16 | <&ToxicFrog> | Yeah, that's not actually the problem here |
02:16 | <&ToxicFrog> | "When creating a keyword argument dictionary, the behavior is the same as passing your object into the dict() initializer" |
02:17 | <&ToxicFrog> | Problem here is that those keys don't exist yet, and I don't know if they need to exist or even WHAT THEY ARE until they are requested. |
02:18 | <&ToxicFrog> | So I can't just override the appropriate accessors, because they would need to be called during the actual string formatting phase. |
02:18 | <&ToxicFrog> | ...although there may be a way around that. |
02:18 | <@RchrdB> | Indeed. You are fundamentally boned by the fact that .format() takes kwargs. |
02:18 | <@RchrdB> | That's just a total loss for you. |
02:19 | <&ToxicFrog> | Why in god's name would they do it that way? Why not just let the user pass in a dict? |
02:20 | <&ToxicFrog> | I mean, in theory, duck typing is meant to be How You Do Shit in python |
02:20 | <@RchrdB> | kwargs is baked into the language and can only work with sets of keys that are fully known before the invoked function is entered. |
02:20 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
02:20 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
02:20 | <@RchrdB> | ToxicFrog, I have -no clue- why. |
02:20 | <@RchrdB> | What format are you templating anyway? |
02:21 | <@RchrdB> | What's your output format meant to be? |
02:21 | <@RchrdB> | Plain text? HTML? ASN.1 DER? |
02:23 | <&ToxicFrog> | Filenames. |
02:23 | <&ToxicFrog> | This is for my music organizer. |
02:24 | <@RchrdB> | The format string on the LHS is user-input too in that case, isn't it? |
02:24 | <&ToxicFrog> | E.g. {library}/{genre}/{category}/{group}/{album}/{disc}{track} - {title}.{ext} |
02:24 | <&ToxicFrog> | Yes, I said that earlier. |
02:25 | <@RchrdB> | I forget things. |
02:25 | <@RchrdB> | I think that in your shoes I would do something mildly but not *heinously* lame, lex the LHS string from a format of your choosing, and compute a sprintf'able string. |
02:26 | <&ToxicFrog> | Yeah, I'm kind of considering that :/ |
02:26 | <&ToxicFrog> | Shame python's regex lib doesn't have the %b extension. |
02:26 | <@RchrdB> | Do you mean \b for word boundaries? |
02:27 | <&ToxicFrog> | No, it's an extension lua has - %b{} matches balanced braces, etc |
02:27 | <&ToxicFrog> | Its pattern matcher is deficient in other frustrating ways, but %b specifically makes lexing stuff like this completely trivial |
02:28 | <@macdjord> | ToxicFrog: Might be that format() is implemented in C or something? |
02:28 | <@RchrdB> | macdjord, pretty much. Actually, before that. The problem is that the ** splat operator for supplying keyword arguments from a dictionary is implemented in C. |
02:28 | <&ToxicFrog> | macdjord: the problem is not what format() is implemented in, but how the **kwargs calling convention works in python. |
02:29 | <&ToxicFrog> | This would have the same problem is format() was written entirely in python. |
02:29 | <&ToxicFrog> | RchrdB: it's not that either. |
02:29 | <&ToxicFrog> | It's that all of the keyword arguments are computed at call time and what the callee is passed is a dict based on the original **kwargs. |
02:29 | <&ToxicFrog> | Rather than the original kwargs object or a proxy for it. |
02:29 | <@macdjord> | ToxicFrog: I meant 'maybe that;s why they used **kwargs instead of taking a dict'. |
02:30 | <@RchrdB> | ToxicFrog, I generally like to reach for "re" for any format that input.split(" ",1) won't parse accurately and parser combinators for any format that POSIX regular expressions won't parse, but YMMV. |
02:31 | <&ToxicFrog> | RchrdB: the thing is, 'balanced foo' is not regular (and BREs, EREs, or I'm pretty sure PCREs can't handle it) |
02:32 | <@RchrdB> | Yes. "Balanced ()" causes me to overflow to parser combinators. |
02:32 | <&ToxicFrog> | But "I have a string containing a bunch of fields denoted with balanced brackets and I only care about those" is really really common |
02:32 | <@macdjord> | ToxicFrog: Can you just identify the keywords in the format string, process them ahead of time, and pass in the resulting dict? |
02:32 | <&ToxicFrog> | And having the %b extension is thus really damn convenient. |
02:32 | <&ToxicFrog> | macdjord: yes, that's what I'm working on how. |
02:32 | <&ToxicFrog> | I was hoping that I wouldn't have to. |
02:33 | <@macdjord> | You're right, there's no reason **kwargs shouldn't take any dict-like thing and allow it to supply values on demand. |
02:34 | <@RchrdB> | â¦unless it turns out that someone measured and decided that making **kwargs inflexible sped up the interpreter enough to be worth it. |
02:35 | <&ToxicFrog> | RchrdB: I think it unlikely that creating a complete copy of the kwargs object on every call is cheaper than passing a reference to it |
02:38 | <@RchrdB> | The copy is elided in the common case that the kwargs object is a dict. |
02:39 | <~Vornicus> | edededededededededededededededededededededededededededededededededededededededed edededededededededededededededededededededededededededededed33333333333333333333 33333333333333333333333333333333333333333333333333 |
02:39 | <&ToxicFrog> | But in that case you would expect to get the original dict in the callee, and you don't. |
02:39 | <&ToxicFrog> | Or did you mean only in the case that type(kwargs) is dict, not the case that kwargs is_a dict? |
02:39 | <&ToxicFrog> | Hi, Vorn's kitten. |
02:42 | <@RchrdB> | *checks* No, the kwargs dict *is* copied in the case that you splat the arguments to a function which takes kwargs. |
02:43 | <@RchrdB> | It might not be copied in the case: def foo(kw1, kw2, kw3):, foo(**{'kw1': 1, 'kw2': 2, 'kw3': 3}), and all the arguments get copied straight into local variable slots instead, but I'm not actually sure. |
02:43 | <@RchrdB> | ToxicFrog, and to answer the last question, from the SO answer it sounds like there's a sorta-accidental assumption that (type(x) is dict) just because (isinstance(x, dict)). |
02:44 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
02:45 | <@RchrdB> | Meh, I can't defend any aspect of CPython's VM's design. Most every aspect of its design is a fucking relic. |
02:57 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
02:57 | | mode/#code [+o himi] by ChanServ |
02:57 | <~Vornicus> | yeah, if you splat something into a thing where you'd be getting parameters you don't get a copy of the dictionary at all. |
02:57 | <~Vornicus> | Or, indeed, include named parameters and a splat. They're two different dictionaries. |
03:02 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
03:05 | | * Vornicus finally got the C# book from the library, three months after he put a hold on it. (it was damaged or something) |
03:15 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
03:15 | | mode/#code [+o himi] by ChanServ |
03:29 | <@macdjord> | ToxicFrog: Oh, wait. I /had/ forgotten the mutability issue. |
03:32 | | HotShot [theeaznon@Nightstar-6vf6q9.sfldmi.sbcglobal.net] has joined #code |
03:43 | | Thalass is now known as Thalass|afk |
03:47 | | Thalass|afk [thalass@Nightstar-90oetb.bigpond.net.au] has quit [Ping timeout: 121 seconds] |
03:55 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
04:09 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
04:09 | | mode/#code [+o himi] by ChanServ |
04:15 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
04:16 | <~Vornicus> | ...now I need a thing I want to do in C# |
04:17 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down] |
04:18 | <@macdjord> | Vornicus: How about Bach's Tocata and Fugue? |
04:18 | <~Vornicus> | um |
04:18 | <&McMartin> | Realm's Ransom map generator |
04:19 | <~Vornicus> | How is it that you have better memory of my old projects than I do |
04:20 | <&McMartin> | My command of useless trivia is profound but I try to bend it to socially useful purposes |
04:20 | <&McMartin> | Like "what has everyone been up to" as opposed to "ancient Mesopotamian shoe sizes" |
04:21 | <@macdjord> | McMartin: What /were/ the ancient Mesopotamian shoe sizes? |
04:21 | <&McMartin> | ... a joke on Animaniacs that was itself a super-extended Moonlighters reference |
04:21 | <&McMartin> | Actual data on this is swapped out other than that it was the one where Pinky and the Brain compete at Jeopardy |
04:29 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
04:29 | | mode/#code [+o himi] by ChanServ |
04:44 | <~Vornicus> | The worst bit is I'm actually vaguely close to finishing somethng and I don't want to abandon this thing |
04:44 | <~Vornicus> | but I only have the book for like 3-6 weeks |
04:54 | <&ToxicFrog> | Vornicus: KSP mod? |
04:55 | <~Vornicus> | I don't have ksp |
04:55 | <~Vornicus> | you're not giving me ksp, either, I would like to have a few hours a month when I don't think about orbital mechanics. |
04:56 | | * macdjord menaces Vorn with Keplerian motion |
04:57 | <~Vornicus> | nuuuu |
04:59 | | celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
05:03 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
05:16 | | * McMartin finds http://www.neocomputer.org/projects/et/ again |
05:16 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
05:16 | | mode/#code [+o himi] by ChanServ |
05:22 | <~Vornicus> | honestly I should really seriously do some cleanup of my home folder(s). There's just so much crap strewn everywhere. |
05:29 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
05:30 | | thalass [thalass@Nightstar-90oetb.bigpond.net.au] has joined #code |
05:30 | | mode/#code [+o thalass] by ChanServ |
05:44 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
05:44 | | mode/#code [+o himi] by ChanServ |
05:46 | | thalass is now known as Thalass|afk |
05:49 | | Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has joined #code |
06:23 | | macdjord is now known as macdjord|slep |
06:41 | | ErikMesoy|sleep is now known as ErikMesoy |
06:47 | | RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.] |
06:50 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
06:50 | | RchrdB [RichardB@Nightstar-c6u.vd5.170.83.IP] has joined #code |
07:03 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
07:03 | | mode/#code [+o himi] by ChanServ |
07:04 | | Thalass|afk is now known as Thalass |
07:06 | | Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has quit [[NS] Quit: Leaving] |
07:07 | | Turaiel is now known as Turaiel[Offline] |
07:15 | | JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code |
07:15 | | mode/#code [+o JackKnife] by ChanServ |
07:17 | | Kindamoody is now known as Kindamoody|afk |
07:32 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
07:45 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
07:45 | | mode/#code [+o himi] by ChanServ |
07:58 | | Kindamoody|afk is now known as Kindamoody |
07:59 | | [R] [rstamer@genoce.org] has quit [Ping timeout: 121 seconds] |
08:09 | | Kindamoody is now known as Kindamoody|afk |
08:32 | | macdjord|slep [macdjord@Nightstar-7rac1r.mc.videotron.ca] has quit [Connection reset by peer] |
08:32 | | macdjord|slep [macdjord@Nightstar-7rac1r.mc.videotron.ca] has joined #code |
08:32 | | mode/#code [+o macdjord|slep] by ChanServ |
08:41 | | [R] [rstamer@Nightstar-d7h8ki.org] has joined #code |
09:27 | | [R] [rstamer@genoce.org] has quit [Operation timed out] |
09:28 | | [R] [rstamer@Nightstar-d7h8ki.org] has joined #code |
09:32 | | [R] [rstamer@genoce.org] has quit [Operation timed out] |
09:34 | | [R] [rstamer@Nightstar-d7h8ki.org] has joined #code |
09:39 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
09:53 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
09:53 | | mode/#code [+o himi] by ChanServ |
10:22 | | HotShot [theeaznon@Nightstar-6vf6q9.sfldmi.sbcglobal.net] has quit [Connection closed] |
11:09 | | mode/#code [+o RchrdB] by ChanServ |
11:11 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
11:14 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection reset by peer] |
11:25 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
11:25 | | mode/#code [+o himi] by ChanServ |
12:00 | | VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code |
12:08 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
12:21 | | himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code |
12:21 | | mode/#code [+o himi] by ChanServ |
12:22 | | Syka [the@Nightstar-s57.sib.126.1.IP] has joined #code |
12:23 | | Syka is now known as NSGuest44119 |
12:37 | | NSGuest44119 [the@Nightstar-s57.sib.126.1.IP] has quit [Connection closed] |
12:41 | | Syka [the@Nightstar-s57.sib.126.1.IP] has joined #code |
12:42 | | Syka is now known as NSGuest42822 |
12:57 | | Xon [Xon@Nightstar-j72.ku7.252.119.IP] has quit [Connection closed] |
12:58 | | Xon [Xon@Nightstar-j72.ku7.252.119.IP] has joined #code |
13:25 | | macdjord|slep is now known as macdjord|wurk |
13:55 | | celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has joined #code |
13:55 | | mode/#code [+o celticminstrel] by ChanServ |
14:30 | | NSGuest42822 [the@Nightstar-s57.sib.126.1.IP] has quit [Connection closed] |
14:34 | | Syka [the@Nightstar-s57.sib.126.1.IP] has joined #code |
14:35 | | Syka is now known as NSGuest61954 |
15:09 | <@celticminstrel> | This is a little odd - XCode seems to be using an older version of clang than it has installed into /usr/bin. |
15:10 | <@celticminstrel> | 'clang --version' gives "Apple LLVM version 4.2", but 'xcrun clang --version' gives "Apple clang version 4.1". |
15:19 | <@RchrdB> | Doesn't Xcode have a thing where it lets you pick which of several installed compilers/versions? |
15:19 | <@RchrdB> | All the IDEs I've ever used had something like that. |
15:20 | <@celticminstrel> | It does, but the only other choice is LLVM GCC 4.2 |
15:26 | | JackKnife [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds] |
15:34 | <@AnnoDomini> | Can you do recursive structs/classes? |
15:34 | <@celticminstrel> | What do you mean? |
15:35 | <@AnnoDomini> | typedef struct A { list<A>; } A; |
15:35 | <@AnnoDomini> | (Well, with better syntax. But I think you get the point.) |
15:36 | <@celticminstrel> | You can drop the typedef. |
15:36 | <&ToxicFrog> | In C++ specifically? |
15:36 | <@AnnoDomini> | Yes. |
15:36 | <@celticminstrel> | I think the answer is "yes", kind of. |
15:45 | | * AnnoDomini tests this. |
15:46 | <@AnnoDomini> | Apparently, you can. Neat! |
16:07 | <@celticminstrel> | I wish I'd known earlier. There's a whole documentation download for XCode covering the ancient stuff. |
16:11 | <@celticminstrel> | It would've helped when I was replacing all that ancient stuff with different stuff. |
16:42 | <@AnnoDomini> | http://pastie.org/9052561 <- This works when run. Are there any problems with this approach that you can see? |
16:44 | <@celticminstrel> | Unless I'm mistaken, one, two, and three won't have their parent set. |
16:44 | <@celticminstrel> | I suggest encapsulating. |
16:45 | <@celticminstrel> | You could have an add() method which sets the parent and appends. |
16:45 | <@AnnoDomini> | Why won't the children have their parent set? |
16:46 | <@celticminstrel> | Oh wait, they will, I just missed the place where you set it. |
16:46 | <@celticminstrel> | Still, I think my suggestion would be better. |
16:46 | | * AnnoDomini repastes with output. |
16:46 | <@celticminstrel> | Is foreach a macro? |
16:46 | <@AnnoDomini> | Yeah. |
16:46 | <@AnnoDomini> | I have very little idea of how it works. |
16:47 | <@celticminstrel> | Does range-for not work for you? |
16:47 | <@AnnoDomini> | "range-for"? |
16:47 | <@celticminstrel> | Or are you compiling for C++98? |
16:47 | <@celticminstrel> | Range-for is just like in Java. |
16:47 | <@celticminstrel> | eg for(std::string s : stringList) |
16:47 | | Thalass is now known as Thalasleep |
16:48 | <@AnnoDomini> | Oh. |
16:48 | <@AnnoDomini> | Hmmm. |
16:48 | <@celticminstrel> | It's new in C++11. |
16:49 | <@AnnoDomini> | I don't know whether it will work with QList. |
16:49 | <@celticminstrel> | I don't know either. |
16:49 | <@celticminstrel> | It works with anything that provides the same interface as an STL container. |
16:50 | <@celticminstrel> | Which I think means begin() and end(). |
16:50 | <@AnnoDomini> | Also, it seems you were correct - the real children won't have their parent set. |
16:50 | <@AnnoDomini> | http://pastie.org/9052842 |
16:50 | <@AnnoDomini> | This crashes. |
16:50 | <@celticminstrel> | Really? |
16:50 | <@AnnoDomini> | It may be that foreach makes copies, instead of accessing the list's elements. |
16:50 | <@celticminstrel> | Range-for also works with normal C arrays. |
16:52 | | Thalasleep [thalass@Nightstar-90oetb.bigpond.net.au] has quit [Ping timeout: 121 seconds] |
16:52 | <@celticminstrel> | If QList has begin() and end() member functions, range-for will work. If it has functions that do roughly the same thing but have different names, you might be able to define begin() and end() functions to make range-for work. |
17:02 | <@AnnoDomini> | It does work with it! (I had to set the project to actually use C++11, though.) |
17:02 | <@celticminstrel> | Fun. |
17:03 | <@AnnoDomini> | Crashes the same as foreach, though. |
17:06 | <@celticminstrel> | I wouldn't expect it to make any difference there. |
17:07 | <@celticminstrel> | Though... |
17:07 | <@celticminstrel> | You can make the loop variable a reference. |
17:07 | <@celticminstrel> | eg for(string& s : stringList) |
17:07 | <@celticminstrel> | If you don't, you get a copy. |
17:08 | | JackKnife [Z@Nightstar-ro94ms.balk.dk] has joined #code |
17:08 | | mode/#code [+o JackKnife] by ChanServ |
17:12 | <@AnnoDomini> | This works. Thanks! |
17:13 | <@celticminstrel> | But really, don't add to the children list directly. Use a member function to add to it. |
17:13 | <@AnnoDomini> | Yes, yes, this is just a test. |
17:17 | <@celticminstrel> | Fair enough. |
17:28 | | Turaiel[Offline] is now known as Turaiel |
17:29 | <@AnnoDomini> | celticminstrel: Like this http://pastie.org/9054196 ? |
17:29 | | Kindamoody|afk is now known as Kindamoody |
17:36 | <@celticminstrel> | Yeah. |
17:37 | <@AnnoDomini> | Hmmm. Which form of incrementation returns the former value? |
17:38 | <@AnnoDomini> | I want to return the former value of something and increment it. |
17:38 | <@celticminstrel> | i++ copies i, increments i, and returns the copy. |
17:38 | <@AnnoDomini> | So "return i++;" will return i. |
17:39 | <@AnnoDomini> | (Rather than i+1.) |
17:39 | <@celticminstrel> | Yeah. |
17:42 | <@ErikMesoy> | The first bad option here is to use "return ++i". |
17:42 | <@ErikMesoy> | This is a bad option because it involves ++i syntax which is obscure. |
17:43 | <@ErikMesoy> | The second bad option is to use "return (i++)". This is a bad option because it usually won't work. |
17:43 | <@ErikMesoy> | The third bad option is "i++; return i" and then a year later you'll wonder why you split those. |
17:43 | <@ErikMesoy> | Anyone know a good option? :V |
17:44 | <@celticminstrel> | That's if you want to return the new value. :P |
17:46 | <@ErikMesoy> | This sounds horribly confusing. |
17:48 | | celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.] |
17:48 | <@AnnoDomini> | I want to return the previous value. |
17:48 | | celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has joined #code |
17:48 | | mode/#code [+o celticminstrel] by ChanServ |
17:49 | <@AnnoDomini> | I suppose I could do i++; return i-1; |
17:51 | <@celticminstrel> | That seems silly. |
17:51 | <&ToxicFrog> | ErikMesoy: "++i" is obscure? What? |
17:52 | <&ToxicFrog> | AnnoDomini: what's wrong with just 'return i++'? |
17:52 | <@AnnoDomini> | Nothing. |
17:52 | <@AnnoDomini> | ErikMesoy is just complaining. |
17:53 | | * TheWatcher seconds TFs question about ++i, uses it all over the shop himself |
17:53 | <@celticminstrel> | I use it. |
17:54 | <@celticminstrel> | I use both i++ and ++i, actually. |
17:54 | <@celticminstrel> | When it's a statement I generally do i++ though. |
18:52 | | NSGuest61954 is now known as Syk |
18:53 | | Turaiel is now known as Turaiel[Offline] |
19:23 | | Kindamoody is now known as Kindamoody[zZz] |
19:25 | <@celticminstrel> | Okay, computing points for a circle would be (r*sin(t), r*cos(t)), so for a rounded rectangle... |
19:26 | <@celticminstrel> | I have to... do that four times, and... add stuff? |
19:26 | <@celticminstrel> | Like the width and height. |
19:53 | | Alek [omegaboot@Nightstar-qa936g.il.comcast.net] has quit [[NS] Quit: brb] |
19:55 | <@AnnoDomini> | You could use a circle drawing and a square drawing, and check if the distance to the center is more or less than some value you set. |
19:56 | <@AnnoDomini> | No, wait. |
19:56 | <@AnnoDomini> | Check what the d() is of a point drawn by a circle and a square, then use the drawing that produces the lower d(). |
20:05 | | Alek [omegaboot@Nightstar-qa936g.il.comcast.net] has joined #code |
20:05 | | mode/#code [+o Alek] by ChanServ |
20:15 | <@celticminstrel> | Huh? |
20:15 | <@celticminstrel> | What's d()? |
20:15 | <@celticminstrel> | To clarfiy, I just need to compute vertices, meaning I only really need to worry about the rounded parts. |
20:15 | <@AnnoDomini> | Distance. |
20:15 | <@AnnoDomini> | OK. |
20:16 | <@celticminstrel> | ^clarify |
20:25 | | HotShot^Work [HotShot^Wor@Nightstar-eeo1n6.mi.comcast.net] has joined #code |
20:32 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [[NS] Quit: brb] |
20:35 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code |
20:35 | | mode/#code [+ao McMartin McMartin] by ChanServ |
21:11 | | JackKnife [Z@Nightstar-ro94ms.balk.dk] has quit [Ping timeout: 121 seconds] |
21:29 | | HotShot^Work [HotShot^Wor@Nightstar-eeo1n6.mi.comcast.net] has quit [Ping timeout: 121 seconds] |
22:31 | | * AnnoDomini wonders how to properly do a method that explores this tree he's got, and displays the various bodies. |
22:31 | <@AnnoDomini> | Right now I've got a pretty hardcoded displayer. |
22:39 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
22:39 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
22:42 | <@gnolam> | https://twitter.com/silascutler/status/453875497907126272 |
22:49 | | ErikMesoy is now known as ErikMesoy|sleep |
22:54 | <@AnnoDomini> | I really like Qt Creator's pasting. It automatically adjusts indentation! |
22:56 | <@celticminstrel> | I think most IDEs do that. |
22:56 | <@celticminstrel> | Eclipse does, XCode does. |
22:56 | <@Namegduf> | Visual Studio does. |
22:57 | <@Namegduf> | (Maybe you have to fiddle with braces before/after and/or alter options, though) |
22:57 | <&McMartin> | Notepad++ doesn't >:_> |
22:57 | <&McMartin> | >_> even |
22:58 | <@AnnoDomini> | Code::Blocks doesn't. |
22:58 | <@celticminstrel> | I don't think I'd call Notepad++ an IDE... |
22:58 | <@Tamber> | Not even an IDE-- ? |
22:58 | <@Tamber> | :p |
22:58 | <@celticminstrel> | Heh. |
22:59 | <&McMartin> | I'd rather use NP++ than Code::Blocks =( |
23:00 | <@celticminstrel> | Code::Blocks is a bit poor, yeah. When I was using it a week or so ago I found it easier in many cases to manually edit the project file than to use CB's interface to change things. |
23:02 | <@celticminstrel> | And when I set it to use C++11, it tried compiling a C file with that flag, causing clang to complain. Though, to be fair, that might be just because it's not intended to be used with clang. |
23:23 | | HotShot^Work [HotShot^Wor@Nightstar-eeo1n6.mi.comcast.net] has joined #code |
23:55 | | HotShot^Work [HotShot^Wor@Nightstar-eeo1n6.mi.comcast.net] has quit [Ping timeout: 121 seconds] |
23:57 | | HotShot^Work [HotShot^Wor@Nightstar-eeo1n6.mi.comcast.net] has joined #code |
--- Log closed Thu Apr 10 00:00:37 2014 |