00:10:32 | * | azimut joined #nim |
00:26:36 | * | lucasta joined #nim |
00:28:01 | * | lucasta quit (Max SendQ exceeded) |
00:34:05 | * | greaser|q quit (Changing host) |
00:34:05 | * | greaser|q joined #nim |
00:41:36 | * | oldpcuser quit (Quit: FreeBSD 15, Slackware 16 and OpenBSD 8 will come with Systemd and GNOME by default. source: myass.com) |
00:46:51 | * | oldpcuser joined #nim |
00:47:28 | * | oldpcuser quit (Remote host closed the connection) |
00:47:53 | * | oldpcuser joined #nim |
01:40:04 | FromDiscord | <_alkamist_> What's the difference between untyped as a return for a template vs nothing? |
01:41:25 | NimEventer | New Nimble package! bz2 - Nim module for the bzip2 compression format., see https://codeberg.org/Yepoleb/nim-bz2 |
01:42:16 | FromDiscord | <Elegantbeef> untyped allows it to have a value, nothing means it should be void afaik |
01:45:30 | FromDiscord | <_alkamist_> Ok, I've just been slapping untyped as a return regardless and getting away with it. |
01:46:00 | FromDiscord | <_alkamist_> For some reason I thought of it like I'm returning "code" |
01:47:57 | FromDiscord | <Elegantbeef> That's kinda how it is with macros atleast |
03:17:56 | * | disso-peach quit (Quit: Leaving) |
03:32:52 | * | lucasta joined #nim |
03:38:46 | * | lucasta quit (Quit: Leaving) |
04:24:32 | * | azimut quit (Ping timeout: 240 seconds) |
04:44:45 | * | ntat joined #nim |
04:45:48 | FromDiscord | <arathanis> whats the main use case difference between using "typed" and "untyped" in a macro? or at all. |
04:50:58 | FromDiscord | <Elegantbeef> `typed` is semantically looked up `untyped` is parsed |
04:59:33 | FromDiscord | <arathanis> In reply to @Elegantbeef "`typed` is semantically looked": so `typed` goes through syntax and semantic evaluation, but `untyped` only goes through syntax evaluation |
05:00:00 | FromDiscord | <arathanis> so untyped is syntactically valid nim, but can be semantically invalid.↵typed is both syntactically and semantically valid nim |
05:00:02 | FromDiscord | <Elegantbeef> Yes |
06:00:05 | * | rockcavera quit (Remote host closed the connection) |
07:03:37 | FromDiscord | <Ras> In reply to @yardanico "i think it's worth": turns out it might be a bug with treeform's `pretty` package instead. When I removed the `print` statements, everything works fine |
07:04:18 | FromDiscord | <Ras> as a test, i replaced the `pretty` package with treeform's `print` package (the two do essentially the same thing) and it also works fine |
07:04:31 | FromDiscord | <Ras> or it might be that `pretty` somehow triggers the GC bug |
07:05:32 | * | derpydoo quit (Ping timeout: 240 seconds) |
07:12:31 | * | derpydoo joined #nim |
07:28:28 | NimEventer | New thread by ploxotnuj1: How to make a dll in nim-lang?, see https://forum.nim-lang.org/t/10284 |
07:35:24 | * | a11e99z0 joined #nim |
07:37:49 | FromDiscord | <Ras> is there a global nimscript location that gets called when anything is built? the mold linker readme says that `~/.config/config.nims` should be it, but it doesn't seem to be working: https://github.com/rui314/mold#how-to-use |
07:41:43 | FromDiscord | <intellj_gamer> I use the `~/.config/nim/nim.cfg` file, think its in the documentation somewhere |
07:42:09 | FromDiscord | <intellj_gamer> Ah, here https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files |
07:42:48 | FromDiscord | <Ras> ah, thanks |
07:44:21 | FromDiscord | <intellj_gamer> To mimic the code mold has, put it in `~/.config/nim/config.nims` (Just checked and it seems to work) |
07:45:37 | FromDiscord | <Ras> great, thanks |
07:48:31 | * | a11e99z0 quit (Quit: Leaving) |
08:13:53 | FromDiscord | <Ras> In reply to @Ras "or it might be": @treeform you might want to know this too |
08:15:27 | FromDiscord | <Ras> `pretty`, when i use it with my asyncnet code, causes memory issues with `orc` (even double-frees and stuff when compiling with `-d:useMalloc`) |
08:15:35 | FromDiscord | <Ras> `pretty` + `refc` is fine |
08:15:40 | FromDiscord | <Ras> `print` + `orc` is fine too |
08:30:11 | FromDiscord | <ieltan> What's the difference between `system.&=` and `system.add` when appending to string ? |
08:30:39 | FromDiscord | <ieltan> (is one faster than the other ?) |
08:31:56 | FromDiscord | <ieltan> Nvm, it seems like they are the same |
09:08:38 | * | mad_toothbrush joined #nim |
09:33:25 | FromDiscord | <thesherwood> Is there a way of defining a proc with a large number of named, optional arguments? I'm trying to create a proc with an interface that is well-suited to styling options. |
09:51:48 | mad_toothbrush | What is an idiomatic way to check if an element is not in a seq ? I mean something like: `if "red" not in colors:` where colors is a seq[string]. Thanks. |
09:53:27 | FromDiscord | <Andreas> In reply to @mad_toothbrush "What is an idiomatic": `"red" system.notin colors` should do https://nim-lang.org/docs/system.html#notin.t%2Cuntyped%2Cuntyped |
09:54:15 | FromDiscord | <Ras> `if "red" notin colors:` |
09:54:17 | FromDiscord | <Ras> oops |
09:54:25 | FromDiscord | <Ras> major lag on my end, sorry Andreas |
09:54:25 | FromDiscord | <Andreas> (edit) "https://nim-lang.org/docs/system.html#notin.t%2Cuntyped%2Cuntyped" => "https://nim-lang.org/docs/system.html#notin.t%2Cuntyped%2Cuntyped↵`not colors.contains "red"` should do too" |
09:54:52 | FromDiscord | <Andreas> In reply to @Ras "major lag on my": no excuses, took me a while, too.. |
09:55:03 | mad_toothbrush | Perfect! Thanks @Andreas @Ras! |
09:56:38 | FromDiscord | <Ras> sent a long message, see http://ix.io/4yBv |
09:57:14 | om3ga | echo var.type.name? |
09:57:53 | FromDiscord | <Andreas> In reply to @om3ga "echo var.type.name?": `echo typeof( var )` maybe ? |
09:58:09 | om3ga | or this yes |
10:01:06 | * | beholders_eye joined #nim |
10:17:50 | mad_toothbrush | Another one: For bare-metal, 'run-from-reset' type microcontroller code, I think I need to use '--os:any --mm:arc -d:useMalloc -d:nimAllocPagesViaMalloc' in addition to other typical cross-compilation specific flags (such as '--cpu:riscv64'). When I do this, I find that my cross compiler specific stuff in nim.cfg (eg 'riscv64.standalone.gcc.linkerexe = "riscv64-unknown-elf-gcc"') gets ignored |
10:17:50 | mad_toothbrush | and the host's gcc gets invoked instead. This wasn't happening when I was using '--os:standalone' though. Have I hit a bug ? |
10:51:29 | FromDiscord | <demotomohiro> I think `riscv64.standalone.gcc.linkerexe` is used only when `--os:standalone` not used when `--os:any`.↵You probably need to set `riscv64.any.gcc.linkerexe`. |
10:56:32 | * | beholders_eye quit (Ping timeout: 258 seconds) |
11:04:12 | mad_toothbrush | @demotomohiro: Thank you so much! I completely did not see the obviousness of that! :) |
11:04:25 | mad_toothbrush | Works like a charm. |
11:04:33 | mad_toothbrush | Now to sort out all the missing symbols! |
11:15:01 | FromDiscord | <odexine> What is the difference between any and standalone again |
11:15:32 | mad_toothbrush | I think any is the successor intended to replace standalone. |
11:16:02 | mad_toothbrush | I was incorrectly using standalone because I was using one of the slightly dated Nim embedded tutes/blogs floating around. |
11:20:42 | * | beholders_eye joined #nim |
11:40:27 | FromDiscord | <auxym> yeah my understanding too is that any supersedes standalone, though I'm not 100% clear on the differences. This is the PR that introduced any: https://github.com/nim-lang/Nim/pull/13088 |
13:04:10 | mad_toothbrush | |
13:22:20 | * | azimut joined #nim |
13:38:41 | nisstyre | how come there's no aarch64 distribution of Nim? I tried compiling it myself but not sure where to put everything |
13:38:52 | nisstyre | I guess I can look at the x86 one and copy the paths |
13:44:31 | FromDiscord | <demotomohiro> Here is prebuilt Nim for aarch64:↵https://github.com/nim-lang/nightlies/releases↵Download the one with '_arm64' prefix. |
13:45:05 | nisstyre | thanks |
13:46:23 | FromDiscord | <demotomohiro> You can put it anywhere. After unzip it, set PATH like `export PATH=/path/to/nim/bin:$PATH`. |
13:47:46 | nisstyre | my issue was where the stdlib goes I guess |
13:57:49 | FromDiscord | <demotomohiro> Nim's nightlies release file contains stdlib. Nim automatically use it.↵You don't need to copy it to other place or set path to stdlib. |
14:04:21 | * | rockcavera joined #nim |
14:19:20 | * | beholders_eye quit (Ping timeout: 260 seconds) |
14:34:53 | FromDiscord | <treeform> In reply to @Ras "<@107140179025735680> you might want": That is strange! I don't use globals in pretty (like I did for print). It should work better. Do you have an issue with a repro case I can try? |
14:38:04 | * | beholders_eye joined #nim |
14:48:46 | FromDiscord | <heysokam> how would you call for `commands.execProcesses(n = processorCount)`, when the process you want to launch is just a shellCmd, like from `execShellCmd`? 🤔 |
14:49:11 | FromDiscord | <heysokam> (edit) "is" => "are" | "a shellCmd," => "shell commands," |
15:01:32 | * | beholders_eye quit (Ping timeout: 240 seconds) |
15:25:07 | FromDiscord | <bostonboston> Does a conversion to a enum not check if you converted to a hole |
15:27:20 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4yCo |
15:28:12 | FromDiscord | <spotlightkid> Note that with '-c', the whole script goes into the second argument as one string. |
15:28:32 | FromDiscord | <spotlightkid> sent a code paste, see https://paste.rs/qEpoi |
15:28:57 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4yCs |
15:31:01 | FromDiscord | <heysokam> its mean to be platform-agnostic though 🤔 |
15:31:07 | FromDiscord | <heysokam> (edit) "mean" => "meant" |
15:35:25 | FromDiscord | <spotlightkid> then don't use shell |
15:37:34 | FromDiscord | <heysokam> In reply to @spotlightkid "then don't use shell": but `execShellCmd` uses a shell, doesn't it? |
15:37:45 | FromDiscord | <heysokam> how does that work platform-agnostic? |
15:38:04 | FromDiscord | <heysokam> the idea is to be able to run commands on cli in parallel, thats all |
15:44:08 | * | azimut quit (Ping timeout: 240 seconds) |
15:45:15 | FromDiscord | <spotlightkid> AFAICS `execShellCmd` uses `system` from the C stdlib, which invokes a platform-dependent command processor (`sh` on \nix, `cmd.exe` or `command.com` on windows). |
15:45:45 | * | lucasta joined #nim |
15:49:32 | FromDiscord | <spotlightkid> I.e. you cant expect `execShellCmd("ls -l")` to work on windows. |
16:07:14 | FromDiscord | <heysokam> well, but if the function calls for the correct thing interally, the function itself is platform-independent |
16:07:30 | FromDiscord | <heysokam> i thought execShellCmd worked on windows normally |
16:14:26 | FromDiscord | <spotlightkid> It does. It just doesn't use the Unix shell. So there wil be differences in the commands you can use. |
16:14:42 | NimEventer | New thread by Steven: MoveWindow(), see https://forum.nim-lang.org/t/10285 |
16:27:23 | FromDiscord | <heysokam> In reply to @spotlightkid "It does. It just": im going to call for a very specific app that i know exists in all systems. what i want is the shell itself, because i know the specific command do exists |
16:27:25 | FromDiscord | <heysokam> (edit) "exists" => "exist" |
16:27:47 | FromDiscord | <heysokam> does `sh` work on windows? because i do know it works on linux/mac |
16:30:57 | FromDiscord | <mratsim> In reply to @heysokam "does `sh` work on": In git bash |
16:31:31 | FromDiscord | <demotomohiro> `sh` works on windows if user installed it somehow. |
16:31:42 | FromDiscord | <spotlightkid> If by `app` you mean a binary executable, you don't need the shell to invoke it.↵Jusr pass the path to it as the first param to `execProcess`. |
16:31:46 | FromDiscord | <mratsim> In reply to @heysokam "the idea is to": This is a parallel CLI commands runner: https://github.com/mratsim/constantine/blob/master/helpers/pararun.nim |
16:47:15 | FromDiscord | <heysokam> In reply to @spotlightkid "If by `app` you": but i don't have the path for some of them. its in `PATH` |
16:47:35 | FromDiscord | <heysokam> some i give a full path, but for others its meant to search in path like a shell |
16:47:51 | FromDiscord | <heysokam> also, its meant to report in cli |
16:48:46 | FromDiscord | <heysokam> In reply to @mratsim "This is a parallel": i don't think i understand what this file is doing |
16:49:01 | FromDiscord | <heysokam> i have 0 knowledge in async, so its going over my head very strongly |
16:49:05 | FromDiscord | <spotlightkid> AFAICS `pararun` uses `osproc.startProcess` with the `poEvalCommand` option, whch boils down to calling the platform-dependent command processor again. |
16:49:57 | FromDiscord | <spotlightkid> Then use the `poUsePath` option, as I've shown above.↵(@heysokam) |
16:50:33 | FromDiscord | <spotlightkid> Sorrym that was meant as a reply to "but i don't have the path for some of them. its in PATH" |
16:50:36 | FromDiscord | <heysokam> whats different then between execShellCmd and execProcess(poUsePath), if they are both doing that? |
17:00:10 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yCK |
17:07:32 | FromDiscord | <mratsim> In reply to @heysokam "i don't think i": It takes a file of commands and enqueue them all for parallel processing.↵↵It uses a semaphore to ensure no more process than the number pf cores are running simultaneously and it buffers each command output so that you don't get garbled lines with 2 processes interleaving their output |
17:08:37 | FromDiscord | <mratsim> Say you have "Hello World!" and "Good morning" you can have Hgooellod Wmoorrnlding!" as an output |
17:11:18 | FromDiscord | <mratsim> In reply to @spotlightkid "Sorrym that was meant": So just use `nim` instead of `/usr/bin/nim` |
17:12:06 | FromDiscord | <mratsim> In reply to @mratsim "Say you have "Hello": In particular execProcesses does garbled output |
17:15:29 | * | mad_toothbrush quit (Ping timeout: 240 seconds) |
17:21:16 | * | PMunch joined #nim |
17:23:25 | FromDiscord | <heysokam> In reply to @mratsim "It takes a file": what i mean is that i cannot use that code if i don't understand it |
17:24:37 | FromDiscord | <heysokam> In reply to @mratsim "In particular execProcesses does": what is garbled output? |
17:26:45 | FromDiscord | <mratsim> In reply to @heysokam "what is garbled output?": One process outputting "Hello World!" and another outputting "Good morning" and what is printed on your console is a mix of the twos: "Hgooellod Wmoorrnlding!" |
17:26:53 | FromDiscord | <mratsim> (edit) "twos:" => "two:" |
17:27:43 | FromDiscord | <heysokam> ah i see |
17:27:59 | FromDiscord | <mratsim> In reply to @heysokam "what i mean is": It's really the minimal to have usable parallel processes unless your parallel processes never print anything and you cannot overload your CPU because you never spawn more processes than your number of cores. |
17:28:23 | FromDiscord | <mratsim> (edit) "minimal" => "minimum" |
17:35:49 | FromDiscord | <demotomohiro> In reply to @demotomohiro "Compiling this code prints": It is known issue: https://github.com/nim-lang/Nim/issues/21687#issuecomment-1514203430 |
17:39:38 | * | Onionhammer5 joined #nim |
17:41:08 | * | Onionhammer quit (Ping timeout: 252 seconds) |
17:41:08 | * | Onionhammer5 is now known as Onionhammer |
17:54:02 | * | adigitoleo quit (Ping timeout: 248 seconds) |
17:55:50 | * | adigitoleo joined #nim |
17:59:05 | * | mad_toothbrush joined #nim |
18:22:37 | FromDiscord | <PunchCake> Whats the best way to do a gui in nim? |
18:22:59 | FromDiscord | <PunchCake> Preferably a webview type of gui |
18:23:57 | mad_toothbrush | How do I refer to a linker script defined symbol from within Nim code ? |
18:42:02 | PMunch | @PunchCake, well if you want webview then use webview. There are a couple packages for it IIRC, nimble.directory |
18:44:27 | FromDiscord | <PunchCake> Which can be used with a js framework |
18:44:27 | FromDiscord | <PunchCake> Can you send some↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
18:46:01 | FromDiscord | <michaelb.eth> is there a way at compile-time to check that a type has a field with a particular name? |
18:46:34 | FromDiscord | <michaelb.eth> (edit) "a" => "an object" |
18:48:04 | FromDiscord | <jmgomez> `compiles(myObject.field)` |
18:49:52 | FromDiscord | <michaelb.eth> what if I don't have an instance, just the typedesc? |
18:50:39 | PMunch | @PunchCake, nope, haven't looked into it myself (apart from just getting Electron up and running with Nim at some point). Personally not a big fan of web-based UIs, but I know there are some libraries for it out there. |
18:52:06 | FromDiscord | <arathanis> In reply to @michaelb.eth "what if I don't": I think you can just ask about the field on an object |
18:53:03 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1120426033603170375/image.png |
18:53:39 | FromDiscord | <michaelb.eth> thanks |
18:54:43 | FromDiscord | <michaelb.eth> for some reason variations of that approach aren't working quite like I want, i.e. in some cases I get the assertion defect I'm expecting, in other cases the compiler fails with a more cryptic error |
18:54:59 | FromDiscord | <arathanis> what is your use case, cause this seems like you would want to be using concepts |
18:55:34 | FromDiscord | <michaelb.eth> I'll look into concepts when they're fully baked and the documentation is up-to-date |
18:55:41 | FromDiscord | <michaelb.eth> until then it's object variants ftw |
18:55:53 | FromDiscord | <arathanis> ahh object variants |
18:56:02 | FromDiscord | <arathanis> can't you just check which variant it is instead of checking the fields? |
18:56:17 | FromDiscord | <michaelb.eth> the variants are user-supplied |
18:56:20 | FromDiscord | <michaelb.eth> I'm writing a library |
18:56:51 | FromDiscord | <michaelb.eth> with a convention that in the case of two different types, one has an `id` field, and the other has a `name` field |
18:57:15 | FromDiscord | <arathanis> ghotcha |
18:57:19 | FromDiscord | <arathanis> (edit) "ghotcha" => "gotcha" |
18:57:35 | FromDiscord | <michaelb.eth> in any case, with my assertions in a `static:` block, there is a compile-time failure if the assertions fail, so that's good |
18:57:49 | FromDiscord | <michaelb.eth> it's just the errors can be cryptic, but oh well |
18:58:22 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4yD3 |
18:58:39 | FromDiscord | <arathanis> then anything that lets that block compile is consided an ExampleConcept |
18:58:46 | FromDiscord | <arathanis> and you otherwise use it as a type |
18:59:00 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4yD4 |
18:59:03 | FromDiscord | <michaelb.eth> sure, concepts seem really cool, but isn't the Manual out of step re: "old concetps" vs. "new concepts"? and, are "new concepts" really ready for prime time? |
18:59:18 | FromDiscord | <arathanis> In reply to @michaelb.eth "sure, concepts seem really": yes, the current implementation is somewhere between the two |
18:59:24 | FromDiscord | <michaelb.eth> In reply to @jmgomez "this may also work": tried it, the `compiles(...)` passes even when the field is missing |
18:59:25 | FromDiscord | <arathanis> the basic stuff like above works though |
19:00:21 | FromDiscord | <jmgomez> In reply to @michaelb.eth "tried it, the `compiles(...)`": that's odd. Can you show how you are using it? |
19:01:27 | FromDiscord | <jmgomez> also another option if you dont really want to use concepts is to just do a macro that checks for the field |
19:01:39 | FromDiscord | <arathanis> In reply to @jmgomez "also another option if": i was also going to suggest this as well |
19:01:40 | FromDiscord | <michaelb.eth> what's the most up-to-date (and hopefully decent) tutorial/blog-post/etc on "new" concepts? I'd be interested in seeing a compare/contrast with how to use them vs. object variants |
19:01:53 | FromDiscord | <arathanis> a macro to be used as a pragma to register the user defined type that verifies what you need |
19:02:02 | FromDiscord | <arathanis> can even stitch things into the type |
19:02:03 | FromDiscord | <michaelb.eth> In reply to @jmgomez "also another option if": ah yeah, that's a good point |
19:03:02 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4yD7 |
19:03:43 | FromDiscord | <michaelb.eth> maybe a compiler bug, but another interesting/weird thing is that for `initial` and `name` I couldn't just supply the default value, had to also give them type, else compile-time failure |
19:04:32 | FromDiscord | <michaelb.eth> (edit) "give them type," => "specify the types," |
19:05:51 | * | lucasta quit (Quit: Leaving) |
19:05:57 | FromDiscord | <jmgomez> how exactly were you using `compiles`? |
19:06:55 | FromDiscord | <jmgomez> (edit) removed "exactly" |
19:06:56 | FromDiscord | <michaelb.eth> I will answer, but before that, I'll note that if I don't put the assertions in `static:`, the first one will fail if `Dm` doesn't have `id` field, but the second one only fails at runtime |
19:07:01 | FromDiscord | <michaelb.eth> which seems weird to me |
19:12:11 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4yD9 |
19:13:18 | FromDiscord | <jmgomez> Yeah. Try to do `when not compiles(Dm.id): error("error whatever")` |
19:16:10 | FromDiscord | <deech4592> sent a code paste, see https://play.nim-lang.org/#ix=4yDb |
19:16:11 | FromDiscord | <michaelb.eth> sent a code paste, see https://paste.rs/ewOM2 |
19:17:18 | FromDiscord | <michaelb.eth> In reply to @michaelb.eth "sure, but here's one": I just relieved that `name` from std/typetriats is probably causing some confusion |
19:17:46 | FromDiscord | <michaelb.eth> In reply to @deech4592 "You can also do": nice, I will try that also, thank you! |
19:19:14 | FromDiscord | <deech4592> Something like this seems like a good candidate for the stdlib. I've had to roll something like this a few times on my own. |
19:19:36 | FromDiscord | <deech4592> (edit) "something like this" => "my own" | "on my own." => "so far." |
19:22:05 | * | ntat quit (Ping timeout: 265 seconds) |
19:24:31 | NimEventer | New thread by mantielero: Macro - issue with the identifiers, see https://forum.nim-lang.org/t/10286 |
19:42:45 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDf |
19:43:27 | * | nyeaa492842301 quit (Quit: The Lounge - https://thelounge.chat) |
19:43:44 | FromDiscord | <ieltan> (edit) "https://play.nim-lang.org/#ix=4yDf" => "https://play.nim-lang.org/#ix=4yDg" |
19:45:11 | FromDiscord | <mratsim> In reply to @michaelb.eth "sure, concepts seem really": new concepts are usable? |
19:52:02 | * | cedb quit (Ping timeout: 252 seconds) |
19:54:15 | * | cedb joined #nim |
19:57:58 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yDl |
19:58:59 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-type-casts |
19:59:24 | FromDiscord | <demotomohiro> > Type casts are a crude mechanism to interpret the bit pattern of an expression as if it would be of another type. Type casts are only needed for low-level programming and are inherently unsafe. |
20:00:02 | * | derpydoo quit (Quit: derpydoo) |
20:02:00 | FromDiscord | <demotomohiro> If you are using cast when you are not using C library, you are likely doing something wrong. |
20:07:07 | * | mronetwo quit (Read error: Connection reset by peer) |
20:07:08 | * | tk quit (Ping timeout: 240 seconds) |
20:07:13 | * | oddish quit (Read error: Connection reset by peer) |
20:07:16 | * | adigitoleo quit (Read error: Connection reset by peer) |
20:07:19 | * | mronetwo joined #nim |
20:07:24 | * | oddish joined #nim |
20:07:49 | * | tk joined #nim |
20:09:40 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDm |
20:10:04 | FromDiscord | <ieltan> (edit) "https://play.nim-lang.org/#ix=4yDm" => "https://play.nim-lang.org/#ix=4yDn" |
20:11:42 | FromDiscord | <krab4t> how you create a proc that takes any amount of any types? not varargs... |
20:11:50 | FromDiscord | <krab4t> t: T its just 1 |
20:12:31 | FromDiscord | <ieltan> In reply to @ieltan "Thanks, I reflected your": The usecase is to have a table of closures, accepting `Parent` and `Child` as an argument and returning bool after running checks |
20:12:43 | FromDiscord | <ieltan> (edit) "and" => "and/or " |
20:15:12 | FromDiscord | <ieltan> `t` may be instances of `Parent` having additional fields that i would like to access, I need to convert to the specific `Child` instance to access them but since I want to put that in library code I don't want the user to manually convert the type all the type |
20:17:12 | * | mad_toothbrush quit (Ping timeout: 240 seconds) |
20:20:13 | * | adigitoleo joined #nim |
20:26:49 | FromDiscord | <demotomohiro> How does Nim compiler infer Child from Parent?↵t of Child checks runtime type info. |
20:30:13 | FromDiscord | <demotomohiro> sent a code paste, see https://paste.rs/UskdQ |
20:33:19 | FromDiscord | <Elegantbeef> Well you can technically `cast[proc(t: Parent)](myClos)` but it's unsafe |
20:33:30 | FromDiscord | <Elegantbeef> This is sounding a lot like methods |
20:34:04 | FromDiscord | <Elegantbeef> @mratsim\: yes they work, but they're not fully implemented and there are many bugs |
20:49:43 | FromDiscord | <voidwalker> can I somehow specify in the .nimble file that my project needs "db_connector" if nim version > 1.6 ? |
20:51:23 | FromDiscord | <voidwalker> if I do nimble install db_connector with choosenim stable, I get `Error: Unsatisfied dependency: nim (>= 1.7.3)` |
20:51:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4yDp |
20:55:17 | * | derpydoo joined #nim |
20:55:37 | FromDiscord | <voidwalker> Thanks, I think that worked, |
20:56:30 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDt |
20:58:25 | FromDiscord | <ieltan> pinging @krisp0 because this is mainly for his library so he might figure something out |
20:59:16 | FromDiscord | <Elegantbeef> You cannot convert a `proc(c: Child)` to `proc(p: Parent)` safely |
21:00:40 | FromDiscord | <ieltan> In reply to @Elegantbeef "You cannot convert a": Is there an alternative approach to my issue then ? |
21:01:05 | FromDiscord | <Elegantbeef> Methods/Convert internally |
21:02:21 | FromDiscord | <demotomohiro> Yes, methods would be better |
21:03:43 | FromDiscord | <ieltan> In reply to @Elegantbeef "Methods/Convert internally": Well, I cannot use methods/dynamic dispatch with closures.. |
21:03:49 | FromDiscord | <ieltan> unless i can ? |
21:05:58 | FromDiscord | <demotomohiro> How about to define methods for each Children types and call them from closures? |
21:09:50 | * | nyeaa492842301 joined #nim |
21:19:21 | FromDiscord | <bostonboston> Nim seems to be exporting a NimMain symbol in my dll even when specifying `--noMain:on`, is that supposed to happen |
21:19:41 | FromDiscord | <Elegantbeef> Yes |
21:19:45 | FromDiscord | <bostonboston> (edit) "Nim ... seems" added "compiler" |
21:19:58 | FromDiscord | <Elegantbeef> You should always call `NimMain` it calls top level code |
21:20:42 | FromDiscord | <bostonboston> So is there something funny I need to be doing when importing my functions from the dll in other languages |
21:20:43 | FromDiscord | <arathanis> In reply to @bostonboston "Nim compiler seems to": it initializes Nim's internals: https://nim-lang.org/docs/backends.html#interfacing-backend-code-calling-nim |
21:21:03 | FromDiscord | <Elegantbeef> Generally you have a `once: NimMain()` inside your `init` procedure |
21:21:07 | FromDiscord | <arathanis> there is a compiler flag to prefix it apparently, if you want to change the name. |
21:21:12 | FromDiscord | <arathanis> In reply to @Elegantbeef "Generally you have a": this is exactly how i do it |
21:22:08 | FromDiscord | <arathanis> ok beef, you work on the compiler right? |
21:22:18 | FromDiscord | <Elegantbeef> "work" is a loose term 😛 |
21:22:34 | FromDiscord | <Elegantbeef> I do some amount of compiler development when the sun hits me at the right time |
21:23:40 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4yDD |
21:23:51 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4yDD" => "https://play.nim-lang.org/#ix=4yDE" |
21:24:00 | FromDiscord | <ieltan> In reply to @demotomohiro "How about to define": Well no, this really should not be up to the user to do this. I was thinking of defining procs for each `Child` types and put them in a object variant but i remembered you cannot share field 😢 |
21:24:46 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4yDE" => "https://play.nim-lang.org/#ix=4yDF" |
21:25:31 | FromDiscord | <arathanis> its gotta be some quirk of the parser |
21:25:38 | FromDiscord | <Elegantbeef> Clearly |
21:26:15 | FromDiscord | <Elegantbeef> ieltan explain what you're trying to do |
21:26:55 | FromDiscord | <Elegantbeef> I do not use `=>` so I've never ran into this, so no real insight here |
21:28:53 | FromDiscord | <bostonboston> Not knowing to run NimMain() once really had me running in circles |
21:35:22 | FromDiscord | <krisp0> In reply to @ieltan "pinging <@222794789567987712> because this": Are you trying to implement event handlers that are a bit similar to krognol's discordnim? |
21:43:52 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDJ |
21:47:47 | FromDiscord | <ieltan> In reply to @krisp0 "Are you trying to": Not aware that it even existed tbh |
21:48:44 | FromDiscord | <Elegantbeef> Nice the bridge dropped an important message 😄 |
21:48:53 | FromDiscord | <Elegantbeef> I've got a possible idea |
21:51:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/sZeK9 |
21:51:18 | FromDiscord | <Elegantbeef> Something like this |
21:51:37 | FromDiscord | <Elegantbeef> whoops should be `cast[proc(p: Parent)](myProc)` |
21:52:57 | FromDiscord | <Elegantbeef> Also those `T` should be `t` |
21:53:28 | FromDiscord | <Elegantbeef> You could also write a macro so you could do `toEvent(proc(c: Child) = echo "hmm")` |
21:54:24 | * | PMunch quit (Quit: leaving) |
22:00:35 | * | greaser|q quit (Remote host closed the connection) |
22:03:46 | * | greaser|q joined #nim |
22:10:14 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDO |
22:10:29 | FromDiscord | <Elegantbeef> Why do we have event kind and inheritance |
22:19:58 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDP |
22:21:36 | FromDiscord | <Elegantbeef> So `array[EventKind, Table[string, Collector]]` |
22:21:45 | FromDiscord | <ieltan> for more details, I used `parseEnum[EventKind]("EVENT_NAME")` |
22:21:58 | FromDiscord | <Elegantbeef> What are the strings for? |
22:22:03 | FromDiscord | <ieltan> In reply to @Elegantbeef "So `array[EventKind, Table[string, Collector]]`": Ah right |
22:22:29 | FromDiscord | <ieltan> it's not gonna move much so an array is appropriate 🙂 |
22:25:32 | FromDiscord | <ieltan> In reply to @Elegantbeef "What are the strings": a discord payload has a `t` field containing the event name, it might be "MESSAGE_CREATE", in anycase i use `parseEnum[EventKind](t)` to get `MessageCreateEvent` |
22:25:48 | FromDiscord | <ieltan> or any other event type |
22:25:51 | FromDiscord | <Elegantbeef> Right so what's the string for in the table? |
22:32:57 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4yDQ |
22:36:32 | FromDiscord | <ieltan> i was planning on adding more stuff on the comments warning about how the string gets too big and that i might have to use slices |
22:43:54 | * | greaser|q quit (Remote host closed the connection) |
22:44:10 | FromDiscord | <Elegantbeef> Do not know why you'd use inheritance where variants suffice |
22:45:57 | * | greaser|q joined #nim |
22:46:58 | FromDiscord | <ieltan> cannot have shared name fields but i'll give it a go later maybe it wont be as bad |
22:47:32 | FromDiscord | <Elegantbeef> Could use fungus |
22:49:46 | FromDiscord | <ieltan> In reply to @Elegantbeef "*Could use fungus*": Not up to me 😢 |
22:50:04 | FromDiscord | <Elegantbeef> What? |
22:51:13 | FromDiscord | <ieltan> I mean that I don't think adding a dependency for `dimscord` would be worth my contribution unless the maintainer thinks otherwise |
22:51:35 | FromDiscord | <Elegantbeef> Well then use a variant with a property |
22:51:46 | * | sagax joined #nim |
22:52:14 | FromDiscord | <ieltan> Yup |
23:39:02 | * | azimut joined #nim |
23:53:02 | FromDiscord | <JJ> so i'm reading through the concepts v2 proposal and the first line threw me off:↵> Empower concepts to make generic code type-checkable at declaration time, not only at instantiation time.↵does araq mean runtime? i thought concepts were monomorphized but i may be mistaken. |
23:58:14 | FromDiscord | <Elegantbeef> Ensure the concept is constrained, like a trait |
23:58:14 | FromDiscord | <Elegantbeef> He means that inside the generic procedure |
23:59:01 | FromDiscord | <JJ> hmm, could you elaborate |
23:59:42 | FromDiscord | <huantian> it's the thing I always complain about |
23:59:45 | FromDiscord | <elegantbeef> Bridge moment |