00:10:43 | * | rockcavera joined #nim |
00:10:43 | * | rockcavera quit (Changing host) |
00:10:43 | * | rockcavera joined #nim |
00:37:09 | FromDiscord | <stoneface> I'm working on documentation for a library but the page title for the generated files has the source directory included, is there any way to remove this? |
00:37:36 | FromDiscord | <stoneface> shows up like `src/<module_name>` |
00:38:46 | FromDiscord | <Elegantbeef> You can try `--project` i think |
00:38:46 | FromDiscord | <Elegantbeef> Dont recall if there is a way |
00:39:35 | FromDiscord | <stoneface> yup, I'm using the `--project` |
00:39:42 | FromDiscord | <stoneface> (edit) "yup, I'm using the `--project` ... " added "switch" |
00:41:36 | FromDiscord | <stoneface> I'm doing `"nim doc --project --index:on --outdir:htmldocs src/trackerboy.nim"` but I get `src/trackerboy` as the title instead of `trackerboy` |
00:42:11 | FromDiscord | <stoneface> hope I don't have to move everything out of source to the project dir lol |
00:42:22 | FromDiscord | <stoneface> (edit) "source" => "src" |
00:43:23 | FromDiscord | <Elegantbeef> I do not know |
00:46:27 | FromDiscord | <slymilano> Hey guys, what HTTP server does Prologue use? Or did they write their own HTTP server and include it with the web framework? |
00:48:58 | FromDiscord | <Elegantbeef> https://github.com/planety/prologue/blob/devel/prologue.nimble#L11-L16 uhh perhaps |
00:49:23 | FromDiscord | <Elegantbeef> https://github.com/xflywind/httpx seems it's this |
00:49:32 | FromDiscord | <slymilano> interdasting thanks |
01:02:07 | FromDiscord | <exelotl> In reply to @Alea "why on earth are": post-def doc comments make a lot of sense to me, it matches how it appears in generated docs and is the more logical way to present the information (imagine reading a dictionary and it had the descriptions of the words before the words lol) |
01:02:48 | FromDiscord | <Alea> true I guess, I just wish that post-def docs were easier to distinguish from the code and comments below them |
01:03:36 | FromDiscord | <exelotl> Yeah it is a bit awkward when you want to put a regular comment in the place where a doc comment would usually go |
01:04:06 | FromDiscord | <exelotl> Syntax highlighting can help I guess, at least I've seen a few themes that highlight them differently |
01:05:52 | FromDiscord | <Alea> which ones? |
01:12:54 | FromDiscord | <j-james> man, okay, i'm bashing my head against a wall with this regex module |
01:13:08 | FromDiscord | <j-james> sent a code paste, see https://paste.rs/Moo |
01:13:15 | FromDiscord | <j-james> what's up with this matching syntax? |
01:13:40 | FromDiscord | <Elegantbeef> wasm is a mistake |
01:13:41 | FromDiscord | <Elegantbeef> Melting my head fighting wasm here apparently |
01:13:41 | FromDiscord | <Elegantbeef> I mean regex 😄 |
01:14:27 | FromDiscord | <j-james> when it works it works great :-p |
01:14:35 | FromDiscord | <j-james> when it doesn't i have no idea what i'm doing wrong |
01:16:12 | FromDiscord | <Elegantbeef> Atleast this is hwo i'd do it |
01:16:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XHV |
01:17:22 | FromDiscord | <j-james> the actual stuff i want to match on is a little more complicated 🙁 |
01:18:05 | FromDiscord | <j-james> i'd really just like my regex from https://regexr.com/ to work |
01:18:27 | FromDiscord | <j-james> but there's something i haven't figured out about what `regex.match()` does |
01:18:28 | FromDiscord | <Elegantbeef> Well i dont use regex so i cannot say much |
01:22:59 | FromDiscord | <stoneface> so copying the src dir out of the project dir and then running `nim doc...` there fixed it |
01:23:23 | FromDiscord | <Elegantbeef> Sounds like a "fix" |
01:23:56 | FromDiscord | <stoneface> a "fix" indeed |
01:24:26 | FromDiscord | <stoneface> dunno why it's putting the src in the title |
01:24:42 | FromDiscord | <Elegantbeef> It's the import path |
01:24:48 | FromDiscord | <exelotl> In reply to @Alea "which ones?": Not sure off the top of my head (am on my phone rn) |
01:24:57 | FromDiscord | <!Patitotective> you can make a PR and add that wacky option :] |
01:27:22 | FromDiscord | <j-james> alright, `for match in findAll(text, re"https:\/\/[\w,\d,\.,\/,\-,_]"): result.add(document[match.boundaries])` did what i wanted |
01:27:32 | FromDiscord | <j-james> gonna have to figure out that `match` syntax later though |
01:27:56 | FromDiscord | <Elegantbeef> The hell are you matching? |
01:29:29 | FromDiscord | <j-james> url-looking things in a markdown document |
01:29:37 | FromDiscord | <j-james> `re"https[^\)]"` is probably better 😄 |
01:29:38 | FromDiscord | <stoneface> In reply to @Elegantbeef "It's the import path": yup, passing -p with the full path of src fixed it, ty |
01:32:34 | FromDiscord | <xflywind> In reply to @slymilano "Hey guys, what HTTP": On windows, it uses `std/asynchttpserver`. |
01:36:00 | FromDiscord | <!Patitotective> hey beeef, im trying to make a _spreadsheet_ for imgui↵sooooooo i was thinking of accepting `colHeaders, rowHeaders: seq[string]` and then generate a table `Table[Cell, string]` to save the inputText buffers where `Cell(col, row: string)`↵or do you think its better to make it just `colHeaders, rowHeaders: set[int]` and then display their name according to their index? 🤔 |
01:38:29 | FromDiscord | <Elegantbeef> Personally i'd use something more composable but you do you |
01:39:14 | FromDiscord | <!Patitotective> how composable? 🤔 |
01:44:24 | FromDiscord | <Elegantbeef> Something like this |
01:44:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XIb |
01:44:44 | FromDiscord | <Elegantbeef> you could use `pairs` in the concept but that doesnt work for things like `seq[(string, int)]` |
01:45:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/8eS |
01:47:34 | FromDiscord | <Elegantbeef> YMMV if this is actually a good idea |
01:49:03 | FromDiscord | <!Patitotective> i cant find any docs for those _c o n c e p t s_ 🤨 |
01:49:14 | FromDiscord | <!Patitotective> (edit) "i cant find any docs for those ... _c" added "" |
01:49:53 | FromDiscord | <mratsim> In reply to @Patitotective "i cant find any": The experimental manual |
01:50:11 | FromDiscord | <!Patitotective> smart |
01:50:45 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#concepts |
01:50:56 | FromDiscord | <Elegantbeef> They're experimental but I will always suggest using them over other methods |
01:52:08 | * | noeontheend quit (Ping timeout: 260 seconds) |
01:52:22 | FromDiscord | <Elegantbeef> I like my code reuse and explict interfaces 😄 |
02:07:41 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/m2x |
02:07:48 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3XIf" => "https://paste.rs/myJ" |
02:07:56 | FromDiscord | <!Patitotective> (edit) "https://paste.rs/V9T" => "https://play.nim-lang.org/#ix=3XIf" |
02:07:58 | FromDiscord | <!Patitotective> (edit) |
02:07:59 | FromDiscord | <Elegantbeef> `var a = {0u16..99u16}` |
02:08:08 | FromDiscord | <!Patitotective> uhg :[ |
02:08:11 | FromDiscord | <!Patitotective> thanks _] |
02:08:13 | FromDiscord | <!Patitotective> (edit) "_]" => ":]" |
02:08:23 | FromDiscord | <Elegantbeef> Also if you only need that range you can do `var a = {range[0..99](0) .. range[0..99](99)}` |
02:08:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/wzJ |
02:11:11 | FromDiscord | <salt> is there away to combine these procs? https://github.com/salt-die/graphim/blob/main/graphim/graph.nim#L121-L128↵I was unsuccessful with `graph_data: openArray[T] | seq[T] | iterator: T` |
02:12:10 | FromDiscord | <huantian> I don’t think you need seq[T] if you already have openArray, but it seems like it would work |
02:12:30 | FromDiscord | <Elegantbeef> You could use a concept but yes just use an openarray and iterator as seperate APIs |
02:12:42 | FromDiscord | <Elegantbeef> You could also use a concept if you want a single proc |
02:13:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Nzs |
02:16:31 | FromDiscord | <Elegantbeef> Ah nvm i guess iterator causes a cgen error |
02:17:14 | FromDiscord | <salt> is `seq` redundant? i thought i had errors when i tested without it, but maybe i didn't test that |
02:17:37 | * | noeontheend joined #nim |
02:17:39 | FromDiscord | <Elegantbeef> openarray takes `seq` and `array[.., T]` |
02:17:50 | * | kayabaNerve quit (Ping timeout: 240 seconds) |
02:18:32 | FromDiscord | <salt> nice, that will remove a lot of procs then |
02:19:36 | FromDiscord | <Elegantbeef> Welcome to the club of reusable code 😄 |
02:22:53 | FromDiscord | <salt> now i just need a macro that defines a function for iterator for every one that i have a seq for |
02:23:20 | FromDiscord | <Elegantbeef> Eh you can just make a template |
02:25:14 | FromDiscord | <huantian> Weird that openArray | iterator doesn’t work |
02:25:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XIj |
02:25:37 | FromDiscord | <Elegantbeef> It's "technically" correct but 100% silly |
02:25:46 | FromDiscord | <Elegantbeef> Nim doesnt do implicit conversions into generics |
02:25:56 | FromDiscord | <Elegantbeef> So i mean it's by the book, but fucking dumb |
02:26:01 | * | arkurious quit (Quit: Leaving) |
02:27:28 | FromDiscord | <salt> i was thinking a macro that would just replace the `openArray` annotation with `iterator`, so i could just tag all the procs with it |
02:28:56 | FromDiscord | <Elegantbeef> Yea that'd work aswell 😄 |
02:30:21 | * | rockcavera quit (Remote host closed the connection) |
02:30:32 | FromDiscord | <Elegantbeef> Huan it gets even uglier `proc doThing(openArray[char or int])` doesnt take string but `proc doThing[T: char or int](openArray[T])` does |
02:31:24 | * | rockcavera joined #nim |
02:31:24 | * | rockcavera quit (Changing host) |
02:31:24 | * | rockcavera joined #nim |
02:31:27 | FromDiscord | <Elegantbeef> And due to implicit converts to cstring you cannot have `proc doThing(oa: openarray[char])` and `proc doThing(s: cstring)` then call `doThing"hello"` |
02:55:04 | FromDiscord | <huantian> Wacko |
02:59:13 | * | noeontheend quit (Ping timeout: 260 seconds) |
03:13:59 | * | vicfred joined #nim |
03:15:49 | * | noeontheend joined #nim |
03:22:21 | FromDiscord | <salt> Can this be simplified, I feel like it's pretty messy -- but it does compile: https://github.com/salt-die/graphim/blob/main/graphim/graph.nim#L128-L149 |
03:23:55 | FromDiscord | <Elegantbeef> use `eqIdent` instead of `== ident"openArray"` |
03:25:58 | FromDiscord | <salt> will `== ident"openArray"` fail for, say, `"open_array"` |
03:26:51 | FromDiscord | <Elegantbeef> Yes |
03:28:25 | FromDiscord | <salt> ok, that's a good thing to know! |
03:59:27 | * | kayabaNerve joined #nim |
04:13:15 | * | noeontheend quit (Ping timeout: 260 seconds) |
04:32:33 | * | slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)) |
05:39:25 | * | nsyd joined #nim |
05:53:41 | * | rockcavera quit (Remote host closed the connection) |
06:16:30 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/c6x |
06:17:13 | FromDiscord | <Rika> likely that somehow character isnt initialised? |
06:17:21 | FromDiscord | <Rika> esp. since its a ref |
06:17:32 | FromDiscord | <Rika> i do not know whether new hook handles that |
06:17:34 | FromDiscord | <Rika> probably not |
06:18:12 | FromDiscord | <Elegantbeef> It does not |
06:18:15 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/vJq |
06:18:19 | FromDiscord | <Rika> thats an object |
06:18:24 | FromDiscord | <Rika> it doesnt need to be "initialised" |
06:18:42 | FromDiscord | <xflywind> I remember DateTime cannot be used as the attributes of object/ref object. |
06:18:48 | FromDiscord | <Yardanico> yeah @Phil add ` entry = new(Character)` |
06:18:55 | FromDiscord | <Yardanico> as a first line in newHook |
06:19:13 | FromDiscord | <Phil> Right, ref type vs value type stuff |
06:19:19 | FromDiscord | <Rika> this might be a dumb question but does nim handle stack overflows itself? im not too familiar with this kind of checking |
06:19:32 | FromDiscord | <Yardanico> it doesn't really "handle" them |
06:20:20 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/aDk |
06:20:29 | FromDiscord | <Rika> in an embedded context |
06:20:37 | FromDiscord | <Rika> baremetal |
06:20:45 | FromDiscord | <Phil> thanks @Yardanico @Rika @ElegantBeef I shall throw that in an SO question for me to google in 6 months once I've inevitably forgotten |
06:20:51 | FromDiscord | <Yardanico> In reply to @Rika "baremetal": how would that be different? |
06:21:39 | FromDiscord | <Rika> i was looking at <https://github.com/knurling-rs/flip-link> and it mentions "unexpected behaviour" |
06:21:39 | FromDiscord | <Yardanico> i mean, instead of crashing your program might start doing all sorts of weird stuff, but that's it |
06:21:42 | FromDiscord | <Rika> yes |
06:21:49 | FromDiscord | <Rika> i would like to prevent that? |
06:22:14 | FromDiscord | <Yardanico> maybe there are existing C solutions for that? |
06:29:27 | FromDiscord | <Phil> I really need to hammer the fundamental differences between value and ref objects into my head more, the more I look at the problem the more I feel dumb |
06:29:57 | FromDiscord | <Yardanico> In reply to @Isofruit "I really need to": i don't know how to explain, but it's basically the value itself vs a _reference_ to the value itself |
06:30:09 | FromDiscord | <Phil> Yeh, I do have that in my head when I consciously think about it |
06:30:12 | FromDiscord | <Yardanico> and if you didn't initialize the reference it would point to non-existing value (nil) |
06:30:18 | FromDiscord | <Phil> It just hasn't become second nature yet to think in those terms |
06:31:32 | FromDiscord | <Elegantbeef> Ref is a pointer, pointers are evil return to stack |
06:31:57 | FromDiscord | <Phil> When asked with the express hint that X is a ref type I can tell you the implications of when you feed a ref-type into a proc and manipulate it in there and what that means for your object-reference outside of that proc.↵But the small things like above that ref-types need to be explicitly created because the system never creates them for you since they aren't copied around everywhere like value types still just aren't immediately present i |
06:32:20 | FromDiscord | <Phil> Though I did just realize why e.g. java has the "new" keyword since everything and its mother in there is a ref-type (bar the basic primitives) |
06:33:19 | FromDiscord | <Phil> (edit) "Though I did just realize why e.g. java has the "new" keyword since everything and its mother in there is a ref-type ... (bar" added "and you have to tell the code somehow that it needs to create those objects" |
06:33:19 | * | dithpri quit (Quit: '); DROP TABLE Users;--) |
06:33:56 | FromDiscord | <demotomohiro> In reply to @Isofruit "I really need to": https://www.reddit.com/r/nim/comments/7dm3le/tutorial_for_types_having_a_hard_time/ |
06:34:38 | FromDiscord | <demotomohiro> https://forum.nim-lang.org/t/1207 |
06:35:33 | FromDiscord | <Phil> In reply to @demotomohiro "https://www.reddit.com/r/nim/comments/7dm3le/tutori": First reply: An informative wall of text from pmunch, good to know he's everywhere 😄 |
06:41:37 | NimEventer | New question by Philipp Doerner: Jsony newHook has `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` when deserializing into ref-objects, see https://stackoverflow.com/questions/72237922/jsony-newhook-has-sigsegv-illegal-storage-access-attempt-to-read-from-nil |
06:48:41 | FromDiscord | <mratsim> In reply to @Rika "this might be a": Compile with the stack-smash flag in GCC |
06:49:33 | FromDiscord | <Rika> ill look into that |
06:49:35 | FromDiscord | <mratsim> Basically it adds the exit function, nop and after enough nop a jump to a panic function |
06:50:10 | FromDiscord | <mratsim> So if you overwrite overflow and rewrite the exit you still reach the panic |
06:50:50 | FromDiscord | <Rika> im reading an article about it and it says something else |
06:50:58 | FromDiscord | <mratsim> -fstack-protector |
06:51:01 | FromDiscord | <Rika> it instead mentions a canary and a check for the canary's value |
06:51:11 | FromDiscord | <Rika> no nops here it seems |
06:51:28 | FromDiscord | <mratsim> Mmmh possible, there are many related flags |
06:52:16 | FromDiscord | <Rika> seems like it uses the canary thing for things with libc? |
06:52:30 | FromDiscord | <Rika> oh, libssp |
06:52:45 | FromDiscord | <mratsim> Probably need both |
06:53:00 | FromDiscord | <mratsim> The canary and the check for the canary can both be overwritten |
06:53:35 | FromDiscord | <Rika> this is what im reading |
06:53:35 | FromDiscord | <Rika> https://embeddedartistry.com/blog/2020/05/18/implementing-stack-smashing-protection-for-microcontrollers-and-embedded-artistrys-libc/ |
06:53:43 | FromDiscord | <mratsim> But on embedded you preallocate normally |
06:54:19 | FromDiscord | <mratsim> Like you are so constrained that the practical recourse is just coding caefully |
06:56:42 | FromDiscord | <Rika> In reply to @mratsim "The canary and the": how does the check get overwritten? |
06:56:55 | FromDiscord | <Rika> there's no code on the stack is there? did i forget something |
06:57:26 | FromDiscord | <Rika> also the canary is "declared" before any other variables so it cant be overwritten no? |
06:57:33 | FromDiscord | <Rika> am i forgetting a lot of things |
07:07:09 | * | pro joined #nim |
07:08:07 | FromDiscord | <Rika> In reply to @Rika "also the canary is": Wait no dumb the point is it gets overwritten lol |
07:20:10 | * | jmiven joined #nim |
07:38:15 | * | Zectbumo joined #nim |
08:19:50 | * | nsyd quit (Quit: WeeChat 3.5) |
09:06:22 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XJ0 |
09:07:06 | FromDiscord | <Elegantbeef> You need to move that Nim string to a cstring if you're going to go across barriers |
09:07:17 | FromDiscord | <Elegantbeef> But that doesnt explain why it's null |
09:10:55 | FromDiscord | <Elegantbeef> I guess maybe Nim zeroes the string... that'd be odd if true |
09:10:56 | FromDiscord | <jmgomez> You can move across different types? Or you mean move it to a local string and then call cstring() |
09:11:10 | FromDiscord | <Elegantbeef> I mean allocate space for a cstring and copy to it |
09:11:31 | FromDiscord | <Elegantbeef> You need a string that outlives the stack, which means you need to use the heap to store the string |
09:11:47 | FromDiscord | <jmgomez> ok, so not move but a copy. Gotcha |
09:12:37 | FromDiscord | <Elegantbeef> You say the string is null, do you mean the pointer or data? |
09:14:48 | * | jmiven left #nim (bye) |
09:17:58 | * | om3ga quit (Read error: Connection reset by peer) |
09:20:03 | FromDiscord | <jmgomez> In reply to @Elegantbeef "You say the string": The data I guess, it points to a single 0 |
09:21:02 | FromDiscord | <jmgomez> So I guess it points to the termination character and that was done deliberately by Nim because the cstring's value is "" |
09:21:04 | FromDiscord | <Elegantbeef> Refc has the abillity to make strings live longer but that's gone in orc sadly |
09:21:29 | FromDiscord | <jmgomez> I guess if I make a wrapper type it will also work, right? |
09:21:32 | * | om3ga joined #nim |
09:21:45 | FromDiscord | <Elegantbeef> What? |
09:22:05 | FromDiscord | <jmgomez> because in reality I wont be passing naked cstrings around |
09:22:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/eTb |
09:22:43 | FromDiscord | <Elegantbeef> But this requires you to store that reference |
09:23:01 | FromDiscord | <jmgomez> I meant like a container that it's also exposed to the FFI |
09:23:31 | FromDiscord | <jmgomez> When you assign the cstring to another type it's copied, isnt it? |
09:23:44 | FromDiscord | <Elegantbeef> I mean you also can just return a pointer to the above and then call `GCUnref` from a free proc |
09:23:56 | FromDiscord | <Elegantbeef> cstrings are never copied |
09:24:11 | FromDiscord | <Elegantbeef> They're syntax sugar on `ptr UncheckedArray[char]` |
09:24:47 | FromDiscord | <jmgomez> ohh |
09:28:15 | * | duuude joined #nim |
09:30:32 | * | Zectbumo quit (Remote host closed the connection) |
09:37:41 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XJ8 |
10:13:09 | * | bananahead left #nim (The Lounge - https://thelounge.chat) |
10:14:10 | * | pro quit (Quit: pro) |
10:39:04 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/j6b |
11:27:21 | * | jmd_ quit (Ping timeout: 248 seconds) |
11:37:25 | * | xet7 quit (Remote host closed the connection) |
11:39:38 | * | xet7 joined #nim |
12:06:09 | * | noeontheend joined #nim |
12:10:19 | * | jmdaemon joined #nim |
12:10:28 | * | noeontheend quit (Ping timeout: 260 seconds) |
12:31:32 | * | jmdaemon quit (Ping timeout: 248 seconds) |
12:35:31 | FromDiscord | <Rika> In reply to @Rika "there's no code on": Yeah I forgot text section is also below bss and data, and that other stack frames could be hit and result in a potential function pointer if any to be overwritten or so |
12:35:43 | FromDiscord | <Rika> stack smash protection is complicated lol |
12:38:32 | FromDiscord | <Rika> Rather I prolly don’t have the memory layout in my head properly yet |
12:38:39 | FromDiscord | <Rika> Probably need to know the specifics more |
12:39:27 | FromDiscord | <davis_> sent a long message, see http://ix.io/3XKc |
12:40:21 | FromDiscord | <Rika> <@&371760044473319454> lol |
12:40:37 | FromDiscord | <voidwalker> Meh, so on arch linux the 1.4.8 outdated package failed to compile after just replacing the version number in the pkgbuild. So I installed nim-git. nimble is supposed to come with nim, but I don't have a nimble command after installing nim-git |
12:41:11 | FromDiscord | <voidwalker> Am I missing something ? |
12:42:12 | FromDiscord | <voidwalker> ah, there's a nim-git package as well, installed that too. all good i think |
12:42:21 | FromDiscord | <voidwalker> (edit) "nim-git" => "nimble-git" |
12:45:17 | FromDiscord | <Phil> In reply to @Rika "<@&371760044473319454> lol": Yard and pmunch must be asleep time for anarchy! |
12:45:49 | FromDiscord | <Phil> Quick! Somebody ask a ruby question! Nobody will see it coming! |
12:46:55 | FromDiscord | <Rika> How do rust lifetimes work |
12:46:56 | FromDiscord | <Rika> Whoops |
12:46:58 | FromDiscord | <!Patitotective> In reply to @davis_ "Investing 101\: Stocks and": crypto is the future |
12:46:59 | FromDiscord | <Rika> Time to get banned |
12:47:15 | FromDiscord | <Yardanico> In reply to @Isofruit "Yard and pmunch must": I'm at a wedding (not mine), so can't respond well today, sorry:) internet here is spotty |
12:47:36 | FromDiscord | <Phil> In reply to @Yardanico "I'm at a wedding": Perfect! More time for anarchy! |
12:48:00 | FromDiscord | <Rika> In reply to @Yardanico "I'm at a wedding": Congrats to them |
12:48:00 | FromDiscord | <Rika> Lol |
12:48:38 | FromDiscord | <!Patitotective> In reply to @Rika "Congrats to them": the start of a "happy" life ._. |
12:48:51 | FromDiscord | <Phil> In reply to @Yardanico "I'm at a wedding": Oh, Rika is correct, congratulations to those getting married |
12:50:23 | FromDiscord | <Yardanico> I banned them, but can't delete the message in matrix for some reason |
12:50:45 | FromDiscord | <Yardanico> Thanks↵(@Phil) |
12:50:52 | FromDiscord | <Rika> In reply to @Patitotective "the start of a": Not up to you to determine whether they’d have a happy life or not xd |
12:52:43 | FromDiscord | <!Patitotective> In reply to @Rika "Not up to you": i have never seen a marriage that stays happy too long, they just start being toxic |
12:56:21 | FromDiscord | <Phil> Hmm minor thought, seq types live in heap, right? Since stack variables can't be Re sized? |
12:56:53 | FromDiscord | <Phil> Or is a new seq in the stack created with every append? |
12:58:06 | FromDiscord | <demotomohiro> pointer (also len in arc/orc) lives in stack but memory area pointed by it lives in heap. |
12:58:09 | FromDiscord | <Rika> Heap |
12:58:45 | FromDiscord | <Rika> You can “make new variables” in the stack but it’s not recommended I believe |
12:59:22 | FromDiscord | <demotomohiro> But if you create a seq[seq[int]] or ref object contains seq, whole seq lives in heap. |
12:59:33 | FromDiscord | <demotomohiro> (edit) removed "seq[seq[int]] or" |
13:07:12 | FromDiscord | <yttriy> Hello, I have a question. Afaik there is a nim operator shr for a right logical shift and an ashr proc for an arithmetic right shift. The behavior of shr with negative numbers depends on what C/C++ compiler you use for nim, so in some cases shr with negative nums can behave as ashr. But what should I do if i want to do a right log. shift with negative numbers and never get ashr result, whichever C/C++ compiler i use (i.e. pure shr)? |
13:08:41 | FromDiscord | <Rika> I don’t understand the last part of your question |
13:09:05 | FromDiscord | <yttriy> Well |
13:10:08 | FromDiscord | <yttriy> You see, in some cases a right log. shift behaves the same as a arithmetic right shift |
13:10:18 | FromDiscord | <yttriy> (edit) "a" => "an" |
13:10:26 | FromDiscord | <yttriy> With negative numbers |
13:11:28 | FromDiscord | <yttriy> But I want RLS always behave as RLS, that is the problem |
13:12:16 | FromDiscord | <Rika> Negative numbers in shifts are undefined behaviour like in C |
13:13:03 | FromDiscord | <Rika> Or do you mean negative numbers as the one being shifted |
13:13:30 | FromDiscord | <Rika> Regular right shift doesn’t act like arithmetic shift in that case, so I’m still not sure what you mean |
13:14:39 | FromDiscord | <demotomohiro> !eval echo 255'u8 shr 1 |
13:14:41 | NimBot | 127 |
13:14:57 | FromDiscord | <demotomohiro> Is this what you want to do? |
13:15:01 | FromDiscord | <Rika> !eval echo -127 shr 1 |
13:15:04 | NimBot | -64 |
13:15:14 | FromDiscord | <yttriy> In reply to @Rika "Regular right shift doesn’t": Maybe i've misunderstood something, but for example -4 shr 1 works -4 ashr(-4, 1) (at least on my machine) |
13:15:22 | FromDiscord | <Rika> Huh |
13:15:44 | FromDiscord | <Rika> Huh. |
13:16:09 | FromDiscord | <yttriy> In reply to @yttriy "Maybe i've misunderstood something,": It's not what I was expecting |
13:16:13 | FromDiscord | <Rika> Okay |
13:16:21 | FromDiscord | <Rika> Cast your negative number into an unsigned |
13:16:33 | FromDiscord | <yttriy> (edit) "-4" => "the same as" |
13:16:36 | FromDiscord | <Rika> shr is set to ashr for signed integers |
13:17:21 | FromDiscord | <Rika> And I do mean cast, a conversion of course wouldn’t work here |
13:17:25 | FromDiscord | <demotomohiro> !eval (cast[uint](-4) shr 1), ", ", (-4 ashr 1) |
13:17:26 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: invalid indentation |
13:17:35 | FromDiscord | <Rika> ashr isn’t an operator |
13:17:40 | FromDiscord | <Rika> Use it like a function |
13:18:46 | FromDiscord | <planetis> In reply to @yttriy "Hello, I have a": cast to unsigned first |
13:19:50 | FromDiscord | <demotomohiro> !eval echo (cast[uint8](-4'i8) shr 1), ", ", ashr(-4'i8, 1) |
13:19:52 | NimBot | 126, -2 |
13:25:25 | FromDiscord | <yttriy> And what does the cast do? (>_< maybe nooby question sorry uwuuwuwuwuwuwuuwuwuwuwuw) |
13:26:04 | FromDiscord | <Rika> Reinterpret as another type |
13:26:39 | FromDiscord | <demotomohiro> For example, cast[uint8](-4'i8) makes uint8 value that have same bit pattern as -4'i8. |
13:30:35 | FromDiscord | <Zoom> Comparing the C FFI overhead on various languages - https://github.com/dyu/ffi-overheadHave we discussed this? On HN frontpage now. Strange results in this repo. |
13:31:14 | * | pro joined #nim |
13:32:02 | FromDiscord | <yttriy> In reply to @demotomohiro "For example, cast[uint8](-4'i8) makes": So, in this case, cast takes -4 bit representation and changes the value of MBS to 0? |
13:33:49 | FromDiscord | <yttriy> (edit) "MBS" => "MSB" |
13:34:39 | FromDiscord | <demotomohiro> In reply to @yttriy "So, in this case,": cast itself doesn't change the value of MBS to 0. `shr` do right bit shift and put 0 in MBS. |
13:35:35 | FromDiscord | <Rika> In reply to @Zoom "Comparing the C FFI": Oh wow Lua lower than C itself lmao |
13:35:46 | FromDiscord | <yttriy> In reply to @demotomohiro "cast itself doesn't change": Ah, i see |
13:35:54 | FromDiscord | <yttriy> thank you |
13:37:26 | FromDiscord | <Rika> Also a really really old Nim version lmao |
13:37:37 | FromDiscord | <Rika> Looks like all the versions are really old |
13:38:02 | FromDiscord | <demotomohiro> That nim code in the repo is written 4 years ago. |
13:39:14 | FromDiscord | <Phil> That's pretty young overall |
13:42:20 | FromDiscord | <Rika> That’s around 1/4 of Nim’s life though |
13:43:54 | FromDiscord | <Phil> Yeah but that code doesn't even go to pre school |
13:44:39 | FromDiscord | <Phil> I've got Java code of drinking age even by us standards at work |
13:47:47 | * | arkurious joined #nim |
13:47:51 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3XKp |
13:51:31 | FromDiscord | <untoreh> is `"someliteralstring"` and `static("someliteralstring")` equivalent? |
13:51:47 | FromDiscord | <Rika> Well LTO isn’t enabled since it would be unfair for other languages |
13:51:55 | FromDiscord | <Rika> In reply to @untoreh "is `"someliteralstring"` and `static("someliteralst": I believe so yes |
14:12:14 | * | dithpri joined #nim |
14:40:48 | * | pro quit (Quit: pro) |
14:41:28 | * | vicfred quit (Quit: Leaving) |
15:09:22 | * | vicfred joined #nim |
15:10:35 | * | vicfred_ joined #nim |
15:13:50 | * | vicfred quit (Ping timeout: 240 seconds) |
15:21:08 | FromDiscord | <mlokis> In reply to @demotomohiro "https://github.com/dyu/ffi-overhead/blob/master/hel": shit I red plu-sone instead of plus-one. |
15:34:49 | * | v9fk quit (Read error: Connection reset by peer) |
15:42:02 | * | slowButPresent joined #nim |
15:45:30 | * | vicfred_ quit (Quit: Leaving) |
15:53:54 | * | v9fk joined #nim |
16:03:26 | FromDiscord | <Forest> Fun fact: `import ../[among,us]` doesn't work- |
16:03:44 | FromDiscord | <Forest> (Among us is an example :) |
16:07:51 | dithpri | yet another compiler smell smh |
16:11:41 | FromDiscord | <!Patitotective> In reply to @Forest "(Among us is an": ඞ |
16:18:10 | * | noeontheend joined #nim |
16:18:12 | * | pro joined #nim |
16:18:26 | * | pro quit (Client Quit) |
16:18:52 | * | v9fk quit (Remote host closed the connection) |
16:18:54 | FromDiscord | <Rika> It’s the ../ thing again |
16:18:59 | FromDiscord | <Rika> You have to quote .. |
16:19:03 | FromDiscord | <Rika> It’s a bug |
16:20:04 | * | v9fk joined #nim |
16:27:12 | FromDiscord | <Bubblie> which class in nim-lang repo is the ../ parsed if I can ask? |
16:27:30 | FromDiscord | <Bubblie> pathutil? |
16:38:50 | * | duuude quit (Ping timeout: 240 seconds) |
16:40:57 | * | noeontheend quit (Ping timeout: 248 seconds) |
16:46:03 | FromDiscord | <Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLk |
16:46:09 | FromDiscord | <Urothis> (edit) "https://play.nim-lang.org/#ix=3XLl" => "https://paste.rs/AwT" |
16:48:30 | FromDiscord | <huantian> It’s just an alias for a unsigned 8 but int, the means it’s public |
16:53:13 | FromDiscord | <Urothis> @huantian much appreciated, def not the answer I expected. Much simpler. |
16:53:43 | FromDiscord | <huantian> Yeah is an interesting notation, kind of confusing coming from other langs, but is nice and concise |
16:54:35 | FromDiscord | <Urothis> Alot of this code is looking alot less intimidating now, lol. Yeah, that notation design choice is an interesting one. Haven't seen that on any other language. |
16:56:41 | FromDiscord | <jmiven> Oberon has it. I'm not sure if it was in Modula |
16:56:51 | FromDiscord | <Rika> In reply to @Urothis "Alot of this code": It’s from Oberon |
16:57:26 | * | firq joined #nim |
16:59:09 | FromDiscord | <kiell> does sequtils not have a find() proc for returning single elements or will i have to write my own? |
17:10:11 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#find%2CT%2CS |
17:14:34 | * | duuude joined #nim |
17:16:43 | FromDiscord | <Forest> Anyone know how I'd manage connections for a game server? I'm planning on making a barebones MC server software in Nim but idk how to handle connections effectively (or at all-) |
17:18:10 | FromDiscord | <Forest> It uses TCP sockets, ik that |
17:23:51 | * | vicecea quit (Remote host closed the connection) |
17:24:22 | * | vicecea joined #nim |
17:25:17 | * | pro joined #nim |
17:28:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLu |
17:31:21 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLv |
17:31:48 | FromDiscord | <Rika> `somehow produce that proc at compile time` macro xd |
17:32:14 | FromDiscord | <Rika> or template |
17:32:18 | FromDiscord | <Rika> this looks templateable |
17:32:36 | FromDiscord | <Phil> Hmmm |
17:32:43 | FromDiscord | <Alea> Is there some kind of data structure that's like a table for ranges?↵Like any index between x and y would return the same value? |
17:32:55 | FromDiscord | <Rika> not that i know of no |
17:33:11 | FromDiscord | <Rika> i dont know if that syntax would work for arrays either so |
17:33:32 | FromDiscord | <Rika> that -> [0..5: xvalue, 6..10:yvalue] or something |
17:33:37 | FromDiscord | <Rika> i dont think that works ofc |
17:35:56 | FromDiscord | <Phil> Wait, wtf |
17:36:13 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLw |
17:36:14 | FromDiscord | <Phil> ... if that works I'll be highly fascinated |
17:37:12 | FromDiscord | <Rika> why wouldnt this compile |
17:37:20 | FromDiscord | <Rika> this wont work with more than one entry though |
17:37:22 | FromDiscord | <Phil> I never tried templating actually named procs |
17:37:59 | FromDiscord | <Rika> In reply to @Rika "this wont work with": since its ambiguous what proc to call if more than one was generated |
17:38:51 | FromDiscord | <Phil> That works fine by me, I need one per domain that I have basically |
17:39:18 | FromDiscord | <Phil> Though wait, the type is at the wrong place I think, I don't wanna generate a generic proc from the template |
17:40:02 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLx |
17:46:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLB |
17:46:29 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3XLB" => "https://paste.rs/3Jm" |
17:50:37 | FromDiscord | <dom96> In reply to @Forest "Anyone know how I'd": Yep, just create a socket server using async. Here is an example of a client and a server: https://github.com/dom96/nim-in-action-code/tree/master/Chapter3/ChatApp |
17:52:02 | FromDiscord | <Forest> Ah thanks! |
18:24:40 | FromDiscord | <Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLR |
18:28:41 | FromDiscord | <Rika> Yes |
18:29:07 | FromDiscord | <Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLT |
18:29:23 | FromDiscord | <voidwalker> we should have a channel for dumbquestions I think, I want to ask a lot but feel ashamed to do so in #main |
18:30:01 | * | noeontheend joined #nim |
18:30:44 | FromDiscord | <Rika> It’s fine |
18:31:03 | FromDiscord | <Rika> How do you determine whether a question is dumb or not anyway |
18:31:10 | FromDiscord | <Rika> In reply to @Urothis "So converted to rust.": Probably |
18:35:55 | * | pro quit (Quit: pro) |
18:44:37 | FromDiscord | <Urothis> Running with it, thanks @Rika |
18:56:36 | * | noeontheend quit (Ping timeout: 248 seconds) |
19:09:25 | FromDiscord | <voidwalker> welp, I was a bit hyped up to learn nim, as I know a bit of pascal where I have a half baked project , and wanted to rewrite in Nim, with OOP and add a webframework.. only to find out there's not much OOP in nim |
19:12:25 | FromDiscord | <Rika> Yeah Nim doesn’t do OOP heavily |
19:16:18 | FromDiscord | <voidwalker> method vocalize(this: Dog): string = "woof" - oooh ok, phew. I thought I couldn't do dog.vocalize in nim, seems I can : ) |
19:16:45 | FromDiscord | <voidwalker> cause what else is oop good for |
19:27:33 | * | xet7 quit (Remote host closed the connection) |
19:27:42 | FromDiscord | <Yardanico> In reply to @voidwalker "cause what else is": you can do dog.vocalize in Nim without methods |
19:27:53 | FromDiscord | <Yardanico> method call syntax (ufcs) is one of the main Nim features |
19:27:59 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
19:28:12 | FromDiscord | <Yardanico> basically `b(a)` is the same as `a.b()` |
19:28:28 | FromDiscord | <Yardanico> `b(a, c, d)` is the same as `a.b(c, d)` |
19:28:44 | * | xet7 joined #nim |
19:28:46 | FromDiscord | <!Patitotective> :] |
19:29:44 | FromDiscord | <voidwalker> ok, will keep that in mind, for my first refactoring |
19:29:58 | FromDiscord | <Yardanico> so you don't need `method` unless you need runtime dispatch |
19:30:19 | FromDiscord | <Yardanico> and even then you can use object variants + procs with `case` instead of methods + objects with inheritance for runtime dispatch |
19:34:03 | FromDiscord | <jmgomez> In reply to @Elegantbeef "cstrings are never copied": So I wrap it in another type, the nim string I mean, and it seem to work with the standard mm (not with orc though). Problem is that it crashes in a waitFor while the orc doesnt! :/ |
19:36:31 | FromDiscord | <Forest> How do i compile the compiler super quickly purely for development stuff? |
19:37:00 | FromDiscord | <Yardanico> In reply to @Forest "How do i compile": `./koch temp` |
19:37:28 | FromDiscord | <Yardanico> you basically use it as `./koch temp c file.nim`, anything after `temp` is an argument to the compiler |
19:38:10 | FromDiscord | <Forest> Thanks! |
19:38:38 | FromDiscord | <Forest> How does it compile nim though? |
19:38:44 | FromDiscord | <Yardanico> wdym "how"? |
19:38:47 | FromDiscord | <Forest> Like the actual compiler, since that's what i need to do |
19:38:51 | FromDiscord | <Yardanico> in debug mode without most optimizations |
19:38:55 | FromDiscord | <Forest> Like uh, the command to build it properly |
19:39:01 | FromDiscord | <Yardanico> yes, if you want to quickly test and debug the compiler, `./koch temp` is what you need to use |
19:39:10 | FromDiscord | <Forest> Ah okay then, thanks! |
19:39:14 | FromDiscord | <Yardanico> it builds the compiler and runs it after compiling |
19:39:25 | FromDiscord | <Forest> Aight! |
19:42:35 | FromDiscord | <voidwalker> what is wrong with this line ? var basePath: string = os.getAppDir |
19:43:56 | FromDiscord | <Yardanico> In reply to @voidwalker "what is wrong with": did you import `os` ? |
19:44:07 | FromDiscord | <voidwalker> import std/[times, os] I think so |
19:44:27 | FromDiscord | <Yardanico> ah yeah, you're making a small mistake - you forgot () |
19:44:43 | FromDiscord | <Yardanico> nim doesn't have return type inference, so it can't deduce that you actually want to call the proc and not assign the variable to the proc itself |
19:44:57 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XMZ |
19:45:02 | FromDiscord | <Yardanico> and yeah, you don't need to specify the type for variables that you initialize right there |
19:45:33 | FromDiscord | <voidwalker> yeah, i just tried a bunch of different things cause i didn't know what's wrong |
19:46:26 | FromDiscord | <Rika> Is there anything significant blocking return type inference other than “no one is working on it”? Like conflicts with other features or whatever else |
19:46:27 | FromDiscord | <Yardanico> the error it probably told you is `/mnt/d/Projects/NimExperiments/nimNimiBrowser/tast.nim(3, 27) Error: type mismatch: got 'proc (): string{.gcsafe, locks: <unknown>.}' for 'getAppDir' but expected 'string'` which says "got proc but expected string" |
19:46:56 | FromDiscord | <Yardanico> so `getAppDir` was of the type `proc (): string` but your basePath was `string` so it expected a string |
19:47:05 | FromDiscord | <Yardanico> In reply to @Rika "Is there anything significant": not sure, maybe it'll require a complete rework of the type system |
19:47:13 | FromDiscord | <Yardanico> i'm not good at the type stuff in compiler |
19:47:16 | FromDiscord | <Yardanico> (edit) "compiler" => "compilers" |
19:48:10 | FromDiscord | <voidwalker> type proc (): string.. nice (wtf) |
19:48:22 | FromDiscord | <Yardanico> ? |
19:48:22 | FromDiscord | <Rika> Okay, good to know |
19:48:29 | FromDiscord | <voidwalker> a procedure that returns a string can be a type ? |
19:48:32 | FromDiscord | <Yardanico> of course? |
19:48:37 | FromDiscord | <Yardanico> you can assign procedures to variables |
19:48:41 | FromDiscord | <Yardanico> since procedures are generally first-class |
19:48:43 | FromDiscord | <Rika> Yup Nim has first class functions |
19:48:46 | FromDiscord | <Yardanico> you can pass them around in arguments, store in objects, etc |
19:48:53 | FromDiscord | <voidwalker> do you do private tutoring @Yardanico ? : D |
19:49:05 | FromDiscord | <Yardanico> lol, I haven't tried :D |
19:49:09 | FromDiscord | <Rika> In reply to @Rika "Yup Nim has first": Not that it’s uncommon to find nowadays though |
19:49:10 | FromDiscord | <Yardanico> don't know if I'm good at teaching |
19:49:19 | FromDiscord | <Yardanico> In reply to @Rika "Not that it’s uncommon": yeah, most languages have it |
19:49:51 | * | Jjp137 quit (Read error: Connection reset by peer) |
19:50:15 | * | Jjp137 joined #nim |
19:50:34 | FromDiscord | <voidwalker> ok, so now I got a "basePath" that is of type proc (): string |
19:50:41 | FromDiscord | <voidwalker> I still don't have a string : D |
19:50:47 | FromDiscord | <Rika> You didn’t put the () |
19:50:49 | FromDiscord | <Yardanico> as I said, if you want the string, you do () |
19:50:59 | FromDiscord | <Yardanico> to actually call the proc and assign its _result_ to the variable instead of itself |
19:51:08 | FromDiscord | <voidwalker> OOhh now I get what you meant |
19:51:37 | FromDiscord | <voidwalker> yeah it's funny learning a new language, feels like it's conspiring against your sanity |
19:52:11 | FromDiscord | <Rika> In reply to @voidwalker "yeah it's funny learning": Kinda only for languages that don’t align with those you know |
19:52:11 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN0 |
19:52:20 | FromDiscord | <Yardanico> In reply to @voidwalker "yeah it's funny learning": hm, but isn't using `()` standard in virtually all languages? |
19:52:26 | FromDiscord | <Yardanico> for calling functions I mean |
19:52:41 | FromDiscord | <voidwalker> probably, I also haven't coded in 2 years, and was not much of a coder before also |
19:54:57 | FromDiscord | <Forest> What's the advantage of using the go gc? |
19:56:00 | FromDiscord | <Recruit_main707> go interoperability |
19:56:53 | FromDiscord | <Rika> I don’t know anyone who’s tried doing that though |
20:02:36 | FromDiscord | <jmgomez> How can you test if a variable which is a proc is set in an instance? It doesnt seem to react to isNil. Arent they pointers? |
20:02:57 | FromDiscord | <Yardanico> In reply to @jmgomez "How can you test": they are |
20:03:27 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XN3 |
20:03:36 | FromDiscord | <Yardanico> In reply to @jmgomez "so this is correct?": yes it is |
20:03:36 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN4 |
20:03:47 | FromDiscord | <jmgomez> thanks! |
20:05:44 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=3XN5 |
20:05:59 | FromDiscord | <Yardanico> In reply to @voidwalker "here comes another dumb": ok, first of all, what do you expect it to do if you add `const` to the object? |
20:06:10 | FromDiscord | <Yardanico> and second of all, you can't assign default values to objects in their definition yet |
20:06:40 | FromDiscord | <voidwalker> Guess I should've used let then |
20:06:50 | FromDiscord | <Yardanico> nope, it won't work |
20:06:55 | FromDiscord | <Yardanico> type definitions don't support variable definitions |
20:07:02 | FromDiscord | <Yardanico> you define fields in an object specifically, not variables |
20:07:02 | * | jmdaemon joined #nim |
20:07:52 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN6 |
20:07:56 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/or7 |
20:08:11 | FromDiscord | <Yardanico> `initAppSettings` - `init` because `AppSettings` is an object, so a value type. if it was a `ref object` it would be `newAppSettings` |
20:08:36 | FromDiscord | <voidwalker> I wanna have a record with all the app settings (path and other vars), and a proc initApp, that assigns them, reading from a file probably |
20:09:21 | FromDiscord | <Yardanico> In reply to @voidwalker "I wanna have a": yeah that's not hard to make, you have a lot of choice from JSON to std/parsecfg to stuff like TOML <https://github.com/NimParsers/parsetoml> |
20:09:38 | FromDiscord | <voidwalker> I used .ini files in my old pascal project |
20:09:52 | FromDiscord | <voidwalker> very 90's, but worked |
20:10:13 | FromDiscord | <Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XN8 |
20:10:28 | FromDiscord | <Yardanico> $ is the general name for a procedure that returns a stringified representation of some type |
20:10:30 | FromDiscord | <Rika> To string proc |
20:10:32 | FromDiscord | <Urothis> (edit) "https://play.nim-lang.org/#ix=3XN8" => "https://play.nim-lang.org/#ix=3XN9" |
20:10:45 | FromDiscord | <Yardanico> all Nim procs/etc expect your type to have `$` to stringify it |
20:11:01 | FromDiscord | <Yardanico> In reply to @voidwalker "very 90's, but worked": if you want something similar to .ini, then std/parsecfg works. If you want a "modern" ini - TOML is fine. JSON works as well, but it's not suitable for configs IMO (no comments!) |
20:11:48 | FromDiscord | <Urothis> And I assume % is some form of append? |
20:11:58 | FromDiscord | <Yardanico> In reply to @Urothis "And I assume %": % is a formatting proc from strutils |
20:12:08 | FromDiscord | <Yardanico> actually if you have the nim extension installed, you can just go-to definition on % |
20:12:30 | FromDiscord | <Yardanico> just hovering over % https://media.discordapp.net/attachments/371759389889003532/975128491974602783/unknown.png |
20:13:00 | FromDiscord | <Yardanico> or ctrl+click to go to the definition |
20:13:21 | FromDiscord | <Yardanico> there's also a more "modern" way of doing string formatting with https://nim-lang.org/docs/strformat.html#limitations |
20:13:25 | FromDiscord | <Yardanico> (edit) "https://nim-lang.org/docs/strformat.html#limitations" => "https://nim-lang.org/docs/strformat.html" |
20:13:50 | FromDiscord | <Urothis> Should have cloned and setup my ide hours ago. Doing that now. |
20:19:55 | FromDiscord | <!Patitotective> In reply to @Yardanico "if you want something": https://patitotective.github.io/niprefs/ 👀 |
20:20:14 | FromDiscord | <Yardanico> sorry, I don't personally like the syntax of it, but maybe voidwalker will :) |
20:20:35 | FromDiscord | <!Patitotective> In reply to @Yardanico "sorry, I don't personally": hehe |
20:21:38 | * | Jjp137 quit (Ping timeout: 260 seconds) |
20:21:56 | * | Jjp137 joined #nim |
20:23:02 | FromDiscord | <Rika> Me neither with the syntax |
20:24:30 | FromDiscord | <!Patitotective> :[ |
20:47:19 | FromDiscord | <exelotl> kdl gud |
20:47:22 | FromDiscord | <exelotl> https://kdl.dev/ |
20:49:00 | FromDiscord | <exelotl> (it's the most promising human-friendly config file format with nesting that I've come across) |
20:50:33 | FromDiscord | <exelotl> if I didn't have nimscript at my disposal I'd probably be using it now |
20:50:33 | FromDiscord | <!Patitotective> it looks really cool |
20:54:21 | * | xet7 quit (Remote host closed the connection) |
20:54:25 | FromDiscord | <!Patitotective> a nim wrapper and ill need to reconsider niprefs lol |
20:54:33 | FromDiscord | <Yardanico> you mean nim implementation :) |
20:54:46 | FromDiscord | <Yardanico> wrapper wraps some existing stuff, you need to actually implement this in Nim |
20:54:51 | * | xet7 joined #nim |
20:55:15 | FromDiscord | <!Patitotective> https://github.com/kdl-org/kdl-rs ? |
20:55:37 | FromDiscord | <Yardanico> would be quite hard to do, and even then the API won't be idiomatic at all |
20:57:08 | FromDiscord | <!Patitotective> In reply to @Patitotective "a nim wrapper and": i mean nim implementation |
20:57:12 | FromDiscord | <Yardanico> yes |
20:59:30 | FromDiscord | <Rika> That looks kinda like XML but not fucked |
21:00:11 | FromDiscord | <Yardanico> In reply to @Rika "That looks kinda like": yes, they explicitly mention that it's quite a lot like XML but without the verboseness |
21:00:14 | FromDiscord | <Yardanico> and not a markup language |
21:00:21 | FromDiscord | <Yardanico> it' |
21:00:23 | FromDiscord | <Yardanico> (edit) "it'" => "it's a fork of https://sdlang.org/" |
21:01:05 | FromDiscord | <Yardanico> but yeah it looks quite good |
21:01:09 | FromDiscord | <!Patitotective> kdl html lmao |
21:10:04 | FromDiscord | <!Patitotective> reading dynamic typed code is a pain |
21:10:14 | FromDiscord | <Yardanico> huh? |
21:10:18 | FromDiscord | <Yardanico> the reference kdl implementation is in rust |
21:11:10 | FromDiscord | <!Patitotective> i mean, like js or python↵https://github.com/bradwoods/7guis-html-css-js/blob/main/docs/cells/index.js#L158 |
21:12:18 | FromDiscord | <System64 ~ Flandre Scarlet> Can I install Nim on Windows XP ? |
21:13:16 | FromDiscord | <Yardanico> нуы |
21:13:20 | FromDiscord | <Yardanico> (edit) "нуы" => "yes" |
21:13:41 | FromDiscord | <Yardanico> are you technisha? |
21:13:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "are you technisha?": wdym? |
21:14:00 | FromDiscord | <Yardanico> no, just a random question, ignore it :) |
21:14:07 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
21:14:12 | FromDiscord | <System64 ~ Flandre Scarlet> How can I do it so? |
21:14:18 | FromDiscord | <Yardanico> In reply to @System64 "How can I do": just install it |
21:15:06 | FromDiscord | <System64 ~ Flandre Scarlet> it says that https://media.discordapp.net/attachments/371759389889003532/975144246468313108/unknown.png |
21:15:26 | FromDiscord | <Yardanico> finish.exe isn't required for the compiler to work, you can manually add Nim to PATH |
21:15:31 | FromDiscord | <Yardanico> check if nim.exe itself works |
21:17:04 | FromDiscord | <System64 ~ Flandre Scarlet> yeah it does |
21:17:25 | FromDiscord | <System64 ~ Flandre Scarlet> so I only have to add the bin folder into PATH? |
21:17:39 | FromDiscord | <Yardanico> yes |
21:17:44 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
21:17:44 | FromDiscord | <Yardanico> also check if nimble works, it might not |
21:18:07 | FromDiscord | <System64 ~ Flandre Scarlet> it displays the help so it works |
21:18:32 | FromDiscord | <Yardanico> well displaying help isn't same as downloading stuff :) but yeah there shouldn't be much issues |
21:20:33 | FromDiscord | <voidwalker> ok, what is the most efficient (least code) way to put string in a file (one per line) into a.. stringlist (array of strings), in nim ? |
21:20:58 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=3XNk |
21:21:18 | FromDiscord | <Yardanico> if you mean just read all strings from a file, `VideoExt = readFile("file.txt")` |
21:21:21 | FromDiscord | <Yardanico> (edit) "`VideoExt" => "`var VideoExt" |
21:21:35 | FromDiscord | <Yardanico> there's really no more "efficient" way of this as you'll have to store the same amount of data anyway |
21:22:00 | FromDiscord | <Yardanico> and you can also split by lines inline with `var VideoExt = readFile("file.txt").splitLines()` although this isn't the most efficient way (but the efficiency is not really noticeable) |
21:26:47 | FromDiscord | <voidwalker> var VideoExt = readFile("file.txt")↵ echo name(type(VideoExt)) |
21:26:49 | FromDiscord | <voidwalker> no go |
21:27:04 | FromDiscord | <Yardanico> In reply to @voidwalker "var VideoExt = readFile("file.txt")": huh? |
21:27:13 | FromDiscord | <voidwalker> wanted to know what type i get |
21:27:24 | FromDiscord | <Yardanico> just a string or you can get an array of strings if you also do splitFile |
21:27:30 | FromDiscord | <Yardanico> not an array, but a sequence |
21:27:50 | FromDiscord | <voidwalker> how do i get its type ? |
21:27:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XNn |
21:28:08 | FromDiscord | <Yardanico> In reply to @voidwalker "how do i get": `typeof`, but why do you want that? |
21:28:17 | FromDiscord | <Yardanico> it'll be just string or seq[string], it won't automatically convert it to some other type |
21:28:23 | FromDiscord | <voidwalker> i wanna see with my own eyes : P |
21:28:27 | FromDiscord | <Yardanico> and you really should be using your IDE Nim extension for things like that :) |
21:28:43 | FromDiscord | <voidwalker> I use vscode + nim extension |
21:28:49 | FromDiscord | <voidwalker> i couldn't find anything better |
21:29:08 | FromDiscord | <Yardanico> yes, nimsaem nim extension with latest nim will show you the type of the variable on hover |
21:29:19 | FromDiscord | <Yardanico> from beef's example https://media.discordapp.net/attachments/371759389889003532/975147825790865428/unknown.png |
21:29:27 | FromDiscord | <Yardanico> `seq[string]` |
21:31:47 | FromDiscord | <voidwalker> I use this : https://marketplace.visualstudio.com/items?itemName=kosz78.nim |
21:32:07 | FromDiscord | <Yardanico> use https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode and install nim 1.6.6 if you haven't already :) |
21:32:24 | FromDiscord | <Yardanico> or if you have nim-git (so the latest devel) that's fine too |
21:33:27 | FromDiscord | <voidwalker> yeah nim-git, cause i couldn't get nim stable in arch |
21:33:37 | FromDiscord | <voidwalker> do i have to uninstall the old nim extension ? the kosz one |
21:33:38 | FromDiscord | <Yardanico> generally to get a stable Nim you install it with `choosenim` |
21:33:40 | FromDiscord | <Yardanico> In reply to @voidwalker "do i have to": yes |
21:33:47 | FromDiscord | <Yardanico> and have you installed nimsuggest ? |
21:33:59 | FromDiscord | <Yardanico> i assume since you're using nim-git from AUR, nimsuggest-git is probably packaged separately, but not sure |
21:34:11 | FromDiscord | <Yardanico> I haven't ever tried AUR packages for Nim, so not sure how good they are |
21:34:49 | FromDiscord | <voidwalker> they worked. i also had to install nimble-git from AUR since I didn't get it with nim-git |
21:34:58 | FromDiscord | <Yardanico> did you install nimsuggest-git then? |
21:35:10 | FromDiscord | <Yardanico> ah nvm, nim-git seems to include it |
21:36:05 | FromDiscord | <voidwalker> not getting any hover pop up :\ |
21:36:19 | FromDiscord | <voidwalker> with the old extension I got a "Loading..." one, now nothing |
21:36:19 | FromDiscord | <Yardanico> actually you need to install nimsuggest-git separately |
21:36:41 | FromDiscord | <Yardanico> because it's a subpackage in nim-git PKGBUILD, so you need to explicitly install it |
21:36:43 | FromDiscord | <voidwalker> great, accidentally cleared compile cache.. recompile nim again : D |
21:37:17 | FromDiscord | <Yardanico> but yeah, Arch way of packaging Nim is quite bad, and it seems like the AUR packages follow the buggy behaviour of the community package |
21:37:47 | FromDiscord | <Yardanico> the part about changing nim compiler flags to always use the ones from makepkg.conf which makes cross-compilation impossible unless you switch these flags back |
21:39:38 | FromDiscord | <voidwalker> community package is 7 months old and nobody updates it |
21:40:09 | * | duuude quit (Ping timeout: 248 seconds) |
21:40:28 | FromDiscord | <Yardanico> In reply to @voidwalker "community package is 7": yes, I know |
21:40:31 | FromDiscord | <Yardanico> so just use choosenim |
21:40:41 | FromDiscord | <voidwalker> ok, after compiling nim and installing nimsuggest, i get the var type in hover : ) |
21:40:55 | FromDiscord | <Yardanico> you installed nim-git which is quite far ahead of stable nim, so it might have different behaviour/procs/etc compared to what you read in stable documentation |
21:41:07 | FromDiscord | <Yardanico> the correct documentation to use for the git nim is http://nim-lang.github.io/Nim/ |
21:41:18 | FromDiscord | <voidwalker> oh well, it will all go to shit again in nim 2.0, so who cares. not like anyone is writing production software in nim : P |
21:41:33 | FromDiscord | <Yardanico> huh? |
21:41:56 | FromDiscord | <Yardanico> nim 2.0 isn't going to be some entirely new language |
21:42:02 | FromDiscord | <voidwalker> i mean v2.0 is supposed to introduce non backward compatible changes |
21:42:10 | FromDiscord | <Yardanico> yes, but not change the whole language and stdlib |
21:45:14 | FromDiscord | <Elegantbeef> Well yea that's how major releases work |
21:45:41 | FromDiscord | <voidwalker> ok, suggestions are a life changer.. I didn't know I missed them, I thought they were just bad : D |
21:46:00 | FromDiscord | <voidwalker> I had some from VS but they were nonsense |
21:49:16 | FromDiscord | <voidwalker> I hope they merge nimble/nimsuggest into the main package when they updated it for arch. less confusion for newbies |
21:49:39 | * | duuude joined #nim |
21:50:52 | FromDiscord | <Yardanico> In reply to @voidwalker "I hope they merge": nim arch package actually provides nimsuggest and all other binaries as well as the compiler |
21:50:59 | FromDiscord | <Yardanico> it's the AUR package that's made different |
21:51:05 | FromDiscord | <Yardanico> an AUR stuff is user contributed |
21:52:55 | FromDiscord | <Yardanico> and yeah @voidwalker the actual newbie way of installing nim is done with choosenim :) |
21:53:30 | FromDiscord | <Yardanico> https://nim-lang.org/install_unix.html , and on windows there are prebuilts available (with a binary that downloads mingw and adds the nim bin folder to path) |
21:59:53 | FromDiscord | <!Patitotective> soooo, i want to parse excel-like formulas , like `=add(A1, sum(2, B2))`↵and i was wondering what was the "best"/easy way, i was thinking of strscans 🤔 |
22:02:10 | FromDiscord | <voidwalker> https://pastebin.com/XGi6DyCB ok most basic stuff, any pointers so far, am I doing it wrong ? |
22:03:43 | FromDiscord | <Yardanico> no need for " of RootObj" if you don't plan on inheriting from `Project` |
22:04:15 | FromDiscord | <Yardanico> and is there a reason why AppConfig is an object but `Project` is a ref object? :) |
22:04:21 | FromDiscord | <Yardanico> also, for path handling you can just use `/` procs |
22:04:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XNr |
22:05:09 | FromDiscord | <voidwalker> cause i will have N projects, created and destroyed dynamically |
22:05:25 | FromDiscord | <Yardanico> and yeah, you really shouldn't use PascalCase for variables since nim has partial case insensitivity, not full like Pascal |
22:05:36 | FromDiscord | <Yardanico> `PascalName` and `pascalName` are different identifiers in Nim because the first character is case sensitive |
22:05:44 | FromDiscord | <voidwalker> oh lol, i had no idea |
22:05:49 | FromDiscord | <Yardanico> so that you can have a type like `Project` and be able to make a variable with the name `project` |
22:06:03 | FromDiscord | <Yardanico> In reply to @voidwalker "cause i will have": is that a response to ref object or "of RootObj" ? |
22:06:20 | FromDiscord | <voidwalker> yes, I read somewhere that's how you make a "class" in nim |
22:06:42 | FromDiscord | <root> What’s nim 2.0 gonna have? Is there a list anywhere? |
22:06:43 | FromDiscord | <voidwalker> but now that I think of it, I don't think it will be inherited |
22:06:46 | FromDiscord | <Elegantbeef> You use inheritance if you need it |
22:06:51 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/RFCs/issues/437 |
22:07:35 | FromDiscord | <voidwalker> I don't know much OOP, it was pretty hard in pascal, didn't have really good docs for it. it was either too dumbed down, or too complex |
22:08:27 | FromDiscord | <voidwalker> Ah and what I like about nim, is that there's you people here and I don't have to wait a day on irc to get a reply so I can move on with the code : D |
22:08:44 | FromDiscord | <voidwalker> or go crazy googling and trying random stuff |
22:08:58 | FromDiscord | <Elegantbeef> There are 11 people here vs. the 5 in pascal 😄 |
22:09:08 | FromDiscord | <Yardanico> and @voidwalker not sure if you want to follow the "main" style guide for Nim? |
22:09:28 | FromDiscord | <Yardanico> in your code it's mainly an issue of spaces :) purely cosmetical of course |
22:09:36 | FromDiscord | <voidwalker> main ? |
22:09:45 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nep1.html |
22:11:13 | FromDiscord | <voidwalker> I wanna follow whatever the standard is for the language, so I don't ruin the aesthetics for others |
22:11:26 | FromDiscord | <Elegantbeef> well nep1 is that |
22:11:44 | FromDiscord | <Elegantbeef> But you can use snake\_case or camelCase it's up to you |
22:13:30 | FromDiscord | <voidwalker> is there a "with" statement in nim, so I don't have to explicitly type the parent title ? |
22:13:44 | FromDiscord | <voidwalker> (edit) "?" => " on every line where I use its members?" |
22:13:51 | FromDiscord | <Recruit_main707> i think so |
22:14:04 | FromDiscord | <Yardanico> https://github.com/zevv/with |
22:14:08 | FromDiscord | <Elegantbeef> `import std/with` |
22:14:22 | FromDiscord | <Yardanico> @beef that behaves differently though |
22:14:47 | FromDiscord | <Elegantbeef> yard why are you writing @beef 😄 |
22:15:10 | FromDiscord | <Yardanico> because you get it anyway :D |
22:15:41 | FromDiscord | <Elegantbeef> It doesnt ping me it's just silly! |
22:15:58 | FromDiscord | <huantian> @beef are you sure |
22:15:59 | FromDiscord | <Yardanico> @ElegantBeef std/with is bad because it appends `x` to _all_ statements inside of `with` |
22:16:14 | FromDiscord | <Yardanico> while zevv/with actually only changes it to allow access to fields of an object/tuple without referring to its variable each tiem |
22:16:15 | FromDiscord | <Yardanico> (edit) "tiem" => "time" |
22:16:39 | FromDiscord | <Elegantbeef> This reminds me of my hacky version of with i made for fun 😄 |
22:21:25 | FromDiscord | <Elegantbeef> It's simple |
22:21:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/28L |
22:25:15 | * | duuude quit (Ping timeout: 260 seconds) |
22:26:25 | * | duuude joined #nim |
22:29:50 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "well displaying help isn't": https://media.discordapp.net/attachments/371759389889003532/975163055161880636/unknown.png |
22:30:14 | FromDiscord | <Yardanico> okay |
22:30:21 | FromDiscord | <Yardanico> why do you want to use it on winxp though? |
22:30:38 | FromDiscord | <Elegantbeef> It's the best windows |
22:32:21 | FromDiscord | <!Patitotective> the best windows is no windows |
22:32:44 | FromDiscord | <Elegantbeef> you mean lindows |
22:33:27 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "why do you want": The best Windows and also, to ensure compatibility |
22:34:23 | FromDiscord | <Yardanico> ok |
22:34:39 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Yardanico "ok": So, my programs can run on very old computers |
22:35:06 | FromDiscord | <Yardanico> but does anyone with a very old computer want to use your programs? 🤔 |
22:35:07 | FromDiscord | <!Patitotective> which programs are you planning to do? 👀 |
22:35:21 | FromDiscord | <Yardanico> and really, it's hard to find a winxp user in 2022 unless it's some hyper corporate environment |
22:35:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Patitotective "which programs are you": a game |
22:35:57 | FromDiscord | <Yardanico> especially for a game :)( |
22:36:04 | FromDiscord | <!Patitotective> what kind of game? 👀 |
22:36:06 | FromDiscord | <Yardanico> i mean if you want it's fine, I just see it as wasted effort |
22:36:08 | FromDiscord | <System64 ~ Flandre Scarlet> a retro-styled game |
22:36:31 | FromDiscord | <System64 ~ Flandre Scarlet> but I'm against programmed obsolescence |
22:36:48 | FromDiscord | <voidwalker> should target win95 then |
22:37:02 | FromDiscord | <Yardanico> In reply to @System64 "but I'm against programmed": winxp isn't programmed obsolescence, it's objectively obsolete |
22:37:13 | FromDiscord | <Yardanico> yeah, target DOS if you really care about obsolescence :) |
22:37:22 | FromDiscord | <System64 ~ Flandre Scarlet> 🤣 |
22:37:38 | FromDiscord | <Elegantbeef> It's end of life'd using it is actively asking for issues |
22:37:39 | FromDiscord | <System64 ~ Flandre Scarlet> I still have a computer that ran with XP |
22:37:45 | FromDiscord | <System64 ~ Flandre Scarlet> but I installed Linux on it |
22:59:16 | FromDiscord | <dom96> In reply to @System64 "": so awesome that it works :D |
23:03:10 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @dom96 "so awesome that it": yeah |
23:07:01 | FromDiscord | <dom96> Nimble does actually have some XP workarounds https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/packageinstaller.nim#L44 |
23:27:45 | FromDiscord | <Zoom> Targeting XP means your program will most probably run on ReactOS with no or minimal fixes. |
23:28:36 | FromDiscord | <Zoom> BTW, did anyone try write anything in Nim for SerenityOS? |
23:29:28 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @dom96 "Nimble does actually have": sus https://media.discordapp.net/attachments/371759389889003532/975178061748265010/unknown.png |
23:29:40 | FromDiscord | <System64 ~ Flandre Scarlet> is SDL2 compatible with Windows XP? |
23:30:04 | FromDiscord | <System64 ~ Flandre Scarlet> Oh wait |
23:30:15 | FromDiscord | <System64 ~ Flandre Scarlet> why does it asks for VCRuntime? |
23:41:36 | * | noeontheend joined #nim |
23:58:31 | FromDiscord | <!Patitotective> ho would i evaluate an arithmetic expression, like `assert eval("1 + 2 2") == 5` |
23:58:56 | FromDiscord | <Elegantbeef> You'd implement a simple parser and evaluator |
23:59:00 | FromDiscord | <Elegantbeef> Or consider using pmunch's stacklang |
23:59:34 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "You'd implement a simple": :[ |
23:59:37 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Or consider using pmunch's": :] |