00:00:11 | * | albe quit (Quit: The Lounge - https://thelounge.chat) |
00:00:53 | FromDiscord | <aurelian5014> is there a lighter weight socket lib for nim? the stdlib has a pretty complex SocketImpl type |
00:02:32 | * | lucasta joined #nim |
00:03:12 | FromDiscord | <aurelian5014> oh, `posix` |
00:04:22 | * | albe joined #nim |
00:35:53 | FromDiscord | <majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=YpVSEhvq |
00:36:02 | * | lucasta quit (Remote host closed the connection) |
00:39:23 | FromDiscord | <kiloneie> ? https://media.discordapp.net/attachments/371759389889003532/1292285038771044373/image.png?ex=67032dba&is=6701dc3a&hm=814f4840df210e966e9af1f993968c2bee7e5f643ed16d523514567bcb228e82& |
00:53:05 | FromDiscord | <Elegantbeef> Use std/strformat? |
02:17:56 | * | xet7 joined #nim |
02:44:08 | FromDiscord | <majortrips1763> Oh snap.. I didn't know that nim supported `--cc:env`, useful |
03:08:52 | FromDiscord | <Robyn [She/Her]> In reply to @majortrips1763 "Oh snap.. I didn't": huh? |
03:08:55 | FromDiscord | <Robyn [She/Her]> what does that do? |
03:14:11 | FromDiscord | <user2m> In reply to @chronos.vitaqua "huh?": https://nim-lang.org/docs/nimc.html#compiler-selection |
03:16:11 | FromDiscord | <majortrips1763> Are there any tutorials covering `config.nims` ? |
03:18:21 | FromDiscord | <Robyn [She/Her]> In reply to @user2m "https://nim-lang.org/docs/nimc.html#compiler-select": oooh damn |
03:20:14 | FromDiscord | <11na/energy> The docs have a [NimScript](https://nim-lang.org/docs/nims.html#nimscript-as-a-configuration-file) page, if that's any help.↵(@majortrips1763) |
03:22:35 | FromDiscord | <majortrips1763> In reply to @11na/energy "The docs have a": Been reading this one, but it doesn't really help me connect the dots for writing the config.nims for a given project. I feel like I am missing something. |
03:22:58 | FromDiscord | <Robyn [She/Her]> In reply to @majortrips1763 "Been reading this one,": well, what are you trying to achieve? |
03:23:25 | FromDiscord | <majortrips1763> In reply to @chronos.vitaqua "well, what are you": Mostly understanding 🙂 |
03:24:37 | FromDiscord | <Robyn [She/Her]> i mean, not sure what you're not understanding? can you be more specific? |
03:24:59 | FromDiscord | <11na/energy> Er, like implementing the values? |
03:25:50 | FromDiscord | <majortrips1763> I am trying to piece my way through writing a config.nims for targetting a multi-arch, free-standing binary. |
03:26:50 | FromDiscord | <Robyn [She/Her]> In reply to @majortrips1763 "I am trying to": oh so you want to set the compiler to a different compiler per arch + OS you're targeting? |
03:26:51 | FromDiscord | <majortrips1763> I am also trying to figure out how to magically alter the nim search path from the config.nims |
03:27:25 | FromDiscord | <Robyn [She/Her]> In reply to @majortrips1763 "I am also trying": `--path:"..."` or `switch("path", "...")` |
03:27:41 | FromDiscord | <Robyn [She/Her]> though you can't remove search paths i don't believe |
03:27:52 | FromDiscord | <Robyn [She/Her]> maybe the nimble path can be removed but that's all |
03:28:15 | FromDiscord | <Robyn [She/Her]> anyway, most things from the CLI should work like it would normally in the .nims file |
03:30:23 | FromDiscord | <majortrips1763> Hmm .. I think I misunderstood something I read. Are there ways to add switches to tasks? |
03:33:28 | FromDiscord | <majortrips1763> Oh .. just located this: https://github.com/nim-lang/Nim/wiki/Using-nimscript-for-configuration |
03:55:12 | FromDiscord | <11na/energy> I might bookmark that; it seems useful enough. The [first header](https://nim-lang.org/docs/nims.html#NimScript) in the docs seems so as well. Worth looking in, essentially.↵(@majortrips1763) |
04:03:19 | FromDiscord | <majortrips1763> In reply to @chronos.vitaqua "though you can't remove": Is it possible to inspect the path? |
04:05:47 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
04:09:54 | * | SchweinDeBurg joined #nim |
04:37:19 | FromDiscord | <majortrips1763> Okay, so I can set custom defines, but I am not finding an intuitive way to inspect them. |
04:56:58 | FromDiscord | <majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=ucVRIXhs |
04:58:42 | FromDiscord | <majortrips1763> It is a little weird as the output from `nim --help` indicates that the syntax is `-d:x:y` and not `-d:x=y` as indicated in the docs.. not certain which is correct |
04:59:21 | FromDiscord | <majortrips1763> Though both syntaxes do result in the define showing up in the output of `nim dump`, I am failing to locate the proc which can retrieve the entire `y` side of the define. |
05:33:08 | FromDiscord | <Elegantbeef> Both are correct |
05:33:12 | FromDiscord | <Elegantbeef> You just do `defined` |
05:33:43 | FromDiscord | <Elegantbeef> If you want the value you do `const myVal {.define.} = defaultValueHere` |
06:28:51 | * | ntat joined #nim |
06:46:04 | FromDiscord | <.bobbbob> choosenim update self gives a 404 error |
07:40:58 | * | lucerne quit (Ping timeout: 252 seconds) |
08:22:21 | * | coldfeet joined #nim |
08:43:33 | FromDiscord | <xtrayambak> In reply to @majortrips1763 "Are there any formatting": nph is neat. |
08:47:14 | * | xet7_ joined #nim |
08:47:29 | * | xet7_ quit (Remote host closed the connection) |
08:49:19 | * | xet7 quit (Ping timeout: 264 seconds) |
09:16:32 | FromDiscord | <spotlightkid> @.bobbbob\: you need to re-install choosenim from https://github.com/nim-lang/choosenim |
09:17:16 | FromDiscord | <spotlightkid> you probably have the out-dated version from https://github.com/dom96/choosenim |
09:17:41 | FromDiscord | <spotlightkid> See also\: https://forum.nim-lang.org/t/12535 |
09:35:13 | * | marcus quit (Remote host closed the connection) |
09:37:15 | * | marcus joined #nim |
10:13:27 | * | beholders_eye joined #nim |
10:17:48 | * | beholders_eye quit (Ping timeout: 246 seconds) |
10:52:15 | * | xet7 joined #nim |
11:19:54 | * | ntat quit (Quit: Leaving) |
11:54:09 | FromDiscord | <einjonas> Hey, has nim smth like a string builder in the stdlib |
11:57:20 | * | ryuukk quit (Remote host closed the connection) |
11:57:32 | FromDiscord | <demotomohiro> There are `std/strformat` and `std/strutils` module in stdlib. |
11:58:08 | FromDiscord | <einjonas> strings aren't immutable in nim right? |
11:59:38 | * | ryuukk joined #nim |
11:59:54 | FromDiscord | <demotomohiro> `const`, `let` and parameter values are immutable but `var` variables are mutable. |
12:00:31 | FromDiscord | <fabric.input_output> strings can be mutated |
12:00:48 | FromDiscord | <einjonas> oh nice |
12:01:24 | FromDiscord | <einjonas> i meant it like in odin where u make allways a clone |
12:01:52 | FromDiscord | <einjonas> because it easier to handle string as a pointer |
12:02:05 | FromDiscord | <einjonas> do avoid allocations |
12:02:32 | FromDiscord | <einjonas> they have a string builder |
12:02:48 | FromDiscord | <einjonas> runes(s) can convert int to char? |
12:04:54 | * | xet7 quit (Remote host closed the connection) |
12:05:06 | FromDiscord | <einjonas> what is pure and std ? |
12:05:19 | FromDiscord | <einjonas> sry i am a beginner in nim |
12:05:33 | FromDiscord | <demotomohiro> A rune in unicode cannot always convert to char as char in Nim is always 1 byte. |
12:05:33 | FromDiscord | <einjonas> wanted to explore it |
12:06:02 | FromDiscord | <einjonas> so how can i make a char? |
12:06:22 | FromDiscord | <einjonas> wait what |
12:06:37 | FromDiscord | <demotomohiro> Files in https://github.com/nim-lang/Nim/tree/devel/lib/pure are part of stdlib. |
12:06:49 | FromDiscord | <einjonas> (edit) "what" => "what's the difference bettween rune and char in odin" |
12:07:10 | FromDiscord | <einjonas> i know them from other languages |
12:07:45 | FromDiscord | <einjonas> but they usually weren't really divided |
12:09:07 | FromDiscord | <demotomohiro> You can make `char` type variable like `var c = 'a'` or `var c = 97.char`. |
12:09:31 | FromDiscord | <einjonas> In reply to @demotomohiro "A rune in unicode": true unicode can be 4 bytes max i think |
12:09:32 | FromDiscord | <majortrips1763> Hmm.. defining a `help` task doesn't seem to result in my task being used for `help` |
12:10:30 | FromDiscord | <einjonas> when i iter over string to i get chars in nim or runes like in golang? |
12:11:40 | FromDiscord | <demotomohiro> You get chars. |
12:14:08 | FromDiscord | <einjonas> oh sry |
12:16:09 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=KJcVIjBL |
12:17:31 | * | xet7 joined #nim |
12:52:35 | FromDiscord | <majortrips1763> Are there any declarations for defining linker sections and such? |
13:00:49 | FromDiscord | <demotomohiro> In reply to @majortrips1763 "Are there any declarations": Only way I know is use `codegenDecl` and use C's attribute:↵https://github.com/demotomohiro/MinimumNimPico/blob/main/src/startup.nim#L114 |
13:03:32 | FromDiscord | <majortrips1763> In reply to @demotomohiro "Only way I know": Nice! This answers a whole ton of questions I had 🙂 |
13:11:17 | FromDiscord | <majortrips1763> In reply to @demotomohiro "Only way I know": I am trying to do almost the exact same pattern, but for multiboot2 entry. |
13:16:42 | FromDiscord | <demotomohiro> In reply to @majortrips1763 "I am trying to": What is multiboot2 entry? Are you trying to write code for some micro controller? |
13:18:04 | FromDiscord | <majortrips1763> multiboot2 is sort of a special section in the binary that can be used to indicate to multiboot2 compliant bootloaders (grub2) as to how to setup the kernel and pass hardware information into the kernel. The spec requires a special `.multiboot2` section in the final binary along with a fairly imple structure.↵https://wiki.osdev.org/Multiboot#Multiboot_2 |
13:18:16 | FromDiscord | <majortrips1763> (edit) "`.multiboot2`" => "`.multiboot`" |
13:18:31 | FromDiscord | <majortrips1763> (edit) "imple" => "simple" |
13:18:53 | FromDiscord | <majortrips1763> I have set it up before using ASM and C, but trying to do it all in pure Nim |
13:19:14 | FromDiscord | <majortrips1763> (edit) "all" => "this time" |
13:21:08 | FromDiscord | <majortrips1763> The problem space has many of the same problems this startup.nim does. Basically a custom entrypoint when there are no stack pointers setup, some data structures to be read about the environment, and eventually a jmp into main. |
13:22:52 | FromDiscord | <majortrips1763> I am actually hoping to write support for multiboot1 and multiboot2, mostly as a practice challenge. |
13:27:20 | FromDiscord | <majortrips1763> Well, "pure nim" as in, no .C or .S files. |
13:28:52 | FromDiscord | <demotomohiro> That looks interesting! |
13:34:32 | * | dvbst joined #nim |
13:36:53 | FromDiscord | <majortrips1763> In reply to @demotomohiro "That looks interesting!": Yah, sort of using this as a teaching aid in learning Nim ... I am also trying to pull in the standard C defines from multiboot2.h and multiboot.h and use them. Grub provides these under a non-GPL license (looks a bit like a BSD2 clause?):↵http://git.savannah.gnu.org/cgit/grub.git/tree/include |
14:00:57 | * | coldfeet quit (Remote host closed the connection) |
14:02:52 | * | Onionhammer quit (Quit: The Lounge - https://thelounge.chat) |
14:36:46 | FromDiscord | <majortrips1763> Are `--define`'s global to all source? |
14:39:21 | FromDiscord | <odexine> Yes |
14:43:44 | FromDiscord | <majortrips1763> is there any fun way to force a .codegenDecl alignment? |
14:45:22 | * | ryuukk quit (Remote host closed the connection) |
14:47:27 | * | ntat joined #nim |
14:47:34 | * | ryuukk joined #nim |
15:08:56 | * | Onionhammer joined #nim |
15:10:47 | * | Onionhammer quit (Client Quit) |
15:20:58 | * | Onionhammer joined #nim |
15:25:19 | FromDiscord | <majortrips1763> So, when referencing a define from multiple sources, does it have to be declared in each source it is used? |
15:33:27 | * | rockcavera joined #nim |
16:05:04 | Amun-Ra | either way works |
16:09:43 | FromDiscord | <majortrips1763> Hmm .. how to get the sizeof() of a C struct defined in a header file? |
16:12:18 | * | xet7_ joined #nim |
16:13:27 | FromDiscord | <piuvas> sent a code paste, see https://play.nim-lang.org/#pasty=svpHwQZg |
16:14:46 | * | xet7 quit (Ping timeout: 272 seconds) |
16:20:44 | FromDiscord | <einjonas> is there a way to use lib like this |
16:21:04 | FromDiscord | <einjonas> sent a code paste, see https://play.nim-lang.org/#pasty=lZdGwOUA |
16:21:35 | FromDiscord | <einjonas> using the libary/file name as identifier |
16:22:08 | FromDiscord | <einjonas> nim doesn't have modules/packages like go right? |
16:22:24 | FromDiscord | <einjonas> every file is in it's own space |
16:24:50 | Amun-Ra | yes |
16:25:15 | Amun-Ra | you can use explicit module names |
16:25:31 | Amun-Ra | and you sometimes have to |
16:27:19 | FromDiscord | <odexine> In reply to @einjonas "nim doesn't have modules/packages": Every file is its own module |
16:27:54 | FromDiscord | <einjonas> thanks |
16:28:06 | FromDiscord | <einjonas> mean't the declaration with package |
16:28:12 | FromDiscord | <einjonas> or namespace in cpp |
16:28:19 | FromDiscord | <odexine> Nothing like that in Nim |
16:28:39 | FromDiscord | <odexine> You can simulate it I guess but otherwise no |
16:28:41 | Amun-Ra | there are namespaces, although there's also single implicit one |
16:28:59 | FromDiscord | <odexine> Well yes but not like on go or X++ |
16:29:03 | FromDiscord | <odexine> C++ |
16:29:25 | Amun-Ra | not 1:1 |
16:35:54 | FromDiscord | <majortrips1763> Is there any crafty way in NimScript to `import` based on a variable name? outside of a huge stack of conditional checks... Like, an `eval` option of some sort? |
16:35:57 | FromDiscord | <einjonas> another question what does do in proc x() |
16:36:14 | FromDiscord | <einjonas> do i have to use it to export it? |
16:36:18 | FromDiscord | <hugop707> Yep |
16:36:31 | FromDiscord | <einjonas> so it's no pointer |
16:36:32 | Amun-Ra | can't see the subject of the question on IRC |
16:36:43 | Amun-Ra | ah, so what I can't see is a star |
16:36:57 | Amun-Ra | einjonas: ptr is Nim's equivalent for pointer |
16:37:10 | FromDiscord | <hugop707> @einjonas , no, the asterix is just for exporting functions or types |
16:37:12 | Amun-Ra | this is what we see on IRC: "einjonas | another question what does do in proc x()" |
16:37:28 | Amun-Ra | star makes a function/variable/whatever public |
16:37:30 | FromDiscord | <odexine> In reply to @einjonas "so it's no pointer": No, that’s syntax from C. Nim is highly Pascal derived (though the star isn’t from Pascal) |
16:38:14 | FromDiscord | <einjonas> i am not used to much to other syntaxes as c |
16:38:22 | FromDiscord | <odexine> In reply to @majortrips1763 "Is there any crafty": Not that I can think of, no. Probably possible in regular Nim though |
16:38:28 | FromDiscord | <einjonas> is nim kinda modern pascal? |
16:38:35 | Amun-Ra | no |
16:38:43 | FromDiscord | <odexine> Not really? |
16:38:55 | FromDiscord | <odexine> Kinda, some people would describe it that way |
16:39:18 | Amun-Ra | people often more describe Nim as compiled-python |
16:39:31 | FromDiscord | <einjonas> is it? |
16:39:41 | FromDiscord | <einjonas> i mean at first glance yeah |
16:39:56 | Amun-Ra | that's because of similar syntax |
16:39:59 | Amun-Ra | (to a point) |
16:40:00 | FromDiscord | <einjonas> i have not sean much but |
16:40:24 | FromDiscord | <einjonas> it uses more syntax from haskell |
16:40:28 | Amun-Ra | Nim goes one step further and tabs are errors :> |
16:40:38 | FromDiscord | <einjonas> function = ↵ do stuff |
16:40:39 | * | Amun-Ra does not speak haskell |
16:41:08 | FromDiscord | <einjonas> the function syntax is kinda more from scala/haskell |
16:41:33 | FromDiscord | <einjonas> and that u don't need to use return |
16:41:39 | Amun-Ra | UFCS is pretty unique… |
16:41:50 | Amun-Ra | D has that, I don't recall any other language |
16:41:55 | Amun-Ra | https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax |
16:43:06 | FromDiscord | <einjonas> yeah besides the indendation i think nim differs much from python |
16:43:58 | FromDiscord | <einjonas> In reply to @Amun-Ra "D has that, I": that's a cool feature |
16:44:01 | Amun-Ra | those are academic discussions after all |
16:44:09 | FromDiscord | <einjonas> yeah |
16:44:12 | Amun-Ra | einjonas: yes, I wish C had that |
16:44:23 | FromDiscord | <einjonas> or Rust |
16:44:34 | Amun-Ra | I'm alergic to Rust ;) |
16:45:02 | Amun-Ra | but that's a topic for #nim-offtopic ;) |
16:45:03 | FromDiscord | <einjonas> it quite syntax heavy but i think the the same goes for cpp |
16:45:43 | Amun-Ra | UFCS was proposed to be included into C++ twice, IIRC those attempts failed |
16:46:30 | FromDiscord | <einjonas> i like Rust |
16:46:40 | FromDiscord | <einjonas> it far better as Java |
16:46:47 | FromDiscord | <einjonas> and has great Docs |
16:47:02 | FromDiscord | <einjonas> but i can see why people don't like it |
16:47:11 | Amun-Ra | I wasted 1x monts on rust, I switched to nim |
16:47:37 | FromDiscord | <einjonas> what have u done with Rust |
16:47:41 | FromDiscord | <majortrips1763> is it possible to do something like `import foo/$var` ? |
16:47:42 | FromDiscord | <einjonas> Gamedev? |
16:47:55 | FromDiscord | <einjonas> we can switch to offtopic |
16:48:05 | Amun-Ra | majortrips1763: thankfully not |
16:49:05 | Amun-Ra | einjonas: just playing with the language |
16:49:17 | FromDiscord | <majortrips1763> In reply to @Amun-Ra "<@661414156846628885>: thankfully not": It is actually kinda unfortunate .. not certain how else to deal with keeping all these config's separated and clean. |
16:49:34 | Amun-Ra | playing the language* (we add "with" in my native language, that's why it slipped) |
16:49:46 | Amun-Ra | majortrips1763: use defines |
16:50:11 | Amun-Ra | are you coming from perl by any chance? ;) |
16:50:38 | FromDiscord | <majortrips1763> In reply to @Amun-Ra "<@661414156846628885>: use defines": I am, that is the problem. I am looking at possibly needing hundreds of defines for different targets, and many of them are unique to specific platforms. To keep it clean I was hoping to handle the per-platform defines in different configs. |
16:51:21 | Amun-Ra | majortrips1763: that sucks, I support hmm… 5-6 targets, tops |
16:51:44 | Amun-Ra | still I think defines are better than these eval-like stuff |
16:52:40 | FromDiscord | <odexine> Can’t you query compile settings like targets? |
16:53:04 | FromDiscord | <odexine> That way you can just import them all no? |
16:53:19 | FromDiscord | <majortrips1763> In reply to @odexine "Can’t you query compile": That is sort of the problem .. I am defining system level targetting information for specific board/architectures/etc. |
16:55:48 | FromDiscord | <majortrips1763> sent a long message, see https://pasty.ee/KVfyRmOC |
16:57:50 | FromDiscord | <majortrips1763> Which I guess I will need to do, have this huge `target/init.nims` script that just has a massive top-down cascade of imports to do a 1:1 of the target to a file name 😦 |
17:00:06 | * | xet7_ quit (Quit: Leaving) |
17:18:53 | * | Onionhammer quit (Quit: The Lounge - https://thelounge.chat) |
17:20:35 | * | xet7 joined #nim |
17:25:17 | FromDiscord | <arm_3_d> sent a code paste, see https://play.nim-lang.org/#pasty=sNDTbAMB |
17:25:40 | FromDiscord | <arm_3_d> (edit) "https://play.nim-lang.org/#pasty=TtaRBwfM" => "https://play.nim-lang.org/#pasty=LDpqnmZP" |
17:27:58 | * | Onionhammer joined #nim |
17:28:06 | * | Onionhammer quit (Client Quit) |
17:31:12 | * | Onionhammer joined #nim |
17:53:31 | FromDiscord | <majortrips1763> Is there not a simple pattern matching proc available in NimScript to be used as part of `while`? |
18:07:49 | FromDiscord | <treeform> In reply to @arm_3_d "Because some customers are": Supporting windows XP is going to be hard with standard library. Your best best might be to bind to win32 API directly? It's going to be a ton of work! |
18:08:27 | FromDiscord | <hugop707> Arent there bindings already? |
18:08:36 | FromDiscord | <treeform> `I'm compiling binary using mingw-w64 from linux.` You probably will need a windoexXP machine to debut this. |
18:08:42 | FromDiscord | <treeform> (edit) "windoexXP" => "Windows XP" |
18:08:53 | FromDiscord | <Elegantbeef> @majortrips1763 nope you can just do `while (let x = someVal; x.somField):` |
18:09:08 | FromDiscord | <treeform> (edit) "debut" => "debug" |
18:10:59 | Amun-Ra | use xp-level winapi functions and you'll be fine |
18:12:08 | FromDiscord | <arm_3_d> Something like WinHttp or WinInet? |
18:12:46 | FromDiscord | <arm_3_d> Yeah, ton of extra code. Especially when everything works in main thread |
18:13:11 | FromDiscord | <arm_3_d> But I need just a background heartbeat. |
18:13:57 | FromDiscord | <treeform> you are mixing threads and async, you could have a timer with just async |
18:14:34 | FromDiscord | <treeform> you can start a new async "thread" with "asyncCheck" and use "await sleepAsync" |
18:14:40 | FromDiscord | <demotomohiro> I wander if connecting windowsXP machine to the internet is safe. |
18:14:45 | FromDiscord | <treeform> (edit) ""asyncCheck"" => "`asyncCheck`" | ""await sleepAsync"" => "`await sleepAsync`" |
18:15:09 | FromDiscord | <arm_3_d> In reply to @treeform "you are mixing threads": Yes this could be an option, but I’m writing a library and users might pause main thread at any time |
18:15:57 | FromDiscord | <arm_3_d> In reply to @demotomohiro "I wander if connecting": I tired to say it to customers. Some people just don’t care 🙂 |
18:16:05 | FromDiscord | <treeform> Too many requriments: asycn, threads, winxp, userd by other people... this will be hard 🙂 |
18:16:22 | FromDiscord | <treeform> (edit) "userd" => "lib used" |
18:16:29 | FromDiscord | <arm_3_d> In reply to @treeform "Too many requriments: asycn,": Thanks for giving me hopes 🙂 |
18:16:57 | FromDiscord | <treeform> I might make sense to write one version for supported OS |
18:17:01 | FromDiscord | <treeform> and one version for XP only |
18:17:15 | FromDiscord | <treeform> XP only uses only win32 apis that exist on winXP |
18:17:17 | FromDiscord | <arm_3_d> Its almost done, only heartbeats are missing |
18:17:38 | FromDiscord | <arm_3_d> In reply to @treeform "XP only uses only": Thanks, will consider that. |
18:18:01 | FromDiscord | <treeform> what about 16 bit windows apps for win95? |
18:18:38 | FromDiscord | <arm_3_d> Thankfully that company didn’t exit at that time |
18:19:22 | FromDiscord | <arm_3_d> (edit) "exit" => "exist" |
18:21:53 | FromDiscord | <arm_3_d> The funny part is we already have a working lib for old stuff in java 8. But they complain about performance on their potato PCs. Big enterprise |
18:43:29 | * | beholders_eye joined #nim |
18:51:56 | * | dvbst quit (Remote host closed the connection) |
18:54:14 | * | coldfeet joined #nim |
19:01:21 | * | cnx quit (Ping timeout: 272 seconds) |
19:06:05 | * | cnx joined #nim |
19:23:55 | * | ntat quit (Quit: Leaving) |
19:26:10 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
19:29:42 | * | Lord_Nightmare joined #nim |
20:07:39 | FromDiscord | <majortrips1763> I think I am failing to use scanf() correctly |
20:15:28 | FromDiscord | <majortrips1763> is there any re or nre module usable in NimScript? |
20:16:42 | * | xet7 quit (Ping timeout: 272 seconds) |
20:16:53 | * | beholders_eye quit (Ping timeout: 248 seconds) |
20:17:11 | FromDiscord | <Nlits (Ping on reply)> I'm getting typemismatch when attempting to call a method defined in a parent type from a method bound to the child type. The error says specifically that SpaceComponent:ObjectType != InlineComponent even though SpaceComponent inherits from InlineComponent |
20:17:15 | FromDiscord | <Nlits (Ping on reply)> Any ideas? |
20:21:00 | FromDiscord | <demotomohiro> In reply to @majortrips1763 "is there any re": https://nim-lang.org/docs/pegs.html↵This probably work in NimScript. |
20:22:20 | FromDiscord | <majortrips1763> In reply to @demotomohiro "https://nim-lang.org/docs/pegs.html This probably w": Hmm, I am familiar with using PEG and LEG as part of lexical work, not really thought to use anything like it for a simple `if <pattern>` condition.. |
20:23:46 | FromDiscord | <Elegantbeef> the nim-regex package works at CTE |
20:24:09 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "the nim-regex package works": Yah, I was sort of hoping to not have to install any new packages 😦 |
20:24:18 | FromDiscord | <Elegantbeef> So then don't use regex |
20:24:26 | FromDiscord | <Elegantbeef> Like a sane person |
20:25:17 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "So then don't use": Alas, it is the simplest solution to the problem at hand .. I would honestly be fine with even simple globbing .. but it doesn't look like that is available either. |
20:27:35 | FromDiscord | <Elegantbeef> `std/strscans` is another pattern matching |
20:28:58 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "`std/strscans` is another pattern": Yah, I attempted to use that, only it allows for some pretty vague imputs, and it seems that I would have to write custom comparison procs to do something as simple as `match(input, re"prefix[3-7]sfx")` |
20:31:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ktBDvJFv |
20:32:45 | FromDiscord | <Elegantbeef> Or more accurately `$c` and `'3'..'7'` |
20:32:53 | FromDiscord | <majortrips1763> Yah, now do that for every permutation of the `x86` target namepace, and keep it to 1 readable line. Be certain to include all `i[3-7]86` variants, `i80[3-7]86` variants, `x86`, `i86pc`, and `x86_32`.↵↵Then do the same for all other architectures w/ similar patterns. |
20:33:42 | FromDiscord | <majortrips1763> For the problem space, regexp's work really well, and don't result in a metric ton of lines of code and a requirement to create variables outside of the scope of the conditional. |
20:33:55 | FromDiscord | <Elegantbeef> Well then time to pull a package |
20:35:58 | FromDiscord | <majortrips1763> `scanf()` supports the whole `${foo}` pattern, which let's me write my own matcher, but for the total scope I am almost better off just writing a simple `glob` handler for ``, `?`, `+`, and `[<range>]` |
20:36:27 | FromDiscord | <Elegantbeef> Well you also can use `scanTuple` then just do `input.scanTuple(...)[0]` |
20:38:21 | FromDiscord | <majortrips1763> I have also found that `scanf()` isn't always matching patterns when it really should.. I am actualy assuming it is overly greedy on the `$i` |
20:38:48 | FromDiscord | <Elegantbeef> `$i` grabs an integer not just a single character |
20:38:53 | FromDiscord | <Elegantbeef> `$c` is for a single character |
20:40:31 | FromDiscord | <fabric.input_output> better use parseutils for finer grained control |
20:42:13 | FromDiscord | <Elegantbeef> Eh strscans is very pluggable |
20:43:12 | FromDiscord | <einjonas> does nim have Mutex or RWLocks? |
20:52:15 | * | coldfeet quit (Remote host closed the connection) |
20:59:36 | FromDiscord | <majortrips1763> Soo .. should I be concerned about a huge tack of warnings regarding `[GcMem]` ? |
20:59:42 | FromDiscord | <majortrips1763> (edit) "tack" => "stack" |
21:00:25 | FromDiscord | <Elegantbeef> Doesn't that mean you're using `--mm:non`? |
21:01:37 | FromDiscord | <majortrips1763> Likely. Sort of trying to figure out what I can/should do about removing the warnings. |
21:02:00 | FromDiscord | <Elegantbeef> You can disable the warning, but you should stop using `--mm:none` really |
21:02:10 | FromDiscord | <Elegantbeef> Just use `arc` and call it a day |
21:02:19 | FromDiscord | <majortrips1763> Well, I am sort of stuck using --mm:none, so that isn't really an option. |
21:02:31 | FromDiscord | <Elegantbeef> How are you stuck using `--mm:none`? |
21:02:46 | FromDiscord | <majortrips1763> because I haven't finished writing the memory manager for the kernel |
21:03:13 | FromDiscord | <Elegantbeef> `--mm:arc -d:useMalloc` and make `malloc` a panic until you have |
21:05:13 | FromDiscord | <majortrips1763> I have to move the initial stack pointer as part of the bootstrapping process. The initial stack pointer is effectively invalid and dangerous to use and mapped into high memory. I need to remap everything and setup the heap and the stack manually. |
21:05:46 | FromDiscord | <majortrips1763> Most of that is done in ASM |
21:05:54 | FromDiscord | <Elegantbeef> `--mm:arc` and `--mm:none` should be identical aside from the hooks being called |
21:06:17 | FromDiscord | <Elegantbeef> So if `none` works `arc` should work with `--d:useMalloc` |
21:08:37 | FromDiscord | <majortrips1763> So, the current that is throwing the warnings is in a scope before `malloc()` is available. |
21:08:42 | FromDiscord | <majortrips1763> (edit) "So, the current ... that" added "code" |
21:09:49 | FromDiscord | <majortrips1763> I feel like it is likely a bad idea to allow Nim to try to call `malloc()` before it is available |
21:09:59 | FromDiscord | <Elegantbeef> While `--mm:none` exists it's not possible to free anything heap allocated stuff. So it's best to ignore it's existence. If you truly need it and want to reduce warnings either `--warningAsError:GcMem: on` or `--warning:GcMem:off` |
21:10:00 | FromDiscord | <majortrips1763> I dunno, I could be wrong .. but that seems like generally a bad idea. |
21:11:55 | FromDiscord | <majortrips1763> I was more curious if I should be attempting to rewrite the code to avoid needing `malloc()` at all .. it would generally be my approach in ASM and C. |
21:13:17 | FromDiscord | <Elegantbeef> Probably best to avoid any heap memory until you can allocate heap memory 😄 |
21:13:19 | FromDiscord | <majortrips1763> Once memory is initialized the entire startup segment will be freed and added to the memory pool.. it is just sort of weird to have to try to write code to avoid unintended side effects. |
21:13:35 | FromDiscord | <majortrips1763> Yah, I am not even allocating heap memory |
21:13:41 | FromDiscord | <Elegantbeef> Just annotate all your procedures `{.raises: [].}` to prevent exceptions |
21:14:18 | FromDiscord | <Elegantbeef> You still can attempt to allocate using `string` `seq` `ref` and `closure` but you should avoid those until you can actually manage them |
21:14:46 | FromDiscord | <majortrips1763> Hmm .. I am not using any of those either.. |
21:15:07 | FromDiscord | <Elegantbeef> What is the full warning for GCMem? |
21:16:35 | FromDiscord | <majortrips1763> it is throwing warnings about code off in `nim-2.0.8/lib/system/except.nim` |
21:16:53 | FromDiscord | <Elegantbeef> Do you use any procedures that can raise? |
21:17:00 | FromDiscord | <Elegantbeef> Do you raise any exceptions? |
21:17:31 | FromDiscord | <majortrips1763> none that I have defined .. it doens't mean I didn't use something silly that could do it ;P |
21:18:26 | FromDiscord | <demotomohiro> If you write `x + y`, Nim do overflow check and can raise exception. |
21:18:30 | FromDiscord | <Elegantbeef> Well certainly annotate your procedures that should not allocate with `{.raises: [].}` this will stop them from using exceptions |
21:19:21 | FromDiscord | <Elegantbeef> I don't think defects are tracked that way |
21:22:32 | FromDiscord | <Elegantbeef> Though actually it seems exceptions aren't tracked that way.... |
21:23:38 | FromDiscord | <Elegantbeef> Ok I take it back I did not call the procedure |
21:37:14 | FromDiscord | <einjonas> is there a plan for implementing tail rec?↵it could be easy done via transpile the function to a while loop on the c site |
21:37:25 | FromDiscord | <einjonas> tail recs are just synatly more pleasing sometimes |
21:37:35 | FromDiscord | <einjonas> (edit) "synatly" => "syntactly" |
21:37:51 | FromDiscord | <einjonas> (edit) "syntactly" => "syndactyly" |
21:40:23 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "Well certainly annotate your": This is incompatible w/ `{.exportc: ... .}` ? |
21:40:45 | FromDiscord | <Elegantbeef> Nope |
21:41:41 | FromDiscord | <majortrips1763> Adding `{.raises: [].]` to the proc declaration triggers an indentation error |
21:42:14 | FromDiscord | <majortrips1763> (edit) "[].]`" => "[].}`" |
21:43:03 | FromDiscord | <majortrips1763> Oh, nm .. I figured that out |
21:44:57 | FromDiscord | <majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=wLHQUvOy |
21:45:23 | FromDiscord | <Elegantbeef> Nope `const`s are Nim side and have to be assigned Nim values |
21:45:32 | FromDiscord | <Elegantbeef> You can do `let` |
21:46:28 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "You can do `let`": That helps some |
21:48:21 | FromDiscord | <demotomohiro> In reply to @einjonas "is there a plan": Modern C compiler optimizer convert tail recursion to loop. |
21:49:09 | FromDiscord | <einjonas> yeah but u still need to remove stacktraces |
21:49:22 | FromDiscord | <einjonas> from the build |
21:49:26 | FromDiscord | <einjonas> via a flag |
21:49:49 | FromDiscord | <einjonas> i tested it in compiler explorer |
21:50:15 | FromDiscord | <Elegantbeef> You can remove stack traces from a single proc |
21:50:22 | FromDiscord | <einjonas> u can? |
21:50:31 | FromDiscord | <einjonas> checks too? |
21:50:50 | FromDiscord | <Elegantbeef> Yes |
21:51:01 | FromDiscord | <einjonas> can u show me a example |
21:51:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=vhwAMlWK |
21:51:35 | FromDiscord | <einjonas> what are push and pop standing for |
21:52:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas |
21:52:58 | FromDiscord | <einjonas> can i overide it for multiple functions with push and pop? |
21:53:19 | FromDiscord | <Elegantbeef> Everything inbetween `push` and `pop` |
21:53:27 | FromDiscord | <einjonas> oh nice |
21:53:30 | FromDiscord | <einjonas> thanks |
21:55:39 | FromDiscord | <majortrips1763> Is there some way to do the Nim equivalent of `{.passC: "-I<path>" .}` in NimScript for setting up a global include path? |
21:58:54 | FromDiscord | <demotomohiro> In reply to @majortrips1763 "Is there some way": You can add `passC` in .nims file like this: https://github.com/demotomohiro/MinimumNimPico/blob/main/src/uartReg.nims#L36 |
22:06:54 | FromDiscord | <majortrips1763> Hmm, wondering if I should actually be re-defining these constants in Nim instead of trying to pull them from the upstream C headers.↵↵Is there any benefit to using `const` over let? Will `var` and `let` possibly be part of my GC problems? |
22:07:23 | FromDiscord | <Elegantbeef> `const` is a Nim constant and can be folded or stored in static memory |
22:07:43 | FromDiscord | <Elegantbeef> `let` and `var` are runtime values that should be on the stack though with `include` they do not need be |
22:08:16 | FromDiscord | <majortrips1763> In reply to @Elegantbeef "`let` and `var` are": Nearly everything I am doing right now is being handled via `include` and `when` |
22:09:26 | FromDiscord | <leorize> redefining constants allow you to use them in Nim CT contexts |
22:10:25 | * | lucasta joined #nim |
22:10:46 | FromDiscord | <leorize> ie. the compiler can fold your `X or Y or Z` into one value at Nim level instead of deferring it to the C compiler |
22:10:54 | FromDiscord | <leorize> and obviously, once you redefined everything in Nim terms, you don't need the headers anymore |
22:10:56 | FromDiscord | <majortrips1763> A huge portion of this segment space is going to get tossed from memory once it is done being used. It is all bootstrap'ing code that glues together multiboot and the kernel entrypoint. In fact .. all of the `proc`'s are `noreturn`. |
22:12:22 | FromDiscord | <double_spiral> Is there a difference between noreturn and : void |
22:12:34 | FromDiscord | <leorize> yes |
22:12:49 | FromDiscord | <double_spiral> What is it |
22:12:59 | FromDiscord | <leorize> noreturn means you enter the proc and never gets out (ie. `quit()`) |
22:13:13 | FromDiscord | <leorize> `void` just meant that the proc does not have a return value |
22:13:32 | FromDiscord | <double_spiral> In reply to @leorize "noreturn means you enter": Oh that makes sense |
22:15:36 | FromDiscord | <majortrips1763> In reply to @leorize "and obviously, once you": Also, the code will be less noisy... |
22:18:04 | FromDiscord | <majortrips1763> Is it possible to carve out a struct/object directly into a specific segment space? Basically force a struct into the first 2 pages of the address space, aligned? |
22:19:29 | FromDiscord | <leorize> you'll need some C magic to help there |
22:19:55 | FromDiscord | <leorize> there's no native functionality for this, so C extension + linker script is still what you need |
22:19:57 | FromDiscord | <majortrips1763> the C/ASM magic is fine, assuming I don't have to resort to a custom linker script and a .S file 😦 |
22:20:17 | FromDiscord | <leorize> there's no avoiding the linker script, unfortunately |
22:20:33 | FromDiscord | <double_spiral> A tragedy |
22:20:52 | FromDiscord | <leorize> you can mark a struct with a section name in GNU C, so you won't have to write .S at least |
22:23:07 | FromDiscord | <majortrips1763> I have been drawing quite a bit of inspiration from: https://github.com/demotomohiro/MinimumNimPico/blob/main/src/startup.nim |
22:27:26 | FromDiscord | <leorize> I'd say to just write a `.c` and link it using `{.compile.}` directive |
22:27:27 | FromDiscord | <leorize> a lot easier than trying to embed it in a `.nim` |
22:29:01 | FromDiscord | <majortrips1763> In reply to @leorize "a lot easier than": But that removes most of the fun. |
22:42:02 | FromDiscord | <majortrips1763> Is there any sort of idiomatic mattern for exposing constants from modules in Nim? I.e. all caps? |
22:42:09 | FromDiscord | <random.visitor> https://play.nim-lang.org/#pasty=vGiuaRMg - anyone have any insights into the "has nil child at index 1", caused by line 67? I've tried looking at the compiler/semexprs.nim without much luck, comparing it to dumpAstGen: output for what I want. various other approaches without much luck either. I guess I should look at if I can do some form of quote do: unpackVarargs(self.inn.\`somewaytogetfuncname\`, args), which I'll do now |
22:42:49 | FromDiscord | <leorize> PascalCase\`↵(@majortrips1763) |
22:43:11 | FromDiscord | <majortrips1763> (edit) "mattern" => "pattern" |
22:45:26 | FromDiscord | <majortrips1763> Do unused _and_ exported constants from a used module get optimized out at compile time? I.e. if I `import foo`, do the unused portions of `foo` get carried around for any reason? |
22:46:37 | FromDiscord | <leorize> yea, unused code is eliminated at compile time |
22:47:33 | FromDiscord | <leorize> you're copying the function type parameters verbatim, which caused the problem↵(@random.visitor) |
22:48:59 | FromDiscord | <random.visitor> on 59 in another test, I was doing (line 59) arr.add(ident def[i][0].strVal) which wasn't working when I tried it - or do you mean something else? |
22:49:16 | FromDiscord | <leorize> if you use `treeRepr`, you will notice that your proc has `Sym` in it, due to being copied from `getTypeImpl` output |
22:49:47 | FromDiscord | <leorize> this sym does not point to your proc parameter but the parameter within the type, which is why the compiler freaked out |
22:54:10 | FromDiscord | <random.visitor> sent a code paste, see https://play.nim-lang.org/#pasty=duJMODvZ |
22:54:14 | FromDiscord | <leorize> here's an example of desym-ing the result\: https://play.nim-lang.org/#pasty=HSqYoRdt |
22:55:12 | FromDiscord | <leorize> it goes without saying that you shouldn't desym everything, just the variable symbols |
22:55:23 | FromDiscord | <leorize> the type symbols should be kept |
22:55:40 | FromDiscord | <leorize> the quick fix I wrote desym everything |
22:55:55 | FromDiscord | <Elegantbeef> Typed AST has killed many a souls |
22:59:33 | FromDiscord | <random.visitor> thank you - that's much better than any approach I would have came up with |
23:03:02 | FromDiscord | <leorize> you're welcome, typed AST is quite the beast to handle |
23:21:31 | FromDiscord | <majortrips1763> Are there any optimization guides floating around? |