<< 14-05-2022 >>

00:10:43*rockcavera joined #nim
00:10:43*rockcavera quit (Changing host)
00:10:43*rockcavera joined #nim
00:37:09FromDiscord<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:36FromDiscord<stoneface> shows up like `src/<module_name>`
00:38:46FromDiscord<Elegantbeef> You can try `--project` i think
00:38:46FromDiscord<Elegantbeef> Dont recall if there is a way
00:39:35FromDiscord<stoneface> yup, I'm using the `--project`
00:39:42FromDiscord<stoneface> (edit) "yup, I'm using the `--project` ... " added "switch"
00:41:36FromDiscord<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:11FromDiscord<stoneface> hope I don't have to move everything out of source to the project dir lol
00:42:22FromDiscord<stoneface> (edit) "source" => "src"
00:43:23FromDiscord<Elegantbeef> I do not know
00:46:27FromDiscord<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:58FromDiscord<Elegantbeef> https://github.com/planety/prologue/blob/devel/prologue.nimble#L11-L16 uhh perhaps
00:49:23FromDiscord<Elegantbeef> https://github.com/xflywind/httpx seems it's this
00:49:32FromDiscord<slymilano> interdasting thanks
01:02:07FromDiscord<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:48FromDiscord<Alea> true I guess, I just wish that post-def docs were easier to distinguish from the code and comments below them
01:03:36FromDiscord<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:06FromDiscord<exelotl> Syntax highlighting can help I guess, at least I've seen a few themes that highlight them differently
01:05:52FromDiscord<Alea> which ones?
01:12:54FromDiscord<j-james> man, okay, i'm bashing my head against a wall with this regex module
01:13:08FromDiscord<j-james> sent a code paste, see https://paste.rs/Moo
01:13:15FromDiscord<j-james> what's up with this matching syntax?
01:13:40FromDiscord<Elegantbeef> wasm is a mistake
01:13:41FromDiscord<Elegantbeef> Melting my head fighting wasm here apparently
01:13:41FromDiscord<Elegantbeef> I mean regex 😄
01:14:27FromDiscord<j-james> when it works it works great :-p
01:14:35FromDiscord<j-james> when it doesn't i have no idea what i'm doing wrong
01:16:12FromDiscord<Elegantbeef> Atleast this is hwo i'd do it
01:16:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XHV
01:17:22FromDiscord<j-james> the actual stuff i want to match on is a little more complicated 🙁
01:18:05FromDiscord<j-james> i'd really just like my regex from https://regexr.com/ to work
01:18:27FromDiscord<j-james> but there's something i haven't figured out about what `regex.match()` does
01:18:28FromDiscord<Elegantbeef> Well i dont use regex so i cannot say much
01:22:59FromDiscord<stoneface> so copying the src dir out of the project dir and then running `nim doc...` there fixed it
01:23:23FromDiscord<Elegantbeef> Sounds like a "fix"
01:23:56FromDiscord<stoneface> a "fix" indeed
01:24:26FromDiscord<stoneface> dunno why it's putting the src in the title
01:24:42FromDiscord<Elegantbeef> It's the import path
01:24:48FromDiscord<exelotl> In reply to @Alea "which ones?": Not sure off the top of my head (am on my phone rn)
01:24:57FromDiscord<!Patitotective> you can make a PR and add that wacky option :]
01:27:22FromDiscord<j-james> alright, `for match in findAll(text, re"https:\/\/[\w,\d,\.,\/,\-,_]"): result.add(document[match.boundaries])` did what i wanted
01:27:32FromDiscord<j-james> gonna have to figure out that `match` syntax later though
01:27:56FromDiscord<Elegantbeef> The hell are you matching?
01:29:29FromDiscord<j-james> url-looking things in a markdown document
01:29:37FromDiscord<j-james> `re"https[^\)]"` is probably better 😄
01:29:38FromDiscord<stoneface> In reply to @Elegantbeef "It's the import path": yup, passing -p with the full path of src fixed it, ty
01:32:34FromDiscord<xflywind> In reply to @slymilano "Hey guys, what HTTP": On windows, it uses `std/asynchttpserver`.
01:36:00FromDiscord<!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:29FromDiscord<Elegantbeef> Personally i'd use something more composable but you do you
01:39:14FromDiscord<!Patitotective> how composable? 🤔
01:44:24FromDiscord<Elegantbeef> Something like this
01:44:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XIb
01:44:44FromDiscord<Elegantbeef> you could use `pairs` in the concept but that doesnt work for things like `seq[(string, int)]`
01:45:48FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/8eS
01:47:34FromDiscord<Elegantbeef> YMMV if this is actually a good idea
01:49:03FromDiscord<!Patitotective> i cant find any docs for those _c o n c e p t s_ 🤨
01:49:14FromDiscord<!Patitotective> (edit) "i cant find any docs for those ... _c" added ""
01:49:53FromDiscord<mratsim> In reply to @Patitotective "i cant find any": The experimental manual
01:50:11FromDiscord<!Patitotective> smart
01:50:45FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#concepts
01:50:56FromDiscord<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:22FromDiscord<Elegantbeef> I like my code reuse and explict interfaces 😄
02:07:41FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/m2x
02:07:48FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=3XIf" => "https://paste.rs/myJ"
02:07:56FromDiscord<!Patitotective> (edit) "https://paste.rs/V9T" => "https://play.nim-lang.org/#ix=3XIf"
02:07:58FromDiscord<!Patitotective> (edit)
02:07:59FromDiscord<Elegantbeef> `var a = {0u16..99u16}`
02:08:08FromDiscord<!Patitotective> uhg :[
02:08:11FromDiscord<!Patitotective> thanks _]
02:08:13FromDiscord<!Patitotective> (edit) "_]" => ":]"
02:08:23FromDiscord<Elegantbeef> Also if you only need that range you can do `var a = {range[0..99](0) .. range[0..99](99)}`
02:08:46FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/wzJ
02:11:11FromDiscord<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:10FromDiscord<huantian> I don’t think you need seq[T] if you already have openArray, but it seems like it would work
02:12:30FromDiscord<Elegantbeef> You could use a concept but yes just use an openarray and iterator as seperate APIs
02:12:42FromDiscord<Elegantbeef> You could also use a concept if you want a single proc
02:13:10FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Nzs
02:16:31FromDiscord<Elegantbeef> Ah nvm i guess iterator causes a cgen error
02:17:14FromDiscord<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:39FromDiscord<Elegantbeef> openarray takes `seq` and `array[.., T]`
02:17:50*kayabaNerve quit (Ping timeout: 240 seconds)
02:18:32FromDiscord<salt> nice, that will remove a lot of procs then
02:19:36FromDiscord<Elegantbeef> Welcome to the club of reusable code 😄
02:22:53FromDiscord<salt> now i just need a macro that defines a function for iterator for every one that i have a seq for
02:23:20FromDiscord<Elegantbeef> Eh you can just make a template
02:25:14FromDiscord<huantian> Weird that openArray | iterator doesn’t work
02:25:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XIj
02:25:37FromDiscord<Elegantbeef> It's "technically" correct but 100% silly
02:25:46FromDiscord<Elegantbeef> Nim doesnt do implicit conversions into generics
02:25:56FromDiscord<Elegantbeef> So i mean it's by the book, but fucking dumb
02:26:01*arkurious quit (Quit: Leaving)
02:27:28FromDiscord<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:56FromDiscord<Elegantbeef> Yea that'd work aswell 😄
02:30:21*rockcavera quit (Remote host closed the connection)
02:30:32FromDiscord<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:27FromDiscord<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:04FromDiscord<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:21FromDiscord<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:55FromDiscord<Elegantbeef> use `eqIdent` instead of `== ident"openArray"`
03:25:58FromDiscord<salt> will `== ident"openArray"` fail for, say, `"open_array"`
03:26:51FromDiscord<Elegantbeef> Yes
03:28:25FromDiscord<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:30FromDiscord<Phil> sent a code paste, see https://paste.rs/c6x
06:17:13FromDiscord<Rika> likely that somehow character isnt initialised?
06:17:21FromDiscord<Rika> esp. since its a ref
06:17:32FromDiscord<Rika> i do not know whether new hook handles that
06:17:34FromDiscord<Rika> probably not
06:18:12FromDiscord<Elegantbeef> It does not
06:18:15FromDiscord<Phil> sent a code paste, see https://paste.rs/vJq
06:18:19FromDiscord<Rika> thats an object
06:18:24FromDiscord<Rika> it doesnt need to be "initialised"
06:18:42FromDiscord<xflywind> I remember DateTime cannot be used as the attributes of object/ref object.
06:18:48FromDiscord<Yardanico> yeah @Phil add ` entry = new(Character)`
06:18:55FromDiscord<Yardanico> as a first line in newHook
06:19:13FromDiscord<Phil> Right, ref type vs value type stuff
06:19:19FromDiscord<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:32FromDiscord<Yardanico> it doesn't really "handle" them
06:20:20FromDiscord<Yardanico> sent a code paste, see https://paste.rs/aDk
06:20:29FromDiscord<Rika> in an embedded context
06:20:37FromDiscord<Rika> baremetal
06:20:45FromDiscord<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:51FromDiscord<Yardanico> In reply to @Rika "baremetal": how would that be different?
06:21:39FromDiscord<Rika> i was looking at <https://github.com/knurling-rs/flip-link> and it mentions "unexpected behaviour"
06:21:39FromDiscord<Yardanico> i mean, instead of crashing your program might start doing all sorts of weird stuff, but that's it
06:21:42FromDiscord<Rika> yes
06:21:49FromDiscord<Rika> i would like to prevent that?
06:22:14FromDiscord<Yardanico> maybe there are existing C solutions for that?
06:29:27FromDiscord<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:57FromDiscord<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:09FromDiscord<Phil> Yeh, I do have that in my head when I consciously think about it
06:30:12FromDiscord<Yardanico> and if you didn't initialize the reference it would point to non-existing value (nil)
06:30:18FromDiscord<Phil> It just hasn't become second nature yet to think in those terms
06:31:32FromDiscord<Elegantbeef> Ref is a pointer, pointers are evil return to stack
06:31:57FromDiscord<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:20FromDiscord<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:19FromDiscord<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:56FromDiscord<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:38FromDiscord<demotomohiro> https://forum.nim-lang.org/t/1207
06:35:33FromDiscord<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:37NimEventerNew 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:41FromDiscord<mratsim> In reply to @Rika "this might be a": Compile with the stack-smash flag in GCC
06:49:33FromDiscord<Rika> ill look into that
06:49:35FromDiscord<mratsim> Basically it adds the exit function, nop and after enough nop a jump to a panic function
06:50:10FromDiscord<mratsim> So if you overwrite overflow and rewrite the exit you still reach the panic
06:50:50FromDiscord<Rika> im reading an article about it and it says something else
06:50:58FromDiscord<mratsim> -fstack-protector
06:51:01FromDiscord<Rika> it instead mentions a canary and a check for the canary's value
06:51:11FromDiscord<Rika> no nops here it seems
06:51:28FromDiscord<mratsim> Mmmh possible, there are many related flags
06:52:16FromDiscord<Rika> seems like it uses the canary thing for things with libc?
06:52:30FromDiscord<Rika> oh, libssp
06:52:45FromDiscord<mratsim> Probably need both
06:53:00FromDiscord<mratsim> The canary and the check for the canary can both be overwritten
06:53:35FromDiscord<Rika> this is what im reading
06:53:35FromDiscord<Rika> https://embeddedartistry.com/blog/2020/05/18/implementing-stack-smashing-protection-for-microcontrollers-and-embedded-artistrys-libc/
06:53:43FromDiscord<mratsim> But on embedded you preallocate normally
06:54:19FromDiscord<mratsim> Like you are so constrained that the practical recourse is just coding caefully
06:56:42FromDiscord<Rika> In reply to @mratsim "The canary and the": how does the check get overwritten?
06:56:55FromDiscord<Rika> there's no code on the stack is there? did i forget something
06:57:26FromDiscord<Rika> also the canary is "declared" before any other variables so it cant be overwritten no?
06:57:33FromDiscord<Rika> am i forgetting a lot of things
07:07:09*pro joined #nim
07:08:07FromDiscord<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:22FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XJ0
09:07:06FromDiscord<Elegantbeef> You need to move that Nim string to a cstring if you're going to go across barriers
09:07:17FromDiscord<Elegantbeef> But that doesnt explain why it's null
09:10:55FromDiscord<Elegantbeef> I guess maybe Nim zeroes the string... that'd be odd if true
09:10:56FromDiscord<jmgomez> You can move across different types? Or you mean move it to a local string and then call cstring()
09:11:10FromDiscord<Elegantbeef> I mean allocate space for a cstring and copy to it
09:11:31FromDiscord<Elegantbeef> You need a string that outlives the stack, which means you need to use the heap to store the string
09:11:47FromDiscord<jmgomez> ok, so not move but a copy. Gotcha
09:12:37FromDiscord<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:03FromDiscord<jmgomez> In reply to @Elegantbeef "You say the string": The data I guess, it points to a single 0
09:21:02FromDiscord<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:04FromDiscord<Elegantbeef> Refc has the abillity to make strings live longer but that's gone in orc sadly
09:21:29FromDiscord<jmgomez> I guess if I make a wrapper type it will also work, right?
09:21:32*om3ga joined #nim
09:21:45FromDiscord<Elegantbeef> What?
09:22:05FromDiscord<jmgomez> because in reality I wont be passing naked cstrings around
09:22:31FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/eTb
09:22:43FromDiscord<Elegantbeef> But this requires you to store that reference
09:23:01FromDiscord<jmgomez> I meant like a container that it's also exposed to the FFI
09:23:31FromDiscord<jmgomez> When you assign the cstring to another type it's copied, isnt it?
09:23:44FromDiscord<Elegantbeef> I mean you also can just return a pointer to the above and then call `GCUnref` from a free proc
09:23:56FromDiscord<Elegantbeef> cstrings are never copied
09:24:11FromDiscord<Elegantbeef> They're syntax sugar on `ptr UncheckedArray[char]`
09:24:47FromDiscord<jmgomez> ohh
09:28:15*duuude joined #nim
09:30:32*Zectbumo quit (Remote host closed the connection)
09:37:41FromDiscord<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:04FromDiscord<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:31FromDiscord<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:43FromDiscord<Rika> stack smash protection is complicated lol
12:38:32FromDiscord<Rika> Rather I prolly don’t have the memory layout in my head properly yet
12:38:39FromDiscord<Rika> Probably need to know the specifics more
12:39:27FromDiscord<davis_> sent a long message, see http://ix.io/3XKc
12:40:21FromDiscord<Rika> <@&371760044473319454> lol
12:40:37FromDiscord<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:11FromDiscord<voidwalker> Am I missing something ?
12:42:12FromDiscord<voidwalker> ah, there's a nim-git package as well, installed that too. all good i think
12:42:21FromDiscord<voidwalker> (edit) "nim-git" => "nimble-git"
12:45:17FromDiscord<Phil> In reply to @Rika "<@&371760044473319454> lol": Yard and pmunch must be asleep time for anarchy!
12:45:49FromDiscord<Phil> Quick! Somebody ask a ruby question! Nobody will see it coming!
12:46:55FromDiscord<Rika> How do rust lifetimes work
12:46:56FromDiscord<Rika> Whoops
12:46:58FromDiscord<!Patitotective> In reply to @davis_ "Investing 101\: Stocks and": crypto is the future
12:46:59FromDiscord<Rika> Time to get banned
12:47:15FromDiscord<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:36FromDiscord<Phil> In reply to @Yardanico "I'm at a wedding": Perfect! More time for anarchy!
12:48:00FromDiscord<Rika> In reply to @Yardanico "I'm at a wedding": Congrats to them
12:48:00FromDiscord<Rika> Lol
12:48:38FromDiscord<!Patitotective> In reply to @Rika "Congrats to them": the start of a "happy" life ._.
12:48:51FromDiscord<Phil> In reply to @Yardanico "I'm at a wedding": Oh, Rika is correct, congratulations to those getting married
12:50:23FromDiscord<Yardanico> I banned them, but can't delete the message in matrix for some reason
12:50:45FromDiscord<Yardanico> Thanks↵(@Phil)
12:50:52FromDiscord<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:43FromDiscord<!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:21FromDiscord<Phil> Hmm minor thought, seq types live in heap, right? Since stack variables can't be Re sized?
12:56:53FromDiscord<Phil> Or is a new seq in the stack created with every append?
12:58:06FromDiscord<demotomohiro> pointer (also len in arc/orc) lives in stack but memory area pointed by it lives in heap.
12:58:09FromDiscord<Rika> Heap
12:58:45FromDiscord<Rika> You can “make new variables” in the stack but it’s not recommended I believe
12:59:22FromDiscord<demotomohiro> But if you create a seq[seq[int]] or ref object contains seq, whole seq lives in heap.
12:59:33FromDiscord<demotomohiro> (edit) removed "seq[seq[int]] or"
13:07:12FromDiscord<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:41FromDiscord<Rika> I don’t understand the last part of your question
13:09:05FromDiscord<yttriy> Well
13:10:08FromDiscord<yttriy> You see, in some cases a right log. shift behaves the same as a arithmetic right shift
13:10:18FromDiscord<yttriy> (edit) "a" => "an"
13:10:26FromDiscord<yttriy> With negative numbers
13:11:28FromDiscord<yttriy> But I want RLS always behave as RLS, that is the problem
13:12:16FromDiscord<Rika> Negative numbers in shifts are undefined behaviour like in C
13:13:03FromDiscord<Rika> Or do you mean negative numbers as the one being shifted
13:13:30FromDiscord<Rika> Regular right shift doesn’t act like arithmetic shift in that case, so I’m still not sure what you mean
13:14:39FromDiscord<demotomohiro> !eval echo 255'u8 shr 1
13:14:57FromDiscord<demotomohiro> Is this what you want to do?
13:15:01FromDiscord<Rika> !eval echo -127 shr 1
13:15:14FromDiscord<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:22FromDiscord<Rika> Huh
13:15:44FromDiscord<Rika> Huh.
13:16:09FromDiscord<yttriy> In reply to @yttriy "Maybe i've misunderstood something,": It's not what I was expecting
13:16:13FromDiscord<Rika> Okay
13:16:21FromDiscord<Rika> Cast your negative number into an unsigned
13:16:33FromDiscord<yttriy> (edit) "-4" => "the same as"
13:16:36FromDiscord<Rika> shr is set to ashr for signed integers
13:17:21FromDiscord<Rika> And I do mean cast, a conversion of course wouldn’t work here
13:17:25FromDiscord<demotomohiro> !eval (cast[uint](-4) shr 1), ", ", (-4 ashr 1)
13:17:26NimBotCompile failed: /usercode/in.nim(1, 23) Error: invalid indentation
13:17:35FromDiscord<Rika> ashr isn’t an operator
13:17:40FromDiscord<Rika> Use it like a function
13:18:46FromDiscord<planetis> In reply to @yttriy "Hello, I have a": cast to unsigned first
13:19:50FromDiscord<demotomohiro> !eval echo (cast[uint8](-4'i8) shr 1), ", ", ashr(-4'i8, 1)
13:19:52NimBot126, -2
13:25:25FromDiscord<yttriy> And what does the cast do? (>_< maybe nooby question sorry uwuuwuwuwuwuwuuwuwuwuwuw)
13:26:04FromDiscord<Rika> Reinterpret as another type
13:26:39FromDiscord<demotomohiro> For example, cast[uint8](-4'i8) makes uint8 value that have same bit pattern as -4'i8.
13:30:35FromDiscord<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:02FromDiscord<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:49FromDiscord<yttriy> (edit) "MBS" => "MSB"
13:34:39FromDiscord<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:35FromDiscord<Rika> In reply to @Zoom "Comparing the C FFI": Oh wow Lua lower than C itself lmao
13:35:46FromDiscord<yttriy> In reply to @demotomohiro "cast itself doesn't change": Ah, i see
13:35:54FromDiscord<yttriy> thank you
13:37:26FromDiscord<Rika> Also a really really old Nim version lmao
13:37:37FromDiscord<Rika> Looks like all the versions are really old
13:38:02FromDiscord<demotomohiro> That nim code in the repo is written 4 years ago.
13:39:14FromDiscord<Phil> That's pretty young overall
13:42:20FromDiscord<Rika> That’s around 1/4 of Nim’s life though
13:43:54FromDiscord<Phil> Yeah but that code doesn't even go to pre school
13:44:39FromDiscord<Phil> I've got Java code of drinking age even by us standards at work
13:47:47*arkurious joined #nim
13:47:51FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3XKp
13:51:31FromDiscord<untoreh> is `"someliteralstring"` and `static("someliteralstring")` equivalent?
13:51:47FromDiscord<Rika> Well LTO isn’t enabled since it would be unfair for other languages
13:51:55FromDiscord<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:08FromDiscord<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:26FromDiscord<Forest> Fun fact: `import ../[among,us]` doesn't work-
16:03:44FromDiscord<Forest> (Among us is an example :)
16:07:51dithpriyet another compiler smell smh
16:11:41FromDiscord<!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:54FromDiscord<Rika> It’s the ../ thing again
16:18:59FromDiscord<Rika> You have to quote ..
16:19:03FromDiscord<Rika> It’s a bug
16:20:04*v9fk joined #nim
16:27:12FromDiscord<Bubblie> which class in nim-lang repo is the ../ parsed if I can ask?
16:27:30FromDiscord<Bubblie> pathutil?
16:38:50*duuude quit (Ping timeout: 240 seconds)
16:40:57*noeontheend quit (Ping timeout: 248 seconds)
16:46:03FromDiscord<Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLk
16:46:09FromDiscord<Urothis> (edit) "https://play.nim-lang.org/#ix=3XLl" => "https://paste.rs/AwT"
16:48:30FromDiscord<huantian> It’s just an alias for a unsigned 8 but int, the means it’s public
16:53:13FromDiscord<Urothis> @huantian much appreciated, def not the answer I expected. Much simpler.
16:53:43FromDiscord<huantian> Yeah is an interesting notation, kind of confusing coming from other langs, but is nice and concise
16:54:35FromDiscord<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:41FromDiscord<jmiven> Oberon has it. I'm not sure if it was in Modula
16:56:51FromDiscord<Rika> In reply to @Urothis "Alot of this code": It’s from Oberon
16:57:26*firq joined #nim
16:59:09FromDiscord<kiell> does sequtils not have a find() proc for returning single elements or will i have to write my own?
17:10:11FromDiscord<Rika> https://nim-lang.org/docs/system.html#find%2CT%2CS
17:14:34*duuude joined #nim
17:16:43FromDiscord<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:10FromDiscord<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:43FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLu
17:31:21FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLv
17:31:48FromDiscord<Rika> `somehow produce that proc at compile time` macro xd
17:32:14FromDiscord<Rika> or template
17:32:18FromDiscord<Rika> this looks templateable
17:32:36FromDiscord<Phil> Hmmm
17:32:43FromDiscord<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:55FromDiscord<Rika> not that i know of no
17:33:11FromDiscord<Rika> i dont know if that syntax would work for arrays either so
17:33:32FromDiscord<Rika> that -> [0..5: xvalue, 6..10:yvalue] or something
17:33:37FromDiscord<Rika> i dont think that works ofc
17:35:56FromDiscord<Phil> Wait, wtf
17:36:13FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLw
17:36:14FromDiscord<Phil> ... if that works I'll be highly fascinated
17:37:12FromDiscord<Rika> why wouldnt this compile
17:37:20FromDiscord<Rika> this wont work with more than one entry though
17:37:22FromDiscord<Phil> I never tried templating actually named procs
17:37:59FromDiscord<Rika> In reply to @Rika "this wont work with": since its ambiguous what proc to call if more than one was generated
17:38:51FromDiscord<Phil> That works fine by me, I need one per domain that I have basically
17:39:18FromDiscord<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:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLx
17:46:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3XLB
17:46:29FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3XLB" => "https://paste.rs/3Jm"
17:50:37FromDiscord<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:02FromDiscord<Forest> Ah thanks!
18:24:40FromDiscord<Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLR
18:28:41FromDiscord<Rika> Yes
18:29:07FromDiscord<Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XLT
18:29:23FromDiscord<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:44FromDiscord<Rika> It’s fine
18:31:03FromDiscord<Rika> How do you determine whether a question is dumb or not anyway
18:31:10FromDiscord<Rika> In reply to @Urothis "So converted to rust.": Probably
18:35:55*pro quit (Quit: pro)
18:44:37FromDiscord<Urothis> Running with it, thanks @Rika
18:56:36*noeontheend quit (Ping timeout: 248 seconds)
19:09:25FromDiscord<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:25FromDiscord<Rika> Yeah Nim doesn’t do OOP heavily
19:16:18FromDiscord<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:45FromDiscord<voidwalker> cause what else is oop good for
19:27:33*xet7 quit (Remote host closed the connection)
19:27:42FromDiscord<Yardanico> In reply to @voidwalker "cause what else is": you can do dog.vocalize in Nim without methods
19:27:53FromDiscord<Yardanico> method call syntax (ufcs) is one of the main Nim features
19:27:59FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
19:28:12FromDiscord<Yardanico> basically `b(a)` is the same as `a.b()`
19:28:28FromDiscord<Yardanico> `b(a, c, d)` is the same as `a.b(c, d)`
19:28:44*xet7 joined #nim
19:28:46FromDiscord<!Patitotective> :]
19:29:44FromDiscord<voidwalker> ok, will keep that in mind, for my first refactoring
19:29:58FromDiscord<Yardanico> so you don't need `method` unless you need runtime dispatch
19:30:19FromDiscord<Yardanico> and even then you can use object variants + procs with `case` instead of methods + objects with inheritance for runtime dispatch
19:34:03FromDiscord<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:31FromDiscord<Forest> How do i compile the compiler super quickly purely for development stuff?
19:37:00FromDiscord<Yardanico> In reply to @Forest "How do i compile": `./koch temp`
19:37:28FromDiscord<Yardanico> you basically use it as `./koch temp c file.nim`, anything after `temp` is an argument to the compiler
19:38:10FromDiscord<Forest> Thanks!
19:38:38FromDiscord<Forest> How does it compile nim though?
19:38:44FromDiscord<Yardanico> wdym "how"?
19:38:47FromDiscord<Forest> Like the actual compiler, since that's what i need to do
19:38:51FromDiscord<Yardanico> in debug mode without most optimizations
19:38:55FromDiscord<Forest> Like uh, the command to build it properly
19:39:01FromDiscord<Yardanico> yes, if you want to quickly test and debug the compiler, `./koch temp` is what you need to use
19:39:10FromDiscord<Forest> Ah okay then, thanks!
19:39:14FromDiscord<Yardanico> it builds the compiler and runs it after compiling
19:39:25FromDiscord<Forest> Aight!
19:42:35FromDiscord<voidwalker> what is wrong with this line ? var basePath: string = os.getAppDir
19:43:56FromDiscord<Yardanico> In reply to @voidwalker "what is wrong with": did you import `os` ?
19:44:07FromDiscord<voidwalker> import std/[times, os] I think so
19:44:27FromDiscord<Yardanico> ah yeah, you're making a small mistake - you forgot ()
19:44:43FromDiscord<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:57FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XMZ
19:45:02FromDiscord<Yardanico> and yeah, you don't need to specify the type for variables that you initialize right there
19:45:33FromDiscord<voidwalker> yeah, i just tried a bunch of different things cause i didn't know what's wrong
19:46:26FromDiscord<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:27FromDiscord<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:56FromDiscord<Yardanico> so `getAppDir` was of the type `proc (): string` but your basePath was `string` so it expected a string
19:47:05FromDiscord<Yardanico> In reply to @Rika "Is there anything significant": not sure, maybe it'll require a complete rework of the type system
19:47:13FromDiscord<Yardanico> i'm not good at the type stuff in compiler
19:47:16FromDiscord<Yardanico> (edit) "compiler" => "compilers"
19:48:10FromDiscord<voidwalker> type proc (): string.. nice (wtf)
19:48:22FromDiscord<Yardanico> ?
19:48:22FromDiscord<Rika> Okay, good to know
19:48:29FromDiscord<voidwalker> a procedure that returns a string can be a type ?
19:48:32FromDiscord<Yardanico> of course?
19:48:37FromDiscord<Yardanico> you can assign procedures to variables
19:48:41FromDiscord<Yardanico> since procedures are generally first-class
19:48:43FromDiscord<Rika> Yup Nim has first class functions
19:48:46FromDiscord<Yardanico> you can pass them around in arguments, store in objects, etc
19:48:53FromDiscord<voidwalker> do you do private tutoring @Yardanico ? : D
19:49:05FromDiscord<Yardanico> lol, I haven't tried :D
19:49:09FromDiscord<Rika> In reply to @Rika "Yup Nim has first": Not that it’s uncommon to find nowadays though
19:49:10FromDiscord<Yardanico> don't know if I'm good at teaching
19:49:19FromDiscord<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:34FromDiscord<voidwalker> ok, so now I got a "basePath" that is of type proc (): string
19:50:41FromDiscord<voidwalker> I still don't have a string : D
19:50:47FromDiscord<Rika> You didn’t put the ()
19:50:49FromDiscord<Yardanico> as I said, if you want the string, you do ()
19:50:59FromDiscord<Yardanico> to actually call the proc and assign its _result_ to the variable instead of itself
19:51:08FromDiscord<voidwalker> OOhh now I get what you meant
19:51:37FromDiscord<voidwalker> yeah it's funny learning a new language, feels like it's conspiring against your sanity
19:52:11FromDiscord<Rika> In reply to @voidwalker "yeah it's funny learning": Kinda only for languages that don’t align with those you know
19:52:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN0
19:52:20FromDiscord<Yardanico> In reply to @voidwalker "yeah it's funny learning": hm, but isn't using `()` standard in virtually all languages?
19:52:26FromDiscord<Yardanico> for calling functions I mean
19:52:41FromDiscord<voidwalker> probably, I also haven't coded in 2 years, and was not much of a coder before also
19:54:57FromDiscord<Forest> What's the advantage of using the go gc?
19:56:00FromDiscord<Recruit_main707> go interoperability
19:56:53FromDiscord<Rika> I don’t know anyone who’s tried doing that though
20:02:36FromDiscord<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:57FromDiscord<Yardanico> In reply to @jmgomez "How can you test": they are
20:03:27FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3XN3
20:03:36FromDiscord<Yardanico> In reply to @jmgomez "so this is correct?": yes it is
20:03:36FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN4
20:03:47FromDiscord<jmgomez> thanks!
20:05:44FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=3XN5
20:05:59FromDiscord<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:10FromDiscord<Yardanico> and second of all, you can't assign default values to objects in their definition yet
20:06:40FromDiscord<voidwalker> Guess I should've used let then
20:06:50FromDiscord<Yardanico> nope, it won't work
20:06:55FromDiscord<Yardanico> type definitions don't support variable definitions
20:07:02FromDiscord<Yardanico> you define fields in an object specifically, not variables
20:07:02*jmdaemon joined #nim
20:07:52FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XN6
20:07:56FromDiscord<voidwalker> sent a code paste, see https://paste.rs/or7
20:08:11FromDiscord<Yardanico> `initAppSettings` - `init` because `AppSettings` is an object, so a value type. if it was a `ref object` it would be `newAppSettings`
20:08:36FromDiscord<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:21FromDiscord<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:38FromDiscord<voidwalker> I used .ini files in my old pascal project
20:09:52FromDiscord<voidwalker> very 90's, but worked
20:10:13FromDiscord<Urothis> sent a code paste, see https://play.nim-lang.org/#ix=3XN8
20:10:28FromDiscord<Yardanico> $ is the general name for a procedure that returns a stringified representation of some type
20:10:30FromDiscord<Rika> To string proc
20:10:32FromDiscord<Urothis> (edit) "https://play.nim-lang.org/#ix=3XN8" => "https://play.nim-lang.org/#ix=3XN9"
20:10:45FromDiscord<Yardanico> all Nim procs/etc expect your type to have `$` to stringify it
20:11:01FromDiscord<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:48FromDiscord<Urothis> And I assume % is some form of append?
20:11:58FromDiscord<Yardanico> In reply to @Urothis "And I assume %": % is a formatting proc from strutils
20:12:08FromDiscord<Yardanico> actually if you have the nim extension installed, you can just go-to definition on %
20:12:30FromDiscord<Yardanico> just hovering over % https://media.discordapp.net/attachments/371759389889003532/975128491974602783/unknown.png
20:13:00FromDiscord<Yardanico> or ctrl+click to go to the definition
20:13:21FromDiscord<Yardanico> there's also a more "modern" way of doing string formatting with https://nim-lang.org/docs/strformat.html#limitations
20:13:25FromDiscord<Yardanico> (edit) "https://nim-lang.org/docs/strformat.html#limitations" => "https://nim-lang.org/docs/strformat.html"
20:13:50FromDiscord<Urothis> Should have cloned and setup my ide hours ago. Doing that now.
20:19:55FromDiscord<!Patitotective> In reply to @Yardanico "if you want something": https://patitotective.github.io/niprefs/ 👀
20:20:14FromDiscord<Yardanico> sorry, I don't personally like the syntax of it, but maybe voidwalker will :)
20:20:35FromDiscord<!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:02FromDiscord<Rika> Me neither with the syntax
20:24:30FromDiscord<!Patitotective> :[
20:47:19FromDiscord<exelotl> kdl gud
20:47:22FromDiscord<exelotl> https://kdl.dev/
20:49:00FromDiscord<exelotl> (it's the most promising human-friendly config file format with nesting that I've come across)
20:50:33FromDiscord<exelotl> if I didn't have nimscript at my disposal I'd probably be using it now
20:50:33FromDiscord<!Patitotective> it looks really cool
20:54:21*xet7 quit (Remote host closed the connection)
20:54:25FromDiscord<!Patitotective> a nim wrapper and ill need to reconsider niprefs lol
20:54:33FromDiscord<Yardanico> you mean nim implementation :)
20:54:46FromDiscord<Yardanico> wrapper wraps some existing stuff, you need to actually implement this in Nim
20:54:51*xet7 joined #nim
20:55:15FromDiscord<!Patitotective> https://github.com/kdl-org/kdl-rs ?
20:55:37FromDiscord<Yardanico> would be quite hard to do, and even then the API won't be idiomatic at all
20:57:08FromDiscord<!Patitotective> In reply to @Patitotective "a nim wrapper and": i mean nim implementation
20:57:12FromDiscord<Yardanico> yes
20:59:30FromDiscord<Rika> That looks kinda like XML but not fucked
21:00:11FromDiscord<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:14FromDiscord<Yardanico> and not a markup language
21:00:21FromDiscord<Yardanico> it'
21:00:23FromDiscord<Yardanico> (edit) "it'" => "it's a fork of https://sdlang.org/"
21:01:05FromDiscord<Yardanico> but yeah it looks quite good
21:01:09FromDiscord<!Patitotective> kdl html lmao
21:10:04FromDiscord<!Patitotective> reading dynamic typed code is a pain
21:10:14FromDiscord<Yardanico> huh?
21:10:18FromDiscord<Yardanico> the reference kdl implementation is in rust
21:11:10FromDiscord<!Patitotective> i mean, like js or python↵https://github.com/bradwoods/7guis-html-css-js/blob/main/docs/cells/index.js#L158
21:12:18FromDiscord<System64 ~ Flandre Scarlet> Can I install Nim on Windows XP ?
21:13:16FromDiscord<Yardanico> нуы
21:13:20FromDiscord<Yardanico> (edit) "нуы" => "yes"
21:13:41FromDiscord<Yardanico> are you technisha?
21:13:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @Yardanico "are you technisha?": wdym?
21:14:00FromDiscord<Yardanico> no, just a random question, ignore it :)
21:14:07FromDiscord<System64 ~ Flandre Scarlet> ah alright
21:14:12FromDiscord<System64 ~ Flandre Scarlet> How can I do it so?
21:14:18FromDiscord<Yardanico> In reply to @System64 "How can I do": just install it
21:15:06FromDiscord<System64 ~ Flandre Scarlet> it says that https://media.discordapp.net/attachments/371759389889003532/975144246468313108/unknown.png
21:15:26FromDiscord<Yardanico> finish.exe isn't required for the compiler to work, you can manually add Nim to PATH
21:15:31FromDiscord<Yardanico> check if nim.exe itself works
21:17:04FromDiscord<System64 ~ Flandre Scarlet> yeah it does
21:17:25FromDiscord<System64 ~ Flandre Scarlet> so I only have to add the bin folder into PATH?
21:17:39FromDiscord<Yardanico> yes
21:17:44FromDiscord<System64 ~ Flandre Scarlet> ah alright
21:17:44FromDiscord<Yardanico> also check if nimble works, it might not
21:18:07FromDiscord<System64 ~ Flandre Scarlet> it displays the help so it works
21:18:32FromDiscord<Yardanico> well displaying help isn't same as downloading stuff :) but yeah there shouldn't be much issues
21:20:33FromDiscord<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:58FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=3XNk
21:21:18FromDiscord<Yardanico> if you mean just read all strings from a file, `VideoExt = readFile("file.txt")`
21:21:21FromDiscord<Yardanico> (edit) "`VideoExt" => "`var VideoExt"
21:21:35FromDiscord<Yardanico> there's really no more "efficient" way of this as you'll have to store the same amount of data anyway
21:22:00FromDiscord<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:47FromDiscord<voidwalker> var VideoExt = readFile("file.txt")↵ echo name(type(VideoExt))
21:26:49FromDiscord<voidwalker> no go
21:27:04FromDiscord<Yardanico> In reply to @voidwalker "var VideoExt = readFile("file.txt")": huh?
21:27:13FromDiscord<voidwalker> wanted to know what type i get
21:27:24FromDiscord<Yardanico> just a string or you can get an array of strings if you also do splitFile
21:27:30FromDiscord<Yardanico> not an array, but a sequence
21:27:50FromDiscord<voidwalker> how do i get its type ?
21:27:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3XNn
21:28:08FromDiscord<Yardanico> In reply to @voidwalker "how do i get": `typeof`, but why do you want that?
21:28:17FromDiscord<Yardanico> it'll be just string or seq[string], it won't automatically convert it to some other type
21:28:23FromDiscord<voidwalker> i wanna see with my own eyes : P
21:28:27FromDiscord<Yardanico> and you really should be using your IDE Nim extension for things like that :)
21:28:43FromDiscord<voidwalker> I use vscode + nim extension
21:28:49FromDiscord<voidwalker> i couldn't find anything better
21:29:08FromDiscord<Yardanico> yes, nimsaem nim extension with latest nim will show you the type of the variable on hover
21:29:19FromDiscord<Yardanico> from beef's example https://media.discordapp.net/attachments/371759389889003532/975147825790865428/unknown.png
21:29:27FromDiscord<Yardanico> `seq[string]`
21:31:47FromDiscord<voidwalker> I use this : https://marketplace.visualstudio.com/items?itemName=kosz78.nim
21:32:07FromDiscord<Yardanico> use https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode and install nim 1.6.6 if you haven't already :)
21:32:24FromDiscord<Yardanico> or if you have nim-git (so the latest devel) that's fine too
21:33:27FromDiscord<voidwalker> yeah nim-git, cause i couldn't get nim stable in arch
21:33:37FromDiscord<voidwalker> do i have to uninstall the old nim extension ? the kosz one
21:33:38FromDiscord<Yardanico> generally to get a stable Nim you install it with `choosenim`
21:33:40FromDiscord<Yardanico> In reply to @voidwalker "do i have to": yes
21:33:47FromDiscord<Yardanico> and have you installed nimsuggest ?
21:33:59FromDiscord<Yardanico> i assume since you're using nim-git from AUR, nimsuggest-git is probably packaged separately, but not sure
21:34:11FromDiscord<Yardanico> I haven't ever tried AUR packages for Nim, so not sure how good they are
21:34:49FromDiscord<voidwalker> they worked. i also had to install nimble-git from AUR since I didn't get it with nim-git
21:34:58FromDiscord<Yardanico> did you install nimsuggest-git then?
21:35:10FromDiscord<Yardanico> ah nvm, nim-git seems to include it
21:36:05FromDiscord<voidwalker> not getting any hover pop up :\
21:36:19FromDiscord<voidwalker> with the old extension I got a "Loading..." one, now nothing
21:36:19FromDiscord<Yardanico> actually you need to install nimsuggest-git separately
21:36:41FromDiscord<Yardanico> because it's a subpackage in nim-git PKGBUILD, so you need to explicitly install it
21:36:43FromDiscord<voidwalker> great, accidentally cleared compile cache.. recompile nim again : D
21:37:17FromDiscord<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:47FromDiscord<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:38FromDiscord<voidwalker> community package is 7 months old and nobody updates it
21:40:09*duuude quit (Ping timeout: 248 seconds)
21:40:28FromDiscord<Yardanico> In reply to @voidwalker "community package is 7": yes, I know
21:40:31FromDiscord<Yardanico> so just use choosenim
21:40:41FromDiscord<voidwalker> ok, after compiling nim and installing nimsuggest, i get the var type in hover : )
21:40:55FromDiscord<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:07FromDiscord<Yardanico> the correct documentation to use for the git nim is http://nim-lang.github.io/Nim/
21:41:18FromDiscord<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:33FromDiscord<Yardanico> huh?
21:41:56FromDiscord<Yardanico> nim 2.0 isn't going to be some entirely new language
21:42:02FromDiscord<voidwalker> i mean v2.0 is supposed to introduce non backward compatible changes
21:42:10FromDiscord<Yardanico> yes, but not change the whole language and stdlib
21:45:14FromDiscord<Elegantbeef> Well yea that's how major releases work
21:45:41FromDiscord<voidwalker> ok, suggestions are a life changer.. I didn't know I missed them, I thought they were just bad : D
21:46:00FromDiscord<voidwalker> I had some from VS but they were nonsense
21:49:16FromDiscord<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:52FromDiscord<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:59FromDiscord<Yardanico> it's the AUR package that's made different
21:51:05FromDiscord<Yardanico> an AUR stuff is user contributed
21:52:55FromDiscord<Yardanico> and yeah @voidwalker the actual newbie way of installing nim is done with choosenim :)
21:53:30FromDiscord<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:53FromDiscord<!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:10FromDiscord<voidwalker> https://pastebin.com/XGi6DyCB ok most basic stuff, any pointers so far, am I doing it wrong ?
22:03:43FromDiscord<Yardanico> no need for " of RootObj" if you don't plan on inheriting from `Project`
22:04:15FromDiscord<Yardanico> and is there a reason why AppConfig is an object but `Project` is a ref object? :)
22:04:21FromDiscord<Yardanico> also, for path handling you can just use `/` procs
22:04:55FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3XNr
22:05:09FromDiscord<voidwalker> cause i will have N projects, created and destroyed dynamically
22:05:25FromDiscord<Yardanico> and yeah, you really shouldn't use PascalCase for variables since nim has partial case insensitivity, not full like Pascal
22:05:36FromDiscord<Yardanico> `PascalName` and `pascalName` are different identifiers in Nim because the first character is case sensitive
22:05:44FromDiscord<voidwalker> oh lol, i had no idea
22:05:49FromDiscord<Yardanico> so that you can have a type like `Project` and be able to make a variable with the name `project`
22:06:03FromDiscord<Yardanico> In reply to @voidwalker "cause i will have": is that a response to ref object or "of RootObj" ?
22:06:20FromDiscord<voidwalker> yes, I read somewhere that's how you make a "class" in nim
22:06:42FromDiscord<root> What’s nim 2.0 gonna have? Is there a list anywhere?
22:06:43FromDiscord<voidwalker> but now that I think of it, I don't think it will be inherited
22:06:46FromDiscord<Elegantbeef> You use inheritance if you need it
22:06:51FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/437
22:07:35FromDiscord<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:27FromDiscord<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:44FromDiscord<voidwalker> or go crazy googling and trying random stuff
22:08:58FromDiscord<Elegantbeef> There are 11 people here vs. the 5 in pascal 😄
22:09:08FromDiscord<Yardanico> and @voidwalker not sure if you want to follow the "main" style guide for Nim?
22:09:28FromDiscord<Yardanico> in your code it's mainly an issue of spaces :) purely cosmetical of course
22:09:36FromDiscord<voidwalker> main ?
22:09:45FromDiscord<Yardanico> https://nim-lang.org/docs/nep1.html
22:11:13FromDiscord<voidwalker> I wanna follow whatever the standard is for the language, so I don't ruin the aesthetics for others
22:11:26FromDiscord<Elegantbeef> well nep1 is that
22:11:44FromDiscord<Elegantbeef> But you can use snake\_case or camelCase it's up to you
22:13:30FromDiscord<voidwalker> is there a "with" statement in nim, so I don't have to explicitly type the parent title ?
22:13:44FromDiscord<voidwalker> (edit) "?" => " on every line where I use its members?"
22:13:51FromDiscord<Recruit_main707> i think so
22:14:04FromDiscord<Yardanico> https://github.com/zevv/with
22:14:08FromDiscord<Elegantbeef> `import std/with`
22:14:22FromDiscord<Yardanico> @beef that behaves differently though
22:14:47FromDiscord<Elegantbeef> yard why are you writing @beef 😄
22:15:10FromDiscord<Yardanico> because you get it anyway :D
22:15:41FromDiscord<Elegantbeef> It doesnt ping me it's just silly!
22:15:58FromDiscord<huantian> @beef are you sure
22:15:59FromDiscord<Yardanico> @ElegantBeef std/with is bad because it appends `x` to _all_ statements inside of `with`
22:16:14FromDiscord<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:15FromDiscord<Yardanico> (edit) "tiem" => "time"
22:16:39FromDiscord<Elegantbeef> This reminds me of my hacky version of with i made for fun 😄
22:21:25FromDiscord<Elegantbeef> It's simple
22:21:26FromDiscord<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:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @Yardanico "well displaying help isn't": https://media.discordapp.net/attachments/371759389889003532/975163055161880636/unknown.png
22:30:14FromDiscord<Yardanico> okay
22:30:21FromDiscord<Yardanico> why do you want to use it on winxp though?
22:30:38FromDiscord<Elegantbeef> It's the best windows
22:32:21FromDiscord<!Patitotective> the best windows is no windows
22:32:44FromDiscord<Elegantbeef> you mean lindows
22:33:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @Yardanico "why do you want": The best Windows and also, to ensure compatibility
22:34:23FromDiscord<Yardanico> ok
22:34:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @Yardanico "ok": So, my programs can run on very old computers
22:35:06FromDiscord<Yardanico> but does anyone with a very old computer want to use your programs? 🤔
22:35:07FromDiscord<!Patitotective> which programs are you planning to do? 👀
22:35:21FromDiscord<Yardanico> and really, it's hard to find a winxp user in 2022 unless it's some hyper corporate environment
22:35:49FromDiscord<System64 ~ Flandre Scarlet> In reply to @Patitotective "which programs are you": a game
22:35:57FromDiscord<Yardanico> especially for a game :)(
22:36:04FromDiscord<!Patitotective> what kind of game? 👀
22:36:06FromDiscord<Yardanico> i mean if you want it's fine, I just see it as wasted effort
22:36:08FromDiscord<System64 ~ Flandre Scarlet> a retro-styled game
22:36:31FromDiscord<System64 ~ Flandre Scarlet> but I'm against programmed obsolescence
22:36:48FromDiscord<voidwalker> should target win95 then
22:37:02FromDiscord<Yardanico> In reply to @System64 "but I'm against programmed": winxp isn't programmed obsolescence, it's objectively obsolete
22:37:13FromDiscord<Yardanico> yeah, target DOS if you really care about obsolescence :)
22:37:22FromDiscord<System64 ~ Flandre Scarlet> 🤣
22:37:38FromDiscord<Elegantbeef> It's end of life'd using it is actively asking for issues
22:37:39FromDiscord<System64 ~ Flandre Scarlet> I still have a computer that ran with XP
22:37:45FromDiscord<System64 ~ Flandre Scarlet> but I installed Linux on it
22:59:16FromDiscord<dom96> In reply to @System64 "": so awesome that it works :D
23:03:10FromDiscord<System64 ~ Flandre Scarlet> In reply to @dom96 "so awesome that it": yeah
23:07:01FromDiscord<dom96> Nimble does actually have some XP workarounds https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/packageinstaller.nim#L44
23:27:45FromDiscord<Zoom> Targeting XP means your program will most probably run on ReactOS with no or minimal fixes.
23:28:36FromDiscord<Zoom> BTW, did anyone try write anything in Nim for SerenityOS?
23:29:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @dom96 "Nimble does actually have": sus https://media.discordapp.net/attachments/371759389889003532/975178061748265010/unknown.png
23:29:40FromDiscord<System64 ~ Flandre Scarlet> is SDL2 compatible with Windows XP?
23:30:04FromDiscord<System64 ~ Flandre Scarlet> Oh wait
23:30:15FromDiscord<System64 ~ Flandre Scarlet> why does it asks for VCRuntime?
23:41:36*noeontheend joined #nim
23:58:31FromDiscord<!Patitotective> ho would i evaluate an arithmetic expression, like `assert eval("1 + 2 2") == 5`
23:58:56FromDiscord<Elegantbeef> You'd implement a simple parser and evaluator
23:59:00FromDiscord<Elegantbeef> Or consider using pmunch's stacklang
23:59:34FromDiscord<!Patitotective> In reply to @Elegantbeef "You'd implement a simple": :[
23:59:37FromDiscord<!Patitotective> In reply to @Elegantbeef "Or consider using pmunch's": :]