<< 25-02-2023 >>

00:42:26FromDiscord<m4ul3r> How would I go about using libdwarf in nim?
00:42:59FromDiscord<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:49FromDiscord<Elegantbeef> c2nim or futhark the header then link to the library using passL or dynlib↵(@m4ul3r)
00:50:07NimEventerNew 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:10NimEventerNew thread by WizardUli: Make nimble task depend on "build", see https://forum.nim-lang.org/t/9936
01:18:51FromDiscord<guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4p7J
01:19:41FromDiscord<guttural666> second example does not work, despite being tested on an engine on the net, this is just infuriating
01:25:46FromDiscord<Nilts> In reply to @not logged in "I want to get": Lol did anyone respond to this.
02:44:37FromDiscord<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:53FromDiscord<Diogenes of Toronto> hey how do I execute shell commmands from nim
02:48:42FromDiscord<Nilts> In reply to @Diogenes of Toronto "hey how do I": https://nim-lang.org/docs/osproc.html
03:10:19FromDiscord<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:31FromDiscord<Elegantbeef> Yes you can if you really must https://nim-lang.org/docs/parsexml.html#example-2colon-retrieve-all-html-links
03:13:01FromDiscord<Elegantbeef> Assuming we're not just talking arbitraily
03:23:39FromDiscord<ringabout> Can we compile the Nim compiler to WASM using Emscripten?
03:24:00FromDiscord<Elegantbeef> The VM can be
03:24:50FromDiscord<ringabout> It would be cool to host the Nim compiler at the browser,
03:26:15FromDiscord<Elegantbeef> The main issue with the full compiler is I do not think there is a C compiler that runs there
03:26:31FromDiscord<Elegantbeef> https://www.jasonbeetham.com/snake/nicoscripter.html does showcase the vm working though 😄
03:27:03FromDiscord<ringabout> Yeah, we probably need a dedicated wasm backend, at least JS works there.
03:27:15FromDiscord<ringabout> In reply to @Elegantbeef "https://www.jasonbeetham.com/snake/nicoscripter.htm": Nice!
04:05:40FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4p7Y
04:05:46FromDiscord<m4ul3r> (edit) "https://play.nim-lang.org/#ix=4p7Y" => "https://play.nim-lang.org/#ix=4p7Z"
04:06:38FromDiscord<Elegantbeef> you need `-ldward`
04:06:45FromDiscord<Elegantbeef> or `-ldwarf` 😛
04:07:48FromDiscord<Elegantbeef> `-L` is for library paths not linking
04:09:02FromDiscord<huantian> Tfw when C
04:12:22FromDiscord<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:50FromDiscord<Hourglass [She/Her]> In reply to @ringabout "Can we compile the": I mean, someone compiled clang to wasm
04:36:00FromDiscord<Hourglass [She/Her]> And actually made it possible to compile files with it
04:36:10FromDiscord<Hourglass [She/Her]> So
04:37:57FromDiscord<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:18FromDiscord<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:52FromDiscord<Hourglass [She/Her]> In reply to @ringabout "Sounds interesting, though for": Wdym? You mean making it feature complete and stuff?
04:39:41FromDiscord<Hourglass [She/Her]> I think Nimskull did a rewrite of the NimScript VM
04:42:43FromDiscord<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:17FromDiscord<Elegantbeef> I wonder if it makes sense to just emit wasm byte code in that case
04:43:31FromDiscord<Elegantbeef> It's something i considered for a theoretical language
04:43:42FromDiscord<huantian> WASM as a first class target? 👀
04:44:21FromDiscord<ringabout> The Nimscript backend should have its own memory management, actually the VM/Nimscript are leaking memory without recycling.
04:44:31FromDiscord<ringabout> (edit) "The Nimscript backend should have its own memory management, actually the ... VM/Nimscript" added "current"
04:44:47FromDiscord<huantian> Huh
04:44:49FromDiscord<Hourglass [She/Her]> In reply to @ringabout "I knew that, I": Ah
04:45:13FromDiscord<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:51FromDiscord<Hourglass [She/Her]> In reply to @ringabout "The Nimscript backend should": The last part of that doesn't make much sense
04:46:12FromDiscord<Elegantbeef> Yea first class wasm huan, my theoretical language plan was to emit wasm and load wasm modules that could implement backends
04:47:07FromDiscord<Diogenes of Toronto> Thoughts on graalvm
04:47:13FromDiscord<Hourglass [She/Her]> For Nim or for your own language?
04:47:36FromDiscord<Diogenes of Toronto> For nim
04:47:38FromDiscord<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:48FromDiscord<Hourglass [She/Her]> (edit) "For Nim or for your own language? ... " added "(Beef)"
04:48:02*azimut quit (Ping timeout: 255 seconds)
04:49:08FromDiscord<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:38FromDiscord<Elegantbeef> The wasm compiler 😄
04:49:57FromDiscord<Elegantbeef> My own language
04:50:16FromDiscord<Elegantbeef> No that i'd ever write it cause it's basically just a Nim fork
04:51:26FromDiscord<Diogenes of Toronto> In reply to @Hourglass, When the Hour Strikes "How would it be": yeah i guess not
04:51:48FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "No that i'd ever": Lol
04:52:50FromDiscord<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:07FromDiscord<Elegantbeef> Ringabout your pass changes would it mess with tooling much?
04:54:38FromDiscord<ringabout> Which changes?
04:54:43FromDiscord<ringabout> (edit) "changes?" => "change?"
04:54:50FromDiscord<Elegantbeef> The ones that remove the compiler pass api
04:56:04FromDiscord<Elegantbeef> I'm playing around with an opinionated Header generator so just curious if it'd impede that any
04:58:08FromDiscord<ringabout> I will keep/deprecate the pass interface.
04:58:30FromDiscord<Elegantbeef> So what would be the proper way for tooling to interact with it?
04:59:40FromDiscord<Elegantbeef> I guess disregard that 😄
04:59:45FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4p87
04:59:56FromDiscord<Elegantbeef> Rika i explained that about 30 times 😄
05:00:38FromDiscord<Rika> sorry i have you mentally blocked
05:00:50FromDiscord<Elegantbeef> What a coincidence I do aswell
05:01:09FromDiscord<ringabout> I have yet had an idea, it seems that after removing passes, I need to duplicate code for lots of backends.
05:02:16FromDiscord<Elegantbeef> Wonder if it just makes sense to use `static Passes` to remove the runtime dispatch, and make it more sensible
05:02:52FromDiscord<Elegantbeef> Probably too much work to use a static openarray there though
05:03:28FromDiscord<ringabout> Yeah, probably
05:26:03*arkurious quit (Quit: Leaving)
06:32:32*ltriant quit (Ping timeout: 248 seconds)
07:23:41FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4p8z
07:25:08FromDiscord<m4ul3r> (edit) "https://play.nim-lang.org/#ix=4p8z" => "https://paste.rs/06X"
07:35:23*kenran joined #nim
07:46:23FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4p8D
07:46:38FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4p8E
07:47:45FromDiscord<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:34FromDiscord<qb> That was my first try as well but leads into a wrong position
08:07:40FromDiscord<qb> Got it
08:15:49*kenran quit (Remote host closed the connection)
08:27:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4p8K
09:02:15*Notxor joined #nim
09:03:04FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4p8S
09:03:33FromDiscord<Rika> that's invalid json
09:03:45FromDiscord<Dudugz> (edit) "https://play.nim-lang.org/#ix=4p8S" => "https://play.nim-lang.org/#ix=4p8T"
09:03:49FromDiscord<Dudugz> Sorry it's pseudo
09:03:59FromDiscord<Rika> `document["main"]["messages"]`?
09:04:08FromDiscord<Rika> or i think `document{"main
09:04:14FromDiscord<Rika> (edit) "`document{"main" => "`document{"main", "messages"}` works too?"
09:04:25FromDiscord<Elegantbeef> The real answer is going to be "use jsonutils and convert it into the proper type"
09:04:52FromDiscord<Dudugz> Hm, it worked now, weird when I tried it before it didn't work, thx
09:07:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4p8W
09:07:21FromDiscord<Elegantbeef> It's likely saner than what you're doing 😛
09:08:22FromDiscord<Dudugz> Hmm, in the case of deserialize, in my case there is no extreme need but I can do it too.
09:08:32FromDiscord<Dudugz> (edit) removed "the" | removed "of"
10:33:42FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4p9j
10:34:07FromDiscord<gogolxdong> https://media.discordapp.net/attachments/371759389889003532/1078988255682363464/image.png
10:48:50FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9k
10:49:01FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4p9k" => "https://play.nim-lang.org/#ix=4p9l"
10:49:11FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4p9l" => "https://play.nim-lang.org/#ix=4p9m"
10:50:35FromDiscord<Phil> sent a long message, see https://paste.rs/9Jz
10:51:40FromDiscord<Phil> Argh, it's likely looking at tags
10:52:27FromDiscord<ringabout> Yeah
10:58:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9u
10:59:12FromDiscord<ringabout> Is it?
10:59:54FromDiscord<ringabout> I'm not aware of that change.
11:00:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4p9v
11:02:39FromDiscord<ringabout> Weird, I don't like the change
11:03:11FromDiscord<Phil> I feel like something is broken with the package or sth, this all just seems odd
11:03:35FromDiscord<Rika> Honestly thinking we should start forking whatever Dom made for Nim since he isn’t affiliated anymore
11:03:53FromDiscord<Rika> Unless it’s already done then okay
11:05:05FromDiscord<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:05FromDiscord<amadan> You forgot to specify the `srcDir`
11:17:22FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4p9C
11:19:44FromDiscord<Phil> Arrrrrghhh the joys of package setups when you take over from others
11:32:52FromDiscord<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:24FromDiscord<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:35FromDiscord<Phil> (edit) "tune" => "turn"
11:33:50FromDiscord<amadan> Looks like you're latest commit worked 🎉
11:34:37FromDiscord<Phil> ... wtf it doesn't locally
11:35:24FromDiscord<ringabout> In reply to @Isofruit "... wtf it doesn't": How did you know? From CI?
11:35:28FromDiscord<Phil> Like, for me the command `sudo docker-compose run --rm tests` is completely broken
11:36:37FromDiscord<ringabout> https://github.com/moigagoo/norm/pull/186 Isn't it green?
11:36:39FromDiscord<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:50FromDiscord<Phil> Yeah in the github CI, but now when you want to execute the test-suite locally
11:37:01FromDiscord<Phil> E.g. for local development
11:37:05FromDiscord<amadan> Did you rebuild the container image?
11:37:16FromDiscord<Phil> Doesn't that happen automatically?
11:37:44FromDiscord<Phil> Should be part of the commands somewhere IIRC
11:38:11FromDiscord<amadan> Mean it should since the ADD should invalidate the run↵but iirc docker-compose doesn't auto rebuild does no?
11:38:33FromDiscord<Phil> I'll nuke the image and all container from my system just to be sure
11:39:07FromDiscord<Phil> You were correct
11:39:13FromDiscord<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:39FromDiscord<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:27FromDiscord<amadan> Whats the issue with it?↵Looks like you just need to run `testament all` and it should all run
11:55:54FromDiscord<Phil> testament all doesn't run is the issue
11:55:54FromDiscord<amadan> Least locally that does it for me
11:56:15FromDiscord<Phil> Neither locally nor on github does it work
11:57:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pa2
11:59:07FromDiscord<amadan> weird? https://media.discordapp.net/attachments/371759389889003532/1079009649208078406/image.png
11:59:18FromDiscord<amadan> (postgres failing since I don
11:59:26FromDiscord<amadan> (edit) "don" => "don't have postgres running)"
12:01:05FromDiscord<Phil> Seems to be a rights issue for some reason
12:02:28FromDiscord<Phil> Argh, somewhere in there the directories were created as root and thus limited access rights
12:02:36FromDiscord<Phil> Nuking them fixed the issue as they were recreated, but this time not as root
12:03:11FromDiscord<Phil> Tests in the gh pipeline also seem to fail for some reason though
12:03:31FromDiscord<amadan> the postgres tests don't read from environment variable it seems
12:04:27FromDiscord<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:45FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4paa
12:23:56FromDiscord<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:05FromDiscord<amadan> Mean you should be able to just connect to it like in the lowdb tests no?
12:25:15FromDiscord<Phil> locally
12:25:32FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4paf
12:25:39FromDiscord<amadan> no magic needed 😜
12:25:53FromDiscord<amadan> (edit) "https://play.nim-lang.org/#ix=4paf" => "https://play.nim-lang.org/#ix=4pag"
12:34:14FromDiscord<Phil> Turns out in nim devel norm no longer supports `Positive` and needs explicit dbType procs for it
12:36:06FromDiscord<Phil> Wait, it does... but also doesn't?↵Wow that error reads weird
12:36:41*azimut joined #nim
12:37:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4paj
12:38:51FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4paj" => "https://play.nim-lang.org/#ix=4pak"
12:39:13FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4pak" => "https://play.nim-lang.org/#ix=4pal"
12:39:49FromDiscord<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:12FromDiscord<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:40FromDiscord<Phil> Okay, I got the fundamental gist of the problem, not sure if it's a nim one or not
13:13:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pax
13:14:41FromDiscord<Phil> sent a code paste, see https://paste.rs/Nqk
13:15:06FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4paC" => "https://play.nim-lang.org/#ix=4paB"
13:15:23FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4pax" => "https://play.nim-lang.org/#ix=4paE"
13:18:09FromDiscord<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:40FromDiscord<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:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4pb8
14:23:50FromDiscord<Rika> those two syntaxes (syntices??) are different systems
14:24:36FromDiscord<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:02via__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:28via__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:29FromDiscord<Rika> In reply to @via__ "i'm pretty new to": do you have a code snippet to show?
14:28:51FromDiscord<Rika> In reply to @via__ "but first, is there": that should compile in modern nim, what version are you using
14:29:03via__1.6.10
14:29:17FromDiscord<Rika> ah wait
14:29:23FromDiscord<Rika> i misunderstood
14:29:28FromDiscord<Rika> yeah i dont hink that works
14:29:37FromDiscord<Rika> fieldpairs is not a traditional iterator
14:30:04FromDiscord<Rika> its one of the special case iterators in nim, where it expands into an unrolled loop when used with `for`
14:30:18via__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:21FromDiscord<Dudugz> Is it possible to set an outDir in .nimble for binaries?
14:30:21via__and that also appears to not compile
14:31:00via__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:52FromDiscord<Rika> i dont see any issues with the second example
14:33:01FromDiscord<Rika> ah, its an issue with strformat i think
14:33:15via__```core/macros.nim(533, 1) Error: undeclared identifier: 'x'```
14:33:22FromDiscord<Rika> just add it directly
14:33:26FromDiscord<Rika> `something.add(x)`
14:33:30FromDiscord<Rika> x is a string anyway
14:33:37via__well, i need to do more with it, this was just a reduced example
14:34:06FromDiscord<Rika> then declare another version of it at the top `let xx = x` as a hack
14:34:40via__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:28via__(especially since afaict thats what toSeq is supposed to be)
14:36:39FromDiscord<Rika> not really, as ive said fieldPairs is a special type of iterator that isnt really an iterator
14:37:10via__okay. there's no other way to get an objects field names (and optionally types) is there?
14:37:12FromDiscord<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:25via__ok
14:38:18FromDiscord<Rika> here's a doc link if you need it https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
14:39:05via__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:21via__i guess thats the symbol binding bug
14:41:21FromDiscord<Rika> the undeclared identifier one is the symbol binding bug
14:41:39via__okay, thank you
15:00:53luisare there people streaming nim programming on twitch or yt?
15:01:05luisid like to follow if yes
15:02:30FromDiscord<auxym> I know pmunch streams occasionally: https://www.youtube.com/@peterme
15:02:58FromDiscord<Phil> In reply to @luis "are there people streaming": Not streaming, but Kiloneie bumps out nim videos occasionally
15:03:13luisauxym: thanks
15:04:07luisPhil: thanks
15:16:16*PMunch joined #nim
15:17:12FromDiscord<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:41FromDiscord<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:01Amun-Rafirst path?
15:40:42Amun-Racheck std/os.split_path
15:41:25FromDiscord<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:12FromDiscord<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:21Amun-Rathat's still not clear enough for me, what exact string in the example do you have in mind?
15:43:46FromDiscord<Rika> i assume something like "C:"
15:44:14Amun-Raah, drive part
15:45:28FromDiscord<Ailuros 💖🧡💛💚💙💜🖤> sent a long message, see http://ix.io/4pbD
15:45:52FromDiscord<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:24FromDiscord<sOkam!> i wish case -sensitive- FS never existed
15:46:35FromDiscord<sOkam!> dumbest idea ever 😔
15:47:00Amun-RaI agree
15:47:49FromDiscord<Ailuros 💖🧡💛💚💙💜🖤> hmm well I guess there can be different perspectives ^^
15:48:05FromDiscord<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:16Amun-RaAiluros: I can't test that, but worst case scenario an equivalent of chdir && getcwd should work
15:50:48FromDiscord<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:50Amun-RaI misread, I wish case insensitive fs never existed :>
15:51:26Amun-Raall windows fses are case insensitive
15:52:10FromDiscord<tsoj> is nimpy threadsafe?
15:55:37FromDiscord<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:57FromDiscord<that_dude> In reply to @Amun-Ra "I misread, I wish": Yet case insensitive languages such as nim exist. Curious 😉
15:57:25FromDiscord<ajusa> How do I share a global variable between threads? I assume I use a lock and gc:orc?
15:58:06Amun-Rathat_dude: that's not exactly true :>
15:58:17Amun-Rathat_dude: https://play.nim-lang.org/#ix=4pbG
16:02:01FromDiscord<that_dude> I know nims exceptions lol. But in general what I said.
16:03:42Amun-RaI'd say nim is style-case insensitive, still case sensitive
16:04:18Amun-Ra(as in snake-case, etc.)
16:10:24FromDiscord<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:20Amun-RaI can see the difference between readme and README
16:11:22FromDiscord<ShalokShalom> honestly, this seems to be just another case of people doing programming with a focus on the computer
16:11:26FromDiscord<ShalokShalom> rather than the human
16:11:49FromDiscord<ShalokShalom> I still think it's obvious, that this has social causes
16:13:49FromDiscord<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:29Amun-RasOkam!: I'm just for FS-es with 1:1 name mappings
16:16:26Amun-Raon the same principle I wouldn't vote for fs that does not distinguish between a and а
16:16:32Amun-Raymmv
16:16:36*Guest40 joined #nim
16:16:37*Guest40 left #nim (#nim)
16:34:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pbR
16:37:42FromDiscord<sOkam!> sent a code paste, see https://paste.rs/Zn4
16:45:20*xet7 joined #nim
16:58:13FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pbV
16:58:40FromDiscord<sOkam!> No matter what I'm trying, its either erroring or printing the wrong thing 😔
17:02:15via__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:34via__it kinda seems like it is from profiling, what could i do to avoid that?
17:09:51Amun-RaI have an answer but you won't like it, iterate C-way
17:10:39via__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:09via__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:22Amun-Rahmm
17:15:19via__maybe not, i'm bad at reading this
17:24:51via__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:17via__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:19FromDiscord<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:08FromDiscord<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:29FromDiscord<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:33via__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:50Amun-Ravia__: that is difference
18:20:12*luis quit (Killed (NickServ (GHOST command used by luis9!~luis@lisp/luis)))
18:42:00FromDiscord<Elegantbeef> `myIdent.repr`↵(@sOkam!)
18:42:03FromDiscord<Elegantbeef> or just `$myIdent`
18:51:43*PMunch quit (Ping timeout: 246 seconds)
19:10:27FromDiscord<Elegantbeef> Macros do not return types, they return nimnodes↵(@sOkam!)
19:10:36FromDiscord<Elegantbeef> That should be `: untyped = newLit(v.strVal)`
19:22:04FromDiscord<4zv4l> what does the `varargs` pragma does ?
19:22:53FromDiscord<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:27FromDiscord<Dudugz> Basically it makes a function accept an indefinite number of parameters of the same type
19:32:50FromDiscord<Dudugz> It's how ``echo`` works I believe, which accepts multiple strings
19:33:09FromDiscord<Dudugz> ``echo "first", " second", " third"...``
19:34:39FromDiscord<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:02FromDiscord<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:56FromDiscord<Dudugz> Got it
20:28:02*Notxor quit (Remote host closed the connection)
20:35:10FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pcW
20:39:19FromDiscord<4zv4l> does Nim have polymorphisme ?
20:40:56FromDiscord<Elegantbeef> No sokam that's for strings, idents are not strings
20:40:59FromDiscord<Elegantbeef> you want `$v`
20:41:11FromDiscord<Elegantbeef> Nim has both runtime polymorphism and static polymorphism
20:41:16FromDiscord<Elegantbeef> What type do you want
20:41:49FromDiscord<4zv4l> both if possible
20:41:49FromDiscord<4zv4l> xD
20:41:57FromDiscord<Phil> runtime polymorphism is using methods
20:42:00FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=
20:42:03FromDiscord<4zv4l> because for now I was using generics while I could use polymorphism
20:42:05Zevvcan't have both
20:42:13Zevvuse both and things go boom. that's broken.
20:42:23FromDiscord<Phil> static polymorphism is using generics etc.
20:42:30FromDiscord<Elegantbeef> Yea sadly it doesnt work at runtime
20:42:44FromDiscord<Elegantbeef> Again the macro needs to return untyped and you need to do `newLit($v)`↵(@sOkam!)
20:43:06Zevvhttps://nim-lang.org/docs/manual.html#methods: "Note: Starting from Nim 0.20, generic methods are deprecated."
20:43:08FromDiscord<Elegantbeef> Though you can just use `astToStr(myIdent)`
20:43:34FromDiscord<Elegantbeef> If they worked that'd be nice
20:44:06FromDiscord<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:26FromDiscord<Elegantbeef> Where your methods are inside a template and you call that when you instantiate a type
20:45:42FromDiscord<sOkam!> how, though?
20:45:49FromDiscord<Elegantbeef> How what?
20:45:52FromDiscord<sOkam!> im landing on errors all the time, no matter what I type
20:46:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd0
20:46:55FromDiscord<Elegantbeef> That works fine assuming you pass in an identifier
20:46:59FromDiscord<sOkam!> nnkUint doesn't have that
20:47:16FromDiscord<Elegantbeef> What does a nnkUnit have to do with this
20:47:22FromDiscord<Elegantbeef> You asked "how do i get the name of an identifier"
20:47:23FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd1
20:47:29FromDiscord<sOkam!> because GLEnum is a distinct uint
20:48:09FromDiscord<Elegantbeef> just use `astToStr`
20:48:15FromDiscord<Elegantbeef> The macro above will also work though
20:48:19FromDiscord<Elegantbeef> Since you're passing in an identifier
20:49:31FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=
20:49:45FromDiscord<sOkam!> like i said, it was failing, but I don't understand why
20:49:56FromDiscord<Elegantbeef> You have a typed macro
20:50:04FromDiscord<Elegantbeef> The parameter needs to be untyped
20:50:22FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd2
20:50:36FromDiscord<sOkam!> not at all, i copy/pasted your macro. which is why I asked that "but how"
20:50:39FromDiscord<Elegantbeef> You're using method call
20:50:45FromDiscord<Elegantbeef> ....
20:51:03FromDiscord<sOkam!> omg :NotLikeThis:
20:51:07FromDiscord<sOkam!> I swear macros are the worst
20:51:21FromDiscord<Elegantbeef> They really arent
20:51:33FromDiscord<4zv4l> wait so I don't get it↵how do I make an interface that link multiple objects with the right methods ?
20:51:52FromDiscord<Elegantbeef> What?
20:52:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd3
20:52:32FromDiscord<Elegantbeef> Why this happens is quite simple
20:52:37FromDiscord<Elegantbeef> `a` is typed since it's on method call
20:52:42FromDiscord<Elegantbeef> This means it expands the identifier to the constant
20:52:44FromDiscord<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:05FromDiscord<Elegantbeef> Nim does not have interfaces in the language use iface or traitor
20:53:11FromDiscord<Elegantbeef> If you do not need runtime interfaces use a generic
20:54:17FromDiscord<Elegantbeef> This sounds like compile time interface so just use a generic with a concept
20:55:08FromDiscord<Elegantbeef> QED
20:55:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4pd4
20:55:19FromDiscord<sOkam!> k, then. before I waste another 4h due to my ignorance, is it possible to convert this macro into $?
20:55:41FromDiscord<Elegantbeef> Of course you can use a macro as an operator
20:56:22FromDiscord<sOkam!> if I changed `untyped` from the input to `v :GLEnum`, wouldn't that make it typed?
20:56:37FromDiscord<Elegantbeef> Of course
20:57:06FromDiscord<sOkam!> that's what I was getting in my second or so attempt, that resolves into `981972'u`, instead of the name
20:57:16FromDiscord<sOkam!> (random number inserted, just example)
20:57:54FromDiscord<sigmasd> Will Nim focus on language tooling after 2.0 ?
20:58:08FromDiscord<sigmasd> I still have to go through hoops just for syntax highlightinh in vim
20:58:12FromDiscord<4zv4l> I don't find the doc about concept
20:58:22FromDiscord<Elegantbeef> Expermental manual 4
20:58:43FromDiscord<Elegantbeef> Constants are folded in code sokam, so yes you will get the constant value
20:59:06FromDiscord<sOkam!> In reply to @sOkam! "k, then. before I": is this possible then?
20:59:32FromDiscord<sOkam!> because when I was trying before at the beginning, i was getting `v` as a string, not the original enum name
20:59:54FromDiscord<sOkam!> i was wrapping the macro into a proc, but that resolved the proc and not the original value
21:00:09FromDiscord<sOkam!> (edit) "i was wrapping the macro into a proc, but that resolved the proc ... and" added "input value"
21:01:22FromDiscord<sigmasd> Another random question, will nim get pattern matching ?
21:01:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pd5
21:01:47FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/AW9
21:02:03FromDiscord<Elegantbeef> Cannot say much else what you want isnt really possible
21:02:22FromDiscord<Elegantbeef> `$` dispatches on types which means the constant is folded
21:02:23FromDiscord<Elegantbeef> You want it to dispatch on an identifier which is not possible
21:03:17FromDiscord<Elegantbeef> Implement a `$` procedure that uses a LUT to convert the value to the string
21:03:22FromDiscord<Elegantbeef> That's the best case
21:03:56FromDiscord<Elegantbeef> Though iirc glenum isnt a distinct type but a alias
21:03:57FromDiscord<Elegantbeef> So you cannot do that either
21:04:06FromDiscord<sOkam!> i don't understand how to do that, can you explain in simpler terms a bit?
21:04:30FromDiscord<Elegantbeef> Make a table of integer -\> string in a `$` for GlEnum
21:05:13FromDiscord<sOkam!> I guess I will have to manually map all of them?
21:05:22FromDiscord<Elegantbeef> Yep
21:05:57FromDiscord<sOkam!> why are the bindings not just enum with a converter? is that not poss for C interop?
21:06:43FromDiscord<sOkam!> In reply to @Elegantbeef "Though iirc glenum isnt": its a distinct uint32
21:06:54FromDiscord<Elegantbeef> I do not recall
21:07:03FromDiscord<sOkam!> i checked
21:07:04FromDiscord<Elegantbeef> Well then there you go
21:07:10FromDiscord<Elegantbeef> You can make your own `$` if you must
21:07:21FromDiscord<Elegantbeef> Or rewrite the bindings to use a Nim enum
21:07:41FromDiscord<sOkam!> is that possible?
21:07:55FromDiscord<Elegantbeef> I mean if you have a keyboard i think
21:07:56FromDiscord<sOkam!> like.. why are they not already enum
21:07:59FromDiscord<Elegantbeef> If you're on a phone maybe not
21:08:11FromDiscord<Elegantbeef> Cause C enums you often `or` together
21:08:33FromDiscord<Elegantbeef> I do actually not recall why they're not Nim enums
21:08:37FromDiscord<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:37FromDiscord<Elegantbeef> I blame it on C enums being bad
21:08:49FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4pda
21:09:41FromDiscord<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:05FromDiscord<4zv4l> why is `mem[1]` not valid ?↵when `mem` is of type `pointer` ?
21:12:20FromDiscord<Elegantbeef> Cause nim is statically typed
21:12:25FromDiscord<4zv4l> how does pointer arithmetic works in Nim ?
21:12:30FromDiscord<Elegantbeef> Not all pointers are arrays
21:12:47FromDiscord<Elegantbeef> `cast[ptr UncheckedArray[T]](mem)[i]`
21:13:06FromDiscord<Elegantbeef> Or use the ptrmath library
21:14:46FromDiscord<4zv4l> In reply to @Elegantbeef "`cast[ptr UncheckedArray[T]](mem)[i]`": I'm trying in Nim playground so I'll try this
21:17:14FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4pdg
21:17:38FromDiscord<Elegantbeef> `myArr[3..4] = [3u16, 3] # this doesnt work`
21:17:56FromDiscord<4zv4l> 3u16 ?
21:18:38FromDiscord<Elegantbeef> ?
21:19:38FromDiscord<4zv4l> why 3 u16 ?
21:19:51FromDiscord<Elegantbeef> Cause it's cleaner than `3.uint16`?
21:20:42FromDiscord<4zv4l> why isn't it `[1'u16, 3]` ?
21:21:47FromDiscord<Elegantbeef> Cause i didnt read the entire code just hte line you complained about
21:26:16FromDiscord<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:27FromDiscord<I have 50GB of nothing on my PC> are there posix pipes in nim stdlib?
22:59:25FromDiscord<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:41FromDiscord<I have 50GB of nothing on my PC> thanks, it seems so
23:10:00FromDiscord<Hourglass [She/Her]> How wasteful is it to make streams?
23:10:09FromDiscord<Hourglass [She/Her]> Should I just reuse a single stream if possible?
23:10:27FromDiscord<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)