00:06:01 | * | abm joined #nim |
00:14:01 | FromGitter | <gogolxdong> thanks! |
00:24:14 | * | krux02 quit (Remote host closed the connection) |
00:46:49 | * | a_chou joined #nim |
00:55:58 | * | a_chou quit (Ping timeout: 260 seconds) |
01:24:05 | FromDiscord | <Deleted User 5bd78114> Does choosenim work on arm 7? |
01:24:11 | FromDiscord | <Deleted User 5bd78114> Aka Termux |
01:37:29 | * | Fish-Face quit (Ping timeout: 258 seconds) |
01:40:36 | * | Fish-Face joined #nim |
01:50:55 | * | abm quit (Quit: Leaving) |
02:08:46 | * | leorize quit (Remote host closed the connection) |
02:10:12 | * | a_chou joined #nim |
02:11:38 | * | leorize joined #nim |
02:25:10 | * | a_chou quit (Remote host closed the connection) |
03:39:22 | FromDiscord | <Quibono> I'd just like to say that compiling with -d:danger is more fun for me than is probably warranted. |
03:39:59 | FromDiscord | <ElegantBeef> what makes it fun? |
03:41:41 | FromDiscord | <Quibono> Just watching all the speed benchmarks suddenly go x times faster lol. |
03:44:42 | FromDiscord | <Quibono> Plus it's just funny doing something in what is actually danger mode. |
03:58:04 | * | muffindrake quit (Ping timeout: 268 seconds) |
03:59:57 | * | muffindrake joined #nim |
04:02:10 | disruptek | while async/await may run on top of cps, there won't be much point to using it. |
04:26:45 | FromDiscord | <Quibono> Is there any reason ARC would slow down a proc? |
04:33:34 | FromDiscord | <shadow.> when no gc is needed |
04:35:08 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Jzy |
04:40:19 | FromDiscord | <ElegantBeef> a is the 97 ascii char |
04:40:31 | FromDiscord | <ElegantBeef> 32 + 64 + 1 = 97 |
04:41:54 | FromDiscord | <ElegantBeef> you're moving the bits i amount |
04:42:53 | FromDiscord | <ElegantBeef> @shadow. do you want this? https://play.nim-lang.org/#ix=2JzC |
04:43:52 | FromDiscord | <shadow.> yup thanks |
04:44:19 | FromDiscord | <shadow.> wait so sorry how is it possible that masking a single bit becomes 32/64? |
04:44:58 | FromDiscord | <shadow.> nvm i get it |
04:45:01 | FromDiscord | <ElegantBeef> it's like if you put a 1 in a single value in 0000 |
04:45:13 | FromDiscord | <ElegantBeef> it can be 1000, 100, 10, 1 |
04:45:13 | FromDiscord | <shadow.> bc the 1 bit isnt at the rightmost position yeah |
04:45:20 | FromDiscord | <ElegantBeef> Yes |
04:45:23 | FromDiscord | <shadow.> should i just shr by n after then? |
04:45:27 | FromDiscord | <ElegantBeef> Right? |
04:45:32 | FromDiscord | <ElegantBeef> That was me writting why |
04:45:40 | FromDiscord | <shadow.> hm? |
04:45:48 | FromDiscord | <ElegantBeef> I didnt mean to write right, i just did |
04:45:51 | FromDiscord | <ElegantBeef> I meant why |
04:45:54 | FromDiscord | <shadow.> oh lol |
04:46:01 | FromDiscord | <shadow.> so that i can get it to be 1 |
04:46:09 | FromDiscord | <shadow.> then i dont need an if statement |
04:46:18 | FromDiscord | <ElegantBeef> Seems pretty silly |
04:46:53 | FromDiscord | <shadow.> fair enough |
04:47:00 | FromDiscord | <ElegantBeef> but you could |
04:47:39 | FromDiscord | <ElegantBeef> I dont get what that iterator is for to be quite honest |
04:48:14 | FromDiscord | <shadow.> again, just learning |
04:48:21 | FromDiscord | <ElegantBeef> ah |
04:49:19 | * | spiderstew joined #nim |
04:50:27 | * | spiderstew_ quit (Ping timeout: 260 seconds) |
04:50:51 | FromDiscord | <shadow.> sorry, my tone probably got lost over the internet that wasnt meant to be rude or fed up lmao |
04:51:02 | FromDiscord | <ElegantBeef> It takes more than that to offend me |
04:51:17 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JzH |
04:51:38 | FromDiscord | <ElegantBeef> yea it would |
04:52:18 | FromDiscord | <shadow.> would cast[uint](c) be any more efficient or is that just silly |
04:54:12 | FromDiscord | <ElegantBeef> Cast should rarely be used |
04:54:28 | FromDiscord | <ElegantBeef> Only when it's your only option |
04:56:29 | FromDiscord | <shadow.> fair enough |
04:57:46 | FromDiscord | <ElegantBeef> Error max is nice for debugging/seeing what i'm missing https://media.discordapp.net/attachments/371759389889003532/792254808035295263/unknown.png |
04:58:30 | FromDiscord | <ElegantBeef> Dont know about the `.add(` and not just `add` being colourised |
05:03:07 | * | fanta1 joined #nim |
05:27:19 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:27:26 | * | njoseph joined #nim |
05:35:36 | FromDiscord | <shadow.> i cant inherit from an object that doesn't inherit from root object, can i |
05:36:01 | FromDiscord | <shadow.> (edit) "i" => "i?" |
05:39:50 | FromDiscord | <ElegantBeef> Did you try it? |
05:42:43 | FromDiscord | <shadow.> yes |
05:43:20 | FromDiscord | <shadow.> the compiler got mad at me |
05:43:33 | FromDiscord | <shadow.> i was just wondering if there's a workaround lol |
05:43:44 | FromDiscord | <shadow.> im guessing it's more complicated than that |
05:51:30 | * | kungtotte quit (Read error: Connection reset by peer) |
05:52:21 | * | kungtotte joined #nim |
06:05:08 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:07:57 | * | vicfred quit (Quit: Leaving) |
06:22:53 | * | narimiran joined #nim |
06:24:21 | * | vicfred joined #nim |
06:28:20 | FromDiscord | <flywind> How can I unroll a for loop using templates and iterators? https://github.com/nim-lang/Nim/issues/14695#issuecomment-645173728 |
06:28:21 | disbot | ➥ unroll should be implemented or deprecated |
06:41:36 | saem | @shadow IIUC the complication shows up in that the compiler has to make room for RTTI to handle the sub-type relationship among other things -- but it can't change an existing definition which is already final. You could be sneaky and patch it on compile depending on your usecase? |
07:00:55 | * | xet7_ joined #nim |
07:01:23 | * | xet7 is now known as Guest69028 |
07:01:33 | * | xet7_ quit (Remote host closed the connection) |
07:01:55 | * | xet7_ joined #nim |
07:03:32 | * | Guest69028 quit (Ping timeout: 272 seconds) |
07:05:11 | * | xet7_ is now known as xet7 |
07:12:13 | Zevv | wow mratsim, that's a nice piece of conclusion you wrote up there |
07:53:21 | FromDiscord | <Balen> What's the use of the distinction between ref object and object, when I can allocate an object on the heap with new(SomeObject) and allocate a ref object on the stack with SomeRefObject(...)? I might be confusing things here, most likely am. |
07:53:56 | FromDiscord | <ElegantBeef> `SomeRefObject()` shouldnt be stack allocated |
07:54:04 | mipri | one's a reference type and the other's a value type. |
07:55:25 | FromDiscord | <Balen> doesn't new(SomeObject) return a ref SomeObject which is a reference type, right? |
07:55:31 | FromDiscord | <ElegantBeef> Yes |
07:55:56 | FromDiscord | <ElegantBeef> !eval type A = ref object; echo A() |
07:55:57 | mipri | analogously to how a 'ref object' is a ref to an object |
07:55:58 | NimBot | Compile failed: /usercode/in.nim(1, 27) Error: type mismatch: got <A> |
07:56:43 | * | leorize quit (Ping timeout: 240 seconds) |
07:56:45 | FromDiscord | <ElegantBeef> isnt it impossible to instantiate a ref object not as a ref? |
07:57:27 | FromDiscord | <ElegantBeef> Anywho the entire point of ref objects is this here, using the references and to have managed pointers https://play.nim-lang.org/#ix=2JA1 |
07:58:30 | FromDiscord | <Balen> sent a code paste, see https://play.nim-lang.org/#ix=2JA2 |
07:58:33 | FromDiscord | <ElegantBeef> Sure |
07:58:48 | FromDiscord | <ElegantBeef> but now to echo b you have to dereference it so it's `echo b[]` |
07:59:26 | FromDiscord | <ElegantBeef> Reference objects are managed pointers, whereas objects are raw stack allocated objects |
07:59:46 | * | leorize joined #nim |
07:59:46 | FromDiscord | <ElegantBeef> You can do `var b: SomeRefObject` and then if you do `b.x = 100` it'll throw a nil error |
08:00:39 | FromDiscord | <ElegantBeef> C# has Structs and Classes which behave similarly |
08:01:00 | FromDiscord | <ElegantBeef> They allow you to explictly state how assignment behaves and where they're stored |
08:01:41 | FromDiscord | <Balen> So if I declare an object as ref object, there's no way to allocate it on the stack at some point? or should the compiler automatically do it if like I allocate the object for the lifetime of a function scope? |
08:01:58 | FromDiscord | <ElegantBeef> If an object is a ref object it's going to be heap allocated |
08:02:30 | FromDiscord | <ElegantBeef> If you want choice, you make your object just a value type then make a `ref YourObject` |
08:02:44 | FromDiscord | <ElegantBeef> Which typically is named `YourObjectRef` or `RefYourObject` |
08:03:04 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/json.nim#L178 |
08:03:08 | FromDiscord | <ElegantBeef> It's in the stdlib a lot |
08:03:22 | FromDiscord | <Balen> Oh |
08:03:48 | FromDiscord | <Balen> so If I wanted to like fine-tune and stack allocate, I could just use a JsonNodeObj in that case |
08:03:54 | mipri | https://play.nim-lang.org/#ix=2JA5 |
08:04:27 | FromDiscord | <Rika> Yes, because SomeRefObject is a `ref object` |
08:04:46 | FromDiscord | <Rika> Referring to the echo b snippet you posted |
08:04:46 | FromDiscord | <Balen> makes sense |
08:05:07 | FromDiscord | <ElegantBeef> Oh you can instantiate ref objects on the stack, but abusing the underlying object |
08:05:24 | FromDiscord | <Balen> like mipri did |
08:05:28 | FromDiscord | <Balen> awesome |
08:05:31 | FromDiscord | <ElegantBeef> That's what i was commenting on |
08:05:35 | FromDiscord | <ElegantBeef> It's uglier than the alternative |
08:05:37 | mipri | no, what I did was instantiate the anonymous object that A is a ref of |
08:05:55 | FromDiscord | <ElegantBeef> Yea that's what i said, or atleast implied |
08:05:59 | mipri | 'type Blah = ref object' is a shorthand for the same BlahObj and BlahRef you might define separately |
08:06:23 | FromDiscord | <Balen> feels less like magic now, thanks y'all. |
08:06:40 | FromDiscord | <ElegantBeef> Also worth noting that if you use inheritance you really want to use `ref` |
08:06:47 | FromDiscord | <Rika> What mipri did is also pretty hacky, never seen it before |
08:07:07 | FromDiscord | <ElegantBeef> Yea it makes sense that it works, but it's not something i'd ever imagine anyone using 😄 |
08:07:54 | FromDiscord | <Rika> I’ll bonk you if you do |
08:12:04 | disruptek | all sorts of strange behavior occurs under the covers. |
08:13:57 | Zevv | disruptek: so, it seems mratsim has seen the light |
08:14:08 | disruptek | hook, line, and sinker. |
08:14:24 | disruptek | but, i dunno, maybe he needs to go to school to learn about arc. |
08:14:31 | Zevv | good to see it all backed by some solid sciencing |
08:14:37 | * | disruptek yawns. |
08:14:40 | Zevv | hehe |
08:14:49 | Zevv | after sesame street for you, boy |
08:15:18 | disruptek | i miss that show. |
08:15:20 | Zevv | but you know, people will go hunt our archives one day to see how it all became to be |
08:15:29 | Zevv | and they better dig up some proper sciencing |
08:15:34 | Zevv | wait what is there no more sesame street? |
08:15:50 | disruptek | not really. i think it's pay-to-play now. |
08:16:04 | Zevv | what will become of the next generation then |
08:16:07 | disruptek | also, most of the content i knew from years back has been replaced by modern work. |
08:16:16 | disruptek | sciencing. |
08:16:25 | Zevv | I haven't had a tv for 20 years I think |
08:16:40 | disruptek | we need to get mratsim focussed on more than just performance. |
08:16:47 | Zevv | oh he is |
08:16:55 | disruptek | about most of this stuff... "i don't care." |
08:16:56 | Zevv | his #1 on the list is now ergonomics, right |
08:17:04 | disruptek | i doubt that. |
08:17:22 | disruptek | he wrote that CTA just to inspire the common plebs. |
08:18:12 | Zevv | if that what it takes, good |
08:18:31 | Zevv | the common plebs don't weave, do they |
08:18:37 | disruptek | i don't see anyone else lining up to get their hands dirty. |
08:18:56 | disruptek | he needs to get messy with the code and see what we're up against. |
08:19:31 | disruptek | it's true that a lot of things /should/ be easier with typed, but 1) typed doesn't work, and 2) we've elided many dead ends by now. |
08:19:36 | FromDiscord | <ElegantBeef> I can barely thread a needle nevermind weave |
08:19:54 | Zevv | right, so from his list #1 is actually a design doc |
08:19:56 | Zevv | ok, fine |
08:20:04 | Zevv | and #2 is "get the compiler bugs fixed" |
08:20:19 | disruptek | easier said than done. |
08:20:29 | Zevv | cmon stop whining |
08:20:56 | Zevv | you wanted others to see the light and help pushing this shit cart up the hill |
08:21:06 | disruptek | today i built a squid cache hierarchy to try to improve my internet. |
08:21:15 | Zevv | you're reading it wrong |
08:21:19 | Zevv | not squid cache |
08:21:22 | disruptek | tomorrow i need to resume porting nimph to ups. |
08:21:34 | disruptek | then add a few lines to gitnim, a few lines to dist. |
08:23:06 | disruptek | mratsim needs his first blood. |
08:23:15 | disruptek | then i will return to cps. |
08:24:08 | Zevv | fair enough |
08:25:11 | Zevv | there's also tribes where they send the kids to roll in a nest of fire ants |
08:25:42 | disruptek | i'm fine with the ants, but we don't need to paint him with honey first. |
08:25:48 | disruptek | he's done that well enough himself. |
08:26:50 | disruptek | remember, zevv: no plan survives encounter with the enemy. |
08:28:34 | Zevv | We'll see. But honestly, of all the people to get on board, mratsim isn't the worse we could end up with |
08:28:45 | FromDiscord | <ElegantBeef> Nah that'd be me |
08:28:55 | Zevv | yeah, imagine |
08:29:03 | disruptek | i pity the fool. |
08:29:13 | Zevv | elegantbeef, disruptek and me |
08:29:13 | Zevv | ha ha |
08:29:18 | disruptek | but it's nice to know someone agrees with us. |
08:29:36 | FromDiscord | <ElegantBeef> I'm still a little lost why you guys talk about child protective services so muc |
08:29:37 | FromDiscord | <ElegantBeef> (edit) "muc" => "much" |
08:29:42 | FromDiscord | <Rika> What is happening |
08:29:59 | disruptek | i was starting to think i was losing my mind. |
08:30:07 | disruptek | that was a few years ago. now i'm sure it's gone. |
08:30:07 | FromDiscord | <ElegantBeef> Those two are scheming to replace the logic behind async with CPS |
08:30:29 | disruptek | honestly i stopped caring about async in august. |
08:30:52 | disruptek | it's kinda like channels. i just know i'm never going there again, and i'm fine with it. |
08:31:21 | FromDiscord | <ElegantBeef> Isnt your current RFC about replacing async's internals with your continuation stuff |
08:31:33 | FromDiscord | <ElegantBeef> To remove dependancies/binary size |
08:31:40 | disruptek | yes and no. |
08:31:57 | disruptek | it was a rebuttal to my feud with dom, but i always wanted to move the needle on the bugs blocking cps. |
08:32:07 | FromDiscord | <ElegantBeef> Ah |
08:32:20 | disruptek | the point is that it's not something to argue about. |
08:32:29 | FromDiscord | <ElegantBeef> Well most things arent |
08:34:21 | FromDiscord | <ElegantBeef> I personally do like the lack of dependancies |
08:35:21 | disruptek | i mean, i get that, but it's really not the message. |
08:35:32 | disruptek | and, to be fair, dom was right that i stacked the deck in the examples. |
08:35:47 | FromDiscord | <ElegantBeef> Well i dont use async or threading so it's really all i see that i like 😄 |
08:36:09 | disruptek | it's not just concurrency, actually. |
08:36:28 | ForumUpdaterBot | New thread by Domogled: Let's work :-), see https://forum.nim-lang.org/t/7293 |
08:36:34 | disruptek | in fact, it could be that explaining it without bringing concurrency in makes the impact more obvious. |
08:36:47 | disruptek | maybe we've been muddying the waters with the damned async angle. |
08:37:33 | FromDiscord | <CodeHz> is that a bug of compiler? https://play.nim-lang.org/#ix=2JAa |
08:38:04 | FromDiscord | <ElegantBeef> A generic converter is scary |
08:38:08 | disruptek | you right sequential code, but you can store its execution as if it were a graph, and run it as you might traverse said graph, wherein each vertex is a state. |
08:38:11 | FromDiscord | <ElegantBeef> As it applies to everything |
08:38:26 | disruptek | codehz: read this, please: |
08:38:34 | disruptek | ~disrupstyle |
08:38:35 | disbot | disrupstyle: 11tips for writing code that won't provoke 😠 rants 🤬 on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek |
08:38:46 | disruptek | i guess i need to add a section on converters. |
08:39:05 | disruptek | do not use them, unless... |
08:39:12 | disruptek | they aren't exported, and |
08:39:21 | disruptek | they exist only to grandfather types, or |
08:39:46 | disruptek | they exist to expose access to data that you otherwise do not have (think, a return type that is not exported to you). |
08:40:01 | disruptek | and, like, one other teeny-tiny super-subtle use case that i forget. |
08:40:08 | disruptek | but, like, just don't fucking use them. |
08:40:35 | FromDiscord | <ElegantBeef> an explicit call is almost always better |
08:40:36 | disruptek | oh, they are good for boxing. |
08:40:48 | disruptek | that's it. really. like, those three things. |
08:40:50 | disruptek | nothing else. |
08:41:08 | FromDiscord | <ElegantBeef> I think impbox uses them with his aliased floats/ints for nico |
08:41:47 | FromDiscord | <ElegantBeef> Ah yea he does |
08:41:59 | FromDiscord | <ElegantBeef> That's like the only time i've ever seen them |
08:42:04 | disruptek | that sounds like boxing. |
08:42:20 | FromDiscord | <ElegantBeef> I'm not much of a sports fan |
08:42:54 | disruptek | converters are one of these things like term-rewriting macros (but less dangerous) that really should be behind safety glass. |
08:42:55 | FromDiscord | <CodeHz> btw, this one works↵https://play.nim-lang.org/#ix=2JAd↵it is bug, at least the two code should give same result: both failed, or both works |
08:43:15 | disruptek | see my section on tuples. |
08:43:56 | mipri | https://play.nim-lang.org/#ix=2JAe - second converter isn't doing anything. |
08:44:23 | FromDiscord | <ElegantBeef> Yep it's not invoked so the usage of it isnt error ridden |
08:44:43 | FromDiscord | <CodeHz> ( I think the problem is not about tuple |
08:44:45 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2JAf |
08:44:47 | disruptek | don't encourage him. |
08:44:56 | FromDiscord | <CodeHz> it is about the type alias with generic |
08:45:05 | FromDiscord | <flywind> generics convertor is ugly and should not be used. |
08:45:09 | FromDiscord | <ElegantBeef> No it's about the fact it's not invoked with the `1 + 1` example |
08:45:34 | disruptek | generics don't exist unless instantiated. |
08:45:42 | disruptek | but, look, seriously, do not do this thing. |
08:46:44 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2JAg see there is no compilation error here |
08:46:55 | FromDiscord | <ElegantBeef> It's not semantically incorrect, it's just that you dont fucking invoke it 😄 |
08:47:24 | FromDiscord | <ElegantBeef> But yes dont do it |
08:48:59 | mipri | https://play.nim-lang.org/#ix=2JAh meanwhile |
08:49:11 | Zevv | 6 |
08:49:29 | FromDiscord | <ElegantBeef> Thanks mipri, i hate it |
08:49:48 | mipri | that's a very weak password, Zevv |
08:50:06 | FromDiscord | <ElegantBeef> Better than mine, of password |
08:51:14 | FromDiscord | <CodeHz> (https://play.nim-lang.org/#ix=2JAj↵And seq with type alias also give error |
08:51:54 | Zevv | it sufficient, the entropy is in my username |
08:53:54 | mipri | again: https://play.nim-lang.org/#ix=2JAk |
08:58:55 | mipri | what you're running into isn't 'aliases with a generic'; it's that Nim has no idea at all what T is supposed to be in your converter. |
08:59:29 | FromDiscord | <CodeHz> But if you replace P with seq, all example works |
09:00:06 | * | Jitty[m] quit (Quit: Idle for 30+ days) |
09:00:22 | mipri | what you achieved there was the converter not triggering at all |
09:02:22 | FromDiscord | <CodeHz> (yes , but it still break 1+1, it is unexpected behaviour.. |
09:03:30 | mipri | OK, I get that it's unexpected that naming a type changes things. I am just caught on the code not doing what anyone actually wants in either case. |
09:08:35 | FromDiscord | <CodeHz> (so I think nim should fix that, either disallow the generic converter or fix this error(possible solution: skip the converter that cannot be solved, like SFINAE, but mush simpler ).. |
09:09:31 | FromDiscord | <ElegantBeef> In the meantime people can stop using converters |
09:10:02 | mipri | sure. the two converters are reacted to with two different paths through the compiler and this number should be reduced to one path. |
09:12:50 | mipri | although it might be a case of "having solved all crime, the police are finally free to make sure that child's lemonade stand is properly collecting sales tax" |
09:13:44 | mipri | the best outcome is that this behavior is accidentally fixed when the code is cleaned up for some other reason |
09:18:22 | * | saem quit (Remote host closed the connection) |
09:19:37 | * | hoijui joined #nim |
09:36:03 | * | leorize quit (Ping timeout: 240 seconds) |
09:37:10 | * | leorize joined #nim |
09:38:56 | * | Torro joined #nim |
09:44:55 | * | hoijui quit (Quit: Leaving) |
10:12:32 | * | krux02 joined #nim |
10:21:07 | * | T0rr0 joined #nim |
10:23:23 | * | Torro quit (Ping timeout: 240 seconds) |
10:24:33 | * | Arrrrrrrr joined #nim |
10:26:37 | * | habamax joined #nim |
10:27:17 | * | T0rr0 quit (Quit: bye) |
10:27:57 | * | Deknos joined #nim |
10:28:54 | * | Torro joined #nim |
10:37:40 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
11:04:32 | * | habamax quit (Ping timeout: 256 seconds) |
11:10:58 | * | hmmm joined #nim |
11:11:08 | hmmm | yo! |
11:11:53 | FromDiscord | <Rika> hello re"hm+" |
11:15:41 | * | Deknos left #nim (#nim) |
11:17:28 | mipri | watc[hm]aker |
11:18:34 | * | Torro quit (Quit: bye) |
11:18:51 | FromDiscord | <Rika> whats a watchaker / watcmaker |
11:22:07 | * | Torro joined #nim |
11:23:49 | * | audiofile joined #nim |
11:24:05 | audiofile | when do I use ref object vs just object? |
11:24:18 | audiofile | when creating a type^ |
11:24:54 | FromDiscord | <flywind> https://forum.nim-lang.org/t/1207 |
11:25:00 | FromDiscord | <flywind> ^ |
11:25:10 | audiofile | went through that and the linked reddit post...still not cleaer :( |
11:26:49 | FromDiscord | <flywind> What's your application? |
11:28:02 | audiofile | just trying to figure out when to use whatt |
11:28:07 | audiofile | no concrete application yet |
11:28:50 | mipri | take Nim's own default position of using object, and switch to ref object if you find you only ever want reference semantisc |
11:32:24 | FromDiscord | <flywind> For example, `ref object` is used to implement linked lists, trees structures which need reference semantics. Most of time, objects are fine. |
11:33:47 | FromDiscord | <flywind> `ref object` is allocated in heap, controlled by GC and harmful to multiple threading. |
11:34:09 | * | hmmmm joined #nim |
11:35:34 | FromDiscord | <Rika> but `object`s cannot contain fields of itself |
11:36:54 | * | hmmm quit (Ping timeout: 256 seconds) |
11:39:18 | audiofile | Rika what does that mean |
11:39:36 | audiofile | like a Tree ref can reference Tree as fields but not if it's defined as an object only? |
11:40:34 | FromDiscord | <Rika> Yeah |
11:42:25 | FromDiscord | <Rika> type tree = ref object ... tree1: tree # ok |
11:42:34 | FromDiscord | <Rika> type tree = object ... tree1: tree # not ok |
11:49:01 | * | hmmmm left #nim (#nim) |
11:53:03 | audiofile | thanks! |
12:27:35 | audiofile | is there any performance advantage of using Table over OrderedTable? |
12:28:23 | * | bacterio quit (Ping timeout: 260 seconds) |
12:29:38 | mipri | there might be. OrderedTables do a little bit more work and use more memory (twice as much, probably) |
12:29:49 | mipri | if you don't need the extra work I wouldn't bother with it. |
12:30:57 | mipri | if you need the extra work and would just implement your own ordering for keys on top of a Table ... that's probably not worth it, vs. using an OrderedTable |
12:31:05 | audiofile | oh wow, source for that ~2x mem usage please? |
12:32:17 | FromDiscord | <Rika> i believe ordered tables dont take any more memory than normal |
12:32:21 | mipri | https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/tables.nim#L1224 |
12:32:25 | FromDiscord | <Rika> since tables are internally seqs |
12:32:38 | * | Vladar joined #nim |
12:33:15 | mipri | I was reading the seq[] there as a duplicate of the hash table backing and it's actually part of the implemention, so it's not that bad |
12:33:32 | FromDiscord | <Rika> no, ordered tables only have an extra next field it seems |
12:33:56 | * | def- quit (Quit: -) |
12:34:02 | mipri | yeah it's a linked list threaded through the table buckets |
12:34:07 | * | def-- joined #nim |
12:34:23 | FromDiscord | <Rika> so is it really 2x memory usage smh |
12:34:30 | mipri | no, not at all |
12:34:31 | * | def-- is now known as def- |
12:35:06 | mipri | memory use of a table over object types will dwarf the size of this stuff |
12:35:17 | mipri | that's what I thought might get duplicated, and it's not |
12:35:42 | * | bacterio joined #nim |
12:36:06 | mipri | if you have a table of int32->int32, the extra memory use is going to be a lot more noticable |
12:43:06 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
12:43:55 | * | pbb joined #nim |
12:44:31 | FromDiscord | <Balen> I was wondering if there's a way of returning a "mutable variable" from a function that's wrapped in an Option. atm I am just returning a pointer like this `Option[ptr Product]` but I don't think that's really clean or ideal. I am returning an element of a global array so the pointer can't be invalid. I know you can return a var Something from a function and that'll supposedly keep the object alive from the GC. |
12:46:36 | * | pbb quit (Excess Flood) |
12:46:54 | * | pbb joined #nim |
12:48:19 | FromDiscord | <CodeHz> var Option ? |
12:48:36 | FromDiscord | <CodeHz> https://nim-lang.org/docs/options.html#get%2COption%5BT%5D_2 |
12:48:47 | FromDiscord | <Rika> i dont understand the concept of returning a mutable |
12:48:52 | FromDiscord | <Rika> what's the usecase? |
12:49:18 | FromDiscord | <tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBe |
12:49:35 | FromDiscord | <tomck> @Balen I'm pretty sure you can just return a `var Product`, what's the GC issue? |
12:50:21 | FromDiscord | <Balen> I know I can do that, but the proc searchs the array for an element. In case it doesn't find it, it returns a none |
12:50:28 | FromDiscord | <Balen> so I want to return an option |
12:50:34 | FromDiscord | <tomck> the way it was explained to me, `var T` is just `T&` in c++ |
12:50:34 | FromDiscord | <CodeHz> no possible, since yield must be inlined |
12:50:57 | FromDiscord | <tomck> oh right, yeah i odn't think `Option[var T]` is valid..? |
12:51:08 | FromDiscord | <tomck> just returning a `ptr T` works, & check for nil |
12:51:16 | FromDiscord | <Rika> have you tried it |
12:51:23 | FromDiscord | <Balen> I did |
12:51:42 | FromDiscord | <Balen> var Product not valid in context it was I think |
12:51:51 | FromDiscord | <tomck> @CodeHz I don't understand why inlining makes this an issue? |
12:51:52 | FromDiscord | <Rika> time to learn lent and sink i guess |
12:52:22 | FromDiscord | <Rika> i dont understand how the code would be valid |
12:52:26 | FromDiscord | <Rika> you cant yield in a proc |
12:52:42 | FromDiscord | <tomck> I can inline my code manually just fine |
12:53:18 | FromDiscord | <CodeHz> or you must make every function to be iterator |
12:53:28 | FromDiscord | <tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBh |
12:53:36 | FromDiscord | <CodeHz> (just like you cannot return from another function |
12:53:50 | FromDiscord | <tomck> no, it just needs to create a new callback function each time i instantiate the iterator |
12:54:03 | FromDiscord | <tomck> but yielding isn't returning, you're just pasting code |
12:54:58 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=2JBi |
12:55:17 | FromDiscord | <Recruit_main707> without that result at the end :p |
12:58:52 | FromDiscord | <CodeHz> consider the function will called in multiple times? or even never called? it cannot be observed from function signature |
12:59:00 | FromDiscord | <CodeHz> (edit) "observed" => "get" |
12:59:06 | FromDiscord | <CodeHz> (edit) "it" => "this information" |
12:59:47 | FromDiscord | <CodeHz> or be stored and called outside of scope |
12:59:58 | FromDiscord | <CodeHz> (edit) "scope" => "scope, make everything wrong" |
13:00:10 | FromDiscord | <tomck> @CodeHz that doesn't matter |
13:00:24 | FromDiscord | <CodeHz> but as a language feature, it should be safe |
13:00:29 | FromDiscord | <tomck> nim has templates |
13:00:48 | FromDiscord | <tomck> i can do this with templates, just not with iterators, despite inline iterators being templates with a tiny extra bit of syntax |
13:00:57 | FromDiscord | <Rika> but they are not templates |
13:00:59 | FromDiscord | <Rika> they are iterators |
13:01:04 | FromDiscord | <CodeHz> yes, you can doing crazy thing with template or macro |
13:01:14 | FromDiscord | <CodeHz> but it is not template or macro |
13:01:17 | FromDiscord | <Rika> they may act like templates but that is not because they try to be templates |
13:01:38 | FromDiscord | <CodeHz> I don't think create footgun is a good idea( |
13:02:25 | FromDiscord | <Rika> like saying i cant go from edge to edge on a bicycle like i can with a motorbike, despite a bike being a motorbike with/out x |
13:02:58 | FromDiscord | <tomck> why are inline iterators like they are then? |
13:02:59 | FromDiscord | <Rika> both of them are pretty fundamentally different |
13:03:03 | FromDiscord | <tomck> why not rust-like iterators instead? |
13:03:04 | FromDiscord | <Rika> because they are fast |
13:03:13 | FromDiscord | <tomck> they're not fast, they're just force-inlined |
13:03:20 | FromDiscord | <Rika> which is fast |
13:03:21 | FromDiscord | <tomck> rust iterators get inlined too |
13:03:26 | FromDiscord | <CodeHz> (PS: {.closure.} iterator cannot do that either( |
13:03:34 | FromDiscord | <tomck> there's no benefit to this, you just make it slow in the case where you can't inline |
13:07:31 | FromDiscord | <CodeHz> wait, rust's generator cannot yield from another callback, even it has been marked as FnOnce |
13:08:37 | FromDiscord | <tomck> yes, rust iterators do not just paste the code in like a template |
13:11:10 | FromDiscord | <CodeHz> but that doesn't mean nim's inline iterator same as copy pasting |
13:12:14 | mipri | C++/D/Rust iterators require a heavy optimization pass to get codegen that looks like inlining happened, and the exact costs are harder to predict, with the benefit of first-class use and superior composability. If you want to rank languages they're more advanced, sure. |
13:12:57 | FromDiscord | <Rika> ~~i'd love to see fast first class iterators in nim tho~~ |
13:13:11 | mipri | Nim's iterators have some limitations but are trivial and you get the limited benefit (no overhead vs. writing the loop yourself) right away. |
13:13:22 | FromDiscord | <CodeHz> unless nim has llvm back-end( |
13:13:29 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/pull/11992 |
13:13:31 | disbot | ➥ every symbol becomes 1st class; defines 0-cost lambda and aliases; inline iterators/templates/etc can be passed to any routine ; snippet at 12https://play.nim-lang.org/#ix=250A |
13:13:46 | mipri | Kotlin's another language with a feature like Nim's inline iterators. |
13:14:18 | FromDiscord | <CodeHz> (but it also have inline callback |
13:14:24 | mipri | yeah there's that, and CPS might also result in better closure iterators. "Here's a thing that might come" doesn't help people accept the features currenlty in the language. |
13:14:25 | FromDiscord | <CodeHz> allow returning from callback |
13:14:45 | FromDiscord | <CodeHz> (edit) "allow returning ... from" added "(top level functino)" |
13:14:53 | FromDiscord | <CodeHz> (edit) "functino)" => "function)" |
13:16:52 | FromDiscord | <Deleted User 5bd78114> @CodeHz |
13:17:01 | FromDiscord | <Deleted User 5bd78114> !repo nlvm |
13:17:02 | disbot | https://github.com/arnetheduck/nlvm -- 9nlvm: 11LLVM-based compiler for the Nim language 15 360⭐ 26🍴 7& 1 more... |
13:17:33 | FromDiscord | <CodeHz> (but it doesn't seem "complete" 😦 |
13:17:55 | FromDiscord | <Deleted User 5bd78114> Yeah :/ |
13:18:03 | FromDiscord | <Deleted User 5bd78114> You could compile with Clang? |
13:18:24 | FromDiscord | <Deleted User 5bd78114> Or llvm-gcc (yes that's a thing apparently) |
13:18:49 | FromDiscord | <CodeHz> (I actually use clang-cl in windows to get native debug info |
13:20:33 | mipri | yeah, another thing that might happen is someone writing a rust-envy lib that implements Rust iterators in exactly the same way, and letting the optimizer do similar work to it -- hopefully. |
13:20:38 | FromDiscord | <Deleted User 5bd78114> O |
13:21:45 | mipri | inline iterators are popular in Nim because they're easy to understand zero cost abstractions and the limitations are very tolerable (even preferable) if you're not writing super FP code. |
13:23:01 | FromDiscord | <CodeHz> (FP style will use pattern match and recursive ( make optimizer work harder and harder |
13:23:58 | mipri | although the most common complain I believe is people wanting to call .next() on them and then balking when this means moving to closure iterators. |
13:24:11 | mipri | for whatever the complaint is here, about "not being able to yield in a proc", I didn't follow. |
13:27:08 | FromDiscord | <tomck> It just seemed like it should be possible to yield in a proc that you define within an iterator, given that iterators just paste the code in like a template |
13:27:43 | FromDiscord | <tomck> seems like iterators have the same restrictions as iterators that you can call `.next()` on |
13:28:12 | mipri | I don't see how that 'given' follows at all. |
13:28:31 | FromDiscord | <Rika> which is intentional because the "pasting" part is an internal implementation |
13:28:35 | mipri | it's because inline iterators are zero cost that you can't have complex control flow like that. where are you storing the continuations? |
13:29:23 | FromDiscord | <tomck> if the 'pasting' is just an implementation detail, it's incredibly leaky lol |
13:29:32 | FromDiscord | <tomck> I don't understand what you mean, zero cost |
13:29:34 | mipri | yeah, OK. |
13:29:58 | FromDiscord | <tomck> hang on, let me paste the example from before |
13:30:19 | FromDiscord | <tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBh |
13:30:35 | FromDiscord | <tomck> here's how it 'could' work trivially, this doesn't currently work |
13:32:55 | mipri | Yeah, that's never going to work. |
13:33:06 | FromDiscord | <tomck> why |
13:34:02 | mipri | I suggest you accept this and backtraack one inch and you'll should immediately find a pretty good solution. |
13:34:17 | FromDiscord | <Rika> well why wouldnt it work |
13:34:26 | mipri | anyway, now that I've seen what you're complaining about, I honestly feel bad for putting in the effort I have already. |
13:34:30 | FromDiscord | <Rika> (im not siding, just curious why you didnt answer) |
13:34:55 | FromDiscord | <tomck> yeah i'm just using a template now |
13:35:05 | FromGitter | <deech> Having a little trouble understanding the semantics of `lent`, does `proc p():lent (ptr int) = ...` mean that `let intPtr = p(); intPtr[] = 100` should be a compiler error? |
13:36:05 | FromDiscord | <tomck> sent a code paste, see https://paste.rs/QNf |
13:36:42 | FromDiscord | <tomck> deech: Don't think that's a compiler error |
13:36:45 | FromDiscord | <tomck> necessarily |
13:38:36 | FromDiscord | <tomck> lent is just an annotation to indicate that the given value isn't owned by you, it might be freed, doesn't indicate any property of the `int` that the pointer points to |
13:39:27 | mipri | https://play.nim-lang.org/#ix=2JBB - Error: 'x.n' cannot be assigned to. s/lent/var/ and it works. |
13:40:37 | FromGitter | <deech> In that case `dealloc intPtr` should be an error? |
13:40:40 | FromDiscord | <tomck> mipri: Yeah, but this is through a `ptr`, right? |
13:43:31 | mipri | *shrug*, a similar example with lent (ptr int) gets nil somehow. This feature isn't stable enough for me to do much asking the compiler about what should work. |
13:44:35 | * | audiofile quit (Quit: Connection closed) |
13:44:39 | mipri | there aren't any lent (...) in the Nim codebase or in the manual, but there are lent objects. |
13:48:27 | mipri | https://play.nim-lang.org/#ix=2JBD - this works without 'lent', allowing p to modify a member of a non-var parameter. With lent I assume that's not possible anymore, but this hits a compiler bug. |
13:52:54 | FromGitter | <deech> This is more the use case I had in mind but it segfaults: https://play.nim-lang.org/ |
13:53:12 | FromGitter | <deech> https://play.nim-lang.org/#ix=2JBF |
14:14:48 | * | NimBot joined #nim |
14:18:38 | FromDiscord | <tomck> deech: just return a Box here,doesn't make sense to return a `lent Box` |
14:18:40 | FromDiscord | <tomck> @deech |
14:20:29 | FromDiscord | <tomck> `lent` is for when you're returning a reference to something that already exists, e.g. https://play.nim-lang.org/#ix=2JBR |
14:21:38 | FromDiscord | <tomck> useful for avoiding copies - if `n` here was a huge value like `seq[int]` instead of just an `int`, returning a `seq[int]` would copy the seq when returning - instead, returning a `lent seq[int]` will avoid the copy by just returning a reference, e.g. `proc getN(b: Box): lent seq[int]` |
14:32:28 | * | Torro quit (Quit: bye) |
14:35:49 | FromGitter | <deech> Then I guess I don't understand `lent` because I thought returning a `lent Thing` meant that you're borrowing it immutably. |
14:38:20 | * | habamax joined #nim |
14:39:19 | FromDiscord | <tomck> yes, borrowing it |
14:39:26 | FromDiscord | <tomck> in your example, you're not borrowing from anything |
14:39:38 | FromDiscord | <tomck> in my example, you're borrowing from the passed in `b` parameter |
14:42:35 | FromGitter | <deech> Ah I see, that makes sense. I'm trying to use `lent` as an immutability guarantee no so much to reduce copying although they are related. |
14:47:52 | * | waleee-cl joined #nim |
14:56:40 | FromDiscord | <tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JC0 |
15:08:56 | * | Tanger quit (Remote host closed the connection) |
15:55:04 | FromDiscord | <shadow.> yessirr |
15:55:07 | FromDiscord | <shadow.> there we go |
15:55:07 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JCy |
16:16:54 | FromDiscord | <mratsim> @gogolxdong: it's there https://github.com/nim-lang/RFCs/issues/295#issuecomment-751296713 |
16:16:55 | disbot | ➥ next steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti |
16:18:03 | FromDiscord | <mratsim> No, async/await will stay, but CPS will solve both interoperability issues between async and multithreading and significantly simplify asyncdispatch and chronos macros (no macros anymore?). |
16:18:18 | FromDiscord | <mratsim> Basically async/await can be implemented very simply in terms of CPS |
16:19:36 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JCH |
16:26:49 | FromDiscord | <mratsim> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2JCJ |
16:36:43 | Zevv | right. As a showcase I'm planning to make an ultratiny async-like lib for running on tiny MCUs, so you can do async I/O from your main code with ISRs doing the work |
16:37:13 | Zevv | so just having a simple ring buffer between uart ISR and main code allowing you to plainly read()/write() without hassle, stuff like that |
16:38:41 | Zevv | mratsim: Im pretty happy that all your sciency work supports my and D.s inital gut feelings :) |
16:39:20 | FromDiscord | <mratsim> 🙂 |
16:40:34 | FromDiscord | <mratsim> that's understating it |
16:40:59 | FromDiscord | <mratsim> I'm starting to write some design I'll try to implement and I hope people will get hyped |
16:43:01 | FromDiscord | <mratsim> here is my current brain dump: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md |
16:44:33 | Zevv | well its not understating. It might have been that we had been blindsighted with our one technical solution and that closures or something else would have been "better" |
16:45:08 | Zevv | But CPS has /felt/ like the right thing to do from the day I properly understood it |
16:46:27 | FromDiscord | <mratsim> Well closures are very similar to closures, except that instead of capturing a proc+parameters to run them later, you capture everything besides that proc+parameters to run them later. |
16:46:43 | Zevv | but we never looked or researched anything beyond CPS like you now did |
16:46:50 | FromDiscord | <mratsim> Yeah it took me sometime to understand them and how we can use them. |
16:47:06 | FromDiscord | <mratsim> Also i'm not the biggest async or IO expert. |
16:47:08 | Zevv | glad you're joining the dark side. |
16:47:37 | Zevv | I believe disruptek said he doesn't believe you're truly in until you got "blood on your hands" |
16:48:08 | FromDiscord | <mratsim> what kind of blood? |
16:48:10 | Zevv | I wonder what exactly should happen for you to meet that criterium, tho |
16:48:13 | Zevv | no idea :) |
16:48:25 | Zevv | lets ask him when he wakes up |
16:49:00 | FromDiscord | <mratsim> My main issue is that the repo is broken, which means that I need to understand the transformatuion without running them |
16:49:24 | Zevv | 0.0.13 werks |
16:49:25 | Zevv | works |
16:49:26 | Zevv | really |
16:49:28 | Zevv | did you try that? |
16:49:40 | disruptek | i think it dumps the transform before the compiler crashes. |
16:49:52 | disruptek | just run that. 😉 |
16:49:58 | Zevv | mratsim: check out 0.0.13 and run the stash/ examples |
16:50:34 | Zevv | git co 0.0.13 |
16:50:34 | disruptek | there's an rfc tag that represents the version i used in the rfc. |
16:50:38 | FromDiscord | <mratsim> yes that's what I did |
16:50:41 | Zevv | nim r -d:cpsDebug stash/iterator.nim |
16:50:48 | FromDiscord | <mratsim> the RFC doesn't run 😉 |
16:51:14 | FromDiscord | <mratsim> I meant, I wanted to run the typed cpsMutant mainly |
16:51:37 | disruptek | mutant hasn't been tested in ages. |
16:51:37 | Zevv | stash/standalone_tcp_server works also, it serves http on port 8000 |
16:51:53 | Zevv | stash/trycatch.nim works also |
16:51:58 | Zevv | I think they all do under 0.0.13 |
16:52:12 | Zevv | We should teach disruptek to keep master running and do his breakage in branches |
16:52:16 | disruptek | the thing is, you don't really need to run anything to understand why cps is killer. |
16:52:17 | Zevv | can we rename 0.0.13 to master maybe |
16:53:27 | disruptek | we can branch the rfc tag to `untyped` if you want. |
16:53:48 | FromDiscord | <exelotl> will it be possible to use cps with --gc:none? |
16:55:07 | FromDiscord | <mratsim> There shouldn't be a technical reason but you have to convince disruptek: https://github.com/disruptek/cps/discussions |
16:55:27 | Zevv | no I want master to work |
16:55:46 | Zevv | because people are generally short sighted and easily put off |
16:55:55 | FromDiscord | <mratsim> in any case, I plan to write or rewrite a CPS that works without any GC for restricted cases |
16:56:03 | Zevv | yes but |
16:56:08 | disruptek | well, sure, make master work if you want. |
16:56:33 | Zevv | mratsim: you're not going all performancy and neglecting the needs of the common people, right |
16:57:02 | Zevv | people like disruptek and me |
16:57:08 | Zevv | UX first, performance later |
16:57:12 | FromDiscord | <mratsim> I'm not neglecting the fact that Nim is a system language and there are systems that have no GC. |
16:57:34 | Zevv | no but also don't neglect that in 99% of the use cases we *have* ARC, and want to leverage that |
16:57:44 | FromDiscord | <mratsim> for the UX, my current design draft has it. |
16:57:50 | Zevv | so no hassles or any kind of special tricks to get it to work, it should just /pop/ work out of the box with refs |
16:58:02 | Zevv | with ARC, to be specific |
16:58:53 | FromDiscord | <mratsim> there is no need to require arc. That's the thing. |
16:59:06 | FromDiscord | <mratsim> the CPS transformation is memory management agnostic. |
16:59:08 | disruptek | how about instead of changing the master branch, we just ask araq to spec typed macros so the compiler can be fixed? |
16:59:17 | FromDiscord | <mratsim> it's just function + storage. |
16:59:20 | Zevv | somewhere in 2023 |
16:59:33 | FromDiscord | <Recruit_main707> cant macros be object pragmas? |
16:59:37 | Zevv | mratsim: right, but that "just storage", how does that get allocated and managed? |
16:59:43 | Zevv | Do users have to /think/ about that? |
16:59:45 | disruptek | it may be agnostic, but 1) the compiler is not, 2) users are not. |
16:59:50 | Zevv | right |
17:00:01 | disruptek | but i've said this too many times. i am starting to sound old. |
17:00:01 | Zevv | so I think this is where the "blood" was referenced |
17:00:09 | disruptek | lol |
17:00:25 | Zevv | but we're not unreasonable. We'll give you the benefit of the doubt :) |
17:01:01 | FromDiscord | <mratsim> To be honest, I don't see why you think that you need to manage the continuation storage yourself |
17:01:43 | FromDiscord | <mratsim> but I'll write something to show that. |
17:01:52 | FromDiscord | <exelotl> for my GBA game I'm using this: <https://github.com/exelotl/ecolo>↵but it's very limited and probably a little buggy. I'm pretty sure it's doing the same kind of thing as CPS but without the formality and lots of features are missing, but they are zero allocation: just function pointers and global variables. |
17:01:55 | Zevv | I need that, I think, so yes please, that would be nice |
17:02:05 | FromDiscord | <mratsim> well I plan to rewrite srtutils,sequtils because those are annoying me to hell for starters. |
17:02:21 | FromDiscord | <mratsim> then maybe streams. |
17:02:23 | Zevv | ooh yes baby talk dirty to me |
17:02:26 | FromDiscord | <mratsim> and then IO. |
17:02:38 | FromDiscord | <mratsim> or you do IO 😛 |
17:02:53 | Zevv | but lets start small. I'd like to see your example snippet like stash/iterators, post-transformed |
17:03:04 | FromDiscord | <Clyybber> disruptek: What needs fixing now? |
17:03:05 | Zevv | to see how you are planning to do the management of the instances there |
17:03:13 | Zevv | disruptek's morale |
17:03:51 | FromDiscord | <Clyybber> the transformation macro is independent on wether we wan't to use GC backed storage for continuations right? |
17:03:59 | FromDiscord | <Clyybber> or is it not split up that way yet? |
17:04:12 | FromDiscord | <mratsim> right now it depends on GC for type erasure |
17:04:25 | FromDiscord | <mratsim> but there is no need for that |
17:04:30 | FromDiscord | <Clyybber> yeah I agree |
17:04:53 | FromDiscord | <Clyybber> but probably we should make that part easily interchangable |
17:05:00 | FromDiscord | <mratsim> GC version: https://github.com/disruptek/cps/blob/master/talk-talk/manual1.nim#L45-L71 |
17:05:09 | FromDiscord | <mratsim> stack version: https://github.com/disruptek/cps/blob/master/talk-talk/manual1_stack.nim#L38-L95 |
17:05:19 | FromDiscord | <Clyybber> so that you could also limit the space continuations would use |
17:05:31 | Zevv | yea I was just looking into those, didn't realise those were there yet |
17:05:34 | FromDiscord | <mratsim> the space is limited, reusable and known at compile-time |
17:05:50 | Zevv | manual1 is still mine, right? |
17:05:57 | FromDiscord | <mratsim> yes |
17:06:01 | Zevv | ok cool |
17:06:06 | Zevv | I think I should be able to understand that one then |
17:06:27 | Zevv | ah the union trick |
17:06:28 | Zevv | riight |
17:06:38 | FromDiscord | <Clyybber> so anybody knows why it crashes currently? |
17:06:43 | FromDiscord | <mratsim> basically, if the Env `supportsCopyMem` we can stack allocate |
17:06:44 | Zevv | disruptek should |
17:07:15 | FromDiscord | <Clyybber> the last bug I found a workable workaround for |
17:07:37 | FromDiscord | <Clyybber> but disruptek already knows about that; maybe he already implemented it |
17:08:35 | FromDiscord | <Clyybber> ah; no; I'll do it |
17:15:31 | FromDiscord | <Clyybber> disruptek: Any example that repros the carnac bug? |
17:17:02 | * | a_chou joined #nim |
17:29:37 | ForumUpdaterBot | New thread by Alexeypetrushin: How to deal with Enums with same names?, see https://forum.nim-lang.org/t/7294 |
17:31:08 | FromDiscord | <mratsim> so @Zevv, is master going to be switched to 0.13? |
17:31:21 | FromDiscord | <mratsim> I'll do the stack changes as a fork of 0.13 |
17:36:01 | * | habamax_ joined #nim |
17:37:42 | * | a_chou quit (Remote host closed the connection) |
17:38:30 | Zevv | if its good with d, lets do that |
17:39:00 | * | habamax quit (Ping timeout: 256 seconds) |
17:40:24 | Zevv | disruptek: what do you want to call current master? |
17:41:24 | * | habamax_ quit (Quit: leaving) |
17:41:51 | * | habamax joined #nim |
17:51:39 | Zevv | hm I don't have the permissions it seems |
17:52:11 | FromDiscord | <geekrelief> godot |
17:58:47 | Oddmonger | godot ? |
18:05:15 | disruptek | clyybber: carnac reproduces the carnac bug. |
18:06:00 | disruptek | zevv: i really think we should leave typed in master; it may help motivate compiler developers to, y'know, develop the compiler. |
18:06:19 | disruptek | mratsim: the rfc tag works. |
18:08:31 | disruptek | zevv: but you should have access to everything; if you don't, tell me what i need to do. it'd be news to me. |
18:09:59 | * | superbia joined #nim |
18:14:20 | FromDiscord | <Clyybber> carnac: Sure, I know but I wanted to put the workaround in cps |
18:14:37 | FromDiscord | <Clyybber> Since it suffered from the same bug no? |
18:14:57 | FromDiscord | <Clyybber> I suspect the dotexpr replace thing might be the same bug |
18:15:40 | FromDiscord | <Clyybber> all replacements in a tree with kind nkHiddenAddr/Deref are affected |
18:19:33 | * | superbia quit (Quit: WeeChat 3.0) |
18:24:19 | disruptek | let's wait for the compiler to be fixed instead. |
18:26:06 | disruptek | clyybber: i don't know if #33 is valid, do you? |
18:26:09 | disruptek | https://github.com/disruptek/cps/issues/33 |
18:26:10 | disbot | ➥ arc crashes compiler or results in move(result, result) |
18:26:23 | disruptek | i can't remember if this is fixed. |
18:26:54 | disruptek | i believe we simply do move(x, x) anymore. |
18:27:03 | disruptek | er, don't move(x, x). |
18:37:00 | Oddmonger | what is the «File» used in many function of terminal.nim ? |
18:37:09 | * | superbia joined #nim |
18:37:23 | Oddmonger | i think it's the terminal, but i don't see any functions to get the handle |
18:48:10 | FromDiscord | <haxscramper> For terminal it most likely refers to `stdout` file |
18:48:52 | * | habamax quit (Quit: leaving) |
18:49:56 | Oddmonger | ah, so i've juste to pass stdout to the function ? |
18:50:13 | Oddmonger | ah i understand |
18:50:26 | Oddmonger | stdout.setColor , and the UFCS do the rest |
18:51:25 | FromDiscord | <Recruit_main707> trying to return an object + a function from a macro, i am having issues:↵ result.add nnkTypeSection.newTree(obj)↵ result.add newFromFlatProc(obj[0][0].basename.strval, fields) |
18:51:28 | FromDiscord | <Recruit_main707> fuck |
18:51:32 | FromDiscord | <Recruit_main707> ill grab a url |
18:55:19 | * | saem joined #nim |
18:55:23 | * | saem waves |
18:58:09 | FromDiscord | <Recruit_main707> trying to return an object + a generated proc from a macro, but get illformed ast, im not sure if this is a bug:↵https://play.nim-lang.org/#ix=2JDw |
19:00:27 | FromDiscord | <Clyybber> > let's wait for the compiler to be fixed instead.↵disruptek: Please lets not do that. Its going to take an indefinite amount of time |
19:00:56 | disruptek | so what? |
19:01:11 | FromDiscord | <Clyybber> its easy to workaround |
19:01:48 | disruptek | why can't the workaround be put in the compiler? |
19:02:28 | FromDiscord | <Clyybber> the workaround is to replace nkHiddenAddr(nkSym) -> nkIdent as a whole in your replacement routine |
19:02:33 | FromDiscord | <Clyybber> but really some more care is required |
19:02:59 | Fish-Face | I still haven't done AoC 19.2 and it's irritating me |
19:03:02 | FromDiscord | <Clyybber> disruptek: Sure, I can put the workaround in the compiler. It would amount to stripping nkHiddenAddr nkHiddenDeref though |
19:03:09 | FromDiscord | <Clyybber> disruptek: And you said you rely on that |
19:03:18 | FromDiscord | <Clyybber> It shouldn't be part of the typed AST IMO |
19:03:26 | FromDiscord | <Clyybber> So lets discuss that and come to a conclusion |
19:06:30 | FromDiscord | <Clyybber> disruptek: grepping for nkHiddenAddr/Deref in cps turns up nothing, are you sure you need them? |
19:06:50 | disruptek | i don't need them /yet/. |
19:07:11 | disruptek | we can remove them in the compiler for now. |
19:07:54 | FromDiscord | <Clyybber> ok |
19:08:03 | disruptek | it would nice if mratsim had at least a prayer of making something work on his first outing. |
19:28:26 | FromDiscord | <Filipe Duarte> Why when I create a variable with rand() from module random, it samples every time I echo? ↵How can I store the value? https://media.discordapp.net/attachments/371759389889003532/792473915582447627/Captura_de_Tela_2020-12-26_as_16.27.16.png |
19:28:55 | FromDiscord | <Filipe Duarte> is varRand a reference for rand(1) proc? |
19:36:26 | Zevv | disruptek: how so? |
19:36:41 | disruptek | what? |
19:36:48 | Zevv | "a prayer..." |
19:37:07 | disruptek | it would be nice if he wasn't blocked by the compiler. |
19:37:24 | Zevv | ah right |
19:37:42 | Zevv | btw, do you have any feelings about the .union. you want to share with the group |
19:38:06 | Zevv | and supportsCopyMem() |
19:38:32 | disruptek | i'm fine with supportsCopyMem but i doubt the union will survive. |
19:39:03 | Zevv | if it goes type erasing, I think it should |
19:39:05 | Zevv | but we'll see |
19:39:50 | disruptek | yeah, i just want to let mamy do his thing. he can probably make it work, and if so, it's great. |
19:40:08 | Zevv | that was my thought as well. I have next week off so I was tempted to go head in again |
19:40:22 | Zevv | but I think I'll lay back and enjoy some time doing other stuf |
19:40:39 | disruptek | yeah, i know as soon as we remove a blocker we'll make fast progress. it'll be a lot of fun. |
19:41:14 | Zevv | I think I'll just get to the same role I had when we had our little sprint |
19:41:22 | Zevv | just using what he delivers and whine about it a lot |
19:42:23 | * | tane joined #nim |
19:43:02 | saem | @Recruit_main707 AFAICS you're getting the the nnkTypeDef ScoreInfo in your macro, but you're already inside a type section. I don't know if you can do what you want to do via a macro pragma on the type. |
19:44:43 | FromDiscord | <Clyybber> @Filipe Duarte Which repl is that? |
19:45:34 | FromDiscord | <Clyybber> It probably builds a program out of the different statements and runs it; and because rand is random you are getting a different output each time |
19:48:07 | Zevv | I don't understand this yet I think. C is a sink object, but not varred |
19:48:33 | FromDiscord | <Filipe Duarte> inim repl running from a terminal. |
19:48:37 | Zevv | so that's immutable, right? |
19:49:17 | FromDiscord | <Clyybber> @Filipe Duarte Yeah; thats the cause then |
19:49:34 | FromDiscord | <Filipe Duarte> I just wanted to save the output of the random sample |
19:52:02 | FromDiscord | <ElegantBeef> It does |
19:52:13 | FromDiscord | <ElegantBeef> Everytime you add code, inim recompiles the program |
19:52:42 | * | fanta1 quit (Quit: fanta1) |
19:54:12 | FromDiscord | <Filipe Duarte> and run the rand() again? |
19:54:31 | FromDiscord | <ElegantBeef> Yep |
19:54:40 | FromDiscord | <Filipe Duarte> but is it possible to store the value, not the rand()? |
19:54:50 | FromDiscord | <ElegantBeef> You are storing the value |
19:55:22 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2JDK |
19:55:40 | FromDiscord | <ElegantBeef> everytime you do `echo randVal` you're causing the program to recompile and it changes the stored value |
19:56:06 | FromDiscord | <Filipe Duarte> Because compiles again on Inim repl. |
19:59:18 | FromDiscord | <Filipe Duarte> Now work |
19:59:36 | FromDiscord | <Filipe Duarte> https://media.discordapp.net/attachments/371759389889003532/792481760495534080/Captura_de_Tela_2020-12-26_as_16.59.30.png |
19:59:39 | FromDiscord | <Clyybber> Maybe inim is willing to shim rand to prevent that behaviour |
19:59:49 | FromDiscord | <Clyybber> @Filipe Duarte heh, removed your randomize() ? |
20:00:22 | FromDiscord | <Filipe Duarte> I did not call randomize() now |
20:00:31 | FromDiscord | <Clyybber> yeah; thats the reason it works now :) |
20:00:31 | FromDiscord | <Filipe Duarte> (edit) "now" => "on the second" |
20:00:44 | FromDiscord | <Filipe Duarte> Thanks |
20:02:15 | FromDiscord | <Filipe Duarte> so randomize() will call rand() every time I call v? |
20:03:32 | FromDiscord | <Clyybber> no, but inim will call rand() everytime you hit enter |
20:03:46 | FromDiscord | <Clyybber> because it will run your program each time you hit enter |
20:06:38 | FromDiscord | <Filipe Duarte> now I understand!! Thanks https://media.discordapp.net/attachments/371759389889003532/792483526255443988/Captura_de_Tela_2020-12-26_as_17.05.32.png |
20:08:08 | FromDiscord | <Filipe Duarte> stored the last value generated on the loop |
20:10:49 | disruptek | zevv: what will you do during your week off? |
20:11:12 | * | Arrrrrrrr quit (Quit: Arrrrrrrr) |
20:11:31 | Zevv | don't know. kids are at home, so no proper focus I'm afraid |
20:12:18 | disruptek | make the most of those kids, i think. |
20:12:32 | Zevv | looking at https://github.com/disruptek/cps/blob/master/talk-talk/manual1_stack.nim, the trampoline is now tied to the type. That was the problem you saw coming. So now what |
20:12:49 | Zevv | disruptek: I gave up on that. They need to do that theirselves I guess |
20:12:56 | disruptek | lol |
20:13:24 | disruptek | i'm telling you, we have to let mratsim bang his own head. |
20:13:50 | disruptek | we're just wasting energy talking about it. 😉 |
20:13:55 | disruptek | i say we work on csp. |
20:14:17 | disruptek | if it takes 100 lines, i'll be disappointed. |
20:14:32 | disruptek | i know that statement will haunt me, but... |
20:14:35 | Zevv | it'll be thin |
20:14:57 | disruptek | csp will need working concepts, though. |
20:15:02 | disruptek | like, /really/ working. |
20:15:18 | Zevv | anyway, I told him today already: I'm pretty glad to see that our gutfeels were right on this, since he came to the same conclusion after a deep dive in literature & other implementations |
20:15:38 | Zevv | I don't care anything about CSP for now, but I'll bit |
20:15:39 | Zevv | e |
20:16:25 | disruptek | mratsim is a good champion for the cause. he'll write a lot of words, benchmarks, and whatnot. |
20:16:44 | disruptek | need more users, though. |
20:16:48 | Zevv | oh I'm sure of that |
20:16:53 | FromDiscord | <notchris> hello my friends |
20:17:04 | Zevv | yeah, so thus my plan to be the loudest user #1 |
20:17:05 | disruptek | sup boss. |
20:17:07 | Zevv | until others pick that up |
20:17:14 | Zevv | hey its chris |
20:17:16 | Zevv | oh no |
20:17:23 | Zevv | it's not |
20:17:39 | notchris | Ayyy |
20:17:40 | notchris | not too much |
20:17:44 | notchris | just hanging |
20:17:52 | notchris | struggling with auth |
20:18:11 | disruptek | oh, are you the one trying to login as me on freenode? |
20:18:29 | notchris | nah must be the evil chris |
20:18:48 | notchris | im trying to figure out the standard for auth / sessions on an express server |
20:19:05 | disruptek | i don't understand why sometimes my asd nick works and other times it doesn't. |
20:19:33 | notchris | and if csrf tokens are necessary |
20:22:30 | disruptek | sounds really, really fun. |
20:24:06 | FromDiscord | <notchris> yeah it sucks |
20:25:00 | FromDiscord | <Recruit_main707> saem: but if i just do result.add obj, it doesnt appear w/ the type section, thats not the issue tho, the issue is that it doesnt remove the pragma brackets for some reason |
20:26:34 | notchris | disruptek: whatcha workin on |
20:26:58 | disruptek | about to drop the kids off at the pool and take the dog for a sniff. |
20:27:36 | notchris | disruptek: that's nice, you must be like west coast |
20:27:40 | notchris | unless its indoors |
20:27:52 | disruptek | nah, it's white-out conditions here. |
20:28:57 | notchris | oh wow |
20:29:10 | notchris | i guess people just like swimming |
20:39:22 | FromDiscord | <bark> I encountered this error for the first time: ↵↵Error: 'result' is of type <string> which cannot be captured as it would violate memory safety, declared here: /home/andrej/Seafile/backup/projects/inaction/readline.nim(3, 1); using '-d:nimWorkaround14447' helps in some cases |
20:39:27 | FromDiscord | <bark> anyone know what it means |
20:39:40 | * | hnOsmium0001 joined #nim |
20:39:52 | FromDiscord | <bark> (edit) "/home/andrej/Seafile/backup/projects/inaction/readline.nim(3," => "/projects/inaction/readline.nim(3," |
20:45:22 | FromDiscord | <mratsim> @zevv, what do you mean "tied to the type"? You can make trampoline a generic function or a concept |
20:46:00 | FromDiscord | <mratsim> Also I don't see any example of `proc foo(a, b: int): int {.cps: C.}` |
20:46:21 | FromDiscord | <mratsim> I assume you don't support return value in cpsified functions yet? |
20:48:32 | FromDiscord | <ElegantBeef> Bark what's your code |
20:50:57 | * | fowl quit (Ping timeout: 260 seconds) |
20:51:52 | * | sirn quit (Ping timeout: 268 seconds) |
20:52:22 | * | kwilczynski quit (Ping timeout: 260 seconds) |
20:52:59 | * | fowl joined #nim |
20:53:11 | * | sirn joined #nim |
20:53:32 | * | kwilczynski joined #nim |
20:59:47 | * | leth joined #nim |
21:00:19 | * | narimiran quit (Quit: leaving) |
21:01:53 | leth | is there a way to make a macro maintain the original type of an argument within it's body? |
21:02:34 | FromDiscord | <ElegantBeef> You could used typed arguments |
21:03:38 | FromDiscord | <ElegantBeef> or a `static[T]`, uncertain what you're doing |
21:03:50 | leth | they will still not be the original typw withing the macro body- |
21:04:24 | leth | I ahve this one argument of a macro that i really only need as it's orignal type rather than a representation of the syntax tree of it. |
21:04:35 | FromDiscord | <ElegantBeef> ah then yea `static[T]` |
21:05:30 | leth | oh, that's it, cheers! |
21:06:03 | * | leorize quit (Ping timeout: 240 seconds) |
21:18:14 | * | Vladar quit (Quit: Leaving) |
21:19:37 | FromDiscord | <mratsim> @leth: ue getTypeInst at the start of the macro to save the type |
21:21:42 | FromDiscord | <mratsim> I wish you well on the road of the typed macros pitfalls |
21:21:53 | FromDiscord | <mratsim> Lots of men fell on that battlefields. |
21:23:58 | * | leorize joined #nim |
21:26:58 | Zevv | mratsim: no, return values not yet |
21:27:13 | Zevv | we thought about that and I think they lived somewhere else in a broken branch once |
21:28:21 | FromDiscord | <mratsim> trying to add them, I'd like to have coroutines with this syntax before doing the union trick |
21:28:48 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JEC |
21:29:03 | Zevv | I did some experiments with that as well, but it's not as useful as I thought it to be because the type is fixed for the whole continuation |
21:29:08 | Zevv | if that makes snese |
21:29:09 | FromDiscord | <mratsim> The coro pragma would automatically create the continuation type from the type signature |
21:29:27 | Zevv | right |
21:29:39 | Zevv | this case is fine, I think we had this at one point |
21:29:43 | Zevv | disruptek: did we? |
21:29:47 | FromDiscord | <mratsim> but it's not a problem, if the end type is T, Continuation[T] is the right type |
21:30:19 | Zevv | I think I also want yield() to be able to return a value :) |
21:30:22 | FromDiscord | <mratsim> basically I think exposing "Cont" is not ergonomic and likely to be confusing |
21:30:23 | Zevv | that's what you pass to resume() |
21:30:49 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JED |
21:30:49 | Zevv | That part of ergonomics we have been struggling with |
21:30:52 | Zevv | to find the right thing |
21:31:50 | FromDiscord | <mratsim> maybe you missed my API for the raw continuations: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md#raw-continuations |
21:32:24 | Zevv | I had a coroutine implementation working on 0.0.13 but that's not checked in it seems. I lost it |
21:32:29 | Zevv | but it was about the same thing |
21:32:35 | FromDiscord | <mratsim> 2 pragmas: {.suspend.} (adds a continuation argument, and nil it if mutant or return nil if classic) |
21:32:35 | Zevv | https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md#raw-continuations |
21:32:42 | * | opal quit (Write error: Connection reset by peer) |
21:33:00 | FromDiscord | <mratsim> and {.resumable.} which is equivalent to {.cps:Cont.} |
21:33:15 | FromDiscord | <mratsim> but the Cont type is autogenerated, I don't see a use case to not autogenerated it |
21:33:28 | Zevv | oh that doc is new to me indeed |
21:33:30 | FromDiscord | <mratsim> and then "bindCallerContinuation" |
21:33:32 | Zevv | let me go through that |
21:33:51 | FromDiscord | <mratsim> resumeContination is calling it |
21:34:20 | FromDiscord | <mratsim> and suspendWith that calls a {.suspend.} proc that will not return immediately. |
21:34:40 | FromDiscord | <mratsim> It's unfinished because I need to prove those works 😛 |
21:35:27 | disruptek | return values don't get impl at this level; a return value is a special form of dispatcher. |
21:35:33 | FromDiscord | <mratsim> AFAIK scheme only has those 3: callCC = suspendsWith, resumeContinuation is just a function call and suspendWith is a lambda |
21:35:36 | disruptek | you can also impl them using a shim. |
21:35:43 | Zevv | ah the shim, right |
21:35:47 | Zevv | that was it |
21:36:00 | FromDiscord | <mratsim> I'll just add a `var result: T` |
21:36:02 | disruptek | the shim is impl but, of course, there's no way to test it. 😁 |
21:36:11 | FromDiscord | <mratsim> for proc that have a result |
21:36:22 | FromDiscord | <mratsim> to give space to the continuation return value |
21:36:42 | disruptek | there's a result field in the code already; it's called "rs" (gensym'd, most likely). |
21:37:22 | disruptek | but anyway... results and exceptions need further discussion to figure out the best ergonomics. |
21:37:44 | disruptek | also stack traces. i think we can do better than our current trace system. |
21:37:55 | Zevv | look at lua for that |
21:38:35 | Zevv | the problem for the current async traces is not nim |
21:38:46 | Zevv | but the fact that the whole ioselector stuff gets traced |
21:38:46 | FromDiscord | <mratsim> right now I'm trying to debug cpsMagic, there is a "result = jield" that doesn't work with in-place continuation on my coroutine example, but works for iterator somehow :/ |
21:38:46 | FromDiscord | <Clyybber> disruptek: Until the fix is in the compiler, we can strip nkHiddenAddr/Deref in normalizingRewrites |
21:38:54 | Zevv | which users couldn't care less about |
21:38:56 | FromDiscord | <mratsim> the problem of async traces is the event loop swallowing everything. |
21:39:11 | FromDiscord | <Clyybber> disruptek: You ok with that? If so I'll push something |
21:39:20 | FromDiscord | <mratsim> CPS without event loop should have nice traces |
21:39:29 | Zevv | it should |
21:39:31 | disruptek | the problem for cps traces is only that they are currently "helped" by the transform. ideally, they are impl entirely in the dispatcher. |
21:39:56 | disruptek | clyybber: i am fine with anything. we can always change code. |
21:39:59 | Zevv | yeah I'm still not sure about that |
21:40:04 | disruptek | araq tells me that "software is soft." |
21:40:16 | FromDiscord | <Clyybber> true |
21:40:45 | Zevv | mratsim: if all references to a coroutine are lost, it is naturally "cancelled", right? |
21:40:50 | Zevv | it just ceases to exist |
21:41:00 | FromDiscord | <mratsim> yes |
21:41:10 | FromDiscord | <mratsim> not calling a continuation means cancelling |
21:41:26 | FromDiscord | <mratsim> then people need to add destructors and/or finalizers for proper collection. |
21:41:33 | Zevv | why? |
21:41:41 | Zevv | they /can/ if they want |
21:41:46 | FromDiscord | <mratsim> if you drop a database handle and it's not closed? |
21:41:47 | Zevv | but if you don't it'll just evaporate |
21:41:57 | Zevv | yeah sure |
21:42:10 | Zevv | but not for the continuations or coroutines themselves |
21:42:22 | FromDiscord | <mratsim> yes those are no problems. |
21:42:34 | FromDiscord | <mratsim> so cancellation isn't too bad. |
21:42:40 | leth | mratsim: Well beeing used to lisp macros, it's a bit different working with macros in nim, but it seems to do the trick. |
21:42:48 | FromDiscord | <mratsim> And I think we can get "async garbage collection" |
21:42:49 | Zevv | this all comes natural to ARC, what about old style refc, this whould just work except for the finalizers right |
21:43:18 | FromDiscord | <mratsim> I think finalizers do work but we don't know when |
21:43:31 | Zevv | exactly. |
21:43:34 | Zevv | it's no longer deterministic |
21:43:55 | FromDiscord | <mratsim> given that those only have one ref count anyway I hope it's "soon" |
21:44:11 | Zevv | with GC's, it's whenever the GC thinks its time |
21:44:18 | Zevv | it might be never |
21:44:43 | FromDiscord | <mratsim> it's when it needs memory. |
21:44:54 | Zevv | which might be never :) |
21:44:56 | FromDiscord | <mratsim> the dreaded "genericReset" |
21:45:06 | FromDiscord | <mratsim> when you return a seq[T] and you don't have {.noInit.} |
21:45:12 | FromDiscord | <mratsim> or Node[T] :/ |
21:46:55 | FromDiscord | <Clyybber> disruptek: Do you remember why nim c tock fails? |
21:47:52 | disruptek | should be the same bug as carnac. |
21:48:20 | Zevv | Went over "First-class continuations", no big surprises here I think |
21:48:38 | FromDiscord | <mratsim> Can we get echo working in the proper order in macros :/ so annoying. https://media.discordapp.net/attachments/371759389889003532/792509195898716231/unknown.png |
21:49:08 | FromDiscord | <mratsim> ah |
21:49:15 | FromDiscord | <mratsim> PEBKAC compiling the wrong file |
21:49:22 | disruptek | heh |
21:49:25 | FromDiscord | <ElegantBeef> Lol |
21:49:34 | FromDiscord | <ElegantBeef> PEBKAC are the worst compiler errors |
21:50:24 | FromDiscord | <mratsim> okay time to sleep. |
21:50:28 | Zevv | part of why I like doing Nim instead of C |
21:50:36 | Zevv | in C the compiler is barely ever wrong |
21:50:40 | Zevv | in Nim it's all the time |
21:50:51 | Zevv | so I can shamelessly blame the compiler |
21:51:08 | Zevv | I have a book which has a chapter called "No, select() is not broken" |
21:51:10 | FromDiscord | <mratsim> especially when you use auto and typedesc |
21:51:12 | Zevv | I had a nice bug a few weeks ago |
21:51:19 | Zevv | involving a broken select() implementation. That was fun |
21:51:21 | FromDiscord | <ElegantBeef> I've pretty much never hit a compiler error, more VM errors than compiler here 😄 |
21:51:38 | FromDiscord | <mratsim> If you don't do generics you miss 80% of the fun |
21:51:40 | Zevv | sleep tight mratsim. |
21:51:49 | disruptek | i mean, really. |
21:51:51 | Zevv | does it happen to you, that if you spend deep time at stuff like this, it hunts your nights? |
21:52:01 | FromDiscord | <mratsim> I had a bug in Weave that resulted in deadlocks, but only on Linux |
21:52:08 | Zevv | when I was up to my elbows in CPS a few months back, it really made for some weeerd dreams |
21:52:19 | FromDiscord | <mratsim> turned out it was glibc conditions variables |
21:52:27 | Zevv | ah I remember that one. Fun as well :) |
21:52:39 | FromDiscord | <mratsim> before sleeping and at wakeup but I don't remember dreams now |
21:52:55 | FromDiscord | <mratsim> when i played go intensively, I dreamed about go. |
21:53:11 | Zevv | imagine if you're really a mathematician and doing a thesis for months or years |
21:53:14 | Zevv | that must be so maddening |
21:53:22 | FromDiscord | <mratsim> apparently it's when you're brain is learning and storing things |
21:53:35 | Zevv | yeah, it's super annoying :) |
21:53:55 | disruptek | that's why when you're learning something, you need to make sure to get a lot of sleep. |
21:54:25 | Zevv | also when you're not learning |
21:54:29 | Zevv | I'm the master of naps |
21:54:35 | Zevv | anytime, anywhere |
21:54:46 | disruptek | probably why i can't learn; i have a pretty annoying sleep disorder. |
21:55:04 | Zevv | yeah, you can't learn dude. Just making the same stupid mistakes all the time |
21:55:17 | disruptek | pretty much. |
21:55:22 | Zevv | just making the same same things over and over |
21:55:46 | Zevv | i bet the gummybears help |
21:56:05 | disruptek | i wish i had some right now. |
21:56:10 | Zevv | aw man |
21:56:12 | FromDiscord | <mratsim> anyway, I think the 3 primitives `bindCallerContinuation`, `resumeContinuation` and `suspendsWith` should cover all your usecases without having to explicitly expose the Cont. And the Continuation are added by `{.resumable.}` (mutate the implicit continuation) and `{.suspend.}` (nil the implicit continuation).↵↵If you have tricky cases you are unsure about, I would be happy to have them |
21:56:37 | Zevv | I'll try to let that part sink in overnight |
21:56:38 | disruptek | why not let the user supply the type? |
21:56:47 | FromDiscord | <mratsim> not ergonomic. |
21:57:05 | disruptek | you think having three different pragmas is more ergonomic? |
21:57:11 | Zevv | we had this 3 tiers of "people" defined with CPS once. We should pick up that lingo again |
21:57:15 | FromDiscord | <mratsim> Continuation is a pretty boring type anyway, a function and environment |
21:57:23 | FromDiscord | <mratsim> it's 2 pragma |
21:57:25 | disruptek | maybe yours are. |
21:57:30 | FromDiscord | <Clyybber> disruptek: stripping doesn't help in tocks case |
21:57:47 | FromDiscord | <mratsim> and better names than cpsMagic and cps:Foo |
21:57:55 | * | disruptek shrugs. |
21:58:06 | Zevv | that's a "yes" in disruptekese |
21:58:10 | FromDiscord | <mratsim> yes |
21:58:13 | disruptek | clyybber: i don't test with tests/tock.nim. |
21:58:43 | disruptek | clyybber: my tests are tests/taste.nim; zevv's are tests/tzevv.nim. |
21:59:04 | FromDiscord | <mratsim> tier 1 raw continuation.↵tier 2: coroutines closure iterators↵tier 2.5 async/await on raw continuations (later)↵tier 3: async/await on closure iterators on continuations |
21:59:26 | FromDiscord | <mratsim> anyway, gtg |
21:59:28 | Zevv | mratsim: right, but when talking about "users" |
21:59:30 | Zevv | where do they live |
21:59:33 | disruptek | mratsim: peace. |
21:59:37 | Zevv | ZzzZ |
21:59:50 | FromDiscord | <Clyybber> mratsim: gn |
22:00:01 | FromDiscord | <mratsim> Most likely at the coroutines level except raw IO API that need fine control over suspend. |
22:00:24 | Zevv | Go away |
22:00:25 | Zevv | sleep |
22:00:33 | FromDiscord | <mratsim> jajaja |
22:00:37 | Zevv | hehehe |
22:24:20 | saem | Fun I got vscode + gdb debugging working with nimsuggest... now it's just a matter of bugs nim-gdb.py for viewing types. |
22:25:26 | * | vicfred quit (Quit: Leaving) |
22:30:12 | * | Q-Master quit (Read error: Connection reset by peer) |
22:31:28 | * | Q-Master joined #nim |
22:39:25 | * | jjido joined #nim |
22:50:24 | * | superbia quit (Quit: WeeChat 3.0) |
22:52:34 | * | vicfred joined #nim |
23:00:06 | ForumUpdaterBot | New question by homesalad: How to get modifyable values from nim Tables, see https://stackoverflow.com/questions/65461457/how-to-get-modifyable-values-from-nim-tables |
23:13:33 | * | Q-Master quit (Read error: Connection reset by peer) |
23:15:07 | * | Q-Master joined #nim |
23:43:52 | * | Q-Master quit (Read error: Connection reset by peer) |
23:44:19 | FromDiscord | <ElegantBeef> @lqdev aw you didnt mention `byaddr` 😄 |
23:44:49 | * | Q-Master joined #nim |
23:46:37 | * | Q-Master quit (Read error: Connection reset by peer) |
23:47:18 | * | Q-Master joined #nim |
23:55:51 | FromDiscord | <lqdev> i always forget about it, simply because it's ugly |
23:56:09 | FromDiscord | <ElegantBeef> I think it's a tad bit less ugly than `cast` |
23:56:38 | FromDiscord | <ElegantBeef> well i guess it's not casted but eitherway |
23:56:48 | FromDiscord | <ElegantBeef> Doesnt require dereferencing |
23:58:09 | * | ^Q-Master^ joined #nim |