code logs -> 2010 -> Fri, 04 Jun 2010< code.20100603.log - code.20100605.log >
--- Log opened Fri Jun 04 00:00:23 2010
00:02
<@ToxicFrog>
McMartin: you mentioned Jambi earlier. Hasn't that been discontinued?
00:04
<@McMartin>
My experience with 4.6.x is that it Doesn't Work Yet, so~
00:04
<@Vornicus>
And without a good start, I'm still looking at a rather ridiculous number of possible values;there are, all told, triangle(n-1) C triangle(n-1)/2 setups I have to try /anyway/
00:04
<@McMartin>
4.5.x is the version I'd want anyhow
00:04
<@McMartin>
(I'd be unlikely to use Scala for a traditional GUI app except as an embedded language though; I've had too many bad experiences with unintended languages for GUI development)
00:09
<@ToxicFrog>
("Unintended languages"? Scala is meant for app development, not embedding)
00:12
<@McMartin>
(Er, maybe Jambi isn't the tech I meant; I meant the Java bindings for Qt)
00:13
<@McMartin>
(IME GUI programming in anything but C++ or the Native Language The OS Intends, whatever that is, is a nightmare generally)
00:13
<@McMartin>
(Not completely sucking at GUI apps is one of the few places where I concede that C++ is overwhelmingly superior)
00:16
<@jerith>
McMartin: I've found pygtk to be not too horrible, but then I haven't really done much with it.
00:17
<@McMartin>
jerith: PyGtk is what Blorple 0.1 used, and I had tremendous difficulty with something that would normally be minor but which was absolutely critical for the final application to support
00:17
<@McMartin>
My inability to get that one minor (grand-scheme of things; blocker to me) thing to work was why I started from scratch with Swing.
00:18
<@jerith>
Hrm.
00:18
<@McMartin>
That thing was a pair of slider windows, which I could do, and then having a 960x960 image scaled to fit in one of the three subwindows produced, so that the user could decide for themselves how much of the display was dedicated to cover art.
00:19 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
00:19
<@McMartin>
Which is to say, I needed the ability to both have and eat my cake wrt a widget's preferred size and a user's overrides, and it's tricky in *any* system. I couldn't work out how to do it in GTK at all, much less via the Python Bindings.
00:19
<@jerith>
That's way beyond anything I've done in any GUI toolkit, so.
00:19
<@McMartin>
Yeah, like I said, if this is impossible without crazy backflips I'd be entirely unsurprised. It's a kind of strange thing to want, but it's in large part The Whole Application for Blorple.
00:20
<@McMartin>
Aqua example of final result: http://blorple.sourceforge.net/blorple.png
00:21
<@McMartin>
(The Swing version also required some backflips but I had learned enough Swing by that point that I could *do* them.)
00:22
<@McMartin>
But the "rescale as the pane resizes" thing I could not get Gtk to do; it insisted on "the image gets to decide the size of the pane that holds it"
00:22
<@jerith>
That's unhelpful.
00:23
<@McMartin>
IIRC, in Swing I had the container say "You get to insist on your size, and you'll totally have scrollbars if it's too big to fit", and then having the main program detect an attempt to turn on scrollbars and react by rescaling the image until you didn't need them anymore.
00:24
<@McMartin>
IIRC when I tried that trick in PyGtk it then concluded that the proper size for itself was zero pixels and then woe and fiery doom ensued.
00:24
<@McMartin>
I'm sure that last one was Me Doing It Wrong somehow, though.
00:25
<@jerith>
Is it not worth building your own container?
00:26
<@McMartin>
I thought that was what I was *doing* - and in Swing effectively what I did.
00:27
<@jerith>
Ah.
00:27
<@McMartin>
Oh, wait, no.
00:27
<@McMartin>
Swing actually Just Did It Right.
00:28
<@McMartin>
Took a JLabel, set its minimum size to 120x120, set its preferred size to whatever the Cover Art *was*, and then added a ComponentListener to it that reacted to a componentResized event by resizing its image.
00:29
<@McMartin>
This label was then added to a JSplitPane.
00:30
<@jerith>
I found Swing to be incredibly awkward when I used it.
00:30
< celticminstrel>
It is a bit awkward, yes.
00:31
<@McMartin>
Yeah
00:31
<@jerith>
I an "why do I need twelve lines to put a button on the screen?" kind of way.
00:31
<@McMartin>
This is clearly why I recalled this as being more complex than it was; this was four lines of code and each was a pretty obvious chunk of specifying what I wanted.
00:32
<@McMartin>
(There was a JScrollPane involved, but it was for the top window, which is supposed to actually scroll since it's a list view.)
00:32
<@jerith>
Which was tightly coupled with "how did I get to seven doc tabs open in my browser without getting any closer to knowing what to do?"
00:32
<@McMartin>
That said, adding a button should be like three lines; one to create the button, one to attach the ActionListener, and one to add it to its parent component.
00:33
<@McMartin>
Swing widget layouts are terrible, though. Springs for life.
00:34 AnnoDomini [annodomini@Nightstar-16d1b861.adsl.tpnet.pl] has quit [[NS] Quit: Blub.]
00:34 Attilla [Attilla@Nightstar-418116f1.threembb.co.uk] has quit [[NS] Quit: ]
00:36 Reiv[Graduate] [orthianz@Nightstar-fd5ecaf2.xnet.co.nz] has joined #code
00:36
<@McMartin>
http://blorple.svn.sf.net/viewvc/blorple/src/java/net/sf/blorple/gui/BlorpleFram e.java?revision=100&view=markup - lines 320-350. 30 lines to set up the window by hand and the various bindings. Some semantics are bound up in it too because I was not very MVCy, more just MVy.
00:36
<@McMartin>
Er, sorry, missed.
00:37
<@McMartin>
230 to 264, and then a pile of semantics.
00:37
<@McMartin>
Most of which are inline anonymous classes because of the aforementioned functional accent.
00:58 Reiv[Graduate] [orthianz@Nightstar-fd5ecaf2.xnet.co.nz] has quit [Ping timeout: 121 seconds]
01:04 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
01:18 * ToxicFrog upreads
01:25
<@ToxicFrog>
McMartin: Jambi is indeed the Java Qt binding. Trolltech (or whoever owns Qt now) has a big announcement on the Jambi page saying that they've stopped development as of 2009-03, and support in 2010-03.
01:27
<@ToxicFrog>
My experience with C++ is that it's painful enough even when you aren't doing GUI programming, and conversely with a good GUI building tool the language is largely irrelevant.
01:28
<@ToxicFrog>
In particular I find the GTK bindings to both Lua and Python to be much, much nicer than the C API or any of the C++ wrappers, simply by virtue of being HLLs.
01:36
<@McMartin>
Right, this is where "GTK fails to do what I want and Glade's relevant options in that domain are beyond opaque" comes in.
01:36
<@McMartin>
Ordinarily in Qt one uses Designer instead of hand-rolling.
01:37
<@McMartin>
Not to be confused with Creator, which is a half-assed IDE, and also not to be confused with Assistant, which is a properly-hyperlinked reference manual.
01:39
<@ToxicFrog>
Aah.
01:40
<@ToxicFrog>
I've generally been doing simple things with GTK, so I have yet to encounter anything where Glade fails me.
01:40
<@ToxicFrog>
That said, if you're using Designer, I fail to see why C++ is a better choice than anything else.
01:42
<@McMartin>
I think you may be misinterpreting my initial statement and some of the logic behind it; let me unpack it a bit.
01:42
<@McMartin>
(a) Bindings to widget libraries - as opposed to using the library directly - has always ended poorly for me
01:42
<@McMartin>
(b) The only exception to this has been C++ wrappers, though this is a necessary, not a sufficient, condition (see: MFC)
01:43
<@McMartin>
If you upread further you can see the precise behavior I was trying to get and which my failure to get PyGtk to *do* caused me to abandon it over.
01:45
<@McMartin>
It's also worth noting that this was 2 years ago and GTK may have advanced some since.
01:46
< Tarinaky>
I need a programming project for the next couple of weeks :/
01:46
<@McMartin>
My general impression of GTK has always been that widgets are incredibly insistent about their sizes in Gtk, robbing their containers of too much power too unconditionally.
01:46
<@McMartin>
And the containers in turn are too spineless to have any existence outside of their contents.
01:47
< gnolam>
Tarinaky: what kind of a project?
01:47
<@McMartin>
So the browser model I'm typically working with when writing GUI apps - in which the User is sizing containers which mutates their contents - is a horrible mismatch to Gtk.
01:47
< gnolam>
McMartin: Amen.
01:47
<@McMartin>
Swing is pretty adept at this, as it turns out. I *think* Qt4 can do this reasonably but haven't actually tried. This is on my List.
01:48
< gnolam>
One sometimes wonders if the Gnome crew has ever even run their desktop environment in anything other than 1024x768+.
01:48
<@McMartin>
gnolam: Maybe they have but haven't been able to figure out how to get GTK to dynamically re-flow their dialog boxes~
01:49
<@McMartin>
That said, I know it's possible, because Pidgin *does* it.
01:49
< Tarinaky>
gnolam: I really wanted that tandem project I was going to do with a friend to happen 'cause I really need help and practise with... well... practical programming :/
01:49
< Tarinaky>
But he's basically disappeared.
01:49
< Tarinaky>
So I'm on my todd again. Which is frustrating.
01:49
< gnolam>
Tarinaky: Eh, pick something you want to do yourself, and /do it/.
01:50
<@McMartin>
It's not common to have itches like that, actually, unless one is a more directed hobbyist.
01:50 Derakon [Derakon@Nightstar-5213d778.ca.comcast.net] has joined #code
01:50 mode/#code [+o Derakon] by Reiver
01:50
< gnolam>
Going in slightly above your level is the best way to learn.
01:50 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
01:50
< Tarinaky>
I know, I know. It's just being above your level isn't that helpful if you don't have someone to help you.
01:51
<@McMartin>
Right, but if you aren't already pushing yourself to the point that Something Could Be Made Easier, projects don't offer themselves.
01:51
<@Derakon>
Sure it is, it's just harder.
01:51
< Tarinaky>
Hence the desire for the Tandem project.
01:51
<@McMartin>
It tends to come down to things like "write a game nobody will play".
01:51
< Tarinaky>
Pretty much.
01:53
< gnolam>
Eh, it worked for Derek Smart. ;-)
01:53
< Tarinaky>
Which in itself tends not to provide any motivation beyond a couple of days.
01:53
<@McMartin>
Depends on what kind of programming you're willing to restrict yourself to.
01:53
<@McMartin>
Or not.
01:54
<@McMartin>
IF is a pretty good gateway drug, for instance, but it rarely translates.
01:55
< Tarinaky>
I'd rather not get bogged down in doing lots of (english) writing.
01:55
< Tarinaky>
I mean. I'd go back to the Roguelike if I had a better idea of how to structure a game.
01:55
<@Derakon>
(One of the ultimate goals of Jetblade is to provide an easily-moddable 2D game for budding programmers to play with)
01:56
<@McMartin>
(In related news, the Aquaria Engine is now open-source.)
01:58
< Tarinaky>
Only time I made any progress with the Roguelike was when I was 'competing' with someone else so we actually regularly worked on our code...
01:58
< Tarinaky>
I'd do some work - then they'd do some to catch up the number of lines... so I'd have to do more... etc...
01:59
<@McMartin>
Speaking of, I really need to get cracking on my own IF again.
01:59
<@McMartin>
Debating how many plot changes to implement before beta 3.
02:00
<@Derakon>
You should make the protagonist be a struggling novella author instead of a superhero~
02:01
<@McMartin>
Derakon: No, these are things like alternate solutions to puzzles
02:01
<@McMartin>
And a couple of changes to the physics, or more permanent reactions to things.
02:01
<@Derakon>
One of the solutions could be going back in time and changing his origin story so he's a different person~
02:01
<@McMartin>
Let me quote directly.
02:02
<@Derakon>
(That could actually be an interesting gimmick -- a game where you have to keep tweaking your origin story so you have the right set of powers to deal with the puzzle in front of you)
02:02
<@McMartin>
David Whyld's "The Mind of the Master" kind of trie that.
02:02
<@McMartin>
*tried
02:02
< Tarinaky>
Derakon: Include Time-travel to facilitate it?
02:02
<@McMartin>
"Bromine compounds are usually solid, and potassium bromide in particular is a sedative. This should be an alternate solution to [spoiler deleted]."
02:02
< Tarinaky>
In a sort of... Journey Man Project style.
02:03
<@Derakon>
Tarinaky: right.
02:03
< Tarinaky>
Man. I haven't played those games in ages.
02:03
<@McMartin>
Other things are things like having the environment change after failed attempts to do certain things as mementoes of the failed attempts.
02:03 * Derakon nods.
02:04
<@McMartin>
I draw the line at accidentally pulling locked doors off their hinges on failed opening attempts.
02:04
<@McMartin>
If they want to BREAK the DOOR, they have to say so~
02:04
<@Derakon>
Hee.
02:04
<@McMartin>
(And if it's a normal door, this will in fact work. Violence: the answer a refreshing amount of the time!)
02:04
<@Derakon>
Now I'm thinking of a "bull in a china shop" platforming game where the goal is to carefully avoid using your massive strength to render the level unwinnable.
02:04
<@McMartin>
Lode Runner~
02:05
<@Derakon>
Lode Runner doesn't have a physics engine.
02:05
<@McMartin>
More seriously, collapsing-platform levels.
02:05
<@McMartin>
More specifically, Luigi's Goddamn Alien Purple Coins.
02:05
<@Derakon>
Heh.
02:06
< Tarinaky>
So. Anyone wanna help me make a game no-one will ever play?~
02:06
<@Derakon>
We'll be glad to give advice~
02:06
< Tarinaky>
:p
02:07
<@Derakon>
(Off to play more SMG2~)
02:07 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has left #code ["Busy"]
02:07
< Tarinaky>
Well. To be honest I'm not really sure how to structure the engine. I know ncurses well enough that I can do output well enough.
02:08
< Tarinaky>
But keeping track of what state the game's meant to be in just prooves so nightmarish.
02:08
< Tarinaky>
Even keeping track of looking and attacking prooves so horrendous.
02:09
< Tarinaky>
*proves
02:09
< Tarinaky>
Spelling proves is hard too.
02:09 * Tarinaky cringes >.<
02:09
<@McMartin>
Tarinaky: Actually, now I *seriously* recommend some Random IF Projects.
02:09
< Tarinaky>
McMartin: I never 'got' IFs.
02:09
<@McMartin>
They'll give you a basic engine that's expandable, and be practice for design in the abstract.
02:10
< Tarinaky>
It'd be a bit wrong for me to try to make an IF given I don't... well... like them.
02:11
<@ToxicFrog>
What don't you like about them?
02:11
<@McMartin>
I'm suggesting it mainly as a well-defined problem domain with a fair amount of discussion on game design
02:11
<@McMartin>
Otherwise, cloning an action puzzler or building a basic scrolling shooter are both excellent starting projects.
02:11
<@McMartin>
Tetris is the standard, but there's something to be said for ones like Klax too.
02:11
< Tarinaky>
ToxicFrog: I just don't get them.
02:12
< Tarinaky>
ToxicFrog: I've tried playing them and it's just... so totally alien.
02:12
<@ToxicFrog>
Can you expand on that?
02:12
<@McMartin>
Also, which era of games?
02:12
<@McMartin>
I'd estimate there being at least five major traditions in IF, each with a noticably different aesthetic.
02:12
< Tarinaky>
Uhh... off the top of my head...
02:13
< Tarinaky>
the Hitchhiker's one and Fallacy of Dawn both spring to mind as ones I've tried playing.
02:13
<@McMartin>
Ouch.
02:13
< Tarinaky>
Ouch?
02:13
<@McMartin>
Yeah, I would not recommend, well, anything by Robb for one's first IF~
02:14
<@McMartin>
He's infamous for awesome writing, pretty good production values, and terrible implementation.
02:14
<@McMartin>
(Fallacy of Dawn)
02:14
<@McMartin>
HHGG is one of the first examples of the problems with adaptations. -_-
02:14
< Tarinaky>
They were both amusing for a bit but I got bored quickly.
02:14
<@McMartin>
If I were pushing something on a new player to try to get them to come to grips with the medium I'd use Bronze or Dreamhold, I think.
02:15
< Tarinaky>
To be honest I preferred the Graphical remake of the HHGG.
02:15
<@McMartin>
Anyway, the reason I suggested it was because the engine is there already as a solved problem and so you don't have the situation where you're making no measurable progress on the actual design.
02:15
< Tarinaky>
Well... to be honest the engine is the bit I actually want to work on.
02:16
< Tarinaky>
It's not like I have some grand awesome design for a game.
02:16
<@McMartin>
I'd suggest a scrolling shooter or a pre-designed action puzzler then. Clone Bejeweled or Tetris.
02:16
<@McMartin>
Or Columns, or Klax, or whatever.
02:16
<@Vornicus>
Centipede!
02:16
< Tarinaky>
Done tetris before.
02:17
<@McMartin>
Scrolling-shooter lets you make the physics and map gradually more complicated. You start at Space Invaders or Galaga, and move through Xevious into something you could render platformers in.
02:17
<@Vornicus>
IT IS THE NINETIES
02:17
<@McMartin>
It is the twenty-first century, and there is time for Audiosurf.
02:18
< Tarinaky>
To be honest... I really wanna do a Roguelike just because I invested so much time in learning ncurses and stuff.
02:18
<@Vornicus>
I'm trying to figure out what category of nut wrote that line.
02:18
< Tarinaky>
:/
02:18 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:19
< Tarinaky>
In the grimdark future of the second millenium THERE IS ONLY AUDIOSURF
02:19
< Tarinaky>
*third
02:19
< Tarinaky>
>.> w/e.
02:19
<@McMartin>
("It is the Nineties, and there is time for Klax" was the marketing slogan for Klax.)
02:19
<@McMartin>
Also, this is the third millenium.
02:20
< Tarinaky>
I did correct myself.
02:20
<@McMartin>
Ah, so you did.
02:20
<@McMartin>
Also, I believe the final word on that is "In the grim future of Hello Kitty, there is only war."
02:21
< Tarinaky>
HAMSTERS FOR THE HAMSTER GOD! KITTIES FOR HIS THRONE!
02:21
<@McMartin>
GROG FOR THE GROGNARD, CHIPS FOR THE CHIP BOWL
02:21
< Tarinaky>
Now stop that. It's silly.
02:23
<@McMartin>
If you want to stay in ncurses, some other options are some kind of empire-management sim a la Hammurabi or King, or a low-res cell-based game like a Pac-Man clone.
02:23
<@McMartin>
Speaking of cells, a Conway Life State Machine simulator could also be worthwhile.
02:23
< Tarinaky>
Well. I'm not sure what's wrong with Roguelike since... you know... I still need to figure out how to fix the problems I have.
02:24
< Tarinaky>
I was mostly fishing for clues.
02:24 * McMartin links http://en.wikipedia.org/wiki/Conway's_Game_of_Life mainly because it animates glider guns.
02:24
<@Vornicus>
I like, uh, shit, what's it called
02:28 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has joined #code
02:29 andy [andy@Nightstar-27d904c2.511.iinet.com] has joined #code
02:29
<@McMartin>
Tarinaky: The problem with the Roguelike appeared to be that you had no interest in working on it.
02:29
< Tarinaky>
Well. I have about as little interest in working on it as any other sort of game.
02:30
< Tarinaky>
I mean... They're all about par for the course on that.
02:30
<@ToxicFrog>
Maybe it's not a game that you want to write?
02:30
< Tarinaky>
Well. There's not really much else is there?
02:31
<@McMartin>
We've been firing off other kinds of games for awhile now~
02:31
< Tarinaky>
<ToxicFrog> Maybe it's not a game that you want to write?
02:31
< Tarinaky>
It was never my intention to have you firing off kinds of games.
02:32
<@ToxicFrog>
How do you mean, not really much else?
02:32
<@McMartin>
You asked for suggestions for a programming project, and that you didn't have any problems you needed to solve (always the best first choice)
02:32
< Tarinaky>
As I say. I was really trying to see if: 1) anyone wanted to do a competition and 2) angling for hints on the specific problem I'd had in the past.
02:32
<@ToxicFrog>
A competition?
02:33
< Tarinaky>
Well... People suggested a game so I dug out the Roguelike example.
02:33
<@ToxicFrog>
As in an ifcomp or icfp style thing?
02:33
< Tarinaky>
I have no idea what those are.
02:33
< Tarinaky>
>.> I've probably been far too meandering in the conversation. Sorry.
02:33
< Tarinaky>
It is something I tend to be, lol.
02:34
<@McMartin>
ifcomp is the annual Interactive Fiction competition, where people submit entries that are then judged.
02:34
<@McMartin>
I'm unfamiliar with ICFP.
02:34
<@ToxicFrog>
International Conference on Functional Programming Annual Competition.
02:34
< Tarinaky>
Well... More what I meant was just... having someone to compare lines of code written with... as a sort of... encouragement :/
02:34
<@ToxicFrog>
"compare lines of code written with"?
02:34
< Tarinaky>
Since that worked quite well when me and Anno were both trying to make Roguelikes.
02:34
<@ToxicFrog>
As in...line counts?
02:34
< Tarinaky>
We were both... yeah.
02:35
<@ToxicFrog>
Wouldn't features implemented be a more relevant metric?
02:35 * ToxicFrog confusions
02:35
< Tarinaky>
It would probably. It's just that'd require me to have better analysis skills than I have.
02:35
< Tarinaky>
In the end it was the line-count that ended up being important to me.
02:35
<@McMartin>
I'd suggest sharpening those first, then - if you don't know what you're writing, no design in the world will get you there.
02:36
<@McMartin>
Building a roadmap and then turning it into a TODO list would be my first step.
02:36 andy [andy@Nightstar-27d904c2.511.iinet.com] has left #code []
02:36
< Tarinaky>
McMartin: I had a roadmap. It's just the roadmap was usually wrong.
02:36
< Tarinaky>
Chicken and egg - which comes first... the practise or the skills needed to do it?
02:39
<@McMartin>
They feed on each other. Alternate.
02:39
<@McMartin>
If you don't know what to do next, it's clearly design's turn.
02:40
< Tarinaky>
Yes... it's just if the roadmap's... fluid it's not a very helpful gauge of progress.
02:40
< Tarinaky>
:/
02:40
< Tarinaky>
What can I say. I just suck at this >.<
02:41
<@McMartin>
This feels more like a case of unrealistic expectations, or an unwillingness to explore outside of specifically defined domains
02:45
< Tarinaky>
:/
02:46
<@McMartin>
You have a next step. If it seems too large, cut pieces out until it's 2-3 days of work tops. Do that. Determine next step.
02:46
< Tarinaky>
It's difficult to judge how big a task is though.
02:46
<@McMartin>
If at any point you do not know what the next step is, it is either (a) declare victory and be done or (b) refine your design until there is a next implementation step
02:46
< Tarinaky>
Particularly when the solution is unknown.
02:46
< Tarinaky>
:/
02:46
<@McMartin>
OK, so make it "if I knew what I was doing, this would be doable in one day."
02:47
<@McMartin>
Then expect it to take a week.
02:47
<@McMartin>
Also, lists can be hierarchical.
02:48
<@McMartin>
If your next step is "there should be attackable monsters", that's probably going to have a bunch of substeps.
02:48
<@McMartin>
Like, "There should be monsters on the map." "They should move." "They should have stat blocks."
02:49
<@McMartin>
And then that last one turns into "stats have to exist" and that's a prereq for "there needs to be a combat model."
03:31
< Tarinaky>
Well... atm I'm trying to remember everything I was told wrt having a logger.
03:31
< Tarinaky>
:/
03:53
<@Derakon>
Programming is a series of tiny steps that combine to make something big.
03:53
<@Derakon>
It's a long process.
03:55
<@Derakon>
Hm. McM is advocating a top-down design, it sounds like.
03:55
<@Derakon>
For personal projects I generally do bottom-up, though.
03:55
<@Derakon>
Which is to say, I think of the thing that I consider most central to the project concept, and I work on that first. Then I build out the other needed components from there.
03:56
<@Derakon>
For example, for Jetblade the first thing I did was start working on the map generation, since procedural mapgen is the core concept of Jetblade.
03:56
<@Derakon>
By starting with these concepts, I help maintain my own interest level.
03:59
<@McMartin>
Oh hey
03:59
< Reiv[Graduate]>
I tend to attempt top-down design, but unfortunately I failed to take a course in program specification design.
03:59 * McMartin is in late, but a VP brought pizza in.
03:59
< Reiv[Graduate]>
I really, really need to read up on it.
04:00
< Tarinaky>
Okay... I've made an attempt at a logger...
04:00
< Tarinaky>
It's been ages since I programmed so between that and everything else I have zero faith in it >.<
04:01
<@McMartin>
Faith is misplaced. Trust but verify
04:01
<@McMartin>
Actually, no. Just verify.
04:02
< Tarinaky>
Uhh... Okay. I've got a singleton template. I've explicitly declared a dummy copy constructor as private because... well.
04:02
< Tarinaky>
Compiler's giving me a warning on it though :/
04:02
<@McMartin>
what warning?
04:02
< Tarinaky>
singleton.hpp:10: error: invalid constructor; you probably meant singleton<X> (const singleton<X>&)
04:03
<@McMartin>
And you have...
04:03
< Tarinaky>
singleton(singleton) {} //Copy constructor
04:03
<@McMartin>
And singleton is a template?
04:03
< Tarinaky>
Yes.
04:03
<@McMartin>
Study your messages.
04:03
<@McMartin>
The question is, in itself, an answer, containing the information you seek
04:04
<@McMartin>
And more!
04:04
< Tarinaky>
I'm missing something fundamental I'm sure... Why does the argument have to be a reference?
04:05
< Tarinaky>
I mean. If it wasn't a dummy function I know why I'd want to make it a reference but that's besides the-...
04:05
< Tarinaky>
Oh wait. Never mind.
04:05
< Tarinaky>
I'm an idiot >.>
04:05
<@McMartin>
Template arguments are part of the type name, yes.
04:06
<@McMartin>
And you want it to be a const reference because otherwise you're calling a copy constructor on the way in.
04:06
< Tarinaky>
Yeah. It took me a moment to twig that. >.>
04:06
< Tarinaky>
I did say I was terrible :p
04:07
<@McMartin>
The thing is, singleton<x> (singleton<x>) isn't intrinsically an error.
04:07
<@McMartin>
But you really don't want to do it even in cases where it would produce a semantic feedback loop the way it does for singletons.
04:09
<@McMartin>
As a general principle, though, if you're passing an object in and you aren't planning on changing it, const X& is almost always better than X. std::string is a very common case of this.
04:10
< Tarinaky>
Oh I know.
04:10
< Tarinaky>
It's just since it was a private dummy that should nevereverever be called.
04:10
<@McMartin>
Right; that's not the error, though, or the reason it complained.
04:10
< Tarinaky>
No. But the general principle...
04:11
<@McMartin>
Is valid, yes. (These kinds of gotchas are also part of why C++ isn't the greatest first language)
04:11
< Tarinaky>
Tough. It was my first language and I'll just have to learn to put up with the headache since~
04:11
<@McMartin>
Pretty much.
04:12
<@McMartin>
Also, doing things like having singletons via hiding constructors is at least possible.
04:12
<@McMartin>
... are you using Boost, by the way?
04:12
< Tarinaky>
No. I am not.
04:13
<@McMartin>
OK
04:13
<@McMartin>
Because if you were, the *real* solution would be to derive from boost::noncopyable.
04:13
<@McMartin>
Are you making use of multiple inheritance amongst your singletons?
04:14
< Tarinaky>
I... struggle to see how polymorphism is the real solution to anything.
04:14
<@McMartin>
Good.
04:14
<@McMartin>
C++ has some wildly crazy aspects that mean you have to do some fairly illogical things if you mix a standard singleton class with multiple inheritance.
04:14
<@McMartin>
So you can ignore those.
04:15
< Tarinaky>
I'm not entirely sure what my logger should be doing to be honest.
04:15
<@McMartin>
A basic logger would just be Logger::log(std::string).
04:16
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/master/logger.cpp
04:16
<@McMartin>
A more sophisticated one would let you have the logger be a drop-in replacement for any std::ostream
04:17
<@McMartin>
I guess that's one way to do it.
04:17
<@McMartin>
Stylistic nitpick: static to mean "this variable doesn't escape this file" is a C-ism; the preferred C++ approach is anonymous namespaces.
04:18
<@McMartin>
Other than that, LOGFILE should probably be a member of the logging class.
04:19
< Tarinaky>
I thought implementation was supposed to be seperate from interface?
04:19
<@McMartin>
Yes, but (a) C++ is intrinsically bad about this, and (b) using global variables is not how you enforce that.
04:20
<@McMartin>
The way you separate them, if you're going to separate them like that, is to have a class ILogger that is also uncopyable and that defines operator()(ILogger::loglevel, std::string) as a pure virtual function
04:21
<@McMartin>
And then define Logger to derive from that. Only the ILogger is then exposed to everyone else, and the function that creates the logger everyone uses is the only function with access to the Logger class proper.
04:21
<@McMartin>
So that's (b)
04:21
<@McMartin>
As for (a), C++ has as an iron requirement that the size of the class be exposed to everyone who uses the class, so that aspect of the interface/implementation divorce simply cannot be done in C++.
04:22
<@McMartin>
If you aren't going to two-layer approach, you have to expose the existence of fields, even if they're inaccessible.
04:22
<@McMartin>
(Also note that going the ILogger/LoggerImpl route means that nobody can ever declare that class as a local variable, and they are forced to always use pointers.)
04:23
<@McMartin>
If you're deliberately eschewing polymorphism, I'd go with the "put the private fields in the .h files everyone uses."
04:24
<@McMartin>
Just remember that changing an implementation will then result in a longer compile time since it adds dependencies across the code.
04:26
< Tarinaky>
Actually. Just realised I'd forgotten to flush buffers anyway.
04:26
< Tarinaky>
:x
04:26
<@McMartin>
Best to flush at the end of operator().
04:30
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/master/logger.hpp http://github.com/Tarinaky/coulomb/blob/master/logger.cpp
04:32
< Tarinaky>
Better?
04:35
<@McMartin>
Much. Only change I'd make would be to put all the #includes up top.
04:36
< Tarinaky>
While we're here might as well ask for critique on my singleton template :x
04:36
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/master/singleton.hpp
04:37
< Tarinaky>
Also: just spotted the error on line 2 myself, please ignore it >.>
04:41
<@McMartin>
It's a *little* skeevy because ideally you don't construct it until first use.
04:42
< Tarinaky>
I thought as it was it wasn't?
04:42
<@McMartin>
"static X Data;"
04:42
<@McMartin>
I believe the compiler's allowed to construct Data at program start
04:43
< Tarinaky>
My understanding of how static works is it only initialises Data when it encounters that statement for the first time.
04:43
< Tarinaky>
:/
04:43
<@McMartin>
Given that you aren't multithreaded, it doesn't matter
04:43
<@McMartin>
And since I don't generally use in-function statics I can't say for sure
04:43
< Tarinaky>
Well... If it's not right I might as well be just using global variables though :/
04:43
< Tarinaky>
I thought in-function statics was basically how you were meant to do it >.<
04:44
<@McMartin>
Replace those two lines with "m_Data = new X()" and you're entirely golden.
04:44
<@McMartin>
Assuming I'm not mentally simulating it wrong, which, given that I'm doing like three things at once here, I could be doing.
04:45 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
04:46
< Tarinaky>
If I did that each instance of the singleton would have different instances.
04:47
<@McMartin>
Ah, I misinterpreted your use case.
04:47 shade_of_cpux is now known as cpux
04:47
<@McMartin>
if you're a singleton, *all* constructors are private, and there's a public static method that returns the instance.
04:48
<@McMartin>
It, being part of the class, gets to call the constructor if needed.
04:48
<@McMartin>
m_Data starts NULL, and then gets assigned new X() by the instance() method if required.
04:49
<@McMartin>
That's the usual technique, anyway.
04:50
<@McMartin>
It's been a long time since I read up on the rules of template instantiation, but I'm not positive that you're guaranteed that any given template will be expanded exactly once.
04:50
< Tarinaky>
How do you call the method if you can't construct it? :x
04:50
< Tarinaky>
Oh no.
04:50
<@McMartin>
static methods don't require an instance.
04:50
<@McMartin>
X* singleton<X>::instance() {}
04:50
< Tarinaky>
I want and am expecting singleton<X> to have a different instance to singleton<Y>.
04:51
<@McMartin>
Not what I mean.
04:51
<@McMartin>
I mean you have singleton<X> in five files and get five different instances.
04:51
< Tarinaky>
Ahh.
04:51
<@McMartin>
I don't recall if the standard has requirements on this, and if it does, I don't know how widely compliant compilers are.
04:52 * McMartin has an article on exactly the issues with Singletons at home, can dig it up once he gets home.
04:58 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
04:58
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/master/singleton.hpp http://github.com/Tarinaky/coulomb/blob/master/singleton.cpp
05:00 Vornicus-Latens [vorn@ServerAdministrator.Nightstar.Net] has joined #code
05:00 mode/#code [+o Vornicus-Latens] by Reiver
05:35 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
06:24 Vornicus-Latens is now known as Vornicus
06:41 Derakon is now known as Derakon[AFK]
06:43 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
07:14 You're now known as TheWatcher
07:29 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has quit [Client closed the connection]
07:32 * TheWatcher eyes that singleton code, responds with http://pastebin.starforge.co.uk/303
07:34
<@McMartin>
Oh, right, I was going to dig up that article. Let's see here.
07:34
<@McMartin>
Oh. It's exactly that~
07:34
<@TheWatcher>
Yep
07:35
<@McMartin>
That doesn't have the MI-handling code though
07:35
<@McMartin>
It also doesn't have init-on-first-use.
07:36
<@TheWatcher>
Um
07:36 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has joined #code
07:38 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has quit [Connection reset by peer]
07:38
<@McMartin>
There it is, page 38
07:39
<@McMartin>
You aren't guaranteed that a statically-cast pointer is to the same place
07:39
<@McMartin>
May I edit with an update?
07:39
<@TheWatcher>
Sure, please do
07:43
<@TheWatcher>
(also, I tend to prefer explicit initialisation, mostly out of habit and style, I guess - I find it sits easier with me than relying on init on first use)
07:43
<@McMartin>
http://pastebin.starforge.co.uk/304
07:44
<@McMartin>
Now to quote for why the hideousness on line 43-44
07:45
<@McMartin>
"Note that the derived class could be deriving from more than just the Singleton, in which case "this" from MyClass might be different from the Singleton "this". The solution is to take a nonexistent object... cast it to both types, and see the difference. This difference will effectively be the distance between Singleton <MyClass> and its derived type MyClass, which it can use to calculate the singleton pointer."
07:45 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has joined #code
07:45
<@McMartin>
An unnecessary precaution in Tirianky's case, since he is eschewing MI
07:45
<@McMartin>
One of several reasons MI is not only full of but made of spiders
07:46
<@McMartin>
Also, if you don't have GPG1, I recommend it; it's one of the finest general-purpose manuals of tricks I own.
07:46
<@McMartin>
The later volumes are really only of interest to the game industry's equivalent of "enterprise software", though.
07:47
<@McMartin>
GPG2 *might* be of general interest
07:47
<@McMartin>
Haven't found too much of use in any of the next 6
07:47
<@McMartin>
(yay bookstore browsing >_>)
07:49
<@McMartin>
But more than half of GPG1 is high-powered general-purpose CS with wide general utility.
07:49
<@McMartin>
It's also what finally taught me quaternions. >_>
07:50
<@McMartin>
Hmmmm
07:50
<@McMartin>
Actually
07:50
<@McMartin>
Studying the horrendousness added
07:51
<@McMartin>
static_cast<> properly implemented may make it unnecessary
07:51
<@McMartin>
This calls for both some Science and some reference chasing.
07:58 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
08:00 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
08:00 mode/#code [+o Vornicus] by Reiver
08:02
<@McMartin>
Yeah, OK, I think your initial code should work.
08:04
<@McMartin>
In fact, even a C-style cast should work
08:09 AnnoDomini [annodomini@Nightstar-16d1b861.adsl.tpnet.pl] has joined #code
08:09 mode/#code [+o AnnoDomini] by Reiver
08:13
< Tarinaky>
'assert'?
08:14
<@McMartin>
function "assert(x)" evaluates x and crashes the program if x is false.
08:15
<@McMartin>
To crash because of such a function is "to assert"
08:15
<@McMartin>
The crash itself is called an "assertion failure"
08:16
<@TheWatcher>
assert is your friend, especially if you replace it with your own version that provides decent failure messages, stack graces, and ignore features
08:16
<@TheWatcher>
*traces
08:16
< Tarinaky>
Also, brb shower.
08:17
<@McMartin>
Super-asserts and stack traces and the rest are also covered in detail in GPG1 - specifically, Chapter 1.12, pp. 109-114.
08:18
<@McMartin>
A couple sleazy tricks from it:
08:19
<@McMartin>
All constant strings evaluate to true; this means you can assert(x && "FunctionFoo() has exploded because x isn't allowed to be NULL, but it was");
08:20 You're now known as TheWatcher[afk]
08:32
< Tarinaky>
I don't have GPG and neither does the library so yeah >.>
08:35
<@McMartin>
If you can scare up a copy of "Effective C++" by Scott Meyers it'll put you in good stead too~
08:36
< Tarinaky>
Read it.
08:37
< Alek>
oooo
08:38
< Alek>
what's GPG?
08:41
< Tarinaky>
Why is it that you always have bullshit lectures the mornings you most want to curl up in bed?
08:41
< Tarinaky>
-.-
08:48
<@Vornicus>
Game Programming Gems
08:58 Orth [orthianz@Nightstar-7fa2d86f.xnet.co.nz] has joined #code
09:01 Reiv[Graduate] [orthianz@Nightstar-a2aa700d.xnet.co.nz] has quit [Ping timeout: 121 seconds]
09:09
<@McMartin>
It's a very long-running series.
09:09
<@McMartin>
I'd consider the first one a must-read, the second one an interesting read, and the rest a useful reference if you're writing an engine and happen to need some of the tricks they pull
09:51 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
10:43 Vornicus is now known as Vornicus-Latens
10:43 Vornicus-Latens [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
10:46 Vornicus-Latens [vorn@ServerAdministrator.Nightstar.Net] has joined #code
10:46 mode/#code [+o Vornicus-Latens] by Reiver
11:09 Orth [orthianz@Nightstar-7fa2d86f.xnet.co.nz] has quit [Client closed the connection]
11:17 Orth [orthianz@Nightstar-72203f4d.xnet.co.nz] has joined #code
11:19 You're now known as TheWatcher
12:50 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
13:04 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
13:34 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has quit [Client exited]
13:46 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
13:58 Zed [Zed@Nightstar-e4835f03.or.comcast.net] has quit [Ping timeout: 121 seconds]
13:59 Zed [Zed@Nightstar-e4835f03.or.comcast.net] has joined #code
14:01 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
14:37 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
15:20
< gnolam>
http://www.youtube.com/watch?v=zX09WnGU6ZY
17:01 Attilla [Attilla@Nightstar-c8f896b1.threembb.co.uk] has joined #code
17:01 mode/#code [+o Attilla] by Reiver
17:44 aoanla [AndChat@37647E.0002A6.410380.1CF395] has joined #code
18:10 AnnoDomini [annodomini@Nightstar-16d1b861.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
18:11 aoanla [AndChat@37647E.0002A6.410380.1CF395] has quit [[NS] Quit: ]
18:12 AnnoDomini [annodomini@Nightstar-4de42d90.adsl.tpnet.pl] has joined #code
18:12 mode/#code [+o AnnoDomini] by Reiver
18:53 Orth [orthianz@Nightstar-72203f4d.xnet.co.nz] has quit [Client closed the connection]
18:59 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has joined #code
19:05 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has quit [Client closed the connection]
19:11 Alek [omegaboot@Nightstar-c5f3565b.il.comcast.net] has quit [Ping timeout: 121 seconds]
19:12 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has joined #code
19:17 Alek [omegaboot@Nightstar-c5f3565b.il.comcast.net] has joined #code
19:19 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has quit [Client closed the connection]
19:21 Alek [omegaboot@Nightstar-c5f3565b.il.comcast.net] has quit [Ping timeout: 121 seconds]
19:25 Alek [omegaboot@Nightstar-c5f3565b.il.comcast.net] has joined #code
--- Log closed Fri Jun 04 19:33:54 2010
--- Log opened Fri Jun 04 19:34:07 2010
19:34 TheWatcher [chris@Nightstar-b4529b0c.zen.co.uk] has joined #code
19:34 Irssi: #code: Total of 22 nicks [8 ops, 0 halfops, 0 voices, 14 normal]
19:34 mode/#code [+o TheWatcher] by Reiver
19:34 Irssi: Join to #code was synced in 53 secs
19:52 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has joined #code
19:55 Vornicus-Latens is now known as Vornicus
20:36 Rhamphoryncus [rhamph@Nightstar-bbc709c4.abhsia.telus.net] has joined #code
21:16 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
21:21 Attilla_ [Attilla@Nightstar-ba4b7094.threembb.co.uk] has joined #code
21:22 Attilla [Attilla@Nightstar-c8f896b1.threembb.co.uk] has quit [NickServ (GHOST command used by Attilla_)]
21:22 Attilla_ is now known as Attilla
21:59 Reiv[Graduate] [orthianz@Nightstar-72203f4d.xnet.co.nz] has quit [Ping timeout: 121 seconds]
22:03 cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
22:09 Serah [Z@2C3C9C.B2A300.F245DE.859909] has joined #code
23:57 shade_of_cpux [Moo@Nightstar-20a84089.dyn.optonline.net] has joined #code
23:57 shade_of_cpux is now known as cpux
--- Log closed Sat Jun 05 00:00:24 2010
code logs -> 2010 -> Fri, 04 Jun 2010< code.20100603.log - code.20100605.log >