00:42:26 | FromDiscord | <m4ul3r> How would I go about using libdwarf in nim? |
00:42:59 | FromDiscord | <Hourglass [She/Her]> What is the recommended way of exposing Nim functions and types to the JVM? (Using jnim, something else would also work tho) |
00:43:49 | FromDiscord | <Elegantbeef> c2nim or futhark the header then link to the library using passL or dynlib↵(@m4ul3r) |
00:50:07 | NimEventer | New post on r/nim by kittywrastler: Importing File Help, see https://reddit.com/r/nim/comments/11b7dvi/importing_file_help/ |
01:10:40 | * | ShadowSector joined #nim |
01:17:10 | NimEventer | New thread by WizardUli: Make nimble task depend on "build", see https://forum.nim-lang.org/t/9936 |
01:18:51 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4p7J |
01:19:41 | FromDiscord | <guttural666> second example does not work, despite being tested on an engine on the net, this is just infuriating |
01:25:46 | FromDiscord | <Nilts> In reply to @not logged in "I want to get": Lol did anyone respond to this. |
02:44:37 | FromDiscord | <m4ul3r> In reply to @Elegantbeef "c2nim or futhark the": thanks for sharing options. c2nim and dynlib doesn't seem to work for me since I'm dealing with structs -- but I'm testing out futhark |
02:46:53 | FromDiscord | <Diogenes of Toronto> hey how do I execute shell commmands from nim |
02:48:42 | FromDiscord | <Nilts> In reply to @Diogenes of Toronto "hey how do I": https://nim-lang.org/docs/osproc.html |
03:10:19 | FromDiscord | <wikimedia foundation> Guy who's making Lobster lang made FlatBuffers, presumably you can deserialize and parse selectively, if you have one big tree and you need only a few fields at a time |
03:12:31 | FromDiscord | <Elegantbeef> Yes you can if you really must https://nim-lang.org/docs/parsexml.html#example-2colon-retrieve-all-html-links |
03:13:01 | FromDiscord | <Elegantbeef> Assuming we're not just talking arbitraily |
03:23:39 | FromDiscord | <ringabout> Can we compile the Nim compiler to WASM using Emscripten? |
03:24:00 | FromDiscord | <Elegantbeef> The VM can be |
03:24:50 | FromDiscord | <ringabout> It would be cool to host the Nim compiler at the browser, |
03:26:15 | FromDiscord | <Elegantbeef> The main issue with the full compiler is I do not think there is a C compiler that runs there |
03:26:31 | FromDiscord | <Elegantbeef> https://www.jasonbeetham.com/snake/nicoscripter.html does showcase the vm working though 😄 |
03:27:03 | FromDiscord | <ringabout> Yeah, we probably need a dedicated wasm backend, at least JS works there. |
03:27:15 | FromDiscord | <ringabout> In reply to @Elegantbeef "https://www.jasonbeetham.com/snake/nicoscripter.htm": Nice! |
04:05:40 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4p7Y |
04:05:46 | FromDiscord | <m4ul3r> (edit) "https://play.nim-lang.org/#ix=4p7Y" => "https://play.nim-lang.org/#ix=4p7Z" |
04:06:38 | FromDiscord | <Elegantbeef> you need `-ldward` |
04:06:45 | FromDiscord | <Elegantbeef> or `-ldwarf` 😛 |
04:07:48 | FromDiscord | <Elegantbeef> `-L` is for library paths not linking |
04:09:02 | FromDiscord | <huantian> Tfw when C |
04:12:22 | FromDiscord | <m4ul3r> In reply to @huantian "Tfw when C": https://tenor.com/view/pepe-why-under256kb-peepo-pepe-discord-gif-22126250 |
04:18:21 | * | ShadowSector quit (Quit: Leaving) |
04:35:50 | FromDiscord | <Hourglass [She/Her]> In reply to @ringabout "Can we compile the": I mean, someone compiled clang to wasm |
04:36:00 | FromDiscord | <Hourglass [She/Her]> And actually made it possible to compile files with it |
04:36:10 | FromDiscord | <Hourglass [She/Her]> So |
04:37:57 | FromDiscord | <ringabout> Sounds interesting, though for now I'm more interested in making the `Nimscript` the first class backend and separate its implementation with old VM execution. |
04:38:18 | FromDiscord | <ringabout> (edit) "Sounds interesting, though for now I'm more interested in making the `Nimscript` the first class backend and separate its implementation with ... oldexecution" added "the" | "execution." => "execution mechanism." |
04:38:52 | FromDiscord | <Hourglass [She/Her]> In reply to @ringabout "Sounds interesting, though for": Wdym? You mean making it feature complete and stuff? |
04:39:41 | FromDiscord | <Hourglass [She/Her]> I think Nimskull did a rewrite of the NimScript VM |
04:42:43 | FromDiscord | <ringabout> I knew that, I would rewrite the Nimscript implementation without the consideration of the macros/VM which still use the old implementation so that the Nimscript backend could actually become an efficient interpreter backend. |
04:43:17 | FromDiscord | <Elegantbeef> I wonder if it makes sense to just emit wasm byte code in that case |
04:43:31 | FromDiscord | <Elegantbeef> It's something i considered for a theoretical language |
04:43:42 | FromDiscord | <huantian> WASM as a first class target? 👀 |
04:44:21 | FromDiscord | <ringabout> The Nimscript backend should have its own memory management, actually the VM/Nimscript are leaking memory without recycling. |
04:44:31 | FromDiscord | <ringabout> (edit) "The Nimscript backend should have its own memory management, actually the ... VM/Nimscript" added "current" |
04:44:47 | FromDiscord | <huantian> Huh |
04:44:49 | FromDiscord | <Hourglass [She/Her]> In reply to @ringabout "I knew that, I": Ah |
04:45:13 | FromDiscord | <Hourglass [She/Her]> In reply to @Elegantbeef "I wonder if it": Emit WASM bytecode so it can be ran on a WASM runtime instead? That'd be cool |
04:45:51 | FromDiscord | <Hourglass [She/Her]> In reply to @ringabout "The Nimscript backend should": The last part of that doesn't make much sense |
04:46:12 | FromDiscord | <Elegantbeef> Yea first class wasm huan, my theoretical language plan was to emit wasm and load wasm modules that could implement backends |
04:47:07 | FromDiscord | <Diogenes of Toronto> Thoughts on graalvm |
04:47:13 | FromDiscord | <Hourglass [She/Her]> For Nim or for your own language? |
04:47:36 | FromDiscord | <Diogenes of Toronto> For nim |
04:47:38 | FromDiscord | <Hourglass [She/Her]> In reply to @Diogenes of Toronto "Thoughts on graalvm": It's p cool, I use it as the go-to JVM runtime and GraalJS is neat |
04:47:48 | FromDiscord | <Hourglass [She/Her]> (edit) "For Nim or for your own language? ... " added "(Beef)" |
04:48:02 | * | azimut quit (Ping timeout: 255 seconds) |
04:49:08 | FromDiscord | <Hourglass [She/Her]> In reply to @Diogenes of Toronto "For nim": How would it be used for Nim? Via GraalLLVM? I don't see much benefit really |
04:49:38 | FromDiscord | <Elegantbeef> The wasm compiler 😄 |
04:49:57 | FromDiscord | <Elegantbeef> My own language |
04:50:16 | FromDiscord | <Elegantbeef> No that i'd ever write it cause it's basically just a Nim fork |
04:51:26 | FromDiscord | <Diogenes of Toronto> In reply to @Hourglass, When the Hour Strikes "How would it be": yeah i guess not |
04:51:48 | FromDiscord | <Hourglass [She/Her]> In reply to @Elegantbeef "No that i'd ever": Lol |
04:52:50 | FromDiscord | <Hourglass [She/Her]> I'm hoping my motivation for the mc server impl stays because I am getting an urge to work on something to do with the Nim compiler again and I don't like it |
04:54:07 | FromDiscord | <Elegantbeef> Ringabout your pass changes would it mess with tooling much? |
04:54:38 | FromDiscord | <ringabout> Which changes? |
04:54:43 | FromDiscord | <ringabout> (edit) "changes?" => "change?" |
04:54:50 | FromDiscord | <Elegantbeef> The ones that remove the compiler pass api |
04:56:04 | FromDiscord | <Elegantbeef> I'm playing around with an opinionated Header generator so just curious if it'd impede that any |
04:58:08 | FromDiscord | <ringabout> I will keep/deprecate the pass interface. |
04:58:30 | FromDiscord | <Elegantbeef> So what would be the proper way for tooling to interact with it? |
04:59:40 | FromDiscord | <Elegantbeef> I guess disregard that 😄 |
04:59:45 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4p87 |
04:59:56 | FromDiscord | <Elegantbeef> Rika i explained that about 30 times 😄 |
05:00:38 | FromDiscord | <Rika> sorry i have you mentally blocked |
05:00:50 | FromDiscord | <Elegantbeef> What a coincidence I do aswell |
05:01:09 | FromDiscord | <ringabout> I have yet had an idea, it seems that after removing passes, I need to duplicate code for lots of backends. |
05:02:16 | FromDiscord | <Elegantbeef> Wonder if it just makes sense to use `static Passes` to remove the runtime dispatch, and make it more sensible |
05:02:52 | FromDiscord | <Elegantbeef> Probably too much work to use a static openarray there though |
05:03:28 | FromDiscord | <ringabout> Yeah, probably |
05:26:03 | * | arkurious quit (Quit: Leaving) |
06:32:32 | * | ltriant quit (Ping timeout: 248 seconds) |
07:23:41 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4p8z |
07:25:08 | FromDiscord | <m4ul3r> (edit) "https://play.nim-lang.org/#ix=4p8z" => "https://paste.rs/06X" |
07:35:23 | * | kenran joined #nim |
07:46:23 | FromDiscord | <qb> sent a code paste, see https://play.nim-lang.org/#ix=4p8D |
07:46:38 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4p8E |
07:47:45 | FromDiscord | <Dudugz> In reply to @qb "How could I calculate": I think you need to divide the size by 2 to get the center of the rectangle ``(rec.width / 2) factor``... |
07:50:34 | FromDiscord | <qb> That was my first try as well but leads into a wrong position |
08:07:40 | FromDiscord | <qb> Got it |
08:15:49 | * | kenran quit (Remote host closed the connection) |
08:27:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4p8K |
09:02:15 | * | Notxor joined #nim |
09:03:04 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4p8S |
09:03:33 | FromDiscord | <Rika> that's invalid json |
09:03:45 | FromDiscord | <Dudugz> (edit) "https://play.nim-lang.org/#ix=4p8S" => "https://play.nim-lang.org/#ix=4p8T" |
09:03:49 | FromDiscord | <Dudugz> Sorry it's pseudo |
09:03:59 | FromDiscord | <Rika> `document["main"]["messages"]`? |
09:04:08 | FromDiscord | <Rika> or i think `document{"main |
09:04:14 | FromDiscord | <Rika> (edit) "`document{"main" => "`document{"main", "messages"}` works too?" |
09:04:25 | FromDiscord | <Elegantbeef> The real answer is going to be "use jsonutils and convert it into the proper type" |
09:04:52 | FromDiscord | <Dudugz> Hm, it worked now, weird when I tried it before it didn't work, thx |
09:07:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4p8W |
09:07:21 | FromDiscord | <Elegantbeef> It's likely saner than what you're doing 😛 |
09:08:22 | FromDiscord | <Dudugz> Hmm, in the case of deserialize, in my case there is no extreme need but I can do it too. |
09:08:32 | FromDiscord | <Dudugz> (edit) removed "the" | removed "of" |
10:33:42 | FromDiscord | <gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4p9j |
10:34:07 | FromDiscord | <gogolxdong> https://media.discordapp.net/attachments/371759389889003532/1078988255682363464/image.png |
10:48:50 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9k |
10:49:01 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4p9k" => "https://play.nim-lang.org/#ix=4p9l" |
10:49:11 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4p9l" => "https://play.nim-lang.org/#ix=4p9m" |
10:50:35 | FromDiscord | <Phil> sent a long message, see https://paste.rs/9Jz |
10:51:40 | FromDiscord | <Phil> Argh, it's likely looking at tags |
10:52:27 | FromDiscord | <ringabout> Yeah |
10:58:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9u |
10:59:12 | FromDiscord | <ringabout> Is it? |
10:59:54 | FromDiscord | <ringabout> I'm not aware of that change. |
11:00:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9v |
11:02:39 | FromDiscord | <ringabout> Weird, I don't like the change |
11:03:11 | FromDiscord | <Phil> I feel like something is broken with the package or sth, this all just seems odd |
11:03:35 | FromDiscord | <Rika> Honestly thinking we should start forking whatever Dom made for Nim since he isn’t affiliated anymore |
11:03:53 | FromDiscord | <Rika> Unless it’s already done then okay |
11:05:05 | FromDiscord | <Phil> Okay, I think the package is just broken, I don't understand how or why or what but the installation must be completely fucked |
11:17:05 | FromDiscord | <amadan> You forgot to specify the `srcDir` |
11:17:22 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4p9C |
11:19:44 | FromDiscord | <Phil> Arrrrrghhh the joys of package setups when you take over from others |
11:32:52 | FromDiscord | <Phil> Thanks @amadan that fixed some of the core issues with the package.↵Now I just need to figure out why in the seven hells the norm tests keep failing as they somehow can't find the lowdb package for importing |
11:33:24 | FromDiscord | <Phil> This fiddly stuff is the most annoying part of software dev, it's all about 100 gears and you need to figure out which one to tune |
11:33:35 | FromDiscord | <Phil> (edit) "tune" => "turn" |
11:33:50 | FromDiscord | <amadan> Looks like you're latest commit worked 🎉 |
11:34:37 | FromDiscord | <Phil> ... wtf it doesn't locally |
11:35:24 | FromDiscord | <ringabout> In reply to @Isofruit "... wtf it doesn't": How did you know? From CI? |
11:35:28 | FromDiscord | <Phil> Like, for me the command `sudo docker-compose run --rm tests` is completely broken |
11:36:37 | FromDiscord | <ringabout> https://github.com/moigagoo/norm/pull/186 Isn't it green? |
11:36:39 | FromDiscord | <Phil> In reply to @ringabout "How did you know?": Norm provides a command to run its test-suite containerized:↵`docker-compose run --rm tests`↵It's based on the provide docker compose file: https://github.com/moigagoo/norm/blob/4479240e6a3347fa8990839b7240d346c4b686a6/docker-compose.yml#L9↵That starts up a container and executes `nimble test` |
11:36:50 | FromDiscord | <Phil> Yeah in the github CI, but now when you want to execute the test-suite locally |
11:37:01 | FromDiscord | <Phil> E.g. for local development |
11:37:05 | FromDiscord | <amadan> Did you rebuild the container image? |
11:37:16 | FromDiscord | <Phil> Doesn't that happen automatically? |
11:37:44 | FromDiscord | <Phil> Should be part of the commands somewhere IIRC |
11:38:11 | FromDiscord | <amadan> Mean it should since the ADD should invalidate the run↵but iirc docker-compose doesn't auto rebuild does no? |
11:38:33 | FromDiscord | <Phil> I'll nuke the image and all container from my system just to be sure |
11:39:07 | FromDiscord | <Phil> You were correct |
11:39:13 | FromDiscord | <amadan> Ran into that problem in a group project when people forgot to rebuild the images↵made this Makefile to auto rebuild when serving just so I didn't have to act as tech support lol |
11:48:59 | * | luis joined #nim |
11:54:39 | FromDiscord | <Phil> Now I want to fiddle with norms test-setup and looking at it, introducing a matrix makes it look like the test-suite needs an overhaul >_> |
11:55:27 | FromDiscord | <amadan> Whats the issue with it?↵Looks like you just need to run `testament all` and it should all run |
11:55:54 | FromDiscord | <Phil> testament all doesn't run is the issue |
11:55:54 | FromDiscord | <amadan> Least locally that does it for me |
11:56:15 | FromDiscord | <Phil> Neither locally nor on github does it work |
11:57:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pa2 |
11:59:07 | FromDiscord | <amadan> weird? https://media.discordapp.net/attachments/371759389889003532/1079009649208078406/image.png |
11:59:18 | FromDiscord | <amadan> (postgres failing since I don |
11:59:26 | FromDiscord | <amadan> (edit) "don" => "don't have postgres running)" |
12:01:05 | FromDiscord | <Phil> Seems to be a rights issue for some reason |
12:02:28 | FromDiscord | <Phil> Argh, somewhere in there the directories were created as root and thus limited access rights |
12:02:36 | FromDiscord | <Phil> Nuking them fixed the issue as they were recreated, but this time not as root |
12:03:11 | FromDiscord | <Phil> Tests in the gh pipeline also seem to fail for some reason though |
12:03:31 | FromDiscord | <amadan> the postgres tests don't read from environment variable it seems |
12:04:27 | FromDiscord | <amadan> Seems easy enough to run `sed` to replace the dbhost const with a `getEnv` call↵Just need to import os for every file, but think you can just chuck a `--import:os` into config.nims can't you? |
12:10:45 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4paa |
12:23:56 | FromDiscord | <Phil> Thanks, did use that, now trying to figure out what arcane invocation I need to run a postgres container with in order for my tests to be able to connect to it |
12:25:05 | FromDiscord | <amadan> Mean you should be able to just connect to it like in the lowdb tests no? |
12:25:15 | FromDiscord | <Phil> locally |
12:25:32 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4paf |
12:25:39 | FromDiscord | <amadan> no magic needed 😜 |
12:25:53 | FromDiscord | <amadan> (edit) "https://play.nim-lang.org/#ix=4paf" => "https://play.nim-lang.org/#ix=4pag" |
12:34:14 | FromDiscord | <Phil> Turns out in nim devel norm no longer supports `Positive` and needs explicit dbType procs for it |
12:36:06 | FromDiscord | <Phil> Wait, it does... but also doesn't?↵Wow that error reads weird |
12:36:41 | * | azimut joined #nim |
12:37:45 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4paj |
12:38:51 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4paj" => "https://play.nim-lang.org/#ix=4pak" |
12:39:13 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4pak" => "https://play.nim-lang.org/#ix=4pal" |
12:39:49 | FromDiscord | <Phil> So if I'm understanding the error right, the issue is that it can't call a `dbType` proc on a `typedesc[Positive]` because it finds nothing that matches, right? |
12:40:12 | FromDiscord | <Phil> But if I define a `dbType` proc for `typedesc[Positive]`, I start getting ambiguity errors elsewhere |
13:10:56 | * | jmdaemon quit (Ping timeout: 248 seconds) |
13:12:40 | FromDiscord | <Phil> Okay, I got the fundamental gist of the problem, not sure if it's a nim one or not |
13:13:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pax |
13:14:41 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Nqk |
13:15:06 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4paC" => "https://play.nim-lang.org/#ix=4paB" |
13:15:23 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4pax" => "https://play.nim-lang.org/#ix=4paE" |
13:18:09 | FromDiscord | <Phil> The examples above both work in nim 1.6.10 btw.↵When dbType for `Positive` is defined, they both call that proc.↵When it isn't defined, they both call `dbType` defined for int64 |
13:45:44 | * | xet7 quit (Ping timeout: 268 seconds) |
13:46:40 | FromDiscord | <Phil> I found a way to work around the issue for now by making it a generic.↵Luckily we want to do the exact same thing for Positive as we want for int64, so just expanding the dbtype for int64 like this works:'↵`func dbType(T: typedesc[int64 | Positive]): string = "BIGINT"` |
14:00:27 | * | ltriant joined #nim |
14:05:27 | * | ltriant quit (Ping timeout: 268 seconds) |
14:22:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pb8 |
14:23:50 | FromDiscord | <Rika> those two syntaxes (syntices??) are different systems |
14:24:36 | FromDiscord | <Rika> second one is more of `PGHOST=localhost; testament all`, first one is more of `export PGHOST=localhost; testament all` |
14:26:45 | * | via__ joined #nim |
14:28:02 | via__ | i'm pretty new to nim and am struggling with some syntax around iterators i was hoping someone could help with. i'm trying to use fieldPairs on an object |
14:28:28 | via__ | but first, is there no way to just get the iterator for fieldPairs into a seq to a variable? let x = example.fieldPairs.toSeq does not compile for example |
14:28:29 | FromDiscord | <Rika> In reply to @via__ "i'm pretty new to": do you have a code snippet to show? |
14:28:51 | FromDiscord | <Rika> In reply to @via__ "but first, is there": that should compile in modern nim, what version are you using |
14:29:03 | via__ | 1.6.10 |
14:29:17 | FromDiscord | <Rika> ah wait |
14:29:23 | FromDiscord | <Rika> i misunderstood |
14:29:28 | FromDiscord | <Rika> yeah i dont hink that works |
14:29:37 | FromDiscord | <Rika> fieldpairs is not a traditional iterator |
14:30:04 | FromDiscord | <Rika> its one of the special case iterators in nim, where it expands into an unrolled loop when used with `for` |
14:30:18 | via__ | yeah, i'd much prefer to not have to explicitly use this just in the form of a for loop, but even then, i'm trying to do: for x, y in example.fieldPairs: something.add(&"{x}") |
14:30:21 | FromDiscord | <Dudugz> Is it possible to set an outDir in .nimble for binaries? |
14:30:21 | via__ | and that also appears to not compile |
14:31:00 | via__ | is there any way to get something like fieldpairs in a form that doesn't have restrictions like that? i guess i could just explicitly make a seq with a for loop and then do things with it |
14:32:52 | FromDiscord | <Rika> i dont see any issues with the second example |
14:33:01 | FromDiscord | <Rika> ah, its an issue with strformat i think |
14:33:15 | via__ | ```core/macros.nim(533, 1) Error: undeclared identifier: 'x'``` |
14:33:22 | FromDiscord | <Rika> just add it directly |
14:33:26 | FromDiscord | <Rika> `something.add(x)` |
14:33:30 | FromDiscord | <Rika> x is a string anyway |
14:33:37 | via__ | well, i need to do more with it, this was just a reduced example |
14:34:06 | FromDiscord | <Rika> then declare another version of it at the top `let xx = x` as a hack |
14:34:40 | via__ | okay. yeah i can hack around it all sorts of ways, like i could just make a for loop that stores the full fieldPairs results in a seq, it just felt like there should be a better way, wasn't sure if i was missing something |
14:35:28 | via__ | (especially since afaict thats what toSeq is supposed to be) |
14:36:39 | FromDiscord | <Rika> not really, as ive said fieldPairs is a special type of iterator that isnt really an iterator |
14:37:10 | via__ | okay. there's no other way to get an objects field names (and optionally types) is there? |
14:37:12 | FromDiscord | <Rika> since the second thing it returns (y) is "multitype" and exists only on compile time since it's a "type descriptor" (types as values) |
14:37:25 | via__ | ok |
14:38:18 | FromDiscord | <Rika> here's a doc link if you need it https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT |
14:39:05 | via__ | yeah i've been using that, it just wasn't clear to me that the behavior i'm seeing is expected from that |
14:39:21 | via__ | i guess thats the symbol binding bug |
14:41:21 | FromDiscord | <Rika> the undeclared identifier one is the symbol binding bug |
14:41:39 | via__ | okay, thank you |
15:00:53 | luis | are there people streaming nim programming on twitch or yt? |
15:01:05 | luis | id like to follow if yes |
15:02:30 | FromDiscord | <auxym> I know pmunch streams occasionally: https://www.youtube.com/@peterme |
15:02:58 | FromDiscord | <Phil> In reply to @luis "are there people streaming": Not streaming, but Kiloneie bumps out nim videos occasionally |
15:03:13 | luis | auxym: thanks |
15:04:07 | luis | Phil: thanks |
15:16:16 | * | PMunch joined #nim |
15:17:12 | FromDiscord | <Phil> Okay, that's my doc crap done for the day.↵Norm now has test-suites running with nim devel and nim 1.6.10↵Owlkettle docs should be finally bugfree, only incorrect text additions should be necessary.↵And I keep learning that I truly detest infrastructure code |
15:23:12 | * | Guest2769 joined #nim |
15:24:17 | * | Guest2769 quit (Client Quit) |
15:38:41 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> Does anyone happen to have an easy way to get correct case for full path on Windows?↵So for example existing file on disk is: C:\Users\jane\Downloads\x.TXT and provided path is c:\users\Jane\downloads\x.txt then proc should return the first path. |
15:40:01 | Amun-Ra | first path? |
15:40:42 | Amun-Ra | check std/os.split_path |
15:41:25 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> ah no sorry I'm not being clear, I just mean the first of the two paths in my post. So just getting the full path but then with the case as it is in FS |
15:42:12 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> there's no issue for working with the files with "incorrect" case as FS is case insensitive, but for display I'd like to get the file/directory names the way they are also displayed in e.g. Windows explorer |
15:42:21 | Amun-Ra | that's still not clear enough for me, what exact string in the example do you have in mind? |
15:43:46 | FromDiscord | <Rika> i assume something like "C:" |
15:44:14 | Amun-Ra | ah, drive part |
15:45:28 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> sent a long message, see http://ix.io/4pbD |
15:45:52 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> I wish case insensitive FS never existed. but this is something I just don't know what an easy way is o.o |
15:46:24 | FromDiscord | <sOkam!> i wish case -sensitive- FS never existed |
15:46:35 | FromDiscord | <sOkam!> dumbest idea ever 😔 |
15:47:00 | Amun-Ra | I agree |
15:47:49 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> hmm well I guess there can be different perspectives ^^ |
15:48:05 | FromDiscord | <sOkam!> to the human, those two files are the same, because they are named the same↵why did windows choose such a stupid thing to do, of making something named the same be different... is beyond me 🤷♂️ |
15:48:16 | Amun-Ra | Ailuros: I can't test that, but worst case scenario an equivalent of chdir && getcwd should work |
15:50:48 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> In reply to @sOkam! "to the human, those": now I am confused 😮 Windows default FS (NTFS) is the case insensitive one, right? So two paths 'case.txt', 'Case.txt', refer to the same file. |
15:50:50 | Amun-Ra | I misread, I wish case insensitive fs never existed :> |
15:51:26 | Amun-Ra | all windows fses are case insensitive |
15:52:10 | FromDiscord | <tsoj> is nimpy threadsafe? |
15:55:37 | FromDiscord | <Ailuros 💖🧡💛💚💙💜🖤> In reply to @Amun-Ra "Ailuros: I can't test": that might be the easiest actually to chdir and back afterwards, thanks 🙂↵found all kinds of answers like (https://stackoverflow.com/questions/4763117/how-can-i-obtain-the-case-sensitive-path-on-windows) but it is not the simplest and they still do not seem to cover all cases |
15:55:57 | FromDiscord | <that_dude> In reply to @Amun-Ra "I misread, I wish": Yet case insensitive languages such as nim exist. Curious 😉 |
15:57:25 | FromDiscord | <ajusa> How do I share a global variable between threads? I assume I use a lock and gc:orc? |
15:58:06 | Amun-Ra | that_dude: that's not exactly true :> |
15:58:17 | Amun-Ra | that_dude: https://play.nim-lang.org/#ix=4pbG |
16:02:01 | FromDiscord | <that_dude> I know nims exceptions lol. But in general what I said. |
16:03:42 | Amun-Ra | I'd say nim is style-case insensitive, still case sensitive |
16:04:18 | Amun-Ra | (as in snake-case, etc.) |
16:10:24 | FromDiscord | <sOkam!> In reply to @Ailuros 💖🧡💛💚💙💜🖤 "now I am confused": I blamed it on the wrong OS. Sorry for the confusion↵I still think `config` and `confiG` are the same thing, specially given how humans are the ones that make mistakes all the time↵Teaching the computer that those words -mean- different things, when they are the same word, is why I said that case -sensitive- is dumdum in my eyes↵But yea, sry for the confusion |
16:10:36 | * | arkurious joined #nim |
16:11:20 | Amun-Ra | I can see the difference between readme and README |
16:11:22 | FromDiscord | <ShalokShalom> honestly, this seems to be just another case of people doing programming with a focus on the computer |
16:11:26 | FromDiscord | <ShalokShalom> rather than the human |
16:11:49 | FromDiscord | <ShalokShalom> I still think it's obvious, that this has social causes |
16:13:49 | FromDiscord | <sOkam!> In reply to @Amun-Ra "I can see the": i can also see the difference between those two and ReAdMe... and that doesn't change that all those three refer to the literal same idea/concept/word. That's why I cannot understand why you would call those things different, when they are just spellings that could very well be accidental mispellings (again, imo) |
16:15:29 | Amun-Ra | sOkam!: I'm just for FS-es with 1:1 name mappings |
16:16:26 | Amun-Ra | on the same principle I wouldn't vote for fs that does not distinguish between a and а |
16:16:32 | Amun-Ra | ymmv |
16:16:36 | * | Guest40 joined #nim |
16:16:37 | * | Guest40 left #nim (#nim) |
16:34:33 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pbR |
16:37:42 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/Zn4 |
16:45:20 | * | xet7 joined #nim |
16:58:13 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pbV |
16:58:40 | FromDiscord | <sOkam!> No matter what I'm trying, its either erroring or printing the wrong thing 😔 |
17:02:15 | via__ | in a proc that takes a seq as a non-var parameter, does then doing a for loop over it like ``` for idx, c in thatseq[someidx..^1]: ``` make a copy each time? |
17:02:34 | via__ | it kinda seems like it is from profiling, what could i do to avoid that? |
17:09:51 | Amun-Ra | I have an answer but you won't like it, iterate C-way |
17:10:39 | via__ | yeah, i can do that if i have to, but is that right? from the manual it feels like that should be a slice and not call newSeq behind the scenes |
17:14:09 | via__ | looking at the C output, i think its making a sequnce for the index range of someidx..^1, which certainly isn't a copy of thatseq, though its still big |
17:14:22 | Amun-Ra | hmm |
17:15:19 | via__ | maybe not, i'm bad at reading this |
17:24:51 | via__ | i swapped it a manual idx while loop and its like 100x faster, so its definitely doing something in there (plus profiler said all time was spent in newSeq) |
17:25:17 | via__ | i'm happy to keep it this way but i'm wondering if thats a bug or if there's a better way to do it |
17:25:19 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pc9 |
17:35:50 | * | oprypin quit (Remote host closed the connection) |
17:37:08 | FromDiscord | <sOkam!> @ElegantBeef how do you get the name of an ident inside a macro?↵with your tutorial i can gather that `thing.kind` exists, but I want to access the symbol name, and the `system.nim` file at line `2803` defines the NimNode with magic, so I cannot find the actual properties of a node listed anywhere↵I have tried `thing.sym`, but that property doesn't exist, and I don't know how to find the name itself↵Any pointers? |
17:38:29 | FromDiscord | <sOkam!> All macro tutorials seem to be focused on generating an ast, not in returning their values, so very lost in how to tackle this one 😦 |
17:40:33 | via__ | Amun-Ra: https://play.nim-lang.org/#ix=4pch , though its more obvious with higher counts (though the playground kills it) |
17:44:49 | * | xet7 quit (Quit: Leaving) |
17:56:53 | * | azimut quit (Ping timeout: 255 seconds) |
18:01:01 | * | ltriant joined #nim |
18:05:10 | * | ltriant quit (Ping timeout: 252 seconds) |
18:13:50 | Amun-Ra | via__: that is difference |
18:20:12 | * | luis quit (Killed (NickServ (GHOST command used by luis9!~luis@lisp/luis))) |
18:42:00 | FromDiscord | <Elegantbeef> `myIdent.repr`↵(@sOkam!) |
18:42:03 | FromDiscord | <Elegantbeef> or just `$myIdent` |
18:51:43 | * | PMunch quit (Ping timeout: 246 seconds) |
19:10:27 | FromDiscord | <Elegantbeef> Macros do not return types, they return nimnodes↵(@sOkam!) |
19:10:36 | FromDiscord | <Elegantbeef> That should be `: untyped = newLit(v.strVal)` |
19:22:04 | FromDiscord | <4zv4l> what does the `varargs` pragma does ? |
19:22:53 | FromDiscord | <4zv4l> > Varargs pragma↵> The varargs pragma can be applied to procedures only (and procedure types). It tells Nim that the proc can take a variable number of parameters after the last specified parameter. Nim string values will be converted to C strings automatically:↵alright |
19:32:27 | FromDiscord | <Dudugz> Basically it makes a function accept an indefinite number of parameters of the same type |
19:32:50 | FromDiscord | <Dudugz> It's how ``echo`` works I believe, which accepts multiple strings |
19:33:09 | FromDiscord | <Dudugz> ``echo "first", " second", " third"...`` |
19:34:39 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#foreign-function-interface-varargs-pragma↵It seems `varargs` pragma is used to call C functions like `printf`. |
19:38:02 | FromDiscord | <demotomohiro> @Dudugz https://nim-lang.org/docs/system.html#echo%2Cvarargs%5Btyped%2C%5D↵`echo` proc has `varargs` parameter type but `varargs` pragma.↵They are same name but actually different things. |
19:56:56 | FromDiscord | <Dudugz> Got it |
20:28:02 | * | Notxor quit (Remote host closed the connection) |
20:35:10 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pcW |
20:39:19 | FromDiscord | <4zv4l> does Nim have polymorphisme ? |
20:40:56 | FromDiscord | <Elegantbeef> No sokam that's for strings, idents are not strings |
20:40:59 | FromDiscord | <Elegantbeef> you want `$v` |
20:41:11 | FromDiscord | <Elegantbeef> Nim has both runtime polymorphism and static polymorphism |
20:41:16 | FromDiscord | <Elegantbeef> What type do you want |
20:41:49 | FromDiscord | <4zv4l> both if possible |
20:41:49 | FromDiscord | <4zv4l> xD |
20:41:57 | FromDiscord | <Phil> runtime polymorphism is using methods |
20:42:00 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix= |
20:42:03 | FromDiscord | <4zv4l> because for now I was using generics while I could use polymorphism |
20:42:05 | Zevv | can't have both |
20:42:13 | Zevv | use both and things go boom. that's broken. |
20:42:23 | FromDiscord | <Phil> static polymorphism is using generics etc. |
20:42:30 | FromDiscord | <Elegantbeef> Yea sadly it doesnt work at runtime |
20:42:44 | FromDiscord | <Elegantbeef> Again the macro needs to return untyped and you need to do `newLit($v)`↵(@sOkam!) |
20:43:06 | Zevv | https://nim-lang.org/docs/manual.html#methods: "Note: Starting from Nim 0.20, generic methods are deprecated." |
20:43:08 | FromDiscord | <Elegantbeef> Though you can just use `astToStr(myIdent)` |
20:43:34 | FromDiscord | <Elegantbeef> If they worked that'd be nice |
20:44:06 | FromDiscord | <Elegantbeef> A work around is making a template like this https://github.com/beef331/truss3d/blob/master/src/truss3D/guicomponents/scrollbar.nim#L60-L104 |
20:44:26 | FromDiscord | <Elegantbeef> Where your methods are inside a template and you call that when you instantiate a type |
20:45:42 | FromDiscord | <sOkam!> how, though? |
20:45:49 | FromDiscord | <Elegantbeef> How what? |
20:45:52 | FromDiscord | <sOkam!> im landing on errors all the time, no matter what I type |
20:46:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd0 |
20:46:55 | FromDiscord | <Elegantbeef> That works fine assuming you pass in an identifier |
20:46:59 | FromDiscord | <sOkam!> nnkUint doesn't have that |
20:47:16 | FromDiscord | <Elegantbeef> What does a nnkUnit have to do with this |
20:47:22 | FromDiscord | <Elegantbeef> You asked "how do i get the name of an identifier" |
20:47:23 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd1 |
20:47:29 | FromDiscord | <sOkam!> because GLEnum is a distinct uint |
20:48:09 | FromDiscord | <Elegantbeef> just use `astToStr` |
20:48:15 | FromDiscord | <Elegantbeef> The macro above will also work though |
20:48:19 | FromDiscord | <Elegantbeef> Since you're passing in an identifier |
20:49:31 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix= |
20:49:45 | FromDiscord | <sOkam!> like i said, it was failing, but I don't understand why |
20:49:56 | FromDiscord | <Elegantbeef> You have a typed macro |
20:50:04 | FromDiscord | <Elegantbeef> The parameter needs to be untyped |
20:50:22 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd2 |
20:50:36 | FromDiscord | <sOkam!> not at all, i copy/pasted your macro. which is why I asked that "but how" |
20:50:39 | FromDiscord | <Elegantbeef> You're using method call |
20:50:45 | FromDiscord | <Elegantbeef> .... |
20:51:03 | FromDiscord | <sOkam!> omg :NotLikeThis: |
20:51:07 | FromDiscord | <sOkam!> I swear macros are the worst |
20:51:21 | FromDiscord | <Elegantbeef> They really arent |
20:51:33 | FromDiscord | <4zv4l> wait so I don't get it↵how do I make an interface that link multiple objects with the right methods ? |
20:51:52 | FromDiscord | <Elegantbeef> What? |
20:52:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd3 |
20:52:32 | FromDiscord | <Elegantbeef> Why this happens is quite simple |
20:52:37 | FromDiscord | <Elegantbeef> `a` is typed since it's on method call |
20:52:42 | FromDiscord | <Elegantbeef> This means it expands the identifier to the constant |
20:52:44 | FromDiscord | <4zv4l> interface that requires for example the method `drive`↵if an object has the method `drive`↵then it can use any function that has for parameter the interface |
20:53:05 | FromDiscord | <Elegantbeef> Nim does not have interfaces in the language use iface or traitor |
20:53:11 | FromDiscord | <Elegantbeef> If you do not need runtime interfaces use a generic |
20:54:17 | FromDiscord | <Elegantbeef> This sounds like compile time interface so just use a generic with a concept |
20:55:08 | FromDiscord | <Elegantbeef> QED |
20:55:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd4 |
20:55:19 | FromDiscord | <sOkam!> k, then. before I waste another 4h due to my ignorance, is it possible to convert this macro into $? |
20:55:41 | FromDiscord | <Elegantbeef> Of course you can use a macro as an operator |
20:56:22 | FromDiscord | <sOkam!> if I changed `untyped` from the input to `v :GLEnum`, wouldn't that make it typed? |
20:56:37 | FromDiscord | <Elegantbeef> Of course |
20:57:06 | FromDiscord | <sOkam!> that's what I was getting in my second or so attempt, that resolves into `981972'u`, instead of the name |
20:57:16 | FromDiscord | <sOkam!> (random number inserted, just example) |
20:57:54 | FromDiscord | <sigmasd> Will Nim focus on language tooling after 2.0 ? |
20:58:08 | FromDiscord | <sigmasd> I still have to go through hoops just for syntax highlightinh in vim |
20:58:12 | FromDiscord | <4zv4l> I don't find the doc about concept |
20:58:22 | FromDiscord | <Elegantbeef> Expermental manual 4 |
20:58:43 | FromDiscord | <Elegantbeef> Constants are folded in code sokam, so yes you will get the constant value |
20:59:06 | FromDiscord | <sOkam!> In reply to @sOkam! "k, then. before I": is this possible then? |
20:59:32 | FromDiscord | <sOkam!> because when I was trying before at the beginning, i was getting `v` as a string, not the original enum name |
20:59:54 | FromDiscord | <sOkam!> i was wrapping the macro into a proc, but that resolved the proc and not the original value |
21:00:09 | FromDiscord | <sOkam!> (edit) "i was wrapping the macro into a proc, but that resolved the proc ... and" added "input value" |
21:01:22 | FromDiscord | <sigmasd> Another random question, will nim get pattern matching ? |
21:01:33 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd5 |
21:01:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/AW9 |
21:02:03 | FromDiscord | <Elegantbeef> Cannot say much else what you want isnt really possible |
21:02:22 | FromDiscord | <Elegantbeef> `$` dispatches on types which means the constant is folded |
21:02:23 | FromDiscord | <Elegantbeef> You want it to dispatch on an identifier which is not possible |
21:03:17 | FromDiscord | <Elegantbeef> Implement a `$` procedure that uses a LUT to convert the value to the string |
21:03:22 | FromDiscord | <Elegantbeef> That's the best case |
21:03:56 | FromDiscord | <Elegantbeef> Though iirc glenum isnt a distinct type but a alias |
21:03:57 | FromDiscord | <Elegantbeef> So you cannot do that either |
21:04:06 | FromDiscord | <sOkam!> i don't understand how to do that, can you explain in simpler terms a bit? |
21:04:30 | FromDiscord | <Elegantbeef> Make a table of integer -\> string in a `$` for GlEnum |
21:05:13 | FromDiscord | <sOkam!> I guess I will have to manually map all of them? |
21:05:22 | FromDiscord | <Elegantbeef> Yep |
21:05:57 | FromDiscord | <sOkam!> why are the bindings not just enum with a converter? is that not poss for C interop? |
21:06:43 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Though iirc glenum isnt": its a distinct uint32 |
21:06:54 | FromDiscord | <Elegantbeef> I do not recall |
21:07:03 | FromDiscord | <sOkam!> i checked |
21:07:04 | FromDiscord | <Elegantbeef> Well then there you go |
21:07:10 | FromDiscord | <Elegantbeef> You can make your own `$` if you must |
21:07:21 | FromDiscord | <Elegantbeef> Or rewrite the bindings to use a Nim enum |
21:07:41 | FromDiscord | <sOkam!> is that possible? |
21:07:55 | FromDiscord | <Elegantbeef> I mean if you have a keyboard i think |
21:07:56 | FromDiscord | <sOkam!> like.. why are they not already enum |
21:07:59 | FromDiscord | <Elegantbeef> If you're on a phone maybe not |
21:08:11 | FromDiscord | <Elegantbeef> Cause C enums you often `or` together |
21:08:33 | FromDiscord | <Elegantbeef> I do actually not recall why they're not Nim enums |
21:08:37 | FromDiscord | <sOkam!> what i mean is that they are official bindings... made by people 100000times smarter than me. why could I think of this and not them? that sounds kinda absurd, which makes me think I'm missing something |
21:08:37 | FromDiscord | <Elegantbeef> I blame it on C enums being bad |
21:08:49 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4pda |
21:09:41 | FromDiscord | <luteva> I am searching for a general datastructure that has keys and values and is being sorted by a given property while inserting. So a kind of SortedMap/SortedTree something like this (but i need to set the property by which the structure is sorted). any ideas? |
21:11:17 | * | azimut joined #nim |
21:12:05 | FromDiscord | <4zv4l> why is `mem[1]` not valid ?↵when `mem` is of type `pointer` ? |
21:12:20 | FromDiscord | <Elegantbeef> Cause nim is statically typed |
21:12:25 | FromDiscord | <4zv4l> how does pointer arithmetic works in Nim ? |
21:12:30 | FromDiscord | <Elegantbeef> Not all pointers are arrays |
21:12:47 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[T]](mem)[i]` |
21:13:06 | FromDiscord | <Elegantbeef> Or use the ptrmath library |
21:14:46 | FromDiscord | <4zv4l> In reply to @Elegantbeef "`cast[ptr UncheckedArray[T]](mem)[i]`": I'm trying in Nim playground so I'll try this |
21:17:14 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4pdg |
21:17:38 | FromDiscord | <Elegantbeef> `myArr[3..4] = [3u16, 3] # this doesnt work` |
21:17:56 | FromDiscord | <4zv4l> 3u16 ? |
21:18:38 | FromDiscord | <Elegantbeef> ? |
21:19:38 | FromDiscord | <4zv4l> why 3 u16 ? |
21:19:51 | FromDiscord | <Elegantbeef> Cause it's cleaner than `3.uint16`? |
21:20:42 | FromDiscord | <4zv4l> why isn't it `[1'u16, 3]` ? |
21:21:47 | FromDiscord | <Elegantbeef> Cause i didnt read the entire code just hte line you complained about |
21:26:16 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4pdo |
21:26:50 | * | xet7 joined #nim |
21:51:29 | * | jmdaemon joined #nim |
21:58:34 | * | Notxor joined #nim |
22:11:29 | * | xet7 quit (Remote host closed the connection) |
22:15:26 | * | xet7 joined #nim |
22:17:41 | * | ltriant joined #nim |
22:46:11 | * | luis_ joined #nim |
22:57:27 | FromDiscord | <I have 50GB of nothing on my PC> are there posix pipes in nim stdlib? |
22:59:25 | FromDiscord | <amadan> https://nim-lang.org/docs/posix.html#pipe%2Carray[%2Ccint] there is this in the `std/posix` module which I think you are looking for |
23:00:55 | * | Notxor quit (Remote host closed the connection) |
23:01:41 | FromDiscord | <I have 50GB of nothing on my PC> thanks, it seems so |
23:10:00 | FromDiscord | <Hourglass [She/Her]> How wasteful is it to make streams? |
23:10:09 | FromDiscord | <Hourglass [She/Her]> Should I just reuse a single stream if possible? |
23:10:27 | FromDiscord | <Hourglass [She/Her]> (I could but that doesn't mean I should, wanting to double check) |
23:10:35 | * | ltriant quit (Ping timeout: 268 seconds) |