code logs -> 2010 -> Thu, 22 Jul 2010< code.20100721.log - code.20100723.log >
--- Log opened Thu Jul 22 00:00:16 2010
00:36
< gnolam>
celticminstrel: if you frequent game programming forums you will eventually come across one of those posts. I just haven't seen one in a long time for some reason. :)
00:38
< TarinakyKai>
I'm frequently guilty of the variation - "Super sweet game design. Come look at it and tell me it's awesome before I put it in the bin."
00:38
< TarinakyKai>
Which is -really- just "Look at me! Look at me! Look at meeeeee~!"
00:39
< TarinakyKai>
Because I never felt loved or wanted as a child.
00:39 * TarinakyKai sage-nods.
00:40 AnnoDomini [annodomini@Nightstar-fb29b369.adsl.tpnet.pl] has quit [[NS] Quit: SRSLY.]
00:41 Attilla_ [Obsolete@Nightstar-5a5cbc92.threembb.co.uk] has quit [[NS] Quit: ]
00:43 You're now known as TheWatcher[T-2]
00:45 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
00:48 You're now known as TheWatcher[zZzZ]
00:52 TarinakyKai [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Connection closed]
02:26 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:30
<@McMartin>
Wacky
02:30
<@McMartin>
http://github.com/remogatto/gospeccy
02:34 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
02:38 Vornicus-Latens [vorn@ServerAdministrator.Nightstar.Net] has joined #code
02:38 mode/#code [+o Vornicus-Latens] by Reiver
02:39 Vornicus-Latens is now known as Vornicus
03:04 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
03:07 cpux- [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
03:10 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
03:10 cpux- is now known as cpux
03:22 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
04:05 Chi is now known as Alek
04:40 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
04:41 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
04:41 Syloqs_AFH is now known as Syloqs-AFH
05:28 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code
05:42 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
05:47 Orth [orthianz@Nightstar-452dda44.xnet.co.nz] has joined #code
05:49 Orthia [orthianz@Nightstar-32b4252e.xnet.co.nz] has quit [Ping timeout: 121 seconds]
06:29 Orth [orthianz@Nightstar-452dda44.xnet.co.nz] has quit [Client closed the connection]
06:38 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
07:05 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Client closed the connection]
07:10 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Connection reset by peer]
07:16 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
07:38
<@jerith>
Happy pi approximation day.
08:33 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
08:39 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
08:40 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
09:00 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
09:08 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
09:14 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
09:28 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
09:30 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
09:34 You're now known as TheWatcher
09:37 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
09:37 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
09:45 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
09:49 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Client closed the connection]
09:57 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has joined #code
10:35 AnnoDomini [annodomini@Nightstar-ba4df6b6.adsl.tpnet.pl] has joined #code
10:35 mode/#code [+o AnnoDomini] by Reiver
10:39 * TheWatcher vaguely sads at perl's inability to do ($foo, $bar) += ($wibble, $womble);
11:39 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
12:17 Orthia [orthianz@Nightstar-597a3beb.xnet.co.nz] has quit [Ping timeout: 121 seconds]
12:18 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
12:40 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited]
13:52 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
14:53 Orthia [orthianz@Nightstar-e99f165b.xnet.co.nz] has joined #code
15:58 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection]
16:03 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
16:04 Syloqs_AFH is now known as Syloqs-AFH
16:07 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection]
16:11 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
16:12 Syloqs_AFH is now known as Syloqs-AFH
16:47
< Tarinaky>
How does one pass by reference in python?
16:50
< simon_>
Tarinaky, it happens by default.
16:51
< Tarinaky>
Ahah.
16:55
< simon_>
Tarinaky, that is, whenever the argument passed is mutable. strings and numbers are passed by value.
16:56
< Tarinaky>
Oh. So Java's way of doing it then?
16:56
< Tarinaky>
Are tuple's mutable?
16:57
<@Vornicus>
Tuples are not.
16:57
<@Vornicus>
Neither are strings, numbers, booleans, None, or frozensets.
16:57
<@Vornicus>
Lists, dictionaries, sets, and files are mutable.
16:58
< Tarinaky>
What about classes?
16:58
< Tarinaky>
Mutable right?
16:59
<@Vornicus>
Classes, Idunno. functions are immutable, and you can make objects in general "immutable" by just not providing any writers, though to use them in a dictionary you also want to have them implement __hash__ and __eq__
16:59
< simon_>
you mean objects?
16:59
< Tarinaky>
Yes, sorry. Objects.
17:00
< Tarinaky>
I'm trying to determine how I should organise a large segment of code.
17:00
< simon_>
so implementation-wise, they're probably always pass-by-reference, but it makes little difference if there are no writers.
17:08
<@Vornicus>
what simon said.
17:08
< Tarinaky>
Can anyone tell me what the behavior of range(a,b) is if a and b may be floating?
17:09
< Tarinaky>
Will they automatically be floored?
17:14
<@Vornicus>
That one's a try it.
17:14
<@Vornicus>
Get out the interactive interpreter and see what happens.
17:14
< simon_>
Tarinaky, also, the interactive interpreter has a pretty neat help() function.
17:14
< Tarinaky>
How severe is a deprecation warning?
17:15
< Tarinaky>
Should I be explicitly flooring them?
17:15
<@Vornicus>
It means that this won't necessarily work in later versions.
17:16
<@Vornicus>
DeprecationWarnings also only show up once each -- you'll only ever see that particular warning once for your whole program.
17:16 * simon_ would be cautious with those in Python because of the python3 migration.
17:16
<@Vornicus>
Explicitly flooring them is probably your best bet, yes.
17:16
< Tarinaky>
As an aside - I have an odd bug :/
17:17
< Tarinaky>
Oh! I see what I've done.
17:17
< simon_>
ah, one of those :)
17:18
< Tarinaky>
Nope. That didn't fix it. But that was a bug as well >.>
17:19 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
17:20
< Tarinaky>
http://tarinaky.pastebin.com/1D2qMiBq << Does anyone see an obvious problem with this fragment?
17:21
<@Vornicus>
What's It Doing Wrong
17:21
< Tarinaky>
It's only drawing the top-left quadrant.
17:23
< Tarinaky>
I've only tested it with coordCenter = (0,0)
17:23
< Tarinaky>
But it's meant to be (once I've looked at input) an inefficient scrolling buffer.
17:41
< Tarinaky>
Ah!
17:42
< Tarinaky>
I think I know what I've done!
17:43
< Tarinaky>
I'm stuffing up the position of the blit still.
17:46
< Tarinaky>
Fixed ^^
17:48 * Vornicus patpats Tarinaky.
17:49
<@jerith>
http://github.com/jerith/connector-django-mysql -- Because I apparently have too much time on my hands.
17:56 Attilla [Obsolete@Nightstar-303ce1dd.threembb.co.uk] has joined #code
17:57 mode/#code [+o Attilla] by Reiver
18:09
< Tarinaky>
What did someone suggest for doing addition of tuples?
18:09
< Tarinaky>
Something to do with map?
18:14
<@Vornicus>
map(operator.add, first, second)
18:14
<@Vornicus>
need to import operator first.
18:16
< Tarinaky>
Oh duh.
18:17
< Tarinaky>
It needs to be first = map(operator.add,first,second) doesn't it?
18:17
< Tarinaky>
(To match first = first + second)
18:18
< Tarinaky>
Nope. That's still not working either :/
18:19
<@Vornicus>
NOT WORKING HOW
18:19
< Tarinaky>
self.coordPlayerPosition = map(operator.add,self.coordPlayerPosition,(0,-1))
18:19
< Tarinaky>
Not working as in doing nothing.
18:20
< Tarinaky>
It's difficult to specify how something's not working when it's doing so silently >.>
18:20
<@Vornicus>
self.coordPlayerPosition hasn't changed at all?
18:20
< Tarinaky>
Correct.
18:20
< Tarinaky>
(0,0) goes in, (0,0) comes out.
18:20
<@Vornicus>
that's odd.
18:20
< Tarinaky>
Desired output is for the y component to be decreased by 1 pixel.
18:21
<@Vornicus>
The equivalent is working for me.
18:22
< Tarinaky>
Mind C+Ping the line?
18:22
<@Vornicus>
>>> a = (4,5) ....>>> a = map(operator.add, a, (0, -1)) ....>>> print a # [4, 4]
18:23
< Tarinaky>
Hmm. It's working in the interactive interpretter.
18:24
<@Vornicus>
Note you're gettin a list back, but.
18:25
< Tarinaky>
>>> a = map(operator.add,a,(0,-1))
18:25
< Tarinaky>
>>> a
18:25
< Tarinaky>
[0, -1]
18:25
< Tarinaky>
So that's not the issue.
18:26 * Tarinaky is watching it in a debugger so he can see the variable (not) change.
18:27
< Tarinaky>
I'm not really sure how to sidestep this issue :/ It's a bit of a show-stopper.
18:28
< Tarinaky>
I mean. I -really- don't want to have to unpack and then repack every matrix I want to add :/
18:33
< Tarinaky>
Oh. That's odd. Working now :/
18:41
< Tarinaky>
Hmm. Faster than I expected it to be.
18:52 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Client closed the connection]
19:39 * ToxicFrog eyes the fuck out of python
19:39
<@ToxicFrog>
[] doesn't appear to have reduce or fold methods
19:40
< celticminstrel>
What would those do?
19:40
< celticminstrel>
I may know, but...
19:40
< celticminstrel>
...not sure.
19:41
<@ToxicFrog>
reduce takes a list of A and a function (A,A) => A and returns a value created by repeatedly applying the function to reduce the list.
19:42
<@ToxicFrog>
That is to say, [1, 2, 3, 4].reduce(_+_) is 10.
19:42
< celticminstrel>
Well, that one is a global method taking two arguments.
19:42
<@ToxicFrog>
fold is a more general form that takes a list of A, a value of type B, and a function (B,A) -> B.
19:43
<@ToxicFrog>
Oh, so it is. Why is it not a method on List?
19:43
< celticminstrel>
No idea.
19:43 * ToxicFrog was trying help([])
19:43
< celticminstrel>
So, what does fold do?
19:45
< celticminstrel>
Maybe reduce is a global function so that it can work on any type that is defined to be iterable?
19:53
<@AnnoDomini>
C++. Can I include a .cpp file, rather than a .h file?
19:54
<@ToxicFrog>
celticminstrel: in that case I'd make it a method on Iterable, but I'm not really familiar with the python class heirarchy, so maybe that's not practical.
19:55
<@ToxicFrog>
Like I said, fold is a more general form of reduce. foldl(list, fn, 0) basically does tmp = fn(0, list[0]), then tmp = fn(tmp, list[1])...until it runs out of list.
19:55
<@ToxicFrog>
reduce is basically fold(tail list, fn, head list).
19:56
<@ToxicFrog>
Fold is less convenient in that it requires you specify an initial value, but more powerful in that you can specify that value, and the result of the fold doesn't need to have the same type as the list contents.
19:56
<@ToxicFrog>
AnnoDomini: yes, although you should ask yourself some hard questions about why you're doing so.
19:56
<@ToxicFrog>
Really, you can #include anything; it's basically a copy-paste that preserves file and line information.
19:57
< celticminstrel>
ToxicFrog: Python does not use an Iterable class to make something iterable.
19:57
<@AnnoDomini>
Because I want a file to keep the functions I've written, and having a .cpp/.h duality is annoying because I need to declare AND define everything in separate files.
19:57
< celticminstrel>
Instead, iteration is handled in a similar way to operator overloading.
19:58
< celticminstrel>
As for fold... would it be incorrect to say that fold(list, fn, 0) is the same as reduce([0] + list,fn)?
19:59
<@ToxicFrog>
AnnoDomini: and these functions are only ever used from a single other file?
19:59
<@ToxicFrog>
Why not just have them in that file to begin with, then?
20:00
<@AnnoDomini>
Hmm. That's a point. I don't want them in the main.cpp file, because it will get huge.
20:00
<@ToxicFrog>
(if they aren't used only from a single other file, they become multiply defined and your program does not link)
20:00
<@ToxicFrog>
celticminstrel: that is incorrect, because it's more restrictively typed than fold.
20:01
<@AnnoDomini>
I see.
20:01
<@ToxicFrog>
celticminstrel: consider the case where it's a list of digits that you're converting into a string - eg, [1,2,3] -> "123"
20:03
<@ToxicFrog>
With fold, you specify "" as the starting value, and lambda x,y: x :: tostring(y) as the fold function.
20:03
<@ToxicFrog>
With reduce, you're stuck.
20:04
< celticminstrel>
AnnoDomini: What you probably need to do is create a .h file with just the prototypes of the functions, and include that instead of the .cpp file.
20:05
<@ToxicFrog>
AnnoDomini: specifically, since it just a copy-paste, you end up with a complete definition of those functions in each file that #includes the cpp. This is not a problem at compile time, but at link time the linker will see multiple definitions for the same function and reject the link.
20:05
< celticminstrel>
ToxicFrog: So, what I said is not true generally, but is true for a subset of cases.
20:05
<@ToxicFrog>
celticminstrel: he knows that, he's trying to avoid having seperate definitions and declarations.
20:05
<@ToxicFrog>
Given that this is C++, ahahahaha, good luck with that.
20:05 * AnnoDomini sads, does it the old way.
20:05
<@ToxicFrog>
And yes. It's true for cases where the fold function has type A -> A -> A rather than B -> A -> B.
20:06
< celticminstrel>
Well, you don't need a header file containing all the definitions; you could instead just include them directly in each file that needs them.
20:06
<@ToxicFrog>
That said, reduce is always a special case of fold.
20:06
< Namegduf>
celticminstrel: That's a horrible idea
20:07
< Namegduf>
If the types become mismatched
20:07
< Namegduf>
Things become horribly wrong
20:07
< celticminstrel>
Did I ever say it was a good idea? :P
20:07
<@AnnoDomini>
Wait, a .h file with definitions?
20:07
< celticminstrel>
Yes.
20:07
<@ToxicFrog>
...are you sure you didn't mean declarations?
20:07
< celticminstrel>
...oh. Right.
20:08
<@AnnoDomini>
Well, I do define classes this way.
20:08
< celticminstrel>
Declarations, yes. Not definitions.
20:08
< celticminstrel>
Defining classes in a header file is fine. Defining functions in a header file is not fine.
20:08
<@ToxicFrog>
And yeah, this is just as annoying as using headers properly, except that now when the definitions change you have to update the declarations in every file that uses them, rather than just in the headers.
20:08
< celticminstrel>
That excludes member functions defined within the class and functions explicitly declared as inline.
20:08
<@ToxicFrog>
IME, the solution is to either:
20:08
< Namegduf>
And if you don't, I think it "works fine".
20:09
< Namegduf>
Until runtime.
20:09
<@ToxicFrog>
(1) do it normally,
20:09
<@ToxicFrog>
(2) write just the cpp files and add something to build pipeline that automatically generates the headers, or
20:09
<@ToxicFrog>
(3) use a less annoying language.
20:09
< celticminstrel>
Actually, I suppose you could just declare all the functions inline.
20:10
< celticminstrel>
It's not like compilers actually use that as a hint to inline the function, right?
20:10
<@ToxicFrog>
Namegduf: no, you should get a compile/link failure - one file will use foo(int, int) but the linker will only see foo(int, int, boolean) or whatever.
20:10
< celticminstrel>
It'll work if only the return types differ, though.
20:10
< Namegduf>
ToxicFrog: I was thinking incompatible types, not differing signatures
20:10
< celticminstrel>
I think.
20:10
<@ToxicFrog>
Namegduf: what's the distinction?
20:10
< celticminstrel>
Parameter types are the signature.
20:11
<@ToxicFrog>
That is to say, what type mismatch between declaration and definition do you have that will compile and link but not run?
20:11
< Namegduf>
"any"?
20:11
<@ToxicFrog>
...um
20:11
< celticminstrel>
No.
20:11
<@ToxicFrog>
If your definition says the function has signature (int, int) -> int
20:11
< Namegduf>
I am not talking about functions
20:11
< Namegduf>
I am talking about types
20:11
< celticminstrel>
Oh.
20:11
< celticminstrel>
Wait.
20:11
< celticminstrel>
What?
20:11
<@ToxicFrog>
Now I'm completely lost, then.
20:12
< Namegduf>
If you define a struct or class in two separate files
20:12
< celticminstrel>
Are you talking about declaring global variables with different types and the same name?
20:12
< Namegduf>
And these definitions differ
20:12
<@ToxicFrog>
Because that's not what any of the rest of us are talking about.
20:12
< Namegduf>
But the names are the same...
20:12
< celticminstrel>
Ah.
20:12
< Namegduf>
I joined in at "You could define things in each file separately"
20:13
< celticminstrel>
Well, perhaps if said types have no member functions...
20:13
< Namegduf>
And I commented that that has horrible issues when types in said things are defined separately, because I don't think the compiler will stop you.
20:13
< celticminstrel>
Not the compiler, no. The linker, probably.
20:13
<@ToxicFrog>
Namegduf: that would explain the confusion, because the "things" we're talking about have always been functions, and thus your comments read as changing the function signature.
20:14
< Namegduf>
Ah.
20:14
< celticminstrel>
Is there anything wrong with the solution of declaring the functions inline, then?
20:14 aoanla [AndChat@7C1B03.122F4E.62F6DE.88FD9B] has joined #code
20:14
< Namegduf>
In C, yes
20:14
< Namegduf>
C is somewhat flexible in terms of function types matching
20:14
< Namegduf>
(It isn't technically required to declare them at all)
20:14
< Namegduf>
(It makes "assumptions")
20:14
< celticminstrel>
C does not care about the signature of a function.
20:14
< Namegduf>
I don't know about C++.
20:15
< celticminstrel>
Is there anything wrong with the solution of declaring the functions inline, then?
20:15
< celticminstrel>
(I usually only do that for operators that operate on enums.)
20:17
<@ToxicFrog>
Well, for starters, whoever wrote the optimizer will track you down and straight up murder you~
20:18
< celticminstrel>
I thought the optimizers didn't rely on that.
20:19
<@ToxicFrog>
?
20:19
< celticminstrel>
I thought the optimizers did not account for inline when doing their work; the compiler is free to ignore it as a hint, after all.
20:20
<@ToxicFrog>
I was under the impression that the inline keyword in C++ was an instruction, not a hint?
20:22
<@ToxicFrog>
(barring situations where it is not possible such as recursive inlines)
20:22
< Namegduf>
inline is a hint
20:22
<@ToxicFrog>
Anyways. To answer seriously, I can't think of any semantic problems, but it may have unfortunate implications for debugging and code size depending on the compiler.
20:28
< celticminstrel>
The only thing that inline is guaranteed to do is allow the function definition to appear in a header without error.
--- Log closed Thu Jul 22 21:13:03 2010
--- Log opened Thu Jul 22 21:13:16 2010
21:13 TheWatcher [chris@Nightstar-b4529b0c.zen.co.uk] has joined #code
21:13 Irssi: #code: Total of 21 nicks [7 ops, 0 halfops, 0 voices, 14 normal]
21:13 mode/#code [+o TheWatcher] by Reiver
21:14 Irssi: Join to #code was synced in 53 secs
21:44
<@McMartin>
C++ is strict about function signatures.
21:45
<@McMartin>
inline is a hint, but it is generally a pretty good hint.
22:13 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
23:08 aoanla [AndChat@7C1B03.122F4E.62F6DE.88FD9B] has quit [[NS] Quit: ]
23:15
< celticminstrel>
Well, I use it when I just want to put the function in the header file. Which isn't very often.
23:19 Zed_ [Zed@Nightstar-e4835f03.or.comcast.net] has joined #code
23:22 Zed [Zed@Nightstar-e4835f03.or.comcast.net] has quit [Ping timeout: 121 seconds]
23:33
<@Vornicus>
Actually I think most of those qualifiers are hints.
--- Log closed Fri Jul 23 00:00:17 2010
code logs -> 2010 -> Thu, 22 Jul 2010< code.20100721.log - code.20100723.log >