<< 06-10-2024 >>

00:00:11*albe quit (Quit: The Lounge - https://thelounge.chat)
00:00:53FromDiscord<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:12FromDiscord<aurelian5014> oh, `posix`
00:04:22*albe joined #nim
00:35:53FromDiscord<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:23FromDiscord<kiloneie> ? https://media.discordapp.net/attachments/371759389889003532/1292285038771044373/image.png?ex=67032dba&is=6701dc3a&hm=814f4840df210e966e9af1f993968c2bee7e5f643ed16d523514567bcb228e82&
00:53:05FromDiscord<Elegantbeef> Use std/strformat?
02:17:56*xet7 joined #nim
02:44:08FromDiscord<majortrips1763> Oh snap.. I didn't know that nim supported `--cc:env`, useful
03:08:52FromDiscord<Robyn [She/Her]> In reply to @majortrips1763 "Oh snap.. I didn't": huh?
03:08:55FromDiscord<Robyn [She/Her]> what does that do?
03:14:11FromDiscord<user2m> In reply to @chronos.vitaqua "huh?": https://nim-lang.org/docs/nimc.html#compiler-selection
03:16:11FromDiscord<majortrips1763> Are there any tutorials covering `config.nims` ?
03:18:21FromDiscord<Robyn [She/Her]> In reply to @user2m "https://nim-lang.org/docs/nimc.html#compiler-select": oooh damn
03:20:14FromDiscord<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:35FromDiscord<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:58FromDiscord<Robyn [She/Her]> In reply to @majortrips1763 "Been reading this one,": well, what are you trying to achieve?
03:23:25FromDiscord<majortrips1763> In reply to @chronos.vitaqua "well, what are you": Mostly understanding 🙂
03:24:37FromDiscord<Robyn [She/Her]> i mean, not sure what you're not understanding? can you be more specific?
03:24:59FromDiscord<11na/energy> Er, like implementing the values?
03:25:50FromDiscord<majortrips1763> I am trying to piece my way through writing a config.nims for targetting a multi-arch, free-standing binary.
03:26:50FromDiscord<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:51FromDiscord<majortrips1763> I am also trying to figure out how to magically alter the nim search path from the config.nims
03:27:25FromDiscord<Robyn [She/Her]> In reply to @majortrips1763 "I am also trying": `--path:"..."` or `switch("path", "...")`
03:27:41FromDiscord<Robyn [She/Her]> though you can't remove search paths i don't believe
03:27:52FromDiscord<Robyn [She/Her]> maybe the nimble path can be removed but that's all
03:28:15FromDiscord<Robyn [She/Her]> anyway, most things from the CLI should work like it would normally in the .nims file
03:30:23FromDiscord<majortrips1763> Hmm .. I think I misunderstood something I read. Are there ways to add switches to tasks?
03:33:28FromDiscord<majortrips1763> Oh .. just located this: https://github.com/nim-lang/Nim/wiki/Using-nimscript-for-configuration
03:55:12FromDiscord<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:19FromDiscord<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:19FromDiscord<majortrips1763> Okay, so I can set custom defines, but I am not finding an intuitive way to inspect them.
04:56:58FromDiscord<majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=ucVRIXhs
04:58:42FromDiscord<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:21FromDiscord<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:08FromDiscord<Elegantbeef> Both are correct
05:33:12FromDiscord<Elegantbeef> You just do `defined`
05:33:43FromDiscord<Elegantbeef> If you want the value you do `const myVal {.define.} = defaultValueHere`
06:28:51*ntat joined #nim
06:46:04FromDiscord<.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:33FromDiscord<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:32FromDiscord<spotlightkid> @.bobbbob\: you need to re-install choosenim from https://github.com/nim-lang/choosenim
09:17:16FromDiscord<spotlightkid> you probably have the out-dated version from https://github.com/dom96/choosenim
09:17:41FromDiscord<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:09FromDiscord<einjonas> Hey, has nim smth like a string builder in the stdlib
11:57:20*ryuukk quit (Remote host closed the connection)
11:57:32FromDiscord<demotomohiro> There are `std/strformat` and `std/strutils` module in stdlib.
11:58:08FromDiscord<einjonas> strings aren't immutable in nim right?
11:59:38*ryuukk joined #nim
11:59:54FromDiscord<demotomohiro> `const`, `let` and parameter values are immutable but `var` variables are mutable.
12:00:31FromDiscord<fabric.input_output> strings can be mutated
12:00:48FromDiscord<einjonas> oh nice
12:01:24FromDiscord<einjonas> i meant it like in odin where u make allways a clone
12:01:52FromDiscord<einjonas> because it easier to handle string as a pointer
12:02:05FromDiscord<einjonas> do avoid allocations
12:02:32FromDiscord<einjonas> they have a string builder
12:02:48FromDiscord<einjonas> runes(s) can convert int to char?
12:04:54*xet7 quit (Remote host closed the connection)
12:05:06FromDiscord<einjonas> what is pure and std ?
12:05:19FromDiscord<einjonas> sry i am a beginner in nim
12:05:33FromDiscord<demotomohiro> A rune in unicode cannot always convert to char as char in Nim is always 1 byte.
12:05:33FromDiscord<einjonas> wanted to explore it
12:06:02FromDiscord<einjonas> so how can i make a char?
12:06:22FromDiscord<einjonas> wait what
12:06:37FromDiscord<demotomohiro> Files in https://github.com/nim-lang/Nim/tree/devel/lib/pure are part of stdlib.
12:06:49FromDiscord<einjonas> (edit) "what" => "what's the difference bettween rune and char in odin"
12:07:10FromDiscord<einjonas> i know them from other languages
12:07:45FromDiscord<einjonas> but they usually weren't really divided
12:09:07FromDiscord<demotomohiro> You can make `char` type variable like `var c = 'a'` or `var c = 97.char`.
12:09:31FromDiscord<einjonas> In reply to @demotomohiro "A rune in unicode": true unicode can be 4 bytes max i think
12:09:32FromDiscord<majortrips1763> Hmm.. defining a `help` task doesn't seem to result in my task being used for `help`
12:10:30FromDiscord<einjonas> when i iter over string to i get chars in nim or runes like in golang?
12:11:40FromDiscord<demotomohiro> You get chars.
12:14:08FromDiscord<einjonas> oh sry
12:16:09FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=KJcVIjBL
12:17:31*xet7 joined #nim
12:52:35FromDiscord<majortrips1763> Are there any declarations for defining linker sections and such?
13:00:49FromDiscord<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:32FromDiscord<majortrips1763> In reply to @demotomohiro "Only way I know": Nice! This answers a whole ton of questions I had 🙂
13:11:17FromDiscord<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:42FromDiscord<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:04FromDiscord<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:16FromDiscord<majortrips1763> (edit) "`.multiboot2`" => "`.multiboot`"
13:18:31FromDiscord<majortrips1763> (edit) "imple" => "simple"
13:18:53FromDiscord<majortrips1763> I have set it up before using ASM and C, but trying to do it all in pure Nim
13:19:14FromDiscord<majortrips1763> (edit) "all" => "this time"
13:21:08FromDiscord<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:52FromDiscord<majortrips1763> I am actually hoping to write support for multiboot1 and multiboot2, mostly as a practice challenge.
13:27:20FromDiscord<majortrips1763> Well, "pure nim" as in, no .C or .S files.
13:28:52FromDiscord<demotomohiro> That looks interesting!
13:34:32*dvbst joined #nim
13:36:53FromDiscord<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:46FromDiscord<majortrips1763> Are `--define`'s global to all source?
14:39:21FromDiscord<odexine> Yes
14:43:44FromDiscord<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:19FromDiscord<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:04Amun-Raeither way works
16:09:43FromDiscord<majortrips1763> Hmm .. how to get the sizeof() of a C struct defined in a header file?
16:12:18*xet7_ joined #nim
16:13:27FromDiscord<piuvas> sent a code paste, see https://play.nim-lang.org/#pasty=svpHwQZg
16:14:46*xet7 quit (Ping timeout: 272 seconds)
16:20:44FromDiscord<einjonas> is there a way to use lib like this
16:21:04FromDiscord<einjonas> sent a code paste, see https://play.nim-lang.org/#pasty=lZdGwOUA
16:21:35FromDiscord<einjonas> using the libary/file name as identifier
16:22:08FromDiscord<einjonas> nim doesn't have modules/packages like go right?
16:22:24FromDiscord<einjonas> every file is in it's own space
16:24:50Amun-Rayes
16:25:15Amun-Rayou can use explicit module names
16:25:31Amun-Raand you sometimes have to
16:27:19FromDiscord<odexine> In reply to @einjonas "nim doesn't have modules/packages": Every file is its own module
16:27:54FromDiscord<einjonas> thanks
16:28:06FromDiscord<einjonas> mean't the declaration with package
16:28:12FromDiscord<einjonas> or namespace in cpp
16:28:19FromDiscord<odexine> Nothing like that in Nim
16:28:39FromDiscord<odexine> You can simulate it I guess but otherwise no
16:28:41Amun-Rathere are namespaces, although there's also single implicit one
16:28:59FromDiscord<odexine> Well yes but not like on go or X++
16:29:03FromDiscord<odexine> C++
16:29:25Amun-Ranot 1:1
16:35:54FromDiscord<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:57FromDiscord<einjonas> another question what does do in proc x()
16:36:14FromDiscord<einjonas> do i have to use it to export it?
16:36:18FromDiscord<hugop707> Yep
16:36:31FromDiscord<einjonas> so it's no pointer
16:36:32Amun-Racan't see the subject of the question on IRC
16:36:43Amun-Raah, so what I can't see is a star
16:36:57Amun-Raeinjonas: ptr is Nim's equivalent for pointer
16:37:10FromDiscord<hugop707> @einjonas , no, the asterix is just for exporting functions or types
16:37:12Amun-Rathis is what we see on IRC: "einjonas | another question what does do in proc x()"
16:37:28Amun-Rastar makes a function/variable/whatever public
16:37:30FromDiscord<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:14FromDiscord<einjonas> i am not used to much to other syntaxes as c
16:38:22FromDiscord<odexine> In reply to @majortrips1763 "Is there any crafty": Not that I can think of, no. Probably possible in regular Nim though
16:38:28FromDiscord<einjonas> is nim kinda modern pascal?
16:38:35Amun-Rano
16:38:43FromDiscord<odexine> Not really?
16:38:55FromDiscord<odexine> Kinda, some people would describe it that way
16:39:18Amun-Rapeople often more describe Nim as compiled-python
16:39:31FromDiscord<einjonas> is it?
16:39:41FromDiscord<einjonas> i mean at first glance yeah
16:39:56Amun-Rathat's because of similar syntax
16:39:59Amun-Ra(to a point)
16:40:00FromDiscord<einjonas> i have not sean much but
16:40:24FromDiscord<einjonas> it uses more syntax from haskell
16:40:28Amun-RaNim goes one step further and tabs are errors :>
16:40:38FromDiscord<einjonas> function = ↵ do stuff
16:40:39*Amun-Ra does not speak haskell
16:41:08FromDiscord<einjonas> the function syntax is kinda more from scala/haskell
16:41:33FromDiscord<einjonas> and that u don't need to use return
16:41:39Amun-RaUFCS is pretty unique…
16:41:50Amun-RaD has that, I don't recall any other language
16:41:55Amun-Rahttps://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax
16:43:06FromDiscord<einjonas> yeah besides the indendation i think nim differs much from python
16:43:58FromDiscord<einjonas> In reply to @Amun-Ra "D has that, I": that's a cool feature
16:44:01Amun-Rathose are academic discussions after all
16:44:09FromDiscord<einjonas> yeah
16:44:12Amun-Raeinjonas: yes, I wish C had that
16:44:23FromDiscord<einjonas> or Rust
16:44:34Amun-RaI'm alergic to Rust ;)
16:45:02Amun-Rabut that's a topic for #nim-offtopic ;)
16:45:03FromDiscord<einjonas> it quite syntax heavy but i think the the same goes for cpp
16:45:43Amun-RaUFCS was proposed to be included into C++ twice, IIRC those attempts failed
16:46:30FromDiscord<einjonas> i like Rust
16:46:40FromDiscord<einjonas> it far better as Java
16:46:47FromDiscord<einjonas> and has great Docs
16:47:02FromDiscord<einjonas> but i can see why people don't like it
16:47:11Amun-RaI wasted 1x monts on rust, I switched to nim
16:47:37FromDiscord<einjonas> what have u done with Rust
16:47:41FromDiscord<majortrips1763> is it possible to do something like `import foo/$var` ?
16:47:42FromDiscord<einjonas> Gamedev?
16:47:55FromDiscord<einjonas> we can switch to offtopic
16:48:05Amun-Ramajortrips1763: thankfully not
16:49:05Amun-Raeinjonas: just playing with the language
16:49:17FromDiscord<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:34Amun-Raplaying the language* (we add "with" in my native language, that's why it slipped)
16:49:46Amun-Ramajortrips1763: use defines
16:50:11Amun-Raare you coming from perl by any chance? ;)
16:50:38FromDiscord<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:21Amun-Ramajortrips1763: that sucks, I support hmm… 5-6 targets, tops
16:51:44Amun-Rastill I think defines are better than these eval-like stuff
16:52:40FromDiscord<odexine> Can’t you query compile settings like targets?
16:53:04FromDiscord<odexine> That way you can just import them all no?
16:53:19FromDiscord<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:48FromDiscord<majortrips1763> sent a long message, see https://pasty.ee/KVfyRmOC
16:57:50FromDiscord<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:17FromDiscord<arm_3_d> sent a code paste, see https://play.nim-lang.org/#pasty=sNDTbAMB
17:25:40FromDiscord<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:31FromDiscord<majortrips1763> Is there not a simple pattern matching proc available in NimScript to be used as part of `while`?
18:07:49FromDiscord<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:27FromDiscord<hugop707> Arent there bindings already?
18:08:36FromDiscord<treeform> `I'm compiling binary using mingw-w64 from linux.` You probably will need a windoexXP machine to debut this.
18:08:42FromDiscord<treeform> (edit) "windoexXP" => "Windows XP"
18:08:53FromDiscord<Elegantbeef> @majortrips1763 nope you can just do `while (let x = someVal; x.somField):`
18:09:08FromDiscord<treeform> (edit) "debut" => "debug"
18:10:59Amun-Rause xp-level winapi functions and you'll be fine
18:12:08FromDiscord<arm_3_d> Something like WinHttp or WinInet?
18:12:46FromDiscord<arm_3_d> Yeah, ton of extra code. Especially when everything works in main thread
18:13:11FromDiscord<arm_3_d> But I need just a background heartbeat.
18:13:57FromDiscord<treeform> you are mixing threads and async, you could have a timer with just async
18:14:34FromDiscord<treeform> you can start a new async "thread" with "asyncCheck" and use "await sleepAsync"
18:14:40FromDiscord<demotomohiro> I wander if connecting windowsXP machine to the internet is safe.
18:14:45FromDiscord<treeform> (edit) ""asyncCheck"" => "`asyncCheck`" | ""await sleepAsync"" => "`await sleepAsync`"
18:15:09FromDiscord<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:57FromDiscord<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:05FromDiscord<treeform> Too many requriments: asycn, threads, winxp, userd by other people... this will be hard 🙂
18:16:22FromDiscord<treeform> (edit) "userd" => "lib used"
18:16:29FromDiscord<arm_3_d> In reply to @treeform "Too many requriments: asycn,": Thanks for giving me hopes 🙂
18:16:57FromDiscord<treeform> I might make sense to write one version for supported OS
18:17:01FromDiscord<treeform> and one version for XP only
18:17:15FromDiscord<treeform> XP only uses only win32 apis that exist on winXP
18:17:17FromDiscord<arm_3_d> Its almost done, only heartbeats are missing
18:17:38FromDiscord<arm_3_d> In reply to @treeform "XP only uses only": Thanks, will consider that.
18:18:01FromDiscord<treeform> what about 16 bit windows apps for win95?
18:18:38FromDiscord<arm_3_d> Thankfully that company didn’t exit at that time
18:19:22FromDiscord<arm_3_d> (edit) "exit" => "exist"
18:21:53FromDiscord<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:39FromDiscord<majortrips1763> I think I am failing to use scanf() correctly
20:15:28FromDiscord<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:11FromDiscord<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:15FromDiscord<Nlits (Ping on reply)> Any ideas?
20:21:00FromDiscord<demotomohiro> In reply to @majortrips1763 "is there any re": https://nim-lang.org/docs/pegs.html↵This probably work in NimScript.
20:22:20FromDiscord<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:46FromDiscord<Elegantbeef> the nim-regex package works at CTE
20:24:09FromDiscord<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:18FromDiscord<Elegantbeef> So then don't use regex
20:24:26FromDiscord<Elegantbeef> Like a sane person
20:25:17FromDiscord<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:35FromDiscord<Elegantbeef> `std/strscans` is another pattern matching
20:28:58FromDiscord<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:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ktBDvJFv
20:32:45FromDiscord<Elegantbeef> Or more accurately `$c` and `'3'..'7'`
20:32:53FromDiscord<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:42FromDiscord<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:55FromDiscord<Elegantbeef> Well then time to pull a package
20:35:58FromDiscord<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:27FromDiscord<Elegantbeef> Well you also can use `scanTuple` then just do `input.scanTuple(...)[0]`
20:38:21FromDiscord<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:48FromDiscord<Elegantbeef> `$i` grabs an integer not just a single character
20:38:53FromDiscord<Elegantbeef> `$c` is for a single character
20:40:31FromDiscord<fabric.input_output> better use parseutils for finer grained control
20:42:13FromDiscord<Elegantbeef> Eh strscans is very pluggable
20:43:12FromDiscord<einjonas> does nim have Mutex or RWLocks?
20:52:15*coldfeet quit (Remote host closed the connection)
20:59:36FromDiscord<majortrips1763> Soo .. should I be concerned about a huge tack of warnings regarding `[GcMem]` ?
20:59:42FromDiscord<majortrips1763> (edit) "tack" => "stack"
21:00:25FromDiscord<Elegantbeef> Doesn't that mean you're using `--mm:non`?
21:01:37FromDiscord<majortrips1763> Likely. Sort of trying to figure out what I can/should do about removing the warnings.
21:02:00FromDiscord<Elegantbeef> You can disable the warning, but you should stop using `--mm:none` really
21:02:10FromDiscord<Elegantbeef> Just use `arc` and call it a day
21:02:19FromDiscord<majortrips1763> Well, I am sort of stuck using --mm:none, so that isn't really an option.
21:02:31FromDiscord<Elegantbeef> How are you stuck using `--mm:none`?
21:02:46FromDiscord<majortrips1763> because I haven't finished writing the memory manager for the kernel
21:03:13FromDiscord<Elegantbeef> `--mm:arc -d:useMalloc` and make `malloc` a panic until you have
21:05:13FromDiscord<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:46FromDiscord<majortrips1763> Most of that is done in ASM
21:05:54FromDiscord<Elegantbeef> `--mm:arc` and `--mm:none` should be identical aside from the hooks being called
21:06:17FromDiscord<Elegantbeef> So if `none` works `arc` should work with `--d:useMalloc`
21:08:37FromDiscord<majortrips1763> So, the current that is throwing the warnings is in a scope before `malloc()` is available.
21:08:42FromDiscord<majortrips1763> (edit) "So, the current ... that" added "code"
21:09:49FromDiscord<majortrips1763> I feel like it is likely a bad idea to allow Nim to try to call `malloc()` before it is available
21:09:59FromDiscord<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:00FromDiscord<majortrips1763> I dunno, I could be wrong .. but that seems like generally a bad idea.
21:11:55FromDiscord<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:17FromDiscord<Elegantbeef> Probably best to avoid any heap memory until you can allocate heap memory 😄
21:13:19FromDiscord<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:35FromDiscord<majortrips1763> Yah, I am not even allocating heap memory
21:13:41FromDiscord<Elegantbeef> Just annotate all your procedures `{.raises: [].}` to prevent exceptions
21:14:18FromDiscord<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:46FromDiscord<majortrips1763> Hmm .. I am not using any of those either..
21:15:07FromDiscord<Elegantbeef> What is the full warning for GCMem?
21:16:35FromDiscord<majortrips1763> it is throwing warnings about code off in `nim-2.0.8/lib/system/except.nim`
21:16:53FromDiscord<Elegantbeef> Do you use any procedures that can raise?
21:17:00FromDiscord<Elegantbeef> Do you raise any exceptions?
21:17:31FromDiscord<majortrips1763> none that I have defined .. it doens't mean I didn't use something silly that could do it ;P
21:18:26FromDiscord<demotomohiro> If you write `x + y`, Nim do overflow check and can raise exception.
21:18:30FromDiscord<Elegantbeef> Well certainly annotate your procedures that should not allocate with `{.raises: [].}` this will stop them from using exceptions
21:19:21FromDiscord<Elegantbeef> I don't think defects are tracked that way
21:22:32FromDiscord<Elegantbeef> Though actually it seems exceptions aren't tracked that way....
21:23:38FromDiscord<Elegantbeef> Ok I take it back I did not call the procedure
21:37:14FromDiscord<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:25FromDiscord<einjonas> tail recs are just synatly more pleasing sometimes
21:37:35FromDiscord<einjonas> (edit) "synatly" => "syntactly"
21:37:51FromDiscord<einjonas> (edit) "syntactly" => "syndactyly"
21:40:23FromDiscord<majortrips1763> In reply to @Elegantbeef "Well certainly annotate your": This is incompatible w/ `{.exportc: ... .}` ?
21:40:45FromDiscord<Elegantbeef> Nope
21:41:41FromDiscord<majortrips1763> Adding `{.raises: [].]` to the proc declaration triggers an indentation error
21:42:14FromDiscord<majortrips1763> (edit) "[].]`" => "[].}`"
21:43:03FromDiscord<majortrips1763> Oh, nm .. I figured that out
21:44:57FromDiscord<majortrips1763> sent a code paste, see https://play.nim-lang.org/#pasty=wLHQUvOy
21:45:23FromDiscord<Elegantbeef> Nope `const`s are Nim side and have to be assigned Nim values
21:45:32FromDiscord<Elegantbeef> You can do `let`
21:46:28FromDiscord<majortrips1763> In reply to @Elegantbeef "You can do `let`": That helps some
21:48:21FromDiscord<demotomohiro> In reply to @einjonas "is there a plan": Modern C compiler optimizer convert tail recursion to loop.
21:49:09FromDiscord<einjonas> yeah but u still need to remove stacktraces
21:49:22FromDiscord<einjonas> from the build
21:49:26FromDiscord<einjonas> via a flag
21:49:49FromDiscord<einjonas> i tested it in compiler explorer
21:50:15FromDiscord<Elegantbeef> You can remove stack traces from a single proc
21:50:22FromDiscord<einjonas> u can?
21:50:31FromDiscord<einjonas> checks too?
21:50:50FromDiscord<Elegantbeef> Yes
21:51:01FromDiscord<einjonas> can u show me a example
21:51:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=vhwAMlWK
21:51:35FromDiscord<einjonas> what are push and pop standing for
21:52:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas
21:52:58FromDiscord<einjonas> can i overide it for multiple functions with push and pop?
21:53:19FromDiscord<Elegantbeef> Everything inbetween `push` and `pop`
21:53:27FromDiscord<einjonas> oh nice
21:53:30FromDiscord<einjonas> thanks
21:55:39FromDiscord<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:54FromDiscord<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:54FromDiscord<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:23FromDiscord<Elegantbeef> `const` is a Nim constant and can be folded or stored in static memory
22:07:43FromDiscord<Elegantbeef> `let` and `var` are runtime values that should be on the stack though with `include` they do not need be
22:08:16FromDiscord<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:26FromDiscord<leorize> redefining constants allow you to use them in Nim CT contexts
22:10:25*lucasta joined #nim
22:10:46FromDiscord<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:54FromDiscord<leorize> and obviously, once you redefined everything in Nim terms, you don't need the headers anymore
22:10:56FromDiscord<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:22FromDiscord<double_spiral> Is there a difference between noreturn and : void
22:12:34FromDiscord<leorize> yes
22:12:49FromDiscord<double_spiral> What is it
22:12:59FromDiscord<leorize> noreturn means you enter the proc and never gets out (ie. `quit()`)
22:13:13FromDiscord<leorize> `void` just meant that the proc does not have a return value
22:13:32FromDiscord<double_spiral> In reply to @leorize "noreturn means you enter": Oh that makes sense
22:15:36FromDiscord<majortrips1763> In reply to @leorize "and obviously, once you": Also, the code will be less noisy...
22:18:04FromDiscord<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:29FromDiscord<leorize> you'll need some C magic to help there
22:19:55FromDiscord<leorize> there's no native functionality for this, so C extension + linker script is still what you need
22:19:57FromDiscord<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:17FromDiscord<leorize> there's no avoiding the linker script, unfortunately
22:20:33FromDiscord<double_spiral> A tragedy
22:20:52FromDiscord<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:07FromDiscord<majortrips1763> I have been drawing quite a bit of inspiration from: https://github.com/demotomohiro/MinimumNimPico/blob/main/src/startup.nim
22:27:26FromDiscord<leorize> I'd say to just write a `.c` and link it using `{.compile.}` directive
22:27:27FromDiscord<leorize> a lot easier than trying to embed it in a `.nim`
22:29:01FromDiscord<majortrips1763> In reply to @leorize "a lot easier than": But that removes most of the fun.
22:42:02FromDiscord<majortrips1763> Is there any sort of idiomatic mattern for exposing constants from modules in Nim? I.e. all caps?
22:42:09FromDiscord<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:49FromDiscord<leorize> PascalCase\`↵(@majortrips1763)
22:43:11FromDiscord<majortrips1763> (edit) "mattern" => "pattern"
22:45:26FromDiscord<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:37FromDiscord<leorize> yea, unused code is eliminated at compile time
22:47:33FromDiscord<leorize> you're copying the function type parameters verbatim, which caused the problem↵(@random.visitor)
22:48:59FromDiscord<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:16FromDiscord<leorize> if you use `treeRepr`, you will notice that your proc has `Sym` in it, due to being copied from `getTypeImpl` output
22:49:47FromDiscord<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:10FromDiscord<random.visitor> sent a code paste, see https://play.nim-lang.org/#pasty=duJMODvZ
22:54:14FromDiscord<leorize> here's an example of desym-ing the result\: https://play.nim-lang.org/#pasty=HSqYoRdt
22:55:12FromDiscord<leorize> it goes without saying that you shouldn't desym everything, just the variable symbols
22:55:23FromDiscord<leorize> the type symbols should be kept
22:55:40FromDiscord<leorize> the quick fix I wrote desym everything
22:55:55FromDiscord<Elegantbeef> Typed AST has killed many a souls
22:59:33FromDiscord<random.visitor> thank you - that's much better than any approach I would have came up with
23:03:02FromDiscord<leorize> you're welcome, typed AST is quite the beast to handle
23:21:31FromDiscord<majortrips1763> Are there any optimization guides floating around?