--- Log opened Fri Mar 25 00:00:52 2022 |
01:54 | | gizmore|2 [kvirc@Nightstar-g1el7j.dip0.t-ipconnect.de] has joined #code |
01:56 | | gizmore [kvirc@Nightstar-j2a665.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds] |
02:26 | | Degi_ [Degi@Nightstar-pld7gq.pool.telefonica.de] has joined #code |
02:26 | | Degi [Degi@Nightstar-l00vbb.pool.telefonica.de] has quit [Ping timeout: 121 seconds] |
02:26 | | Degi_ is now known as Degi |
03:37 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has quit [Ping timeout: 121 seconds] |
04:06 | | Vorntastic [uid293981@Nightstar-phvupn.irccloud.com] has joined #code |
04:06 | | mode/#code [+qo Vorntastic Vorntastic] by ChanServ |
05:44 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
05:44 | | mode/#code [+o himi] by ChanServ |
05:53 | <@macdjord> | Fantasy Species' Video Games: https://rabbiteclair.tumblr.com/post/679669545607266304 |
06:40 | | abudhabi [abudhabi@Nightstar-7egovc.dynamic.t-mobile.pl] has quit [Connection closed] |
07:00 | <&McMartin> | New Bumbershoot post, with Too Much Code In It. https://bumbershootsoft.wordpress.com/2022/03/25/lights-out-nes-pressing-start-to-begin/ |
07:02 | | Netsplit Traal.Nightstar.Net <-> Krikkit.Nightstar.Net quits: @ToxicFrog, @celticminstrel, @McMartin, @PinkFreud, Alek, @Syloq |
07:03 | | Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [[NS] Quit: No Ping reply in 180 seconds.] |
07:03 | | Netsplit Traal.Nightstar.Net <-> Deepthought.Nightstar.Net quits: @macdjord, Degi, @himi, @JustBob, ErikMesoy, @Tamber, @Kindamoody, gizmore|2, Pink, @Vorntastic, (+1 more, use /NETSPLIT to show all of them) |
07:04 | | Netsplit over, joins: &McMartin, Alek, @celticminstrel, &ToxicFrog, @PinkFreud, @Syloq |
07:04 | | jerith [jerith@Nightstar-ip7ar2.slipgate.net] has quit [Ping timeout: 121 seconds] |
07:04 | | Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code |
07:04 | | mode/#code [+ao Reiver Reiver] by ChanServ |
07:04 | | Netsplit over, joins: @JustBob, Degi, Pink, @Tamber, ~Vorntastic, @macdjord, @gnolam, @himi, gizmore|2, @Kindamoody (+1 more) |
07:04 | <&McMartin> | Though less code than before, because it turns out writing code is a sucker's game when the lookup table is smaller. |
07:04 | | jerith [jerith@Nightstar-ip7ar2.slipgate.net] has joined #code |
07:05 | | mode/#code [+ao jerith jerith] by ChanServ |
09:27 | < catalyst> | code is all data processing anyway |
12:31 | <@gnolam> | *FLEXIBLY USED POLISH WORD* |
12:32 | <@gnolam> | I was juuuust about to hit "release". |
12:32 | <@gnolam> | But no. Found a massive bug. |
12:33 | <&Reiver> | hahah |
12:33 | <&Reiver> | I do appreciate your epithet. I'm sure abudhabi would be able to guess, at that. :p |
12:36 | < simon_> | I'm converting some Python code to Rust, and I've reached a point where Python's dynamic nature makes the Rust version a bit cumbersome... |
12:36 | < simon_> | basically, I've got a heterogenous queue |
12:36 | < simon_> | it has some more bells and whistles, but what I'm struggling with is essentially just dequeuing. |
12:37 | < simon_> | in python I can just say 'item = stream.dequeue()' and the type of item is whatever |
12:37 | < simon_> | in Rust I made an enum Item { SomeA(A), SomeB(B) } and that's what I'm pushing through |
12:38 | < simon_> | then 'let item = stream.dequeue()' becomes an Item, and not specifically an A or a B. |
12:39 | < simon_> | for each specific thing I could do 'if let Some(SomeA(a)) = stream.dequeue() { ... }', which means I have to do explicit error handling every time I dequeue. |
12:41 | < simon_> | maybe if Item: TryFrom<A> + TryFrom<V>, I can do 'let a: A = stream.dequeue().try_from()?;' |
12:41 | < simon_> | oops, s/V/B/ |
13:16 | <&ToxicFrog> | simon_: My Rust is rusty, but this sounds like the kind of thing match {} blocks are for |
13:17 | <&ToxicFrog> | let item = stream.dequeue(); match item { Item::SomeA(a) => { ...do something with a... } Item::SomeB(b) => { ...do something with b... } } |
13:19 | <&ToxicFrog> | Indeed "matching over heterogenous enum types" is one of the worked examples in the rustbook. |
13:19 | <&ToxicFrog> | https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html#destructuring-enums |
13:41 | < simon_> | ToxicFrog, yup. but if I have a match block every time I dequeue, and every branch besides the one I expect should result in the same kind of error, then I'm hoping to abstract the error handling away. |
13:42 | < simon_> | so my current thought is, as long as every enum option has a distinct type, I can write a partial function that takes my enum and returns an Option<T> where T is some particular type within a single enum option. |
13:43 | | * simon_ writes a non-generic version for a particular enum first :P |
13:46 | < catalyst> | A as_a(&self) -> Option<&A> |
13:47 | < catalyst> | fn as_a rather |
14:10 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
14:10 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
15:56 | | Vorntastic [uid293981@Nightstar-phvupn.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity] |
16:21 | | Alek [Alek@Nightstar-06ca3p.il.comcast.net] has quit [[NS] Quit: ] |
16:23 | | Alek [Alek@Nightstar-06ca3p.il.comcast.net] has joined #code |
17:08 | | Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has joined #code |
19:10 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed] |
21:23 | | Kindamoody is now known as Kindamoody[zZz] |
--- Log closed Sat Mar 26 00:00:54 2022 |