code logs -> 2022 -> Sat, 10 Sep 2022< code.20220909.log - code.20220911.log >
--- Log opened Sat Sep 10 00:00:50 2022
00:27 Kindamoody is now known as Kindamoody[zZz]
00:28 Vorntastic [uid293981@Nightstar-phvupn.irccloud.com] has joined #code
00:28 mode/#code [+qo Vorntastic Vorntastic] by ChanServ
00:39
<@celticminstrel>
But that’s not the same as yield in Python or JavaScript.
00:40
<@celticminstrel>
It’s similar, obviously, hence the same name.
00:46
<@celticminstrel>
I could be wrong, but IIUC a coroutine in Lua does not need to yield – you could have two coroutines that just resume each other. This is certainly the case with general coroutines… I haven’t actually tried it to see if it works in Lua…
00:48
<@celticminstrel>
The documentation doesn’t support this, so maybe I’m wrong?
00:51
<@celticminstrel>
I know coroutines aren’t forced to be generators (but I actually remember using them as not-generators in Python too…).
00:56
<@celticminstrel>
My quick trivial test case for that appears to work.
00:58
<@celticminstrel>
Coroutine 1 resumes coroutine 2 and coroutine 2 resumes coroutine 1, with a print before and after the resume, and all the prints are printed.
00:59
<@celticminstrel>
But there could easily be something I’m missing, like one of the resumes just fails.
00:59
<@celticminstrel>
It does actually look like that might be what happens.
00:59
<@celticminstrel>
So I guess I’m probably just wrong about that.
01:00
<@celticminstrel>
Still better than pure-generators, I guess…
01:01
<@celticminstrel>
But I’m pretty sure that makes it identical to Python’s implementation…
01:02
<@celticminstrel>
Apparently I’m thinking of Python 2’s implementation.
01:23 Alek [Alek@Nightstar-06ca3p.il.comcast.net] has quit [Ping timeout: 121 seconds]
01:30 gizmore|2 [kvirc@Nightstar-17n7kf.dip0.t-ipconnect.de] has joined #code
01:33 gizmore [kvirc@Nightstar-1i847f.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
01:37 Degi [Degi@Nightstar-9lst8m.pool.telefonica.de] has quit [Ping timeout: 121 seconds]
01:47 Degi [Degi@Nightstar-2o56bo.pool.telefonica.de] has joined #code
02:00
<&ToxicFrog>
celticminstrel: I know it's not the same as yield in python or javascript, but I was talking about Lua coroutines so I don't see how that's relevant
02:05
<&ToxicFrog>
celticminstrel: and no, you can't resume a coroutine already running; coroutine.resume() will immediately return (false, "cannot resume non-suspended coroutine"). Basically, you can't create loops on the execution stack.
02:05
<&ToxicFrog>
(you can create as many coroutines from the same underlying function as you want, though)
03:05 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
03:05 mode/#code [+qo Vornicus Vornicus] by ChanServ
03:08 Alek [Alek@Nightstar-06ca3p.il.comcast.net] has joined #code
05:34 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
06:31 Kindamoody[zZz] is now known as Kindamoody
08:47 Kizor [a@Nightstar-nfsqa7.yok.fi] has quit [Ping timeout: 121 seconds]
09:18 jessifae [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [The TLS connection was non-properly terminated.]
11:08 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has joined #code
12:03 Alek [Alek@Nightstar-06ca3p.il.comcast.net] has quit [[NS] Quit: ]
12:05 Alek [Alek@Nightstar-06ca3p.il.comcast.net] has joined #code
14:28 Kizor [a@Nightstar-nfsqa7.yok.fi] has joined #code
15:00 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:00 mode/#code [+qo Vornicus Vornicus] by ChanServ
16:38 Vorntastic [uid293981@Nightstar-phvupn.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
16:45 jessifae [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
23:49 Kindamoody [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has quit [Client exited]
23:52 Kimo|autojoin [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has joined #code
23:52 mode/#code [+o Kimo|autojoin] by ChanServ
23:52 Kimo|autojoin is now known as Kindamoody[zZz]
--- Log closed Sun Sep 11 00:00:51 2022
code logs -> 2022 -> Sat, 10 Sep 2022< code.20220909.log - code.20220911.log >

[ Latest log file ]