<< 27-12-2020 >>

00:01:18*Q-Master quit (Ping timeout: 272 seconds)
00:15:45FromDiscord<Recruit_main707> am i missing something? i get illformed AST even though when i copy the code and paste it in the file it compiles fine
00:15:58FromDiscord<ElegantBeef> Yep, the code
00:16:08FromDiscord<ElegantBeef> Hard to tell what you're missing with a question alone ๐Ÿ˜„
00:16:23disrupteki'm pretty sure it's between the ears.
00:16:37FromDiscord<ElegantBeef> I dont have any corn
00:19:13FromDiscord<ElegantBeef> If you're pasting the macro `.repr` it will often work even with a bad nim node tree
00:19:52FromDiscord<ElegantBeef> Use `dumptree` with and `treeRepr` of the result to compare the two
00:21:59FromDiscord<Recruit_main707> i dont print it, its the error msg itself
00:22:00FromDiscord<Recruit_main707> https://play.nim-lang.org/#ix=2JFh
00:22:11*tane quit (Quit: Leaving)
00:22:54FromDiscord<ElegantBeef> you're invoking fields?
00:24:26FromDiscord<Recruit_main707> no, they are getters
00:24:31FromDiscord<Recruit_main707> defined somewhere else
00:25:28FromDiscord<ElegantBeef> Compare the debug output of this https://play.nim-lang.org/#ix=2JFjโ†ตwith https://play.nim-lang.org/#ix=2JFk
00:26:37FromDiscord<ElegantBeef> Illformed AST just means you're missing some nodes somewhere
00:28:38FromDiscord<ElegantBeef> Looks like it's the `varTy` one uses a dot expr the other uses an ident
00:29:30FromDiscord<ElegantBeef> @Recruit_main707 https://media.discordapp.net/attachments/371759389889003532/792549677505183764/unknown.png
00:34:24FromDiscord<ElegantBeef> Nothing else is glaringly wrong, so good luck ๐Ÿ˜„
00:37:57FromDiscord<Cohjellah> hey guys can I just put spawn in front of a proc call to put it on a seperate thread?/
00:38:49FromDiscord<Cohjellah> or do I have to do some channel shenanigans
00:38:58*mbomba joined #nim
00:39:30FromDiscord<Recruit_main707> @ElegantBeef i changed that and now the ast is the same, still get the error though, thanks for trying though
00:40:22FromDiscord<ElegantBeef> Afaik spawn creates a new thread in the threadpool
00:40:35FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn
00:40:57FromDiscord<Cohjellah> yeaaaahh
00:41:00FromDiscord<Cohjellah> hmm
00:49:51saem@Recruit_main707: you're in a TypeSection and you're returning a statement that has a TypeDef and ProcDef. You can test this a few ways, one is to simply set result = obj, another is set result = yourGeneratedProc, and yet another is to put a dumpLisp: the line above type ScoreInfo and intend the type so it falls under it.
00:51:39saemThe first one will succeed because it's TypeDef, the second will fail because you're declaring a proc under a type section, and the last one will show you the ast where your replacement is taking place and why it won't work the way you're doing it.
00:53:22FromDiscord<Recruit_main707> how can i overcome this
00:56:08*mbomba quit (Quit: WeeChat 3.0)
00:57:00saemI'm thinking about it not quite sure yet, I've seen different ways of approaching it, but I don't know if they fit the feel of what you're after.
00:58:19saemWait... you can get the parent for obj?
01:00:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:01:07*njoseph joined #nim
01:01:24FromDiscord<Recruit_main707> Pc turned off automatically, I really need to disable that shit, Iโ€™ll try it tomorrow, why though.
01:05:05saemIt has the occasional edge case but walk up the nodes, get to the module and put in a top level proc declaration.
01:30:06Fish-FaceI caved on day 19 and wrote a solution in python
01:30:50FromDiscord<ElegantBeef> I stopped forcing myself to do them around the 11th
01:30:59FromDiscord<ElegantBeef> They just got too much like work and less fun
01:31:10FromDiscord<ElegantBeef> Although i still love my day 18 solutiion ๐Ÿ˜„
01:36:10Fish-FaceI still want to do 25 so I have to finish the horrible ones
01:37:08Fish-Face19.2 is just annoying because of the lack of good CFG libraries
01:37:51Fish-Facein python I picked the first library I saw that parsed grammars from strings (rather than having you define them in code) and it's easy peasy
01:38:40*vicfred quit (Quit: Leaving)
01:43:01*vicfred joined #nim
02:08:47Fish-FaceI assume it's possible to do in a PEG with some lookahead stuff but EH
02:10:18*D_ quit (Remote host closed the connection)
02:12:05*D_ joined #nim
02:37:20*krux02 quit (Remote host closed the connection)
02:38:22*leth quit (Quit: no reason)
02:47:53FromDiscord<shadow.> `Error: execution of an external program failed: 'C:\Users\shado\nimcache\day6_d\day6.exe '` im getting this generic error when running my code. it seems that it occurs during calling the function, a print before call prints but as the first line of my function it does not print
02:48:06FromDiscord<shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JFT
02:48:07FromDiscord<ElegantBeef> are you using `-d:release`?
02:48:10FromDiscord<shadow.> nope
02:48:27FromDiscord<ElegantBeef> Are you surrrre?
02:48:30FromDiscord<shadow.> yep
02:48:38FromDiscord<shadow.> i did -d:debug still same thing
02:48:51FromDiscord<shadow.> tho it should be debug by default, now?
02:49:00FromDiscord<ElegantBeef> It is debug by default
02:49:00FromDiscord<shadow.> (edit) "now?" => "right?"
02:49:01FromDiscord<shadow.> yeah
02:49:02FromDiscord<shadow.> hmm
02:49:12FromDiscord<ElegantBeef> Give the entire output from the terminal
02:49:41FromDiscord<shadow.> the 400410 is from a previous function call
02:49:41FromDiscord<shadow.> sent a code paste, see https://paste.rs/FXJ
02:49:45FromDiscord<shadow.> which executes fine
02:49:57FromDiscord<shadow.> (edit)
02:51:15FromDiscord<ElegantBeef> Going to try it here, can i get the entire file?
02:51:34FromDiscord<shadow.> sure thing
02:51:39FromDiscord<shadow.> https://media.discordapp.net/attachments/371759389889003532/792585458307039252/day6.nim
02:51:40FromDiscord<shadow.> https://media.discordapp.net/attachments/371759389889003532/792585460526088212/input.txt
02:52:40FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/792585705166864434/unknown.png
02:52:45FromDiscord<ElegantBeef> Your pc is poopoo
02:53:13FromDiscord<shadow.> wtfff
02:53:20FromDiscord<shadow.> maybe windows just bad?
02:53:41FromDiscord<ElegantBeef> Ew you're manually parsing the data ๐Ÿ˜ฆ
02:54:12FromDiscord<ElegantBeef> ah it's a different year eh?
02:57:36FromDiscord<shadow.> yeahhh
02:57:37FromDiscord<shadow.> 2015
02:57:41FromDiscord<shadow.> id normally use npeg dw
02:57:46FromDiscord<shadow.> but me and my friend were racing
02:57:48FromDiscord<shadow.> and i had to go speedf
02:57:49FromDiscord<shadow.> (edit) "speedf" => "speed"
02:57:59FromDiscord<shadow.> i also couldn't figure how to use strscans on it
03:00:22FromDiscord<shadow.> i wonder why my pc poopooed tho
03:05:06FromDiscord<shadow.> im on windows 10 devel 1.5.1
03:05:29FromDiscord<ElegantBeef> well you'd have `"turn on $i,$i through $i,$i"` and `"toggle $i,$i, through $i,$i"`
03:05:37FromDiscord<ElegantBeef> and i guess off
03:05:55FromDiscord<shadow.> yeah i just didn't know how to get the cmd with it
03:06:06FromDiscord<shadow.> ig that could be done manually
03:06:11FromDiscord<ElegantBeef> If it passes parsing it's that one
03:06:17FromDiscord<ElegantBeef> what hash?
03:06:24FromDiscord<ElegantBeef> i'm on 5a5844 and it works
03:06:33FromDiscord<shadow.> ah just got off pc i cant check
03:06:49FromDiscord<shadow.> just surprised bc its normal enough code lol
03:07:01FromDiscord<ElegantBeef> Well something is wrong somewhere
03:07:06FromDiscord<shadow.> fair
03:07:20FromDiscord<shadow.> btw nice job on scantuple that shit is a breeze to use
03:07:54FromDiscord<ElegantBeef> Thanks, i really like it, 4raqs suggestion was so much better than the var injection
03:08:14FromDiscord<shadow.> what'd he suggest?
03:08:18FromDiscord<ElegantBeef> The tuple
03:08:27FromDiscord<ElegantBeef> Originally i just injected `var idents`
03:08:44FromDiscord<ElegantBeef> So even if it failed they were still there
03:09:20FromDiscord<ElegantBeef> it was supposed to be used like `whenScanF(line, pattern, seconds, minutes, days): body`
03:09:46FromDiscord<ElegantBeef> that'd declare seconds, minutes and days as variables inside that body's scope
03:11:00FromDiscord<ElegantBeef> This was the first pass https://play.nim-lang.org/#ix=2JG1
03:24:23FromDiscord<Cohjellah> Hey guys, running into this compilation error:
03:24:32FromDiscord<Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=
03:25:28FromDiscord<Cohjellah> Is there a way to just not change my code and still get around this by using different methods within threadpool?
03:27:15FromDiscord<Cohjellah> nvm there are some good docs out there. It's surrounding my use of global variables
03:33:02FromDiscord<ElegantBeef> Still reimplementing that chat client?
03:35:59giacois it possible to help the compiler infer the type of "left" and "right" here? https://play.nim-lang.org/
03:36:01giacouups
03:36:24giacohttps://play.nim-lang.org/#ix=2JG8
03:37:11FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2JG9
03:37:29FromDiscord<Cohjellah> Yep
03:37:35FromDiscord<ElegantBeef> Although the left/right is same as the parent, so it's kinda redundant
03:37:35FromDiscord<Cohjellah> Long process
03:37:40FromDiscord<ElegantBeef> Unless you just dont want them to be nil
03:39:22giacothanks for the solution. How would you check for non-nill?
03:39:49disruptekisNil()
03:40:04FromDiscord<ElegantBeef> Isnt there `not nil` if the sole intent is to just avoid nils?
03:40:16disruptekyes, but..
03:40:20disruptek~disrupstyle
03:40:21disbotdisrupstyle: 11tips for writing code that won't provoke ๐Ÿ˜  rants ๐Ÿคฌ on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek
03:40:24disruptekisNil is preferred.
03:40:45disrupteknot nil support is incomplete.
03:40:51FromDiscord<ElegantBeef> No i meant the experimental feature
03:41:01FromDiscord<ElegantBeef> This schtuff https://nim-lang.org/docs/manual_experimental.html#not-nil-annotation
03:41:07disrupteknot nil support is incomplete.
03:41:31FromDiscord<ElegantBeef> Ah
03:41:39disruptekhopefully 1.6.
03:42:19giacolol sorry D
03:42:21giaco:D
03:42:29FromDiscord<Cohjellah> @ElegantBeef your solution works so well when I spawn a thread, because polling works in the background and doesn't interrupt now
03:42:33FromDiscord<Cohjellah> and there's no thread safe issues
03:43:25FromDiscord<Cohjellah> My next problem is, when a message is received, how do I pull the input variable from the thread spawned proc which now acts as readLine out, so then I can erase it and put it back when a message is received
03:43:34FromDiscord<Cohjellah> HMM big think
03:44:24FromDiscord<Cohjellah> I guess to surmise my question, how do I pass variables from one thread to another?
03:45:09FromDiscord<ElegantBeef> Very carefully
03:45:13FromDiscord<Cohjellah> HAHA
03:45:16FromDiscord<Cohjellah> I think I'm looking for channels?
03:45:22FromDiscord<ElegantBeef> Quite possibly
03:46:20*waleee-cl quit (Quit: Connection closed for inactivity)
03:47:06disruptekpre-1.4 you use channels, 1.4+ i would just use isolate.
03:47:10FromDiscord<Cohjellah> Nim, the language of mystery
03:47:13FromDiscord<Cohjellah> isolate?
03:47:19disruptek!rfc isolate
03:47:20disbothttps://github.com/nim-lang/RFCs/issues/244 -- 3'isolated' data for Nim 7& 2 more...
03:47:32FromDiscord<Cohjellah> oh my god there's a command to search the lang?
03:47:33FromDiscord<Cohjellah> Hot
03:47:50disruptekno, it's just a bot.
03:48:02FromDiscord<Cohjellah> yes, which searches the language...
03:48:04disruptekbut that reminds me, i need to work on ndoc.
03:48:27FromDiscord<Cohjellah> man all these [T]'s everywhere
03:48:32giacoI wish I had a grid that explains when I should decorate proc arguments with "var" and "ref" or nothing in case of both value and ref variables (or maybe other cases I'm not thinking about)
03:48:37disrupteksome tips on how to use the bot, for discord people:
03:48:38FromDiscord<Cohjellah> Anyway this project has made me learn a lot, even if it's such a dumb thing I'm trying to do
03:48:39FromDiscord<ElegantBeef> Generics are for generic situations
03:48:40disruptek~notes
03:48:40disbotnotes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek
03:49:01FromDiscord<Cohjellah> Yeah people just always throw them in examples and it always throws me off because I come from Python
03:49:31FromDiscord<ElegantBeef> `var` is for when you want to mutate a non ref object, `ref` cause you were too lazy to make a `TRefObj`, and nothing is what the default is
03:50:22FromDiscord<Cohjellah> lol
03:51:08disruptekTObj is conventionally an object while PObj is conventionally a ref TObj.
03:51:31FromDiscord<ElegantBeef> Yea the convention about that is rather muddy though
03:51:38FromDiscord<Cohjellah> oh man all this is flying past me at mach speed
03:51:57FromDiscord<Cohjellah> Should have started with C not Python aha
03:52:01FromDiscord<ElegantBeef> Nim has reference types and value types, there are naming conventions for when both exist
03:52:21FromDiscord<ElegantBeef> Value types behave like primitives, where as reference types like python classes
03:52:31disruptekit's pretty consistent in the compiler, for example, but i wouldn't worry about it elsewhere. it's just, y'know, try not to call a ref object TSomething just because it might confuse someone.
03:54:12FromDiscord<Cohjellah> Okay, so looking at this isolate thing I should go with this?
03:56:18FromDiscord<ElegantBeef> Not a clue
03:56:34FromDiscord<Cohjellah> ahaha excellet
03:56:40FromDiscord<Cohjellah> (edit) "excellet" => "excellent"
03:56:43FromDiscord<Cohjellah> I'll just look at channels
03:57:22*muffindrake quit (Ping timeout: 260 seconds)
03:57:42FromDiscord<ElegantBeef> i honestly dont really know why you need channels here
03:57:52FromDiscord<ElegantBeef> Can i see your code?
03:57:55FromDiscord<Cohjellah> yeah, okay I just really need to ping the threaded proc
03:57:56FromDiscord<Cohjellah> here
03:58:25FromDiscord<Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=2JGc
03:58:48FromDiscord<Cohjellah> Proc connect will receive a message and I need it to work nicely with lineWriter
03:58:53FromDiscord<ElegantBeef> Yea this is... silly
03:58:57FromDiscord<Cohjellah> ๐Ÿ˜ฎ
03:59:04FromDiscord<Cohjellah> Most likely
03:59:27*muffindrake joined #nim
03:59:31FromDiscord<ElegantBeef> Actually, nvm forgot how this worked ๐Ÿ˜„
04:00:00FromDiscord<Cohjellah> HAHA ok so it's so convoluted like this because when a message is received the terminal will just echo whatever the user is typing
04:00:07FromDiscord<Cohjellah> so it just screws up your messaging
04:00:38FromDiscord<ElegantBeef> also you shared your ip ๐Ÿ˜›
04:00:38FromDiscord<Cohjellah> your solution was to store the individual's characters using getch and then when a message is pinged it'll erase the line, print the received message and then return the input message to the input line
04:00:42FromDiscord<Cohjellah> not my IP
04:00:46FromDiscord<Cohjellah> but yeah oops
04:01:11FromDiscord<Cohjellah> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2JGf
04:01:55FromDiscord<Cohjellah> HMM unsure how to get the two procs to talk with each other or what method to use. Once I've got that I can probably put together a hacky solution
04:02:12FromDiscord<Cohjellah> I say method in the general sense
04:03:05FromDiscord<ElegantBeef> I mean you spawn a thread every time `messageFlowVar isReady` as you're doing per line, then you can handle all logic aside from polling on the main thread
04:03:32giacothanks!
04:03:34FromDiscord<ElegantBeef> Although probably not wise performance wise and a pretty off solution
04:04:15FromDiscord<Cohjellah> but before the user presses enter, it'll be in the lineWriter proc
04:04:29FromDiscord<Cohjellah> so if a message was received, it'll just perform the same way it dod before
04:04:56FromDiscord<Cohjellah> by deleting the message the user was currently writing
04:05:03FromDiscord<ElegantBeef> No
04:05:15FromDiscord<ElegantBeef> Cause you have the input captured
04:05:24giacoshould I still consider threads if I notice that my logic fits into async/await nicely? Is there a way to use all my cores elegantly while staying with the async pattern?
04:05:33FromDiscord<Cohjellah> oh
04:05:35FromDiscord<Cohjellah> hold up
04:06:30FromDiscord<ElegantBeef> well if you have parallelised logic and need it to be faster consider threads, atleast that's i think the consensus
04:06:48FromDiscord<Cohjellah> INTERESTING
04:06:53FromDiscord<ElegantBeef> I really should wait for someone that knows how to thread talk ๐Ÿ˜„
04:06:56FromDiscord<Cohjellah> So, it works but makes a ton of blank space
04:07:37FromDiscord<Cohjellah> hol' up
04:09:56FromDiscord<Cohjellah> so it works, but it has visual bugs hahaha
04:10:09FromDiscord<ElegantBeef> What's the visual bug?
04:10:41FromDiscord<Cohjellah> user A is typing "hello", user B sends a message to A,โ†ตuser A's terminal input now looks like this " "
04:10:51FromDiscord<Cohjellah> but the blank space is still hello if you press enter
04:10:57FromDiscord<Cohjellah> it'll still send hello to user B
04:11:01FromDiscord<ElegantBeef> Did you reprint the input?
04:11:21FromDiscord<Cohjellah> Not sure how to do that because I don't know how to tell lineWriter proc that a message has been received
04:11:28FromDiscord<Cohjellah> hence why I wanted to use channels or something to make them communicate
04:12:42FromDiscord<ElegantBeef> Yea idk, i still think this can be easily handled just using flowvars of `char` on the spawned proc
04:12:58FromDiscord<Cohjellah> so instead of a procedure just use spawn on the flowvar?
04:13:00FromDiscord<Cohjellah> of char
04:13:08FromDiscord<ElegantBeef> well instead of returning a string, return a `char`
04:13:14FromDiscord<Cohjellah> interesting
04:13:14FromDiscord<ElegantBeef> then move your logic into your main thread
04:13:30FromDiscord<ElegantBeef> your thread proc just becomes `getCh`
04:13:33FromDiscord<Cohjellah> I tried something similar before but heck it was laggy
04:13:40FromDiscord<Cohjellah> ah yeah that's what I initially did
04:13:56FromDiscord<ElegantBeef> yea i imagined as such
04:14:09FromDiscord<Cohjellah> every character you hit, polling would start
04:14:16FromDiscord<ElegantBeef> Wait what?
04:14:26FromDiscord<Cohjellah> like I would spam the A key and there would be massive delays
04:15:26FromDiscord<ElegantBeef> I'll brb then i'll see something
04:16:42FromDiscord<Cohjellah> ok pls
04:16:52FromDiscord<Cohjellah> it also wasn't thread safe
04:17:25FromDiscord<Cohjellah> because to spawn the getCh after each key press I had to put a spawn on each branch of the case, and for some reason the asyncdispatch polling lag made them out of sync and keys would popup in any sort of order
04:17:48disruptekno, don't do that.
04:18:50FromDiscord<Cohjellah> learnt that the hard way hey
04:20:07disruptekjust spawn a thread to loop on getch. after it gets a key, it operates a lock and adds it to a queue.
04:20:32disruptekyour original thread can just check the queue to get the input.
04:22:33FromDiscord<Cohjellah> HMMM
04:22:51disruptek!last hmmm
04:22:52disbothmmm quit 716 hours ago and last spoke 17 hours ago
04:24:12FromDiscord<Cohjellah> So when you say spawn a thread to loop on getch
04:24:20FromDiscord<Cohjellah> can you spawn a thread on a loop or are you talking about using a proc?
04:24:34disruptekyou spawn a thread for a {.thread.} proc.
04:24:42disruptekthe body of the proc is a loop on getch.
04:25:10disruptekfollowing the getch, it does a `withLock myLock: queue.add ch`
04:25:16disruptekthat's it.
04:25:45FromDiscord<Cohjellah> so pretty much what I did above but add {.thread.} to the end of it and use a queue
04:26:21disruptek"queue" is some sort of data structure. it can be anything that can hold more than one ch.
04:26:28FromDiscord<Cohjellah> yep
04:26:35FromDiscord<Cohjellah> so I've used queue's before in Python with multiprocessing
04:26:48disrupteki dunno what you did above. i try not to read other people's code; it just makes me angry.
04:26:52FromDiscord<Cohjellah> that's pretty much what I was looking for. If the queue is accessible by the connect proc, it can call queue
04:26:53disruptekbad for my blood pressure.
04:27:09FromDiscord<Cohjellah> then erase line and re-write the queue to the input line in the terminal
04:27:37FromDiscord<Cohjellah> is queue a keyword or a made up word there
04:27:45FromDiscord<Cohjellah> made up being variable haha
04:27:46disruptekit's made up.
04:28:14disrupteka string would be a good choice.
04:28:19FromDiscord<Cohjellah> what exactly is that called? Just thread locking? I want to read more on it
04:28:42disruptekyes, locks. threads.
04:29:14FromDiscord<Cohjellah> Cheers!
04:29:29disruptekhave fun and stay out of structure.
04:30:35FromDiscord<Cohjellah> hahaha okay I do have more questions, of course
04:30:45disruptekthat's what beef's here for.
04:30:54FromDiscord<Cohjellah> Hahahaha
04:31:05FromDiscord<Cohjellah> I just want to know how do I access that variable outside of the thread proc
04:31:18disruptekusing a lock.
04:32:03FromDiscord<Cohjellah> errrrrrrh
04:32:10FromDiscord<Cohjellah> I'll have a play. so withLock is the keyword
04:32:15FromDiscord<Cohjellah> and myLock is another variable?
04:32:16disruptekyes.
04:32:20disruptekyes.
04:32:36FromDiscord<Cohjellah> so myLock as the variable is the queue, and you're passing it the queue variable
04:32:47FromDiscord<Cohjellah> so you can just store stuff in it, or am I mistake
04:32:49FromDiscord<Cohjellah> mistaken
04:32:58disruptekmyLock is a variable holding a lock.
04:33:01disruptekqueue is a string.
04:33:10disruptekyou'll define those before spawning the thread.
04:33:12FromDiscord<ElegantBeef> Locks prevent threads from read/writing to variables at the same time from multiple threads
04:33:41disrupteklocks need to be init'd and deinit'd, too.
04:34:41FromDiscord<Cohjellah> ok
04:34:44FromDiscord<Cohjellah> I'll have a go
04:34:50FromDiscord<ElegantBeef> Nah use nim
04:35:25FromDiscord<Cohjellah> of course ๐Ÿ˜‰
04:35:37FromDiscord<Cohjellah> Nim makes learning these concepts a lot easier
04:35:42FromDiscord<Cohjellah> for me at least
04:35:45FromDiscord<Rika> did you get his joke
04:35:50disruptekno.
04:36:05FromDiscord<ElegantBeef> Well rika explain it for the back of the class
04:36:37FromDiscord<Cohjellah> golang is for nerds
04:37:07FromDiscord<Rika> you calling us nimions dumb or what
04:37:55disruptekyou're pretty much the epitome of `nimpleton`.
04:38:05FromDiscord<Rika> lmao
04:38:31FromDiscord<ElegantBeef> Yea well... you're a nimrod
04:38:46disrupteknimlet.
04:38:49FromDiscord<Cohjellah> Nimpleton lmao
04:39:04FromDiscord<ElegantBeef> Add that to your CV to get the job everytime
04:39:19FromDiscord<Cohjellah> Fellow Nimpleton would look great on the CV
04:39:33FromDiscord<Cohjellah> feeling like a Nimpleton though rn trying to initialise a lock lmao
04:39:41FromDiscord<Rika> nimwit
04:39:55PrestigeNice
04:40:08FromDiscord<Cohjellah> Any good examples of lock out in the wild
04:40:13FromDiscord<ElegantBeef> The threads doc
04:40:15FromDiscord<Rika> a ot
04:40:15FromDiscord<Cohjellah> so I can study the ancient texts
04:40:16FromDiscord<Rika> lot
04:40:19FromDiscord<Cohjellah> I'm looking at it
04:40:24FromDiscord<Cohjellah> it's in the lock module though?
04:40:31FromDiscord<ElegantBeef> Yea
04:41:02FromDiscord<Cohjellah> the docs generally just show the procs and templates but no examples
04:41:07FromDiscord<Cohjellah> HMM
04:41:10FromDiscord<ElegantBeef> https://nim-lang.org/docs/threads.html#examples
04:41:34FromDiscord<ElegantBeef> Locks arent useful on their own, without threading
04:41:55FromDiscord<Cohjellah> right so the lock examples are in the threading docs
04:41:58FromDiscord<Cohjellah> ty
04:42:02disruptek!rfc cps steps
04:42:02disbothttps://github.com/nim-lang/RFCs/issues/295 -- 3next steps for CPS
04:42:28FromDiscord<Cohjellah> this makes complete sense
04:42:35FromDiscord<Cohjellah> Bless the ElegantBeef and everyone here for your assistance
04:43:36FromDiscord<Cohjellah> Templates are so cool
04:44:08FromDiscord<ElegantBeef> Yep, macros are even cooler
04:44:40FromDiscord<ElegantBeef> More complicated, but more powerful
04:45:37FromDiscord<Rika> no u
04:45:41FromDiscord<Cohjellah> I honestly did chapter 3 of the Nim In Action book which was this chat app which I wanted to make work better - keen to get up to all that cool stuff
04:46:32FromDiscord<Cohjellah> (edit) "app which" => "app. But then I go stuck because" | "app. But then I go stuck becauseI wanted to make ... work" added "it"
04:48:00*spiderstew_ joined #nim
04:48:07*spiderstew quit (Ping timeout: 260 seconds)
04:54:25FromDiscord<Cohjellah> so how exactly do I stick the string variable in the lock?
04:54:43FromDiscord<Cohjellah> do I define it first then play with it in the lock and then it's accessible in other threads using the lock, or do I have to define it within the lock
04:55:28FromDiscord<ElegantBeef> The lock isnt anything special aside from "We're holding onto resources dont write/read"
04:55:39FromDiscord<Rika> you dont stick anything in the lock
04:55:51FromDiscord<Rika> the lock is a glorified boolean (in super dumbed down terms)
04:56:17FromDiscord<Cohjellah> right but I can't access it in a thread because I get the GC error
04:56:37FromDiscord<Cohjellah> the thread isn't GC safe because it's using a global variable
04:56:40FromDiscord<Rika> sorry to say but then you might be doing something wrong
04:56:45FromDiscord<Cohjellah> I am 100% doing something wrong
04:57:55FromDiscord<Cohjellah> hold up the GC error went away
04:59:21FromDiscord<Cohjellah> now my input variable is an error type. Lol. At least it's a different error
05:00:04*jjido quit (Quit: Connection closed for inactivity)
05:00:20FromDiscord<Rika> are you compiling
05:00:24FromDiscord<Rika> or checking via nimsuggest
05:00:29FromDiscord<Rika> because if its the latter then ignore it
05:00:38FromDiscord<Rika> shit gets funky when youre using threading and nimsuggest
05:03:05FromDiscord<Cohjellah> so I'm getting an undeclared variable error
05:03:15FromDiscord<Cohjellah> Am I not supposed to declare the variable I want to be passed around inside of the lock?
05:03:43FromDiscord<ElegantBeef> the lock is a global variable, you cannot declare anything inside it
05:04:05FromDiscord<Cohjellah> https://tenor.com/view/nick-young-question-marks-what-excuse-me-huh-gif-4486363
05:04:10FromDiscord<Cohjellah> Okay that explains it
05:05:36FromDiscord<ElegantBeef> I honestly dont know how you're supposed to add to the global string
05:06:01FromDiscord<Cohjellah> What do you mean. Isn't the purpose of lock to pass variables between threads/cores
05:06:21FromDiscord<ElegantBeef> It's to lock resources to prevent reading/writting to them at the same time
05:06:45FromDiscord<Cohjellah> right, because it'll just overwrite whatever you're assigning to it
05:06:49FromDiscord<Cohjellah> if you don't use a lock
05:06:54FromDiscord<Cohjellah> yadda yadda thread safe stuff
05:07:22FromDiscord<ElegantBeef> Yea, the string is heap allocated, so afaik it wont let you add to it, unless i'm missing something
05:07:33FromDiscord<Cohjellah> hnmmmm
05:08:09Prestigeso concatenation allocates the new size needed?
05:09:28disruptekyes.
05:09:42FromDiscord<Cohjellah> so I've got the lock, and I've created the global variable
05:09:53FromDiscord<Cohjellah> trying to access it within the lock proves futile as I still get the unsafe GC error
05:10:00FromDiscord<ElegantBeef> guess can use `cast(gcsafe)` but no clue if that's what disruptek was alluding to
05:10:12disruptekof course.
05:10:21disruptekit's safe because you're using a lock when you r/w it.
05:10:26FromDiscord<Cohjellah> riiight
05:10:31FromDiscord<Cohjellah> but the compiler doesn't know that so I have to flag it?
05:10:36FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#threads-gc-safety
05:10:38FromDiscord<ElegantBeef> Yep
05:11:17disruptek.gcsafe shouldn't exist. it's stupid.
05:11:37FromDiscord<Cohjellah> lmao
05:11:51FromDiscord<ElegantBeef> It seems marginally helpful for many headaches
05:12:59FromDiscord<Cohjellah> groovy
05:13:01FromDiscord<Cohjellah> actually works now
05:13:08disruptekweird.
05:13:24*hnOsmium0001 is now known as hnOsmium0002
05:13:29*disruptek is now known as asd
05:13:42FromDiscord<Cohjellah> now to put in the logic I need and see if it really works, but at least there's no GC error
05:13:55FromDiscord<ElegantBeef> Disruptek was setting you up to fail, and you succeeded really letting him down
05:14:11*asd is now known as keisterfish
05:14:18*hnOsmium0002 is now known as hnOsmium0001
05:14:36keisterfishit's almost like threads work well and are simple to use.
05:15:04*keisterfish is now known as asd
05:15:09FromDiscord<Cohjellah> maybe I was just asking my questions all wrong
05:15:20FromDiscord<ElegantBeef> Hey i've never seen you before, you cannot use that sarcastic tone with me
05:15:20asdnot really.
05:15:31Prestigeasd: what is your ideal vision for async/csp/threads etc
05:15:38PrestigeI can't tell what direction Nim is going in
05:15:38asdthe first step to improving async is removal of async.
05:15:54FromDiscord<Cohjellah> aaand I think I've created deadlocks
05:15:56FromDiscord<Cohjellah> huzzah
05:16:07FromDiscord<Cohjellah> But hey at least it's a new issue
05:16:31asdideally we have a csp layer like clojure's core.async.
05:16:40PrestigeGuess async will need to stay for backwards compat. right
05:16:55Prestigeor do you just mean the underlying implementation
05:17:03FromDiscord<Cohjellah> What's wrong with async?
05:17:04asdit will stay, but it should be improved with proper exception handling, cancellation, and traces.
05:17:11*Prestige is not familiar with csp
05:17:16asdbut it's the wrong abstraction.
05:18:02asd~csp is https://en.wikipedia.org/wiki/Communicating_sequential_processes
05:18:03disbotcsp: 11https://en.wikipedia.org/wiki/Communicating_sequential_processes
05:18:14PrestigeI'll give this a read, thanks
05:19:19asdin the same way that go provides really killer concurrency, nim can too.
05:19:53asdthe difference is, we have a better memory model, better FFI, better support for complex abstraction like generics and concepts, and better performance literally everywhere.
05:20:00PrestigeIs this blocked by something, or just in the works?
05:20:32asdthere's not much complexity to it, but to do it "our way", we want to use macros.
05:21:04asdthe reason is that macros will let the user compose using cps/csp patterns very broadly, which is a killer feature that no other language can provide.
05:21:20asdyou cannot define your own cps types in kotlin, for example.
05:21:48asdin our version, you can define everything yourself.
05:22:47asdthis means that abstractions aren't limited by the complexity or limitations of the type system -- they exploit it.
05:23:27asdinstead of saying, "yeah, we have this thing and you can build on it" we say, "we have this thing that you can compose with your existing shit."
05:23:47PrestigeThat would be cool to see. Still reading, might ping with more questions down the road
05:24:01asdit means in particular that libraries can provide cps/csp behaviors to your existing types via generics and concepts.
05:24:26asdyou don't have to use what we provide. we merely provide the formal semantics.
05:24:41FromDiscord<Cohjellah> ok so now it works EXACTLY How I want, but there's still the visual bug, hmm. But that's okay. At least it's functional atm
05:24:46FromDiscord<Cohjellah> thanks @ElegantBeef
05:24:48FromDiscord<Cohjellah> โค๏ธ
05:26:19FromDiscord<Cohjellah> nevermind
05:26:24FromDiscord<Cohjellah> ๐Ÿ˜†
05:33:44asd~cps is https://en.wikipedia.org/wiki/Continuation-passing_style
05:33:45disbotcps: 11https://en.wikipedia.org/wiki/Continuation-passing_style
05:36:13FromDiscord<Rika> asd: so you're a fellow advocate for cps and csp? nice
05:36:22FromDiscord<ElegantBeef> It's disruptek no?
05:36:32asdi'm much better looking than disruptek.
05:37:17FromDiscord<Rika> thats disruptek? really
05:37:55asdno, i'm shorter than disruptek but longer where it counts.
05:38:59PrestigeHe has a really long reach. Good for boxing in his weight class
05:39:01FromDiscord<Rika> patience?
05:39:09FromDiscord<Rika> i hope your patience is longer
05:39:23asdi don't know how disruptek manages to be so patient.
06:08:24FromDiscord<Cohjellah> I need a character literal of '\u0000' which is null
06:08:30FromDiscord<Cohjellah> but nim doesn't like it. Would just using null suffice?
06:08:47FromDiscord<Cohjellah> nil
06:08:48FromDiscord<ElegantBeef> you want ascii `'\0'`?
06:08:58FromDiscord<ElegantBeef> The null terminating character?
06:09:02FromDiscord<Cohjellah> I guess? So because I recreated the wheel there is of course bugs
06:09:06FromDiscord<Cohjellah> on windows
06:09:29FromDiscord<Cohjellah> on Linux is works great, but for instance the backspace key is different, and shift is creating spaces because it shows up as '\u0000'
06:09:46asdjust use linux.
06:09:54FromDiscord<Cohjellah> it's a chat app
06:10:01FromDiscord<Cohjellah> want it to work on windows
06:10:05asdjust talk to linux users.
06:10:10FromDiscord<Cohjellah> hahahaha
06:10:16FromDiscord<Cohjellah> that's the optimal solution hmm
06:10:21asdwho gives a shit what windows users have to say?
06:10:55FromDiscord<Rika> Why do you need a null character
06:11:19asdrika has null character.
06:11:32FromDiscord<Rika> I can tell
06:11:42FromDiscord<Cohjellah> I don't need one
06:11:54FromDiscord<Cohjellah> but for windows users when they use shift it's giving the server a null character
06:12:03FromDiscord<Cohjellah> which is giving the windows users a blank space
06:12:31FromDiscord<Cohjellah> like so
06:12:32FromDiscord<Cohjellah> https://media.discordapp.net/attachments/371759389889003532/792636011112562718/unknown.png
06:12:58FromDiscord<ElegantBeef> So just dont add that character ๐Ÿ˜„
06:13:16FromDiscord<Cohjellah> trying to disregard it, but when I put '\u0000' it just goes red
06:13:17FromDiscord<Cohjellah> it's odd
06:13:19FromDiscord<Cohjellah> let me try compile
06:13:24FromDiscord<Rika> Use \0
06:13:28FromDiscord<Rika> Not the u one
06:13:35FromDiscord<ElegantBeef> well `'\u0000'` is unicode not a ascii char
06:13:47FromDiscord<Rika> Is it a code point or what
06:13:59FromDiscord<Rika> If itโ€™s a code point the I guess itโ€™s something different t
06:14:17FromDiscord<Cohjellah> riight so is there a mismatch between windows and linux hence the issues
06:14:26FromDiscord<Cohjellah> is there a way to change the encoding... or something
06:15:05PrestigeCan you show the code? Idk what's going on
06:15:16Prestigebut I also don't use Windows if that's actually the problem
06:16:02FromDiscord<ElegantBeef> I dont even know how you're getting a unicode character here
06:16:14FromDiscord<Cohjellah> ahahaha neither
06:16:19FromDiscord<Cohjellah> something to do with windows
06:16:20FromDiscord<ElegantBeef> `getCh` returns a `char`, which is not unicode
06:16:29FromDiscord<ElegantBeef> Is your server written in Nim aswell?
06:16:30asdtell the windows users not to use shift.
06:16:47*asd is now known as disruptek
06:17:17FromDiscord<Rika> Tell them to move to Linux
06:17:59Prestigehttps://i.imgur.com/N4KrlS8.png disruptek Idk who would disagree. it's much better
06:18:46disruptekyou'd be suprised how common it is in the compiler.
06:19:03FromDiscord<ElegantBeef> I mean i'd merge the two ifs but newline the if body, unless i'm using `if foo != nil` for something else
06:19:19PrestigeThe CTO at my company does that actually, it's kind of annoying
06:19:25FromDiscord<Cohjellah> the server is written in nim too
06:20:06FromDiscord<Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=2JGE
06:20:09FromDiscord<Cohjellah> it's completed borked it. Nothing types on Windows
06:21:58FromDiscord<ElegantBeef> I mean prestige as i said i do it depending on the case, i dont see the point nesting them if you're only using that nil check with the other one
06:22:34Prestigethe execution on the same line annoys me
06:22:36disruptekthe point is that it's more legible and easier to see the control-flow, particularly when looking for a missing else.
06:22:44Prestigethat too
06:22:59FromDiscord<ElegantBeef> Yea i dont like the one line either
06:23:40*narimiran joined #nim
06:24:28FromDiscord<Rika> Me neither but I bet Iโ€™ve done it before
06:32:27disrupteki aspire to write code that, even if it doesn't match my future style, won't be so ugly that it causes me to want to rewrite it. a commit merely to change style is annoying at best and breaking at worst.
06:33:44FromDiscord<ElegantBeef> i aspire to write code that
06:34:16FromDiscord<Rika> Sucks
06:34:25FromDiscord<Cohjellah> sooooo
06:34:28disrupteksucks would be an improvement, huh beef.
06:34:33FromDiscord<Cohjellah> shift AND caps lock on windows produces unicode: \u0000
06:34:35FromDiscord<Cohjellah> and
06:34:40FromDiscord<Cohjellah> \0 just breaks it... HMM
06:34:41FromDiscord<ElegantBeef> Yea, garbage < sucks
06:35:16FromDiscord<ElegantBeef> What terminal emulator are you using?
06:35:17FromDiscord<Cohjellah> so the ASCII version of unicode \u0000 is \0?
06:35:23FromDiscord<Cohjellah> I'm using just regular old bash
06:35:26FromDiscord<Cohjellah> they're using the base terminal
06:35:34FromDiscord<Cohjellah> for windows
06:35:40FromDiscord<ElegantBeef> Jesus christ
06:35:47FromDiscord<Rika> ???
06:35:48FromDiscord<ElegantBeef> Windows Terminal 2 exists
06:35:53FromDiscord<Rika> I am hella confused
06:35:56FromDiscord<Cohjellah> powershell?
06:36:05FromDiscord<ElegantBeef> No
06:36:12FromDiscord<ElegantBeef> Windows Terminal
06:37:33FromDiscord<Cohjellah> riiight
06:37:51FromDiscord<Cohjellah> so they click the exe, it opens into whatever Terminal is default on Windows
06:38:06FromDiscord<ElegantBeef> And windows command prompt is garbage
06:39:03FromDiscord<ElegantBeef> you could always just remove `\u0000` from the string, since it's apparently getting added somehow, but no clue why
06:40:13FromDiscord<Cohjellah> I'm trying
06:40:18miprisomething like an 8-byte API with bad FFI that thinks it's getting 16-byte returns, maybe
06:40:20FromDiscord<Cohjellah> but nim dislikes \u
06:41:03mipri!eval echo ("\0"[0].byte, "\0"[0] == '\0')
06:41:07NimBot(0, true)
06:41:31FromDiscord<Rika> !eval echo "\u0000" == "\0"
06:41:34NimBottrue
06:41:36FromDiscord<ElegantBeef> !eval echo "\u0000".len
06:41:39NimBot1
06:41:43FromDiscord<Cohjellah> nani
06:41:45FromDiscord<Rika> lol
06:42:09FromDiscord<ElegantBeef> !eval echo "\u0000" in {'\0'}
06:42:11NimBotCompile failed: /usercode/in.nim(1, 15) Error: type mismatch: got <set[char], string>
06:42:18FromDiscord<Cohjellah> oh
06:42:20FromDiscord<Cohjellah> you guys are doing strings
06:42:31FromDiscord<ElegantBeef> Well yea it's not a char
06:42:36FromDiscord<Cohjellah> riiiiiiiiiiiiiiiiiiiiiiiiight
06:42:38FromDiscord<ElegantBeef> It's a unicode character
06:42:42FromDiscord<ElegantBeef> Which is multiple bytes
06:42:46FromDiscord<Rika> not always
06:42:58FromDiscord<ElegantBeef> Well can be,
06:43:00FromDiscord<Rika> alphanums are unicode chars, yet single bite
06:43:01mipriit isn't multiple bytes in this case, but that's why the char syntax doesn't work.
06:43:01FromDiscord<Rika> bye
06:43:04FromDiscord<Rika> bYTE
06:43:05FromDiscord<ElegantBeef> Proved it's' a single byte he
06:43:05FromDiscord<Rika> GOD
06:43:09FromDiscord<ElegantBeef> (edit) "he" => "here"
06:43:17FromDiscord<Cohjellah> how the heck is char returning \u0000
06:43:18FromDiscord<Cohjellah> what in gods name
06:43:23FromDiscord<Rika> its not?
06:43:35FromDiscord<Rika> its a string with \u0000
06:43:37FromDiscord<Rika> not a char
06:43:50FromDiscord<ElegantBeef> well they're using `str.add(char)`
06:43:57FromDiscord<Cohjellah> ^
06:44:01FromDiscord<Rika> then use \0
06:44:10FromDiscord<Cohjellah> \0 makes nothing work on the windows user
06:44:10FromDiscord<Rika> i said that a while ago didnt i
06:44:11FromDiscord<Cohjellah> they can't type anything
06:44:19FromDiscord<ElegantBeef> So the terminal is returning `\0` and then adding to the str is causing it to be `\u0000`
06:44:31FromDiscord<Cohjellah> hol up I might have borked it in my code
06:44:35FromDiscord<Cohjellah> continue just goes back to the top of the loop doesn;'t it
06:44:36FromDiscord<Cohjellah> holy shit
06:44:38FromDiscord<Cohjellah> yep I'm retarded
06:44:46FromDiscord<Cohjellah> Classic blunder
06:44:46FromDiscord<Cohjellah> soz for swears
06:44:55Prestigedisruptek: what do you mean by `Use try expressions only without an except clause`?
06:47:29disruptekprestige: if you plan on raising an exception, you'll get a syntax error for a try expression.
06:48:08PrestigeBy that I think you mean, variable assignment to a try block?
06:48:26ForumUpdaterBotNew thread by Domogled: Asynchttpserver basic-usage with error, see https://forum.nim-lang.org/t/7295
06:48:27FromDiscord<ElegantBeef> `expression` is the key here
06:48:32disruptek^
06:48:42FromDiscord<ElegantBeef> Expressions are on the right of an `=`
06:48:46disruptekthat's why it's in italics. ๐Ÿ˜‰
06:48:47PrestigeOh, okay
06:48:55PrestigeI wasn't sure if that's what it meant
06:51:04disruptekit's in the list because the behavior may vary before nim-2.0.
07:05:03FromDiscord<mratsim> is there any reason to expose the `while continuation != nil and continuation.fn != nil: continuation.fn(continuation)`
07:05:20disruptekof course.
07:05:47FromDiscord<mratsim> enlighten me
07:06:11disruptekevery dispatcher may be implemented differently.
07:06:48disruptekthings you might want to customize according to the dispatcher: exception handling, stack traces, etc.
07:07:03FromDiscord<mratsim> sure, but the only place they would stop is at a suspension point. They wouldn't know what to do if we break at a for loop?
07:07:44disruptekevery exit from a continuation is a suspension point.
07:07:57FromDiscord<mratsim> I mean something like "yield"
07:08:04disruptekyou mean a nil fn?
07:08:33FromDiscord<mratsim> not "for i in 0 ..< 10: if a[i] < 5: continue".
07:08:35FromDiscord<mratsim> yes
07:08:39FromDiscord<mratsim> a nil continuation.
07:09:40disruptekone example is that we need to impl `[]`(c: C; a, b: int): int so that it can do a tail trampoline and return the result.
07:09:44FromDiscord<mratsim> Because if we have every {.cps:C.} function generates automatically a while wrapper, we can easily add "yield" with a return statement.
07:10:10FromDiscord<mratsim> instead of the c.value that is stored within the continuation
07:10:39disruptekthis is indeed how yield is impl.
07:10:52FromDiscord<mratsim> otherwise we need a "channel" to communicate result to the outer scope
07:11:20disruptekone example is that we need to impl `[]`(c: C; a, b: int): int so that it can do a tail trampoline and return the result.
07:11:24FromDiscord<mratsim> and we need to introduce Option[T] for the cases we actually yielded something or if it was just regular control flow.
07:11:39FromDiscord<mratsim> in which fail is the example?
07:11:44FromDiscord<mratsim> file
07:12:10disruptekwe haven't impl it. it's just my shorthand for "return result from an object-based continuation".
07:12:29disruptekit will have to be impl for every continuation type we generate, for obvious reasons.
07:12:58disruptekwe can call it `getResult` or something to make it more obvious while discussing it.
07:13:15FromDiscord<mratsim> I think it's too complex to have every end users generate their continuation type, add custom fields etc
07:13:29disruptekcoming from you, that's a remarkable statement.
07:13:47FromDiscord<mratsim> I'm always thinking about ergonomics
07:13:59disruptekZevv: mratsim is awake and i think he may be drunk.
07:14:27disruptekthink about the fact that people want to bring guns to this knife fight. nim will let them.
07:14:34disruptekthis is not the case with other languages.
07:14:52disrupteki wanna compose cps with my most complex abstractions.
07:15:35FromDiscord<mratsim> You jibe but: when you develop for ML, scientists don't care about the code, they produce software engineering garbage in matlab and they are fine with that.โ†ตWHen doing cryptography, if you don't make things as simple as possible, people will misuse that. And if you expose the internals, you better choose very annoying name to type.
07:16:08disruptekwell, i don't care about the name. ๐Ÿ˜
07:16:34FromDiscord<mratsim> Well me too I want to compose with complex abstractions but I want to make it very usable as well
07:17:12disrupteksure. using concepts isn't the problem, here, though.
07:17:22disrupteki mean, we used to infer the type. ๐Ÿคท
07:17:26FromDiscord<mratsim> we can show the way, but someone might find some weird IO usecase on streaming from distributed file system that I certainly won't implement.
07:17:55disruptekyou guys have a #head requires in libp2p.
07:18:03*disruptek sighs.
07:19:21FromDiscord<mratsim> So continuations are delimited, this mean their type is fixed, ContinuationProc[O] because at the end the cps proc is transformed from a proc that returns O (O for output).
07:19:53disruptekcould be.
07:20:36FromDiscord<mratsim> if the while true wraps the cps-ed proc, we can skip that promise "val" here: https://github.com/disruptek/cps/blob/rfc/stash/iterator.nim#L13
07:21:03FromDiscord<mratsim> just call the wrapper: https://github.com/disruptek/cps/blob/rfc/stash/iterator.nim#L19-L20 and it will return us the yield: https://github.com/disruptek/cps/blob/rfc/stash/iterator.nim#L19-L20
07:22:05FromDiscord<mratsim> Now you said something interesting about stacktraces.
07:22:10disrupteki think the logic there is a little weird.
07:22:43disruptekbut, yeah, if you wanna rewrite it i'm happy to see what you come up with.
07:22:58FromDiscord<mratsim> but if we want to customize stacktraces we need to provide an enum "cfWhile, cfFor, cfBreak"
07:23:00disrupteki never mind it when people rewrite zevv's stuff. ๐Ÿคฃ
07:23:24disruptekthe stack traces can be composed statically.
07:24:06disruptekthere's a crude impl in the code already.
07:24:18FromDiscord<mratsim> but they need to be able to reconstruct the original control flow pre-cps I think
07:24:35disrupteksee what you think.
07:24:47disruptekit's not like we don't have all the line info if we want to use it.
07:25:04FromDiscord<mratsim> I think stacktraces is a different problem than the dispatcher, solved by different people and it's better to provide a separate API for it.
07:25:04disruptekwe should be able to do very sophisticated traces if we want them.
07:25:34disruptekthe question about stack trace is whether it needs partial impl in the transform itself.
07:25:46disruptekit currently lives inside the transform, to some extent.
07:25:58FromDiscord<mratsim> we can use the {.tags.} to say {.tags: forLoop.}
07:26:05disruptekit might make more sense to do a static analysis of the transform after it is complete.
07:26:06FromDiscord<mratsim> with a line number
07:26:18*juanfra__ joined #nim
07:26:32disruptekwhat's the point of that?
07:26:57disrupteki wouldn't confuse the issue with the effects system.
07:27:14FromDiscord<mratsim> tags are effect that propagate up?
07:27:27disruptekyes, but you can leave any ast that you want in the tail of the proc. no one will ever see it.
07:27:38FromDiscord<mratsim> ah then it's wrong
07:27:45disruptekreturn ...; when false: any ast i want.
07:27:57disruptekthe when false just prevents sem.
07:28:02FromDiscord<mratsim> I usually hide them in discard statement
07:28:16disruptekyeah, it's whatever you want.
07:28:35disrupteki don't want the compiler trying to understand my metadata.
07:28:56FromDiscord<mratsim> I don't think it's just Zevv code I will need to rewrite, it's the public stuff: cps and cpsMagic.
07:29:13disruptekgo nuts.
07:29:20FromDiscord<mratsim> sure
07:29:26FromDiscord<mratsim> see you in a week :p
07:29:30disruptekhaha
07:29:48disruptekjust remember that we have huge potential here and i dunno about zevv, but i hate giving up opportunity.
07:29:51FromDiscord<mratsim> I wonder if I should try this directly on the typed branch instead of 0.0.13
07:30:02disruptekyou should. untyped is shit.
07:30:26FromDiscord<mratsim> Do you think I give up? ๐Ÿ˜› I spent a long time banging my head to make Weave work.
07:30:26disruptektyped is much slicker.
07:30:48disrupteki know your work ethic. ๐Ÿ˜‰
07:31:49FromDiscord<mratsim> I do put a lot of things on pause but usually to try to work on things that are good on the potential attractiveness/time ratio for Nim.
07:32:09disruptekright, and when this thing works, it's going to blow away everything else out there.
07:32:10FromDiscord<mratsim> anyway. let's open the bowels of the beast
07:32:50FromDiscord<ElegantBeef> Ah i thought it started smelling like shit in here
07:32:55disruptekaccording to clyybber, we can just swap out the hidden nodes.
07:33:06disruptekto work around the issue with desem.
07:33:12FromDiscord<mratsim> I'll be DND for a while and will only come back when I'm tired of macro+type shit.
07:33:22disruptekokie.
07:33:27FromDiscord<mratsim> Which i assume will happen in 3, 2, 1 ...
07:33:32FromDiscord<ElegantBeef> Was nice knowing you
07:33:32disruptekit's 02:30 here anyway.
07:33:56FromDiscord<mratsim> you can watch my progress here: https://github.com/nim-lang/RFCs/issues/44
07:33:57disbotโžฅ [RFC] Working with types in macro is difficult.
07:34:27FromDiscord<mratsim> and the backup: https://github.com/nim-lang/Nim/issues/8677
07:34:28disbotโžฅ [Meta] Generics/Static early symbol resolution
07:35:22disrupteki mean, there has never been a shortage of bugs in nim.
07:35:29disruptekwhat we need is a spec.
07:35:43disruptekcps is helping to create that, in theory.
07:35:57FromDiscord<mratsim> CPS is helping create API
07:36:20FromDiscord<mratsim> not sure if you read my draft design, but we can decribe a lot of thing in terms of suspendand resume.
07:36:39FromDiscord<mratsim> Streams, IO, task, iterators, async, ...
07:36:41disruptekyeah, i hate that. ๐Ÿ˜„
07:37:01FromDiscord<mratsim> but it's true :p
07:37:10disruptekto me it's not about suspend/resume, it's about A->B.
07:37:12FromDiscord<mratsim> you can call that await and "next" if you want
07:37:14FromDiscord<mratsim> I compiled a list of aliases
07:39:09FromDiscord<mratsim> resume aliases: "wake", "waitFor", "generate", "continue", "produce", "read", "lex", "parse", suspend aliases: "schedule", "launch", "start"
07:39:33FromDiscord<mratsim> thogh I gues it's more sexy to talk about producer-consumer.
07:39:53FromDiscord<mratsim> resume = consumer, suspend = producer
07:39:55disrupteki really wanted to reuse `yield`, `continue`, etc.
07:40:28disruptekit's possible, but a little more convoluted.
07:42:07FromDiscord<mratsim> same
07:42:36FromDiscord<mratsim> yield might be possible though, for coroutines.
07:42:44FromDiscord<mratsim> it should parse the same.
07:43:01FromDiscord<mratsim> continue will likely error at the parser level
07:43:19disrupteknah, it just needs an untyped layer.
07:43:24FromDiscord<mratsim> I think we should really push the producer-consumer narrative.
07:43:25disruptekbut it's just hard to justify that.
07:43:40FromDiscord<mratsim> That's what continuations solve in an efficient way.
07:44:04disruptekyes, but it's not the mental map, i don't think.
07:44:13disruptekbut anyway, get to work. you can rename it later. ๐Ÿ˜
07:44:19FromDiscord<mratsim> Producer->consumer: without intermediate buffers, without atomics or locks synchronization, without state machine, can be paused, interleaved, resumed.
07:44:23Zevvdudes
07:44:28disruptekoh shit.
07:45:35Zevvi thought i would come in early and say something relevant & smrat
07:45:46Zevvayway, I'm the best learner today. slept the longest
07:45:56disrupteki believe that.
07:46:39disruptekyou have a whole week of extra sleep ahead of you, assuming you can find a hole to put your kids in.
07:51:31Zevvyou told mratsim yet that generics for a trampoline is not the right answer, right
07:51:41Zevvlike, you told him often enough now
07:52:06disruptekhe doesn't even want to expose the trampoline.
07:52:21disrupteki told him he can do whatever he wants to your code. ๐Ÿคช
07:52:34disruptekit won't work, but that's okay with me.
07:53:11disruptekhaving more experiments to look at won't be a bad thing.
07:54:00Zevvfair enough
07:54:10Zevvits not about the exposing
07:54:17Zevvbut you know that, and I
07:55:46disrupteki think he has to write a few implementations. it's the best way to understand the domain.
07:56:25Zevvsure
07:56:46Zevvand I don't mind him rewriting your code
07:56:54disruptekheh
07:58:20FromDiscord<hobbledehoy> is there anyway to have optional parameters in a pragma?
07:58:26disruptekyes.
07:59:07FromDiscord<hobbledehoy> how? I've tried just making the parameter in the macro optional but it didn't work
07:59:37disruptekhere's an example:
07:59:44disruptek!repo disruptek/criterion
07:59:44disbothttps://github.com/disruptek/criterion -- 9criterion: 11statistics-driven micro-benchmarking framework 15 13โญ 0๐Ÿด
07:59:53disrupteksee the .measure in sugar.nim.
08:00:02disruptekat least, i think that's where it is.
08:00:57disruptekthere might still be a bug with .measure. verus .measure: []. but i think it's fixed.
08:04:27disruptekzevv: you will have to keep your eye on mamy; i need to learn a thing.
08:04:29FromDiscord<hobbledehoy> thanks!
08:06:35Zevvsweet learns
08:08:34Zevvmratsim: our current CPS splitter is overly eager, it splits at all control flow, without checking if there is actually a suspension point in there
08:09:04Zevvthat should not be hard to fix, but for now we got ton's of "false" suspends
08:31:20AraqChristmas is over, back to work
08:45:01FromGitter<nothratal> ```code paste, see link``` โŽ โŽ Can someone tell me how to ignore the error I'm getting? โŽ => Error: invalid order in enum 'b' [https://gitter.im/nim-lang/Nim?at=5fe8498d97312f4b6bf16b68]
08:45:52FromGitter<nothratal> I'm converting a code snippet from another language, the enum has over 200 unordered, but unique entries...
08:46:20FromDiscord<ElegantBeef> "However, the ordinal values have to be in ascending order. " from the manual
08:47:43FromDiscord<ElegantBeef> Your best solution i imagine is to write something that extracts the information and stores the identifier ordinal in ascending order
08:47:49FromDiscord<ElegantBeef> But i'm constantly wrong
08:48:11FromGitter<nothratal> :D
08:49:15FromGitter<nothratal> I'm considering to convert it into a table, but that's also very ugly
08:49:18Araqc2nim reorders it for you
08:52:32FromDiscord<ElegantBeef> What's the source material?
08:55:45FromGitter<nothratal> c2nim did the trick
08:55:59FromDiscord<ElegantBeef> Ah that answers my question ๐Ÿ˜„
08:56:21FromGitter<nothratal> out of curiosity, why does nim require it in ascending order?
08:57:16Araqcause nobody added a 'sort' call to the compiler
08:57:32Araqalso, when I wrote the code, I didn't have 'sort' lying around. PRs are welcome
08:58:12Araqthere is probably a problem with what 'enum x = 3, y, z = 2' means
08:58:39Araqshould 'y' still be 4 implicitly?
08:58:52FromGitter<nothratal> lol, I thought I get a highly technical explanation. I like this one :D
08:58:52FromDiscord<ElegantBeef> Was going to say `x, y = 3, z = 2, w` is a bit confusing
08:59:51FromDiscord<ElegantBeef> Would `w` be 4 if so then everything after makes no sense really
09:00:55miprithose are both errors currently, so changing them wouldn't be breaking code
09:01:21mipriwell, tihs isn't an error: x = -1, y, z = 3 # y is 0
09:02:25mipriyeah I thought y would always be zero but it's +1 of the previous value, of course.
09:04:32FromDiscord<ElegantBeef> Personally i've never seen anyone use non ascending enums, so i dont see much of a benefit
09:04:57mipriyou don't ever see it in Nim because the compiler rejects it
09:05:09FromDiscord<ElegantBeef> I mean in general
09:05:36mipriwell in general, I don't see enums with explicit values.
09:06:39mipriI thought of something like a `type Blah = static object`, analogously to `ref object` where there's an anonymous object type created to match the declaration, but in this case it's an enum body
09:06:58PrestigeI'm probably just used to this because of Java, but being able to construct enums with properties as if the were an object (all of the same type) was useful at times
09:07:40PrestigeAs if it were*
09:08:05FromDiscord<ElegantBeef> Well good news they're just a singleton wrapping a class
09:09:20AraqJava's enums are offending
09:10:01PrestigeWould be nice to be able to do that with Nim, but I'm probably the only person that feels that way. I don't currently have a use case for it either so whatever
09:10:31FromDiscord<ElegantBeef> I mean you can make an `array[Enum, T]`
09:10:37Araqwell you should be able to add this feature via Nim's macro system
09:11:09PrestigeYeah, if I ever run across it maybe I'll make a FatEnum or something, lol
09:11:12miprido what specifically? You can still write procs that that take an enum type and look like properties.
09:11:15FromDiscord<ElegantBeef> Isnt it just a few constants mixed with the abillity to make them?
09:11:41PrestigeYep pretty much
09:11:54Araqlol, FatEnum, good name
09:12:34FromDiscord<ElegantBeef> So you get a similar thing using an array mixed with some properties ๐Ÿ˜„
09:13:37FromDiscord<ElegantBeef> Man i loved live before reading Nim's "Nim for Java programmers" I lived in bliss not realizing what the jvm was doing with all of it's objects ๐Ÿ˜„
09:14:38PrestigeI should work on that MI macro when I get back from vacation.. going to be interesting
09:14:49saemThanks for merging, Araq. I ended up poking at nim-gdb.py today I think I've fixed a bunch of bugs with view types with it (created a new one, but that's because I don't understand memory layouts well), and hopefully tomorrow gdb will be a whole lot more useful.
09:15:08Araq:O
09:16:45AraqI have to thank you!
09:16:52Araqexcellent work
09:17:17saemI mean, if you think it's a terribad idea I'm all ears, but I'm finding it really hard to make progress without just starting at the memory layout. :D
09:17:41saems/starting/staring
09:17:43AraqI rarely use any debugger
09:17:47Araqso don't ask me
09:18:18Araqand yeah, I did use C# for years and it's debugger is excellent. Didn't use it much either.
09:18:47Araqthe eternal step-into vs step-over question takes too much brain power
09:19:03saemI much prefer types + writing tests, but I need other design things to be true before I can make progress that way.
09:19:07FromDiscord<ElegantBeef> Same for me, the only times i feel like i need the debugger is when doing stupid things like recursive logic
09:19:37saemGraphics is the only time I've felt like I desperately need a debugger.
09:19:49FromDiscord<ElegantBeef> Let's traverse a graph using a while loop eternally.... and i crashed unity
09:19:51saemOr when I can't reason about memory layouts
09:22:06saemAnyhow, I learned a bunch about gdb python integration and got a sense of types of consideration from the work that the Rust folks did: https://github.com/rust-lang/rust/blob/master/src/etc/gdb_providers.py
09:23:50saemI'll probably need to fix choosenim afterwards, because it ships with a broken nim-gdb.
09:32:08FromDiscord<ElegantBeef> How dare you share that repo here! ๐Ÿ˜›
09:32:20FromDiscord<Rika> @ElegantBeef#550 Nim for Java programmers?
09:32:24*saem is a monster
09:32:47FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/wiki/Nim-for-Java-programmers
09:32:53FromDiscord<Rika> Thanks
09:33:43ZevvAraq: seems that mratsim has seen the light, he'll take us there
09:33:58Zevvhe needs to lose few fingers on the blade first, but he'll be ok
09:36:46AraqI worry a bit but shut up
09:37:34ZevvI can read that as "I worry a bit, but shut up (you)" or "I worry a bit, but (I) shut up"
09:37:35*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:37:37Zevv:)
09:38:05AraqI shut up.
09:38:10FromDiscord<ElegantBeef> Zevv read it like the first, as i did just to keep yourself on your feet
09:38:12ZevvMe too
09:41:01saemDraft PR for the gdb bits in case anyone is curious, I need to crash, it's almost 2AM. https://github.com/nim-lang/Nim/pull/16479/files
09:41:02disbotโžฅ Attempts at improving nim-gdb.py
09:41:05Araqall I want is Weave with refs and strings and seqs and some IO support
09:41:39FromDiscord<ElegantBeef> nighty night west coast ๐Ÿ˜„
09:41:49saemThanks, good nite
09:41:56*saem quit (Remote host closed the connection)
09:41:59Araqgood night, take care
09:56:22FromDiscord<ElegantBeef> I only briefly looked at docgen, but any clues on how hard it'd be to add the import path as a subtitle on the output of them modules?
09:56:29FromDiscord<ElegantBeef> (edit) "them" => "the"
09:57:29Araqsimple?
09:57:52FromDiscord<ElegantBeef> I imagined so
10:10:35*Torro joined #nim
10:15:39*opal joined #nim
10:24:23*Vladar joined #nim
10:24:53FromDiscord<TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JHC
10:29:04Araqecho createMessage("John", "Hi!")
10:29:09Araqso that you can see how it's different
10:29:20Araqfrom what you assumed it would be
10:40:21FromDiscord<TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JI9
10:40:39miprithere's an extra space in your 'expected'
10:40:50mipriafter "John",
10:41:25*Cthalupa quit (Ping timeout: 240 seconds)
10:43:08*Cthalupa joined #nim
11:02:58ForumUpdaterBotNew thread by Mantielero: C++ FFI templates, see https://forum.nim-lang.org/t/7296
11:20:14FromDiscord<TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JNS
11:31:12FromDiscord<Rika> Itโ€™s better if you compare JSON nodes instead of the string versions
11:33:13*Arrrrrrrr joined #nim
11:40:15*cYbErTiM[m] joined #nim
11:51:00FromDiscord<cybertim> Been trying to get the httpclient example from the manual working.. for over 4 hours now ๐Ÿ˜› On linux and on windows i always get this when I run the 'nim compile --run' command: "Error: cannot evaluate at compile time: defaultSslContext" and i can't get any leads or info on this issue.. also tried adding -d:ssl or passing some parameters into newHttpClient, but i guess the example from the manual is suppose to work?
11:57:25*krux02 joined #nim
11:58:49FromDiscord<Rika> With the define yes
12:01:16*cYbErTiM[m] left #nim ("User left")
12:03:36miprithe manual doesn't have an httpclient example. What specific example are you talking about?
12:03:51*superbia joined #nim
12:04:17FromDiscord<Rika> I think they mean from the docs
12:04:43FromDiscord<cybertim> https://nim-lang.org/docs/httpclient.html first code sample
12:05:13miprithe three line one, with google.com?
12:05:25FromDiscord<cybertim> yes
12:05:57mipriit works for me with no flags required. just 'nim r thefile' is enough.
12:06:06mipriwhat version of Nim do you have?
12:06:47FromDiscord<cybertim> Nim Compiler Version 1.4.2 [Linux: amd64] and Nim Compiler Version 1.4.2 [Windows: amd64]
12:08:05FromDiscord<Rika> Probably some weird SSL issue again
12:08:17mipriit's not an SSL request.
12:08:44FromDiscord<cybertim> the whole error is: toolchains/nim-1.4.2/lib/pure/httpclient.nim(321, 12) Error: cannot evaluate at compile time: defaultSslContext
12:08:49FromDiscord<Rika> Well read the error
12:10:31mipriwhen -d:ssl isn't passed, that's line's just returning a dummy threadvar
12:10:55miprithere's nothing at all ssl about it actually.
12:11:41mipricybertim: I get your error if I change 'var client = newHttpClient()' to 'const client = newHttpClient()'
12:11:57mipriperhaps you're not running the example in the manual, but something like that?
12:13:48FromDiscord<cybertim> that seems to be the issue indeed ๐Ÿ™‚ now it passes (though i get ssl issues now) but at least i can continue my journey
12:14:17FromDiscord<cybertim> i guess const isn't like const i think a const is
12:14:22mipriNim isn't JS, no.
12:15:54FromDiscord<lqdev> @cybertim Nim `let` is like JS `const`
12:16:01FromDiscord<lqdev> or, not really
12:16:08FromDiscord<lqdev> nvm
12:16:09FromDiscord<lqdev> it is
12:16:30*Arrrrrrrr quit (Quit: Arrrrrrrr)
12:16:37FromDiscord<lqdev> Nim `var` โ†’ JS `let`โ†ตNim `let` โ†’ JS `const`โ†ตNim `const` โ†’ no JS counterpart
12:18:34FromDiscord<cybertim> ok, let is actually a typescript thing, and my background is mainly java/typescript
12:19:40mipriJS does have a let
12:20:41mipriand you're right about the mapping.
12:20:48FromDiscord<cybertim> ohwell, with const i thought more of 'final' in java
12:21:19FromDiscord<lqdev> nah that's what `let` does
12:21:42FromDiscord<lqdev> `const` is actually quite different โ€“ it does compile-time evaluation
12:22:40miprivar - here's a variable. It's just fine to use, it's not like 'var' in JS which is just something only old code does beacuse it didn't have JS2015 improvements. You shouldn't automatically rewrite it when you see it into something else.
12:23:14miprilet - here's an immutable variable. const - here's a statically-known value.
12:24:08qwrJS var means the declared variable happens magically in containing functions outermost scope, relict from time when JS had no block scopes
12:28:09qwrin nim its imho good to use let for any binding that don't mutate, makes code intent clearer
12:28:56qwr(and which isn't constant)
12:28:57mipriyeah, and the example would've worked with 'let'
12:30:14miprisince it's a ref object, the non-var parameters using it are a bit of a lie
12:49:01Zevvmratsim: I found my coro on a backup: https://github.com/disruptek/cps/blob/coro/stash/coroutine.nim
12:49:10Zevvfor what its worth
13:03:35FromDiscord<Filipe Duarte> Trying to use jupyternim but need to add zmq to the PATH. I installed ZeroMQ but don't know to add to the jupyternim path
13:25:07*superbia quit (Quit: WeeChat 3.0)
13:49:37planetis[m]system is missing an export for nimCmpMem, can I add it?
13:51:07Araqit's not missing
13:51:29Araqmaybe cmpMem is missing tho
13:52:29planetis[m]yes there is zeromem, copymem, equalmem
14:05:44*NimBot joined #nim
14:20:22*MarderIII joined #nim
14:20:43*opal quit (Ping timeout: 240 seconds)
14:27:40*clemens3 joined #nim
14:36:58Oddmongeri'm using ยซ Color ยป which is a ยซ distinct type ยป (not sure to have understood what is it, except it's a type which cannot be use a the type)
14:37:15Oddmongerso for using it, i either cast it or postfix it, that is:
14:37:49Oddmongerstdout.setBackgroundColor( cast[Color](c)) or stdout.setBackgroundColor( c.Color)
14:38:01Araqnever 'cast' it
14:38:19Oddmongerisn't the c.Color a sort of casting ?
14:38:31mipriit's checked
14:39:28Oddmongerbut how to check an integer ?
14:39:53Oddmongeri could as well do var a:Float , and then a.Color
14:42:19Oddmongerindeed it works, i've just tried. Why this is better than a cast ?
14:42:35Araqbecause 'cast' is unsafe
14:42:55Araqplease read any tutorial or the manual
14:44:52mipri!eval import os; var a = 1.2; echo (FileMode(a), cast[FileMode](a))
14:44:56NimBot(fmWrite, 51 (invalid data!))
14:47:21mipriit's not the most compelling example with enums, but it just gets worse from here.
14:48:16FromDiscord<Rika> gets even worse when you start casting ref types
14:48:19FromDiscord<Rika> lmao
14:51:07*Arrrrrrrr joined #nim
15:02:42FromGitter<HJarausch> optional seq parameter defaulting yo an empty list - how to โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5fe8a21297312f4b6bf2362b]
15:03:31FromDiscord<flywind> !eval proc foo(l:seq[int] = @[]) = discard
15:03:33NimBot<no output>
15:03:57FromDiscord<flywind> Always use space between operator I think.
15:04:36mipri@ is an operator, not syntax, so it can obviously appear in operators itself. and operators like += have = in them. conclusion: =@ is an operator that Nim hasn't been told about
15:06:01FromGitter<HJarausch> Yes, thanks. Important spaces are driving me crazy in Nim
15:06:35Oddmongerhaha me too, it remembers < < and << in C++ (with templates)
15:07:15Araqsimply learn the language, *shrug*
15:07:42Oddmongeroh i do, but it doesn't prevent some hair pulls :)
15:07:46Araqthe lexing rules are actually simpler than in most other languages (fewer special cases)
15:08:09Araqbut if you never learn them it remains guesswork
15:09:15Zevvstory of my life
15:09:40FromGitter<HJarausch> At least in C++ it was a stupid parser. A human friendly parses should consider alternatives if one interpretation doesn't work. But who requires software to be human friendly?
15:10:02*MyMind quit (Ping timeout: 256 seconds)
15:10:08narimiranspeaks a man who writes human-unfriendly code constantly
15:11:14Araqa set of simple rules works much better than an "intelligent" system that invites users who love the race to the bottom.
15:11:39Araqin the end you have more complex rules which are just as surprising as the simpler ones
15:12:20Araqmaybe "surprising" for *other* people, but they will always be surprising for somebody
15:15:42*Gustavo6046 quit (Ping timeout: 268 seconds)
15:18:09*Gustavo6046 joined #nim
15:32:27FromGitter<deech> How do `range[...]` types work for inputs that are not known at compile time? Runtime error?>
15:34:12mipri!eval import strutils, times; echo "1".parseInt.MonthdayRange
15:34:16NimBot1
15:34:20mipri!eval import strutils, times; echo "100".parseInt.MonthdayRange
15:34:23NimBot/usercode/in.nim(1) inโ†ต/playground/nim/lib/system/fatal.nim(49) sysFatalโ†ตError: unhandled exception: value out of range: 100 notin 1 .. 31 [RangeDefect]
15:35:33FromDiscord<alehander42> heyy
15:35:42FromDiscord<alehander42> so good to rest a bit
15:39:48FromGitter<deech> mipri: Thanks!
15:55:32*MyMind joined #nim
15:55:35mipriand continuing the earlier thread,
15:55:38mipri!eval import strutils, times; echo cast[MonthdayRange]("100".parseInt)
15:55:41NimBot100
15:58:14FromDiscord<Recruit_main707> can you get the parent of a nim node?
15:58:56disrupteknot without cheating.
16:05:49*waleee-cl joined #nim
16:11:05*Torro left #nim ("bye")
16:15:21FromDiscord<Recruit_main707> can i get the type implementation of an object given its name?
16:17:14FromDiscord<lqdev> yeah
16:17:19FromDiscord<Recruit_main707> how
16:17:32FromDiscord<lqdev> is your name a string, an ident, โ€ฆ?
16:17:50FromDiscord<Recruit_main707> `macroName: TypeName`, ideally
16:18:05FromDiscord<lqdev> `macroName` is your macro?
16:18:07FromDiscord<Recruit_main707> yep
16:18:21FromDiscord<lqdev> you can make its parameter `typed` and then use `getTypeImpl[1].getTypeImpl` on that
16:18:22FromDiscord<Recruit_main707> so an ident i guess
16:18:34FromDiscord<Recruit_main707> ah, perfect
16:19:23FromDiscord<lqdev> the reason for the extra getTypeImpl[1] is because using getTypeImpl on a type sym passed to a macro returns AST for `typeDesc[T]` for some reason, so we take the T and return its impl
16:19:54FromDiscord<Recruit_main707> i see, thanks
16:21:50FromDiscord<mratsim> @Araq, Weave with strings, seqs, Isolated, that is probably possible with arc, ref to be checked, normally I move everything so it can't be collected within Weave.โ†ตโ†ตFor IO, no, that's the wrong tool
16:22:26FromDiscord<mratsim> Read this: https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md
16:28:16narimirandisruptek: is it known that criterion fails on nim 1.2.x and 1.4.x?
16:28:56*xace quit (Ping timeout: 240 seconds)
16:29:01federico3is there any Nim talk at CCC? https://streaming.media.ccc.de/rc3/one#schedule
16:31:10*xace joined #nim
16:35:38disrupteknarimiran: it passes my ci. nim's ci is broken.
16:35:50disruptekdoes it not work for you?
16:36:17*Gustavo6046 quit (Ping timeout: 260 seconds)
16:36:46disrupteki/o scheduling for cps is trivial enough that it hardly bears consideration.
16:37:01narimiranoh, now i see it is disabled in devel (and not on 1.2 nor 1.4), and it was disabled by T. because of https://github.com/disruptek/criterion/issues/3
16:37:09disruptekright.
16:37:33disruptekleorize is the one that turned me on to the problem and fixed it in his setup-nim.
16:38:24disrupteki mean, i'm assuming it's the same issue.
16:38:30disrupteki haven't looked into nim's ci.
16:39:01narimiranyeah, it looks like it is the same thing
16:39:04*Gustavo6046 joined #nim
16:39:12FromDiscord<mratsim> You have plenty of scheduling problem that you can focus on with CPS: introducing task budgets, multithreaded actors, multithreaded CSPs.โ†ตCPS liberates you from thinking about "how the hell do I transform the code and write that ugly macro".
16:39:22narimiran`sh: 1: testes: not found`
16:39:25FromDiscord<mratsim> you just capture the continuation and go wild.
16:39:59FromDiscord<mratsim> await becomes "scheduler.enqueue continuation"
16:40:05disruptekright. it makes the job much simpler, which is why it's used in compilers, etc.
16:40:32disrupteknarimiran: failure to find testes is usually a bad sign.
16:40:43FromDiscord<mratsim> git submodule?
16:40:51narimirandisruptek: nice one :)
16:40:59narimirandisruptek: should i just change the testing command to something like `nim c -r tests/many.nim` and call it a day?
16:41:21disrupteki wouldn't worry about fixing criterion.
16:41:32disruptekit's more important to fix the ci so it builds dependencies.
16:42:06disrupteki think many is too long a test, also. i made the tests faster recently.
16:42:45disruptekmratsim: how is your effort coming along so far?
16:43:38FromDiscord<mratsim> I somewhat repaired iterator.nim with cpsMutant, dropped the non-Mutant part of the code as well because I don't see a use-case for it.
16:44:04FromDiscord<mratsim> I have a good idea of what should work as the public API.
16:44:20disruptekah, i knew you would do that. i think it's a mistake, though.
16:44:22FromDiscord<mratsim> so now I'm looking to change environment.nim, to add the union trick
16:44:39disruptekbut let's see what you come up with, first.
16:45:57FromDiscord<mratsim> Is there a functional reason behind the tree of inheritance btw? I think it should still work if all are at the same inheritance novel no?
16:46:46FromDiscord<mratsim> level not novel
16:46:58disrupteki /think/ the current code /does/ work without new inheritance levels.
16:47:46disrupteki would try not to remove it in your first go-round.
16:48:22FromDiscord<mratsim> I'm not removing it but I'm separating that part cleanly so it's easier to compare the public proc purposes
16:48:22disruptekthe original idea was that we could do conversion and extension of extant types to optimize memory consumption.
16:48:28disruptekgood.
16:49:16FromDiscord<mratsim> I think if you do "type B = ref object of A" and "type C = ref object of A", on conversion they use the same memory.
16:49:34FromDiscord<mratsim> so your technique would likely save copies but not memory.
16:50:04disruptekyes, and this made more sense before we switched to typed.
16:50:40disruptekalso, growth is still a thing...
16:50:44FromDiscord<mratsim> And if unions work, we use refs only if we actually have ref/seq/strings. Refs are cheap to copy and seq/strings would be moved.
16:51:39FromDiscord<mratsim> My main worry is code maintenance, it's hard to follow the reparenting for example. It would likely be easier to debug if all inherits from the base Continuation.
16:51:55disruptekyou're not wrong.
16:51:57FromDiscord<mratsim> anyway, going back to the battlefield.
16:54:49FromDiscord<Clyybber> disruptek: The CI does nimble install -y --depsOnly
16:55:05disruptekso it's merely a path issue.
16:56:27FromDiscord<Clyybber> disruptek: We might untype the AST ourselves for now. Until the compiler is fixed
16:56:46disruptekit's starting to look like we'll have to.
16:56:48FromDiscord<Clyybber> Basically replace each NimNode with a new one, so as to set the .typ to nil
16:57:10disruptekdo we preserve hiddens?
16:57:19disruptekwe should elide them, no?
16:57:37FromDiscord<Clyybber> I have a patch to remove them for cps
16:57:46FromDiscord<Clyybber> but its no use without stripping .typ
16:57:54FromDiscord<Clyybber> and not sure if it pops up in cps anyways
16:58:14FromDiscord<Clyybber> I do it in the normalizeAst step or whatever its called
16:58:28disrupteknice.
16:58:48disrupteki have a bad arc crash on windows.
16:58:56disrupteknot sure what to do with it.
16:58:57FromDiscord<Clyybber> actually we might only have to untype calls, at least those are the ones where I know sigmatch skips them if they already have a typ
16:58:59disruptekit's my bloom filter.
16:59:19FromDiscord<Clyybber> find yourself a windows user
16:59:32disruptekeh... i hate those.
17:00:13ForumUpdaterBotNew thread by Jiyinyiyong: Compiling to js but failed, generics not supported?, see https://forum.nim-lang.org/t/7297
17:00:30disruptekit's a little embarrassing that araq uses windows.
17:31:36Zevvif he didnt, windows support for nim would be naught
17:38:30FromDiscord<acek7> Sup
17:41:29*abm joined #nim
17:43:45FromDiscord<Clyybber> disruptek: Since we are using submodules for cps is there a reason we don't have a config with the paths set up?
17:43:55disruptekyes.
17:44:28Zevvwhy do we have submodules
17:44:36*l1x quit (Quit: Connection closed for inactivity)
17:44:37Zevvcps needs no deps
17:44:47FromDiscord<Clyybber> because disruptek needs his testes
17:44:51Zevvsigh
17:44:55disrupteki'm rather attached to them.
17:44:57FromDiscord<Clyybber> sigh
17:45:08Zevvzevv the nodeps man
17:45:15disruptekwe don't use the submodules.
17:45:16FromDiscord<Clyybber> disruptek: Sounds like the dependency should be reversed
17:45:37disruptekmy testes should require cps? ๐Ÿค”
17:45:56Zevveverybody requires cps
17:45:58FromDiscord<Clyybber> testes should be attached to you, not the other way around
17:46:02Zevvthey just dont know that yet
17:46:24disruptekremember king missile's /detachable penis/ tune?
17:46:50disruptekor was that the butthole surfers.
17:47:12disruptekhttps://www.youtube.com/watch?v=byDiILrNbM4
17:47:42Zevvdisruptek: hold your head down with the profanity for a few weeks, now cps is getting rebooted, it would be a bad timing to lose you again for a few weeks
17:47:42FromDiscord<Clyybber> I woke up this morning with a bad repo
17:47:45Zevvyou can do it buddy
17:47:57Zevvjust sit on your hands before you type
17:48:03FromDiscord<Clyybber> my submodule was missing again
17:50:31Zevvso i didnt read up this morning, how will mratsim put non ref conts of diffent types in one scheduler?
17:50:55disruptekdid he say he would do such a thing?
17:51:18Zevvwe said he would do such a thing
17:51:26Fish-FaceZevv: did you ever solve AoC 19.2 with npeg?
17:51:36Zevvnope, greedyness
17:51:56Zevvguess it should be possible, but i got terribly lazy, aoc wise, this year
17:52:13Fish-FaceI thought I came up with a way to do it with a PEG, but npeg is looping on my translated input!
17:52:44Fish-Facenot sure why - might be my fault or a bug, I'm not very good at reading the traces (in such a complicated, contrived grammar anyway)
17:52:57Zevveven i couldnt. part of the reason i gave up
17:53:03Zevvthe aaabbabababbaaab made my eyes bleed
17:53:06Fish-Faceyeah
17:53:23Zevvwhat typically happens is that you try to match something of length 0
17:53:25Zevvlike * * 1
17:53:38Zevvtheres some safe guards in npeg to detect that at compile time, but it doesnt catch it all
17:53:50Zevvso it will happily match nothing, and then do it again and again
17:54:10Fish-Faceit's not that, it's backtracking to the same place I think
17:55:43Zevvstill the same thing, prbly
17:56:36*Zevv quit (Quit: Lost terminal)
17:57:00*Zevv joined #nim
17:57:02Zevvlua lpeg has a better verification for that, maybe I should look into that one day
17:57:20*MarderIII quit (Quit: Leaving)
17:59:45Fish-FaceOK my idea did work though (I switched back to `pegs`)
18:00:09Fish-Facewell that task was very annoying
18:00:18Fish-Facebut I learned something about parsers and pegs in particular
18:02:51disrupteki don't understand how someone can steal my asd nick when it's registered to my freenode account.
18:05:03ZevvFish-Face: sorry to hear npeg let you down
18:05:18Zevvit let me down as well on 19b, so thats that
18:05:21Fish-Facehaha
18:05:34Zevvtime to neglegt and then abandon that stuff
18:05:35Fish-Faceblame that guy Ford who invented PEG
18:05:59FromDiscord<Clyybber> disruptek: are the travis badges still there on purpose (nimph)
18:06:07Zevvyeah ford sucks a big time
18:06:18disruptekclyybber: i'm working on a new ci branch.
18:06:25FromDiscord<Clyybber> ah cool
18:06:48Zevva lot of my excuses are usually based on the fact that npeg builds on the same ideas of Lpeg, and Lpeg has the same problems as npeg has
18:07:31Fish-Facehehehe
18:07:46Zevvi just point to Ierusalimschy. Same kind of guy as Ford
18:07:51Zevvterrible, horrible people
18:08:23Fish-FaceI will push this code and then you can have a look if you care (I already had a look at your WIP code for 19b to try and steal ideas)
18:08:39Zevvalso I just dont understand most of all that stuff. its fun and all, but the stuff these guys put in their papers is really scary
18:08:43Fish-Facethen I was like "that doesn't even look like a valid grammar, I don't think I can still it"
18:08:46Zevvcool thanks
18:08:53Fish-Facesteal*
18:08:59Zevvfor me 19b didt spin, but it just gave the wrong answers
18:09:13Zevvlemme check if i have the code around
18:09:28Zevv9
18:09:29FromDiscord<Skippy> a quick question: How do I multiple conditions in an if statement pseudo code if a = b and a <10:
18:09:44disrupteklgtm
18:09:58Fish-Faceprediction: it's either an obvious error in my grammar, or a bug in npeg that will take hours to track down ;)
18:10:17Fish-Facehuh. What I have at the moment crashes with `-d:danger`, how exciting
18:11:40Fish-FaceZevv: https://github.com/fish-face/AoC2020/tree/master/19
18:12:23Zevvcan always be a bug, but with npeg I have something that never happened in my life before
18:12:34ZevvI got 0 (zero!) bugs reported on npeg up to now
18:12:40Zevvwhich makes me pretty suspicious
18:12:43Zevvhttp://ix.io/2K1t
18:12:45Zevvhere's my grammar
18:13:47Zevvyou're doing funky stuff with lookaheads
18:13:47Zevvwhy
18:13:50disrupteknah, i reported a bug.
18:13:57Zevvand *was* it a bug
18:13:59Zevvor just a report
18:14:12disruptekcapture indices off-by-one.
18:14:16miprione of your char classes was wrong, a long time ago.
18:14:22Zevvpfff
18:14:25Zevvyou guys are no fun
18:14:29disruptekheh
18:14:49Zevvlet me find those in github
18:15:21Zevvyeah the graph class, true. Was also an off-by-one
18:15:22Zevvha
18:15:30Zevvwell, *no* other bugs then off-by-ones then
18:15:37Zevvdamn
18:16:05FromDiscord<Clyybber> @Skippy Change your = to ==
18:16:13Fish-FaceZevv: it will spin without lookaheads
18:16:27Fish-Facethe lookaheads are to make use of PEGs' limited backtracking
18:16:30disruptekclyybber: it's pseudocode. ๐Ÿ˜
18:16:48FromDiscord<Clyybber> true, but you wouldn't ask how to pseudocode
18:16:54FromDiscord<Clyybber> or would you?
18:17:10disruptekyou know me too well.
18:17:25Fish-Facein the sense that if you force one option in a choice to fail, it backtracks and tries the next choice. If you have succeeded a choice and *then* fail, it will not backtrack to the beginning of the choice to try other options.
18:17:42Fish-Facethe lookaheads in the npeg thing might be wrong (the ones in the main file are correct though)
18:18:06Zevvok, cool, thanks
18:18:13ZevvI hope I can find the courage to get into this
18:18:29ZevvI'm tempted to answer "can you please provide a minimal reproducing example"
18:18:34Fish-Faceha
18:18:35Fish-Facehahahaha
18:19:06Fish-FaceI mean the alphabet literally has only two characters, how much more minimal do you want??
18:19:13disruptekone character.
18:25:46Zevvless rules would help :)
18:26:14FromDiscord<Clyybber> porting template heavy Cpp code is kinda satisfying
18:26:35FromDiscord<Clyybber> when the useless abstractions collapse that is
18:27:35Fish-FaceZevv: I know, I'm kidding :P
18:28:09Fish-Facebut yeah, the Lark parser I used in the python solution uses Earley, i.e. CFG semantics, not PEG.
18:29:30ForumUpdaterBotNew post on r/nim by NicholasKross: Sputnim - a SAT solver in Nim, see https://www.reddit.com/r/nim/comments/kl8lax/sputnim_a_sat_solver_in_nim/
18:29:51FromDiscord<Skippy> @Clyybber that example was pseudo code, is there a way of doing AND condition?
18:30:14FromDiscord<haxscramper> `if a == b and a <10:`
18:30:15FromDiscord<Clyybber> just do and :)
18:30:43FromDiscord<Skippy> @haxscramper thanks, for some reason it wasn't working before i was using &
18:30:45FromDiscord<haxscramper> Literally just that. Well, with `a < 10`
18:31:04FromDiscord<Skippy> the nim by example doesn't have an and example :S
18:32:46FromDiscord<Skippy> (edit) "and" => "and If statement"
18:39:52*superbia joined #nim
18:45:47*habamax joined #nim
18:51:52*saem joined #nim
18:51:55*saem waves
18:52:02Araqwb saem
18:52:03*krux02 quit (Remote host closed the connection)
18:52:25saemThanks, Araq.
18:59:57*Arrrrrrrr quit (Read error: Connection reset by peer)
19:02:46*Arrrrrrrr joined #nim
19:16:41saemJust skimmed Nimporter source and that feels like more than I'm willing to sign up for now. :D
19:17:09Araqyeah, we need you for nimsuggest and the VS plugin
19:17:44saemYup, I just want enough so I can inspect what's happening in nimsuggest.
19:18:05Araqwell it's in suggest.nim
19:18:15Araqbut you already know
19:20:23saemYeah, I've been poking at that. I'm trying to build a mental map so I can "be the code" as suggest does its thing and reading/bouncing through definitions hasn't built a good enough picture yet.
19:21:20saemI'm being impatient, it's not like this was written overnight so I can't really expect to get a strong understanding in a few hours.
19:21:42Araqwhat do you want to know?
19:23:56saemI'm in discovery mode so I don't have a concrete set of questions, just feelings of uncertainty and getting "stuck". The most concrete question I have right now is how the magic/builtin stuff gets tied together because that's something I can't use "go to definition" with.
19:24:55saemI thought I had stumbled upon it a while back, but I can't seem to retrace my steps.
19:25:07Araqthe definition of magic: "LengthArray"
19:25:17Araqis the enum value mLengthArray in the compiler
19:25:41Araqthere is nothing to "jump" to.
19:26:02Araqyou cannot jump to C's 'int' keyword either. nobody ever noticed.
19:26:40Araqmaybe I shouldn't have called it "magic", not much is really going on
19:27:24saemI did find that enum last night. I'm guessing to see all that implies I'd want to see the usages of any particular m* entry to see what implications it/how it's used, etc...?
19:27:38FromDiscord<Deleted User 5bd78114> Sorry to interrupt, but out of pure curiosity, are there `goto` statements in Nim? Preferably like `goto "labelName"`
19:27:52FromDiscord<Deleted User 5bd78114> Or maybe if there's a lib for it
19:28:01Araqyou can use 'break labelHere'
19:28:25Araqor use the "relooper" algorithm
19:28:50FromDiscord<Deleted User 5bd78114> Oh? I'm assuming this'll be in the docs, right?
19:29:04saemNeat question, is a labeled block another variant?
19:29:31Araq'break <label>' is documented, the relooper algorithm is "trivial" when you spent the last ten years writing compilers
19:32:18*tane joined #nim
19:32:51Araqsaem, seraching for m* works well but isn't all that interesting
19:33:07Araqbut sure, do it
19:33:36saemseems like procs with names getMagic, createMagic, etc... demystify it.
19:34:14*habamax quit (Ping timeout: 272 seconds)
19:34:51Araqit's a builtin. much like Nim's 'if' statement
19:35:21Araqthe 'if' statement doesn't have a single implementation, all the compiler passes need to understand and handle it
19:35:36Araqand the codegen needs to map it to a C 'if' statement.
19:37:51FromDiscord<Deleted User 5bd78114> sent a code paste, see https://play.nim-lang.org/#ix=2K1N
19:38:21Araqdon't use 'setjmp'
19:38:24FromDiscord<Deleted User 5bd78114> I'm assuming something like this night confuse the compiler?
19:38:35Araqyeah
19:38:43FromDiscord<Deleted User 5bd78114> Yeah, I figured
19:38:46FromDiscord<Deleted User 5bd78114> Thanks!
19:53:49saemWondering if this is in the right ballpark then, but for mArray at least, the sem pass converts that to tyArray, after which point transf, and whatever code gen handle what that means natively.
19:56:56Zevvdisruptek: where's tbloom.nim
19:57:11disruptekhttps://github.com/disruptek/bloom
19:57:38Zevvno tbloom.nim in there
19:57:43disruptektests/test.nim
19:57:56disruptekyou can rename it if you want it to be called `tbloom.nim`.
19:58:04Zevvyou said it was called tbloom.nim
19:58:15disruptekthat was /then/, big guy.
19:58:22Zevvtsss
19:58:23disrupteki'm tired of looking at red on my dashboard.
19:59:02Zevvall I get are green squares
20:00:07Zevvpff your stuff is broken, it just crashes for me
20:00:42disruptekare you on a windows machine?
20:01:00Zevvain't got none
20:01:02Zevvmingwing
20:02:05Zevvyeah funny, linux all is ok, valgrind thinks you're great too
20:02:09Zevvand mingw goes boom
20:02:30FromDiscord<Meowz> God I love nimpy. Awesome project.
20:03:23FromDiscord<Meowz> Once it will extract nim types to python classes its just perfect.
20:03:26disruptekzevv: did my testes break it again?
20:04:05Zevvi know nothing. I was just seeing if winedbg would bring soemthing new
20:04:36disruptekhmmph.
20:04:44Zevvstack overflow
20:04:47Zevvis what it sais
20:04:54Zevvcould it be so simple, not enough stack on windows?
20:05:21disruptekonly under arc?
20:06:00Zevvnim c -d:mingw --gc:arc --passL:"-Wl,--stack,4194304" tbloom.nim
20:06:01Zevvfixes it
20:06:23disruptekit's 8-9mb.
20:06:47disruptekthanks for debugging it.
20:06:57disruptekyou almost make me want to install mingw.
20:07:19Zevvapt-get install mingw
20:07:20Zevvis that hard?
20:07:42disruptekgentoo, and, no, it's not hard, it's a matter of principle.
20:07:52Zevvwhiner
20:08:30Zevvthe magic size is about 3250000, bored of bisecting now
20:09:13disrupteki guess this is a bug in my test and not really something nim should worry about.
20:16:45disrupteki'm such an idiot.
20:17:00disrupteki put the filter on the heap and not the data. ๐Ÿ™„
20:26:00disrupteki guess that doesn't solve it, either.
20:29:50FromDiscord<Deleted User 5bd78114> I sucks that choosenim don't work on arm-
20:30:08disruptek~gitnim
20:30:09disbotgitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek
20:35:22disruptekmratsim: # TODO: this require var foo: FooType = something which is not ergonomic ... no.
20:35:45disruptekwe are literally working around that requirement in that statement.
20:36:21disruptekor maybe someone else wrote that comment. ๐Ÿ˜€
20:38:01disrupteki dunno why you would remove all this code when it's enough to simply set the Mutant flag. i'm fairly certain Mutant will not work.
20:41:31FromGitter<bung87> `git nim` what does it means `nim` following `git` ?
20:41:44FromDiscord<Clyybber> @timotheecour I gotta ask; why do you wrap every snippet inside `when true:` ๐Ÿ˜ ?
20:43:10FromGitter<bung87> for future add conditions that dont touch indent ?
20:44:19FromDiscord<ElegantBeef> Its for making people ask the question
20:45:43*hnOsmium0001 joined #nim
20:46:32FromGitter<bung87> good one
20:47:25FromDiscord<shadow.> @ElegantBeef
20:47:28FromDiscord<shadow.> my nim is still poopooing
20:47:32FromDiscord<shadow.> how do i check hash lol
20:47:37FromDiscord<ElegantBeef> nim -v
20:47:42FromDiscord<shadow.> fbc8a40c7a351ff7c0f2dc0608bc8926f89d8537
20:47:53FromDiscord<ElegantBeef> I'm more recent
20:48:02FromDiscord<ElegantBeef> But still just try stable to see if it's not your pc
20:48:10FromDiscord<shadow.> i just did `choosenim update devel --latest` like 5 mins ago lmao
20:48:24FromDiscord<shadow.> wait a min `active boot switches: -d:release` what does that mean-
20:50:25FromDiscord<ElegantBeef> What it was built with
20:50:40FromDiscord<shadow.> choosenim?
20:50:44FromDiscord<shadow.> or do you mean something other than that
20:50:50FromDiscord<shadow.> ill try stable rq
20:50:59FromDiscord<shadow.> but my lovely scantuple...
20:51:39FromDiscord<ElegantBeef> I mean try stable to see if it works, if it still doesnt, question life
20:51:45FromDiscord<shadow.> same issue on stable
20:51:48FromDiscord<shadow.> life is being questioned
21:02:34*narimiran quit (Ping timeout: 260 seconds)
21:08:44ForumUpdaterBotNew thread by 19: Problem with sdl2 & nim, see https://forum.nim-lang.org/t/7298
21:16:59FromDiscord<Daniel> is kitlang some sort of a clone of nim?
21:19:54FromDiscord<ElegantBeef> Nope
21:22:28FromDiscord<Daniel> Why is NIM slower than C almost 9 times here?:โ†ตhttps://vlang.io/compilation_speed
21:24:09FromDiscord<Recruit_main707> nim's first compilation is always considerably slower
21:24:21FromDiscord<Recruit_main707> second and next ones are much faster
21:24:32FromDiscord<ElegantBeef> It's also many lines, and V isnt really to be trusted
21:24:39FromDiscord<ElegantBeef> It's a dumpster fire of a language
21:25:06FromDiscord<Recruit_main707> id like that program yeah, although, can v's compiler stay up for a month?
21:25:07FromDiscord<ElegantBeef> When the test is compilation of 200,000 echos
21:26:11FromDiscord<Daniel> I accidentally found that website by googling "nim vs zig", its interesting google thinks its important.
21:26:50FromDiscord<Daniel> https://media.discordapp.net/attachments/371759389889003532/792866104808701992/unknown.png
21:27:09FromDiscord<Recruit_main707> also, kinda sus nim and a few others dissapear in the second test
21:27:18FromDiscord<Recruit_main707> even v does
21:30:02FromDiscord<Quibono> @Daniel Way to mention a new programming language I have to look up.
21:34:01FromDiscord<ElegantBeef> Let's mention that V touted themselves as a GCless ARCless language which just leaked instead of worrying about memory
21:35:04FromGitter<timotheecour> > @Clyybber I gotta ask; why do you wrap every snippet inside when true: ๐Ÿ˜ ? โŽ โŽ allows having a single file with: โŽ โŽ ```when define case1: <snippet> โŽ when define case2: <snippet slightly modified> โŽ Etc...``` ... [https://gitter.im/nim-lang/Nim?at=5fe8fe0893af5216fc68140f]
21:36:03FromDiscord<myphs> What's up with that V? Isn't that a meme language that promised the world but delivered almost nothing and their main author was caught lying multiple times on HN?
21:36:14FromDiscord<ElegantBeef> Yea
21:36:40FromDiscord<ElegantBeef> Not saying Nim's compile time isnt slow, replicated their example and it's taking sometime to compile
21:37:06FromDiscord<ElegantBeef> But pretty shitty example imo
21:42:37disrupteki have a bad feeling about this.
21:43:15FromDiscord<ElegantBeef> Shit is this a starwars episode?
21:43:25FromDiscord<lqdev> remember that time when the supposed release date of V 1.0 was December 2019?
21:43:32FromDiscord<lqdev> holy shit they released 0.2 a couple days ago
21:43:47disruptekit must be june 2019.
21:43:52FromDiscord<lqdev> you know, that version that was promised to be ready in December 2019.
21:43:59FromDiscord<lqdev> wait a second
21:44:04disruptekwhich is weird, because it's snowing pretty heavy outside.
21:50:23FromGitter<timotheecour> > *<FromDiscord>* <Daniel> Why is NIM slower than C almost 9 times โŽ โŽ this benchmark is contrived, sure, but itโ€™s definitely useful (https://vlang.io/compilation_speed); I wrote a similar one in https://github.com/nim-lang/Nim/pull/14614 to test something different: whether modules add overhead (the answer was: no, very little); we should add a simila benchmark as the one from V, to test for
21:50:23FromGitter... super-linearity and avoid regressions in compile times
21:50:24disbotโžฅ add a benchmark (to run manually) to test compilation speed in several settings
21:52:59planetis[m]you know the thing about benchmarking, they just look for corner cases that they are faster at
21:53:12planetis[m]benchmarking is bs imo
21:53:52FromDiscord<ElegantBeef> Well general benchmarking isnt too bad, but why the hell are we making 400 000 lines of garbage which can be replaced with a for loop and calling it "benchmarking"
21:54:37FromDiscord<ElegantBeef> Benchmarking unrealistic situations is purposely unreallistic
21:55:02FromGitter<timotheecour> itโ€™s a proxy for generating a large program; what matters isnโ€™t the N=400k LOC, itโ€™s the curve as you increase N (and its nonlinearity)
21:59:15FromDiscord<ElegantBeef> I do wonder if there is any amount of purpose built code for this example for them
22:00:27FromDiscord<ElegantBeef> Just weird that they rely on a C compiler still, but somehow beat C
22:01:44FromDiscord<ElegantBeef> Based off this quote `> V compiles between โ‰ˆ80k (Clang backend) and โ‰ˆ1 million (x64 and tcc backends) lines of code per second per CPU core.` i think they use TCC for that benchmark but compare it to gcc
22:02:01FromDiscord<Recruit_main707> can you get the pragmas applied to typed object
22:05:14disruptekyes.
22:09:40FromDiscord<shadow.> `let (_, first, second, dist) = line.scanTuple "$w to $w = $i"`
22:09:42FromDiscord<shadow.> used scantuple again
22:09:42FromDiscord<ElegantBeef> Oh hey tcc took 22s to compile the 400 k loc macro
22:09:42FromDiscord<shadow.> lol
22:11:22FromDiscord<ElegantBeef> Nice, glad to hear someone likes it ๐Ÿ˜„
22:17:16*disruptek throbs.
22:19:39FromDiscord<ElegantBeef> Disruptek you really need to get health insurance to get that throbbing checked out
22:20:31disruptekthere's something wet and i'm afraid to check to see if it's pus. doesn't seem to be blood.
22:25:27*clyybber joined #nim
22:26:39FromDiscord<Deleted User 5bd78114> What's TCC?
22:26:59FromGitter<timotheecour> tiny c compiler
22:27:17FromDiscord<ElegantBeef> tiny c compiler, compiles faster than GCC but with less optimized code
22:27:52FromDiscord<Deleted User 5bd78114> Oh
22:28:03qwrit is single-pass, so yes, only peep-hole optimizations afaik
22:28:14FromDiscord<Deleted User 5bd78114> Nice
22:28:23disruptekyeah, it's pretty kinky.
22:29:48*Arrrrrrrr quit (Remote host closed the connection)
22:34:01FromDiscord<Deleted User 5bd78114> Are there any compilers that produce faster binaries then gcc?
22:35:31mipriclang in some cases. icc in some cases. non-C compilers probably. especially in some cases. gcc also loses to past iterations. in some cases.
22:36:45FromDiscord<Deleted User 5bd78114> Huh
22:37:12FromDiscord<Deleted User 5bd78114> Also, what is LLVM code used for? I don't quite understand it exactly
22:37:22FromDiscord<Deleted User 5bd78114> I know Clang emits LLVM
22:37:39FromDiscord<Deleted User 5bd78114> (edit) "Also, what is ... LLVM" added "code compiled with" | removed "code"
22:37:42mipriclang uses LLVM. clang emits the same shit gcc does.
22:38:06FromDiscord<Deleted User 5bd78114> So then why does llvm matter?
22:38:12FromDiscord<ElegantBeef> LLVM is a backend similar to what Nim uses C for
22:38:27FromDiscord<ElegantBeef> It gives you a compilation method for all the platforms llvm supports
22:38:35mipriit's different, so it manages to be better in some cases.
22:39:43FromDiscord<Deleted User 5bd78114> Oh? That's cool!
22:40:50miprithe big selling point of both compilers is not how fast their binaries are. The big selling point of gcc is that it's open source, widely ported, adapted to compile a bunch of languages, works well with useful tooling like gdb. The big selling point of LLVM is that its intermediate representation for code is very easy to write compilers against, which is why Rust, Zig, et al. use it.
22:42:37*zielmicha__ quit (Ping timeout: 260 seconds)
22:42:52FromDiscord<ElegantBeef> Using gcc pretty much lets you go wherever C is with the exception of a few cases, from desktop to embedded with relative ease
22:43:08FromDiscord<ElegantBeef> LLVM is a bit more of a hassle for embedded as i hear it
22:43:47*waleee-cl quit (Ping timeout: 260 seconds)
22:43:47*kinkinkijkin quit (Ping timeout: 260 seconds)
22:44:56*zielmicha__ joined #nim
22:44:59*waleee-cl joined #nim
22:45:03*kinkinkijkin joined #nim
22:46:46FromDiscord<mratsim> @zevv, @disruptek, it's aaaaaalliiiiivvveeeeeee!!! https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex03_echoing_truths.nim
22:46:59FromDiscord<mratsim> It's super hacky underneath but who cares.
22:47:56FromDiscord<mratsim> Highlights: the new syntax proposal where people don't need to declare their continuation type. Scheduler integration, mutant, also type erasure with flexible to use stack object
22:48:35FromDiscord<mratsim> only unknown I have is if casting a "ref object" to "ref object of RootObj" is safe.
22:48:46FromDiscord<mratsim> so i don't use it right now but it would be useful to know
22:49:24*superbia quit (Quit: WeeChat 3.0)
22:55:45FromDiscord<mratsim> @Deleted User 5bd78114 there is a goto with label hidden behind the {.goto.} pragma and labels must be enums
22:56:47Zevvso mratsim
22:56:49Zevvwhat did you do
22:57:14Zevvthat we didn't do already
22:57:36Zevvquite a lot
22:58:44miprihttps://play.nim-lang.org/#ix=2K2N - I wouldn't think it's safe since there has to be extra runtime information
22:58:59FromDiscord<lqdev> @mratsim โ†ต> # how to enforce moves?โ†ตmaybe try marking the continuation's `=copy` with {.error.}
22:59:07miprioutput: 1 8
22:59:07FromDiscord<mratsim> I monkey patched here and there around the codebase
22:59:12FromDiscord<lqdev> idk how it works under the hood tho and how feasible it is
22:59:20FromDiscord<mratsim> doesn't work with concepts
22:59:36FromDiscord<mratsim> @lqdev
22:59:41FromDiscord<lqdev> ah
22:59:50FromDiscord<mratsim> having internet only on poor 3G is hell :/
23:00:33Zevvmratsim: i was just about to brush my teeth
23:00:39Zevvwill dive in tomorrow!
23:01:10FromDiscord<Deleted User 5bd78114> Oh, thanks! Could I have a simple example of how it works? Since I've never seen it before and I also don't know what an enum is-
23:01:59miprihttps://nim-lang.org/docs/manual.html#types-enumeration-types
23:02:00*krux02 joined #nim
23:02:01FromDiscord<lqdev> how did you miss enums :p
23:03:55FromDiscord<Deleted User 5bd78114> Thanks :p
23:05:10FromDiscord<mratsim> the goto is undocumented though
23:05:22FromDiscord<mratsim> there is a post of Jehan in the forum that shows it
23:05:33FromDiscord<mratsim> and Synthesis use it extensively for state machines
23:05:39FromDiscord<mratsim> !repo synthesis
23:05:39disbothttps://github.com/mratsim/Synthesis -- 9Synthesis: 11Synthesis is a compiletime, procedure-based, low-overhead, no-allocation, state-machine generator optimized for communicating processes and threads 15 61โญ 3๐Ÿด 7& 1 more...
23:06:18FromDiscord<mratsim> look into the "synthesis" proc. You can use "expandMacros" on the example to see the codegen
23:09:52FromDiscord<Deleted User 5bd78114> Thanks!
23:32:32FromDiscord<Deleted User 5bd78114> Is it possible to make Nim execute raw binary data?
23:32:47disruptekof course.
23:33:39FromDiscord<Deleted User 5bd78114> Oh? How would I go about doing it? I preferably don't want the file to be written to a location on the harddrive
23:34:02FromDiscord<Deleted User 5bd78114> Maybe writing it to /tmp and using that
23:34:28FromDiscord<Deleted User 5bd78114> (edit) "Oh? How would I go about doing it? I preferably don't want the file to be written to a ... location(No" added "permanent" | "permanentlocation on the harddrive ... " added "(No creating them manually deleting after :p)"
23:34:43FromDiscord<ElegantBeef> memfiles exists
23:34:46FromDiscord<mratsim> you can interpret data as code.
23:35:39FromDiscord<mratsim> look into photo-jit, you need to manipulate memprotect
23:35:50mipriI get it that Deleted User asked about executing shellcode in Nim, but it was immediately followed up with "narrator: Deleted User is probably looking for 'nim r'"
23:35:54FromDiscord<mratsim> !repo photon-jit
23:35:55disbothttps://github.com/mratsim/photon-jit -- 9photon-jit: 11A low-overhead JIT assembler for Nim 15 13โญ 0๐Ÿด
23:35:57FromDiscord<Deleted User 5bd78114> Oh, okay, thanks!
23:36:21FromDiscord<Deleted User 5bd78114> What's nim r?
23:36:48mipriit's like nim c -r, but without dropping the binary in the current directory.
23:37:43mipriit's written to an appropriate cache directory, and reused if the source hasn't changed.
23:39:10FromDiscord<ElegantBeef> Knowing nisha what they're asking about is if one could implement a JVM in Nim
23:39:20disruptekof course.
23:39:23FromDiscord<Deleted User 5bd78114> I'm wanting to do this with any binary
23:39:26FromDiscord<Deleted User 5bd78114> XD
23:39:50FromDiscord<ElegantBeef> what do you mean "any binary" if i give you an image you want to run it?
23:40:07*lordofgibbons joined #nim
23:41:13FromDiscord<Deleted User 5bd78114> Well, let's say I have the `gcc` binary stored in some json data because I'm fucking insane, and I wanna execute it via Nim from that json file, that's how I want to do it
23:41:25FromDiscord<Deleted User 5bd78114> (edit) "how" => "what" | removed "it"
23:42:30mipriand you're wanting to do this while being aware that there's no universal 'gcc' binary that works on all systems?
23:43:28FromDiscord<Deleted User 5bd78114> Yup
23:43:45FromDiscord<Deleted User 5bd78114> I warned you I'm insane-
23:45:22*lordofgibbons is now known as hypergibbon
23:47:34FromDiscord<Deleted User 5bd78114> Now I'm wondering if the amd64 binary and arm32 binary of gcc share even a few similar instructions-
23:47:45disrupteknope, they are /all/ new.
23:47:50*tane quit (Quit: Leaving)
23:48:02FromDiscord<Deleted User 5bd78114> Makes sense
23:48:26FromDiscord<Deleted User 5bd78114> How about 86 and 64 bit PCs?
23:48:42disrupteki've never seen an 86bit pc.
23:49:18FromDiscord<mratsim> floating point is 87 bit originally
23:50:54Zevvbaaad refactoring mratsim
23:51:04Zevvyou threw out all our commits, now all the code is yours :)
23:51:19ZevvI hoped that at least a *few* of my lines would survive all this \o/
23:53:35FromDiscord<mratsim> what? I only threw mutant, well non-mutant
23:53:35FromDiscord<mratsim> the rest is moved and monkey patched
23:53:50Zevvnah just whining. I blamed core/transform.nim
23:53:53FromDiscord<mratsim> someone told me "go nut" also ๐Ÿ˜‰
23:54:09Zevvby all means, please do! :)
23:54:26*hypergibbon quit (Remote host closed the connection)
23:54:27FromDiscord<sealmove> Guys, I am looking for a human readable serialization format for arbitrary Nim data. I tried every json implementation I found. stdlib's json, eminim, json, they all fail with compile error for my data. `marshal` module did work, but that's not intended for human readability and it does not write the names of named tuples which in my case is important. NimYAML does dump the data correctly but fails to parse them back to my type.
23:54:37FromDiscord<mratsim> for now I only put things on top of the core and tried not too have to change the internals
23:54:40FromDiscord<sealmove> jason
23:54:58Zevvmratsim: core transform is also a bit hairy to jump in I guess
23:55:12ZevvI just ran your truth \o/
23:55:20disruptekjason fails to serialize data?
23:55:21Zevvsealmove: did you try jason?
23:55:41FromDiscord<sealmove> yes, it doesn't compile either :|
23:55:48disruptekblame the compiler.
23:55:54disruptekuse 1.4 compiler instead.
23:56:13disruptekit's a recent regression.
23:56:29FromDiscord<sealmove> I am using 1.4.2
23:56:44disruptekcan i have a repro?
23:56:52FromDiscord<sealmove> I'll try
23:57:10FromDiscord<sealmove> thanks