code logs -> 2014 -> Wed, 01 Jan 2014< code.20131231.log - code.20140102.log >
--- Log opened Wed Jan 01 00:00:36 2014
00:05 * Derakon eyes Pyrel's code.
00:05
<&Derakon>
I find myself in some Proc-resolution code, needing to request targeting information from the user.
00:06
<&Derakon>
In my original implementation of the Prompt system (which asks the user for info), I used threads, and as a result I could suspend one thread's execution to resolve a Prompt.
00:06
<&Derakon>
Some helpful user came in and went "No, no, coroutines are much better for this" and reimplemented the Prompt system with same.
00:06
<&Derakon>
AIUI this means that any time I want to suspend thread execution I have to use yield statements throughout the entire call chain, though.
00:06
<&Derakon>
This is...not ideal.
00:07
<&Derakon>
(Basically I want to be able to do "target = gui.prompt.resolvePrompt(gui.prompt.TargetPrompt())" and have resolvePrompt handle the different-execution-context hackery.
00:07
<&Derakon>
)
00:58 Turaiel is now known as Turaiel[Offline]
01:20 AnnoDomini [AbuDhabi@Nightstar-1apnlb.adsl.tpnet.pl] has joined #code
01:23 AnnoDomi1i [AbuDhabi@Nightstar-9p85ee.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
01:25 Vornicus [Vorn@Nightstar-sn7kve.sd.cox.net] has joined #code
01:26 mode/#code [+qo Vornicus Vornicus] by ChanServ
01:52 ErikMesoy is now known as ErikMesoy|sleep
02:09 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
04:29 Turaiel[Offline] is now known as Turaiel
05:07 Syka [the@Nightstar-and.d0v.127.1.IP] has joined #code
05:45 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
06:19 * Vornicus gnaws on various bits of code
06:24 Turaiel is now known as Turaiel[Offline]
06:24 celticminstrel [celticminst@Nightstar-qargh6.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:35 Turaiel[Offline] is now known as Turaiel
06:54 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.]
06:58 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has joined #code
07:12 Turaiel is now known as Turaiel[Offline]
07:40 Syka [the@Nightstar-and.d0v.127.1.IP] has quit [Ping timeout: 121 seconds]
09:30 Syka [the@Nightstar-rb0.2vi.131.1.IP] has joined #code
09:58 Vornicus [Vorn@Nightstar-sn7kve.sd.cox.net] has quit [Connection closed]
10:34 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
11:19 ErikMesoy|sleep is now known as ErikMesoy
11:51 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has quit [Ping timeout: 121 seconds]
11:55 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has joined #code
11:55 mode/#code [+o Orthia] by ChanServ
13:14 AnnoDomi1i [AbuDhabi@Nightstar-1apnlb.adsl.tpnet.pl] has joined #code
13:16 AnnoDomini [AbuDhabi@Nightstar-1apnlb.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
13:38 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has joined #code
13:51 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
14:11 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has quit [Ping timeout: 121 seconds]
14:15 gnolam [lenin@Nightstar-lgrapr.tbcn.telia.com] has joined #code
14:15 mode/#code [+o gnolam] by ChanServ
14:23 Lurtz [Lurtz@Nightstar-2lo.fq2.228.194.IP] has joined #code
14:46 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
14:49 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has quit [Ping timeout: 121 seconds]
14:53 redwire [redwire@Nightstar-ohmu6b.eastlink.ca] has joined #code
15:13 redwire [redwire@Nightstar-ohmu6b.eastlink.ca] has quit [[NS] Quit: My MacBook has gone to sleep. ZZZzzzâ¦]
15:21 Stalker [Z@Nightstar-ro94ms.balk.dk] has joined #code
15:27
<&ToxicFrog>
Derakon: what do you mean by "yield statements throughout the entire call chain"?
15:27
<&ToxicFrog>
I would expect it to be something like:
15:27
<&ToxicFrog>
- you call gui.prompt.resolvePrompt()
15:27
<&ToxicFrog>
- that yields
15:28
<&ToxicFrog>
- once the gui has an answer, it resumes this coroutine, gui.prompt.resolvePrompt() returns, and execution continues normally
15:55
<&Derakon>
Mm, my understanding was that you had to propagate the yield all the way to the top.
15:55
<&Derakon>
That is, if you call foo, which calls bar, which yields, then foo must invoke bar via "for i in bar(): yield i".
15:55
<&Derakon>
In order to get out of that execution context.
15:55
<&ToxicFrog>
If this is the case, then when you are using are not actually coroutines.
15:55
<&Derakon>
I may well be misunderstanding.
15:56
<&ToxicFrog>
Or are coroutines so overconstrained as to be useless except as simple iterators.
15:56
<&Derakon>
Python Coroutines are in fact an unexpected consequence of the way generator functions work, not something that was actually planned for.
15:56
<&ToxicFrog>
So, formally, a coroutine supports one action, resume(coroutine, ...) which suspends execution of the caller and begins/resumes execution of the callee.
15:57
<&ToxicFrog>
In most implementations, you also get yield(...), which is eqv to resume(who_resumed_me(), ...)
15:57
<&Derakon>
Right, I get how coroutines are supposed to work.
15:57
<&Derakon>
It's how they work syntactically in Python that trips me up.
15:57
<&ToxicFrog>
Aah.
15:59
<&ToxicFrog>
PEP 0342 seems to be the relevant literature.
16:00
<&ToxicFrog>
Eurgh
16:01
<&Derakon>
"Also, generators cannot yield control while other functions are executing, unless those functions are themselves expressed as generators, and the outer generator is written to yield in response to values yielded by the inner generator. This complicates the implementation of even relatively simple use cases like asynchronous communications, because calling any functions either requires the
16:01
<&Derakon>
genrator tor "block" (i.e. be unable to yield control), or else a lot of boilerplate looping code must be added around every needed function call."
16:01
<&Derakon>
That's what I was talking about
16:01
<&ToxicFrog>
Right. But that's listed as one of the limitations they want to fix.
16:01
<&Derakon>
Yeah.
16:02
<&ToxicFrog>
Is this PEP not actually implemented?
16:02
<&Derakon>
It's at least partially-implemented, as yield exists.
16:02
<&ToxicFrog>
yield-as-an-expression, you mean?
16:02
<&Derakon>
Yeah.
16:02
<&ToxicFrog>
02
16:02
<&Derakon>
It's a Python keyword.
16:03
<&ToxicFrog>
36666666666666666666666666666666666666666666666666666666666666666666666666666666 666
16:03
<&Derakon>
\o/ ?
16:03
<&ToxicFrog>
]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\10999ni
16:03
<&Derakon>
\o/ .
16:03
<&ToxicFrog>
Thank you, kitten
16:03
<&ToxicFrog>
I should get up and feed them
16:03
<&ToxicFrog>
Anyways, yes, but it was a keyword before this PEP, it just couldn't be used as an expression.
16:03
<&Derakon>
...I don't understand.
16:04
<&Derakon>
Oh, the difference between "yield" and "yield x"?
16:04
<&Derakon>
Oh wait, no...I think I see.
16:04
<&Derakon>
Inside the generator, doing receivedValue = yield
16:05
<&ToxicFrog>
No, the fact that you can do 'x = yield y' and get a result back when the coroutine is resumed.
16:05
<&ToxicFrog>
Which is kind of vital for most uses of coroutines.
16:06
<&ToxicFrog>
The existence of the 'greenlet' library ca. 2011 implies that either this PEP isn't implemented (or wasn't then) or that the changes are sufficiently cumbersome to use that there's a use for a library on top of them.
16:06
<&Derakon>
>>> def foo():
16:06
<&Derakon>
... sum = 0
16:06
<&Derakon>
... for i in xrange(3):
16:06
<&Derakon>
... sum += yield
16:06
<&Derakon>
... print sum
16:06
<&Derakon>
...
16:06
<&Derakon>
>>> foo()
16:06
<&Derakon>
<generator object foo at 0x1004a7730>
16:06
<&Derakon>
>>> foo.send(5)
16:06
<&Derakon>
Traceback (most recent call last): File "<stdin>", line 1, in <module>
16:06
<&Derakon>
AttributeError: 'function' object has no attribute 'send'
16:07
<&Derakon>
Oh, dur.
16:07
<&Derakon>
I'm stupid.
16:08
<&Derakon>
bar = foo(); bar.next(); bar.send(5); bar.send(3); bar.send(1)
16:08
<&Derakon>
9
16:08
<&Derakon>
So that does work.
16:21
<&ToxicFrog>
Hmm. But can you yield from nested calls?
16:25
<&ToxicFrog>
Ok, it looks like next() returns the first value yielded, and send() returns the value of the next yield
16:26
<&ToxicFrog>
So even if you can't yield across frames you have everything you need
16:26
<&ToxicFrog>
just send() to the coroutine you want to yield to, and ignore yield entirely
16:28
<&Derakon>
I think that the I/O and execution stuff in Pyrel will need a bit of a rewrite in any case, since I don't understand it~
16:29
<&ToxicFrog>
(this conversation neatly illustrates why the more I use python, the less I like it~)
16:30
<&Derakon>
At this point I have something like five years invested in Python, so it's my Lua~
16:31
<&Derakon>
(From your perspective, that is)
16:35
<&ToxicFrog>
I'm actually using Lua less and less these days except for emufun~
16:38
<&Derakon>
What do you work in instead?
16:41
<&ToxicFrog>
Clojure.
16:41
<&ToxicFrog>
Or Python, at work, hence my increasing frustrating with it.
16:42
<&Derakon>
I really ought to be trying out more languages...
16:42
<&Derakon>
Problem being that most of my projects are pretty long-established and/or group efforts.
16:42
<&ToxicFrog>
(or C++ at work, but I already know I don't like that)
16:42
<&Derakon>
Heh.
16:42
<&Derakon>
C++ is at least predictable~
16:42
<&Derakon>
In the sense that you know exactly what you're getting into when you have to work in it.
16:43
<&ToxicFrog>
I want to learn Go and Rust at some point, but I'm pretty much saturated at my current project load, and there's at least one more clojure project I want to write first.
16:43
<@froztbyte>
eh
16:43
<@froztbyte>
I wouldn't agree with that
16:43
<@froztbyte>
I'd agree with "you know it'd be unpleasant"
16:43
<@froztbyte>
but not what specific horrors you'll run into
16:46
<&Derakon>
Anyway, I'ma disappear for awhile. Thanks for the assistance, TF.
16:46 Derakon is now known as Derakon[AFK2]
17:36 redwire [redwire@Nightstar-ohmu6b.eastlink.ca] has joined #code
17:49 Syka [the@Nightstar-rb0.2vi.131.1.IP] has quit [Ping timeout: 121 seconds]
17:55 Turaiel[Offline] is now known as Turaiel
18:23 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has joined #code
18:51 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has quit [Ping timeout: 121 seconds]
19:00 * TheWatcher eyes this, ....s
19:01
<@TheWatcher>
Memory overwrites, some of my favourite things.
19:16 Turaiel is now known as Turaiel[Offline]
19:38 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has joined #code
19:44
<@froztbyte>
haha
19:45
<&ToxicFrog>
Oh, fuck Java
19:45
<&ToxicFrog>
'lein run': works fine
19:45
<&ToxicFrog>
'java -jar foo.jar': no output.
19:45 Vornicus [Vorn@Nightstar-sn7kve.sd.cox.net] has joined #code
19:45 mode/#code [+qo Vornicus Vornicus] by ChanServ
19:45
<&ToxicFrog>
Add (flush) to the end: jar version works fine.
19:46
<@froztbyte>
it's enturdprise grade
19:46
<&ToxicFrog>
Apparently, System.out defaults to being really aggressively buffered, rather than line-buffered, and the buffer is silently discarded at program exit rather than flushed.
19:46
<@froztbyte>
stop complaining, puny mortal
19:46 * froztbyte hides
19:46
<&ToxicFrog>
Even if System.out is connected to a terminal.
19:50 Lurtz [Lurtz@Nightstar-2lo.fq2.228.194.IP] has left #code ["Leaving"]
19:55 * Derakon[AFK2] returns to the coroutine problem.
19:55 Derakon[AFK2] is now known as Derakon
19:55
<&Derakon>
This is a rough approximation of what I'm trying to do: http://pastebin.starforge.co.uk/612
19:55
<&Derakon>
Unfortunately, it gives me this error:
19:55
<&Derakon>
Traceback (most recent call last):
19:55
<&Derakon>
File "test.py", line 22, in <module>
19:55
<&Derakon>
main()
19:55
<&Derakon>
File "test.py", line 5, in main
19:55
<&Derakon>
runner.next()
19:55
<&Derakon>
AttributeError: 'NoneType' object has no attribute 'next'
19:55
<&Derakon>
In order to fix it, AIUI I would have to make the contents of sub() be "for i in sub2(): yield i".
19:56 redwire [redwire@Nightstar-ohmu6b.eastlink.ca] has quit [[NS] Quit: Textual IRC Client: www.textualapp.com]
20:04
<&ToxicFrog>
Derakon: so, the issue here is that send() is basically resume() but yield is crippled.
20:04
<&ToxicFrog>
I think the way around this is to turn main into a coroutine and never use yield ever, just send between coros.
20:04
<&ToxicFrog>
And then your actual __main__ just goes main().next(argv)
20:06
<&Derakon>
But in order for send to work, there has to be a corresponding yield, right?
20:06
<&Derakon>
Because the value provided by send is the value returned by yield.
20:08
<&ToxicFrog>
send suspends the caller's execution, though, right? What happens if a calls b.send() and then b calls a.send()?
20:10 celticminstrel [celticminst@Nightstar-qargh6.dsl.bell.ca] has joined #code
20:10 mode/#code [+o celticminstrel] by ChanServ
20:11 * ToxicFrog gotests
20:15
<&ToxicFrog>
Cocks
20:15
<&Derakon>
TF: how do either of them get the value sent?
20:15
<&ToxicFrog>
It dies with "generator already running"
20:15
<&ToxicFrog>
So send is not in fact isomorphic with resume
20:16
<&ToxicFrog>
Derakon: send would return it just as it returns the values returned by yield if this actually worked but it doesn't.
20:16
<&Derakon>
Ah.
20:16
<&Derakon>
Alas.
20:17
<&ToxicFrog>
Er, values passed to yield.
20:18 * Derakon heads over to #python then.
20:18
<&Derakon>
Here's hoping I can navigate the storm.
20:18 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has quit [A TLS fatal alert has been received.]
20:18 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has joined #code
20:23
<&ToxicFrog>
Actually, question about the "switched it to coroutines"
20:23
<&ToxicFrog>
How did they do that since, as far as we can determine, coroutines in python don't actually work?
20:26
< Xon>
Async Tasks in C# have some rather sharp and nasty edges before .NET 4.5.1
20:26
<&ToxicFrog>
This isn't going well.
20:27
< Xon>
ToxicFrog, python coroutines do sound horribly limited
20:27
<&Derakon>
TF: they did it in the "for i in func(): yield i" sense.
20:27
<&Derakon>
Which works as far as you plumb the yield statements.
20:29
<&ToxicFrog>
Derakon: right, what I mean is that they don't even seem to grasp that "coroutines" are a more general and powerful concept than that and that that's what you want
20:31
<&Derakon>
Ah, yeah.
20:31
<&Derakon>
It's really sounding like I should just revert to my thread-based system.
20:32
< Xon>
Derakon, that level of implementation is rather worthless
20:32
<&Derakon>
Maybe hook in the event-processing module I wrote, do it with publish/subscribe.
20:32
<&Derakon>
Xon: I know!
20:37
< Xon>
Derakon, almost as fun as finding out the .NET 4.5 Async DB stuff is utterly unusable with the scoped transaction stuff which is the recommended way todo transactions without managing the raw connection objects yourself
20:45 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has quit [Ping timeout: 121 seconds]
20:47
<&Derakon>
Xon: uh, sure?
21:05 ErikMesoy is now known as ErikMesoy|sleep
21:40 ErikMesoy|sleep [Erik@Nightstar-3kot9q.80-203-17.nextgentel.com] has quit [Connection closed]
21:52 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has joined #code
22:11 Draak [Godbehere@Nightstar-hl453o.zing-net.ca] has quit [Ping timeout: 121 seconds]
22:19 ErikMesoy [Erik@Nightstar-ekm.o7n.203.80.IP] has joined #code
22:26 * Alek pokes Tora.
22:29
<@Alek>
ugh. Steam is lagging.
22:30
<@Alek>
some things load fast, some load slow, and some don't load at all - it just can't add a game to cart. -_-
22:44 Stalker [Z@Nightstar-ro94ms.balk.dk] has quit [Ping timeout: 121 seconds]
22:45
<@celticminstrel>
I hope it fixes soon, I'd like to get Hammerwatch.
22:47 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has joined #code
22:47 mode/#code [+o Orthia] by ChanServ
22:53
<@celticminstrel>
On a mostly unrelated note, I'm mildly annoyed that it won't let me get the cards from voting.
22:54
<&McMartin>
That happened in the summer sale too; IIRC they backfilled it after the servers calmed down.
23:05
<@celticminstrel>
If you mean cards, it won't let me because of Steam Level. Which, as far as I can tell, is next to impossible to raise intentionally.
23:06
<&McMartin>
oh
23:07
<@celticminstrel>
If I did manage to raise it, then it would backfill, but there doesn't seem to be any viable way to do that.
23:07
<&McMartin>
IIRC you can gain 2 levels from doing all the non-Facebook-y things in Pillar of the Community, and then the rest involves messing around with games with cheap cards on the marketplace.
23:08
<@celticminstrel>
Though it's impossible for Pillar of the Community to be your first badge, and also impossible to get it at all if you don't have Facebook.
23:09
<&McMartin>
That latter is not true.
23:09
<@celticminstrel>
As far as I can tell, the only way to raise level is by collecting a game's trading cards?
23:09
<@celticminstrel>
It's not?
23:09
<@celticminstrel>
Hm...
23:09
<&McMartin>
You have to X of Y for Pillar.
23:09
<&McMartin>
And about half gives you 100 XP.
23:09
<@celticminstrel>
Ohh.
23:09
<@celticminstrel>
Hm.
23:09
<&McMartin>
And another amount - which never actually hits 100% - for level 2 and another 100 XP
23:09
<&McMartin>
Otherwise, yeah, game trading cards.
23:10
<@celticminstrel>
I'm confused why I don't have "Review a game" when I've actually done it.
23:10
<&McMartin>
You have to have done it after they started tracking
23:10
<@celticminstrel>
I did it in the first holiday sale where I got coal for it or something.
23:10
<&McMartin>
And yes, Years of Service and Game Mechanic are the two badges you'll always get before Pillar.
23:10
<&McMartin>
Yeah, you have to do it after they started tracking for it to count.
23:10
<@celticminstrel>
Game Mechanic?
23:10
<@celticminstrel>
I thought the coal sale was when they started tracking...
23:10
<&McMartin>
There's a badge for tracking number of games owned, but the XP reward there is fairly trivial.
23:11
<&McMartin>
The coal sale was where they gave up on their old model and designed the badge system -_-
23:11
<@celticminstrel>
I only see Sharp-Eyed Stockpiler, not Game Mechanic.
23:11
<&McMartin>
Ah, it must change names as the amount advances.
23:11
<@celticminstrel>
I see.
23:11
<&McMartin>
(Because all the good prizes were grabbed by people using Steam Achievement Manager in the Coal sale)
23:12
<&McMartin>
(And then all the bad prizes were too, leaving Valve to fabricate -10% on Half-Life 2 coupons for everyone playing honestly)
23:12
<@celticminstrel>
Okay, so I have done 9 of the pillar tasks, so five more would raise my steam level.
23:12
<&McMartin>
What level are you now?
23:13
<@celticminstrel>
Four, I think.
23:13
<&McMartin>
OK, that should be doable.
23:13
<@celticminstrel>
Needs 55 XP or something.
23:14 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
23:14
<&McMartin>
I maintain a wide variety of kind of pointless screenshots to invite comment for this badge
23:14
<@celticminstrel>
I'd do "Make a Trade" but I don't think I have anything to trade. Except... I do have some cards, and one is a duplicate...
23:14
<&McMartin>
Most notably http://steamcommunity.com/sharedfiles/filedetails/?id=14892558
23:15
<@celticminstrel>
It counts if done through browser instead of Steam client?
23:15
<&McMartin>
I would guess you have to be logged in to make it count.
23:15
<&McMartin>
But you can log in from multiple sources.
23:15
<@celticminstrel>
Well yes, logging in is assumed.
23:16
<@celticminstrel>
You can't log in from multiple Steam clients though...
23:16
<&McMartin>
True enough
23:16
<@celticminstrel>
So Bromide is you?
23:19 Syka [the@Nightstar-li4.p90.156.120.IP] has joined #code
23:19 ErikMesoy [Erik@Nightstar-ekm.o7n.203.80.IP] has quit [Connection closed]
23:19 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has quit [Ping timeout: 121 seconds]
23:20 AnnoDomini [AbuDhabi@Nightstar-85r1p0.adsl.tpnet.pl] has joined #code
23:20 ErikMesoy [Erik@Nightstar-ekm.o7n.203.80.IP] has joined #code
23:23 AnnoDomi1i [AbuDhabi@Nightstar-1apnlb.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
23:24
<@celticminstrel>
Apparently "Comment on a friend's screenshot" doesn't actually require the "friend" part.
23:29 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has joined #code
23:29 mode/#code [+o Orthia] by ChanServ
23:29
<&McMartin>
There's like five or six "Bromide"s out there; I'm one of them.
23:29
<&McMartin>
(That one is me though, yeah)
23:40 Orthia [orthianz@Nightstar-5m8.1ee.224.119.IP] has quit [[NS] Quit: Going dooooown...]
23:53
<@celticminstrel>
Well, I have some cards now, though it doesn't look like they'll be any use.
23:53
< AnnoDomini>
Augh: http://imgur.com/gallery/MSPDV
23:54
<@celticminstrel>
Unless I can get most of them by trading or something.
23:54
<@celticminstrel>
But I have nothing to trade for, so...
23:54
<&McMartin>
Well, you can also buy them outright for money, if you are mad
23:54
<@celticminstrel>
Yeah, no thanks.
23:55
<&McMartin>
(Or if you don't want to deal with traders; most people just take their card drops and put them up for sale for a few cents, because if you have a sizable collection it adds up)
23:55
<@celticminstrel>
Huh?
23:56
<&McMartin>
This is kind of off-topic, so I'll go to PM here
--- Log closed Thu Jan 02 00:00:52 2014
code logs -> 2014 -> Wed, 01 Jan 2014< code.20131231.log - code.20140102.log >

[ Latest log file ]