00:03:51 | FromDiscord | <Quibono> Okay, figured out what it was/ |
00:10:59 | FromDiscord | <treeform> disruptek, should I add jason to my bench mark? |
00:11:02 | FromDiscord | <ElegantBeef> Someone make a jsparser for extracting the `name` of functions, arguements and if it returns objects π |
00:11:23 | FromDiscord | <ElegantBeef> Npeg is hard to understand π |
00:12:52 | FromDiscord | <Esbeesy> I've just done my own Npeg based on zevvs |
00:12:54 | FromDiscord | <Esbeesy> Since mine didn't work |
00:13:01 | FromDiscord | <Esbeesy> (edit) "mine" => "it" | "itdidn't work ... " added "for me" |
00:13:11 | FromDiscord | <Esbeesy> https://github.com/sambeckingham/advent-of-code-2020/blob/main/day4/day4npeg.nim |
00:13:18 | FromDiscord | <ElegantBeef> It's not like he has a "Js parser" laying about π |
00:25:40 | * | luis quit (Ping timeout: 246 seconds) |
00:36:21 | FromDiscord | <Cohjellah> Real talk. How do I get a C compiler onto Windows |
00:36:26 | FromDiscord | <Cohjellah> this seems unnecessarily complex |
00:37:14 | FromDiscord | <Avatarfighter> @fwsgonzo i can't remember but `cast[ByteAddress]addr(callback)` should give the address i think |
00:37:50 | FromDiscord | <Avatarfighter> (edit) "`cast[ByteAddress]addr(callback)`" => "`cast[ByteAddress](addr(callback))`" |
00:44:47 | FromDiscord | <fwsgonzo> This worked for me: `let farg = cast[ptr int](unsafeAddr(callback))[]` |
00:45:51 | FromDiscord | <Avatarfighter> idk why but what you wrote looks like it should be a crime π |
00:46:01 | FromDiscord | <Avatarfighter> im glad it works ahah |
00:46:08 | FromDiscord | <fwsgonzo> you should have seen the Rust startup code I wrote once then |
00:46:22 | FromDiscord | <fwsgonzo> "it doesn't look like Rust", I was told |
00:46:33 | FromDiscord | <fwsgonzo> but that's just what bare metal glue looks like all the time |
00:46:52 | FromDiscord | <Avatarfighter> rip |
00:47:02 | FromDiscord | <Avatarfighter> yeah that's exciting. |
00:47:05 | FromDiscord | <Avatarfighter> What are you working on?> |
00:47:09 | FromDiscord | <fwsgonzo> not that I'm assuming that my version of "getting the address of a function" is the best answer π |
00:48:37 | FromDiscord | <fwsgonzo> I'm trying to pass a function address from one VM to another. The storage I have at my disposal is 2 registers. And so, with that I can pass one trampoline function address, and another function that is just a regular nim function. The trampoline would call into Nim so that Nim thinks that everything is normal again. |
01:02:04 | FromDiscord | <shadow.> mingw64 comes with nim |
01:02:06 | FromDiscord | <shadow.> or 32 |
01:02:41 | FromDiscord | <Cohjellah> Cheers. Going to get WSL up |
01:10:40 | * | krux02 quit (Remote host closed the connection) |
01:15:23 | * | abm joined #nim |
01:20:17 | FromDiscord | <Quibono> How do I put a { in fmt without it thinking I'm trying to slip in a var? |
01:30:38 | FromDiscord | <Quibono> nvm |
01:44:17 | mipri | {{ is one char shorter than nvm yk |
01:44:27 | FromDiscord | <Cohjellah> So arrays are fixed. If I have the size of an array changing constantly do I use a list? |
01:44:38 | FromDiscord | <Cohjellah> Fixed length |
01:44:49 | mipri | use a seq instead |
01:45:21 | mipri | !eval echo [1,2,3].typeof |
01:45:24 | NimBot | array[0..2, int] |
01:45:28 | mipri | !eval echo @[1,2,3].typeof |
01:45:30 | NimBot | seq[int] |
01:45:49 | mipri | !eval var x = @[1,2]; x.add 3; echo x |
01:45:51 | NimBot | @[1, 2, 3] |
01:46:01 | FromDiscord | <Cohjellah> Rightio |
01:46:22 | FromDiscord | <Cohjellah> See I'm trying to do AoC and this is dead easy in Python, but in Nim I'm confused aye. Trying to do it in a python way |
01:47:51 | mipri | I've seen a lot of Python solutions that would translate pretty easily to Nim, main exception's list comprehension use. |
01:47:57 | * | Vladar quit (Quit: Leaving) |
01:48:16 | mipri | but if you do it in a Nim way you've got enums, which you can parseEnum into from a string, and you've got case statements |
01:48:25 | mipri | I've had a pretty easy time so far. Tonight it might finally get interesting |
01:54:50 | disruptek | i've been saying that for the last 4 months. |
01:55:44 | disruptek | treeform: yeah. |
01:56:20 | disruptek | i put flatty in a frosty benchmark. |
01:56:31 | disruptek | i think it's published. |
02:02:53 | disruptek | fwsgonzo: is it working? |
02:04:21 | FromDiscord | <Rebel> disruptek glad to see you are back π |
02:04:59 | disruptek | sup dawg. |
02:05:37 | FromDiscord | <Rebel> Still working on that problem I described days ago π
been bogged down with other stuff but I know roughly what I need to do lol. |
02:05:47 | disruptek | use threads? |
02:05:52 | FromDiscord | <Rebel> Yes I plan to lol |
02:05:58 | disruptek | weird. |
02:05:58 | FromDiscord | <Rebel> I've seen the light |
02:06:09 | disruptek | am i dreaming? |
02:06:23 | FromDiscord | <Rebel> Look if you really want I could link it but my code has been roasted enough by dom π’ |
02:06:35 | disruptek | i'm good, thanks. i just ate. |
02:06:49 | FromDiscord | <Rebel> Ok it's not that bad lol |
02:07:03 | disruptek | well, let me tell you something about being old: |
02:07:11 | FromDiscord | <Rebel> Just a massive switch statement with modularity at the forefront guess I could have applied DRY more |
02:07:26 | disruptek | when you've eaten vomit even once, and even if it's your own vomit, you develop a certain distaste for the activity. |
02:07:30 | disruptek | so to speak. |
02:07:49 | FromDiscord | <Rebel> Oh shit did you get inspiration from the vomit cake? |
02:08:07 | disruptek | please. i never ate vomit cake. |
02:08:15 | disruptek | it was more of a stew. |
02:09:12 | FromDiscord | <Rebel> ohhhh |
02:09:14 | FromDiscord | <Rebel> it's a video lol |
02:09:17 | FromDiscord | <Rebel> papa franku |
02:09:35 | FromDiscord | <Rebel> Just watch the last one in the series (human cake) you can skip hair and vomit cake |
02:09:47 | disruptek | um, okay, thanks. |
02:09:53 | disruptek | how did i get so lucky... |
02:10:15 | FromDiscord | <Rebel> HOLY SHIT |
02:10:18 | FromDiscord | <Rebel> youtube actually removed it |
02:11:03 | FromDiscord | <Rebel> F you can only watch it in 360p of the reupload; although, there is probably an archive somewhere |
02:11:36 | disruptek | i like my vomit at 1080p. |
02:14:36 | FromDiscord | <Rebel> Any chance you know about quantum computing lol |
02:15:46 | disruptek | fwsgonzo: if you use methods, you could probably use the existing string-based dispatch. |
02:16:15 | disruptek | quantum vomit isn't a thing. yet. hmm, maybe i should register the domain just in case. |
02:18:35 | FromDiscord | <Rebel> I will show you in offtopic lol |
02:19:16 | FromDiscord | <treeform> disruptek, your branch mark animation is hard to read. I can't tell who is faster it animate too fast. |
02:19:23 | FromDiscord | <treeform> benchmark |
02:19:36 | disruptek | the benchmarks are in the test directory, iirc. |
02:19:59 | disruptek | i think flatty is faster for some writes and slower for some reads, which surprised me. |
02:20:10 | FromDiscord | <treeform> this animation: https://github.com/disruptek/frosty/blob/master/docs/bench.svg |
02:20:35 | disruptek | but also i think frosty does more work, which lets it support more structures. they aren't targetting the same thing. |
02:20:39 | FromDiscord | <Daniel> noob question.β΅What does export do? https://media.discordapp.net/attachments/371759389889003532/784605122042396723/unknown.png |
02:20:45 | FromDiscord | <Daniel> In nim docs i found this https://nim-lang.org/docs/manual.html#procedures-export-marker |
02:20:49 | disruptek | lets you use the symbol in an outside module. |
02:20:52 | FromDiscord | <Daniel> But i am not sure if thats the answer |
02:20:58 | disruptek | no, that's the answer. |
02:21:03 | FromDiscord | <treeform> disruptek, yeah I don't support case objects because I try not to use macros |
02:21:19 | disruptek | ahh, are there case objects in intsets? |
02:21:21 | FromDiscord | <treeform> case objects just seem to never work out for me |
02:21:25 | disruptek | i didn't even realize. |
02:21:31 | FromDiscord | <treeform> I don't know about intsets |
02:21:41 | FromDiscord | <treeform> i probably don't support sets |
02:21:45 | FromDiscord | <treeform> i should |
02:22:10 | FromDiscord | <Daniel> I still dont understand that export part....i know does exporting |
02:22:35 | disruptek | when you export a symbol, you make it available to scopes that /import/ the module in which the symbol is /exported/. |
02:23:21 | disruptek | treeform: frosty isn't fully optimal (copy-free) because i'm lazy, but it's pretty close. |
02:23:28 | FromDiscord | <Daniel> Yea, but what does he use on line 2 export all those modules, ....for example he imports jester, then in next line he export jester |
02:23:39 | disruptek | it needs cps to be finished. i think i mentioned that at least once today, though. sorry. |
02:23:40 | FromDiscord | <Daniel> (edit) "what" => "why" |
02:24:03 | disruptek | to make jester's symbols available to those who import /that/ module. |
02:24:23 | disruptek | it's just an irritation, if dom wrote it, or it's genius if i wrote it. |
02:24:57 | disruptek | fighter: where is my svg for nigel? |
02:26:33 | FromDiscord | <shadow.> @mipri you can always use comprehension or sugar collect |
02:27:04 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GFr |
02:27:19 | FromDiscord | <shadow.> (edit) "https://play.nim-lang.org/#ix=2GFr" => "https://play.nim-lang.org/#ix=2GFs" |
02:27:43 | FromDiscord | <shadow.> (edit) "https://play.nim-lang.org/#ix=2GFs" => "https://play.nim-lang.org/#ix=2GFt" |
02:29:15 | disruptek | treeform: i slowed down the benchmark for ya. |
02:30:03 | FromDiscord | <treeform> why is it even an animation? give table or list |
02:30:24 | FromDiscord | <treeform> i'll get my own frosty benchmarks soon |
02:30:35 | disruptek | i dunno how to automate it. |
02:30:59 | disruptek | i mean, automate embedding it in the readme. it's... annoying to do markup. |
02:31:21 | disruptek | i could make it static, i guess. |
02:31:56 | disruptek | it works like this because it's copied from other projects that feature longer benchmarks, like jason. |
02:32:43 | disruptek | treeform: get to feature parity and then we can really compete. |
02:33:26 | FromDiscord | <treeform> I am just giving feed back, if you like the animation dont change it |
02:33:46 | FromDiscord | <Quibono> Would it be weird to have a separate file for just types? I can't for the life of me decide how Nim projects should get formatted. |
02:34:03 | FromDiscord | <treeform> I usually have a common file with all my types and common procs. |
02:34:11 | FromDiscord | <treeform> then all the other files build on that |
02:34:34 | FromDiscord | <Quibono> So shared stuff, then specific files for specific stuff, and a main file? |
02:35:22 | FromDiscord | <shadow.> hmm nimble sure is taking long to install frosty |
02:35:27 | FromDiscord | <shadow.> if only i had some amazing new package manager |
02:35:30 | FromDiscord | <shadow.> made by disruptek |
02:35:32 | FromDiscord | <shadow.> starting with an n |
02:35:38 | FromDiscord | <shadow.> i should probably go install that... |
02:42:18 | * | Ekho quit (Ping timeout: 244 seconds) |
02:43:54 | FromDiscord | <Avatarfighter> tf |
02:44:03 | FromDiscord | <Avatarfighter> disruptek has a package? |
02:44:12 | FromDiscord | <Avatarfighter> disruptek: what you packin' |
02:44:43 | * | Ekho joined #nim |
02:44:51 | FromDiscord | <exelotl> @Daniel if module foo exports jester, then when I import foo I can use everything from jester without having to explicitly import jester. |
02:47:06 | FromDiscord | <exelotl> in other words, the export marker `` lets you export symbols that are defined in the current module, but the `export` keyword lets you export symbols that are defined in other modules |
02:47:44 | FromDiscord | <exelotl> see: https://nim-lang.org/docs/manual.html#modules-export-statement |
03:02:01 | * | casaca quit (Remote host closed the connection) |
03:09:06 | * | abm quit (Quit: Leaving) |
03:13:18 | * | ee7[m] quit (*.net *.split) |
03:13:19 | * | Clonkk[m] quit (*.net *.split) |
03:13:20 | * | planetis[m] quit (*.net *.split) |
03:13:22 | * | rayman22201 quit (*.net *.split) |
03:13:22 | * | nikki93 quit (*.net *.split) |
03:13:24 | * | mipri quit (*.net *.split) |
03:18:43 | * | ee7[m] joined #nim |
03:18:43 | * | Clonkk[m] joined #nim |
03:18:43 | * | planetis[m] joined #nim |
03:18:43 | * | rayman22201 joined #nim |
03:18:43 | * | nikki93 joined #nim |
03:18:43 | * | mipri joined #nim |
03:19:01 | * | casaca joined #nim |
03:20:12 | FromDiscord | <Daniel> i thought does pretty much everything when it comes to exporting, this seems more complicated, my system2 sees spaghetti |
03:21:11 | FromDiscord | <ElegantBeef> And i checked `import module` will not be accepted π |
03:21:45 | FromDiscord | <ElegantBeef> It's nicer than making a macro for `importExport module`, but alas |
03:30:50 | FromDiscord | <Rika> Why not |
03:31:01 | FromDiscord | <Rika> Spec issues? |
03:36:33 | FromDiscord | <ElegantBeef> More that didnt want to make macros have to support yet another derivation |
03:36:41 | FromDiscord | <ElegantBeef> And it already supports it |
03:37:05 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/RFCs/issues/282 |
03:37:06 | disbot | β₯ Less Redundant Import/Export ; snippet at 12https://play.nim-lang.org/#ix=2Dx2 |
03:45:49 | Prestige | Beef: I'd also like that feature tbh |
03:47:12 | FromDiscord | <ElegantBeef> Well the suggestion as you can see is to make a macro and import it π |
03:47:32 | FromDiscord | <ElegantBeef> So maybe we can make a macro and petition for it to be in the system stdlib? π |
03:48:02 | Prestige | I'd like that. Having a way to automatically export would be so nice |
03:48:13 | FromDiscord | <ElegantBeef> Yea but what do we name it? |
03:49:01 | FromDiscord | <ElegantBeef> `expose` `exImport` `share` |
03:49:15 | Prestige | i was going to say expose |
03:50:20 | Prestige | or maybe includePublic, or similar |
03:50:23 | FromDiscord | <Daniel> just using asterisk would make more logic to my brain |
03:50:37 | FromDiscord | <ElegantBeef> Yea but the boss dislikes it |
03:50:48 | FromDiscord | <Daniel> using import export one after another turns my brain into mush |
03:51:12 | FromDiscord | <ElegantBeef> Well i dont like it either but `share/expose` isnt too bad |
03:51:17 | FromDiscord | <Daniel> i have a small brain tho, as many other ppl |
03:51:42 | Prestige | integrate :P |
03:51:59 | Prestige | should get the most buzzword type of word possible. Lol |
03:52:35 | FromDiscord | <Daniel> in any case, for a newcomer this current concept is very confusing, it is just not intuitive as it should be |
03:52:35 | Prestige | oh what about, sharedImport? |
03:52:53 | FromDiscord | <Daniel> (edit) "in any case, for a newcomer this current ... concept" added "import/export" |
03:53:53 | Prestige | I'm liking sharedImport a lot, Beef. Up to you, though |
03:54:10 | FromDiscord | <ElegantBeef> It's like the same length as `import` and `export` π |
03:54:28 | Prestige | sounds nicer though, don't think length is really an issue |
03:54:39 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=2GFN |
03:54:52 | FromDiscord | <Cypheriel> I'm trying to use `asyncnet.connect()` but it keeps giving this error |
03:54:56 | FromDiscord | <Cypheriel> and I am so confused |
03:55:24 | FromDiscord | <exelotl> @Daniel you might find this article helpful: https://narimiran.github.io/2019/07/01/nim-import.html |
03:56:30 | mipri | Cypheriel: you've got a ref object that's nil. |
03:57:23 | FromDiscord | <exelotl> It doesn't cover the `export` keyword but it does a good job of explaining the design behind imports |
03:59:08 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=2GFP |
03:59:45 | FromDiscord | <treeform> oops got to change the labels to freeze/thaw |
04:00:57 | FromDiscord | <Cypheriel> mipri: I really have no idea what that means :/ I'm so confused |
04:01:24 | FromDiscord | <Cypheriel> I'm getting some of the weirdest errors all of a sudden |
04:02:22 | mipri | it's really important to know what that means. Nim has value types and reference types, and reference types can be nil and misusing them results in errors like this. |
04:02:29 | mipri | in short, anyway: you're not initializing something. |
04:03:44 | FromDiscord | <Cypheriel> uh. I'm pretty sure I am, though |
04:03:55 | mipri | ok then. |
04:04:13 | FromDiscord | <Cypheriel> I'm so confused |
04:04:27 | FromDiscord | <ElegantBeef> Providing code is better than words |
04:05:22 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=2GFU |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:35 | * | supakeen joined #nim |
04:07:33 | mipri | so, where's initSocketClient come from? |
04:08:51 | FromDiscord | <Cypheriel> sent a code paste, see https://play.nim-lang.org/#ix=2GFW |
04:09:10 | disruptek | prestige, beefcake: there's a "superstar" in grok that you might like. |
04:09:13 | disruptek | !repo disruptek/grok |
04:09:15 | disbot | https://github.com/disruptek/grok -- 9grok: 11spelunking gear 15 0β 0π΄ |
04:10:17 | mipri | ... so, where's SocketClient coming from? |
04:10:56 | FromDiscord | <Cypheriel> It's the name of the object type |
04:11:09 | FromDiscord | <Cypheriel> I'll make a hastebin |
04:13:39 | FromDiscord | <Cypheriel> https://hastebin.com/odawatefif.nim |
04:14:07 | FromDiscord | <Cypheriel> (edit) "https://hastebin.com/odawatefif.nim" => "https://hastebin.com/upaqefecud.kotlin" |
04:14:18 | FromDiscord | <Cypheriel> (edit) "https://hastebin.com/upaqefecud.kotlin" => "https://hastebin.com/upaqefecud.nim" |
04:16:45 | mipri | ok, not the first one |
04:17:21 | disruptek | you aren't setting the socket field when you instantiate the result. |
04:17:58 | FromDiscord | <Cypheriel> \:facepalm: |
04:18:19 | FromDiscord | <Cypheriel> How on Earth did I not see that |
04:18:42 | FromDiscord | <Cypheriel> I've changed so many things trying to debug the error |
04:18:56 | FromDiscord | <Cypheriel> That's such an ambiguous error D: |
04:19:15 | FromDiscord | <Cypheriel> Well. Thank you! |
04:19:17 | mipri | it's not ambiguous, I told you above |
04:19:17 | disruptek | well, i dunno what the error was, but i can guess. π |
04:19:39 | mipri | but an `echo client` probably would've helped you a lot |
04:19:44 | FromDiscord | <Cypheriel> I mean I understand what the error means |
04:19:58 | FromDiscord | <Cypheriel> I actually did that, but I didn't bother checking if `socket` existed |
04:20:05 | FromDiscord | <Cypheriel> Right I just replied to a bot |
04:20:10 | mipri | that echo would've shown that it was nil |
04:20:44 | FromDiscord | <Cypheriel> When I did that, I was more-so checking if maybe something was wrong with the init not creating a socket |
04:20:50 | FromDiscord | <Cypheriel> I mean an object |
04:20:56 | disruptek | don't sweat it. |
04:21:05 | disruptek | most of mipri's bugs are like this. |
04:21:26 | disruptek | rarely do the pros make serious errors. |
04:21:49 | FromDiscord | <Cypheriel> also tbf it didn't say it was nil, it said this `socket: ...` |
04:21:57 | mipri | hmm yeah, just noticed that. |
04:22:12 | FromDiscord | <Cypheriel> which... I would just see as "maybe this doesn't have a string representation" |
04:22:33 | mipri | right, which is probably the case anyway |
04:22:52 | FromDiscord | <ElegantBeef> You can always roll the die and `echo refObject[]` |
04:22:59 | FromDiscord | <Cypheriel> Oh, it is |
04:23:11 | mipri | that's a bit lame then. |
04:23:54 | mipri | you'd have gotten a warning about the unused variable if not for the wrapSocket |
04:23:55 | Prestige | What's this grok business |
04:24:28 | FromDiscord | <Cypheriel> Ah yeah, makes sense |
04:24:45 | FromDiscord | <Cypheriel> I can't believe I missed that, though |
04:24:51 | FromDiscord | <Cypheriel> I was so confused for the longest time |
04:27:09 | FromDiscord | <ElegantBeef> grok seems to be disrupteks version of sugar π |
04:28:08 | Prestige | ah |
04:28:24 | disruptek | it's garbage i don't want to type twice. |
04:28:59 | disruptek | but there's a conditional exporter that you might want to hack. |
04:34:05 | * | lritter quit (Ping timeout: 240 seconds) |
04:35:07 | * | lritter joined #nim |
04:41:04 | * | narimiran joined #nim |
04:45:05 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:51:35 | leorize[m]1 | dude you're back |
04:52:22 | disruptek | i know, it's pissing me off, too. |
04:52:36 | leorize[m]1 | glad to have you around tho |
04:52:45 | disruptek | π |
04:52:53 | disruptek | is github fixed, btw? |
04:55:51 | Prestige | it's all downhill from herez |
04:57:18 | FromDiscord | <Cypheriel> Y'all going to do AoC day 5? |
05:00:11 | disruptek | nope. |
05:03:51 | FromDiscord | <Rebel> ^ |
05:04:40 | FromDiscord | <Rebel> Also Disruptek I am testing out the threading solution in a bit will let you know the results. |
05:04:53 | disruptek | that's okay; i know what the results are. |
05:05:54 | FromDiscord | <Rebel> In hindsight if this was in Python I would've just used asyncio.queue + coroutines + asyncio.gather + uvloop |
05:06:07 | disruptek | yeah, that's super fun. |
05:06:28 | FromDiscord | <Rebel> Should've maybe used coroutines in Nim but didn't feel like it |
05:06:51 | disruptek | which coroutines in nim? |
05:07:03 | FromDiscord | <Rebel> Unstable coro module |
05:07:03 | disruptek | feel free to weigh in on the cps rfc: |
05:07:08 | disruptek | !rfc cps |
05:07:09 | disbot | https://github.com/nim-lang/RFCs/issues/295 -- 3next steps for CPS 7& 2 more... |
05:07:33 | disruptek | it's unstable because no one uses it. |
05:07:49 | FromDiscord | <Rebel> Yeah I can see why |
05:08:16 | FromDiscord | <Rebel> Looked too complicated at first glance and would make my binary bigger not sure by how much though |
05:08:40 | disruptek | considering you are already using async, i doubt it matters. |
05:09:41 | FromDiscord | <Rebel> Interesting |
05:10:14 | disruptek | are you looking at my grindr profile? |
05:10:31 | FromDiscord | <Rebel> Um no don't swing that way lol |
05:10:39 | FromDiscord | <Rebel> Go to offtopic |
05:10:46 | FromDiscord | <Rebel> And check out thr vid |
05:10:48 | FromDiscord | <Rebel> The |
05:10:53 | disruptek | offtopic is too spammy for me. |
05:11:01 | FromDiscord | <Rebel> It's not atm lol |
05:11:03 | disruptek | i prefer to saturate #nim with my bullshit. |
05:17:19 | FromDiscord | <Rebel> Any chance you've done syscalls in Nim? |
05:17:38 | disruptek | yeah, there's a library for them, but it's a little out of date. |
05:17:47 | disruptek | !repo syscall |
05:17:48 | disbot | https://github.com/def-/nim-syscall -- 9nim-syscall: 11Raw system calls for Nim 15 19β 3π΄ 7& 3 more... |
05:17:52 | FromDiscord | <Rebel> Sorry should've clarified |
05:17:57 | disruptek | windows? |
05:18:00 | FromDiscord | <Rebel> Windows syscalls |
05:18:10 | disruptek | fuck no, do i look like a moron? |
05:18:32 | FromDiscord | <Rebel> Hmmm maybe I could just write a Nim wrapper for hell's gate. |
05:19:05 | disruptek | is that what the kids are calling it these days? |
05:19:43 | FromDiscord | <Rebel> https://github.com/am0nsec/HellsGate |
05:21:42 | disruptek | seems simple enough. |
05:22:03 | disruptek | that's what i said about my first threesome, though. |
05:23:48 | FromDiscord | <Rebel> Ok spinning up the vm |
05:23:51 | FromDiscord | <Rebel> Time to test out the thread theory |
05:24:00 | disruptek | yeah, great. |
05:24:05 | FromDiscord | <Rebel> once I actually code it into main codebase lol |
05:24:08 | disruptek | let's see if they still work after all these years. |
05:25:00 | FromDiscord | <Rebel> YEp |
05:25:01 | FromDiscord | <Rebel> (edit) "YEp" => "Yep" |
05:25:03 | FromDiscord | <Rebel> this is the plan |
05:25:04 | FromDiscord | <Rebel> https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L39 |
05:26:56 | FromDiscord | <Rebel> btw out of curiosity was I right? |
05:27:11 | FromDiscord | <Rebel> Do you read Nietzsche? |
05:27:31 | disruptek | no, but i laughed at `dumb and dumber`. |
05:27:50 | disruptek | nietzsche is a book about nothing. |
05:28:07 | disruptek | fuck that, i can watch seinfeld if i'm in the mood. |
05:28:19 | disruptek | americans don't read. |
05:28:38 | FromDiscord | <Rebel> Ever seen the Eric Andre seinfield skit? |
05:28:45 | FromDiscord | <Rebel> (edit) "seinfield" => "seinfeld" |
05:28:50 | disruptek | no, i actually don't watch seinfeld. |
05:29:03 | FromDiscord | <Rebel> lol neither do I |
05:29:32 | FromDiscord | <Rebel> Here I posted it in your favorite spammy channel |
05:30:00 | disruptek | great, just think of how much time this is saving me. |
05:30:04 | Prestige | Seinfeld is god |
05:30:08 | Prestige | good* |
05:30:33 | FromDiscord | <Rebel> well vmware is updating... |
05:30:38 | disruptek | the problem is his porsche collection. |
05:30:45 | disruptek | i don't really want to rant about it, though. |
05:31:53 | Prestige | what's the problem with his porche collection? |
05:32:16 | disruptek | did i stutter? |
05:32:41 | Prestige | did your fingers trip? |
05:32:49 | disruptek | did yours? |
05:33:00 | Prestige | like, constantly |
05:33:03 | disruptek | no one said anything about porches, stoops, or patios. |
05:33:17 | Prestige | haha |
05:33:33 | Prestige | what's the problem with his porsche collection? |
05:34:14 | FromDiscord | <Rebel> We could talk about quantum crypto instead π |
05:42:44 | * | thomasross quit (Ping timeout: 256 seconds) |
05:50:47 | FromDiscord | <Rebel> Is there a way to force a proc to be gcsafe? |
05:51:06 | FromDiscord | <Rebel> oh nvm guess I can just use a threadvar |
05:51:39 | FromDiscord | <Rebel> ` Error: cannot create a flowVar of type: Table[system.string, system.string]` π€ |
05:53:55 | FromDiscord | <Rebel> huh well this is quite the conundrum |
05:55:17 | disruptek | what's the problem now? |
05:55:29 | disruptek | why do you think you want a flowvar? |
05:55:40 | FromDiscord | <Rebel> ????? |
05:55:45 | FromDiscord | <Rebel> I linked you what I was basing my own off of lol |
05:55:54 | FromDiscord | <Rebel> I went the threadpool route |
05:55:58 | disruptek | i don't read dom's code. |
05:56:18 | disruptek | why do you need a threadpool? |
05:56:19 | FromDiscord | <Rebel> well it uses a threadpool lol |
05:56:29 | FromDiscord | <Rebel> idk man I just want whatever is easiest lol and it looked easy |
05:56:31 | FromDiscord | <Rebel> ugh |
05:56:35 | FromDiscord | <Rebel> time to comment all my thread code |
05:56:36 | disruptek | are you writing code because other people write code? |
05:56:39 | FromDiscord | <Rebel> (edit) "comment" => "uncomment" |
05:56:46 | FromDiscord | <Rebel> what? |
05:56:49 | FromDiscord | <Rebel> of course not |
05:56:51 | FromDiscord | <Rebel> don't be foolish |
05:56:54 | disruptek | just write one you need. ignore these knuckleheads. |
05:57:04 | FromDiscord | <Rebel> I thought this would work lol |
05:57:06 | FromDiscord | <Rebel> I got jebaited |
05:57:39 | FromDiscord | <Rebel> oh man I didn't know a flowvar can't be a table |
05:57:41 | FromDiscord | <Rebel> this sucks on nice |
05:57:43 | FromDiscord | <Rebel> (edit) "nice" => "ice" |
05:57:52 | disruptek | you don't need it. |
05:57:58 | FromDiscord | <Rebel> correct |
05:58:05 | FromDiscord | <Rebel> going back to plan c I guess |
05:58:08 | FromDiscord | <Rebel> ugh |
05:58:22 | disruptek | i told you exactly what to do a week ago. |
05:59:16 | FromDiscord | <Rebel> oh well |
05:59:19 | FromDiscord | <Rebel> I'll do this one day |
05:59:21 | FromDiscord | <Rebel> I'm going back to C# |
05:59:30 | FromDiscord | <Rebel> I have more fun things to do there |
05:59:37 | disruptek | makes sense. |
06:04:14 | FromDiscord | <InventorMatt> are there any nontrivial examples for a use of cps? |
06:04:24 | disruptek | yes, read the paper. |
06:04:41 | FromDiscord | <InventorMatt> i mean written in the current implementation in nim |
06:04:53 | disruptek | nothing i can share. |
06:05:23 | FromDiscord | <InventorMatt> okay, thanks |
06:05:27 | disruptek | i have a thing that serializes continuations into the cloud and runs them on lambda. |
06:09:50 | FromDiscord | <Rebel> If you are curious disruptek as I most likely won't be touching it again for a while here is my current thought process with threading, if this threadpool implementation would've worked I think this was it but alas here we are, feel free to laugh at the code I know it's not the best: || https://pastebin.com/gLLdmCeX pw: Xi5bC1EQeD|| |
06:10:29 | disruptek | but what's threadpool for? |
06:13:26 | * | a_chou joined #nim |
06:13:46 | FromDiscord | <Rebel> because it was a suggestion |
06:14:00 | FromDiscord | <Rebel> and meant I didn't have to deal with locks, or joining threads |
06:14:29 | disruptek | what's hard about locks? |
06:14:36 | disruptek | or joinThread()? |
06:15:25 | FromDiscord | <Rebel> nothing |
06:15:45 | FromDiscord | <Rebel> the hardest part was described |
06:15:53 | FromDiscord | <Rebel> and figuring out where best to fit that piece into the puzzle |
06:16:11 | FromDiscord | <Rebel> I will attempt to fit that piece in a bit I am going back to C# and getting things done |
06:16:27 | disruptek | well, it seems much more complex than i envisioned it. |
06:17:48 | disruptek | to me it's just createThread, have the thread check a boolean to see if it should do anything, and join the thread at the end of the program. when the thread works, it uses a lock to mutate data in the shared heap. your main thread can just use the lock to read the data. that's it. |
06:18:38 | disruptek | one lock, one proc, two calls, and a boolean. i think i saw a porno with this plot line, now that i think about it. |
06:26:01 | Zevv | dude. at least *try* |
06:27:12 | disruptek | i /am/ trying. π |
06:30:03 | FromDiscord | <Rebel> hmmmm yeah I will try to do it that way I guess my current threaded implementation uses channels |
06:30:11 | FromDiscord | <Rebel> Don't think they're needed |
06:30:21 | disruptek | no. |
06:30:56 | disruptek | look, you can always add complexity when you need it. |
06:31:02 | disruptek | why not start with something that works? |
06:32:27 | * | j-james joined #nim |
06:32:50 | j-james | hey, what's nim's exponent function? |
06:33:16 | disruptek | it's the function that raises to the power of its argument. |
06:33:24 | FromDiscord | <Rebel> that's what I've been trying to do bruh |
06:33:42 | disruptek | rebel: what did i tell you about listening to the chuckleheads? |
06:33:46 | FromDiscord | <Rebel> occam's razor ftw win I guess lol |
06:34:15 | FromDiscord | <flywind> !eval import math; echo pow(2.0, 3.0); echo 2 ^ 3 |
06:34:17 | NimBot | 8.0β΅8 |
06:34:32 | j-james | oh that makes more sense, i've been using it for division this whole time |
06:34:38 | disruptek | i think people just don't trust me in here. maybe i should go under cover. |
06:34:46 | * | disruptek is now known as keisterfish |
06:34:51 | FromDiscord | <Rebel> ok well to be fair |
06:34:57 | FromDiscord | <Rebel> now that you understand the full scope of the problem |
06:35:01 | FromDiscord | <Rebel> you see what I kind of mean now |
06:35:06 | j-james | ah pow |
06:35:21 | FromDiscord | <Rebel> Did you end up puking from the code? π |
06:35:38 | FromDiscord | <Rebel> might be just a bit too big to fit in one proc π
|
06:35:50 | keisterfish | let's just say i had my cake and now i get to eat it, too. |
06:36:31 | keisterfish | the one proc is your new thread. |
06:37:36 | * | j-james quit (Remote host closed the connection) |
06:53:43 | * | a_chou quit (Remote host closed the connection) |
06:57:57 | * | ajf joined #nim |
06:58:18 | * | ajf quit (Remote host closed the connection) |
06:58:37 | * | nerdrage joined #nim |
07:03:15 | FromDiscord | <ElegantBeef> Any ideas on how to handle a js function that uses js promises? |
07:05:19 | FromDiscord | <ElegantBeef> Ah there is a `asyncjs` module |
07:15:01 | FromDiscord | <ElegantBeef> Any clues on how to properly get the instantiated recorder from inside the `GetMediaRecorder` function ? https://play.nim-lang.org/#ix=2GGy |
07:23:02 | * | letto quit (Ping timeout: 256 seconds) |
07:35:13 | * | letto joined #nim |
07:46:45 | keisterfish | ask nicely. |
07:47:19 | keisterfish | call getMediaRecorder(), it yields a future, await the future to receive the recorder. |
07:51:10 | * | j-james joined #nim |
07:53:30 | * | j-james quit (Remote host closed the connection) |
07:56:16 | * | keisterfish is now known as disruptek |
07:59:05 | * | nerdrage quit (Remote host closed the connection) |
08:00:03 | * | opal quit (Ping timeout: 240 seconds) |
08:02:00 | * | opal joined #nim |
08:05:53 | * | opal quit (Remote host closed the connection) |
08:06:20 | * | opal joined #nim |
08:11:41 | FromDiscord | <ElegantBeef> Well i mean i wrote that so yea i know what it does, the thing is it cannot be awaited |
08:39:33 | * | habamax joined #nim |
08:39:44 | * | mbomba joined #nim |
08:49:36 | * | opal quit (Remote host closed the connection) |
08:50:48 | * | opal joined #nim |
08:56:12 | FromDiscord | <tamashungary> nigger nigger nigger i hate jews |
08:56:16 | FromDiscord | <tamashungary> nigger |
08:56:28 | FromDiscord | <tamashungary> bombing run over tel aviv |
08:56:48 | FromDiscord | <ElegantBeef> @treeform might wanna ban this guy |
08:56:49 | FromDiscord | <tamashungary> flossing at the holocaust memorial |
08:57:00 | FromDiscord | <tamashungary> holocaust 2 electric boogaloo |
08:57:10 | FromDiscord | <ElegantBeef> What it'd be like to be 12 again |
08:57:21 | FromDiscord | <tamashungary> i hate israel |
09:00:51 | FromDiscord | <treeform> I don't think its age related, probably just a script spamming stuff. |
09:16:36 | * | narimiran quit (Ping timeout: 240 seconds) |
09:20:04 | FromDiscord | <Rika> I wonder what happened. |
09:20:49 | FromDiscord | <ElegantBeef> I mean if you want to know there are ways to learn |
09:22:20 | FromDiscord | <Rika> I know, I can't be assed to check myself though |
09:23:16 | FromDiscord | <ElegantBeef> Racist/anti semetic shit |
09:32:20 | FromDiscord | <kaletaa> I'm anti-semantic |
09:39:18 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:51:24 | planetis[m] | I have seen the Israel-Palestine reconciliation videos, and most of the |
09:51:24 | planetis[m] | Israelis taking part, look to me like either actors or cold hearted murderers. |
09:51:24 | planetis[m] | Not that I take anyone's side but damn. |
09:57:48 | planetis[m] | I hope something can change for the better, because it seems to me everyone is |
09:57:48 | planetis[m] | trying to start WW3 in the middle east |
10:00:42 | planetis[m] | my country is planning to spent almost 10bil on weapons in a year, we will make |
10:00:42 | planetis[m] | Americans, French and Germans richer but we might get bankrupt again, with |
10:00:42 | planetis[m] | these assholes in the goverment |
10:00:59 | FromDiscord | <Rika> #offtopic / #nim-offtopic |
10:10:28 | planetis[m] | sure if you don't care about the common people dying for megalomanics leaders |
10:10:28 | planetis[m] | and expansionism, you can all kindly go fuck yourselves. |
10:10:35 | * | planetis[m] left #nim ("User left") |
10:17:17 | mipri | yeah, among hundreds of people, you're the only one who has a moral position that others might not want to hear about. |
10:17:45 | * | j-james joined #nim |
10:19:12 | supakeen | what a nice morning |
10:20:46 | j-james | so uh |
10:21:12 | j-james | on-topic: do any of you have advice for cleaning this code up? |
10:21:14 | j-james | https://play.nim-lang.org/#ix=2GHC |
10:22:52 | j-james | is there a `count(string, char): int` style method i'm unaware of? |
10:23:40 | mipri | that'd have you looping over the string three times though |
10:24:08 | mipri | sequtils has that, a count() |
10:28:46 | mipri | https://play.nim-lang.org/#ix=2GHG <- I'd do something like this |
10:32:48 | mipri | the row and column stuff seems unimportant in the first part, but it's repeated in the second part which I don't really follow. |
10:33:06 | mipri | you could pull that out into a template |
10:33:26 | mipri | er, an iterator |
10:33:44 | j-james | i was hoping to do something like this: https://play.nim-lang.org/#ix=2GHJ |
10:33:59 | j-james | a better iterator for the first part would be nice |
10:34:46 | j-james | something like `split()` but for string positions |
10:35:31 | mipri | something like distribute() in sequtils? |
10:36:56 | j-james | yeah, but if it took a string |
10:37:06 | j-james | oh dumb me |
10:37:36 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2GHL |
10:37:58 | j-james | strings can probably be converted to seqs |
10:38:31 | mipri | {.push hint[XDeclaredButNotUsed]: off.} |
10:38:34 | mipri | {.pop.} |
10:39:39 | mipri | !eval echo @"hi" |
10:39:41 | NimBot | @['h', 'i'] |
10:41:47 | * | mbomba quit (Quit: WeeChat 3.0) |
10:47:31 | * | waleee-cl joined #nim |
10:49:17 | * | gangstacat quit (Quit: Δis!) |
10:49:57 | supakeen | erm |
10:50:11 | supakeen | excuse me but why have i been writing toSeq("hi".items) all my life then? |
10:50:39 | supakeen | time to rewrite some code, brb |
10:51:15 | Zevv | `@` does not work for iterables |
10:51:40 | supakeen | but it seems I could've written @"hi" all along? |
10:51:58 | mipri | for anything's that an openArray, yes. |
10:54:09 | supakeen | The whole `seq[char]`, `openArray[char]`, `string` variations still confuse me :) |
10:55:09 | j-james | mipri: thanks, this is much cleaner: https://play.nim-lang.org/#ix=2GHP |
10:56:42 | * | gangstacat joined #nim |
10:59:34 | * | j-james quit (Remote host closed the connection) |
11:07:46 | supakeen | mrm, did something change between 1.4.0 and 1.4.2 regarding `seq[var T]`? |
11:08:40 | supakeen | gheh, no |
11:36:33 | * | lum quit (Quit: Lum: Bye!) |
11:39:08 | * | lum joined #nim |
11:39:35 | * | narimiran joined #nim |
11:55:10 | * | zahary_ joined #nim |
11:57:24 | * | zahary quit (Ping timeout: 272 seconds) |
11:57:26 | * | zahary_ is now known as zahary |
11:57:38 | * | stefantalpalaru quit (Remote host closed the connection) |
11:57:47 | * | stefantalpalaru joined #nim |
11:58:36 | * | stefantalpalaru quit (Changing host) |
11:58:36 | * | stefantalpalaru joined #nim |
11:58:47 | * | fowl quit (Ping timeout: 272 seconds) |
11:59:00 | * | fowl joined #nim |
11:59:55 | FromDiscord | <dom96> ooh, I may have found a 13 year old bug https://media.discordapp.net/attachments/371759389889003532/784750895404679168/unknown.png |
12:04:53 | * | luis1 joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:17 | * | krux02 joined #nim |
12:06:34 | * | supakeen joined #nim |
12:42:16 | * | Vladar joined #nim |
12:47:33 | * | luis1 quit (Ping timeout: 272 seconds) |
12:48:38 | * | Q-Master quit (Ping timeout: 256 seconds) |
12:48:59 | FromDiscord | <Sendell> hey guys π Am I doing something wrong or are asserts kept in release builds ? Oo |
12:49:59 | narimiran | -d:danger will remove them for sure |
12:51:28 | FromDiscord | <Sendell> ok so that's expected behavior ? |
12:51:49 | FromDiscord | <Sendell> -d:release keeps asserts |
12:51:51 | FromDiscord | <Sendell> ? |
12:52:06 | FromDiscord | <Sendell> can't find that specified in the docs |
12:52:30 | narimiran | look at `config/nim.cfg |
12:52:50 | narimiran | `assertions:off` are there only for `danger`, not for `release` |
12:53:12 | FromDiscord | <Sendell> didnt know that file, i'll take a look |
12:53:13 | FromDiscord | <Sendell> thx π |
13:02:45 | federico3 | What's the difference between --cpu=nimvm and --cpu=vm ? |
13:15:53 | FromDiscord | <krisppurg> @ElegantBeef I will. Theres already a PR on dimscord and currently voice is taking longer to push and im busy irl. |
13:17:14 | * | audiofile joined #nim |
13:20:18 | * | Q-Master joined #nim |
13:24:36 | * | lritter quit (Ping timeout: 240 seconds) |
13:25:35 | * | PMunch joined #nim |
13:28:28 | * | sepples joined #nim |
13:31:54 | * | lritter joined #nim |
13:39:25 | ForumUpdaterBot | New thread by Serge: Is somebody working on a Fyne-like GUI lib for Nim?, see https://forum.nim-lang.org/t/7205 |
13:49:04 | * | hmmm joined #nim |
13:49:09 | hmmm | g'day |
13:53:19 | FromDiscord | <dom96> hello |
14:03:38 | FromDiscord | <fwsgonzo> is there a standard HTTP library for Nim? which library has the best HTTP header manipulation design? |
14:06:37 | * | junland quit (Quit: %ZNC Disconnected%) |
14:11:01 | * | Q-Master quit (Ping timeout: 256 seconds) |
14:11:08 | * | junland joined #nim |
14:12:09 | * | junland quit (Client Quit) |
14:15:28 | * | junland joined #nim |
14:17:38 | Zoom[m] | Is it possible to set a required quantity of an expression in `pegs`? Now I'm doing `E E E E E E E E E ...` |
14:18:05 | PMunch | Zoom[m], yes that is possible |
14:18:12 | * | junland quit (Client Quit) |
14:18:35 | PMunch | Have a look at the two last operators here: https://github.com/zevv/npeg#syntax |
14:18:51 | Zoom[m] | Actually, I'm working with pegs in std |
14:19:00 | PMunch | Oh |
14:19:04 | PMunch | For that one I don't know |
14:19:07 | PMunch | Haven't used it much |
14:19:47 | Zoom[m] | If I use zevv's npeg everyone will say I just copied his solution, and I'm not trying to look at any, until I'm done |
14:21:38 | * | junland joined #nim |
14:22:00 | FromDiscord | <ajusa> is there any way to make a loop parallel if it is reading from stdin? eg making `for line in stdin.lines:` parallel |
14:22:59 | FromGitter | <xflywind> Are there builtin functions to compare two Nim identities in runtime(eqIent is in CT) |
14:24:33 | PMunch | @ajusa, well you can make the execution of whatever is in the loop parallel |
14:25:08 | PMunch | @xflywind, I don't think Nim has idents on runtime |
14:25:13 | PMunch | What're you trying to do? |
14:26:19 | FromDiscord | <ajusa> PMunch good point, I assume you mean I basically spawn a bunch of stuff within the loop and then process it after the loop is done? |
14:26:37 | PMunch | Pretty much |
14:26:45 | PMunch | Or rater you start processing while the loop is running |
14:26:57 | PMunch | But it will continue until it is done |
14:27:25 | FromDiscord | <ajusa> would I need channels for that then, to have a work queue of some sort? |
14:27:31 | PMunch | What you probably want to do though is to start N number of worker threads, each trying to read from a channel |
14:27:53 | PMunch | Then in your main thread you loop over stdin and put every line into the channel |
14:27:54 | FromGitter | <xflywind> Yeah I could use compilerapi instead |
14:28:05 | PMunch | The threads will read from the channel and process the inputs |
14:28:43 | PMunch | @ajusa, channels are the easiest option I think |
14:28:43 | FromGitter | <xflywind> timothee and I am doing a nimlint for reviewing PR. |
14:28:59 | PMunch | I mean you could also spin up a new thread for each line |
14:29:06 | PMunch | But that is likely to just slow stuff way down |
14:29:18 | FromDiscord | <ajusa> I'm worried about the memory usage in that scenario though, as I think I would have a non-trivial amount of the file in memory. My use case involves parsing logs, so after seeing a line I store some data into a table and move on. |
14:29:29 | FromDiscord | <ajusa> (edit) "memory." => "memory (through the channel)." |
14:34:30 | PMunch | Well you can set maxItems on the channel |
14:34:42 | PMunch | That means the writer will block when the channel is full |
14:34:59 | PMunch | Effectively putting an upper bound on its memory usage |
14:35:30 | FromDiscord | <ajusa> oh I missed that completely. Just to double check, I can't use channels with spawn, right? |
14:35:41 | PMunch | (well, if you are putting strings in you could theoretically put infinitely long strings in. But if you cap the length of a line the memory consumption would be bound) |
14:36:04 | PMunch | No that's apparently a bad idea |
14:36:07 | PMunch | Not entirely sure why |
14:36:16 | PMunch | Think they might be copied or something |
14:37:01 | FromDiscord | <ajusa> Alright, thanks! hopefully I can speed up my program a bit with this π |
14:37:28 | Zevv | ajusa: you could have one thread doing the actual reading of stdin |
14:37:40 | Zevv | and find the line boundaries -> ptr + len |
14:37:52 | Zevv | use a thread pool to pick lines from a queue and work on them |
14:38:31 | Zevv | complication is memory management, how to clean up parts that are done |
14:38:49 | Zevv | if you want to go zero-copy |
14:39:35 | * | abm joined #nim |
14:40:19 | FromDiscord | <ajusa> I'm not too concerned about memory usage so long as I can cap it like PMunch suggested. Just didn't want to end up in a scenario where the entire log file is read into memory some how. |
14:40:31 | Zevv | consider memFiles |
14:41:20 | FromDiscord | <ajusa> Can I use memFiles with stdin? |
14:41:27 | Zevv | no :( |
14:42:02 | FromDiscord | <ajusa> π¦ I use grep to filter my logs first so I need to read over stdin |
14:42:57 | FromDiscord | <ajusa> I do wish that there was an easier automatic way of doing this though lol. Seems like weave and spawn are supposed to abstract away having to figure out how many threads to allocate based on the cpu, etc |
14:43:32 | Zevv | Nim doesn't have a solid threading story, still |
14:43:55 | Zevv | the primitives are there, but there's now one-solution-fits-all glue for you yet |
14:44:41 | * | Q-Master joined #nim |
14:45:35 | FromDiscord | <ajusa> Yeah, I last tried doing threading in nim in 2017, at least things are better now. |
14:46:42 | Zevv | I practically never use threads, except when using Golang |
14:47:18 | Zevv | I decided I'm not smart enough to do it right, so I might as well just not do it at all |
14:47:48 | PMunch | Threads are always fun <_< |
14:47:53 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2GJf |
14:48:43 | PMunch | Yeah unless you're doing a lot of work for each line there isn't much optimising to do when reading from a file |
14:49:53 | FromDiscord | <ajusa> Exactly. My current (non-threaded) solution is only 4 times slow than just dumping everything to /dev/null so I figured it was time to look into multithreading |
14:49:58 | * | Q-Master quit (Ping timeout: 256 seconds) |
14:50:37 | PMunch | To put some stuff into perspective: https://cdn.mos.cms.futurecdn.net/LC7jNpbXZu5L462NHq4DnA.jpg |
14:51:26 | Zevv | 'physical system reboot. 5m' |
14:51:27 | Zevv | dude |
14:52:27 | PMunch | Not sure if you think that's fast or slow :P |
14:52:43 | Zevv | if you got a full cabinet with 90's raid controllers, sure |
14:52:46 | Zevv | then it's pretty accurate |
14:53:32 | PMunch | Or just a normal Windows install :P |
14:54:25 | FromDiscord | <Rika> Windows can reboot in a minute or less for me |
14:55:35 | FromDiscord | <Rika> L0 cache access is what tho π |
14:56:07 | lain | in a macro that accepts a 'typed' argument (statement list), is there an easy way to find all statements that might modify a given variable? |
14:56:42 | PMunch | @Rika, because RAM is so slow the CPU has levels of caches where it tries to pre-load stuff from memory |
14:56:57 | FromDiscord | <Rika> I know |
14:57:05 | PMunch | Oh :P |
14:57:08 | FromDiscord | <Rika> Maybe reread my message |
14:57:15 | PMunch | I thought you asked what L0 was :P |
14:57:28 | FromDiscord | <Rika> I see |
15:06:39 | FromDiscord | <dom96> @ajusa for your use case it sounds like it might be worthwhile to investigate how grep tools handle stdin |
15:09:35 | ForumUpdaterBot | New thread by Inventormatt: Nimbotics, see https://forum.nim-lang.org/t/7206 |
15:19:36 | ForumUpdaterBot | New thread by Deech: Statically Check If An Object Is A Subtype Of Another Object, see https://forum.nim-lang.org/t/7207 |
15:24:42 | FromDiscord | <shadow.> is there any way to set the low or high of a slice? |
15:25:36 | * | Q-Master joined #nim |
15:28:33 | FromDiscord | <lqdev> yes |
15:28:36 | FromDiscord | <lqdev> slice.a = 10 |
15:28:39 | FromDiscord | <lqdev> slice.b = 20 |
15:31:01 | FromDiscord | <shadow.> oh nice thanks |
15:34:57 | * | Kaivo quit (Quit: WeeChat 2.9) |
15:35:02 | FromDiscord | <shadow.> is there a way to assign a function to a variable? |
15:35:17 | * | Kaivo joined #nim |
15:35:17 | FromDiscord | <shadow.> and change which function it's associated with |
15:35:22 | FromDiscord | <shadow.> as long as yk same return type and args? |
15:35:34 | narimiran | have you tried it? |
15:35:48 | FromDiscord | <shadow.> yeah |
15:36:20 | FromDiscord | <shadow.> invalid type none for var |
15:40:38 | FromDiscord | <krisppurg> maybe a dumb question, but is there a way to read bytes from string? |
15:40:52 | FromDiscord | <lqdev> yeah just iterate over it |
15:41:06 | FromDiscord | <lqdev> a char is always a single byte in Nim |
15:41:37 | FromDiscord | <shadow.> oh hey krisppurg |
15:41:43 | FromDiscord | <krisppurg> sup shadow |
15:41:47 | FromDiscord | <shadow.> i was just talking about dimscord yesterday lol |
15:41:52 | FromDiscord | <krisppurg> I saw |
15:42:14 | FromDiscord | <shadow.> oh wait u accepted my pr |
15:42:15 | FromDiscord | <shadow.> haha |
15:42:40 | FromDiscord | <shadow.> wait nvm |
15:42:42 | FromDiscord | <shadow.> i think im being dumb |
15:42:43 | FromDiscord | <shadow.> lol |
15:43:22 | FromDiscord | <krisppurg> dont want offtopic chat in main rn, but feel free to dm me if you want. |
15:43:31 | FromDiscord | <shadow.> oh ok |
15:53:19 | FromDiscord | <ajusa> Doesn't Nim in Action have an example where channels and spawn were used? Is that one of those things that doesn't work anymore but worked back then? |
15:55:31 | Zevv | it still does, the book is still relevant, make sure to find the errate |
15:58:43 | FromDiscord | <ajusa> errate? |
15:59:39 | FromDiscord | <ajusa> oh nevermind the book has two threads finish before looking at the stuff in the channel, that isn't what I was trying to do |
15:59:50 | FromDiscord | <InventorMatt> https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html |
15:59:59 | FromDiscord | <InventorMatt> this is the errata for it |
16:00:04 | * | Helios quit (Quit: Idle for 30+ days) |
16:03:13 | FromDiscord | <starl0rd> Hi all |
16:03:28 | FromDiscord | <starl0rd> sent a code paste, see https://play.nim-lang.org/#ix=2GJH |
16:03:59 | FromDiscord | <starl0rd> is there a better way to init a seq with default values for its type repeated a number of times ? |
16:04:05 | * | hmmm quit (Ping timeout: 240 seconds) |
16:04:56 | FromDiscord | <starl0rd> probaly something like those list comprehensions in python ? |
16:05:56 | FromDiscord | <Vindaar> @starl0rd there's `newSeqWith` (in sequtils I think) |
16:06:08 | narimiran | you have off-by-one error, i think |
16:06:15 | narimiran | and you can do it like this: https://play.nim-lang.org#ix=2GJJ |
16:06:29 | narimiran | alternatively: https://nim-lang.github.io/Nim/sequtils.html#newSeqWith.t%2Cint%2Cuntyped |
16:08:10 | * | hmmm joined #nim |
16:08:34 | FromDiscord | <Vindaar> but if you only want the default value of `Bit` anyway, you don't even have to explicitly assign anything. Just doing `newSeq[Bit](size)` already initializes with the default value, no? |
16:08:46 | narimiran | true |
16:09:48 | FromDiscord | <shadow.> @starl0rd you can also use sugar collect or repeat |
16:14:30 | FromDiscord | <starl0rd> Thanks guys |
16:14:42 | FromDiscord | <starl0rd> sent a code paste, see https://play.nim-lang.org/#ix=2GJR |
16:14:44 | FromDiscord | <starl0rd> These both work |
16:14:49 | FromDiscord | <shadow.> rip me |
16:15:01 | FromDiscord | <starl0rd> ? |
16:15:04 | FromDiscord | <shadow.> nvm lol |
16:15:08 | FromDiscord | <shadow.> i think i misread what you were tryna do |
16:15:25 | FromDiscord | <shadow.> ohh yeah you can do β΅`var ba2 = repeat(size, bit)`β΅as well |
16:15:36 | FromDiscord | <shadow.> tho that requires sequtils so newSeqWith() prolly makes more sense |
16:16:14 | * | NimBot joined #nim |
16:16:23 | FromDiscord | <starl0rd> ba one has the advantage in that i dont need to import anything, but it is less readable than newSeqWith |
16:16:33 | FromDiscord | <shadow.> yeah that was my thought |
16:16:50 | FromDiscord | <shadow.> i mean you can always just make a template for repeat if you want it more readable |
16:17:07 | FromDiscord | <starl0rd> havent got around to templates just about yet |
16:17:12 | FromDiscord | <shadow.> ohh ok |
16:17:33 | FromDiscord | <starl0rd> i am doing the tutorial on the official site |
16:18:03 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GJT |
16:18:04 | FromDiscord | <shadow.> (if you need it) |
16:18:08 | FromDiscord | <shadow.> if not yeah newSeqWith works fine |
16:19:52 | FromDiscord | <shadow.> is there a way to strip a seq of a character from front and tail ends? |
16:20:45 | FromDiscord | <shadow.> element not character |
16:21:19 | FromDiscord | <shadow.> if not ill just make one |
16:21:22 | FromDiscord | <starl0rd> i know the functional way to do this, coming from haskell |
16:21:25 | FromDiscord | <shadow.> haha |
16:21:31 | FromDiscord | <starl0rd> you use the take and drop functions |
16:21:50 | FromDiscord | <shadow.> does this make you happy |
16:21:51 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GJZ |
16:21:51 | FromDiscord | <shadow.> LOL |
16:21:55 | FromDiscord | <shadow.> as a haskell dev |
16:22:04 | FromDiscord | <shadow.> that was in one of my aoc's lol |
16:22:27 | FromDiscord | <shadow.> eh whatever ill just make a function |
16:22:35 | FromDiscord | <starl0rd> that's just my first instinct now. reach for map or filter |
16:22:39 | FromDiscord | <krisppurg> Is this how you would read the bytes https://play.nim-lang.org/#ix=2GJX ? |
16:23:06 | FromDiscord | <lqdev> wellβ¦yeah |
16:23:10 | FromDiscord | <shadow.> lol |
16:23:12 | FromDiscord | <shadow.> char == byte |
16:23:18 | FromDiscord | <lqdev> not exactly equal tho |
16:23:21 | FromDiscord | <shadow.> well |
16:23:24 | FromDiscord | <lqdev> you can convert from byte to char |
16:23:27 | FromDiscord | <shadow.> all chars are a byte |
16:23:29 | FromDiscord | <shadow.> in size |
16:23:29 | FromDiscord | <lqdev> and vice versa |
16:23:35 | FromDiscord | <shadow.> well yeah |
16:23:40 | FromDiscord | <shadow.> they're different representations of the same bits |
16:23:54 | FromDiscord | <shadow.> but the idea is that iterating over a string yields chars which are all bytes |
16:24:10 | FromDiscord | <shadow.> i mean if you really want the "bytes" of a string you could cast it to a byte array |
16:24:11 | FromDiscord | <lqdev> if you need unicode characters use `unicode.runes` |
16:26:40 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=2GK3 |
16:27:12 | FromDiscord | <shadow.> rust chars are 4 bytes |
16:27:16 | FromDiscord | <shadow.> lmao |
16:27:24 | FromDiscord | <shadow.> that's most likely why you need casting |
16:27:28 | FromDiscord | <shadow.> or whatever tf that is |
16:27:35 | FromDiscord | <lqdev> it's not casting |
16:27:43 | FromDiscord | <lqdev> just reading into a byte array |
16:27:46 | FromDiscord | <shadow.> fair enough |
16:32:19 | FromDiscord | <shadow.> boom |
16:32:21 | FromDiscord | <shadow.> finished aoc day 5 lol |
16:33:46 | FromDiscord | <shadow.> hmm i have an opinion based question |
16:34:06 | FromDiscord | <shadow.> if you can ensure that x is a Natural and you need to check if x is not 0, do you use > for readability or != |
16:38:22 | FromDiscord | <Vindaar> imo depends on the meaning of 0 in the context. I'd possibly go with `!= 0` if I mean to say "hey, this is unequal the special case here" (and of course < 0 cannot happen) |
16:38:30 | FromDiscord | <Vindaar> but normally just `> 0` |
16:39:05 | FromDiscord | <shadow.> fair enough |
16:39:10 | FromDiscord | <shadow.> im going to assume the speed difference is miniscule |
16:47:11 | FromDiscord | <Vindaar> in the vast, vast majority of use cases the speed difference here certainly would not matter I'd say |
16:47:29 | FromDiscord | <shadow.> lmfao yeah kk |
16:47:41 | FromDiscord | <shadow.> time to upload my aoc to github |
16:47:44 | * | Kaivo quit (Quit: switching to wifi) |
16:48:48 | * | Kaivo joined #nim |
16:48:51 | ForumUpdaterBot | New post on r/nim by richardd08: Running into problems trying to submit C code generated by Nim to a programming contest, see https://www.reddit.com/r/nim/comments/k7ats7/running_into_problems_trying_to_submit_c_code/ |
16:51:55 | * | habamax quit (Read error: Connection reset by peer) |
17:01:10 | FromDiscord | <Vindaar> damn you were all fast answering that person! |
17:02:23 | FromDiscord | <starl0rd> sent a code paste, see https://play.nim-lang.org/#ix=2GKi |
17:02:37 | FromDiscord | <starl0rd> would this copy the input and mutate the copy |
17:02:51 | FromDiscord | <starl0rd> or would this mutate the original seq ? |
17:03:07 | FromDiscord | <Vindaar> nope, sequences have value semantics, i.e. assignments copy |
17:03:10 | FromDiscord | <starl0rd> (edit) "https://play.nim-lang.org/#ix=2GKi" => "https://play.nim-lang.org/#ix=2GKk" |
17:03:32 | FromDiscord | <starl0rd> and the original would be gc'ed when its done right ? |
17:03:45 | FromDiscord | <starl0rd> And there are no more refs |
17:04:07 | FromDiscord | <Vindaar> nope, the original continues to live a happy life until its scope comes to a sudden end π |
17:04:29 | FromDiscord | <starl0rd> but if im adding 1000 times |
17:04:44 | FromDiscord | <starl0rd> and bitarray is global scope |
17:04:49 | FromDiscord | <Vindaar> then this is probably not a very smart procedure to write |
17:04:54 | FromDiscord | <starl0rd> i'd have 1000 bit arrays in mem ? |
17:04:56 | FromDiscord | <Vindaar> so you want to mutate the global one |
17:05:08 | FromDiscord | <starl0rd> not really : P |
17:05:12 | FromDiscord | <Vindaar> it depends on where the result is assigned to |
17:05:17 | FromDiscord | <starl0rd> i'd rather write this as a `func` |
17:05:37 | FromDiscord | <Vindaar> if you overwrite the input again, then of course it won't result in you having 1000 seqs |
17:05:57 | FromDiscord | <starl0rd> ofc |
17:05:59 | FromDiscord | <Vindaar> a naive functional proc like this will have serious performance problems though |
17:06:13 | FromDiscord | <Vindaar> that's why e.g. clojure data types are quite non trivial (but pretty amazing) |
17:06:33 | FromDiscord | <starl0rd> the language ? |
17:06:39 | FromDiscord | <starl0rd> or the pragma ? |
17:07:03 | FromDiscord | <Vindaar> PMunch has ported over the clojure vector that allows for this in an efficient manner https://github.com/PMunch/nim-persistent-vector |
17:07:24 | FromDiscord | <Vindaar> the Clojure the language |
17:07:48 | * | habamax joined #nim |
17:07:51 | FromDiscord | <starl0rd> immutable lists are pretty dope in general |
17:08:01 | FromDiscord | <Vindaar> agreed |
17:08:13 | FromDiscord | <starl0rd> i miss the cons operator here |
17:08:31 | FromDiscord | <starl0rd> i even searched for nim cons operator |
17:08:35 | FromDiscord | <starl0rd> on google |
17:08:41 | FromDiscord | <starl0rd> didn't get very far |
17:09:22 | FromDiscord | <starl0rd> comming back, when i call this func with an actual seq argument |
17:09:30 | FromDiscord | <starl0rd> is that copied over in the parameter ? |
17:10:12 | FromDiscord | <Vindaar> the parameter is passed by reference if the passed object exceeds a (relatively small, don't have the number in my head) sizo |
17:10:25 | FromDiscord | <Vindaar> you don't have to worry about that at least π |
17:10:55 | FromDiscord | <starl0rd> and is then implicitly dereferenced in the proc ? |
17:11:06 | FromDiscord | <starl0rd> (edit) "and is ... then" added "that" |
17:11:09 | FromDiscord | <Vindaar> yep |
17:11:30 | FromDiscord | <starl0rd> means i do have to make a copy in the proc ? |
17:11:47 | FromDiscord | <Vindaar> if you want a copy yes, otherwise no. Not sure what you mean sorr |
17:11:57 | FromDiscord | <starl0rd> if i never want to mutate the original |
17:12:07 | FromDiscord | <Vindaar> then sure, you need to make a mutable copy |
17:12:08 | FromDiscord | <starl0rd> if its a ref, i'd mutate it |
17:12:46 | FromDiscord | <Vindaar> yes, but as I said, you don't have to worry about that. If you have a raw `object` (not `ref object`) it might be passed by reference, but for you everything is still just a value object |
17:13:14 | FromDiscord | <starl0rd> hang on |
17:13:16 | FromDiscord | <starl0rd> : P |
17:15:32 | FromDiscord | <Vindaar> my arms are getting tired π |
17:26:20 | * | audiofile quit (Ping timeout: 272 seconds) |
17:28:21 | * | abm quit (Quit: Leaving) |
17:30:12 | FromDiscord | <starl0rd> you're saved from more typing by the compiler |
17:30:26 | FromDiscord | <starl0rd> it WONT let me mutate : p |
17:30:38 | FromDiscord | <starl0rd> unless i shadow the variable with itself |
17:30:52 | FromDiscord | <starl0rd> which i remember reading from the tutorial is an idom |
17:35:53 | FromDiscord | <haxscramper> What are the recommendations for using `std/distros` for providing better error messages? I want to make wrapper that somehow detects missing library for linking, and provides relevant fix suggestions. (like "cannot find hunspell library, please install it using apt-get ... etc") |
17:36:35 | FromDiscord | <haxscramper> make C library wrappers that requires static linking |
17:37:37 | FromDiscord | <Vindaar> yes, of course you cannot mutate it. I thought that much was clear to you, sorry |
17:38:15 | FromDiscord | <Vindaar> or rather that's what I was trying to get across when I said "don't worry about it" (it being mutating it accidentally) |
17:38:35 | FromDiscord | <starl0rd> it kindda was, but i wasn't sure if it was a ref or value and if i can EVER accidently mutate the orignal |
17:38:44 | FromDiscord | <starl0rd> no matter the size |
17:39:05 | FromDiscord | <Vindaar> you can, but then you need to do unsafe things π So yes, Nim is great here |
17:39:10 | FromDiscord | <starl0rd> i like working with pure functions, much easier to reason about for me |
17:41:51 | FromDiscord | <Vindaar> so you can do this: https://play.nim-lang.org/#ix=2GKz |
17:42:20 | FromDiscord | <Vindaar> but of course you don't want to do such a thing usually haha. But it's useful in particular when dealing with C libraries |
17:43:57 | FromDiscord | <shadow.> how can i do a single discard in macros? |
17:44:02 | FromDiscord | <shadow.> like instead of discarding an expr |
17:44:04 | FromDiscord | <shadow.> do i just do empty? |
17:44:17 | FromDiscord | <shadow.> nvm figured it out |
17:48:20 | FromDiscord | <shadow.> i present to you |
17:48:24 | FromDiscord | <shadow.> the bad idea pragma |
17:48:30 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GKC |
17:48:45 | FromDiscord | <shadow.> function creating errors? just wrap it with badIdea! |
17:49:48 | FromDiscord | <InventorMatt> the only thing it is missing is a way to log the error |
17:49:53 | FromDiscord | <shadow.> hm true |
17:50:02 | FromDiscord | <shadow.> is there a way to except any exception under a var? |
17:50:05 | FromDiscord | <shadow.> ik u can do except Exception as e |
17:50:08 | FromDiscord | <shadow.> but what abt for any error |
17:51:12 | FromDiscord | <lqdev> var e = getCurrentException() |
17:51:30 | FromDiscord | <shadow.> ohh |
17:51:36 | FromDiscord | <haxscramper> Just found funny bug - `std/distros` uses ``"sun" in `<uname -a shell output>` `` to detect if current OS is a solaris. So on sundays, you can be detected as arch linux and solaris at the same time. |
17:52:24 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GKD |
17:52:46 | FromDiscord | <starl0rd> yay |
17:52:54 | FromDiscord | <starl0rd> wrote a rudimentary bloom filter |
17:52:56 | FromDiscord | <starl0rd> https://play.nim-lang.org/#ix=2GKE |
17:53:32 | FromDiscord | <starl0rd> ^ways i could do this better \ critique ? |
17:53:43 | FromDiscord | <starl0rd> (edit) "do" => "have done" |
17:54:23 | FromDiscord | <shadow.> camelCase |
17:54:48 | FromDiscord | <shadow.> maybe make the number used in the hash function a parameter |
17:54:52 | FromDiscord | <shadow.> instead of making 3 different functions |
17:55:38 | FromDiscord | <zetashift> also you for multiple variable declaration after each other you can do https://nim-lang.org/docs/tut1.html#the-var-statement also goes for let and const |
17:55:58 | FromDiscord | <starl0rd> usually they'd be 3 very different functions. didn't feel like typing them out : P |
17:56:30 | FromDiscord | <zetashift> usually Nim peeps use the implicit `result = ba2` for example |
17:56:55 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2GKF |
17:57:02 | FromDiscord | <shadow.> dont take my word on it |
17:57:40 | FromDiscord | <starl0rd> yea, i could do that. thanks |
17:57:49 | FromDiscord | <shadow.> yeah i think my version of initBitArray should work lol |
17:57:55 | FromDiscord | <shadow.> since in nim everything is auto-zeroed |
17:58:10 | FromDiscord | <starl0rd> is it necessary ? or just prefered |
17:58:17 | FromDiscord | <zetashift> preferred! |
17:58:28 | FromDiscord | <zetashift> But since your init is camelCase, why not the rest too? haha |
17:58:41 | FromDiscord | <shadow.> yeah |
17:58:52 | FromDiscord | <shadow.> in addition, underscores and caps dont really affect things iirc |
17:58:55 | FromDiscord | <shadow.> so do_this_thing` |
17:59:03 | FromDiscord | <starl0rd> it would! but i like it nice and explicit so i dont have to use my brain when i read it back a week from now on. |
17:59:05 | FromDiscord | <shadow.> (edit) "do_this_thing`" => "`do_this_thing` is equal to `doThisThing`" |
17:59:08 | FromDiscord | <zetashift> yes users that will use your bloomfilter can use both casing |
17:59:10 | FromDiscord | <shadow.> fair enough |
17:59:32 | FromDiscord | <starl0rd> i hope no one does : p |
17:59:52 | FromDiscord | <zetashift> haha, for future data structures who knows! |
18:00:20 | FromDiscord | <zetashift> sadly don't know much about bloom filters so I can't help you that much except style |
18:00:20 | FromDiscord | <starl0rd> i just read a wikipedia article on it yesterday, thought i'd be a nice nifty thing to make as i read the seq section in the nim tutorial |
18:00:41 | FromDiscord | <starl0rd> its just a learning tool |
18:00:53 | FromDiscord | <starl0rd> (edit) "its just a learning tool ... " added "here" |
18:01:06 | FromDiscord | <zetashift> yea looks good |
18:01:07 | FromDiscord | <starl0rd> but i really didnt want to write another tree |
18:01:15 | FromDiscord | <zetashift> also nothing is imported so nobody can use it either wya |
18:01:26 | FromDiscord | <starl0rd> win |
18:01:28 | FromDiscord | <zetashift> exported |
18:01:59 | FromDiscord | <starl0rd> i just might read the bloom spec and make it a proper package next weekend if i get the time |
18:02:29 | FromDiscord | <starl0rd> publishing a package would get me introduced to nimble confs and stuff |
18:04:33 | * | thomasross joined #nim |
18:10:18 | FromGitter | <deech> What is the difference between `copyNimNode` and `copyNimTree` and are they deep copies? https://github.com/nim-lang/Nim/blob/devel/lib/core/macros.nim#L414 |
18:11:37 | FromDiscord | <lqdev> i believe that copyNimNode is a shallow copy and copyNimTree is a deep copy |
18:14:01 | FromDiscord | <shadow.> sounds about right |
18:53:42 | FromDiscord | <Quibono> sent a code paste, see https://play.nim-lang.org/#ix=2GKX |
18:53:54 | FromDiscord | <Quibono> Three dots makes more sense. |
18:54:03 | FromDiscord | <Quibono> _three dot gang_ |
19:02:05 | FromDiscord | <haxscramper> Because we also have `..<` and `...<` is too much |
19:02:20 | FromDiscord | <haxscramper> And besides, you can make own `...` operator |
19:02:21 | FromDiscord | <lqdev> i mean `..<` is your `...` |
19:05:03 | FromDiscord | <shadow.> !eval echo (0f).type |
19:05:06 | NimBot | float32 |
19:05:10 | FromDiscord | <shadow.> perfect |
19:05:15 | FromDiscord | <lqdev> yes |
19:06:02 | FromDiscord | <shadow.> yes |
19:08:20 | FromDiscord | <Quibono> So why not have ... be the default and then keep ..< |
19:08:37 | FromDiscord | <Quibono> because ellipses are literally the symbol for what .. is now. |
19:08:41 | * | Adeon quit (Ping timeout: 265 seconds) |
19:09:38 | Zevv | sure that might have been better, but its not what it is now |
19:10:29 | * | Adeon joined #nim |
19:10:46 | FromDiscord | <lqdev> `..<` is more readable because it implies lowering the RHS value |
19:10:54 | FromDiscord | <lqdev> dot dot less |
19:10:57 | FromDiscord | <lqdev> is how you read that |
19:11:27 | FromDiscord | <Quibono> Right, so keep that, and just so ... for the normal one. Never too late to change, it could be in the 1.5 version |
19:11:44 | FromDiscord | <Quibono> Then depreciate .. in 1.6 |
19:14:34 | Zevv | Id say make an RFC for that and put up an PR |
19:15:20 | Zevv | but trust me, nothing gets deprecated. what runs in 1.0 must run in 1.x |
19:15:46 | FromDiscord | <Quibono> How does one make an RFC? |
19:16:03 | Zevv | create an issue in the nim rfc repo at github |
19:16:41 | Zevv | i wish you the best but i dont think you'll get much support |
19:16:57 | Zevv | we got worse problems to fix then an subjectively bad choice for an operator |
19:17:47 | FromDiscord | <shadow.> lmao |
19:17:49 | FromDiscord | <shadow.> i prefer .. tbh |
19:18:04 | FromDiscord | <shadow.> https://media.discordapp.net/attachments/371759389889003532/784861162511794237/unknown.png |
19:18:09 | FromDiscord | <shadow.> this looks awkward |
19:18:15 | FromDiscord | <shadow.> maybe in discord font it looks good |
19:18:16 | FromDiscord | <shadow.> but in ide no |
19:18:28 | Zevv | bikeshedding |
19:19:02 | FromDiscord | <shadow.> fair enough |
19:19:29 | FromDiscord | <Quibono> I get itβs a trivial issue but it canβt be that hard to add |
19:19:47 | Zevv | it isnt |
19:20:26 | Zevv | should be 2 minutes of work |
19:20:41 | FromDiscord | <InventorMatt> you could always make a template for it and use that for all of your own projects |
19:21:30 | FromDiscord | <Quibono> True, but part of why I like Nim is it has good syntax. 1..10 feels like bad syntax. |
19:21:34 | FromDiscord | <Quibono> Iβll make the RFC |
19:22:45 | Zevv | "feels like" -> subjective |
19:22:55 | Zevv | but ill shut up now |
19:23:08 | FromDiscord | <Quibono> Isn't all syntax subjective lol. |
19:23:24 | Zevv | right. so thats why it is what it is |
19:23:33 | Zevv | there are parts i hate. there are parts i love |
19:23:42 | Zevv | but i actually dont care too much |
19:24:16 | Zevv | if you actually use stuff, it doesnt matter |
19:24:38 | Zevv | people whine about indenting, complain about style/case insensitivity |
19:25:28 | FromDiscord | <Quibono> _uses stuff and still prefers ..._ |
19:25:36 | Zevv | i think i hate all languages i use equally |
19:29:58 | FromDiscord | <Quibono> https://github.com/nim-lang/Nim/issues/16263 |
19:29:59 | disbot | β₯ Add 1...10 in place of 1..10 in order to better match English syntax. |
19:30:01 | FromDiscord | <Quibono> Let the hate begin |
19:30:03 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/EBk |
19:30:43 | FromDiscord | <haxscramper> This is not a RFC repo btw - correct one is https://github.com/nim-lang/RFCs/issues |
19:31:09 | FromDiscord | <Quibono> Lol can I move it or do I need to delete and remake it? |
19:31:45 | FromDiscord | <haxscramper> And to make it universally accessible it would have to be added in `std/system` which basically no-go under any circumstances, especially considering little practical value of such addition. |
19:31:59 | FromDiscord | <haxscramper> Delete and remake probably |
19:32:34 | FromDiscord | <Quibono> Why is it a no-go to add it to std/system? |
19:32:53 | Zevv | because of this |
19:33:10 | Zevv | what would happen if every single new idea ended up there |
19:33:31 | FromDiscord | <haxscramper> Because it is a 3k+ line file, with 2k+ more lines of 'mandatory necessary stuff' |
19:33:50 | FromDiscord | <haxscramper> with 2k+ `include`s |
19:34:21 | FromDiscord | <haxscramper> I just have `hmisc` package where I dump all of my ideas in such cases, and drag it around for all projects |
19:34:44 | FromDiscord | <Quibono> Alright, I won't resubmit. |
19:35:58 | Zoom[m] | Hey, I thought I've caught up with AOC. How is it it's still Dec the 5th but the 6th day is already on? |
19:37:03 | Zoom[m] | That's a real π€¦ββοΈmoment. That's the timer counting to the 6th day... |
19:48:38 | * | sschwarzer joined #nim |
19:54:04 | disruptek | i think i hate all languages zevv uses equally. |
19:55:06 | sschwarzer | disruptek: Which languages were you talking about? |
19:55:29 | disruptek | languages zevv uses. |
19:56:08 | sschwarzer | disruptek: oookay. I meant, which languages specifically? |
19:56:37 | disruptek | just the ones he uses. |
19:57:02 | disruptek | if he uses it, i think i hate it. |
19:57:09 | sschwarzer | disruptek: I see. Everything's crystal clear now. Thank you very much! ;-) |
19:57:59 | * | a_chou joined #nim |
19:58:42 | * | a_chou quit (Remote host closed the connection) |
19:59:12 | * | a_chou joined #nim |
19:59:29 | sschwarzer | Is it possible to store an AST for later processing at runtime? For example, in https://play.nim-lang.org/#ix=2GLd , I would like to store the AST that can be visualized with `dumpTree` in a const or let "variable". Somehow I think this should be easy, but don't see how. |
20:00:02 | disruptek | why not? |
20:00:51 | sschwarzer | disruptek: You mean why it shouldn't be easy? Or why I don't see it? :) |
20:01:06 | sschwarzer | I mean, how can I do it in Nim? |
20:01:24 | FromDiscord | <InventorMatt> Do you want to store it as a string? |
20:01:41 | disruptek | what is it you want to store? nim nodes? a string representing the code? or just the semantic relationships? |
20:01:56 | sschwarzer | InventorMatt: No, I want to store it as a tree, similar to JSON or `XmlNode`s |
20:02:12 | sschwarzer | I want to store the AST data structure. |
20:02:36 | sschwarzer | The same that a macro in place of `dumpTree` would see. |
20:02:41 | FromDiscord | <InventorMatt> Its possible to store it but only during compile time. |
20:02:43 | disruptek | you can't store a ref as a const. or maybe timmy got his wish and now you can. |
20:03:23 | sschwarzer | disruptek: good point. I'd also be fine with storing it with let as ref. |
20:03:43 | disruptek | i think you can let refs now. |
20:04:11 | disruptek | as a hack, you could de/serialize it with frosty. |
20:05:37 | FromDiscord | <dom96> disruptek: who's timmy? |
20:07:00 | disruptek | timothee |
20:07:28 | FromDiscord | <fwsgonzo> is there a nim executable option to make the name of the nimcache .json file a known filename? |
20:07:37 | FromDiscord | <fwsgonzo> (edit) "is there a nim executable option to make the name of the nimcache .json file a known filename? ... " added "it'" |
20:07:47 | FromDiscord | <fwsgonzo> (edit) "it'" => "it's a little bit annoying to have to translate x.nim into x.json" |
20:07:54 | disruptek | dude, keep us posted on your work. it's pretty interesting. |
20:09:16 | disruptek | there's a proc to change a file extension. i think it's called changeFileExt. |
20:11:22 | sschwarzer | disruptek: What dude and work? |
20:12:02 | disruptek | gonzo is doing some pretty interesting stuff with cache vms. |
20:13:09 | disruptek | maybe i can find the medium posts. |
20:13:47 | disruptek | https://fwsgonzo.medium.com/virtual-machines-for-multi-tenancy-in-varnish-1c619ea3276 |
20:16:23 | sschwarzer | disruptek: thanks |
20:16:44 | disruptek | clyybber: ^ |
20:17:48 | disruptek | we should probably have a bloom filter package. i will improve this one and if no one wants to maintain it, i guess i will. |
20:20:40 | * | narimiran quit (Quit: leaving) |
20:22:43 | * | a_chou quit (Quit: a_chou) |
20:27:57 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2GLn |
20:29:14 | FromDiscord | <fwsgonzo> Just to clarify, the above is working code |
20:30:04 | * | sschwarzer quit (Quit: leaving) |
20:31:07 | disruptek | i mean, there are really great ways to do this in nim. |
20:31:39 | disruptek | you can make a macro that produces a unique symbol that is shared by both pieces of code but won't be clobbered by anything else. |
20:32:33 | disruptek | macros are perfect for setting up complex compile-time logic, but you can even use a template for something this simple. |
20:36:54 | * | unclechu quit (Ping timeout: 244 seconds) |
20:36:54 | * | L[m] quit (Ping timeout: 244 seconds) |
20:36:57 | * | guelosk[m] quit (Ping timeout: 246 seconds) |
20:37:00 | * | leorize[m] quit (Ping timeout: 246 seconds) |
20:37:29 | * | ee7[m] quit (Ping timeout: 244 seconds) |
20:37:29 | * | Clonkk[m] quit (Ping timeout: 244 seconds) |
20:37:32 | * | jonjitsu[m] quit (Ping timeout: 260 seconds) |
20:37:33 | * | Zoom[m] quit (Ping timeout: 260 seconds) |
20:37:33 | * | leorize[m]1 quit (Ping timeout: 260 seconds) |
20:37:33 | * | GitterIntegratio quit (Ping timeout: 260 seconds) |
20:37:35 | * | Jitty[m] quit (Ping timeout: 268 seconds) |
20:37:36 | * | ache-of-head[m] quit (Ping timeout: 268 seconds) |
20:37:36 | * | BitPuffin quit (Ping timeout: 268 seconds) |
20:37:44 | * | jaens[m] quit (Ping timeout: 240 seconds) |
20:37:44 | * | reversem3 quit (Ping timeout: 240 seconds) |
20:37:47 | * | MTRNord quit (Ping timeout: 260 seconds) |
20:37:50 | * | lnxw37d4 quit (Ping timeout: 264 seconds) |
20:38:12 | * | lytedev[m] quit (Ping timeout: 268 seconds) |
20:38:21 | * | pixtum[m] quit (Ping timeout: 246 seconds) |
20:38:49 | * | Avatarfighter[m] quit (Ping timeout: 268 seconds) |
20:45:54 | * | hnOsmium0001 joined #nim |
20:48:46 | hmmm | wtf happened :o |
20:57:00 | Prestige | hmmm: hmm? |
20:58:24 | * | habamax quit (Ping timeout: 265 seconds) |
20:58:28 | * | reversem3 joined #nim |
20:59:21 | lain | is the order of macro evaluation well-defined in nim? |
20:59:28 | disruptek | yes. |
21:00:03 | * | pixtum[m] joined #nim |
21:00:17 | * | leorize[m] joined #nim |
21:00:43 | * | jaens[m] joined #nim |
21:01:16 | * | guelosk[m] joined #nim |
21:02:14 | * | unclechu joined #nim |
21:03:44 | lain | is it just the order they're encountered in (so, top-down, left-to-right?) |
21:04:31 | * | lytedev[m] joined #nim |
21:04:46 | * | L[m] joined #nim |
21:04:52 | disruptek | it depends on whether their inputs are typed or not; untyped passes can be evaluated earlier than typed passes. |
21:05:07 | lain | ah right |
21:05:16 | * | BitPuffin joined #nim |
21:06:08 | * | ee7[m] joined #nim |
21:06:59 | * | Jitty[m] joined #nim |
21:07:28 | * | Northstrider[m] joined #nim |
21:08:48 | * | Avatarfighter[m] joined #nim |
21:08:55 | * | ache-of-head[m] joined #nim |
21:12:27 | * | jonjitsu[m] joined #nim |
21:12:56 | * | leorize[m]1 joined #nim |
21:14:15 | * | MTRNord joined #nim |
21:17:05 | * | lnxw37d4 joined #nim |
21:18:32 | * | Clonkk[m] joined #nim |
21:18:47 | * | Zoom[m] joined #nim |
22:24:16 | * | asie joined #nim |
22:55:04 | FromDiscord | <Digitalcraftsman> sent a long message, see http://ix.io/2GMn |
22:55:46 | FromDiscord | <Digitalcraftsman> (edit) "http://ix.io/2GMn" => "http://ix.io/2GMo" |
22:56:01 | FromDiscord | <lqdev> the reason is that the current behavior prevents many bugs. |
22:56:09 | FromDiscord | <lqdev> and is stricter. |
22:56:31 | FromDiscord | <lqdev> what bugs? ask Araq, he said that ._. |
22:57:33 | disruptek | defaulting to immutability is obviously more conservative. |
22:57:43 | * | Vladar quit (Remote host closed the connection) |
22:58:25 | FromDiscord | <Digitalcraftsman> But a=20 and b=30 are known at compile time. In case of a proc call such as foo(a=bar(), b=buzz()) I would expected this. |
22:58:41 | disruptek | yes, they are known to be static and immutable. |
22:59:19 | disruptek | ergo, the signature does not match. you feel me? |
23:01:22 | FromDiscord | <Digitalcraftsman> I can understand this stricter behavior if you want to prevent bugs with all kinds of function call variations. |
23:01:39 | disruptek | good. |
23:03:43 | * | hmmm quit () |
23:05:32 | FromDiscord | <Digitalcraftsman> The drawback with this behavior in my AoC implementation is that I had to declare the variables bottom, bottom2, top and top2 for calling `binSearch()` but I don't use them afterwards. See https://github.com/digitalcraftsman/advent-of-code-2020/blob/main/05/part2.nim |
23:06:37 | FromDiscord | <Digitalcraftsman> Is there a better way for calling a proc with variables parameters as in my case? |
23:07:02 | disruptek | why do you pass them as mutable at all? |
23:07:21 | FromDiscord | <Esbeesy> Yeah the bounds can't ever change can they? |
23:07:38 | disruptek | well, as soon as the proc returns they are unused, so... |
23:07:41 | FromDiscord | <Esbeesy> Oh no wait they do |
23:07:56 | FromDiscord | <Digitalcraftsman> that's the point |
23:08:06 | disruptek | what's the point? |
23:08:29 | disruptek | proc binSearch(bottom, top: int; ...) = var bottom = bottom; var top = top; ... |
23:08:51 | disruptek | then you just binSearch(0, 128, ...) ... binSearch(0, 8, ...) |
23:08:58 | disruptek | this is a nim idiom. |
23:09:07 | FromDiscord | <Digitalcraftsman> The parameters top and bottom always stay in the range they define at the beginning. I wanted to make top and bottom mutable so I don't have to declare another two mutable vars inside binSearch |
23:09:21 | disruptek | welcome to abstraction. |
23:09:57 | disruptek | they aren't additional if you're declaring them in any event, right? |
23:11:06 | disruptek | in fact, you only need to declare top. bottom is synonymous with `result` here. |
23:11:37 | disruptek | and diff can be a template if it pleases you. |
23:11:51 | FromDiscord | <Digitalcraftsman> top and bottom have to be set depending on the usecase. Since I use binSearch twice with difference range bounds I moved the code into proc |
23:12:35 | disruptek | well, i stand by my statements, but you can write the code any way you want. |
23:14:39 | FromDiscord | <Digitalcraftsman> I had a version where I used result directly instead of bottom. the compiler warned about variable shadowing. But with the current of my code I dont get any compiler warnings anymore. I'll replace bottom with result then |
23:15:28 | FromDiscord | <Digitalcraftsman> I'll have a look at templates. It's just one of the more advanced features that I haven't used so far |
23:15:35 | FromDiscord | <Digitalcraftsman> (edit) "advanced" => ""advanced"" |
23:15:56 | disruptek | they can be useful trivially, too. |
23:16:20 | disruptek | template diff: int = foo - bar |
23:18:09 | disruptek | you probably got a shadowing warning because you shadowed the special symbol `result`; it shouldn't be redeclared, and then you won't be warned about reuse of the identifier. |
23:18:34 | FromDiscord | <shadow.> !eval echo (1..10).type |
23:18:36 | NimBot | HSlice[system.int, system.int] |
23:18:40 | FromDiscord | <shadow.> ah ok |
23:19:36 | disruptek | !eval import os; echo "goatse".addFileExt "cx" |
23:19:39 | NimBot | goatse.cx |
23:19:46 | disruptek | interesting. |
23:20:00 | FromDiscord | <shadow.> lol |
23:20:13 | FromDiscord | <Digitalcraftsman> yeq that was in one of the earlier iterations where I declared var (foo, result) = (bottom, top) inside the proc. |
23:20:40 | FromDiscord | <shadow.> what's the correct type so that you can pass `0..10` or `20..50` to a function |
23:20:48 | FromDiscord | <shadow.> hslice and slice aren't working |
23:21:08 | FromDiscord | <shadow.> wait nvm |
23:21:10 | FromDiscord | <shadow.> im being dumb |
23:24:08 | FromDiscord | <Digitalcraftsman> (edit) I had a version where I used result directly instead of bottom. the compiler warned about variable shadowing. But with the current iteration of my code I dont get any compiler warnings anymore. I'll replace bottom with result then |
23:24:30 | FromDiscord | <Digitalcraftsman> (edit) top and bottom have to be set depending on the usecase. Since I use binSearch twice with different range bounds I moved the code into proc |
23:24:56 | FromDiscord | <Digitalcraftsman> (edit) yep that was in one of the earlier iterations where I declared var (foo, result) = (bottom, top) inside the proc. |
23:28:37 | FromDiscord | <ElegantBeef> Congrats, you figured it out π |
23:29:27 | FromDiscord | <Recruit_main707> Lol |
23:42:43 | * | vicfred quit (Quit: Leaving) |
23:46:30 | FromDiscord | <shadow.> yes |
23:46:35 | FromDiscord | <shadow.> the issue was i was being dumb |
23:47:14 | FromDiscord | <ElegantBeef> Dont worry i'm incapable of figuring out how to properly await a asyncJS future π |
23:47:48 | FromDiscord | <shadow.> lmfao |
23:48:13 | * | jaggz joined #nim |
23:49:03 | FromDiscord | <ElegantBeef> `Error: undeclared identifier: 'await'` the most infuriating error |
23:49:32 | FromDiscord | <shadow.> loll |
23:50:35 | * | PMunch quit (Quit: leaving) |
23:53:45 | disruptek | i know. it means you're using threads wrong. |
23:53:58 | FromDiscord | <ElegantBeef> I mean it's javascript so i hope not π |
23:54:31 | disruptek | if it's javascript, i guarantee you're using threads wrong. π |
23:54:51 | FromDiscord | <ElegantBeef> Well i'm not using threads i'm attempting to get a media recorder, but that uses a promise to be constructed |
23:55:01 | FromDiscord | <ElegantBeef> So it's just a pain |
23:56:16 | FromDiscord | <ElegantBeef> I suppose i could try using the asyncJs promises, but i'd really just like to get it linearized |
23:57:58 | FromDiscord | <ElegantBeef> Also annoyingly it seems that a `newJsObject` outputs `[{}]` |
23:58:20 | FromDiscord | <ElegantBeef> Ah guess that's fine? |
23:58:40 | disruptek | i wouldn't tolerate that shit. |
23:58:45 | disruptek | make someone pay. |