00:01:18 | * | Q-Master quit (Ping timeout: 272 seconds) |
00:15:45 | FromDiscord | <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:58 | FromDiscord | <ElegantBeef> Yep, the code |
00:16:08 | FromDiscord | <ElegantBeef> Hard to tell what you're missing with a question alone ๐ |
00:16:23 | disruptek | i'm pretty sure it's between the ears. |
00:16:37 | FromDiscord | <ElegantBeef> I dont have any corn |
00:19:13 | FromDiscord | <ElegantBeef> If you're pasting the macro `.repr` it will often work even with a bad nim node tree |
00:19:52 | FromDiscord | <ElegantBeef> Use `dumptree` with and `treeRepr` of the result to compare the two |
00:21:59 | FromDiscord | <Recruit_main707> i dont print it, its the error msg itself |
00:22:00 | FromDiscord | <Recruit_main707> https://play.nim-lang.org/#ix=2JFh |
00:22:11 | * | tane quit (Quit: Leaving) |
00:22:54 | FromDiscord | <ElegantBeef> you're invoking fields? |
00:24:26 | FromDiscord | <Recruit_main707> no, they are getters |
00:24:31 | FromDiscord | <Recruit_main707> defined somewhere else |
00:25:28 | FromDiscord | <ElegantBeef> Compare the debug output of this https://play.nim-lang.org/#ix=2JFjโตwith https://play.nim-lang.org/#ix=2JFk |
00:26:37 | FromDiscord | <ElegantBeef> Illformed AST just means you're missing some nodes somewhere |
00:28:38 | FromDiscord | <ElegantBeef> Looks like it's the `varTy` one uses a dot expr the other uses an ident |
00:29:30 | FromDiscord | <ElegantBeef> @Recruit_main707 https://media.discordapp.net/attachments/371759389889003532/792549677505183764/unknown.png |
00:34:24 | FromDiscord | <ElegantBeef> Nothing else is glaringly wrong, so good luck ๐ |
00:37:57 | FromDiscord | <Cohjellah> hey guys can I just put spawn in front of a proc call to put it on a seperate thread?/ |
00:38:49 | FromDiscord | <Cohjellah> or do I have to do some channel shenanigans |
00:38:58 | * | mbomba joined #nim |
00:39:30 | FromDiscord | <Recruit_main707> @ElegantBeef i changed that and now the ast is the same, still get the error though, thanks for trying though |
00:40:22 | FromDiscord | <ElegantBeef> Afaik spawn creates a new thread in the threadpool |
00:40:35 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn |
00:40:57 | FromDiscord | <Cohjellah> yeaaaahh |
00:41:00 | FromDiscord | <Cohjellah> hmm |
00:49:51 | saem | @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:39 | saem | The 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:22 | FromDiscord | <Recruit_main707> how can i overcome this |
00:56:08 | * | mbomba quit (Quit: WeeChat 3.0) |
00:57:00 | saem | I'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:19 | saem | Wait... 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:24 | FromDiscord | <Recruit_main707> Pc turned off automatically, I really need to disable that shit, Iโll try it tomorrow, why though. |
01:05:05 | saem | It has the occasional edge case but walk up the nodes, get to the module and put in a top level proc declaration. |
01:30:06 | Fish-Face | I caved on day 19 and wrote a solution in python |
01:30:50 | FromDiscord | <ElegantBeef> I stopped forcing myself to do them around the 11th |
01:30:59 | FromDiscord | <ElegantBeef> They just got too much like work and less fun |
01:31:10 | FromDiscord | <ElegantBeef> Although i still love my day 18 solutiion ๐ |
01:36:10 | Fish-Face | I still want to do 25 so I have to finish the horrible ones |
01:37:08 | Fish-Face | 19.2 is just annoying because of the lack of good CFG libraries |
01:37:51 | Fish-Face | in 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:47 | Fish-Face | I 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:53 | FromDiscord | <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:06 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2JFT |
02:48:07 | FromDiscord | <ElegantBeef> are you using `-d:release`? |
02:48:10 | FromDiscord | <shadow.> nope |
02:48:27 | FromDiscord | <ElegantBeef> Are you surrrre? |
02:48:30 | FromDiscord | <shadow.> yep |
02:48:38 | FromDiscord | <shadow.> i did -d:debug still same thing |
02:48:51 | FromDiscord | <shadow.> tho it should be debug by default, now? |
02:49:00 | FromDiscord | <ElegantBeef> It is debug by default |
02:49:00 | FromDiscord | <shadow.> (edit) "now?" => "right?" |
02:49:01 | FromDiscord | <shadow.> yeah |
02:49:02 | FromDiscord | <shadow.> hmm |
02:49:12 | FromDiscord | <ElegantBeef> Give the entire output from the terminal |
02:49:41 | FromDiscord | <shadow.> the 400410 is from a previous function call |
02:49:41 | FromDiscord | <shadow.> sent a code paste, see https://paste.rs/FXJ |
02:49:45 | FromDiscord | <shadow.> which executes fine |
02:49:57 | FromDiscord | <shadow.> (edit) |
02:51:15 | FromDiscord | <ElegantBeef> Going to try it here, can i get the entire file? |
02:51:34 | FromDiscord | <shadow.> sure thing |
02:51:39 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/792585458307039252/day6.nim |
02:51:40 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/792585460526088212/input.txt |
02:52:40 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/792585705166864434/unknown.png |
02:52:45 | FromDiscord | <ElegantBeef> Your pc is poopoo |
02:53:13 | FromDiscord | <shadow.> wtfff |
02:53:20 | FromDiscord | <shadow.> maybe windows just bad? |
02:53:41 | FromDiscord | <ElegantBeef> Ew you're manually parsing the data ๐ฆ |
02:54:12 | FromDiscord | <ElegantBeef> ah it's a different year eh? |
02:57:36 | FromDiscord | <shadow.> yeahhh |
02:57:37 | FromDiscord | <shadow.> 2015 |
02:57:41 | FromDiscord | <shadow.> id normally use npeg dw |
02:57:46 | FromDiscord | <shadow.> but me and my friend were racing |
02:57:48 | FromDiscord | <shadow.> and i had to go speedf |
02:57:49 | FromDiscord | <shadow.> (edit) "speedf" => "speed" |
02:57:59 | FromDiscord | <shadow.> i also couldn't figure how to use strscans on it |
03:00:22 | FromDiscord | <shadow.> i wonder why my pc poopooed tho |
03:05:06 | FromDiscord | <shadow.> im on windows 10 devel 1.5.1 |
03:05:29 | FromDiscord | <ElegantBeef> well you'd have `"turn on $i,$i through $i,$i"` and `"toggle $i,$i, through $i,$i"` |
03:05:37 | FromDiscord | <ElegantBeef> and i guess off |
03:05:55 | FromDiscord | <shadow.> yeah i just didn't know how to get the cmd with it |
03:06:06 | FromDiscord | <shadow.> ig that could be done manually |
03:06:11 | FromDiscord | <ElegantBeef> If it passes parsing it's that one |
03:06:17 | FromDiscord | <ElegantBeef> what hash? |
03:06:24 | FromDiscord | <ElegantBeef> i'm on 5a5844 and it works |
03:06:33 | FromDiscord | <shadow.> ah just got off pc i cant check |
03:06:49 | FromDiscord | <shadow.> just surprised bc its normal enough code lol |
03:07:01 | FromDiscord | <ElegantBeef> Well something is wrong somewhere |
03:07:06 | FromDiscord | <shadow.> fair |
03:07:20 | FromDiscord | <shadow.> btw nice job on scantuple that shit is a breeze to use |
03:07:54 | FromDiscord | <ElegantBeef> Thanks, i really like it, 4raqs suggestion was so much better than the var injection |
03:08:14 | FromDiscord | <shadow.> what'd he suggest? |
03:08:18 | FromDiscord | <ElegantBeef> The tuple |
03:08:27 | FromDiscord | <ElegantBeef> Originally i just injected `var idents` |
03:08:44 | FromDiscord | <ElegantBeef> So even if it failed they were still there |
03:09:20 | FromDiscord | <ElegantBeef> it was supposed to be used like `whenScanF(line, pattern, seconds, minutes, days): body` |
03:09:46 | FromDiscord | <ElegantBeef> that'd declare seconds, minutes and days as variables inside that body's scope |
03:11:00 | FromDiscord | <ElegantBeef> This was the first pass https://play.nim-lang.org/#ix=2JG1 |
03:24:23 | FromDiscord | <Cohjellah> Hey guys, running into this compilation error: |
03:24:32 | FromDiscord | <Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix= |
03:25:28 | FromDiscord | <Cohjellah> Is there a way to just not change my code and still get around this by using different methods within threadpool? |
03:27:15 | FromDiscord | <Cohjellah> nvm there are some good docs out there. It's surrounding my use of global variables |
03:33:02 | FromDiscord | <ElegantBeef> Still reimplementing that chat client? |
03:35:59 | giaco | is it possible to help the compiler infer the type of "left" and "right" here? https://play.nim-lang.org/ |
03:36:01 | giaco | uups |
03:36:24 | giaco | https://play.nim-lang.org/#ix=2JG8 |
03:37:11 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2JG9 |
03:37:29 | FromDiscord | <Cohjellah> Yep |
03:37:35 | FromDiscord | <ElegantBeef> Although the left/right is same as the parent, so it's kinda redundant |
03:37:35 | FromDiscord | <Cohjellah> Long process |
03:37:40 | FromDiscord | <ElegantBeef> Unless you just dont want them to be nil |
03:39:22 | giaco | thanks for the solution. How would you check for non-nill? |
03:39:49 | disruptek | isNil() |
03:40:04 | FromDiscord | <ElegantBeef> Isnt there `not nil` if the sole intent is to just avoid nils? |
03:40:16 | disruptek | yes, but.. |
03:40:20 | disruptek | ~disrupstyle |
03:40:21 | disbot | disrupstyle: 11tips for writing code that won't provoke ๐ rants ๐คฌ on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek |
03:40:24 | disruptek | isNil is preferred. |
03:40:45 | disruptek | not nil support is incomplete. |
03:40:51 | FromDiscord | <ElegantBeef> No i meant the experimental feature |
03:41:01 | FromDiscord | <ElegantBeef> This schtuff https://nim-lang.org/docs/manual_experimental.html#not-nil-annotation |
03:41:07 | disruptek | not nil support is incomplete. |
03:41:31 | FromDiscord | <ElegantBeef> Ah |
03:41:39 | disruptek | hopefully 1.6. |
03:42:19 | giaco | lol sorry D |
03:42:21 | giaco | :D |
03:42:29 | FromDiscord | <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:33 | FromDiscord | <Cohjellah> and there's no thread safe issues |
03:43:25 | FromDiscord | <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:34 | FromDiscord | <Cohjellah> HMM big think |
03:44:24 | FromDiscord | <Cohjellah> I guess to surmise my question, how do I pass variables from one thread to another? |
03:45:09 | FromDiscord | <ElegantBeef> Very carefully |
03:45:13 | FromDiscord | <Cohjellah> HAHA |
03:45:16 | FromDiscord | <Cohjellah> I think I'm looking for channels? |
03:45:22 | FromDiscord | <ElegantBeef> Quite possibly |
03:46:20 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:47:06 | disruptek | pre-1.4 you use channels, 1.4+ i would just use isolate. |
03:47:10 | FromDiscord | <Cohjellah> Nim, the language of mystery |
03:47:13 | FromDiscord | <Cohjellah> isolate? |
03:47:19 | disruptek | !rfc isolate |
03:47:20 | disbot | https://github.com/nim-lang/RFCs/issues/244 -- 3'isolated' data for Nim 7& 2 more... |
03:47:32 | FromDiscord | <Cohjellah> oh my god there's a command to search the lang? |
03:47:33 | FromDiscord | <Cohjellah> Hot |
03:47:50 | disruptek | no, it's just a bot. |
03:48:02 | FromDiscord | <Cohjellah> yes, which searches the language... |
03:48:04 | disruptek | but that reminds me, i need to work on ndoc. |
03:48:27 | FromDiscord | <Cohjellah> man all these [T]'s everywhere |
03:48:32 | giaco | I 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:37 | disruptek | some tips on how to use the bot, for discord people: |
03:48:38 | FromDiscord | <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:39 | FromDiscord | <ElegantBeef> Generics are for generic situations |
03:48:40 | disruptek | ~notes |
03:48:40 | disbot | notes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek |
03:49:01 | FromDiscord | <Cohjellah> Yeah people just always throw them in examples and it always throws me off because I come from Python |
03:49:31 | FromDiscord | <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:22 | FromDiscord | <Cohjellah> lol |
03:51:08 | disruptek | TObj is conventionally an object while PObj is conventionally a ref TObj. |
03:51:31 | FromDiscord | <ElegantBeef> Yea the convention about that is rather muddy though |
03:51:38 | FromDiscord | <Cohjellah> oh man all this is flying past me at mach speed |
03:51:57 | FromDiscord | <Cohjellah> Should have started with C not Python aha |
03:52:01 | FromDiscord | <ElegantBeef> Nim has reference types and value types, there are naming conventions for when both exist |
03:52:21 | FromDiscord | <ElegantBeef> Value types behave like primitives, where as reference types like python classes |
03:52:31 | disruptek | it'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:12 | FromDiscord | <Cohjellah> Okay, so looking at this isolate thing I should go with this? |
03:56:18 | FromDiscord | <ElegantBeef> Not a clue |
03:56:34 | FromDiscord | <Cohjellah> ahaha excellet |
03:56:40 | FromDiscord | <Cohjellah> (edit) "excellet" => "excellent" |
03:56:43 | FromDiscord | <Cohjellah> I'll just look at channels |
03:57:22 | * | muffindrake quit (Ping timeout: 260 seconds) |
03:57:42 | FromDiscord | <ElegantBeef> i honestly dont really know why you need channels here |
03:57:52 | FromDiscord | <ElegantBeef> Can i see your code? |
03:57:55 | FromDiscord | <Cohjellah> yeah, okay I just really need to ping the threaded proc |
03:57:56 | FromDiscord | <Cohjellah> here |
03:58:25 | FromDiscord | <Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=2JGc |
03:58:48 | FromDiscord | <Cohjellah> Proc connect will receive a message and I need it to work nicely with lineWriter |
03:58:53 | FromDiscord | <ElegantBeef> Yea this is... silly |
03:58:57 | FromDiscord | <Cohjellah> ๐ฎ |
03:59:04 | FromDiscord | <Cohjellah> Most likely |
03:59:27 | * | muffindrake joined #nim |
03:59:31 | FromDiscord | <ElegantBeef> Actually, nvm forgot how this worked ๐ |
04:00:00 | FromDiscord | <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:07 | FromDiscord | <Cohjellah> so it just screws up your messaging |
04:00:38 | FromDiscord | <ElegantBeef> also you shared your ip ๐ |
04:00:38 | FromDiscord | <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:42 | FromDiscord | <Cohjellah> not my IP |
04:00:46 | FromDiscord | <Cohjellah> but yeah oops |
04:01:11 | FromDiscord | <Cohjellah> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2JGf |
04:01:55 | FromDiscord | <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:12 | FromDiscord | <Cohjellah> I say method in the general sense |
04:03:05 | FromDiscord | <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:32 | giaco | thanks! |
04:03:34 | FromDiscord | <ElegantBeef> Although probably not wise performance wise and a pretty off solution |
04:04:15 | FromDiscord | <Cohjellah> but before the user presses enter, it'll be in the lineWriter proc |
04:04:29 | FromDiscord | <Cohjellah> so if a message was received, it'll just perform the same way it dod before |
04:04:56 | FromDiscord | <Cohjellah> by deleting the message the user was currently writing |
04:05:03 | FromDiscord | <ElegantBeef> No |
04:05:15 | FromDiscord | <ElegantBeef> Cause you have the input captured |
04:05:24 | giaco | should 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:33 | FromDiscord | <Cohjellah> oh |
04:05:35 | FromDiscord | <Cohjellah> hold up |
04:06:30 | FromDiscord | <ElegantBeef> well if you have parallelised logic and need it to be faster consider threads, atleast that's i think the consensus |
04:06:48 | FromDiscord | <Cohjellah> INTERESTING |
04:06:53 | FromDiscord | <ElegantBeef> I really should wait for someone that knows how to thread talk ๐ |
04:06:56 | FromDiscord | <Cohjellah> So, it works but makes a ton of blank space |
04:07:37 | FromDiscord | <Cohjellah> hol' up |
04:09:56 | FromDiscord | <Cohjellah> so it works, but it has visual bugs hahaha |
04:10:09 | FromDiscord | <ElegantBeef> What's the visual bug? |
04:10:41 | FromDiscord | <Cohjellah> user A is typing "hello", user B sends a message to A,โตuser A's terminal input now looks like this " " |
04:10:51 | FromDiscord | <Cohjellah> but the blank space is still hello if you press enter |
04:10:57 | FromDiscord | <Cohjellah> it'll still send hello to user B |
04:11:01 | FromDiscord | <ElegantBeef> Did you reprint the input? |
04:11:21 | FromDiscord | <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:28 | FromDiscord | <Cohjellah> hence why I wanted to use channels or something to make them communicate |
04:12:42 | FromDiscord | <ElegantBeef> Yea idk, i still think this can be easily handled just using flowvars of `char` on the spawned proc |
04:12:58 | FromDiscord | <Cohjellah> so instead of a procedure just use spawn on the flowvar? |
04:13:00 | FromDiscord | <Cohjellah> of char |
04:13:08 | FromDiscord | <ElegantBeef> well instead of returning a string, return a `char` |
04:13:14 | FromDiscord | <Cohjellah> interesting |
04:13:14 | FromDiscord | <ElegantBeef> then move your logic into your main thread |
04:13:30 | FromDiscord | <ElegantBeef> your thread proc just becomes `getCh` |
04:13:33 | FromDiscord | <Cohjellah> I tried something similar before but heck it was laggy |
04:13:40 | FromDiscord | <Cohjellah> ah yeah that's what I initially did |
04:13:56 | FromDiscord | <ElegantBeef> yea i imagined as such |
04:14:09 | FromDiscord | <Cohjellah> every character you hit, polling would start |
04:14:16 | FromDiscord | <ElegantBeef> Wait what? |
04:14:26 | FromDiscord | <Cohjellah> like I would spam the A key and there would be massive delays |
04:15:26 | FromDiscord | <ElegantBeef> I'll brb then i'll see something |
04:16:42 | FromDiscord | <Cohjellah> ok pls |
04:16:52 | FromDiscord | <Cohjellah> it also wasn't thread safe |
04:17:25 | FromDiscord | <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:48 | disruptek | no, don't do that. |
04:18:50 | FromDiscord | <Cohjellah> learnt that the hard way hey |
04:20:07 | disruptek | just spawn a thread to loop on getch. after it gets a key, it operates a lock and adds it to a queue. |
04:20:32 | disruptek | your original thread can just check the queue to get the input. |
04:22:33 | FromDiscord | <Cohjellah> HMMM |
04:22:51 | disruptek | !last hmmm |
04:22:52 | disbot | hmmm quit 716 hours ago and last spoke 17 hours ago |
04:24:12 | FromDiscord | <Cohjellah> So when you say spawn a thread to loop on getch |
04:24:20 | FromDiscord | <Cohjellah> can you spawn a thread on a loop or are you talking about using a proc? |
04:24:34 | disruptek | you spawn a thread for a {.thread.} proc. |
04:24:42 | disruptek | the body of the proc is a loop on getch. |
04:25:10 | disruptek | following the getch, it does a `withLock myLock: queue.add ch` |
04:25:16 | disruptek | that's it. |
04:25:45 | FromDiscord | <Cohjellah> so pretty much what I did above but add {.thread.} to the end of it and use a queue |
04:26:21 | disruptek | "queue" is some sort of data structure. it can be anything that can hold more than one ch. |
04:26:28 | FromDiscord | <Cohjellah> yep |
04:26:35 | FromDiscord | <Cohjellah> so I've used queue's before in Python with multiprocessing |
04:26:48 | disruptek | i dunno what you did above. i try not to read other people's code; it just makes me angry. |
04:26:52 | FromDiscord | <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:53 | disruptek | bad for my blood pressure. |
04:27:09 | FromDiscord | <Cohjellah> then erase line and re-write the queue to the input line in the terminal |
04:27:37 | FromDiscord | <Cohjellah> is queue a keyword or a made up word there |
04:27:45 | FromDiscord | <Cohjellah> made up being variable haha |
04:27:46 | disruptek | it's made up. |
04:28:14 | disruptek | a string would be a good choice. |
04:28:19 | FromDiscord | <Cohjellah> what exactly is that called? Just thread locking? I want to read more on it |
04:28:42 | disruptek | yes, locks. threads. |
04:29:14 | FromDiscord | <Cohjellah> Cheers! |
04:29:29 | disruptek | have fun and stay out of structure. |
04:30:35 | FromDiscord | <Cohjellah> hahaha okay I do have more questions, of course |
04:30:45 | disruptek | that's what beef's here for. |
04:30:54 | FromDiscord | <Cohjellah> Hahahaha |
04:31:05 | FromDiscord | <Cohjellah> I just want to know how do I access that variable outside of the thread proc |
04:31:18 | disruptek | using a lock. |
04:32:03 | FromDiscord | <Cohjellah> errrrrrrh |
04:32:10 | FromDiscord | <Cohjellah> I'll have a play. so withLock is the keyword |
04:32:15 | FromDiscord | <Cohjellah> and myLock is another variable? |
04:32:16 | disruptek | yes. |
04:32:20 | disruptek | yes. |
04:32:36 | FromDiscord | <Cohjellah> so myLock as the variable is the queue, and you're passing it the queue variable |
04:32:47 | FromDiscord | <Cohjellah> so you can just store stuff in it, or am I mistake |
04:32:49 | FromDiscord | <Cohjellah> mistaken |
04:32:58 | disruptek | myLock is a variable holding a lock. |
04:33:01 | disruptek | queue is a string. |
04:33:10 | disruptek | you'll define those before spawning the thread. |
04:33:12 | FromDiscord | <ElegantBeef> Locks prevent threads from read/writing to variables at the same time from multiple threads |
04:33:41 | disruptek | locks need to be init'd and deinit'd, too. |
04:34:41 | FromDiscord | <Cohjellah> ok |
04:34:44 | FromDiscord | <Cohjellah> I'll have a go |
04:34:50 | FromDiscord | <ElegantBeef> Nah use nim |
04:35:25 | FromDiscord | <Cohjellah> of course ๐ |
04:35:37 | FromDiscord | <Cohjellah> Nim makes learning these concepts a lot easier |
04:35:42 | FromDiscord | <Cohjellah> for me at least |
04:35:45 | FromDiscord | <Rika> did you get his joke |
04:35:50 | disruptek | no. |
04:36:05 | FromDiscord | <ElegantBeef> Well rika explain it for the back of the class |
04:36:37 | FromDiscord | <Cohjellah> golang is for nerds |
04:37:07 | FromDiscord | <Rika> you calling us nimions dumb or what |
04:37:55 | disruptek | you're pretty much the epitome of `nimpleton`. |
04:38:05 | FromDiscord | <Rika> lmao |
04:38:31 | FromDiscord | <ElegantBeef> Yea well... you're a nimrod |
04:38:46 | disruptek | nimlet. |
04:38:49 | FromDiscord | <Cohjellah> Nimpleton lmao |
04:39:04 | FromDiscord | <ElegantBeef> Add that to your CV to get the job everytime |
04:39:19 | FromDiscord | <Cohjellah> Fellow Nimpleton would look great on the CV |
04:39:33 | FromDiscord | <Cohjellah> feeling like a Nimpleton though rn trying to initialise a lock lmao |
04:39:41 | FromDiscord | <Rika> nimwit |
04:39:55 | Prestige | Nice |
04:40:08 | FromDiscord | <Cohjellah> Any good examples of lock out in the wild |
04:40:13 | FromDiscord | <ElegantBeef> The threads doc |
04:40:15 | FromDiscord | <Rika> a ot |
04:40:15 | FromDiscord | <Cohjellah> so I can study the ancient texts |
04:40:16 | FromDiscord | <Rika> lot |
04:40:19 | FromDiscord | <Cohjellah> I'm looking at it |
04:40:24 | FromDiscord | <Cohjellah> it's in the lock module though? |
04:40:31 | FromDiscord | <ElegantBeef> Yea |
04:41:02 | FromDiscord | <Cohjellah> the docs generally just show the procs and templates but no examples |
04:41:07 | FromDiscord | <Cohjellah> HMM |
04:41:10 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/threads.html#examples |
04:41:34 | FromDiscord | <ElegantBeef> Locks arent useful on their own, without threading |
04:41:55 | FromDiscord | <Cohjellah> right so the lock examples are in the threading docs |
04:41:58 | FromDiscord | <Cohjellah> ty |
04:42:02 | disruptek | !rfc cps steps |
04:42:02 | disbot | https://github.com/nim-lang/RFCs/issues/295 -- 3next steps for CPS |
04:42:28 | FromDiscord | <Cohjellah> this makes complete sense |
04:42:35 | FromDiscord | <Cohjellah> Bless the ElegantBeef and everyone here for your assistance |
04:43:36 | FromDiscord | <Cohjellah> Templates are so cool |
04:44:08 | FromDiscord | <ElegantBeef> Yep, macros are even cooler |
04:44:40 | FromDiscord | <ElegantBeef> More complicated, but more powerful |
04:45:37 | FromDiscord | <Rika> no u |
04:45:41 | FromDiscord | <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:32 | FromDiscord | <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:25 | FromDiscord | <Cohjellah> so how exactly do I stick the string variable in the lock? |
04:54:43 | FromDiscord | <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:28 | FromDiscord | <ElegantBeef> The lock isnt anything special aside from "We're holding onto resources dont write/read" |
04:55:39 | FromDiscord | <Rika> you dont stick anything in the lock |
04:55:51 | FromDiscord | <Rika> the lock is a glorified boolean (in super dumbed down terms) |
04:56:17 | FromDiscord | <Cohjellah> right but I can't access it in a thread because I get the GC error |
04:56:37 | FromDiscord | <Cohjellah> the thread isn't GC safe because it's using a global variable |
04:56:40 | FromDiscord | <Rika> sorry to say but then you might be doing something wrong |
04:56:45 | FromDiscord | <Cohjellah> I am 100% doing something wrong |
04:57:55 | FromDiscord | <Cohjellah> hold up the GC error went away |
04:59:21 | FromDiscord | <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:20 | FromDiscord | <Rika> are you compiling |
05:00:24 | FromDiscord | <Rika> or checking via nimsuggest |
05:00:29 | FromDiscord | <Rika> because if its the latter then ignore it |
05:00:38 | FromDiscord | <Rika> shit gets funky when youre using threading and nimsuggest |
05:03:05 | FromDiscord | <Cohjellah> so I'm getting an undeclared variable error |
05:03:15 | FromDiscord | <Cohjellah> Am I not supposed to declare the variable I want to be passed around inside of the lock? |
05:03:43 | FromDiscord | <ElegantBeef> the lock is a global variable, you cannot declare anything inside it |
05:04:05 | FromDiscord | <Cohjellah> https://tenor.com/view/nick-young-question-marks-what-excuse-me-huh-gif-4486363 |
05:04:10 | FromDiscord | <Cohjellah> Okay that explains it |
05:05:36 | FromDiscord | <ElegantBeef> I honestly dont know how you're supposed to add to the global string |
05:06:01 | FromDiscord | <Cohjellah> What do you mean. Isn't the purpose of lock to pass variables between threads/cores |
05:06:21 | FromDiscord | <ElegantBeef> It's to lock resources to prevent reading/writting to them at the same time |
05:06:45 | FromDiscord | <Cohjellah> right, because it'll just overwrite whatever you're assigning to it |
05:06:49 | FromDiscord | <Cohjellah> if you don't use a lock |
05:06:54 | FromDiscord | <Cohjellah> yadda yadda thread safe stuff |
05:07:22 | FromDiscord | <ElegantBeef> Yea, the string is heap allocated, so afaik it wont let you add to it, unless i'm missing something |
05:07:33 | FromDiscord | <Cohjellah> hnmmmm |
05:08:09 | Prestige | so concatenation allocates the new size needed? |
05:09:28 | disruptek | yes. |
05:09:42 | FromDiscord | <Cohjellah> so I've got the lock, and I've created the global variable |
05:09:53 | FromDiscord | <Cohjellah> trying to access it within the lock proves futile as I still get the unsafe GC error |
05:10:00 | FromDiscord | <ElegantBeef> guess can use `cast(gcsafe)` but no clue if that's what disruptek was alluding to |
05:10:12 | disruptek | of course. |
05:10:21 | disruptek | it's safe because you're using a lock when you r/w it. |
05:10:26 | FromDiscord | <Cohjellah> riiight |
05:10:31 | FromDiscord | <Cohjellah> but the compiler doesn't know that so I have to flag it? |
05:10:36 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#threads-gc-safety |
05:10:38 | FromDiscord | <ElegantBeef> Yep |
05:11:17 | disruptek | .gcsafe shouldn't exist. it's stupid. |
05:11:37 | FromDiscord | <Cohjellah> lmao |
05:11:51 | FromDiscord | <ElegantBeef> It seems marginally helpful for many headaches |
05:12:59 | FromDiscord | <Cohjellah> groovy |
05:13:01 | FromDiscord | <Cohjellah> actually works now |
05:13:08 | disruptek | weird. |
05:13:24 | * | hnOsmium0001 is now known as hnOsmium0002 |
05:13:29 | * | disruptek is now known as asd |
05:13:42 | FromDiscord | <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:55 | FromDiscord | <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:36 | keisterfish | it's almost like threads work well and are simple to use. |
05:15:04 | * | keisterfish is now known as asd |
05:15:09 | FromDiscord | <Cohjellah> maybe I was just asking my questions all wrong |
05:15:20 | FromDiscord | <ElegantBeef> Hey i've never seen you before, you cannot use that sarcastic tone with me |
05:15:20 | asd | not really. |
05:15:31 | Prestige | asd: what is your ideal vision for async/csp/threads etc |
05:15:38 | Prestige | I can't tell what direction Nim is going in |
05:15:38 | asd | the first step to improving async is removal of async. |
05:15:54 | FromDiscord | <Cohjellah> aaand I think I've created deadlocks |
05:15:56 | FromDiscord | <Cohjellah> huzzah |
05:16:07 | FromDiscord | <Cohjellah> But hey at least it's a new issue |
05:16:31 | asd | ideally we have a csp layer like clojure's core.async. |
05:16:40 | Prestige | Guess async will need to stay for backwards compat. right |
05:16:55 | Prestige | or do you just mean the underlying implementation |
05:17:03 | FromDiscord | <Cohjellah> What's wrong with async? |
05:17:04 | asd | it 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:16 | asd | but it's the wrong abstraction. |
05:18:02 | asd | ~csp is https://en.wikipedia.org/wiki/Communicating_sequential_processes |
05:18:03 | disbot | csp: 11https://en.wikipedia.org/wiki/Communicating_sequential_processes |
05:18:14 | Prestige | I'll give this a read, thanks |
05:19:19 | asd | in the same way that go provides really killer concurrency, nim can too. |
05:19:53 | asd | the 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:00 | Prestige | Is this blocked by something, or just in the works? |
05:20:32 | asd | there's not much complexity to it, but to do it "our way", we want to use macros. |
05:21:04 | asd | the 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:20 | asd | you cannot define your own cps types in kotlin, for example. |
05:21:48 | asd | in our version, you can define everything yourself. |
05:22:47 | asd | this means that abstractions aren't limited by the complexity or limitations of the type system -- they exploit it. |
05:23:27 | asd | instead 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:47 | Prestige | That would be cool to see. Still reading, might ping with more questions down the road |
05:24:01 | asd | it means in particular that libraries can provide cps/csp behaviors to your existing types via generics and concepts. |
05:24:26 | asd | you don't have to use what we provide. we merely provide the formal semantics. |
05:24:41 | FromDiscord | <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:46 | FromDiscord | <Cohjellah> thanks @ElegantBeef |
05:24:48 | FromDiscord | <Cohjellah> โค๏ธ |
05:26:19 | FromDiscord | <Cohjellah> nevermind |
05:26:24 | FromDiscord | <Cohjellah> ๐ |
05:33:44 | asd | ~cps is https://en.wikipedia.org/wiki/Continuation-passing_style |
05:33:45 | disbot | cps: 11https://en.wikipedia.org/wiki/Continuation-passing_style |
05:36:13 | FromDiscord | <Rika> asd: so you're a fellow advocate for cps and csp? nice |
05:36:22 | FromDiscord | <ElegantBeef> It's disruptek no? |
05:36:32 | asd | i'm much better looking than disruptek. |
05:37:17 | FromDiscord | <Rika> thats disruptek? really |
05:37:55 | asd | no, i'm shorter than disruptek but longer where it counts. |
05:38:59 | Prestige | He has a really long reach. Good for boxing in his weight class |
05:39:01 | FromDiscord | <Rika> patience? |
05:39:09 | FromDiscord | <Rika> i hope your patience is longer |
05:39:23 | asd | i don't know how disruptek manages to be so patient. |
06:08:24 | FromDiscord | <Cohjellah> I need a character literal of '\u0000' which is null |
06:08:30 | FromDiscord | <Cohjellah> but nim doesn't like it. Would just using null suffice? |
06:08:47 | FromDiscord | <Cohjellah> nil |
06:08:48 | FromDiscord | <ElegantBeef> you want ascii `'\0'`? |
06:08:58 | FromDiscord | <ElegantBeef> The null terminating character? |
06:09:02 | FromDiscord | <Cohjellah> I guess? So because I recreated the wheel there is of course bugs |
06:09:06 | FromDiscord | <Cohjellah> on windows |
06:09:29 | FromDiscord | <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:46 | asd | just use linux. |
06:09:54 | FromDiscord | <Cohjellah> it's a chat app |
06:10:01 | FromDiscord | <Cohjellah> want it to work on windows |
06:10:05 | asd | just talk to linux users. |
06:10:10 | FromDiscord | <Cohjellah> hahahaha |
06:10:16 | FromDiscord | <Cohjellah> that's the optimal solution hmm |
06:10:21 | asd | who gives a shit what windows users have to say? |
06:10:55 | FromDiscord | <Rika> Why do you need a null character |
06:11:19 | asd | rika has null character. |
06:11:32 | FromDiscord | <Rika> I can tell |
06:11:42 | FromDiscord | <Cohjellah> I don't need one |
06:11:54 | FromDiscord | <Cohjellah> but for windows users when they use shift it's giving the server a null character |
06:12:03 | FromDiscord | <Cohjellah> which is giving the windows users a blank space |
06:12:31 | FromDiscord | <Cohjellah> like so |
06:12:32 | FromDiscord | <Cohjellah> https://media.discordapp.net/attachments/371759389889003532/792636011112562718/unknown.png |
06:12:58 | FromDiscord | <ElegantBeef> So just dont add that character ๐ |
06:13:16 | FromDiscord | <Cohjellah> trying to disregard it, but when I put '\u0000' it just goes red |
06:13:17 | FromDiscord | <Cohjellah> it's odd |
06:13:19 | FromDiscord | <Cohjellah> let me try compile |
06:13:24 | FromDiscord | <Rika> Use \0 |
06:13:28 | FromDiscord | <Rika> Not the u one |
06:13:35 | FromDiscord | <ElegantBeef> well `'\u0000'` is unicode not a ascii char |
06:13:47 | FromDiscord | <Rika> Is it a code point or what |
06:13:59 | FromDiscord | <Rika> If itโs a code point the I guess itโs something different t |
06:14:17 | FromDiscord | <Cohjellah> riight so is there a mismatch between windows and linux hence the issues |
06:14:26 | FromDiscord | <Cohjellah> is there a way to change the encoding... or something |
06:15:05 | Prestige | Can you show the code? Idk what's going on |
06:15:16 | Prestige | but I also don't use Windows if that's actually the problem |
06:16:02 | FromDiscord | <ElegantBeef> I dont even know how you're getting a unicode character here |
06:16:14 | FromDiscord | <Cohjellah> ahahaha neither |
06:16:19 | FromDiscord | <Cohjellah> something to do with windows |
06:16:20 | FromDiscord | <ElegantBeef> `getCh` returns a `char`, which is not unicode |
06:16:29 | FromDiscord | <ElegantBeef> Is your server written in Nim aswell? |
06:16:30 | asd | tell the windows users not to use shift. |
06:16:47 | * | asd is now known as disruptek |
06:17:17 | FromDiscord | <Rika> Tell them to move to Linux |
06:17:59 | Prestige | https://i.imgur.com/N4KrlS8.png disruptek Idk who would disagree. it's much better |
06:18:46 | disruptek | you'd be suprised how common it is in the compiler. |
06:19:03 | FromDiscord | <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:19 | Prestige | The CTO at my company does that actually, it's kind of annoying |
06:19:25 | FromDiscord | <Cohjellah> the server is written in nim too |
06:20:06 | FromDiscord | <Cohjellah> sent a code paste, see https://play.nim-lang.org/#ix=2JGE |
06:20:09 | FromDiscord | <Cohjellah> it's completed borked it. Nothing types on Windows |
06:21:58 | FromDiscord | <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:34 | Prestige | the execution on the same line annoys me |
06:22:36 | disruptek | the point is that it's more legible and easier to see the control-flow, particularly when looking for a missing else. |
06:22:44 | Prestige | that too |
06:22:59 | FromDiscord | <ElegantBeef> Yea i dont like the one line either |
06:23:40 | * | narimiran joined #nim |
06:24:28 | FromDiscord | <Rika> Me neither but I bet Iโve done it before |
06:32:27 | disruptek | i 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:44 | FromDiscord | <ElegantBeef> i aspire to write code that |
06:34:16 | FromDiscord | <Rika> Sucks |
06:34:25 | FromDiscord | <Cohjellah> sooooo |
06:34:28 | disruptek | sucks would be an improvement, huh beef. |
06:34:33 | FromDiscord | <Cohjellah> shift AND caps lock on windows produces unicode: \u0000 |
06:34:35 | FromDiscord | <Cohjellah> and |
06:34:40 | FromDiscord | <Cohjellah> \0 just breaks it... HMM |
06:34:41 | FromDiscord | <ElegantBeef> Yea, garbage < sucks |
06:35:16 | FromDiscord | <ElegantBeef> What terminal emulator are you using? |
06:35:17 | FromDiscord | <Cohjellah> so the ASCII version of unicode \u0000 is \0? |
06:35:23 | FromDiscord | <Cohjellah> I'm using just regular old bash |
06:35:26 | FromDiscord | <Cohjellah> they're using the base terminal |
06:35:34 | FromDiscord | <Cohjellah> for windows |
06:35:40 | FromDiscord | <ElegantBeef> Jesus christ |
06:35:47 | FromDiscord | <Rika> ??? |
06:35:48 | FromDiscord | <ElegantBeef> Windows Terminal 2 exists |
06:35:53 | FromDiscord | <Rika> I am hella confused |
06:35:56 | FromDiscord | <Cohjellah> powershell? |
06:36:05 | FromDiscord | <ElegantBeef> No |
06:36:12 | FromDiscord | <ElegantBeef> Windows Terminal |
06:37:33 | FromDiscord | <Cohjellah> riiight |
06:37:51 | FromDiscord | <Cohjellah> so they click the exe, it opens into whatever Terminal is default on Windows |
06:38:06 | FromDiscord | <ElegantBeef> And windows command prompt is garbage |
06:39:03 | FromDiscord | <ElegantBeef> you could always just remove `\u0000` from the string, since it's apparently getting added somehow, but no clue why |
06:40:13 | FromDiscord | <Cohjellah> I'm trying |
06:40:18 | mipri | something like an 8-byte API with bad FFI that thinks it's getting 16-byte returns, maybe |
06:40:20 | FromDiscord | <Cohjellah> but nim dislikes \u |
06:41:03 | mipri | !eval echo ("\0"[0].byte, "\0"[0] == '\0') |
06:41:07 | NimBot | (0, true) |
06:41:31 | FromDiscord | <Rika> !eval echo "\u0000" == "\0" |
06:41:34 | NimBot | true |
06:41:36 | FromDiscord | <ElegantBeef> !eval echo "\u0000".len |
06:41:39 | NimBot | 1 |
06:41:43 | FromDiscord | <Cohjellah> nani |
06:41:45 | FromDiscord | <Rika> lol |
06:42:09 | FromDiscord | <ElegantBeef> !eval echo "\u0000" in {'\0'} |
06:42:11 | NimBot | Compile failed: /usercode/in.nim(1, 15) Error: type mismatch: got <set[char], string> |
06:42:18 | FromDiscord | <Cohjellah> oh |
06:42:20 | FromDiscord | <Cohjellah> you guys are doing strings |
06:42:31 | FromDiscord | <ElegantBeef> Well yea it's not a char |
06:42:36 | FromDiscord | <Cohjellah> riiiiiiiiiiiiiiiiiiiiiiiiight |
06:42:38 | FromDiscord | <ElegantBeef> It's a unicode character |
06:42:42 | FromDiscord | <ElegantBeef> Which is multiple bytes |
06:42:46 | FromDiscord | <Rika> not always |
06:42:58 | FromDiscord | <ElegantBeef> Well can be, |
06:43:00 | FromDiscord | <Rika> alphanums are unicode chars, yet single bite |
06:43:01 | mipri | it isn't multiple bytes in this case, but that's why the char syntax doesn't work. |
06:43:01 | FromDiscord | <Rika> bye |
06:43:04 | FromDiscord | <Rika> bYTE |
06:43:05 | FromDiscord | <ElegantBeef> Proved it's' a single byte he |
06:43:05 | FromDiscord | <Rika> GOD |
06:43:09 | FromDiscord | <ElegantBeef> (edit) "he" => "here" |
06:43:17 | FromDiscord | <Cohjellah> how the heck is char returning \u0000 |
06:43:18 | FromDiscord | <Cohjellah> what in gods name |
06:43:23 | FromDiscord | <Rika> its not? |
06:43:35 | FromDiscord | <Rika> its a string with \u0000 |
06:43:37 | FromDiscord | <Rika> not a char |
06:43:50 | FromDiscord | <ElegantBeef> well they're using `str.add(char)` |
06:43:57 | FromDiscord | <Cohjellah> ^ |
06:44:01 | FromDiscord | <Rika> then use \0 |
06:44:10 | FromDiscord | <Cohjellah> \0 makes nothing work on the windows user |
06:44:10 | FromDiscord | <Rika> i said that a while ago didnt i |
06:44:11 | FromDiscord | <Cohjellah> they can't type anything |
06:44:19 | FromDiscord | <ElegantBeef> So the terminal is returning `\0` and then adding to the str is causing it to be `\u0000` |
06:44:31 | FromDiscord | <Cohjellah> hol up I might have borked it in my code |
06:44:35 | FromDiscord | <Cohjellah> continue just goes back to the top of the loop doesn;'t it |
06:44:36 | FromDiscord | <Cohjellah> holy shit |
06:44:38 | FromDiscord | <Cohjellah> yep I'm retarded |
06:44:46 | FromDiscord | <Cohjellah> Classic blunder |
06:44:46 | FromDiscord | <Cohjellah> soz for swears |
06:44:55 | Prestige | disruptek: what do you mean by `Use try expressions only without an except clause`? |
06:47:29 | disruptek | prestige: if you plan on raising an exception, you'll get a syntax error for a try expression. |
06:48:08 | Prestige | By that I think you mean, variable assignment to a try block? |
06:48:26 | ForumUpdaterBot | New thread by Domogled: Asynchttpserver basic-usage with error, see https://forum.nim-lang.org/t/7295 |
06:48:27 | FromDiscord | <ElegantBeef> `expression` is the key here |
06:48:32 | disruptek | ^ |
06:48:42 | FromDiscord | <ElegantBeef> Expressions are on the right of an `=` |
06:48:46 | disruptek | that's why it's in italics. ๐ |
06:48:47 | Prestige | Oh, okay |
06:48:55 | Prestige | I wasn't sure if that's what it meant |
06:51:04 | disruptek | it's in the list because the behavior may vary before nim-2.0. |
07:05:03 | FromDiscord | <mratsim> is there any reason to expose the `while continuation != nil and continuation.fn != nil: continuation.fn(continuation)` |
07:05:20 | disruptek | of course. |
07:05:47 | FromDiscord | <mratsim> enlighten me |
07:06:11 | disruptek | every dispatcher may be implemented differently. |
07:06:48 | disruptek | things you might want to customize according to the dispatcher: exception handling, stack traces, etc. |
07:07:03 | FromDiscord | <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:44 | disruptek | every exit from a continuation is a suspension point. |
07:07:57 | FromDiscord | <mratsim> I mean something like "yield" |
07:08:04 | disruptek | you mean a nil fn? |
07:08:33 | FromDiscord | <mratsim> not "for i in 0 ..< 10: if a[i] < 5: continue". |
07:08:35 | FromDiscord | <mratsim> yes |
07:08:39 | FromDiscord | <mratsim> a nil continuation. |
07:09:40 | disruptek | one 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:44 | FromDiscord | <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:10 | FromDiscord | <mratsim> instead of the c.value that is stored within the continuation |
07:10:39 | disruptek | this is indeed how yield is impl. |
07:10:52 | FromDiscord | <mratsim> otherwise we need a "channel" to communicate result to the outer scope |
07:11:20 | disruptek | one 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:24 | FromDiscord | <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:39 | FromDiscord | <mratsim> in which fail is the example? |
07:11:44 | FromDiscord | <mratsim> file |
07:12:10 | disruptek | we haven't impl it. it's just my shorthand for "return result from an object-based continuation". |
07:12:29 | disruptek | it will have to be impl for every continuation type we generate, for obvious reasons. |
07:12:58 | disruptek | we can call it `getResult` or something to make it more obvious while discussing it. |
07:13:15 | FromDiscord | <mratsim> I think it's too complex to have every end users generate their continuation type, add custom fields etc |
07:13:29 | disruptek | coming from you, that's a remarkable statement. |
07:13:47 | FromDiscord | <mratsim> I'm always thinking about ergonomics |
07:13:59 | disruptek | Zevv: mratsim is awake and i think he may be drunk. |
07:14:27 | disruptek | think about the fact that people want to bring guns to this knife fight. nim will let them. |
07:14:34 | disruptek | this is not the case with other languages. |
07:14:52 | disruptek | i wanna compose cps with my most complex abstractions. |
07:15:35 | FromDiscord | <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:08 | disruptek | well, i don't care about the name. ๐ |
07:16:34 | FromDiscord | <mratsim> Well me too I want to compose with complex abstractions but I want to make it very usable as well |
07:17:12 | disruptek | sure. using concepts isn't the problem, here, though. |
07:17:22 | disruptek | i mean, we used to infer the type. ๐คท |
07:17:26 | FromDiscord | <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:55 | disruptek | you guys have a #head requires in libp2p. |
07:18:03 | * | disruptek sighs. |
07:19:21 | FromDiscord | <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:53 | disruptek | could be. |
07:20:36 | FromDiscord | <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:03 | FromDiscord | <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:05 | FromDiscord | <mratsim> Now you said something interesting about stacktraces. |
07:22:10 | disruptek | i think the logic there is a little weird. |
07:22:43 | disruptek | but, yeah, if you wanna rewrite it i'm happy to see what you come up with. |
07:22:58 | FromDiscord | <mratsim> but if we want to customize stacktraces we need to provide an enum "cfWhile, cfFor, cfBreak" |
07:23:00 | disruptek | i never mind it when people rewrite zevv's stuff. ๐คฃ |
07:23:24 | disruptek | the stack traces can be composed statically. |
07:24:06 | disruptek | there's a crude impl in the code already. |
07:24:18 | FromDiscord | <mratsim> but they need to be able to reconstruct the original control flow pre-cps I think |
07:24:35 | disruptek | see what you think. |
07:24:47 | disruptek | it's not like we don't have all the line info if we want to use it. |
07:25:04 | FromDiscord | <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:04 | disruptek | we should be able to do very sophisticated traces if we want them. |
07:25:34 | disruptek | the question about stack trace is whether it needs partial impl in the transform itself. |
07:25:46 | disruptek | it currently lives inside the transform, to some extent. |
07:25:58 | FromDiscord | <mratsim> we can use the {.tags.} to say {.tags: forLoop.} |
07:26:05 | disruptek | it might make more sense to do a static analysis of the transform after it is complete. |
07:26:06 | FromDiscord | <mratsim> with a line number |
07:26:18 | * | juanfra__ joined #nim |
07:26:32 | disruptek | what's the point of that? |
07:26:57 | disruptek | i wouldn't confuse the issue with the effects system. |
07:27:14 | FromDiscord | <mratsim> tags are effect that propagate up? |
07:27:27 | disruptek | yes, but you can leave any ast that you want in the tail of the proc. no one will ever see it. |
07:27:38 | FromDiscord | <mratsim> ah then it's wrong |
07:27:45 | disruptek | return ...; when false: any ast i want. |
07:27:57 | disruptek | the when false just prevents sem. |
07:28:02 | FromDiscord | <mratsim> I usually hide them in discard statement |
07:28:16 | disruptek | yeah, it's whatever you want. |
07:28:35 | disruptek | i don't want the compiler trying to understand my metadata. |
07:28:56 | FromDiscord | <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:13 | disruptek | go nuts. |
07:29:20 | FromDiscord | <mratsim> sure |
07:29:26 | FromDiscord | <mratsim> see you in a week :p |
07:29:30 | disruptek | haha |
07:29:48 | disruptek | just remember that we have huge potential here and i dunno about zevv, but i hate giving up opportunity. |
07:29:51 | FromDiscord | <mratsim> I wonder if I should try this directly on the typed branch instead of 0.0.13 |
07:30:02 | disruptek | you should. untyped is shit. |
07:30:26 | FromDiscord | <mratsim> Do you think I give up? ๐ I spent a long time banging my head to make Weave work. |
07:30:26 | disruptek | typed is much slicker. |
07:30:48 | disruptek | i know your work ethic. ๐ |
07:31:49 | FromDiscord | <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:09 | disruptek | right, and when this thing works, it's going to blow away everything else out there. |
07:32:10 | FromDiscord | <mratsim> anyway. let's open the bowels of the beast |
07:32:50 | FromDiscord | <ElegantBeef> Ah i thought it started smelling like shit in here |
07:32:55 | disruptek | according to clyybber, we can just swap out the hidden nodes. |
07:33:06 | disruptek | to work around the issue with desem. |
07:33:12 | FromDiscord | <mratsim> I'll be DND for a while and will only come back when I'm tired of macro+type shit. |
07:33:22 | disruptek | okie. |
07:33:27 | FromDiscord | <mratsim> Which i assume will happen in 3, 2, 1 ... |
07:33:32 | FromDiscord | <ElegantBeef> Was nice knowing you |
07:33:32 | disruptek | it's 02:30 here anyway. |
07:33:56 | FromDiscord | <mratsim> you can watch my progress here: https://github.com/nim-lang/RFCs/issues/44 |
07:33:57 | disbot | โฅ [RFC] Working with types in macro is difficult. |
07:34:27 | FromDiscord | <mratsim> and the backup: https://github.com/nim-lang/Nim/issues/8677 |
07:34:28 | disbot | โฅ [Meta] Generics/Static early symbol resolution |
07:35:22 | disruptek | i mean, there has never been a shortage of bugs in nim. |
07:35:29 | disruptek | what we need is a spec. |
07:35:43 | disruptek | cps is helping to create that, in theory. |
07:35:57 | FromDiscord | <mratsim> CPS is helping create API |
07:36:20 | FromDiscord | <mratsim> not sure if you read my draft design, but we can decribe a lot of thing in terms of suspendand resume. |
07:36:39 | FromDiscord | <mratsim> Streams, IO, task, iterators, async, ... |
07:36:41 | disruptek | yeah, i hate that. ๐ |
07:37:01 | FromDiscord | <mratsim> but it's true :p |
07:37:10 | disruptek | to me it's not about suspend/resume, it's about A->B. |
07:37:12 | FromDiscord | <mratsim> you can call that await and "next" if you want |
07:37:14 | FromDiscord | <mratsim> I compiled a list of aliases |
07:39:09 | FromDiscord | <mratsim> resume aliases: "wake", "waitFor", "generate", "continue", "produce", "read", "lex", "parse", suspend aliases: "schedule", "launch", "start" |
07:39:33 | FromDiscord | <mratsim> thogh I gues it's more sexy to talk about producer-consumer. |
07:39:53 | FromDiscord | <mratsim> resume = consumer, suspend = producer |
07:39:55 | disruptek | i really wanted to reuse `yield`, `continue`, etc. |
07:40:28 | disruptek | it's possible, but a little more convoluted. |
07:42:07 | FromDiscord | <mratsim> same |
07:42:36 | FromDiscord | <mratsim> yield might be possible though, for coroutines. |
07:42:44 | FromDiscord | <mratsim> it should parse the same. |
07:43:01 | FromDiscord | <mratsim> continue will likely error at the parser level |
07:43:19 | disruptek | nah, it just needs an untyped layer. |
07:43:24 | FromDiscord | <mratsim> I think we should really push the producer-consumer narrative. |
07:43:25 | disruptek | but it's just hard to justify that. |
07:43:40 | FromDiscord | <mratsim> That's what continuations solve in an efficient way. |
07:44:04 | disruptek | yes, but it's not the mental map, i don't think. |
07:44:13 | disruptek | but anyway, get to work. you can rename it later. ๐ |
07:44:19 | FromDiscord | <mratsim> Producer->consumer: without intermediate buffers, without atomics or locks synchronization, without state machine, can be paused, interleaved, resumed. |
07:44:23 | Zevv | dudes |
07:44:28 | disruptek | oh shit. |
07:45:35 | Zevv | i thought i would come in early and say something relevant & smrat |
07:45:46 | Zevv | ayway, I'm the best learner today. slept the longest |
07:45:56 | disruptek | i believe that. |
07:46:39 | disruptek | you have a whole week of extra sleep ahead of you, assuming you can find a hole to put your kids in. |
07:51:31 | Zevv | you told mratsim yet that generics for a trampoline is not the right answer, right |
07:51:41 | Zevv | like, you told him often enough now |
07:52:06 | disruptek | he doesn't even want to expose the trampoline. |
07:52:21 | disruptek | i told him he can do whatever he wants to your code. ๐คช |
07:52:34 | disruptek | it won't work, but that's okay with me. |
07:53:11 | disruptek | having more experiments to look at won't be a bad thing. |
07:54:00 | Zevv | fair enough |
07:54:10 | Zevv | its not about the exposing |
07:54:17 | Zevv | but you know that, and I |
07:55:46 | disruptek | i think he has to write a few implementations. it's the best way to understand the domain. |
07:56:25 | Zevv | sure |
07:56:46 | Zevv | and I don't mind him rewriting your code |
07:56:54 | disruptek | heh |
07:58:20 | FromDiscord | <hobbledehoy> is there anyway to have optional parameters in a pragma? |
07:58:26 | disruptek | yes. |
07:59:07 | FromDiscord | <hobbledehoy> how? I've tried just making the parameter in the macro optional but it didn't work |
07:59:37 | disruptek | here's an example: |
07:59:44 | disruptek | !repo disruptek/criterion |
07:59:44 | disbot | https://github.com/disruptek/criterion -- 9criterion: 11statistics-driven micro-benchmarking framework 15 13โญ 0๐ด |
07:59:53 | disruptek | see the .measure in sugar.nim. |
08:00:02 | disruptek | at least, i think that's where it is. |
08:00:57 | disruptek | there might still be a bug with .measure. verus .measure: []. but i think it's fixed. |
08:04:27 | disruptek | zevv: you will have to keep your eye on mamy; i need to learn a thing. |
08:04:29 | FromDiscord | <hobbledehoy> thanks! |
08:06:35 | Zevv | sweet learns |
08:08:34 | Zevv | mratsim: 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:04 | Zevv | that should not be hard to fix, but for now we got ton's of "false" suspends |
08:31:20 | Araq | Christmas is over, back to work |
08:45:01 | FromGitter | <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:52 | FromGitter | <nothratal> I'm converting a code snippet from another language, the enum has over 200 unordered, but unique entries... |
08:46:20 | FromDiscord | <ElegantBeef> "However, the ordinal values have to be in ascending order. " from the manual |
08:47:43 | FromDiscord | <ElegantBeef> Your best solution i imagine is to write something that extracts the information and stores the identifier ordinal in ascending order |
08:47:49 | FromDiscord | <ElegantBeef> But i'm constantly wrong |
08:48:11 | FromGitter | <nothratal> :D |
08:49:15 | FromGitter | <nothratal> I'm considering to convert it into a table, but that's also very ugly |
08:49:18 | Araq | c2nim reorders it for you |
08:52:32 | FromDiscord | <ElegantBeef> What's the source material? |
08:55:45 | FromGitter | <nothratal> c2nim did the trick |
08:55:59 | FromDiscord | <ElegantBeef> Ah that answers my question ๐ |
08:56:21 | FromGitter | <nothratal> out of curiosity, why does nim require it in ascending order? |
08:57:16 | Araq | cause nobody added a 'sort' call to the compiler |
08:57:32 | Araq | also, when I wrote the code, I didn't have 'sort' lying around. PRs are welcome |
08:58:12 | Araq | there is probably a problem with what 'enum x = 3, y, z = 2' means |
08:58:39 | Araq | should 'y' still be 4 implicitly? |
08:58:52 | FromGitter | <nothratal> lol, I thought I get a highly technical explanation. I like this one :D |
08:58:52 | FromDiscord | <ElegantBeef> Was going to say `x, y = 3, z = 2, w` is a bit confusing |
08:59:51 | FromDiscord | <ElegantBeef> Would `w` be 4 if so then everything after makes no sense really |
09:00:55 | mipri | those are both errors currently, so changing them wouldn't be breaking code |
09:01:21 | mipri | well, tihs isn't an error: x = -1, y, z = 3 # y is 0 |
09:02:25 | mipri | yeah I thought y would always be zero but it's +1 of the previous value, of course. |
09:04:32 | FromDiscord | <ElegantBeef> Personally i've never seen anyone use non ascending enums, so i dont see much of a benefit |
09:04:57 | mipri | you don't ever see it in Nim because the compiler rejects it |
09:05:09 | FromDiscord | <ElegantBeef> I mean in general |
09:05:36 | mipri | well in general, I don't see enums with explicit values. |
09:06:39 | mipri | I 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:58 | Prestige | I'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:40 | Prestige | As if it were* |
09:08:05 | FromDiscord | <ElegantBeef> Well good news they're just a singleton wrapping a class |
09:09:20 | Araq | Java's enums are offending |
09:10:01 | Prestige | Would 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:31 | FromDiscord | <ElegantBeef> I mean you can make an `array[Enum, T]` |
09:10:37 | Araq | well you should be able to add this feature via Nim's macro system |
09:11:09 | Prestige | Yeah, if I ever run across it maybe I'll make a FatEnum or something, lol |
09:11:12 | mipri | do what specifically? You can still write procs that that take an enum type and look like properties. |
09:11:15 | FromDiscord | <ElegantBeef> Isnt it just a few constants mixed with the abillity to make them? |
09:11:41 | Prestige | Yep pretty much |
09:11:54 | Araq | lol, FatEnum, good name |
09:12:34 | FromDiscord | <ElegantBeef> So you get a similar thing using an array mixed with some properties ๐ |
09:13:37 | FromDiscord | <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:38 | Prestige | I should work on that MI macro when I get back from vacation.. going to be interesting |
09:14:49 | saem | Thanks 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:08 | Araq | :O |
09:16:45 | Araq | I have to thank you! |
09:16:52 | Araq | excellent work |
09:17:17 | saem | I 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:41 | saem | s/starting/staring |
09:17:43 | Araq | I rarely use any debugger |
09:17:47 | Araq | so don't ask me |
09:18:18 | Araq | and yeah, I did use C# for years and it's debugger is excellent. Didn't use it much either. |
09:18:47 | Araq | the eternal step-into vs step-over question takes too much brain power |
09:19:03 | saem | I much prefer types + writing tests, but I need other design things to be true before I can make progress that way. |
09:19:07 | FromDiscord | <ElegantBeef> Same for me, the only times i feel like i need the debugger is when doing stupid things like recursive logic |
09:19:37 | saem | Graphics is the only time I've felt like I desperately need a debugger. |
09:19:49 | FromDiscord | <ElegantBeef> Let's traverse a graph using a while loop eternally.... and i crashed unity |
09:19:51 | saem | Or when I can't reason about memory layouts |
09:22:06 | saem | Anyhow, 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:50 | saem | I'll probably need to fix choosenim afterwards, because it ships with a broken nim-gdb. |
09:32:08 | FromDiscord | <ElegantBeef> How dare you share that repo here! ๐ |
09:32:20 | FromDiscord | <Rika> @ElegantBeef#550 Nim for Java programmers? |
09:32:24 | * | saem is a monster |
09:32:47 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/wiki/Nim-for-Java-programmers |
09:32:53 | FromDiscord | <Rika> Thanks |
09:33:43 | Zevv | Araq: seems that mratsim has seen the light, he'll take us there |
09:33:58 | Zevv | he needs to lose few fingers on the blade first, but he'll be ok |
09:36:46 | Araq | I worry a bit but shut up |
09:37:34 | Zevv | I 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:37 | Zevv | :) |
09:38:05 | Araq | I shut up. |
09:38:10 | FromDiscord | <ElegantBeef> Zevv read it like the first, as i did just to keep yourself on your feet |
09:38:12 | Zevv | Me too |
09:41:01 | saem | Draft 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:02 | disbot | โฅ Attempts at improving nim-gdb.py |
09:41:05 | Araq | all I want is Weave with refs and strings and seqs and some IO support |
09:41:39 | FromDiscord | <ElegantBeef> nighty night west coast ๐ |
09:41:49 | saem | Thanks, good nite |
09:41:56 | * | saem quit (Remote host closed the connection) |
09:41:59 | Araq | good night, take care |
09:56:22 | FromDiscord | <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:29 | FromDiscord | <ElegantBeef> (edit) "them" => "the" |
09:57:29 | Araq | simple? |
09:57:52 | FromDiscord | <ElegantBeef> I imagined so |
10:10:35 | * | Torro joined #nim |
10:15:39 | * | opal joined #nim |
10:24:23 | * | Vladar joined #nim |
10:24:53 | FromDiscord | <TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JHC |
10:29:04 | Araq | echo createMessage("John", "Hi!") |
10:29:09 | Araq | so that you can see how it's different |
10:29:20 | Araq | from what you assumed it would be |
10:40:21 | FromDiscord | <TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JI9 |
10:40:39 | mipri | there's an extra space in your 'expected' |
10:40:50 | mipri | after "John", |
10:41:25 | * | Cthalupa quit (Ping timeout: 240 seconds) |
10:43:08 | * | Cthalupa joined #nim |
11:02:58 | ForumUpdaterBot | New thread by Mantielero: C++ FFI templates, see https://forum.nim-lang.org/t/7296 |
11:20:14 | FromDiscord | <TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2JNS |
11:31:12 | FromDiscord | <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:00 | FromDiscord | <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:49 | FromDiscord | <Rika> With the define yes |
12:01:16 | * | cYbErTiM[m] left #nim ("User left") |
12:03:36 | mipri | the manual doesn't have an httpclient example. What specific example are you talking about? |
12:03:51 | * | superbia joined #nim |
12:04:17 | FromDiscord | <Rika> I think they mean from the docs |
12:04:43 | FromDiscord | <cybertim> https://nim-lang.org/docs/httpclient.html first code sample |
12:05:13 | mipri | the three line one, with google.com? |
12:05:25 | FromDiscord | <cybertim> yes |
12:05:57 | mipri | it works for me with no flags required. just 'nim r thefile' is enough. |
12:06:06 | mipri | what version of Nim do you have? |
12:06:47 | FromDiscord | <cybertim> Nim Compiler Version 1.4.2 [Linux: amd64] and Nim Compiler Version 1.4.2 [Windows: amd64] |
12:08:05 | FromDiscord | <Rika> Probably some weird SSL issue again |
12:08:17 | mipri | it's not an SSL request. |
12:08:44 | FromDiscord | <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:49 | FromDiscord | <Rika> Well read the error |
12:10:31 | mipri | when -d:ssl isn't passed, that's line's just returning a dummy threadvar |
12:10:55 | mipri | there's nothing at all ssl about it actually. |
12:11:41 | mipri | cybertim: I get your error if I change 'var client = newHttpClient()' to 'const client = newHttpClient()' |
12:11:57 | mipri | perhaps you're not running the example in the manual, but something like that? |
12:13:48 | FromDiscord | <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:17 | FromDiscord | <cybertim> i guess const isn't like const i think a const is |
12:14:22 | mipri | Nim isn't JS, no. |
12:15:54 | FromDiscord | <lqdev> @cybertim Nim `let` is like JS `const` |
12:16:01 | FromDiscord | <lqdev> or, not really |
12:16:08 | FromDiscord | <lqdev> nvm |
12:16:09 | FromDiscord | <lqdev> it is |
12:16:30 | * | Arrrrrrrr quit (Quit: Arrrrrrrr) |
12:16:37 | FromDiscord | <lqdev> Nim `var` โ JS `let`โตNim `let` โ JS `const`โตNim `const` โ no JS counterpart |
12:18:34 | FromDiscord | <cybertim> ok, let is actually a typescript thing, and my background is mainly java/typescript |
12:19:40 | mipri | JS does have a let |
12:20:41 | mipri | and you're right about the mapping. |
12:20:48 | FromDiscord | <cybertim> ohwell, with const i thought more of 'final' in java |
12:21:19 | FromDiscord | <lqdev> nah that's what `let` does |
12:21:42 | FromDiscord | <lqdev> `const` is actually quite different โ it does compile-time evaluation |
12:22:40 | mipri | var - 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:14 | mipri | let - here's an immutable variable. const - here's a statically-known value. |
12:24:08 | qwr | JS var means the declared variable happens magically in containing functions outermost scope, relict from time when JS had no block scopes |
12:28:09 | qwr | in nim its imho good to use let for any binding that don't mutate, makes code intent clearer |
12:28:56 | qwr | (and which isn't constant) |
12:28:57 | mipri | yeah, and the example would've worked with 'let' |
12:30:14 | mipri | since it's a ref object, the non-var parameters using it are a bit of a lie |
12:49:01 | Zevv | mratsim: I found my coro on a backup: https://github.com/disruptek/cps/blob/coro/stash/coroutine.nim |
12:49:10 | Zevv | for what its worth |
13:03:35 | FromDiscord | <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:37 | planetis[m] | system is missing an export for nimCmpMem, can I add it? |
13:51:07 | Araq | it's not missing |
13:51:29 | Araq | maybe cmpMem is missing tho |
13:52:29 | planetis[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:58 | Oddmonger | i'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:15 | Oddmonger | so for using it, i either cast it or postfix it, that is: |
14:37:49 | Oddmonger | stdout.setBackgroundColor( cast[Color](c)) or stdout.setBackgroundColor( c.Color) |
14:38:01 | Araq | never 'cast' it |
14:38:19 | Oddmonger | isn't the c.Color a sort of casting ? |
14:38:31 | mipri | it's checked |
14:39:28 | Oddmonger | but how to check an integer ? |
14:39:53 | Oddmonger | i could as well do var a:Float , and then a.Color |
14:42:19 | Oddmonger | indeed it works, i've just tried. Why this is better than a cast ? |
14:42:35 | Araq | because 'cast' is unsafe |
14:42:55 | Araq | please read any tutorial or the manual |
14:44:52 | mipri | !eval import os; var a = 1.2; echo (FileMode(a), cast[FileMode](a)) |
14:44:56 | NimBot | (fmWrite, 51 (invalid data!)) |
14:47:21 | mipri | it's not the most compelling example with enums, but it just gets worse from here. |
14:48:16 | FromDiscord | <Rika> gets even worse when you start casting ref types |
14:48:19 | FromDiscord | <Rika> lmao |
14:51:07 | * | Arrrrrrrr joined #nim |
15:02:42 | FromGitter | <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:31 | FromDiscord | <flywind> !eval proc foo(l:seq[int] = @[]) = discard |
15:03:33 | NimBot | <no output> |
15:03:57 | FromDiscord | <flywind> Always use space between operator I think. |
15:04:36 | mipri | @ 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:01 | FromGitter | <HJarausch> Yes, thanks. Important spaces are driving me crazy in Nim |
15:06:35 | Oddmonger | haha me too, it remembers < < and << in C++ (with templates) |
15:07:15 | Araq | simply learn the language, *shrug* |
15:07:42 | Oddmonger | oh i do, but it doesn't prevent some hair pulls :) |
15:07:46 | Araq | the lexing rules are actually simpler than in most other languages (fewer special cases) |
15:08:09 | Araq | but if you never learn them it remains guesswork |
15:09:15 | Zevv | story of my life |
15:09:40 | FromGitter | <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:08 | narimiran | speaks a man who writes human-unfriendly code constantly |
15:11:14 | Araq | a set of simple rules works much better than an "intelligent" system that invites users who love the race to the bottom. |
15:11:39 | Araq | in the end you have more complex rules which are just as surprising as the simpler ones |
15:12:20 | Araq | maybe "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:27 | FromGitter | <deech> How do `range[...]` types work for inputs that are not known at compile time? Runtime error?> |
15:34:12 | mipri | !eval import strutils, times; echo "1".parseInt.MonthdayRange |
15:34:16 | NimBot | 1 |
15:34:20 | mipri | !eval import strutils, times; echo "100".parseInt.MonthdayRange |
15:34:23 | NimBot | /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:33 | FromDiscord | <alehander42> heyy |
15:35:42 | FromDiscord | <alehander42> so good to rest a bit |
15:39:48 | FromGitter | <deech> mipri: Thanks! |
15:55:32 | * | MyMind joined #nim |
15:55:35 | mipri | and continuing the earlier thread, |
15:55:38 | mipri | !eval import strutils, times; echo cast[MonthdayRange]("100".parseInt) |
15:55:41 | NimBot | 100 |
15:58:14 | FromDiscord | <Recruit_main707> can you get the parent of a nim node? |
15:58:56 | disruptek | not without cheating. |
16:05:49 | * | waleee-cl joined #nim |
16:11:05 | * | Torro left #nim ("bye") |
16:15:21 | FromDiscord | <Recruit_main707> can i get the type implementation of an object given its name? |
16:17:14 | FromDiscord | <lqdev> yeah |
16:17:19 | FromDiscord | <Recruit_main707> how |
16:17:32 | FromDiscord | <lqdev> is your name a string, an ident, โฆ? |
16:17:50 | FromDiscord | <Recruit_main707> `macroName: TypeName`, ideally |
16:18:05 | FromDiscord | <lqdev> `macroName` is your macro? |
16:18:07 | FromDiscord | <Recruit_main707> yep |
16:18:21 | FromDiscord | <lqdev> you can make its parameter `typed` and then use `getTypeImpl[1].getTypeImpl` on that |
16:18:22 | FromDiscord | <Recruit_main707> so an ident i guess |
16:18:34 | FromDiscord | <Recruit_main707> ah, perfect |
16:19:23 | FromDiscord | <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:54 | FromDiscord | <Recruit_main707> i see, thanks |
16:21:50 | FromDiscord | <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:26 | FromDiscord | <mratsim> Read this: https://github.com/weavers-guild/weave-io/blob/master/blog/multithreading_flavors.md |
16:28:16 | narimiran | disruptek: 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:01 | federico3 | is there any Nim talk at CCC? https://streaming.media.ccc.de/rc3/one#schedule |
16:31:10 | * | xace joined #nim |
16:35:38 | disruptek | narimiran: it passes my ci. nim's ci is broken. |
16:35:50 | disruptek | does it not work for you? |
16:36:17 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
16:36:46 | disruptek | i/o scheduling for cps is trivial enough that it hardly bears consideration. |
16:37:01 | narimiran | oh, 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:09 | disruptek | right. |
16:37:33 | disruptek | leorize is the one that turned me on to the problem and fixed it in his setup-nim. |
16:38:24 | disruptek | i mean, i'm assuming it's the same issue. |
16:38:30 | disruptek | i haven't looked into nim's ci. |
16:39:01 | narimiran | yeah, it looks like it is the same thing |
16:39:04 | * | Gustavo6046 joined #nim |
16:39:12 | FromDiscord | <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:22 | narimiran | `sh: 1: testes: not found` |
16:39:25 | FromDiscord | <mratsim> you just capture the continuation and go wild. |
16:39:59 | FromDiscord | <mratsim> await becomes "scheduler.enqueue continuation" |
16:40:05 | disruptek | right. it makes the job much simpler, which is why it's used in compilers, etc. |
16:40:32 | disruptek | narimiran: failure to find testes is usually a bad sign. |
16:40:43 | FromDiscord | <mratsim> git submodule? |
16:40:51 | narimiran | disruptek: nice one :) |
16:40:59 | narimiran | disruptek: should i just change the testing command to something like `nim c -r tests/many.nim` and call it a day? |
16:41:21 | disruptek | i wouldn't worry about fixing criterion. |
16:41:32 | disruptek | it's more important to fix the ci so it builds dependencies. |
16:42:06 | disruptek | i think many is too long a test, also. i made the tests faster recently. |
16:42:45 | disruptek | mratsim: how is your effort coming along so far? |
16:43:38 | FromDiscord | <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:04 | FromDiscord | <mratsim> I have a good idea of what should work as the public API. |
16:44:20 | disruptek | ah, i knew you would do that. i think it's a mistake, though. |
16:44:22 | FromDiscord | <mratsim> so now I'm looking to change environment.nim, to add the union trick |
16:44:39 | disruptek | but let's see what you come up with, first. |
16:45:57 | FromDiscord | <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:46 | FromDiscord | <mratsim> level not novel |
16:46:58 | disruptek | i /think/ the current code /does/ work without new inheritance levels. |
16:47:46 | disruptek | i would try not to remove it in your first go-round. |
16:48:22 | FromDiscord | <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:22 | disruptek | the original idea was that we could do conversion and extension of extant types to optimize memory consumption. |
16:48:28 | disruptek | good. |
16:49:16 | FromDiscord | <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:34 | FromDiscord | <mratsim> so your technique would likely save copies but not memory. |
16:50:04 | disruptek | yes, and this made more sense before we switched to typed. |
16:50:40 | disruptek | also, growth is still a thing... |
16:50:44 | FromDiscord | <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:39 | FromDiscord | <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:55 | disruptek | you're not wrong. |
16:51:57 | FromDiscord | <mratsim> anyway, going back to the battlefield. |
16:54:49 | FromDiscord | <Clyybber> disruptek: The CI does nimble install -y --depsOnly |
16:55:05 | disruptek | so it's merely a path issue. |
16:56:27 | FromDiscord | <Clyybber> disruptek: We might untype the AST ourselves for now. Until the compiler is fixed |
16:56:46 | disruptek | it's starting to look like we'll have to. |
16:56:48 | FromDiscord | <Clyybber> Basically replace each NimNode with a new one, so as to set the .typ to nil |
16:57:10 | disruptek | do we preserve hiddens? |
16:57:19 | disruptek | we should elide them, no? |
16:57:37 | FromDiscord | <Clyybber> I have a patch to remove them for cps |
16:57:46 | FromDiscord | <Clyybber> but its no use without stripping .typ |
16:57:54 | FromDiscord | <Clyybber> and not sure if it pops up in cps anyways |
16:58:14 | FromDiscord | <Clyybber> I do it in the normalizeAst step or whatever its called |
16:58:28 | disruptek | nice. |
16:58:48 | disruptek | i have a bad arc crash on windows. |
16:58:56 | disruptek | not sure what to do with it. |
16:58:57 | FromDiscord | <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:59 | disruptek | it's my bloom filter. |
16:59:19 | FromDiscord | <Clyybber> find yourself a windows user |
16:59:32 | disruptek | eh... i hate those. |
17:00:13 | ForumUpdaterBot | New thread by Jiyinyiyong: Compiling to js but failed, generics not supported?, see https://forum.nim-lang.org/t/7297 |
17:00:30 | disruptek | it's a little embarrassing that araq uses windows. |
17:31:36 | Zevv | if he didnt, windows support for nim would be naught |
17:38:30 | FromDiscord | <acek7> Sup |
17:41:29 | * | abm joined #nim |
17:43:45 | FromDiscord | <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:55 | disruptek | yes. |
17:44:28 | Zevv | why do we have submodules |
17:44:36 | * | l1x quit (Quit: Connection closed for inactivity) |
17:44:37 | Zevv | cps needs no deps |
17:44:47 | FromDiscord | <Clyybber> because disruptek needs his testes |
17:44:51 | Zevv | sigh |
17:44:55 | disruptek | i'm rather attached to them. |
17:44:57 | FromDiscord | <Clyybber> sigh |
17:45:08 | Zevv | zevv the nodeps man |
17:45:15 | disruptek | we don't use the submodules. |
17:45:16 | FromDiscord | <Clyybber> disruptek: Sounds like the dependency should be reversed |
17:45:37 | disruptek | my testes should require cps? ๐ค |
17:45:56 | Zevv | everybody requires cps |
17:45:58 | FromDiscord | <Clyybber> testes should be attached to you, not the other way around |
17:46:02 | Zevv | they just dont know that yet |
17:46:24 | disruptek | remember king missile's /detachable penis/ tune? |
17:46:50 | disruptek | or was that the butthole surfers. |
17:47:12 | disruptek | https://www.youtube.com/watch?v=byDiILrNbM4 |
17:47:42 | Zevv | disruptek: 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:42 | FromDiscord | <Clyybber> I woke up this morning with a bad repo |
17:47:45 | Zevv | you can do it buddy |
17:47:57 | Zevv | just sit on your hands before you type |
17:48:03 | FromDiscord | <Clyybber> my submodule was missing again |
17:50:31 | Zevv | so i didnt read up this morning, how will mratsim put non ref conts of diffent types in one scheduler? |
17:50:55 | disruptek | did he say he would do such a thing? |
17:51:18 | Zevv | we said he would do such a thing |
17:51:26 | Fish-Face | Zevv: did you ever solve AoC 19.2 with npeg? |
17:51:36 | Zevv | nope, greedyness |
17:51:56 | Zevv | guess it should be possible, but i got terribly lazy, aoc wise, this year |
17:52:13 | Fish-Face | I thought I came up with a way to do it with a PEG, but npeg is looping on my translated input! |
17:52:44 | Fish-Face | not 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:57 | Zevv | even i couldnt. part of the reason i gave up |
17:53:03 | Zevv | the aaabbabababbaaab made my eyes bleed |
17:53:06 | Fish-Face | yeah |
17:53:23 | Zevv | what typically happens is that you try to match something of length 0 |
17:53:25 | Zevv | like * * 1 |
17:53:38 | Zevv | theres some safe guards in npeg to detect that at compile time, but it doesnt catch it all |
17:53:50 | Zevv | so it will happily match nothing, and then do it again and again |
17:54:10 | Fish-Face | it's not that, it's backtracking to the same place I think |
17:55:43 | Zevv | still the same thing, prbly |
17:56:36 | * | Zevv quit (Quit: Lost terminal) |
17:57:00 | * | Zevv joined #nim |
17:57:02 | Zevv | lua lpeg has a better verification for that, maybe I should look into that one day |
17:57:20 | * | MarderIII quit (Quit: Leaving) |
17:59:45 | Fish-Face | OK my idea did work though (I switched back to `pegs`) |
18:00:09 | Fish-Face | well that task was very annoying |
18:00:18 | Fish-Face | but I learned something about parsers and pegs in particular |
18:02:51 | disruptek | i don't understand how someone can steal my asd nick when it's registered to my freenode account. |
18:05:03 | Zevv | Fish-Face: sorry to hear npeg let you down |
18:05:18 | Zevv | it let me down as well on 19b, so thats that |
18:05:21 | Fish-Face | haha |
18:05:34 | Zevv | time to neglegt and then abandon that stuff |
18:05:35 | Fish-Face | blame that guy Ford who invented PEG |
18:05:59 | FromDiscord | <Clyybber> disruptek: are the travis badges still there on purpose (nimph) |
18:06:07 | Zevv | yeah ford sucks a big time |
18:06:18 | disruptek | clyybber: i'm working on a new ci branch. |
18:06:25 | FromDiscord | <Clyybber> ah cool |
18:06:48 | Zevv | a 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:31 | Fish-Face | hehehe |
18:07:46 | Zevv | i just point to Ierusalimschy. Same kind of guy as Ford |
18:07:51 | Zevv | terrible, horrible people |
18:08:23 | Fish-Face | I 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:39 | Zevv | also 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:43 | Fish-Face | then I was like "that doesn't even look like a valid grammar, I don't think I can still it" |
18:08:46 | Zevv | cool thanks |
18:08:53 | Fish-Face | steal* |
18:08:59 | Zevv | for me 19b didt spin, but it just gave the wrong answers |
18:09:13 | Zevv | lemme check if i have the code around |
18:09:28 | Zevv | 9 |
18:09:29 | FromDiscord | <Skippy> a quick question: How do I multiple conditions in an if statement pseudo code if a = b and a <10: |
18:09:44 | disruptek | lgtm |
18:09:58 | Fish-Face | prediction: it's either an obvious error in my grammar, or a bug in npeg that will take hours to track down ;) |
18:10:17 | Fish-Face | huh. What I have at the moment crashes with `-d:danger`, how exciting |
18:11:40 | Fish-Face | Zevv: https://github.com/fish-face/AoC2020/tree/master/19 |
18:12:23 | Zevv | can always be a bug, but with npeg I have something that never happened in my life before |
18:12:34 | Zevv | I got 0 (zero!) bugs reported on npeg up to now |
18:12:40 | Zevv | which makes me pretty suspicious |
18:12:43 | Zevv | http://ix.io/2K1t |
18:12:45 | Zevv | here's my grammar |
18:13:47 | Zevv | you're doing funky stuff with lookaheads |
18:13:47 | Zevv | why |
18:13:50 | disruptek | nah, i reported a bug. |
18:13:57 | Zevv | and *was* it a bug |
18:13:59 | Zevv | or just a report |
18:14:12 | disruptek | capture indices off-by-one. |
18:14:16 | mipri | one of your char classes was wrong, a long time ago. |
18:14:22 | Zevv | pfff |
18:14:25 | Zevv | you guys are no fun |
18:14:29 | disruptek | heh |
18:14:49 | Zevv | let me find those in github |
18:15:21 | Zevv | yeah the graph class, true. Was also an off-by-one |
18:15:22 | Zevv | ha |
18:15:30 | Zevv | well, *no* other bugs then off-by-ones then |
18:15:37 | Zevv | damn |
18:16:05 | FromDiscord | <Clyybber> @Skippy Change your = to == |
18:16:13 | Fish-Face | Zevv: it will spin without lookaheads |
18:16:27 | Fish-Face | the lookaheads are to make use of PEGs' limited backtracking |
18:16:30 | disruptek | clyybber: it's pseudocode. ๐ |
18:16:48 | FromDiscord | <Clyybber> true, but you wouldn't ask how to pseudocode |
18:16:54 | FromDiscord | <Clyybber> or would you? |
18:17:10 | disruptek | you know me too well. |
18:17:25 | Fish-Face | in 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:42 | Fish-Face | the lookaheads in the npeg thing might be wrong (the ones in the main file are correct though) |
18:18:06 | Zevv | ok, cool, thanks |
18:18:13 | Zevv | I hope I can find the courage to get into this |
18:18:29 | Zevv | I'm tempted to answer "can you please provide a minimal reproducing example" |
18:18:34 | Fish-Face | ha |
18:18:35 | Fish-Face | hahahaha |
18:19:06 | Fish-Face | I mean the alphabet literally has only two characters, how much more minimal do you want?? |
18:19:13 | disruptek | one character. |
18:25:46 | Zevv | less rules would help :) |
18:26:14 | FromDiscord | <Clyybber> porting template heavy Cpp code is kinda satisfying |
18:26:35 | FromDiscord | <Clyybber> when the useless abstractions collapse that is |
18:27:35 | Fish-Face | Zevv: I know, I'm kidding :P |
18:28:09 | Fish-Face | but yeah, the Lark parser I used in the python solution uses Earley, i.e. CFG semantics, not PEG. |
18:29:30 | ForumUpdaterBot | New 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:51 | FromDiscord | <Skippy> @Clyybber that example was pseudo code, is there a way of doing AND condition? |
18:30:14 | FromDiscord | <haxscramper> `if a == b and a <10:` |
18:30:15 | FromDiscord | <Clyybber> just do and :) |
18:30:43 | FromDiscord | <Skippy> @haxscramper thanks, for some reason it wasn't working before i was using & |
18:30:45 | FromDiscord | <haxscramper> Literally just that. Well, with `a < 10` |
18:31:04 | FromDiscord | <Skippy> the nim by example doesn't have an and example :S |
18:32:46 | FromDiscord | <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:02 | Araq | wb saem |
18:52:03 | * | krux02 quit (Remote host closed the connection) |
18:52:25 | saem | Thanks, Araq. |
18:59:57 | * | Arrrrrrrr quit (Read error: Connection reset by peer) |
19:02:46 | * | Arrrrrrrr joined #nim |
19:16:41 | saem | Just skimmed Nimporter source and that feels like more than I'm willing to sign up for now. :D |
19:17:09 | Araq | yeah, we need you for nimsuggest and the VS plugin |
19:17:44 | saem | Yup, I just want enough so I can inspect what's happening in nimsuggest. |
19:18:05 | Araq | well it's in suggest.nim |
19:18:15 | Araq | but you already know |
19:20:23 | saem | Yeah, 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:20 | saem | I'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:42 | Araq | what do you want to know? |
19:23:56 | saem | I'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:55 | saem | I thought I had stumbled upon it a while back, but I can't seem to retrace my steps. |
19:25:07 | Araq | the definition of magic: "LengthArray" |
19:25:17 | Araq | is the enum value mLengthArray in the compiler |
19:25:41 | Araq | there is nothing to "jump" to. |
19:26:02 | Araq | you cannot jump to C's 'int' keyword either. nobody ever noticed. |
19:26:40 | Araq | maybe I shouldn't have called it "magic", not much is really going on |
19:27:24 | saem | I 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:38 | FromDiscord | <Deleted User 5bd78114> Sorry to interrupt, but out of pure curiosity, are there `goto` statements in Nim? Preferably like `goto "labelName"` |
19:27:52 | FromDiscord | <Deleted User 5bd78114> Or maybe if there's a lib for it |
19:28:01 | Araq | you can use 'break labelHere' |
19:28:25 | Araq | or use the "relooper" algorithm |
19:28:50 | FromDiscord | <Deleted User 5bd78114> Oh? I'm assuming this'll be in the docs, right? |
19:29:04 | saem | Neat question, is a labeled block another variant? |
19:29:31 | Araq | '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:51 | Araq | saem, seraching for m* works well but isn't all that interesting |
19:33:07 | Araq | but sure, do it |
19:33:36 | saem | seems like procs with names getMagic, createMagic, etc... demystify it. |
19:34:14 | * | habamax quit (Ping timeout: 272 seconds) |
19:34:51 | Araq | it's a builtin. much like Nim's 'if' statement |
19:35:21 | Araq | the 'if' statement doesn't have a single implementation, all the compiler passes need to understand and handle it |
19:35:36 | Araq | and the codegen needs to map it to a C 'if' statement. |
19:37:51 | FromDiscord | <Deleted User 5bd78114> sent a code paste, see https://play.nim-lang.org/#ix=2K1N |
19:38:21 | Araq | don't use 'setjmp' |
19:38:24 | FromDiscord | <Deleted User 5bd78114> I'm assuming something like this night confuse the compiler? |
19:38:35 | Araq | yeah |
19:38:43 | FromDiscord | <Deleted User 5bd78114> Yeah, I figured |
19:38:46 | FromDiscord | <Deleted User 5bd78114> Thanks! |
19:53:49 | saem | Wondering 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:56 | Zevv | disruptek: where's tbloom.nim |
19:57:11 | disruptek | https://github.com/disruptek/bloom |
19:57:38 | Zevv | no tbloom.nim in there |
19:57:43 | disruptek | tests/test.nim |
19:57:56 | disruptek | you can rename it if you want it to be called `tbloom.nim`. |
19:58:04 | Zevv | you said it was called tbloom.nim |
19:58:15 | disruptek | that was /then/, big guy. |
19:58:22 | Zevv | tsss |
19:58:23 | disruptek | i'm tired of looking at red on my dashboard. |
19:59:02 | Zevv | all I get are green squares |
20:00:07 | Zevv | pff your stuff is broken, it just crashes for me |
20:00:42 | disruptek | are you on a windows machine? |
20:01:00 | Zevv | ain't got none |
20:01:02 | Zevv | mingwing |
20:02:05 | Zevv | yeah funny, linux all is ok, valgrind thinks you're great too |
20:02:09 | Zevv | and mingw goes boom |
20:02:30 | FromDiscord | <Meowz> God I love nimpy. Awesome project. |
20:03:23 | FromDiscord | <Meowz> Once it will extract nim types to python classes its just perfect. |
20:03:26 | disruptek | zevv: did my testes break it again? |
20:04:05 | Zevv | i know nothing. I was just seeing if winedbg would bring soemthing new |
20:04:36 | disruptek | hmmph. |
20:04:44 | Zevv | stack overflow |
20:04:47 | Zevv | is what it sais |
20:04:54 | Zevv | could it be so simple, not enough stack on windows? |
20:05:21 | disruptek | only under arc? |
20:06:00 | Zevv | nim c -d:mingw --gc:arc --passL:"-Wl,--stack,4194304" tbloom.nim |
20:06:01 | Zevv | fixes it |
20:06:23 | disruptek | it's 8-9mb. |
20:06:47 | disruptek | thanks for debugging it. |
20:06:57 | disruptek | you almost make me want to install mingw. |
20:07:19 | Zevv | apt-get install mingw |
20:07:20 | Zevv | is that hard? |
20:07:42 | disruptek | gentoo, and, no, it's not hard, it's a matter of principle. |
20:07:52 | Zevv | whiner |
20:08:30 | Zevv | the magic size is about 3250000, bored of bisecting now |
20:09:13 | disruptek | i guess this is a bug in my test and not really something nim should worry about. |
20:16:45 | disruptek | i'm such an idiot. |
20:17:00 | disruptek | i put the filter on the heap and not the data. ๐ |
20:26:00 | disruptek | i guess that doesn't solve it, either. |
20:29:50 | FromDiscord | <Deleted User 5bd78114> I sucks that choosenim don't work on arm- |
20:30:08 | disruptek | ~gitnim |
20:30:09 | disbot | gitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek |
20:35:22 | disruptek | mratsim: # TODO: this require var foo: FooType = something which is not ergonomic ... no. |
20:35:45 | disruptek | we are literally working around that requirement in that statement. |
20:36:21 | disruptek | or maybe someone else wrote that comment. ๐ |
20:38:01 | disruptek | i 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:31 | FromGitter | <bung87> `git nim` what does it means `nim` following `git` ? |
20:41:44 | FromDiscord | <Clyybber> @timotheecour I gotta ask; why do you wrap every snippet inside `when true:` ๐ ? |
20:43:10 | FromGitter | <bung87> for future add conditions that dont touch indent ? |
20:44:19 | FromDiscord | <ElegantBeef> Its for making people ask the question |
20:45:43 | * | hnOsmium0001 joined #nim |
20:46:32 | FromGitter | <bung87> good one |
20:47:25 | FromDiscord | <shadow.> @ElegantBeef |
20:47:28 | FromDiscord | <shadow.> my nim is still poopooing |
20:47:32 | FromDiscord | <shadow.> how do i check hash lol |
20:47:37 | FromDiscord | <ElegantBeef> nim -v |
20:47:42 | FromDiscord | <shadow.> fbc8a40c7a351ff7c0f2dc0608bc8926f89d8537 |
20:47:53 | FromDiscord | <ElegantBeef> I'm more recent |
20:48:02 | FromDiscord | <ElegantBeef> But still just try stable to see if it's not your pc |
20:48:10 | FromDiscord | <shadow.> i just did `choosenim update devel --latest` like 5 mins ago lmao |
20:48:24 | FromDiscord | <shadow.> wait a min `active boot switches: -d:release` what does that mean- |
20:50:25 | FromDiscord | <ElegantBeef> What it was built with |
20:50:40 | FromDiscord | <shadow.> choosenim? |
20:50:44 | FromDiscord | <shadow.> or do you mean something other than that |
20:50:50 | FromDiscord | <shadow.> ill try stable rq |
20:50:59 | FromDiscord | <shadow.> but my lovely scantuple... |
20:51:39 | FromDiscord | <ElegantBeef> I mean try stable to see if it works, if it still doesnt, question life |
20:51:45 | FromDiscord | <shadow.> same issue on stable |
20:51:48 | FromDiscord | <shadow.> life is being questioned |
21:02:34 | * | narimiran quit (Ping timeout: 260 seconds) |
21:08:44 | ForumUpdaterBot | New thread by 19: Problem with sdl2 & nim, see https://forum.nim-lang.org/t/7298 |
21:16:59 | FromDiscord | <Daniel> is kitlang some sort of a clone of nim? |
21:19:54 | FromDiscord | <ElegantBeef> Nope |
21:22:28 | FromDiscord | <Daniel> Why is NIM slower than C almost 9 times here?:โตhttps://vlang.io/compilation_speed |
21:24:09 | FromDiscord | <Recruit_main707> nim's first compilation is always considerably slower |
21:24:21 | FromDiscord | <Recruit_main707> second and next ones are much faster |
21:24:32 | FromDiscord | <ElegantBeef> It's also many lines, and V isnt really to be trusted |
21:24:39 | FromDiscord | <ElegantBeef> It's a dumpster fire of a language |
21:25:06 | FromDiscord | <Recruit_main707> id like that program yeah, although, can v's compiler stay up for a month? |
21:25:07 | FromDiscord | <ElegantBeef> When the test is compilation of 200,000 echos |
21:26:11 | FromDiscord | <Daniel> I accidentally found that website by googling "nim vs zig", its interesting google thinks its important. |
21:26:50 | FromDiscord | <Daniel> https://media.discordapp.net/attachments/371759389889003532/792866104808701992/unknown.png |
21:27:09 | FromDiscord | <Recruit_main707> also, kinda sus nim and a few others dissapear in the second test |
21:27:18 | FromDiscord | <Recruit_main707> even v does |
21:30:02 | FromDiscord | <Quibono> @Daniel Way to mention a new programming language I have to look up. |
21:34:01 | FromDiscord | <ElegantBeef> Let's mention that V touted themselves as a GCless ARCless language which just leaked instead of worrying about memory |
21:35:04 | FromGitter | <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:03 | FromDiscord | <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:14 | FromDiscord | <ElegantBeef> Yea |
21:36:40 | FromDiscord | <ElegantBeef> Not saying Nim's compile time isnt slow, replicated their example and it's taking sometime to compile |
21:37:06 | FromDiscord | <ElegantBeef> But pretty shitty example imo |
21:42:37 | disruptek | i have a bad feeling about this. |
21:43:15 | FromDiscord | <ElegantBeef> Shit is this a starwars episode? |
21:43:25 | FromDiscord | <lqdev> remember that time when the supposed release date of V 1.0 was December 2019? |
21:43:32 | FromDiscord | <lqdev> holy shit they released 0.2 a couple days ago |
21:43:47 | disruptek | it must be june 2019. |
21:43:52 | FromDiscord | <lqdev> you know, that version that was promised to be ready in December 2019. |
21:43:59 | FromDiscord | <lqdev> wait a second |
21:44:04 | disruptek | which is weird, because it's snowing pretty heavy outside. |
21:50:23 | FromGitter | <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:23 | FromGitter | ... super-linearity and avoid regressions in compile times |
21:50:24 | disbot | โฅ add a benchmark (to run manually) to test compilation speed in several settings |
21:52:59 | planetis[m] | you know the thing about benchmarking, they just look for corner cases that they are faster at |
21:53:12 | planetis[m] | benchmarking is bs imo |
21:53:52 | FromDiscord | <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:37 | FromDiscord | <ElegantBeef> Benchmarking unrealistic situations is purposely unreallistic |
21:55:02 | FromGitter | <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:15 | FromDiscord | <ElegantBeef> I do wonder if there is any amount of purpose built code for this example for them |
22:00:27 | FromDiscord | <ElegantBeef> Just weird that they rely on a C compiler still, but somehow beat C |
22:01:44 | FromDiscord | <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:01 | FromDiscord | <Recruit_main707> can you get the pragmas applied to typed object |
22:05:14 | disruptek | yes. |
22:09:40 | FromDiscord | <shadow.> `let (_, first, second, dist) = line.scanTuple "$w to $w = $i"` |
22:09:42 | FromDiscord | <shadow.> used scantuple again |
22:09:42 | FromDiscord | <ElegantBeef> Oh hey tcc took 22s to compile the 400 k loc macro |
22:09:42 | FromDiscord | <shadow.> lol |
22:11:22 | FromDiscord | <ElegantBeef> Nice, glad to hear someone likes it ๐ |
22:17:16 | * | disruptek throbs. |
22:19:39 | FromDiscord | <ElegantBeef> Disruptek you really need to get health insurance to get that throbbing checked out |
22:20:31 | disruptek | there'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:39 | FromDiscord | <Deleted User 5bd78114> What's TCC? |
22:26:59 | FromGitter | <timotheecour> tiny c compiler |
22:27:17 | FromDiscord | <ElegantBeef> tiny c compiler, compiles faster than GCC but with less optimized code |
22:27:52 | FromDiscord | <Deleted User 5bd78114> Oh |
22:28:03 | qwr | it is single-pass, so yes, only peep-hole optimizations afaik |
22:28:14 | FromDiscord | <Deleted User 5bd78114> Nice |
22:28:23 | disruptek | yeah, it's pretty kinky. |
22:29:48 | * | Arrrrrrrr quit (Remote host closed the connection) |
22:34:01 | FromDiscord | <Deleted User 5bd78114> Are there any compilers that produce faster binaries then gcc? |
22:35:31 | mipri | clang 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:45 | FromDiscord | <Deleted User 5bd78114> Huh |
22:37:12 | FromDiscord | <Deleted User 5bd78114> Also, what is LLVM code used for? I don't quite understand it exactly |
22:37:22 | FromDiscord | <Deleted User 5bd78114> I know Clang emits LLVM |
22:37:39 | FromDiscord | <Deleted User 5bd78114> (edit) "Also, what is ... LLVM" added "code compiled with" | removed "code" |
22:37:42 | mipri | clang uses LLVM. clang emits the same shit gcc does. |
22:38:06 | FromDiscord | <Deleted User 5bd78114> So then why does llvm matter? |
22:38:12 | FromDiscord | <ElegantBeef> LLVM is a backend similar to what Nim uses C for |
22:38:27 | FromDiscord | <ElegantBeef> It gives you a compilation method for all the platforms llvm supports |
22:38:35 | mipri | it's different, so it manages to be better in some cases. |
22:39:43 | FromDiscord | <Deleted User 5bd78114> Oh? That's cool! |
22:40:50 | mipri | the 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:52 | FromDiscord | <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:08 | FromDiscord | <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:46 | FromDiscord | <mratsim> @zevv, @disruptek, it's aaaaaalliiiiivvveeeeeee!!! https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex03_echoing_truths.nim |
22:46:59 | FromDiscord | <mratsim> It's super hacky underneath but who cares. |
22:47:56 | FromDiscord | <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:35 | FromDiscord | <mratsim> only unknown I have is if casting a "ref object" to "ref object of RootObj" is safe. |
22:48:46 | FromDiscord | <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:45 | FromDiscord | <mratsim> @Deleted User 5bd78114 there is a goto with label hidden behind the {.goto.} pragma and labels must be enums |
22:56:47 | Zevv | so mratsim |
22:56:49 | Zevv | what did you do |
22:57:14 | Zevv | that we didn't do already |
22:57:36 | Zevv | quite a lot |
22:58:44 | mipri | https://play.nim-lang.org/#ix=2K2N - I wouldn't think it's safe since there has to be extra runtime information |
22:58:59 | FromDiscord | <lqdev> @mratsim โต> # how to enforce moves?โตmaybe try marking the continuation's `=copy` with {.error.} |
22:59:07 | mipri | output: 1 8 |
22:59:07 | FromDiscord | <mratsim> I monkey patched here and there around the codebase |
22:59:12 | FromDiscord | <lqdev> idk how it works under the hood tho and how feasible it is |
22:59:20 | FromDiscord | <mratsim> doesn't work with concepts |
22:59:36 | FromDiscord | <mratsim> @lqdev |
22:59:41 | FromDiscord | <lqdev> ah |
22:59:50 | FromDiscord | <mratsim> having internet only on poor 3G is hell :/ |
23:00:33 | Zevv | mratsim: i was just about to brush my teeth |
23:00:39 | Zevv | will dive in tomorrow! |
23:01:10 | FromDiscord | <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:59 | mipri | https://nim-lang.org/docs/manual.html#types-enumeration-types |
23:02:00 | * | krux02 joined #nim |
23:02:01 | FromDiscord | <lqdev> how did you miss enums :p |
23:03:55 | FromDiscord | <Deleted User 5bd78114> Thanks :p |
23:05:10 | FromDiscord | <mratsim> the goto is undocumented though |
23:05:22 | FromDiscord | <mratsim> there is a post of Jehan in the forum that shows it |
23:05:33 | FromDiscord | <mratsim> and Synthesis use it extensively for state machines |
23:05:39 | FromDiscord | <mratsim> !repo synthesis |
23:05:39 | disbot | https://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:18 | FromDiscord | <mratsim> look into the "synthesis" proc. You can use "expandMacros" on the example to see the codegen |
23:09:52 | FromDiscord | <Deleted User 5bd78114> Thanks! |
23:32:32 | FromDiscord | <Deleted User 5bd78114> Is it possible to make Nim execute raw binary data? |
23:32:47 | disruptek | of course. |
23:33:39 | FromDiscord | <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:02 | FromDiscord | <Deleted User 5bd78114> Maybe writing it to /tmp and using that |
23:34:28 | FromDiscord | <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:43 | FromDiscord | <ElegantBeef> memfiles exists |
23:34:46 | FromDiscord | <mratsim> you can interpret data as code. |
23:35:39 | FromDiscord | <mratsim> look into photo-jit, you need to manipulate memprotect |
23:35:50 | mipri | I 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:54 | FromDiscord | <mratsim> !repo photon-jit |
23:35:55 | disbot | https://github.com/mratsim/photon-jit -- 9photon-jit: 11A low-overhead JIT assembler for Nim 15 13โญ 0๐ด |
23:35:57 | FromDiscord | <Deleted User 5bd78114> Oh, okay, thanks! |
23:36:21 | FromDiscord | <Deleted User 5bd78114> What's nim r? |
23:36:48 | mipri | it's like nim c -r, but without dropping the binary in the current directory. |
23:37:43 | mipri | it's written to an appropriate cache directory, and reused if the source hasn't changed. |
23:39:10 | FromDiscord | <ElegantBeef> Knowing nisha what they're asking about is if one could implement a JVM in Nim |
23:39:20 | disruptek | of course. |
23:39:23 | FromDiscord | <Deleted User 5bd78114> I'm wanting to do this with any binary |
23:39:26 | FromDiscord | <Deleted User 5bd78114> XD |
23:39:50 | FromDiscord | <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:13 | FromDiscord | <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:25 | FromDiscord | <Deleted User 5bd78114> (edit) "how" => "what" | removed "it" |
23:42:30 | mipri | and you're wanting to do this while being aware that there's no universal 'gcc' binary that works on all systems? |
23:43:28 | FromDiscord | <Deleted User 5bd78114> Yup |
23:43:45 | FromDiscord | <Deleted User 5bd78114> I warned you I'm insane- |
23:45:22 | * | lordofgibbons is now known as hypergibbon |
23:47:34 | FromDiscord | <Deleted User 5bd78114> Now I'm wondering if the amd64 binary and arm32 binary of gcc share even a few similar instructions- |
23:47:45 | disruptek | nope, they are /all/ new. |
23:47:50 | * | tane quit (Quit: Leaving) |
23:48:02 | FromDiscord | <Deleted User 5bd78114> Makes sense |
23:48:26 | FromDiscord | <Deleted User 5bd78114> How about 86 and 64 bit PCs? |
23:48:42 | disruptek | i've never seen an 86bit pc. |
23:49:18 | FromDiscord | <mratsim> floating point is 87 bit originally |
23:50:54 | Zevv | baaad refactoring mratsim |
23:51:04 | Zevv | you threw out all our commits, now all the code is yours :) |
23:51:19 | Zevv | I hoped that at least a *few* of my lines would survive all this \o/ |
23:53:35 | FromDiscord | <mratsim> what? I only threw mutant, well non-mutant |
23:53:35 | FromDiscord | <mratsim> the rest is moved and monkey patched |
23:53:50 | Zevv | nah just whining. I blamed core/transform.nim |
23:53:53 | FromDiscord | <mratsim> someone told me "go nut" also ๐ |
23:54:09 | Zevv | by all means, please do! :) |
23:54:26 | * | hypergibbon quit (Remote host closed the connection) |
23:54:27 | FromDiscord | <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:37 | FromDiscord | <mratsim> for now I only put things on top of the core and tried not too have to change the internals |
23:54:40 | FromDiscord | <sealmove> jason |
23:54:58 | Zevv | mratsim: core transform is also a bit hairy to jump in I guess |
23:55:12 | Zevv | I just ran your truth \o/ |
23:55:20 | disruptek | jason fails to serialize data? |
23:55:21 | Zevv | sealmove: did you try jason? |
23:55:41 | FromDiscord | <sealmove> yes, it doesn't compile either :| |
23:55:48 | disruptek | blame the compiler. |
23:55:54 | disruptek | use 1.4 compiler instead. |
23:56:13 | disruptek | it's a recent regression. |
23:56:29 | FromDiscord | <sealmove> I am using 1.4.2 |
23:56:44 | disruptek | can i have a repro? |
23:56:52 | FromDiscord | <sealmove> I'll try |
23:57:10 | FromDiscord | <sealmove> thanks |