<< 26-12-2020 >>

00:06:01*abm joined #nim
00:14:01FromGitter<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:05FromDiscord<Deleted User 5bd78114> Does choosenim work on arm 7?
01:24:11FromDiscord<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:22FromDiscord<Quibono> I'd just like to say that compiling with -d:danger is more fun for me than is probably warranted.
03:39:59FromDiscord<ElegantBeef> what makes it fun?
03:41:41FromDiscord<Quibono> Just watching all the speed benchmarks suddenly go x times faster lol.
03:44:42FromDiscord<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:10disruptekwhile async/await may run on top of cps, there won't be much point to using it.
04:26:45FromDiscord<Quibono> Is there any reason ARC would slow down a proc?
04:33:34FromDiscord<shadow.> when no gc is needed
04:35:08FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2Jzy
04:40:19FromDiscord<ElegantBeef> a is the 97 ascii char
04:40:31FromDiscord<ElegantBeef> 32 + 64 + 1 = 97
04:41:54FromDiscord<ElegantBeef> you're moving the bits i amount
04:42:53FromDiscord<ElegantBeef> @shadow. do you want this? https://play.nim-lang.org/#ix=2JzC
04:43:52FromDiscord<shadow.> yup thanks
04:44:19FromDiscord<shadow.> wait so sorry how is it possible that masking a single bit becomes 32/64?
04:44:58FromDiscord<shadow.> nvm i get it
04:45:01FromDiscord<ElegantBeef> it's like if you put a 1 in a single value in 0000
04:45:13FromDiscord<ElegantBeef> it can be 1000, 100, 10, 1
04:45:13FromDiscord<shadow.> bc the 1 bit isnt at the rightmost position yeah
04:45:20FromDiscord<ElegantBeef> Yes
04:45:23FromDiscord<shadow.> should i just shr by n after then?
04:45:27FromDiscord<ElegantBeef> Right?
04:45:32FromDiscord<ElegantBeef> That was me writting why
04:45:40FromDiscord<shadow.> hm?
04:45:48FromDiscord<ElegantBeef> I didnt mean to write right, i just did
04:45:51FromDiscord<ElegantBeef> I meant why
04:45:54FromDiscord<shadow.> oh lol
04:46:01FromDiscord<shadow.> so that i can get it to be 1
04:46:09FromDiscord<shadow.> then i dont need an if statement
04:46:18FromDiscord<ElegantBeef> Seems pretty silly
04:46:53FromDiscord<shadow.> fair enough
04:47:00FromDiscord<ElegantBeef> but you could
04:47:39FromDiscord<ElegantBeef> I dont get what that iterator is for to be quite honest
04:48:14FromDiscord<shadow.> again, just learning
04:48:21FromDiscord<ElegantBeef> ah
04:49:19*spiderstew joined #nim
04:50:27*spiderstew_ quit (Ping timeout: 260 seconds)
04:50:51FromDiscord<shadow.> sorry, my tone probably got lost over the internet that wasnt meant to be rude or fed up lmao
04:51:02FromDiscord<ElegantBeef> It takes more than that to offend me
04:51:17FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JzH
04:51:38FromDiscord<ElegantBeef> yea it would
04:52:18FromDiscord<shadow.> would cast[uint](c) be any more efficient or is that just silly
04:54:12FromDiscord<ElegantBeef> Cast should rarely be used
04:54:28FromDiscord<ElegantBeef> Only when it's your only option
04:56:29FromDiscord<shadow.> fair enough
04:57:46FromDiscord<ElegantBeef> Error max is nice for debugging/seeing what i'm missing https://media.discordapp.net/attachments/371759389889003532/792254808035295263/unknown.png
04:58:30FromDiscord<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:36FromDiscord<shadow.> i cant inherit from an object that doesn't inherit from root object, can i
05:36:01FromDiscord<shadow.> (edit) "i" => "i?"
05:39:50FromDiscord<ElegantBeef> Did you try it?
05:42:43FromDiscord<shadow.> yes
05:43:20FromDiscord<shadow.> the compiler got mad at me
05:43:33FromDiscord<shadow.> i was just wondering if there's a workaround lol
05:43:44FromDiscord<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:20FromDiscord<flywind> How can I unroll a for loop using templates and iterators? https://github.com/nim-lang/Nim/issues/14695#issuecomment-645173728
06:28:21disbotunroll should be implemented or deprecated
06:41:36saem@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:13Zevvwow mratsim, that's a nice piece of conclusion you wrote up there
07:53:21FromDiscord<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:56FromDiscord<ElegantBeef> `SomeRefObject()` shouldnt be stack allocated
07:54:04miprione's a reference type and the other's a value type.
07:55:25FromDiscord<Balen> doesn't new(SomeObject) return a ref SomeObject which is a reference type, right?
07:55:31FromDiscord<ElegantBeef> Yes
07:55:56FromDiscord<ElegantBeef> !eval type A = ref object; echo A()
07:55:57miprianalogously to how a 'ref object' is a ref to an object
07:55:58NimBotCompile failed: /usercode/in.nim(1, 27) Error: type mismatch: got <A>
07:56:43*leorize quit (Ping timeout: 240 seconds)
07:56:45FromDiscord<ElegantBeef> isnt it impossible to instantiate a ref object not as a ref?
07:57:27FromDiscord<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:30FromDiscord<Balen> sent a code paste, see https://play.nim-lang.org/#ix=2JA2
07:58:33FromDiscord<ElegantBeef> Sure
07:58:48FromDiscord<ElegantBeef> but now to echo b you have to dereference it so it's `echo b[]`
07:59:26FromDiscord<ElegantBeef> Reference objects are managed pointers, whereas objects are raw stack allocated objects
07:59:46*leorize joined #nim
07:59:46FromDiscord<ElegantBeef> You can do `var b: SomeRefObject` and then if you do `b.x = 100` it'll throw a nil error
08:00:39FromDiscord<ElegantBeef> C# has Structs and Classes which behave similarly
08:01:00FromDiscord<ElegantBeef> They allow you to explictly state how assignment behaves and where they're stored
08:01:41FromDiscord<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:58FromDiscord<ElegantBeef> If an object is a ref object it's going to be heap allocated
08:02:30FromDiscord<ElegantBeef> If you want choice, you make your object just a value type then make a `ref YourObject`
08:02:44FromDiscord<ElegantBeef> Which typically is named `YourObjectRef` or `RefYourObject`
08:03:04FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/json.nim#L178
08:03:08FromDiscord<ElegantBeef> It's in the stdlib a lot
08:03:22FromDiscord<Balen> Oh
08:03:48FromDiscord<Balen> so If I wanted to like fine-tune and stack allocate, I could just use a JsonNodeObj in that case
08:03:54miprihttps://play.nim-lang.org/#ix=2JA5
08:04:27FromDiscord<Rika> Yes, because SomeRefObject is a `ref object`
08:04:46FromDiscord<Rika> Referring to the echo b snippet you posted
08:04:46FromDiscord<Balen> makes sense
08:05:07FromDiscord<ElegantBeef> Oh you can instantiate ref objects on the stack, but abusing the underlying object
08:05:24FromDiscord<Balen> like mipri did
08:05:28FromDiscord<Balen> awesome
08:05:31FromDiscord<ElegantBeef> That's what i was commenting on
08:05:35FromDiscord<ElegantBeef> It's uglier than the alternative
08:05:37miprino, what I did was instantiate the anonymous object that A is a ref of
08:05:55FromDiscord<ElegantBeef> Yea that's what i said, or atleast implied
08:05:59mipri'type Blah = ref object' is a shorthand for the same BlahObj and BlahRef you might define separately
08:06:23FromDiscord<Balen> feels less like magic now, thanks y'all.
08:06:40FromDiscord<ElegantBeef> Also worth noting that if you use inheritance you really want to use `ref`
08:06:47FromDiscord<Rika> What mipri did is also pretty hacky, never seen it before
08:07:07FromDiscord<ElegantBeef> Yea it makes sense that it works, but it's not something i'd ever imagine anyone using 😄
08:07:54FromDiscord<Rika> I’ll bonk you if you do
08:12:04disruptekall sorts of strange behavior occurs under the covers.
08:13:57Zevvdisruptek: so, it seems mratsim has seen the light
08:14:08disruptekhook, line, and sinker.
08:14:24disruptekbut, i dunno, maybe he needs to go to school to learn about arc.
08:14:31Zevvgood to see it all backed by some solid sciencing
08:14:37*disruptek yawns.
08:14:40Zevvhehe
08:14:49Zevvafter sesame street for you, boy
08:15:18disrupteki miss that show.
08:15:20Zevvbut you know, people will go hunt our archives one day to see how it all became to be
08:15:29Zevvand they better dig up some proper sciencing
08:15:34Zevvwait what is there no more sesame street?
08:15:50disrupteknot really. i think it's pay-to-play now.
08:16:04Zevvwhat will become of the next generation then
08:16:07disruptekalso, most of the content i knew from years back has been replaced by modern work.
08:16:16disrupteksciencing.
08:16:25ZevvI haven't had a tv for 20 years I think
08:16:40disruptekwe need to get mratsim focussed on more than just performance.
08:16:47Zevvoh he is
08:16:55disruptekabout most of this stuff... "i don't care."
08:16:56Zevvhis #1 on the list is now ergonomics, right
08:17:04disrupteki doubt that.
08:17:22disruptekhe wrote that CTA just to inspire the common plebs.
08:18:12Zevvif that what it takes, good
08:18:31Zevvthe common plebs don't weave, do they
08:18:37disrupteki don't see anyone else lining up to get their hands dirty.
08:18:56disruptekhe needs to get messy with the code and see what we're up against.
08:19:31disruptekit'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:36FromDiscord<ElegantBeef> I can barely thread a needle nevermind weave
08:19:54Zevvright, so from his list #1 is actually a design doc
08:19:56Zevvok, fine
08:20:04Zevvand #2 is "get the compiler bugs fixed"
08:20:19disruptekeasier said than done.
08:20:29Zevvcmon stop whining
08:20:56Zevvyou wanted others to see the light and help pushing this shit cart up the hill
08:21:06disruptektoday i built a squid cache hierarchy to try to improve my internet.
08:21:15Zevvyou're reading it wrong
08:21:19Zevvnot squid cache
08:21:22disruptektomorrow i need to resume porting nimph to ups.
08:21:34disruptekthen add a few lines to gitnim, a few lines to dist.
08:23:06disruptekmratsim needs his first blood.
08:23:15disruptekthen i will return to cps.
08:24:08Zevvfair enough
08:25:11Zevvthere's also tribes where they send the kids to roll in a nest of fire ants
08:25:42disrupteki'm fine with the ants, but we don't need to paint him with honey first.
08:25:48disruptekhe's done that well enough himself.
08:26:50disruptekremember, zevv: no plan survives encounter with the enemy.
08:28:34ZevvWe'll see. But honestly, of all the people to get on board, mratsim isn't the worse we could end up with
08:28:45FromDiscord<ElegantBeef> Nah that'd be me
08:28:55Zevvyeah, imagine
08:29:03disrupteki pity the fool.
08:29:13Zevvelegantbeef, disruptek and me
08:29:13Zevvha ha
08:29:18disruptekbut it's nice to know someone agrees with us.
08:29:36FromDiscord<ElegantBeef> I'm still a little lost why you guys talk about child protective services so muc
08:29:37FromDiscord<ElegantBeef> (edit) "muc" => "much"
08:29:42FromDiscord<Rika> What is happening
08:29:59disrupteki was starting to think i was losing my mind.
08:30:07disruptekthat was a few years ago. now i'm sure it's gone.
08:30:07FromDiscord<ElegantBeef> Those two are scheming to replace the logic behind async with CPS
08:30:29disruptekhonestly i stopped caring about async in august.
08:30:52disruptekit's kinda like channels. i just know i'm never going there again, and i'm fine with it.
08:31:21FromDiscord<ElegantBeef> Isnt your current RFC about replacing async's internals with your continuation stuff
08:31:33FromDiscord<ElegantBeef> To remove dependancies/binary size
08:31:40disruptekyes and no.
08:31:57disruptekit was a rebuttal to my feud with dom, but i always wanted to move the needle on the bugs blocking cps.
08:32:07FromDiscord<ElegantBeef> Ah
08:32:20disruptekthe point is that it's not something to argue about.
08:32:29FromDiscord<ElegantBeef> Well most things arent
08:34:21FromDiscord<ElegantBeef> I personally do like the lack of dependancies
08:35:21disrupteki mean, i get that, but it's really not the message.
08:35:32disruptekand, to be fair, dom was right that i stacked the deck in the examples.
08:35:47FromDiscord<ElegantBeef> Well i dont use async or threading so it's really all i see that i like 😄
08:36:09disruptekit's not just concurrency, actually.
08:36:28ForumUpdaterBotNew thread by Domogled: Let's work :-), see https://forum.nim-lang.org/t/7293
08:36:34disruptekin fact, it could be that explaining it without bringing concurrency in makes the impact more obvious.
08:36:47disruptekmaybe we've been muddying the waters with the damned async angle.
08:37:33FromDiscord<CodeHz> is that a bug of compiler? https://play.nim-lang.org/#ix=2JAa
08:38:04FromDiscord<ElegantBeef> A generic converter is scary
08:38:08disruptekyou 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:11FromDiscord<ElegantBeef> As it applies to everything
08:38:26disruptekcodehz: read this, please:
08:38:34disruptek~disrupstyle
08:38:35disbotdisrupstyle: 11tips for writing code that won't provoke 😠 rants 🤬 on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek
08:38:46disrupteki guess i need to add a section on converters.
08:39:05disruptekdo not use them, unless...
08:39:12disruptekthey aren't exported, and
08:39:21disruptekthey exist only to grandfather types, or
08:39:46disruptekthey exist to expose access to data that you otherwise do not have (think, a return type that is not exported to you).
08:40:01disruptekand, like, one other teeny-tiny super-subtle use case that i forget.
08:40:08disruptekbut, like, just don't fucking use them.
08:40:35FromDiscord<ElegantBeef> an explicit call is almost always better
08:40:36disruptekoh, they are good for boxing.
08:40:48disruptekthat's it. really. like, those three things.
08:40:50disrupteknothing else.
08:41:08FromDiscord<ElegantBeef> I think impbox uses them with his aliased floats/ints for nico
08:41:47FromDiscord<ElegantBeef> Ah yea he does
08:41:59FromDiscord<ElegantBeef> That's like the only time i've ever seen them
08:42:04disruptekthat sounds like boxing.
08:42:20FromDiscord<ElegantBeef> I'm not much of a sports fan
08:42:54disruptekconverters are one of these things like term-rewriting macros (but less dangerous) that really should be behind safety glass.
08:42:55FromDiscord<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:15disrupteksee my section on tuples.
08:43:56miprihttps://play.nim-lang.org/#ix=2JAe - second converter isn't doing anything.
08:44:23FromDiscord<ElegantBeef> Yep it's not invoked so the usage of it isnt error ridden
08:44:43FromDiscord<CodeHz> ( I think the problem is not about tuple
08:44:45FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2JAf
08:44:47disruptekdon't encourage him.
08:44:56FromDiscord<CodeHz> it is about the type alias with generic
08:45:05FromDiscord<flywind> generics convertor is ugly and should not be used.
08:45:09FromDiscord<ElegantBeef> No it's about the fact it's not invoked with the `1 + 1` example
08:45:34disruptekgenerics don't exist unless instantiated.
08:45:42disruptekbut, look, seriously, do not do this thing.
08:46:44FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2JAg see there is no compilation error here
08:46:55FromDiscord<ElegantBeef> It's not semantically incorrect, it's just that you dont fucking invoke it 😄
08:47:24FromDiscord<ElegantBeef> But yes dont do it
08:48:59miprihttps://play.nim-lang.org/#ix=2JAh meanwhile
08:49:11Zevv6
08:49:29FromDiscord<ElegantBeef> Thanks mipri, i hate it
08:49:48miprithat's a very weak password, Zevv
08:50:06FromDiscord<ElegantBeef> Better than mine, of password
08:51:14FromDiscord<CodeHz> (https://play.nim-lang.org/#ix=2JAj↵And seq with type alias also give error
08:51:54Zevvit sufficient, the entropy is in my username
08:53:54mipriagain: https://play.nim-lang.org/#ix=2JAk
08:58:55mipriwhat 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:29FromDiscord<CodeHz> But if you replace P with seq, all example works
09:00:06*Jitty[m] quit (Quit: Idle for 30+ days)
09:00:22mipriwhat you achieved there was the converter not triggering at all
09:02:22FromDiscord<CodeHz> (yes , but it still break 1+1, it is unexpected behaviour..
09:03:30mipriOK, 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:35FromDiscord<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:31FromDiscord<ElegantBeef> In the meantime people can stop using converters
09:10:02miprisure. the two converters are reacted to with two different paths through the compiler and this number should be reduced to one path.
09:12:50miprialthough 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:44miprithe 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:08hmmmyo!
11:11:53FromDiscord<Rika> hello re"hm+"
11:15:41*Deknos left #nim (#nim)
11:17:28mipriwatc[hm]aker
11:18:34*Torro quit (Quit: bye)
11:18:51FromDiscord<Rika> whats a watchaker / watcmaker
11:22:07*Torro joined #nim
11:23:49*audiofile joined #nim
11:24:05audiofilewhen do I use ref object vs just object?
11:24:18audiofilewhen creating a type^
11:24:54FromDiscord<flywind> https://forum.nim-lang.org/t/1207
11:25:00FromDiscord<flywind> ^
11:25:10audiofilewent through that and the linked reddit post...still not cleaer :(
11:26:49FromDiscord<flywind> What's your application?
11:28:02audiofilejust trying to figure out when to use whatt
11:28:07audiofileno concrete application yet
11:28:50mipritake Nim's own default position of using object, and switch to ref object if you find you only ever want reference semantisc
11:32:24FromDiscord<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:47FromDiscord<flywind> `ref object` is allocated in heap, controlled by GC and harmful to multiple threading.
11:34:09*hmmmm joined #nim
11:35:34FromDiscord<Rika> but `object`s cannot contain fields of itself
11:36:54*hmmm quit (Ping timeout: 256 seconds)
11:39:18audiofileRika what does that mean
11:39:36audiofilelike a Tree ref can reference Tree as fields but not if it's defined as an object only?
11:40:34FromDiscord<Rika> Yeah
11:42:25FromDiscord<Rika> type tree = ref object ... tree1: tree # ok
11:42:34FromDiscord<Rika> type tree = object ... tree1: tree # not ok
11:49:01*hmmmm left #nim (#nim)
11:53:03audiofilethanks!
12:27:35audiofileis there any performance advantage of using Table over OrderedTable?
12:28:23*bacterio quit (Ping timeout: 260 seconds)
12:29:38miprithere might be. OrderedTables do a little bit more work and use more memory (twice as much, probably)
12:29:49mipriif you don't need the extra work I wouldn't bother with it.
12:30:57mipriif 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:05audiofileoh wow, source for that ~2x mem usage please?
12:32:17FromDiscord<Rika> i believe ordered tables dont take any more memory than normal
12:32:21miprihttps://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/tables.nim#L1224
12:32:25FromDiscord<Rika> since tables are internally seqs
12:32:38*Vladar joined #nim
12:33:15mipriI 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:32FromDiscord<Rika> no, ordered tables only have an extra next field it seems
12:33:56*def- quit (Quit: -)
12:34:02mipriyeah it's a linked list threaded through the table buckets
12:34:07*def-- joined #nim
12:34:23FromDiscord<Rika> so is it really 2x memory usage smh
12:34:30miprino, not at all
12:34:31*def-- is now known as def-
12:35:06miprimemory use of a table over object types will dwarf the size of this stuff
12:35:17miprithat's what I thought might get duplicated, and it's not
12:35:42*bacterio joined #nim
12:36:06mipriif 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:31FromDiscord<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:19FromDiscord<CodeHz> var Option ?
12:48:36FromDiscord<CodeHz> https://nim-lang.org/docs/options.html#get%2COption%5BT%5D_2
12:48:47FromDiscord<Rika> i dont understand the concept of returning a mutable
12:48:52FromDiscord<Rika> what's the usecase?
12:49:18FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBe
12:49:35FromDiscord<tomck> @Balen I'm pretty sure you can just return a `var Product`, what's the GC issue?
12:50:21FromDiscord<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:28FromDiscord<Balen> so I want to return an option
12:50:34FromDiscord<tomck> the way it was explained to me, `var T` is just `T&` in c++
12:50:34FromDiscord<CodeHz> no possible, since yield must be inlined
12:50:57FromDiscord<tomck> oh right, yeah i odn't think `Option[var T]` is valid..?
12:51:08FromDiscord<tomck> just returning a `ptr T` works, & check for nil
12:51:16FromDiscord<Rika> have you tried it
12:51:23FromDiscord<Balen> I did
12:51:42FromDiscord<Balen> var Product not valid in context it was I think
12:51:51FromDiscord<tomck> @CodeHz I don't understand why inlining makes this an issue?
12:51:52FromDiscord<Rika> time to learn lent and sink i guess
12:52:22FromDiscord<Rika> i dont understand how the code would be valid
12:52:26FromDiscord<Rika> you cant yield in a proc
12:52:42FromDiscord<tomck> I can inline my code manually just fine
12:53:18FromDiscord<CodeHz> or you must make every function to be iterator
12:53:28FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBh
12:53:36FromDiscord<CodeHz> (just like you cannot return from another function
12:53:50FromDiscord<tomck> no, it just needs to create a new callback function each time i instantiate the iterator
12:54:03FromDiscord<tomck> but yielding isn't returning, you're just pasting code
12:54:58FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=2JBi
12:55:17FromDiscord<Recruit_main707> without that result at the end :p
12:58:52FromDiscord<CodeHz> consider the function will called in multiple times? or even never called? it cannot be observed from function signature
12:59:00FromDiscord<CodeHz> (edit) "observed" => "get"
12:59:06FromDiscord<CodeHz> (edit) "it" => "this information"
12:59:47FromDiscord<CodeHz> or be stored and called outside of scope
12:59:58FromDiscord<CodeHz> (edit) "scope" => "scope, make everything wrong"
13:00:10FromDiscord<tomck> @CodeHz that doesn't matter
13:00:24FromDiscord<CodeHz> but as a language feature, it should be safe
13:00:29FromDiscord<tomck> nim has templates
13:00:48FromDiscord<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:57FromDiscord<Rika> but they are not templates
13:00:59FromDiscord<Rika> they are iterators
13:01:04FromDiscord<CodeHz> yes, you can doing crazy thing with template or macro
13:01:14FromDiscord<CodeHz> but it is not template or macro
13:01:17FromDiscord<Rika> they may act like templates but that is not because they try to be templates
13:01:38FromDiscord<CodeHz> I don't think create footgun is a good idea(
13:02:25FromDiscord<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:58FromDiscord<tomck> why are inline iterators like they are then?
13:02:59FromDiscord<Rika> both of them are pretty fundamentally different
13:03:03FromDiscord<tomck> why not rust-like iterators instead?
13:03:04FromDiscord<Rika> because they are fast
13:03:13FromDiscord<tomck> they're not fast, they're just force-inlined
13:03:20FromDiscord<Rika> which is fast
13:03:21FromDiscord<tomck> rust iterators get inlined too
13:03:26FromDiscord<CodeHz> (PS: {.closure.} iterator cannot do that either(
13:03:34FromDiscord<tomck> there's no benefit to this, you just make it slow in the case where you can't inline
13:07:31FromDiscord<CodeHz> wait, rust's generator cannot yield from another callback, even it has been marked as FnOnce
13:08:37FromDiscord<tomck> yes, rust iterators do not just paste the code in like a template
13:11:10FromDiscord<CodeHz> but that doesn't mean nim's inline iterator same as copy pasting
13:12:14mipriC++/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:57FromDiscord<Rika> ~~i'd love to see fast first class iterators in nim tho~~
13:13:11mipriNim'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:22FromDiscord<CodeHz> unless nim has llvm back-end(
13:13:29FromDiscord<flywind> https://github.com/nim-lang/Nim/pull/11992
13:13:31disbotevery 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:46mipriKotlin's another language with a feature like Nim's inline iterators.
13:14:18FromDiscord<CodeHz> (but it also have inline callback
13:14:24mipriyeah 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:25FromDiscord<CodeHz> allow returning from callback
13:14:45FromDiscord<CodeHz> (edit) "allow returning ... from" added "(top level functino)"
13:14:53FromDiscord<CodeHz> (edit) "functino)" => "function)"
13:16:52FromDiscord<Deleted User 5bd78114> @CodeHz
13:17:01FromDiscord<Deleted User 5bd78114> !repo nlvm
13:17:02disbothttps://github.com/arnetheduck/nlvm -- 9nlvm: 11LLVM-based compiler for the Nim language 15 360⭐ 26🍴 7& 1 more...
13:17:33FromDiscord<CodeHz> (but it doesn't seem "complete" 😦
13:17:55FromDiscord<Deleted User 5bd78114> Yeah :/
13:18:03FromDiscord<Deleted User 5bd78114> You could compile with Clang?
13:18:24FromDiscord<Deleted User 5bd78114> Or llvm-gcc (yes that's a thing apparently)
13:18:49FromDiscord<CodeHz> (I actually use clang-cl in windows to get native debug info
13:20:33mipriyeah, 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:38FromDiscord<Deleted User 5bd78114> O
13:21:45mipriinline 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:01FromDiscord<CodeHz> (FP style will use pattern match and recursive ( make optimizer work harder and harder
13:23:58miprialthough 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:11miprifor whatever the complaint is here, about "not being able to yield in a proc", I didn't follow.
13:27:08FromDiscord<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:43FromDiscord<tomck> seems like iterators have the same restrictions as iterators that you can call `.next()` on
13:28:12mipriI don't see how that 'given' follows at all.
13:28:31FromDiscord<Rika> which is intentional because the "pasting" part is an internal implementation
13:28:35mipriit'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:23FromDiscord<tomck> if the 'pasting' is just an implementation detail, it's incredibly leaky lol
13:29:32FromDiscord<tomck> I don't understand what you mean, zero cost
13:29:34mipriyeah, OK.
13:29:58FromDiscord<tomck> hang on, let me paste the example from before
13:30:19FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2JBh
13:30:35FromDiscord<tomck> here's how it 'could' work trivially, this doesn't currently work
13:32:55mipriYeah, that's never going to work.
13:33:06FromDiscord<tomck> why
13:34:02mipriI suggest you accept this and backtraack one inch and you'll should immediately find a pretty good solution.
13:34:17FromDiscord<Rika> well why wouldnt it work
13:34:26miprianyway, now that I've seen what you're complaining about, I honestly feel bad for putting in the effort I have already.
13:34:30FromDiscord<Rika> (im not siding, just curious why you didnt answer)
13:34:55FromDiscord<tomck> yeah i'm just using a template now
13:35:05FromGitter<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:05FromDiscord<tomck> sent a code paste, see https://paste.rs/QNf
13:36:42FromDiscord<tomck> deech: Don't think that's a compiler error
13:36:45FromDiscord<tomck> necessarily
13:38:36FromDiscord<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:27miprihttps://play.nim-lang.org/#ix=2JBB - Error: 'x.n' cannot be assigned to. s/lent/var/ and it works.
13:40:37FromGitter<deech> In that case `dealloc intPtr` should be an error?
13:40:40FromDiscord<tomck> mipri: Yeah, but this is through a `ptr`, right?
13:43:31mipri*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:39miprithere aren't any lent (...) in the Nim codebase or in the manual, but there are lent objects.
13:48:27miprihttps://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:54FromGitter<deech> This is more the use case I had in mind but it segfaults: https://play.nim-lang.org/
13:53:12FromGitter<deech> https://play.nim-lang.org/#ix=2JBF
14:14:48*NimBot joined #nim
14:18:38FromDiscord<tomck> deech: just return a Box here,doesn't make sense to return a `lent Box`
14:18:40FromDiscord<tomck> @deech
14:20:29FromDiscord<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:38FromDiscord<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:49FromGitter<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:19FromDiscord<tomck> yes, borrowing it
14:39:26FromDiscord<tomck> in your example, you're not borrowing from anything
14:39:38FromDiscord<tomck> in my example, you're borrowing from the passed in `b` parameter
14:42:35FromGitter<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:40FromDiscord<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:04FromDiscord<shadow.> yessirr
15:55:07FromDiscord<shadow.> there we go
15:55:07FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JCy
16:16:54FromDiscord<mratsim> @gogolxdong: it's there https://github.com/nim-lang/RFCs/issues/295#issuecomment-751296713
16:16:55disbotnext steps for CPS ; snippet at 12https://play.nim-lang.org/#ix=2Gti
16:18:03FromDiscord<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:18FromDiscord<mratsim> Basically async/await can be implemented very simply in terms of CPS
16:19:36FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JCH
16:26:49FromDiscord<mratsim> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2JCJ
16:36:43Zevvright. 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:13Zevvso 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:41Zevvmratsim: Im pretty happy that all your sciency work supports my and D.s inital gut feelings :)
16:39:20FromDiscord<mratsim> 🙂
16:40:34FromDiscord<mratsim> that's understating it
16:40:59FromDiscord<mratsim> I'm starting to write some design I'll try to implement and I hope people will get hyped
16:43:01FromDiscord<mratsim> here is my current brain dump: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md
16:44:33Zevvwell 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:08ZevvBut CPS has /felt/ like the right thing to do from the day I properly understood it
16:46:27FromDiscord<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:43Zevvbut we never looked or researched anything beyond CPS like you now did
16:46:50FromDiscord<mratsim> Yeah it took me sometime to understand them and how we can use them.
16:47:06FromDiscord<mratsim> Also i'm not the biggest async or IO expert.
16:47:08Zevvglad you're joining the dark side.
16:47:37ZevvI believe disruptek said he doesn't believe you're truly in until you got "blood on your hands"
16:48:08FromDiscord<mratsim> what kind of blood?
16:48:10ZevvI wonder what exactly should happen for you to meet that criterium, tho
16:48:13Zevvno idea :)
16:48:25Zevvlets ask him when he wakes up
16:49:00FromDiscord<mratsim> My main issue is that the repo is broken, which means that I need to understand the transformatuion without running them
16:49:24Zevv0.0.13 werks
16:49:25Zevvworks
16:49:26Zevvreally
16:49:28Zevvdid you try that?
16:49:40disrupteki think it dumps the transform before the compiler crashes.
16:49:52disruptekjust run that. 😉
16:49:58Zevvmratsim: check out 0.0.13 and run the stash/ examples
16:50:34Zevvgit co 0.0.13
16:50:34disruptekthere's an rfc tag that represents the version i used in the rfc.
16:50:38FromDiscord<mratsim> yes that's what I did
16:50:41Zevvnim r -d:cpsDebug stash/iterator.nim
16:50:48FromDiscord<mratsim> the RFC doesn't run 😉
16:51:14FromDiscord<mratsim> I meant, I wanted to run the typed cpsMutant mainly
16:51:37disruptekmutant hasn't been tested in ages.
16:51:37Zevvstash/standalone_tcp_server works also, it serves http on port 8000
16:51:53Zevvstash/trycatch.nim works also
16:51:58ZevvI think they all do under 0.0.13
16:52:12ZevvWe should teach disruptek to keep master running and do his breakage in branches
16:52:16disruptekthe thing is, you don't really need to run anything to understand why cps is killer.
16:52:17Zevvcan we rename 0.0.13 to master maybe
16:53:27disruptekwe can branch the rfc tag to `untyped` if you want.
16:53:48FromDiscord<exelotl> will it be possible to use cps with --gc:none?
16:55:07FromDiscord<mratsim> There shouldn't be a technical reason but you have to convince disruptek: https://github.com/disruptek/cps/discussions
16:55:27Zevvno I want master to work
16:55:46Zevvbecause people are generally short sighted and easily put off
16:55:55FromDiscord<mratsim> in any case, I plan to write or rewrite a CPS that works without any GC for restricted cases
16:56:03Zevvyes but
16:56:08disruptekwell, sure, make master work if you want.
16:56:33Zevvmratsim: you're not going all performancy and neglecting the needs of the common people, right
16:57:02Zevvpeople like disruptek and me
16:57:08ZevvUX first, performance later
16:57:12FromDiscord<mratsim> I'm not neglecting the fact that Nim is a system language and there are systems that have no GC.
16:57:34Zevvno but also don't neglect that in 99% of the use cases we *have* ARC, and want to leverage that
16:57:44FromDiscord<mratsim> for the UX, my current design draft has it.
16:57:50Zevvso 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:02Zevvwith ARC, to be specific
16:58:53FromDiscord<mratsim> there is no need to require arc. That's the thing.
16:59:06FromDiscord<mratsim> the CPS transformation is memory management agnostic.
16:59:08disruptekhow about instead of changing the master branch, we just ask araq to spec typed macros so the compiler can be fixed?
16:59:17FromDiscord<mratsim> it's just function + storage.
16:59:20Zevvsomewhere in 2023
16:59:33FromDiscord<Recruit_main707> cant macros be object pragmas?
16:59:37Zevvmratsim: right, but that "just storage", how does that get allocated and managed?
16:59:43ZevvDo users have to /think/ about that?
16:59:45disruptekit may be agnostic, but 1) the compiler is not, 2) users are not.
16:59:50Zevvright
17:00:01disruptekbut i've said this too many times. i am starting to sound old.
17:00:01Zevvso I think this is where the "blood" was referenced
17:00:09disrupteklol
17:00:25Zevvbut we're not unreasonable. We'll give you the benefit of the doubt :)
17:01:01FromDiscord<mratsim> To be honest, I don't see why you think that you need to manage the continuation storage yourself
17:01:43FromDiscord<mratsim> but I'll write something to show that.
17:01:52FromDiscord<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:55ZevvI need that, I think, so yes please, that would be nice
17:02:05FromDiscord<mratsim> well I plan to rewrite srtutils,sequtils because those are annoying me to hell for starters.
17:02:21FromDiscord<mratsim> then maybe streams.
17:02:23Zevvooh yes baby talk dirty to me
17:02:26FromDiscord<mratsim> and then IO.
17:02:38FromDiscord<mratsim> or you do IO 😛
17:02:53Zevvbut lets start small. I'd like to see your example snippet like stash/iterators, post-transformed
17:03:04FromDiscord<Clyybber> disruptek: What needs fixing now?
17:03:05Zevvto see how you are planning to do the management of the instances there
17:03:13Zevvdisruptek's morale
17:03:51FromDiscord<Clyybber> the transformation macro is independent on wether we wan't to use GC backed storage for continuations right?
17:03:59FromDiscord<Clyybber> or is it not split up that way yet?
17:04:12FromDiscord<mratsim> right now it depends on GC for type erasure
17:04:25FromDiscord<mratsim> but there is no need for that
17:04:30FromDiscord<Clyybber> yeah I agree
17:04:53FromDiscord<Clyybber> but probably we should make that part easily interchangable
17:05:00FromDiscord<mratsim> GC version: https://github.com/disruptek/cps/blob/master/talk-talk/manual1.nim#L45-L71
17:05:09FromDiscord<mratsim> stack version: https://github.com/disruptek/cps/blob/master/talk-talk/manual1_stack.nim#L38-L95
17:05:19FromDiscord<Clyybber> so that you could also limit the space continuations would use
17:05:31Zevvyea I was just looking into those, didn't realise those were there yet
17:05:34FromDiscord<mratsim> the space is limited, reusable and known at compile-time
17:05:50Zevvmanual1 is still mine, right?
17:05:57FromDiscord<mratsim> yes
17:06:01Zevvok cool
17:06:06ZevvI think I should be able to understand that one then
17:06:27Zevvah the union trick
17:06:28Zevvriight
17:06:38FromDiscord<Clyybber> so anybody knows why it crashes currently?
17:06:43FromDiscord<mratsim> basically, if the Env `supportsCopyMem` we can stack allocate
17:06:44Zevvdisruptek should
17:07:15FromDiscord<Clyybber> the last bug I found a workable workaround for
17:07:37FromDiscord<Clyybber> but disruptek already knows about that; maybe he already implemented it
17:08:35FromDiscord<Clyybber> ah; no; I'll do it
17:15:31FromDiscord<Clyybber> disruptek: Any example that repros the carnac bug?
17:17:02*a_chou joined #nim
17:29:37ForumUpdaterBotNew thread by Alexeypetrushin: How to deal with Enums with same names?, see https://forum.nim-lang.org/t/7294
17:31:08FromDiscord<mratsim> so @Zevv, is master going to be switched to 0.13?
17:31:21FromDiscord<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:30Zevvif its good with d, lets do that
17:39:00*habamax quit (Ping timeout: 256 seconds)
17:40:24Zevvdisruptek: what do you want to call current master?
17:41:24*habamax_ quit (Quit: leaving)
17:41:51*habamax joined #nim
17:51:39Zevvhm I don't have the permissions it seems
17:52:11FromDiscord<geekrelief> godot
17:58:47Oddmongergodot ?
18:05:15disruptekclyybber: carnac reproduces the carnac bug.
18:06:00disruptekzevv: i really think we should leave typed in master; it may help motivate compiler developers to, y'know, develop the compiler.
18:06:19disruptekmratsim: the rfc tag works.
18:08:31disruptekzevv: 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:20FromDiscord<Clyybber> carnac: Sure, I know but I wanted to put the workaround in cps
18:14:37FromDiscord<Clyybber> Since it suffered from the same bug no?
18:14:57FromDiscord<Clyybber> I suspect the dotexpr replace thing might be the same bug
18:15:40FromDiscord<Clyybber> all replacements in a tree with kind nkHiddenAddr/Deref are affected
18:19:33*superbia quit (Quit: WeeChat 3.0)
18:24:19disrupteklet's wait for the compiler to be fixed instead.
18:26:06disruptekclyybber: i don't know if #33 is valid, do you?
18:26:09disruptekhttps://github.com/disruptek/cps/issues/33
18:26:10disbotarc crashes compiler or results in move(result, result)
18:26:23disrupteki can't remember if this is fixed.
18:26:54disrupteki believe we simply do move(x, x) anymore.
18:27:03disrupteker, don't move(x, x).
18:37:00Oddmongerwhat is the «File» used in many function of terminal.nim ?
18:37:09*superbia joined #nim
18:37:23Oddmongeri think it's the terminal, but i don't see any functions to get the handle
18:48:10FromDiscord<haxscramper> For terminal it most likely refers to `stdout` file
18:48:52*habamax quit (Quit: leaving)
18:49:56Oddmongerah, so i've juste to pass stdout to the function ?
18:50:13Oddmongerah i understand
18:50:26Oddmongerstdout.setColor , and the UFCS do the rest
18:51:25FromDiscord<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:28FromDiscord<Recruit_main707> fuck
18:51:32FromDiscord<Recruit_main707> ill grab a url
18:55:19*saem joined #nim
18:55:23*saem waves
18:58:09FromDiscord<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:27FromDiscord<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:56disruptekso what?
19:01:11FromDiscord<Clyybber> its easy to workaround
19:01:48disruptekwhy can't the workaround be put in the compiler?
19:02:28FromDiscord<Clyybber> the workaround is to replace nkHiddenAddr(nkSym) -> nkIdent as a whole in your replacement routine
19:02:33FromDiscord<Clyybber> but really some more care is required
19:02:59Fish-FaceI still haven't done AoC 19.2 and it's irritating me
19:03:02FromDiscord<Clyybber> disruptek: Sure, I can put the workaround in the compiler. It would amount to stripping nkHiddenAddr nkHiddenDeref though
19:03:09FromDiscord<Clyybber> disruptek: And you said you rely on that
19:03:18FromDiscord<Clyybber> It shouldn't be part of the typed AST IMO
19:03:26FromDiscord<Clyybber> So lets discuss that and come to a conclusion
19:06:30FromDiscord<Clyybber> disruptek: grepping for nkHiddenAddr/Deref in cps turns up nothing, are you sure you need them?
19:06:50disrupteki don't need them /yet/.
19:07:11disruptekwe can remove them in the compiler for now.
19:07:54FromDiscord<Clyybber> ok
19:08:03disruptekit would nice if mratsim had at least a prayer of making something work on his first outing.
19:28:26FromDiscord<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:55FromDiscord<Filipe Duarte> is varRand a reference for rand(1) proc?
19:36:26Zevvdisruptek: how so?
19:36:41disruptekwhat?
19:36:48Zevv"a prayer..."
19:37:07disruptekit would be nice if he wasn't blocked by the compiler.
19:37:24Zevvah right
19:37:42Zevvbtw, do you have any feelings about the .union. you want to share with the group
19:38:06Zevvand supportsCopyMem()
19:38:32disrupteki'm fine with supportsCopyMem but i doubt the union will survive.
19:39:03Zevvif it goes type erasing, I think it should
19:39:05Zevvbut we'll see
19:39:50disruptekyeah, i just want to let mamy do his thing. he can probably make it work, and if so, it's great.
19:40:08Zevvthat was my thought as well. I have next week off so I was tempted to go head in again
19:40:22Zevvbut I think I'll lay back and enjoy some time doing other stuf
19:40:39disruptekyeah, i know as soon as we remove a blocker we'll make fast progress. it'll be a lot of fun.
19:41:14ZevvI think I'll just get to the same role I had when we had our little sprint
19:41:22Zevvjust using what he delivers and whine about it a lot
19:42:23*tane joined #nim
19:43:02saem@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:43FromDiscord<Clyybber> @Filipe Duarte Which repl is that?
19:45:34FromDiscord<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:07ZevvI don't understand this yet I think. C is a sink object, but not varred
19:48:33FromDiscord<Filipe Duarte> inim repl running from a terminal.
19:48:37Zevvso that's immutable, right?
19:49:17FromDiscord<Clyybber> @Filipe Duarte Yeah; thats the cause then
19:49:34FromDiscord<Filipe Duarte> I just wanted to save the output of the random sample
19:52:02FromDiscord<ElegantBeef> It does
19:52:13FromDiscord<ElegantBeef> Everytime you add code, inim recompiles the program
19:52:42*fanta1 quit (Quit: fanta1)
19:54:12FromDiscord<Filipe Duarte> and run the rand() again?
19:54:31FromDiscord<ElegantBeef> Yep
19:54:40FromDiscord<Filipe Duarte> but is it possible to store the value, not the rand()?
19:54:50FromDiscord<ElegantBeef> You are storing the value
19:55:22FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2JDK
19:55:40FromDiscord<ElegantBeef> everytime you do `echo randVal` you're causing the program to recompile and it changes the stored value
19:56:06FromDiscord<Filipe Duarte> Because compiles again on Inim repl.
19:59:18FromDiscord<Filipe Duarte> Now work
19:59:36FromDiscord<Filipe Duarte> https://media.discordapp.net/attachments/371759389889003532/792481760495534080/Captura_de_Tela_2020-12-26_as_16.59.30.png
19:59:39FromDiscord<Clyybber> Maybe inim is willing to shim rand to prevent that behaviour
19:59:49FromDiscord<Clyybber> @Filipe Duarte heh, removed your randomize() ?
20:00:22FromDiscord<Filipe Duarte> I did not call randomize() now
20:00:31FromDiscord<Clyybber> yeah; thats the reason it works now :)
20:00:31FromDiscord<Filipe Duarte> (edit) "now" => "on the second"
20:00:44FromDiscord<Filipe Duarte> Thanks
20:02:15FromDiscord<Filipe Duarte> so randomize() will call rand() every time I call v?
20:03:32FromDiscord<Clyybber> no, but inim will call rand() everytime you hit enter
20:03:46FromDiscord<Clyybber> because it will run your program each time you hit enter
20:06:38FromDiscord<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:08FromDiscord<Filipe Duarte> stored the last value generated on the loop
20:10:49disruptekzevv: what will you do during your week off?
20:11:12*Arrrrrrrr quit (Quit: Arrrrrrrr)
20:11:31Zevvdon't know. kids are at home, so no proper focus I'm afraid
20:12:18disruptekmake the most of those kids, i think.
20:12:32Zevvlooking 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:49Zevvdisruptek: I gave up on that. They need to do that theirselves I guess
20:12:56disrupteklol
20:13:24disrupteki'm telling you, we have to let mratsim bang his own head.
20:13:50disruptekwe're just wasting energy talking about it. 😉
20:13:55disrupteki say we work on csp.
20:14:17disruptekif it takes 100 lines, i'll be disappointed.
20:14:32disrupteki know that statement will haunt me, but...
20:14:35Zevvit'll be thin
20:14:57disruptekcsp will need working concepts, though.
20:15:02disrupteklike, /really/ working.
20:15:18Zevvanyway, 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:38ZevvI don't care anything about CSP for now, but I'll bit
20:15:39Zevve
20:16:25disruptekmratsim is a good champion for the cause. he'll write a lot of words, benchmarks, and whatnot.
20:16:44disruptekneed more users, though.
20:16:48Zevvoh I'm sure of that
20:16:53FromDiscord<notchris> hello my friends
20:17:04Zevvyeah, so thus my plan to be the loudest user #1
20:17:05disrupteksup boss.
20:17:07Zevvuntil others pick that up
20:17:14Zevvhey its chris
20:17:16Zevvoh no
20:17:23Zevvit's not
20:17:39notchrisAyyy
20:17:40notchrisnot too much
20:17:44notchrisjust hanging
20:17:52notchrisstruggling with auth
20:18:11disruptekoh, are you the one trying to login as me on freenode?
20:18:29notchrisnah must be the evil chris
20:18:48notchrisim trying to figure out the standard for auth / sessions on an express server
20:19:05disrupteki don't understand why sometimes my asd nick works and other times it doesn't.
20:19:33notchrisand if csrf tokens are necessary
20:22:30disrupteksounds really, really fun.
20:24:06FromDiscord<notchris> yeah it sucks
20:25:00FromDiscord<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:34notchrisdisruptek: whatcha workin on
20:26:58disruptekabout to drop the kids off at the pool and take the dog for a sniff.
20:27:36notchrisdisruptek: that's nice, you must be like west coast
20:27:40notchrisunless its indoors
20:27:52disrupteknah, it's white-out conditions here.
20:28:57notchrisoh wow
20:29:10notchrisi guess people just like swimming
20:39:22FromDiscord<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:27FromDiscord<bark> anyone know what it means
20:39:40*hnOsmium0001 joined #nim
20:39:52FromDiscord<bark> (edit) "/home/andrej/Seafile/backup/projects/inaction/readline.nim(3," => "/projects/inaction/readline.nim(3,"
20:45:22FromDiscord<mratsim> @zevv, what do you mean "tied to the type"? You can make trampoline a generic function or a concept
20:46:00FromDiscord<mratsim> Also I don't see any example of `proc foo(a, b: int): int {.cps: C.}`
20:46:21FromDiscord<mratsim> I assume you don't support return value in cpsified functions yet?
20:48:32FromDiscord<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:53lethis there a way to make a macro maintain the original type of an argument within it's body?
21:02:34FromDiscord<ElegantBeef> You could used typed arguments
21:03:38FromDiscord<ElegantBeef> or a `static[T]`, uncertain what you're doing
21:03:50leththey will still not be the original typw withing the macro body-
21:04:24lethI 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:35FromDiscord<ElegantBeef> ah then yea `static[T]`
21:05:30lethoh, that's it, cheers!
21:06:03*leorize quit (Ping timeout: 240 seconds)
21:18:14*Vladar quit (Quit: Leaving)
21:19:37FromDiscord<mratsim> @leth: ue getTypeInst at the start of the macro to save the type
21:21:42FromDiscord<mratsim> I wish you well on the road of the typed macros pitfalls
21:21:53FromDiscord<mratsim> Lots of men fell on that battlefields.
21:23:58*leorize joined #nim
21:26:58Zevvmratsim: no, return values not yet
21:27:13Zevvwe thought about that and I think they lived somewhere else in a broken branch once
21:28:21FromDiscord<mratsim> trying to add them, I'd like to have coroutines with this syntax before doing the union trick
21:28:48FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JEC
21:29:03ZevvI 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:08Zevvif that makes snese
21:29:09FromDiscord<mratsim> The coro pragma would automatically create the continuation type from the type signature
21:29:27Zevvright
21:29:39Zevvthis case is fine, I think we had this at one point
21:29:43Zevvdisruptek: did we?
21:29:47FromDiscord<mratsim> but it's not a problem, if the end type is T, Continuation[T] is the right type
21:30:19ZevvI think I also want yield() to be able to return a value :)
21:30:22FromDiscord<mratsim> basically I think exposing "Cont" is not ergonomic and likely to be confusing
21:30:23Zevvthat's what you pass to resume()
21:30:49FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=2JED
21:30:49ZevvThat part of ergonomics we have been struggling with
21:30:52Zevvto find the right thing
21:31:50FromDiscord<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:24ZevvI had a coroutine implementation working on 0.0.13 but that's not checked in it seems. I lost it
21:32:29Zevvbut it was about the same thing
21:32:35FromDiscord<mratsim> 2 pragmas: {.suspend.} (adds a continuation argument, and nil it if mutant or return nil if classic)
21:32:35Zevvhttps://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:00FromDiscord<mratsim> and {.resumable.} which is equivalent to {.cps:Cont.}
21:33:15FromDiscord<mratsim> but the Cont type is autogenerated, I don't see a use case to not autogenerated it
21:33:28Zevvoh that doc is new to me indeed
21:33:30FromDiscord<mratsim> and then "bindCallerContinuation"
21:33:32Zevvlet me go through that
21:33:51FromDiscord<mratsim> resumeContination is calling it
21:34:20FromDiscord<mratsim> and suspendWith that calls a {.suspend.} proc that will not return immediately.
21:34:40FromDiscord<mratsim> It's unfinished because I need to prove those works 😛
21:35:27disruptekreturn values don't get impl at this level; a return value is a special form of dispatcher.
21:35:33FromDiscord<mratsim> AFAIK scheme only has those 3: callCC = suspendsWith, resumeContinuation is just a function call and suspendWith is a lambda
21:35:36disruptekyou can also impl them using a shim.
21:35:43Zevvah the shim, right
21:35:47Zevvthat was it
21:36:00FromDiscord<mratsim> I'll just add a `var result: T`
21:36:02disruptekthe shim is impl but, of course, there's no way to test it. 😁
21:36:11FromDiscord<mratsim> for proc that have a result
21:36:22FromDiscord<mratsim> to give space to the continuation return value
21:36:42disruptekthere's a result field in the code already; it's called "rs" (gensym'd, most likely).
21:37:22disruptekbut anyway... results and exceptions need further discussion to figure out the best ergonomics.
21:37:44disruptekalso stack traces. i think we can do better than our current trace system.
21:37:55Zevvlook at lua for that
21:38:35Zevvthe problem for the current async traces is not nim
21:38:46Zevvbut the fact that the whole ioselector stuff gets traced
21:38:46FromDiscord<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:46FromDiscord<Clyybber> disruptek: Until the fix is in the compiler, we can strip nkHiddenAddr/Deref in normalizingRewrites
21:38:54Zevvwhich users couldn't care less about
21:38:56FromDiscord<mratsim> the problem of async traces is the event loop swallowing everything.
21:39:11FromDiscord<Clyybber> disruptek: You ok with that? If so I'll push something
21:39:20FromDiscord<mratsim> CPS without event loop should have nice traces
21:39:29Zevvit should
21:39:31disruptekthe problem for cps traces is only that they are currently "helped" by the transform. ideally, they are impl entirely in the dispatcher.
21:39:56disruptekclyybber: i am fine with anything. we can always change code.
21:39:59Zevvyeah I'm still not sure about that
21:40:04disruptekaraq tells me that "software is soft."
21:40:16FromDiscord<Clyybber> true
21:40:45Zevvmratsim: if all references to a coroutine are lost, it is naturally "cancelled", right?
21:40:50Zevvit just ceases to exist
21:41:00FromDiscord<mratsim> yes
21:41:10FromDiscord<mratsim> not calling a continuation means cancelling
21:41:26FromDiscord<mratsim> then people need to add destructors and/or finalizers for proper collection.
21:41:33Zevvwhy?
21:41:41Zevvthey /can/ if they want
21:41:46FromDiscord<mratsim> if you drop a database handle and it's not closed?
21:41:47Zevvbut if you don't it'll just evaporate
21:41:57Zevvyeah sure
21:42:10Zevvbut not for the continuations or coroutines themselves
21:42:22FromDiscord<mratsim> yes those are no problems.
21:42:34FromDiscord<mratsim> so cancellation isn't too bad.
21:42:40lethmratsim: 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:48FromDiscord<mratsim> And I think we can get "async garbage collection"
21:42:49Zevvthis all comes natural to ARC, what about old style refc, this whould just work except for the finalizers right
21:43:18FromDiscord<mratsim> I think finalizers do work but we don't know when
21:43:31Zevvexactly.
21:43:34Zevvit's no longer deterministic
21:43:55FromDiscord<mratsim> given that those only have one ref count anyway I hope it's "soon"
21:44:11Zevvwith GC's, it's whenever the GC thinks its time
21:44:18Zevvit might be never
21:44:43FromDiscord<mratsim> it's when it needs memory.
21:44:54Zevvwhich might be never :)
21:44:56FromDiscord<mratsim> the dreaded "genericReset"
21:45:06FromDiscord<mratsim> when you return a seq[T] and you don't have {.noInit.}
21:45:12FromDiscord<mratsim> or Node[T] :/
21:46:55FromDiscord<Clyybber> disruptek: Do you remember why nim c tock fails?
21:47:52disruptekshould be the same bug as carnac.
21:48:20ZevvWent over "First-class continuations", no big surprises here I think
21:48:38FromDiscord<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:08FromDiscord<mratsim> ah
21:49:15FromDiscord<mratsim> PEBKAC compiling the wrong file
21:49:22disruptekheh
21:49:25FromDiscord<ElegantBeef> Lol
21:49:34FromDiscord<ElegantBeef> PEBKAC are the worst compiler errors
21:50:24FromDiscord<mratsim> okay time to sleep.
21:50:28Zevvpart of why I like doing Nim instead of C
21:50:36Zevvin C the compiler is barely ever wrong
21:50:40Zevvin Nim it's all the time
21:50:51Zevvso I can shamelessly blame the compiler
21:51:08ZevvI have a book which has a chapter called "No, select() is not broken"
21:51:10FromDiscord<mratsim> especially when you use auto and typedesc
21:51:12ZevvI had a nice bug a few weeks ago
21:51:19Zevvinvolving a broken select() implementation. That was fun
21:51:21FromDiscord<ElegantBeef> I've pretty much never hit a compiler error, more VM errors than compiler here 😄
21:51:38FromDiscord<mratsim> If you don't do generics you miss 80% of the fun
21:51:40Zevvsleep tight mratsim.
21:51:49disrupteki mean, really.
21:51:51Zevvdoes it happen to you, that if you spend deep time at stuff like this, it hunts your nights?
21:52:01FromDiscord<mratsim> I had a bug in Weave that resulted in deadlocks, but only on Linux
21:52:08Zevvwhen I was up to my elbows in CPS a few months back, it really made for some weeerd dreams
21:52:19FromDiscord<mratsim> turned out it was glibc conditions variables
21:52:27Zevvah I remember that one. Fun as well :)
21:52:39FromDiscord<mratsim> before sleeping and at wakeup but I don't remember dreams now
21:52:55FromDiscord<mratsim> when i played go intensively, I dreamed about go.
21:53:11Zevvimagine if you're really a mathematician and doing a thesis for months or years
21:53:14Zevvthat must be so maddening
21:53:22FromDiscord<mratsim> apparently it's when you're brain is learning and storing things
21:53:35Zevvyeah, it's super annoying :)
21:53:55disruptekthat's why when you're learning something, you need to make sure to get a lot of sleep.
21:54:25Zevvalso when you're not learning
21:54:29ZevvI'm the master of naps
21:54:35Zevvanytime, anywhere
21:54:46disruptekprobably why i can't learn; i have a pretty annoying sleep disorder.
21:55:04Zevvyeah, you can't learn dude. Just making the same stupid mistakes all the time
21:55:17disruptekpretty much.
21:55:22Zevvjust making the same same things over and over
21:55:46Zevvi bet the gummybears help
21:56:05disrupteki wish i had some right now.
21:56:10Zevvaw man
21:56:12FromDiscord<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:37ZevvI'll try to let that part sink in overnight
21:56:38disruptekwhy not let the user supply the type?
21:56:47FromDiscord<mratsim> not ergonomic.
21:57:05disruptekyou think having three different pragmas is more ergonomic?
21:57:11Zevvwe had this 3 tiers of "people" defined with CPS once. We should pick up that lingo again
21:57:15FromDiscord<mratsim> Continuation is a pretty boring type anyway, a function and environment
21:57:23FromDiscord<mratsim> it's 2 pragma
21:57:25disruptekmaybe yours are.
21:57:30FromDiscord<Clyybber> disruptek: stripping doesn't help in tocks case
21:57:47FromDiscord<mratsim> and better names than cpsMagic and cps:Foo
21:57:55*disruptek shrugs.
21:58:06Zevvthat's a "yes" in disruptekese
21:58:10FromDiscord<mratsim> yes
21:58:13disruptekclyybber: i don't test with tests/tock.nim.
21:58:43disruptekclyybber: my tests are tests/taste.nim; zevv's are tests/tzevv.nim.
21:59:04FromDiscord<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:26FromDiscord<mratsim> anyway, gtg
21:59:28Zevvmratsim: right, but when talking about "users"
21:59:30Zevvwhere do they live
21:59:33disruptekmratsim: peace.
21:59:37ZevvZzzZ
21:59:50FromDiscord<Clyybber> mratsim: gn
22:00:01FromDiscord<mratsim> Most likely at the coroutines level except raw IO API that need fine control over suspend.
22:00:24ZevvGo away
22:00:25Zevvsleep
22:00:33FromDiscord<mratsim> jajaja
22:00:37Zevvhehehe
22:24:20saemFun 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:06ForumUpdaterBotNew 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:19FromDiscord<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:51FromDiscord<lqdev> i always forget about it, simply because it's ugly
23:56:09FromDiscord<ElegantBeef> I think it's a tad bit less ugly than `cast`
23:56:38FromDiscord<ElegantBeef> well i guess it's not casted but eitherway
23:56:48FromDiscord<ElegantBeef> Doesnt require dereferencing
23:58:09*^Q-Master^ joined #nim