<< 11-04-2021 >>

00:00:00*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:01:01*njoseph joined #nim
00:32:00FromDiscord<Nisha's alt> So how do i define a function in Nim programmatically?
00:32:13FromDiscord<Nisha's alt> Like, at runtime
00:32:16FromDiscord<Nisha's alt> Is it possible?
00:35:08FromDiscord<ElegantBeef> You dont
00:38:42*jess quit (Quit: K-Lined)
00:38:52*jess joined #nim
00:40:21FromDiscord<konsumlamm> depending on what you want to achieve, you may want to define a closure
00:44:31*axtr joined #nim
00:44:33*axtr quit (Remote host closed the connection)
00:53:45FromDiscord<Nisha's alt> What's a closure? :P
01:00:10FromDiscord<Nisha's alt> :p
01:01:29saemClosures are defined in the manual: https://nim-lang.org/docs/manual.html#procedures-closures there are also closure iterators, again in the manual.
01:01:55FromDiscord<Nisha's alt> Oh okay
01:04:09FromDiscord<Nisha's alt> How does Nimscripter even expose the functions that it does?
01:05:13FromDiscord<exelotl> @Nisha's alt a closure is an anonymous function that captures/holds-on-to local variables that were in scope at the moment when the function was created (they say it "closes over" the scope)
01:05:23FromDiscord<exelotl> example: https://play.nim-lang.org/#ix=2VF1
01:05:37FromDiscord<Nisha's alt> Oh okay!
01:06:28FromDiscord<Nisha's alt> Ah! Makes sense, thanks!
01:18:14FromDiscord<Nisha's alt> How do i set Zig as the C compiler? :P
01:19:20saemThat sounds like a fun thing to try, I thin you want `--cc:` option, see: https://nim-lang.org/docs/nimc.html#compiler-selection
01:24:33FromDiscord<Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VF6
01:25:54saemhmm, is zig's CLI compatible with llvm, gcc, etc?
01:25:57FromDiscord<Nisha's alt> Oh i need to do this command `nim c -f --cc:zig --zig.options.linker:"-target x86_64-windows-gnu" --zig.options.always:"-target x86_64-windows-gnu"`
01:26:12FromDiscord<Nisha's alt> Yeah, it's compatible with llvm
01:26:12saemoh, just specify more, because it can't guess those things.
01:26:27FromDiscord<Nisha's alt> Idk what the Linux alternative for those args are tho
01:26:31FromDiscord<Nisha's alt> For aarch64
01:26:46saemI was going to say you could be sneaky and just symlink or something
01:26:52FromDiscord<Chem> You need to set `cc` to `env` and probably a good handful of other flags too
01:31:02FromDiscord<Nisha's alt> Oh okay
01:31:10FromDiscord<Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VFl
01:31:16FromDiscord<Chem> Change the target to whatever
01:31:18FromDiscord<Chem> (edit) "https://play.nim-lang.org/#ix=2VFl" => "https://paste.rs/Xsl"
01:31:29FromDiscord<Chem> Also works with
01:31:38FromDiscord<Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VFo
01:31:41FromDiscord<Nisha's alt> Oh, thanks!
01:31:57FromDiscord<Nisha's alt> But how would i make it compile for linux aarch64?
01:32:00FromDiscord<Chem> (edit) "https://play.nim-lang.org/#ix=2VFo" => "https://play.nim-lang.org/#ix=2VFq"
01:32:11FromDiscord<Chem> Pass the target triple for linux aarch64
01:32:15FromDiscord<Chem> is that your operating system>?
01:32:16FromDiscord<Chem> (edit) "system>?" => "system?"
01:32:19FromDiscord<Nisha's alt> Yeah
01:32:28FromDiscord<Nisha's alt> Idk how to get the triple target :p
01:32:53FromDiscord<Chem> `zig targets | jq .native`
01:35:00FromDiscord<Nisha's alt> Is this the entire triple? `"aarch64-linux.4.14.116...4.14.116-musl`
01:35:21FromDiscord<Nisha's alt> Or is it only `"aarch64-linux.4.14.116-musl`?
01:40:21FromDiscord<Chem> You want `aarch64-linux-musl`
01:40:32FromDiscord<Nisha's alt> Alright!
01:40:42FromDiscord<Chem> `<architecture>-<operating system>-<ABI>`
01:42:12FromDiscord<nsauzede> when trying to `format nim document` with Nim VScode ext, I get `No 'nimpretty' binary could be found in PATH environment variable`
01:42:27FromDiscord<nsauzede> how can we install/setup `nimpretty` ?
01:43:30FromDiscord<ElegantBeef> how did you install nim?
01:43:44FromDiscord<nsauzede> I built it from (GH) source
01:44:00FromDiscord<nsauzede> and added `nim` bin to my PATH
01:44:10FromDiscord<ElegantBeef> So nimpretty should've been built with it
01:44:16FromDiscord<nsauzede> (doesn't sound cannonical πŸ™‚ )
01:44:21FromDiscord<nsauzede> (edit) "cannonical" => "canonical"
01:44:49FromDiscord<ElegantBeef> Yea if you use `./koch` to build it it should've pooped out `nimpretty`
01:45:04FromDiscord<nsauzede> oof
01:45:06FromDiscord<ElegantBeef> I do suggest using choosenim for installing it to easily change versions
01:45:08FromDiscord<nsauzede> (edit) "oof ... " added "true"
01:46:10FromDiscord<nsauzede> In reply to @ElegantBeef "Yea if you use": I don't remember the commands to build -- I followed the README -- but yeah I do have the nimpretty bin
01:46:23FromDiscord<nsauzede> thanks !
01:46:26FromDiscord<ElegantBeef> No problem
01:46:32FromDiscord<Nisha's alt> :p
01:46:37FromDiscord<Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VG8
01:46:46FromDiscord<Nisha's alt> Probably saying android because I'm using Termux :p
01:46:53FromDiscord<ElegantBeef> choosenim does alias it all so you get nim, nimsuggest, nimpretty all built per version
01:48:15FromDiscord<nsauzede> I don't know what is `choosenim` and I can't find such file in my Nim git workdir
01:48:23FromDiscord<Nisha's alt> sent a code paste, see https://paste.rs/Fbr
01:48:28FromDiscord<ElegantBeef> https://github.com/dom96/choosenim
01:48:42FromDiscord<nsauzede> oh, ok a 3rdparty right
01:48:49FromDiscord<ElegantBeef> Well it's "1st" party
01:48:58FromDiscord<ElegantBeef> Dom is apart of the Nim team
01:49:39FromDiscord<nsauzede> hmm 3rd in the sense : not shipped/available in regular Nim workdir after build πŸ™‚
01:49:50FromDiscord<nsauzede> but I get it πŸ˜‰
01:49:54FromDiscord<ElegantBeef> Yea
01:54:43FromDiscord<Chem> @Nisha's alt What is `znim`
01:55:22FromDiscord<Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGz
01:55:33FromDiscord<Nisha's alt> Just an alias to compile with Zig instead of Clang
01:55:56FromDiscord<Chem> Is `zigcc` a real command πŸ€”
01:56:00FromDiscord<Chem> I thought it was `zig cc`
01:57:02FromDiscord<Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VGB
01:58:05FromDiscord<Nisha's alt> Yeay i did that
01:58:40FromDiscord<Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGC
01:58:49FromDiscord<Nisha's alt> (edit) "https://play.nim-lang.org/#ix=2VGC" => "https://play.nim-lang.org/#ix=2VGD"
01:59:03FromDiscord<Nisha's alt> It fails at the Android glob part
02:00:12FromDiscord<Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGE
02:00:40FromDiscord<Gary M> Oh speaking of the whole super long compiler/linker options my solution has been to use custom nimble tasks for that
02:00:52FromDiscord<Gary M> So I can do `nimble windows release`
02:01:09FromDiscord<Gary M> I think nake would work similarly
02:01:14FromDiscord<Nisha's alt> Hm
02:01:27FromDiscord<Nisha's alt> Yeah i just need to get the compiler actually working first xD
02:01:48*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
02:02:11*njoseph joined #nim
02:02:26FromDiscord<Nisha's alt> Ah
02:02:40FromDiscord<Nisha's alt> It uses `android-glob` when it should be `libandroid-glob`
02:02:45FromDiscord<Nisha's alt> How do i change that?
02:08:40*sagax joined #nim
02:13:55FromDiscord<Nisha's alt> :p
02:33:41FromDiscord<Nisha's alt> No-one?-
03:17:11*waleee-cl quit (Quit: Connection closed for inactivity)
03:20:39FromDiscord<Nisha's alt> :p
03:29:55FromDiscord<exelotl> I guess everyone's asleep πŸ˜…
03:30:40FromDiscord<exelotl> (I'm also asleep, its 4:30am, zzzzzzz)
03:33:52FromDiscord<Nisha's alt> Nah I'm awake~
03:33:56FromDiscord<Nisha's alt> (edit) "awake~" => "awake"
03:33:58FromDiscord<Rika> just put it thru sed lmao
03:34:12FromDiscord<Nisha's alt> Wut?-
03:34:46FromDiscord<Rika> since zigcc is a script you can get the parameters and put that thru sed xdddd
03:35:23FromDiscord<Nisha's alt> Idk how I'd replace the args that are hardcoded into the binary :p
03:38:37*spiderstew_ joined #nim
03:39:19*spiderstew quit (Ping timeout: 260 seconds)
03:40:40FromDiscord<Rika> do you not understand what i mean
03:40:50FromDiscord<Nisha's alt> No-
03:41:08FromDiscord<Nisha's alt> I'm having a hard time reading tone conveyed through text rn
03:41:41FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2VGT
03:42:39FromDiscord<Nisha's alt> Sorry I'm dumb rn
03:42:47FromDiscord<Nisha's alt> I really don't understand πŸ˜…
03:43:19FromDiscord<Nisha's alt> (edit) "I really don't understand ... πŸ˜…" added "what you mean rn"
03:44:33FromDiscord<Rika> then disregard
03:45:17FromDiscord<Nisha's alt> Okay then :p
03:46:36FromDiscord<Mustache Man> something i'm finding with nim's OO is i have tended to name the 1st parameter a single letter
03:47:29FromDiscord<Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VGU
03:47:39FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGU" => "https://play.nim-lang.org/#ix=2VGV"
03:47:41FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGV" => "https://play.nim-lang.org/#ix=2VGW"
03:47:50FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGW" => "https://play.nim-lang.org/#ix=2VGX"
03:48:34FromDiscord<Mustache Man> is there a more idiomatic way?
03:48:34FromDiscord<exelotl> How very golang of you :p
03:49:00FromDiscord<ElegantBeef> Some people prefer `self` i personally prefer writing `node` in that case
03:49:28FromDiscord<Mustache Man> self is the python way πŸ˜›
03:49:32FromDiscord<Nisha's alt> How about `this`?
03:49:32FromDiscord<Mustache Man> i would prefer this
03:49:48FromDiscord<ElegantBeef> i dont like `this` since it's not descriptive enough since we arent class based
03:50:15FromDiscord<Mustache Man> i think they are equally non-descript
03:50:21FromDiscord<Mustache Man> it's just whatever you're used to surely
03:50:22FromDiscord<ElegantBeef> `node` is rather descript
03:50:29FromDiscord<Mustache Man> oh i meant this vs self
03:50:35FromDiscord<exelotl> Yeah I think `node: Node` is what I'd expect to find in the stdlib
03:50:47FromDiscord<ElegantBeef> or for longer words short forms
03:50:59FromDiscord<ElegantBeef> like `ContextManager` might be `ctxMgr` or similar
03:51:19FromDiscord<exelotl> But I too get lazy and write n sometimes in my own project
03:51:33FromDiscord<ElegantBeef> With helper procedures i do tend to default to single variable names
03:51:36FromDiscord<ElegantBeef> (edit) "With helper procedures i do tend to default to single ... variable" added "character"
03:52:00FromDiscord<ElegantBeef> And the stdlib tends to do it aswell
03:52:04FromDiscord<Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VGZ
03:52:21FromDiscord<Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGZ" => "https://play.nim-lang.org/#ix=2VH0"
03:52:23FromDiscord<ElegantBeef> i tend to do `node` there as well, but yea `n` wouldnt be outrageous to me
03:52:57FromDiscord<Mustache Man> well they can't both be node πŸ˜›
03:53:10FromDiscord<ElegantBeef> They can be
03:53:16FromDiscord<ElegantBeef> just would change the view
03:53:26FromDiscord<Mustache Man> the view?
03:53:27FromDiscord<ElegantBeef> Shadowing the parameter in that case is bad
03:53:30FromDiscord<Mustache Man> ah
03:53:56FromDiscord<ElegantBeef> Shadowing is nice but only when it makes sense, so yea in that case `n` or `child` might be more descript
03:55:13FromDiscord<ElegantBeef> A valid use of shadowing is in pmunch's `option_utils` module's `withSome` macro, all non `var` options are unpacked and shadowed by their unpacked values
03:55:29FromDiscord<Mustache Man> thanks for your input everyone
03:55:44FromDiscord<Mustache Man> i have another question. i've been learning nim for about two weeks now
03:55:46FromDiscord<Mustache Man> if i wanted to expand my horizons with Nim, what's a smallish project i could take a look at?
03:56:19FromDiscord<ElegantBeef> You mean looking at a created program or something to work on?
03:56:31FromDiscord<Mustache Man> looking at someone else's work. something that displays how deep the rabbit hole goes
03:56:35FromDiscord<ElegantBeef> Ah
03:56:46FromDiscord<ElegantBeef> Got some gui frameworks like `nigui` or `nimx`
03:56:50FromDiscord<Mustache Man> high level that is, not low-level stuff necessarily
03:57:12FromDiscord<ElegantBeef> Can look at treeforms repos since they're assorted categories and complexities https://github.com/treeform
03:58:10FromDiscord<ElegantBeef> There's a lot of code out there written in Nim from assorted individuals so if you have more precise field that you'd like too look into i might know of a repo there
03:58:33FromDiscord<Mustache Man> wow treeform has a lot of projects
03:58:35FromDiscord<Mustache Man> thank you
03:58:49FromDiscord<ElegantBeef> Yea it's all pretty useful and good code
03:58:58FromDiscord<ElegantBeef> `benchy` is pretty fricken nice
04:01:02FromDiscord<ElegantBeef> Also were you just learning OOP or actively planning on using it?
04:01:22FromDiscord<Mustache Man> i'm using it
04:01:27FromDiscord<Mustache Man> in a simulation
04:02:05FromDiscord<Mustache Man> it's a sort of network traffic simulator
04:02:37FromDiscord<ElegantBeef> It's just always a question to be had when people tend to come from OOP languages πŸ˜„
04:03:24FromDiscord<Mustache Man> my background is mostly Java & R
04:03:24FromDiscord<ElegantBeef> Since depending on what you're doing it could be completely unneeded/unwarranted
04:03:40FromDiscord<ElegantBeef> Yea based of `this` i reasoned C#/Java
04:04:18FromDiscord<Mustache Man> mmhmm. Java's concept of OO is insane, hence why i'm trying to leave it.
04:04:35FromDiscord<ElegantBeef> Everything is a heap allocated object, what could go wrong?!
04:04:56FromDiscord<ElegantBeef> Looks at minecraft performance graphs
04:05:16FromDiscord<Mustache Man> and R on the other hand doesn't properly support OO.
04:06:25FromDiscord<ElegantBeef> And if you ever want a code review there's always atleast one opinionated Nim user around πŸ˜›
04:06:34FromDiscord<Mustache Man> i appreciate that!
04:06:56FromDiscord<Mustache Man> i've managed to 100x the performance of my simulation so far
04:07:10FromDiscord<ElegantBeef> You mean Nim vs. Java?
04:07:32FromDiscord<Mustache Man> ah, no, just from making improvements to my understandings of Nim
04:07:36FromDiscord<ElegantBeef> Ah
04:07:46FromDiscord<ElegantBeef> are you building a release version?
04:07:57FromDiscord<ElegantBeef> That's a common failure of people benchmarking
04:08:14FromDiscord<Mustache Man> What do you mean by a release version?
04:08:18FromDiscord<Rika> -d:release
04:08:22FromDiscord<ElegantBeef> `-d:release` or `-d:danger`
04:08:24FromDiscord<Mustache Man> no
04:08:26FromDiscord<ElegantBeef> Well
04:08:27FromDiscord<Rika> use that
04:08:31FromDiscord<ElegantBeef> Get ready for free performance
04:08:33FromDiscord<Rika> youll see more improvement
04:08:36FromDiscord<Mustache Man> oh my
04:08:40FromDiscord<Mustache Man> i'll give it a shot.
04:08:42FromDiscord<Rika> prolly another 2x to the 100x
04:08:46FromDiscord<Rika> so total 200x prolly
04:08:47FromDiscord<ElegantBeef> even more with `-d:lto` and `--opt:speed`
04:08:54FromDiscord<ElegantBeef> The last should be implied but some times it's not
04:09:34FromDiscord<ElegantBeef> Gary was testing his simd optimized vectors and inline was being the least aggressive feature ever without the `--opt:speed`
04:10:00FromDiscord<ElegantBeef> inb4 "Holy shit speed"
04:11:13FromDiscord<ElegantBeef> We need popups on the manual/tutorial that say "Hey, if you're concerned about performance in any regard, consider building with `-d:release` or `-d:danger`
04:11:15FromDiscord<ElegantBeef> (edit) "`-d:danger`" => "`-d:danger`""
04:11:16FromDiscord<Mustache Man> uhhhh
04:11:23FromDiscord<Mustache Man> it's 15x faster
04:11:27FromDiscord<Mustache Man> o_0
04:11:29FromDiscord<ElegantBeef> Yea
04:11:34FromDiscord<ElegantBeef> Optimizers tend to optimize
04:12:03FromDiscord<Mustache Man> i guess i should have read the compiler guide
04:12:31FromDiscord<ElegantBeef> It's also listed in the tutorial briefly
04:12:44FromDiscord<ElegantBeef> But yea many people miss it so we're here saying "To get free speed dont test a debug build"
04:13:15FromDiscord<ElegantBeef> Like this was a laugh/good read https://github.com/treeform/raytracer/blob/master/nim/story.md
04:14:10FromDiscord<Mustache Man> so then what's the right way to profile?
04:14:26FromDiscord<Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VH4
04:15:18FromDiscord<ElegantBeef> all you need is `--debugger:native` afaik
04:15:37FromDiscord<ElegantBeef> then you can use your profiler and output what you need
04:15:42FromDiscord<Mustache Man> oh forgot to mention i was using nimprof
04:15:54FromDiscord<ElegantBeef> I've never used it so no clue
04:16:05FromDiscord<Mustache Man> ok
04:16:17FromDiscord<ElegantBeef> I've never really profiled code outside benchmarks
04:17:14*vicfred quit (Quit: Leaving)
04:18:50FromDiscord<Mustache Man> Oh another thing- the other day I asked why removing the first element of a list had such poor performance. i did switch over to doubly linked lists for a nice performance boost. but it does seems trivial to increment the pointer to the memory location of the start of the array by one. does nim give access to that?
04:19:14FromDiscord<Rika> dont try it
04:20:14FromDiscord<Mustache Man> but violent explosions are the best way to learn
04:20:17FromDiscord<ElegantBeef> Uhh
04:20:37FromDiscord<ElegantBeef> I dont even know what you're asking, making it so the array `[]` is offset by a value?
04:22:38FromDiscord<Mustache Man> if you have [0, 1, 2, 3], with memory locations of each element at say, 0, 8, 16, 24, then move the pointer referring to the array from 0 to 8... but yeah i guess that does mess with the size of the array, and what to do with 0.. and i have no idea the garbage collection repurcussions
04:23:49FromDiscord<Mustache Man> (edit) "24," => "24. let's say i want to remove the first element: 0. "
04:23:52FromDiscord<ElegantBeef> You could make your own type which moves the pointer than frees it, but you'd have a slowly getting smaller sequence
04:24:09FromDiscord<ElegantBeef> (edit) "than" => "then"
04:24:20FromDiscord<Mustache Man> yes that's okay.
04:24:40FromDiscord<Mustache Man> (edit) "yes that's okay. ... " added "the point is just to make it less expensive to remove that 0th element."
04:24:57FromDiscord<Mustache Man> (edit) "0th element." => "elemtn at index 0"
04:25:01FromDiscord<Mustache Man> (edit) "elemtn" => "elemnt"
04:25:04FromDiscord<Mustache Man> (edit) "elemnt" => "element"
04:25:34FromDiscord<ElegantBeef> Every remove would shrink the collection by 1
04:25:40FromDiscord<ElegantBeef> So you'd have to grow it more often
04:26:04FromDiscord<ElegantBeef> Could you re explain what this sequence was for?
04:26:07FromDiscord<ElegantBeef> (edit) "re explain" => "reexplain"
04:26:10FromDiscord<Mustache Man> perhaps i don't know how sequences maintain their size
04:26:27FromDiscord<Mustache Man> do they grow whenever they exceed a portion of their max capacity?
04:26:30FromDiscord<Rika> sequences kinda look like (size, ptr -> (capacity, ptr -> data))
04:26:32FromDiscord<ElegantBeef> Yes
04:26:39FromDiscord<Rika> i think
04:26:55FromDiscord<ElegantBeef> Close enough rika
04:27:33FromDiscord<Mustache Man> hmm. well it's probably not worth it to me right now
04:28:07FromDiscord<Mustache Man> i was just intrigued and figured it was worth asking about
04:28:19FromDiscord<ElegantBeef> ah actually rika it's (ptr -> size, capacity, ptr -> data)
04:28:26FromDiscord<ElegantBeef> Sequence is the size of a pointer
04:32:00FromDiscord<Rika> In reply to @ElegantBeef "ah actually rika it's": why would the size be in a pointer
04:33:10FromDiscord<ElegantBeef> to make the stack size smaller i presume
04:34:01FromDiscord<ElegantBeef> The size is halved by having two sources of indirection
04:43:28FromDiscord<Rika> oh you're not doing it properly!!!
04:43:40FromDiscord<Rika> (ptr -> (size, capacity), ptr -> data)
04:43:41FromDiscord<Rika> smh
04:44:03FromDiscord<ElegantBeef> ah
04:49:19*vicfred joined #nim
05:24:41FromDiscord<reilly> Has anyone seen aklomp/base64? If these benchmarks are to be believed, it's absurdly fast. https://media.discordapp.net/attachments/371759389889003532/830674695241072640/unknown.png
05:25:45saemWhat do you mean by seen?
05:27:39FromDiscord<reilly> Well, there's no Nim wrapper for it, at least not on nimble.directory, and I'm a little skeptical that someone wouldn't have already wrapped it seeing as it's so brokenly fast unless it's just a little under the radar.
05:28:54FromDiscord<reilly> But hey, what do I know? I don't even need this for anything, I just stumbled across it and was curious if someone had already done the dirty work.
05:29:50saemTreeform does know about it and it was discussed: https://forum.nim-lang.org/t/5363
05:35:55FromDiscord<reilly> Aklomp aside, that thread is interesting. If Treeform made it "just as fast as C," then the benchmark must be out of date, right?
05:36:48saemGuess so
05:39:09FromDiscord<Nisha's alt> What's aklomp?
05:39:45FromDiscord<reilly> In reply to @Charlotte|πŸ’»β­ "What's aklomp?": https://github.com/aklomp/base64/
05:40:03FromDiscord<reilly> Very very fast base64 encoder/decoder.
05:40:03FromDiscord<Nisha's alt> O
05:40:06FromDiscord<Nisha's alt> Nice
06:14:03ForumUpdaterBotNew thread by JPLRouge: Nimview and websocket ---> webwsi , see https://forum.nim-lang.org/t/7774
06:14:32*haxscramper joined #nim
07:29:30*beshr joined #nim
08:01:54FromDiscord<Gary M> hey, how is genSym used?
08:10:37FromDiscord<haxscramper> `let yourVar = genSym(nskVar, "varName")`
08:11:25FromDiscord<haxscramper> Just keep check of where you put the generated symbol - `nskVar`/ `nskLet` / etc. https://nim-lang.org/docs/macros.html#NimSymKind
08:12:06FromDiscord<haxscramper> E.g. don't put `var` symbol in the for loop variable (it should be `nskForVar`) etc.
08:12:15FromDiscord<haxscramper> (edit) "`var`" => "`nskVar`"
08:15:53*vicfred quit (Quit: Leaving)
08:21:46FromDiscord<Gary M> Thanks.
08:22:00FromDiscord<Gary M> I sort of fixed the issue I was having differently.
08:22:13FromDiscord<Gary M> Which was gensym clashes via chained templates
08:22:22*letto quit (Quit: Konversation terminated!)
08:22:33FromDiscord<Gary M> I put them inside a `block:` and it scopes well now
08:27:19*letto joined #nim
08:27:54FromDiscord<hamidb80> i wrote a sha256 algorithm in nim
08:28:23FromDiscord<hamidb80> but it's so damn slow πŸ˜„
08:28:35FromDiscord<hamidb80> can anyone give me a point to make it faster?
08:28:37FromDiscord<hamidb80> https://github.com/hamidb80/nim_days/blob/main/SHA256/sha256.nim
08:30:55FromDiscord<hamidb80> or suggest an article or something
08:33:35*narimiran joined #nim
08:38:27ForumUpdaterBotNew thread by 19: C library with custom build system to Nim, see https://forum.nim-lang.org/t/7775
08:40:06FromDiscord<mratsim> In reply to @hamidb80 "but it's so damn": don't use sequences, don't use strings, don't use seq[bool], sha256 is uint32 based, you don't use uint32?
08:41:16FromDiscord<mratsim> Use throughput, time and cycle benchmarks, it's easier to use throughput (SHA256 per second) as a measure of progress rather than time: https://github.com/mratsim/constantine/blob/master/benchmarks/bench_sha256.nim#L67
08:41:38FromDiscord<mratsim> or https://github.com/status-im/nim-blscurve/blob/master/benchmarks/bench_sha256.nim
08:56:55FromDiscord<GreyGhost> Been googling for a bit, can anyone help me with this error? .nimble/pkgs/bcrypt-0.2.1/bcrypt/blowfish.h:66:35: error: unknown type name 'u_int32_t'; did you mean 'uint32_t'?
09:12:31ForumUpdaterBotNew thread by Japplegame: Trouble with... I don't know :), see https://forum.nim-lang.org/t/7776
09:28:12*lritter joined #nim
09:32:40FromDiscord<hamidb80> In reply to @mratsim "don't use sequences, don't": so, how can i do `rotateRight`/`rotateLeft` with int?
09:33:15FromDiscord<mratsim> In reply to @hamidb80 "so, how can i": https://github.com/mratsim/constantine/blob/master/constantine/hashes/h_sha256.nim#L60-L64
09:33:26*narimiran quit (Quit: leaving)
09:33:29FromDiscord<mratsim> this compiles to a single rol instruction
09:33:37FromDiscord<mratsim> or ror for right
09:35:12*arecaceae quit (Remote host closed the connection)
09:35:31*arecaceae joined #nim
09:36:15FromDiscord<ElegantBeef> Do want to point out that `bitops` does exist if hambid didnt know
09:37:27FromDiscord<Rika> hamidb
09:38:01FromDiscord<ElegantBeef> I swear sometimes i have minor dyslexia since i looked three times to spell it properly
09:38:04FromDiscord<hamidb80> In reply to @ElegantBeef "Do want to point": i really didn't know
09:43:34FromDiscord<hamidb80> πŸ˜„ i don't know why but it makes me laugh https://media.discordapp.net/attachments/371759389889003532/830739840621740052/unknown.png
09:43:54FromDiscord<hamidb80> (edit) "why" => "why."
09:50:49FromDiscord<hamidb80> https://www.youtube.com/watch?v=IB8Yt2dqZbo
09:55:16*mikey2132 joined #nim
10:22:26FromDiscord<jtiai> How do I use bit fields defined with enum? tried `myobject.bitfield.X == 1` but apparently that isn't the right way...
10:25:07FromDiscord<hamidb80> `myobject.bitfield.X.int` i think
10:25:10FromDiscord<eddned> What's the most reliable GUI library for nim?
10:28:03*mikey2132 left #nim ("Leaving")
10:29:31FromDiscord<carpal> sent a code paste, see https://play.nim-lang.org/#ix=2VIF
10:29:39FromDiscord<carpal> (edit) "https://play.nim-lang.org/#ix=2VIF" => "https://play.nim-lang.org/#ix=2VIG"
10:33:00FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VII
10:34:39FromDiscord<Rika> can you give code?
10:34:40FromDiscord<Gary M> In reply to @carpal "is the instance copied": believe so
10:34:53FromDiscord<Rika> In reply to @Gary M "believe so": not if the type is sufficiently large
10:34:55FromDiscord<Rika> i belive
10:35:01FromDiscord<Gary M> unless you have a ref object or that I guess
10:35:01FromDiscord<Rika> believe
10:35:32FromDiscord<Gary M> it would choose when to make those optimizations automagically though and you shouldn't rely on it passing by ref/var if you don't specify it.
10:36:33FromDiscord<Gary M> @jtiai Yeah please show the code.
10:38:48FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VIJ
10:40:09FromDiscord<Rika> thats not how enums work
10:41:20FromDiscord<jtiai> So I should do traditional bit orring like in C?
10:43:20FromDiscord<Gary M> @jtiai did you look at the documentation for bitfields?
10:43:41FromDiscord<jtiai> Yes but it was a bit confusing how I can assign values.
10:44:08FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2VIK
10:44:09FromDiscord<Rika> Flags enum only stores one value
10:44:15FromDiscord<Rika> you use a set if you want a bitfield
10:44:37FromDiscord<konsumlamm> i'm pretty sure those are called (bit)sets and not bitfields
10:44:41FromDiscord<Gary M> yes
10:44:46FromDiscord<Rika> sorry
10:44:58FromDiscord<Rika> im trying to think in two languages at the same time right now
10:45:07FromDiscord<Gary M> more of the actual example : P
10:45:07FromDiscord<Gary M> sent a code paste, see https://paste.rs/NNf
10:45:47FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2VIM
10:45:52FromDiscord<konsumlamm> instead of cast, you should also be able to use `ord` for the first one
10:46:23FromDiscord<jtiai> So I can't do `somefield.somebit = X` ?
10:46:42FromDiscord<konsumlamm> no, but you can to `someset.incl(X)`
10:47:11FromDiscord<jtiai> Ah, so whole enum/bitflags is a bit useless in this case.
10:47:18FromDiscord<konsumlamm> ?
10:47:33FromDiscord<Gary M> no, it's a set of flags
10:47:43FromDiscord<konsumlamm> a `set[T]` is bitflags essentially
10:47:50FromDiscord<jtiai> Such a messy language.
10:47:55FromDiscord<konsumlamm> and the `T` can be an enum
10:48:02FromDiscord<Gary M> what? There's nothing messy about it.
10:48:26FromDiscord<Gary M> just because something you can do in C doesn't directly translate to Nim doesn't make it messy
10:48:30FromDiscord<jtiai> so how I can do `cpu.flags.carry = 1` ?
10:48:56FromDiscord<Gary M> `cpu.flags.incl(carry)`
10:49:05FromDiscord<Gary M> where flags is a set
10:49:13FromDiscord<Gary M> ` MyFlags = set[MyFlag]`
11:04:41*beenz quit (Ping timeout: 240 seconds)
11:06:56FromDiscord<carpal> In reply to @Gary M "believe so": ok so, why not to pass as reference also to x?
11:07:02FromDiscord<carpal> isn't faster?
11:07:22FromDiscord<Gary M> that largely depends on what you're trying to copy
11:07:23FromDiscord<Rika> not always i believe?
11:07:49FromDiscord<carpal> rarely a struct has a size less than 8 bytes
11:07:52FromDiscord<Gary M> if it's a quite large object then sure it might be faster. The compiler would make that decision for you.
11:08:21FromDiscord<Gary M> the choice of using `var` as a parameter at least in my eyes comes down to if you need to mutate the variable or not.
11:08:49FromDiscord<carpal> yes that's its purpose
11:09:01FromDiscord<carpal> but also out of nim
11:09:13FromDiscord<Gary M> implying that performance maybe shouldn't be the consideration here πŸ˜„
11:12:04*beshr quit (Remote host closed the connection)
11:14:26*al1ranger joined #nim
11:18:11*xet7_ joined #nim
11:18:13*xet7 quit (Ping timeout: 252 seconds)
11:18:38*xet7_ quit (Remote host closed the connection)
11:19:15*xet7 joined #nim
11:24:26FromDiscord<madman> does the `--path:` compiler option give the compiler search paths to include nim modules?
11:25:15FromDiscord<carpal> cls
11:25:17FromDiscord<carpal> ops
11:25:18FromDiscord<carpal> lol
11:25:54*al1ranger quit (Quit: Leaving)
11:26:10FromDiscord<madman> ???
11:26:11FromDiscord<madman> xD
11:26:45*xet7 quit (Quit: Leaving)
11:33:46FromDiscord<madman> sent a code paste, see https://play.nim-lang.org/#ix=2VJ9
11:37:48FromDiscord<clyybber> yeah
11:38:23FromDiscord<Gary M> @madman you're a mad man
11:38:31FromDiscord<madman> xD
11:38:45FromDiscord<madman> @Gary M you the G-Man
11:39:35liblq-devrise and shine, mr. freeman
11:39:37FromDiscord<madman> @clyybber i tried but i cannot seem to find where i am in the root
11:39:37liblq-devrise and shine
11:39:58FromDiscord<madman> exactly!
11:40:10FromDiscord<madman> G-Man and the madman
11:40:17FromDiscord<clyybber> In reply to @x19 "<@!107882072974065664> i tried but": hmm, I think it's relative to your CWD
11:40:19FromDiscord<madman> hl3 released
11:40:27liblq-devand the freeman
11:40:30FromDiscord<clyybber> you can make it relative to the config file though
11:41:49FromDiscord<madman> config file okey
11:43:31FromDiscord<carpal> I'm sorry for the off-topic question, is there a way to convert time_point to long long in c++?
11:43:46FromDiscord<carpal> to get nanos without doing time_point - time_point?
11:44:32FromDiscord<carpal> what does the nim's getTicks function wrap?
11:46:03FromDiscord<Rika> you can get nanos by using monotimes
11:47:31FromDiscord<carpal> mhh https://media.discordapp.net/attachments/371759389889003532/830771037678469121/unknown.png
11:48:18FromDiscord<Gary M> int64 should basically be long long no? πŸ˜„
11:49:44FromDiscord<Rika> isnt long long int80 (min int64)?
11:49:49FromDiscord<Rika> "int80" if it existed
11:49:54FromDiscord<Rika> oh wait no
11:49:56FromDiscord<Rika> thats for floats
11:49:58FromDiscord<Rika> me big brain
11:51:04FromDiscord<carpal> In reply to @Rika "isnt long long int80": long long is int64
11:51:14FromDiscord<carpal> long is int32
11:51:23FromDiscord<carpal> no ideas why
11:53:08FromDiscord<Gary M> because that's the contrived descriptor they used for the bit size of ints in C/C++
11:53:22FromDiscord<Gary M> where now it's best not to even use those
11:56:04*filcuc_ joined #nim
11:59:13FromDiscord<nsauzede> is it possible to limit float decimal print format ? (eg: like in C `printf("%.6f")`
11:59:36FromDiscord<nsauzede> in this `stdout.write(&"u={u} v={v}\n")`
11:59:49FromDiscord<Rika> echo &"{thefloat:6}" or something i forget, check docs
12:00:03FromDiscord<nsauzede> thank you
12:00:10FromDiscord<Rika> but theres a :, after that, you can specify stuff
12:00:18FromDiscord<Rika> like in python if youre familiar with that
12:00:51FromDiscord<nsauzede> I quickly grepped `format` in the manual and didn't find something related hence my lazy q here
12:01:58FromDiscord<Rika> https://nim-lang.org/docs/strformat.html#formatting-floats
12:04:22FromDiscord<nsauzede> perfect thx
12:08:10*filcuc_ quit (Ping timeout: 268 seconds)
12:13:40*filcuc_ joined #nim
12:24:03*tane joined #nim
12:31:21FromDiscord<carpal> In reply to @Rika "you can get nanos": ok, I'm using QueryPerformanceCounter but it returns a int64 and I don't known what kind of value it is
12:31:27FromDiscord<carpal> nanos, ticks?
12:32:50FromDiscord<Yardanico> https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter
12:33:31FromDiscord<Yardanico> also, why didn't you just use std/monotimes ?
12:33:48FromDiscord<carpal> because I'm not using nim
12:34:33FromDiscord<Yardanico> you can still check the source code of monotimes
12:38:05FromDiscord<carpal> In reply to @Yardanico "https://docs.microsoft.com/en-us/windows/win32/api/": nothing, it does work well, I've already found these articles and I used them to make the program work, thanks anyway
12:38:54FromDiscord<carpal> In reply to @Yardanico "you can still check": infact, I looked at timers.nim, found QueryPerformanceCounter/Frequency and then I tryed to implement it
12:59:16*WilhelmVonWeiner joined #nim
13:02:12*waleee-cl joined #nim
13:04:35*waleee-cl left #nim (#nim)
13:34:04*Gustavo6046 quit (Remote host closed the connection)
13:39:03FromDiscord<Nisha's alt> Soooo since it's more effort then I'm willing to put in rn, I'm not gonna port Nimscripter to Python as a public project
13:39:18FromDiscord<Nisha's alt> But i am going to use it in my project on it's own
13:41:08*Gustavo6046 joined #nim
13:46:30FromDiscord<haxscramper> If my data structure has cycles is it possible to still use ARC and somehow manage this cycle manually? For example if I have an application that fully no-cycles (but some number of DAG and trees), and I just have a single tiny object that is actually cyclic
13:47:04FromDiscord<mratsim> In reply to @haxscramper "If my data structure": with cursor maybe
14:14:21*PMunch joined #nim
14:27:35Oddmongeri'm using a nim lib (godot nim) which has a file containing only Β«importΒ» orders
14:27:59Oddmongerwhen compiling, i get warnings because they are not used in the file
14:28:51Oddmongeris it possible to make a fake import using in the file ? For killing the warnings
14:29:37*filcuc_ quit (Ping timeout: 252 seconds)
14:30:16Oddmongermaybe exporting them…
14:31:37Oddmongeryes perfect, Β« import mainpanel Β» and then Β« export mainpanel Β» and that's ok ,no more warnings
14:48:33FromDiscord<gollark> So I was looking at using Nim for a thing which will need to parse EPUBs, and I was wondering why there are two XML parsers in the standard library.
14:48:35FromDiscord<gollark> Which one is good?
14:49:09FromDiscord<DavidKunz> sent a code paste, see https://play.nim-lang.org/#ix=2VKf
14:51:33FromDiscord<Yardanico> In reply to @DavidKunz "Hi, is there an": your key name is declared at runtime?
14:51:59FromDiscord<Yardanico> I'd honestly recommend you somewhat changing your code so you don't need to do it in the first place, but you can do it with https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT
14:52:01FromDiscord<DavidKunz> My main task is to make object variants comparable (which unfortunately isn't possible at the moment)
14:52:17FromDiscord<Yardanico> oh, object variants
14:52:58FromDiscord<DavidKunz> `fieldPairs` works great, but I need to compare two objects
14:54:06FromDiscord<Yardanico> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT
14:54:35ForumUpdaterBotNew thread by Mantielero: Arduino with Nim, see https://forum.nim-lang.org/t/7777
14:55:42FromDiscord<DavidKunz> @Yardanico , this doesn't work for case objects 😦
14:55:50FromDiscord<gollark> This seems like a usecase for macros mostly.
14:56:28FromDiscord<gollark> Objects compile to structs, so picking out fields by name at runtime probably won't work.
14:58:34FromDiscord<DavidKunz> Maybe I'm not writing idiomatic Nim, the thing is:↡- I want to have a data structure with object variants↡- When I do that, I immediately lose the possibility to compare two objects which I need for unit tests
14:59:27FromDiscord<Gary M> Comparing 2 objects? Override `=` with the intended functionality
14:59:38FromDiscord<Rika> < you mean?
14:59:39FromDiscord<Rika> and ==?
14:59:46FromDiscord<Gary M> That too
14:59:55FromDiscord<Rika> i dont think you can override =
15:00:01FromDiscord<Rika> i dont recall being able to
15:00:02FromDiscord<DavidKunz> Yes, I tried to overwrite `==` but I'm not sure how to do that without hardcoding all the fields, see https://play.nim-lang.org/#ix=2VKe
15:00:22FromDiscord<Gary M> Pretty sure you can check which variant the object is
15:00:55FromDiscord<Gary M> And then you'd have to manually compare the fields of those variants
15:01:18FromDiscord<DavidKunz> `fieldPairs` doesn't work with object variants
15:01:28FromDiscord<Gary M> So something like if the variants don't match, they're not equal, if the variants match then compare each field manually
15:01:37FromDiscord<konsumlamm> then just hardcode it, where's the problem?
15:01:57FromDiscord<Gary M> The solution doesn't have to be elegant always
15:02:23FromDiscord<DavidKunz> That's true, I was just wondering if there's a more elegant way
15:02:44FromDiscord<DavidKunz> Would be great if the standard library could compare object variants, so I tried to come up with a solution
15:03:44FromDiscord<DavidKunz> Do you think it would make sense to open an RFC?
15:05:42FromDiscord<haxscramper> You can open RFC, maybe adapt API from here https://haxscramper.github.io/hnimast/src/hnimast/obj_field_macros.html#parallelFieldPairs.m%2Ctyped%2Ctyped%2Cuntyped
15:05:52FromDiscord<haxscramper> But honestly my implementation is just unholy abomination
15:06:28FromDiscord<DavidKunz> `macro parallelFieldPairs(lhsObj, rhsObj: typed; body: untyped): untyped` <-- yes, that's exactly what I would need! Thanks!
15:06:46FromDiscord<haxscramper> don't use
15:06:47FromDiscord<haxscramper> it
15:07:01FromDiscord<haxscramper> It's just so badly implemeted internally, this can't be done via macro API
15:07:24FromDiscord<haxscramper> Or rather do use it only with objects that are (1) variant and (2) have all fields exported
15:07:44FromDiscord<haxscramper> For private fields do use `hackPrivateParallelFieldPairs`, but better just don't
15:07:46FromDiscord<DavidKunz> I won't use it, but the idea to have it exactly would solve my problem
15:08:32FromDiscord<DavidKunz> So I could at least write up an RFC with my use case
15:09:19FromDiscord<DavidKunz> (without implementation)
15:09:31FromDiscord<haxscramper> In reply to @DavidKunz "Yes, I tried to": I generally just hardcode all fields, but you can save a lot of typing using approach similar to this:
15:09:39FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2VKz
15:11:13FromDiscord<Yardanico> the time has come https://media.discordapp.net/attachments/371759389889003532/830822300462219274/unknown.png
15:11:42FromDiscord<Rika> wdym
15:11:45FromDiscord<Yardanico> 7777
15:11:48FromDiscord<Rika> oh
15:11:50FromDiscord<Rika> i didnt notice
15:14:42saemHmm, needs more 7s.
15:24:31*SebastianM joined #nim
15:28:23SebastianMHi guys, Could you tell me is there any reason to pass -std=c++17 or other to nim compiler? I don't know which c++ standard nim compiler emits...
15:31:41FromDiscord<haxscramper> IIRC it emits very simple C++ that is very close to C, so there is no reason to pass any C++ flags unless you are interfacing with code that explicitly requires it
15:32:53FromDiscord<haxscramper> So far I've seen it only use exceptions, template syntax for typedef (when using `importcpp` for a template type)
15:34:37SebastianMhaxscramper: thank you for your quick and detailed answer.
15:34:55FromDiscord<Gary M> Something to note is that on windows the gcc that ships with nim is outdated and only goes up to C++14
15:35:07FromDiscord<Gary M> Something like gcc 6.0
15:35:18FromDiscord<Gary M> gcc/g++ :P
15:36:30FromDiscord<Gary M> Which kinda makes Linux the easier platform for building windows with an up-to-date mingw
15:37:04FromDiscord<Gary M> Building to windows
15:37:32SebastianMgary m: yeah, windows has some outdated tools
15:38:06*SebastianM quit (Quit: -a- Bye Bye)
15:38:13FromDiscord<Yardanico> In reply to @haxscramper "IIRC it emits very": sadly that's kind of old news
15:38:20FromDiscord<Yardanico> the default is c++14
15:38:23FromDiscord<Yardanico> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/compiler/extccomp.nim#L89
15:38:59FromDiscord<Yardanico> or idk
15:40:22FromDiscord<Yardanico> there's even a PR that switches it to c++17
15:40:23FromDiscord<Yardanico> https://github.com/nim-lang/Nim/pull/17375
15:43:41FromDiscord<geekrelief> In reply to @Oddmonger "yes perfect, Β« import": You can also use the `warning` pragma to disable warnings
15:44:40FromDiscord<haxscramper> In reply to @Yardanico "the default is c++14": Does it explicitly use any C++14-only constructs?
15:44:53FromDiscord<haxscramper> Like lambdas, or some generic constraints somewhere
15:44:59FromDiscord<haxscramper> Or something like that?
15:45:00cornfeedhoboI really would love for someone to profile the ref counting gc vs some rust application. not sure how to make that apples-to-apples, but it would be very interesting
15:45:49FromDiscord<Yardanico> In reply to @haxscramper "Does it explicitly use": it was switched to c++14 in https://github.com/nim-lang/Nim/pull/13695 I think
15:45:58FromDiscord<Yardanico> before there was no "default" std version for C++
15:46:52FromDiscord<haxscramper> I'm asking if there is anything that would require C++14-or-later?
15:47:26*xace quit (Ping timeout: 240 seconds)
15:48:28leorize[m]cornfeedhobo: usually you need a alloc/dealloc heavy benchmark like havlak
15:48:29FromDiscord<haxscramper> Like nim generating some code that would fail on C++98/C++11 compiler?
15:49:28*xace joined #nim
15:56:05FromDiscord<DavidKunz> Regarding comparable object variants, I created an RFC: https://github.com/nim-lang/RFCs/issues/367
15:57:03ForumUpdaterBotNew question by Filip: How to call function in Nim based on a number without ifs?, see https://stackoverflow.com/questions/67047107/how-to-call-function-in-nim-based-on-a-number-without-ifs
15:58:58*filcuc_ joined #nim
15:58:59FromDiscord<Yardanico> a) I've read ifs are slow(er-ish) among other things (like that novices should leave optimizing them up to the compiler so I know I don't have to even think about it but I would like to try something like this to learn nonetheless)
15:59:11FromDiscord<Yardanico> it's from that video about branchless programming
15:59:13FromDiscord<Yardanico> suddently ifs are slow now
15:59:52FromDiscord<Yardanico> (from that SO question)
15:59:53FromDiscord<Gary M> I did a seq of proc()'s before idk why you couldn't do an array
16:00:13FromDiscord<Yardanico> x > 5 still does "if" inside
16:00:17FromDiscord<Rika> yeah but that would likely be slower than ifs
16:00:21FromDiscord<Yardanico> it has to use comparison
16:00:33FromDiscord<Gary M> @Rika indexing an array?
16:01:44FromDiscord<Rika> calling the proc i believe
16:01:44FromDiscord<Gary M> Regardless it's silly optimization
16:02:02FromDiscord<Gary M> @Rika nah should be just as fast as any nimcall
16:02:19FromDiscord<Tavon> The issue with ifs is when there is a branch misprediction, that's "pretty costly"
16:02:25FromDiscord<Gary M> You can even force it to only accept {.nimcall.} procs so no closures
16:03:00FromDiscord<Gary M> You'd think so but sometimes the alternative is just plain slower @Tavon
16:03:04FromDiscord<Rika> idk dude, i know you're right but ive always the feeling that itd still be slower
16:03:31FromDiscord<Tavon> Well for 2 functions you'd rather do an if, but if you had like 50 functions, a jump table would be better
16:03:46FromDiscord<Tavon> (edit) "Well for 2 functions you'd rather do an if, but if you had like 50 functions, a jump table would be ... better" added "a lot"
16:03:48PMunchAnyone ready for some more keyboard firmware programming?
16:04:30FromDiscord<Gary M> Well you can make an enum indexed array of procedures to have some fucked up jump table I guess idk
16:05:42PMunchStream is live: https://www.twitch.tv/pmunche
16:10:59FromDiscord<Nisha's alt> Is there a way to expose functions to Nimscripter at runtime? Like, it's already defined at compile time, but i wanna actually make it so it can be used after a certain function has been called or something
16:16:08FromDiscord<Nisha's alt> Nvm there's a better way to do what i want
16:17:05FromDiscord<Nisha's alt> Am i able to do something like `let client {.exportToScript.} = myPythonFile.client`?
16:19:19*filcuc_ quit (Read error: No route to host)
16:19:35*filcuc_ joined #nim
16:25:01FromDiscord<Nisha's alt> What modules should i not include in Nimscript, since i don't want it to be able to touch the system at all
16:25:50liblq-devyou should probably ping @ElegantBeef
16:26:12liblq-devprobably the more dangerous ones are io, os
16:26:28liblq-devpossibly also net, httpclient, and such
16:26:36liblq-devdepends on whether you want to allow network connections or not
16:31:20FromDiscord<Yardanico> @liblq-dev beef said that he won't help with that :)
16:41:26FromDiscord<Nisha's alt> Well, this isn't strictly Python related-
16:41:43FromDiscord<Nisha's alt> Since I'm definitely gonna reuse Nimscripter in an actual Nim project when i get home
16:41:57FromDiscord<Nisha's alt> I just wanna know which ones i should remove
16:42:05FromDiscord<Nisha's alt> In reply to @liblq-dev "possibly also net, httpclient,": But thanks!
16:45:11FromDiscord<Nisha's alt> Uhh i have no idea what does what xD
16:45:45FromDiscord<Nisha's alt> Is it safe to remove everything in `pure` (as in move the folder somewhere else and only add in the things i need)
16:47:06FromDiscord<Nisha's alt> (edit) "`pure`" => "`pure`?"
16:47:18FromDiscord<Nisha's alt> Like, what type of things would i actually need to keep
16:47:28FromDiscord<treeform> In reply to @reilly "Aklomp aside, that thread": I think their benchmark out of date. Non nim people always messes up compiling nim in debug mode. My thing was not as fast as aklomp's SIMD version.
16:47:57FromDiscord<treeform> In reply to @Mustache Man "wow treeform has a": I do, if you find a bug, please submit and issue.
16:49:37FromDiscord<treeform> In reply to @ajusa "good point to be": The BOM is stupid, it rarely shows up, but when it does it messes up your day.
16:49:40FromDiscord<haxscramper> In reply to @DavidKunz "Regarding comparable object variants,": Maybe you should change title to "make field pairs work for variant object", because comparison implementation is just a side effect of that
16:50:39FromDiscord<ajusa> In reply to @treeform "The BOM is stupid,": I said that a week ago haha but yeah, it threw me off when I saw it from stdlib
16:52:30FromDiscord<treeform> everyone can't switch to UTF8 fast enough.
16:54:11FromDiscord<Rika> utf8 with bom
17:02:11*Vladar joined #nim
17:03:33FromDiscord<treeform> that does happen
17:04:04FromDiscord<treeform> it supposed to be ignored though as utf8 is not big or little endian dependent.
17:06:50FromDiscord<Rika> still annoying when its encounterrd
17:06:52FromDiscord<Rika> (edit) "encounterrd" => "encountered"
17:12:15FromDiscord<DavidKunz> @haxscramper , thanks for the hint, I will do that!
17:25:12FromDiscord<DavidKunz> @haxscramper one small question: I see that for comparisons it relies on `fields` , does `fields` in the end rely on `fieldPairs`? (the Nim source code doesn't show that: https://github.com/nim-lang/Nim/blob/version-1-4/lib/system/iterators.nim#L246)
17:25:34PMunchAnyone knows how I can add a flexible array at the end of an object in Nim?
17:25:42PMunchhttps://en.wikipedia.org/wiki/Flexible_array_member like this
17:29:05ForumUpdaterBotNew thread by Rozzamarine: NDustman (random URL generator), see https://forum.nim-lang.org/t/7778
17:34:02FromDiscord<haxscramper> In reply to @DavidKunz "<@!608382355454951435> one small question:": `fieldPairs` and `fields` already work for single object iteration - https://play.nim-lang.org/#ix=2VLm
17:34:37FromDiscord<haxscramper> And they are implemented using compiler magic, each one differently
17:34:51FromDiscord<haxscramper> Wait a second, I will pull up the implementation source
17:37:05FromDiscord<haxscramper> Well, not "each one differently", but here is an implementation (at least the part that looks closely related) - https://github.com/nim-lang/Nim/blob/4780b08b9d2b06d20ce45167b2b4d11a816518af/compiler/semfields.nim#L64
17:39:14FromDiscord<DavidKunz> Ok, thank you @hexscramper
17:39:17liblq-devPMunch: yes, `UncheckedArray`
17:39:35FromDiscord<haxscramper> In reply to @DavidKunz "Ok, thank you @hexscramper": I'm still waiting for someone to call be `hex scraper`
17:39:43FromDiscord<haxscramper> (edit) "be" => "me"
17:40:14FromDiscord<DavidKunz> I double checked πŸ™‚
17:40:34FromDiscord<DavidKunz> but only the scamper part
17:44:15m33[m]Hi guys, I've made my first nim program, a simple requester for phishstats.info Rest API... This one is going in production, to replace the python script that I used to run. I feel better with an autonomous 600KB binary compiled with nim, rather that a python environment for this simple task (been broken already once). So if they are nim-lang devs hanging here: thanks :)
17:46:59PMunchliblq-dev, and how would I assign to that in an object constructor?
17:47:09liblq-devgood question
17:47:25liblq-devyou probably need to allocate the memory for the object manually in this case
17:47:25PMunchI just get an error that array[0..0, int16] doesn't match UncheckedArray[int16]
17:47:30PMunchHmm
17:47:36PMunchThat won't work for this..
17:47:36liblq-devjust like in C
17:47:45PMunchSince I need to use PROGMEM
17:48:06FromDiscord<Yardanico> @m33 nice! care if I add the website to https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim ?
17:48:43FromDiscord<Yardanico> oh, I misunderstood what you written, sorry :P
17:49:06FromDiscord<Yardanico> also 600kb might be a little big, did you compile with -d:release ?
17:51:58m33[m]<FromDiscord "<Yardanico> @m33 nice! care if I"> I might if I get a clearance from the management
17:53:06m33[m]<FromDiscord "<Yardanico> also 600kb might be "> I don't know why yet, but nimble build gives me a 575KB binary, whereas nim called by hand with -d:release gives me a 300KB binary (I do have a config.nims file with d release)
17:53:26*filcuc_ quit (Ping timeout: 240 seconds)
17:53:53FromDiscord<Yardanico> -d:release in config.nims doesn't work, that's why :)
17:54:05m33[m]HA!
17:54:08FromDiscord<Yardanico> you must provide it when calling nim/nimble
17:54:13FromDiscord<Yardanico> nimble build -d:release
17:54:17m33[m]Good , that will same be more time searching for this :)
17:54:45FromDiscord<Yardanico> also of course you can get it even smaller after that with "strip -s" - that removes some C-side debugging info
17:54:50m33[m]currious btw, since this config.nims does get the d : ssl right
17:55:49FromDiscord<Yardanico> it'
17:55:56m33[m]<FromDiscord "<Yardanico> also of course you c"> I know, it goes down to 270KB when stripped, but I guess that doesn't worth the hassle of one more line command for such a small binary ;)
17:56:09FromDiscord<Yardanico> it's because -d:release and -d:danger are checked in the main nim config file
17:56:14FromDiscord<Yardanico> and that is evaluated before user configs
17:56:21FromDiscord<Yardanico> see https://github.com/nim-lang/Nim/issues/14272 for more info
17:56:21m33[m]I'm happy enough already to have 1 bin instead of the python stuff
17:57:50FromDiscord<Anuke> > you must provide it when calling nim/nimble↡Strange thing is, when I provide it to nimble when running `nimble install`, it skips building altogether
17:58:14FromDiscord<Yardanico> not sure about nimble, I rarely use it to compile
17:58:21FromDiscord<Yardanico> most of the time I just use "nim" directly
17:59:23FromDiscord<Anuke> I can build it myself, but I'd rather have nimble install it into the right directories
18:00:20FromDiscord<Yardanico> nimble install provides -d:release for binaries by default I think
18:00:32FromDiscord<Anuke> `nimble install -d:danger` doesn't even try to build, while `nimble install` does, which is strange
18:00:36FromDiscord<Anuke> no new warnings either
18:01:29FromDiscord<Solitude> In reply to @Anuke "`nimble install -d:danger` doesn't": `nimble install -p:-d:danger`
18:01:46FromDiscord<Solitude> -d flag is install dependencies only
18:02:00FromDiscord<Solitude> -p is for passing options to compiler
18:03:11FromDiscord<Anuke> oh
18:03:42FromDiscord<Solitude> nimble build and nimble install have different flags
18:05:37PMunchDamn it, ran into the PROGMEM bug again..
18:09:09FromDiscord<Anuke> I get a C memcpy warning when compiling, should I be concerned? <https://play.nim-lang.org/#ix=2VLD>
18:09:30FromDiscord<Solitude> nah
18:15:42FromDiscord<mrotaru> is there a comprehensive guide on how to do async in nim ? So covering things like how to integrate `async` code with callbacks, the meaning of "global dispatcher poll loop", etc
18:20:11*m4r35n357 quit (Quit: Ex-Chat)
18:22:13*vicfred joined #nim
18:25:34*krux02 quit (Ping timeout: 268 seconds)
19:05:36FromDiscord<Goel> nimusggest going crazy, eating 4gb ram with a single VsCodium file opened https://media.discordapp.net/attachments/371759389889003532/830881284967628800/screenshot-from-2021-04-11-20-.png
19:26:17*lritter quit (Ping timeout: 246 seconds)
19:34:25FromDiscord<lamersc> In reply to @Goel "nimusggest going crazy, eating": What’s the difference between vsc and vscodium?
19:35:47*krux02 joined #nim
19:37:08FromDiscord<GE> vscodium is visual studio code with all the microsoft branding and telemetry removed or disabled.
19:37:23FromDiscord<GE> Some plugins won't work with vscodium however.
19:46:00FromDiscord<zetashift> In reply to @Goel "nimusggest going crazy, eating": Yeah nimsuggest tends to do that with certain files/projects, hopefully this year brings some good QoL improvements
19:48:49FromDiscord<nsauzede> In reply to @GE "Some plugins won't work": For now I always managed to somehow install the few extensions I needed -- out of curiosity, what kind of exts won't work ?
19:49:23FromDiscord<GE> https://github.com/VSCodium/vscodium/blob/master/DOCS.md#proprietary-extensions
20:00:54FromDiscord<nsauzede> I see, ok; thanks
20:04:48FromDiscord<nsauzede> Is it possible to convert a float32 to bit-exact binary representation ? are there helpers to convert them ? or should I use some union between a float32 and eg: uint32 ?
20:05:21ForumUpdaterBotNew thread by Mikra: Os:any and Newlib/Newlib-nano, see https://forum.nim-lang.org/t/7779
20:17:49*haxscramper quit (Remote host closed the connection)
20:18:33FromDiscord<sealmove> hi
20:19:01FromDiscord<sealmove> i am trying to read data from a socket but i don't know what number to put in `socket.recv(n)`
20:19:12FromDiscord<sealmove> `socket.recvLine()` works but I don't want to read only 1 line
20:19:31FromDiscord<sealmove> and I don't know how many bytes or lines I'll receive
20:20:09FromDiscord<sealmove> I tried `recv` with a big number but it just blocks
20:21:29FromDiscord<ElegantBeef> @Nisha's alt most of the nim code just wont work due to no cffi in the vm, so pretty much anything that relies on C shouldnt be included
20:22:52FromDiscord<ElegantBeef> In reply to @nsauzede "Is it possible to": you can `cast[uint32](float32)`
20:24:16FromDiscord<ElegantBeef> In reply to @รєคɭ๓๏שє "i am trying to": have you seen https://nim-lang.org/docs/net.html#recv%2CSocket%2Cint it has a timeout you can use to reduce blocking
20:24:56FromDiscord<Mustache Man> is there a better way to get a root? i'm saddened by what i've had to do
20:25:04FromDiscord<ElegantBeef> "get a root"?
20:25:09FromDiscord<Mustache Man> like square root
20:25:27FromDiscord<sealmove> In reply to @ElegantBeef "have you seen https://nim-lang.org/docs/net.html#re": but I am not receiving the data I should
20:25:32FromDiscord<ElegantBeef> !eval import math; echo sqrt(100.0)
20:25:37NimBot10.0
20:25:50FromDiscord<Mustache Man> to do 4^0.5, i have to do 4.float().pow(0.5)
20:26:13FromDiscord<Mustache Man> i don't want to do the float operation
20:26:14FromDiscord<ElegantBeef> !eval import math; echo 4.float.sqrt
20:26:17NimBot2.0
20:26:27FromDiscord<ElegantBeef> Well you can make a sqrt proc then
20:26:36FromDiscord<ElegantBeef> takes in integers and casts them
20:26:54FromDiscord<Mustache Man> i suppose, i feel like the math pow implementation should handle it
20:27:12FromDiscord<Mustache Man> and ^ handles different types as well
20:27:36FromDiscord<ElegantBeef> Well it
20:27:46FromDiscord<ElegantBeef> (edit) "it" => "it's ambigious if you want float64 or 32 from an int sqrt imo"
20:28:58FromDiscord<Mustache Man> hmm why not use a default
20:29:15FromDiscord<Mustache Man> let the user provide an additional argument for what type they would like to receive
20:29:19FromDiscord<Nisha's alt> In reply to @ElegantBeef "<@!524288464422830095> most of the": Okay
20:29:23FromDiscord<ElegantBeef> Well we have generics for that
20:29:28FromDiscord<Mustache Man> pow(4, 0.5, int64)
20:29:33FromDiscord<Mustache Man> (edit) "int64)" => "float64)"
20:30:57FromDiscord<Mustache Man> generics in what sense?
20:31:21FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2VMg
20:31:49FromDiscord<ElegantBeef> Dammit saem ran into typeclass + generic issue writing that example πŸ˜„
20:32:45FromDiscord<ElegantBeef> There is a typedesc with generic resolution but atm which doesnt allow generic + inferred typeclass, which kinda sucks for this type of stuff
20:32:59FromDiscord<ElegantBeef> So i guess the typedesc might be the wisest
20:34:02FromDiscord<konsumlamm> fwiw, instead of `4.float`, you can just do `4.0`
20:34:09FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2VMi
20:34:19FromDiscord<ElegantBeef> Sure but i assume that was a placeholder for an integer
20:34:29FromDiscord<Mustache Man> yes
20:34:39FromDiscord<ElegantBeef> Feel free to submit a PR to the stdlib and write tests for this procedure πŸ˜›
20:35:23FromDiscord<Yardanico> In reply to @konsumlamm "fwiw, instead of `4.float`,": even shorter: 4d
20:35:32FromDiscord<Yardanico> :P
20:36:16FromDiscord<Mustache Man> thanks for this proc
20:36:38FromDiscord<nsauzede> what means `4d` ?
20:36:47FromDiscord<Yardanico> d is a type suffix for float64
20:36:52FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#lexical-analysis-numerical-constants
20:36:54FromDiscord<konsumlamm> eww
20:36:58FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/830904275575898152/unknown.png
20:37:02FromDiscord<konsumlamm> at least use `4'd` :P
20:37:05FromDiscord<nsauzede> oh right `double` πŸ‘
20:37:09FromDiscord<Yardanico> the apostrophe can be omitted
20:37:12FromDiscord<Yardanico> In reply to @konsumlamm "at least use `4'd`": no, why
20:37:30FromDiscord<konsumlamm> it can, but with custom literal suffixes, it can only for builtin suffixes
20:37:49FromDiscord<konsumlamm> so imo it's more consistent to use the '
20:38:00FromDiscord<nsauzede> I find `4.0` more readable πŸ˜›
20:38:52FromDiscord<nsauzede> but TIL, thanks
20:39:22PMunchCan you control where an emit is placed in the C code?
20:39:28FromDiscord<ElegantBeef> yes
20:39:36PMunchThe compiler reorders my code so stuff isn't declared..
20:39:40FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma
20:39:48PMunchI'm streaming right now by the way if you want to help live :P
20:39:54FromDiscord<ElegantBeef> mentions `/TYPESECTION/`
20:41:43FromDiscord<sealmove> how to read from socket until there is nothing more to read? ><
20:41:50FromDiscord<Mustache Man> also seems like ceiling and floor should return an int
20:42:02FromDiscord<ElegantBeef> Nah they generally return floats in most languages
20:42:05FromDiscord<ElegantBeef> They're float operations
20:42:34FromDiscord<ElegantBeef> Without lenientops it'd get annoying
20:42:52FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "how to read from": use an unbuffered socket or recv(1) with a loop to check for if there's data to be read
20:44:30FromDiscord<sealmove> with `newSocket(buffered = false)` it works!!
20:44:40FromDiscord<Yardanico> i know
20:45:46PMunch@ElegantBeef, thanks. Worked a treat
20:45:48FromDiscord<dom96> In reply to @รєคɭ๓๏שє "how to read from": if you're doing this then you're likely following the wrong path πŸ™‚
20:45:58FromDiscord<dom96> why do you think you need to do this?
20:46:09FromDiscord<ElegantBeef> I noticed, there is this live stream someone whored πŸ˜›
20:47:30FromDiscord<Mustache Man> In reply to @ElegantBeef "Nah they generally return": yeah that seems to be true. R returns integers. it is pretty weird sometimes.
20:47:57FromDiscord<ElegantBeef> Yea in most cases it's in the float or double related math so is odd to see int
20:48:07FromDiscord<Mustache Man> then again, R uses a special 'numeric' type that abstracts that away
20:49:17FromDiscord<exelotl> In reply to @exelotl "I don't think dup": Oh I found the answer to this! Needed to define `=copy` and `=sink` instead of just `=`
20:50:17*teasea quit (Quit: teasea)
20:52:19*teasea joined #nim
20:56:52FromDiscord<exelotl> if only @clyybber was here yesterday I bet he could have told me that x)
20:56:57FromDiscord<sealmove> In reply to @dom96 "if you're doing this": Why? If you mean there are more high level api, I know. I am doing something very basic, so I don't need more fancy stuff.
20:57:11FromDiscord<sealmove> Basically doing programmatically what I would do with netcat
20:57:19*ckafi[m] joined #nim
21:08:05FromGitter<awr1> question: is there a reason overflows at compiletime don't seem to raise? they seem to just crash and are unrecoverable
21:08:10FromGitter<awr1> example https://play.nim-lang.org/#ix=2VMA
21:08:43FromDiscord<dom96> @sealmove if you're doing netcat-y stuff then it may be appropriate, usually people are trying to implement a protocol and those pretty much always have message delimiters
21:09:00FromGitter<awr1> the compiler says it's an overflow in the proper location sure enough i'm just curious why nothing seems to raise
21:13:08FromDiscord<ElegantBeef> does it still error in `-d:danger`?
21:13:25FromDiscord<ElegantBeef> Oh nevermind i see
21:19:02*NimBot joined #nim
21:20:45*xet7 joined #nim
21:35:40*tane quit (Quit: Leaving)
21:40:20*Vladar quit (Quit: Leaving)
22:25:07FromDiscord<clyybber> In reply to @exelotl "if only <@!107882072974065664> was": Oh damn, I think I even read your message but somehow thought you figured it out :D
22:25:38*PMunch quit (Quit: leaving)
22:25:58FromDiscord<clyybber> =copy is = btw, better to use =copy though, ideally we want to keep = free as a general operator
22:26:53FromDiscord<exelotl> yep, I remember that part :)
22:26:57FromDiscord<exelotl> just forgot that =sink exists
22:31:16FromDiscord<Nisha's alt> NLVM isn't being updated anymore? :P
22:31:32FromDiscord<Nisha's alt> Or is it just gonna be slow to reimplement everything
22:31:40FromDiscord<Nisha's alt> And that's why it's slow (in terms of development)
22:31:49FromDiscord<clyybber> In reply to @Charlotte|πŸ’»β­ "NLVM isn't being updated": it is, just in less frequent batches
22:32:15FromDiscord<Nisha's alt> Oh okay
22:51:24FromDiscord<Nisha's alt> Kinda wanna make a shitty language now lmao
22:51:42FromDiscord<Nisha's alt> Hm...
22:54:47FromDiscord<exelotl> I made a super crappy language for uni once
22:55:19FromDiscord<exelotl> spent more time fighting the ocaml compiler than making the language :(
22:55:25FromDiscord<Nisha's alt> Lmao
22:56:39FromDiscord<GE> What's the most reliable cross platform (works on BSD, linux, mac, and windows) GUI for nim?
22:57:00FromDiscord<Nisha's alt> Probably nimx (i think that's what it's called) iirc
23:05:34FromDiscord<rosewood> Trying this out: https://peterme.net/how-to-embed-nimscript-into-a-nim-program-embedding-nimscript-pt-2.html - can't get nim to find `compiler` can anyone help? I'm on nim 1.5.1 with nimble 0.13.1 with `nimble install compiler@#head` - did something change since this blogpost?
23:06:20FromDiscord<ElegantBeef> No it should still work
23:06:41FromDiscord<ElegantBeef> Though you might want to checkout nimscripter for a easier experience in life
23:07:00FromDiscord<ElegantBeef> But either way yea it really should work
23:08:12FromDiscord<rosewood> Interesting - also do you know if it is actually possible to compile the "nimscript" to an object file to be loaded by the application? i.e. to have the best of both worlds
23:08:54FromDiscord<ElegantBeef> Well it's just nim code, so if you take it and throw it in the compiler with the binary(assuming you expose the api properly) it'll just work
23:09:38FromDiscord<ElegantBeef> But no nimscripter atleast doesnt support turning the nimscript into compiled code out of the box
23:14:13FromDiscord<rosewood> sent a long message, see https://paste.rs/xvt
23:14:38FromDiscord<rosewood> (edit) "http://ix.io/2VN0" => "http://ix.io/2VMZ"
23:14:54FromDiscord<ElegantBeef> Yea i dont think that's possible atm, due to how nimscript communicates, you'd need to replicate that exposed API in native code
23:14:59FromDiscord<ElegantBeef> It's not a too crazy idea
23:16:08FromDiscord<ElegantBeef> I have a slightly outdated video explaining nimscripter, but it's relatively simple
23:16:14FromDiscord<Nisha's alt> Wouldn't Nimscripter allow for this? You'd probably have to modify it a tiny but it seems quite versitile :p (Beef will know more though-)
23:16:25FromDiscord<ElegantBeef> Well you need to expose the api
23:16:53FromDiscord<ElegantBeef> So without that exposed api, it doesnt help much, plus you'd have to change the loading logic and that requires recompiling the code
23:17:27FromDiscord<ElegantBeef> Since one does `loadScript` and the other needs to do some dynamic library logic
23:17:47FromDiscord<ElegantBeef> It's probably worthwhile to just look at Nim's HCR or a plugin system for your example
23:18:24FromDiscord<ElegantBeef> Nimscript's VM is slow and copies all objects so isnt overly intuitive to work with for gameplay
23:18:58FromDiscord<rosewood> In reply to @ElegantBeef "Nimscript's VM is slow": kinda surprising that it's slow considering it's a register-based VM
23:19:11FromDiscord<ElegantBeef> I dont think optimizing it is on anyones priority
23:19:24FromDiscord<ElegantBeef> Got other more important thing the people that are capable are working on πŸ˜„
23:19:48FromDiscord<rosewood> wouldn't improving nimscript improve compilation times (w.r.t macros ofc)?
23:19:57FromDiscord<rosewood> surprised it's not a priority
23:21:50FromDiscord<ElegantBeef> Well IC is currently being worked on
23:21:59FromDiscord<rosewood> IC?
23:22:03FromDiscord<ElegantBeef> Incremental compilation
23:22:25FromDiscord<ElegantBeef> Which would make the hot code reloading less of a tedious thing
23:23:47FromDiscord<ElegantBeef> I said this yesterday and it's still true, i do eventually plan on profiling it to see where the performance is an issue πŸ˜„
23:24:04FromDiscord<ElegantBeef> But i'm just a numpty so take that with a grain of salt
23:25:48*Gustavo6046 quit (Remote host closed the connection)
23:26:33*Gustavo6046 joined #nim
23:31:02FromDiscord<rosewood> from my impressions on the talk for hot code reloading - it seems more appropriate for the development process and seems to give a big hit on performance (3-4x). In my situation I am thinking of just extensions/plugins (with interactivity).↡↡But.. perhaps hot code reloading does fit this need, i.e. would it work with a separate "plugin" as a dll/library file?
23:32:21FromDiscord<ElegantBeef> Well you could use a plugin system or HCR
23:32:30FromDiscord<ElegantBeef> I was uncertain what the overall desired endgoal was
23:34:17FromDiscord<ElegantBeef> https://github.com/genotrance/plugins seems like it might hit what you need
23:42:07FromDiscord<rosewood> sent a long message, see http://ix.io/2VN8
23:43:42FromDiscord<ElegantBeef> Well ideally you'd expose the plugins the sameway you expose the nimscript code then in then it wouldnt be too much of a hassle to use a plugin system
23:44:05FromDiscord<ElegantBeef> I dont see seemless running the nim compiler on a nimscript file to get a usable binary
23:44:15FromDiscord<ElegantBeef> But someone smarter than i might have an idea
23:44:34FromDiscord<Nisha's alt> ;)
23:44:56FromDiscord<Nisha's alt> ~~Use YAML as the scripting language, adding logic and everything lmao-~~
23:45:02FromDiscord<Nisha's alt> /j btw
23:45:11FromDiscord<Nisha's alt> Please don't do this, even I wouldn't
23:45:24FromDiscord<ElegantBeef> Of course you wouldnt you didnt mention python or java
23:45:42FromDiscord<Nisha's alt> Lmaooo
23:45:55FromDiscord<Nisha's alt> I'll do this JUST BECAUSE you said that now :)
23:46:32FromDiscord<ElegantBeef> No you wont, you'll say you'll do it spend a few minutes on it then jump to the next silly idea
23:46:41FromDiscord<Nisha's alt> Lmao-
23:46:51FromDiscord<Nisha's alt> You know me too well /hj
23:46:59FromDiscord<Nisha's alt> Though it's doable in Python easily
23:47:12FromDiscord<Nisha's alt> Nim is another story, since it's compiled, so i can't do it all dynamically
23:47:20FromDiscord<ElegantBeef> I mean it's super easy in Nim
23:47:56FromDiscord<Nisha's alt> Really? Dynamically calling existing functions?
23:48:06FromDiscord<ElegantBeef> Well yea you expose all the functions with a macro
23:48:17FromDiscord<Nisha's alt> Meh cnba for that-
23:48:33FromDiscord<Nisha's alt> ~~I'll just make a YAML to Nim transpiler-~~
23:49:24FromDiscord<Nisha's alt> ~~And I'll make the transpiler in Python-~~
23:50:10FromDiscord<Nisha's alt> Wait, does nim check actually work well compared to actually compiling the code?
23:50:19FromDiscord<Nisha's alt> Does it show all possible compilation errors?
23:50:43FromDiscord<ElegantBeef> it does if you tell it to
23:50:51FromDiscord<ElegantBeef> `nimcheck --errorMax:100`
23:50:57FromDiscord<ElegantBeef> `nim c --errorMax:100`
23:50:58FromDiscord<Nisha's alt> Why 100? :P
23:51:11FromDiscord<ElegantBeef> I mean i'm just showing how to get more errors
23:51:15FromDiscord<Nisha's alt> O
23:56:36FromDiscord<ElegantBeef> @rosewood all in all, hopefully someone with more than 1 braincell can answer the best way to handle this πŸ˜„
23:57:04FromDiscord<rosewood> I think I can probably figure it out
23:57:20FromDiscord<rosewood> Just need to get `import compiler` working haha
23:57:27FromDiscord<rosewood> so maybe I wont be able to aylmao
23:57:50FromDiscord<ElegantBeef> Is the compiler erroring or just your editor?
23:57:56FromDiscord<rosewood> compiler
23:58:54FromDiscord<rosewood> I'm on macos - I am using choosenim to install nim on devel branch. I'm currently trying to install nim via HEAD - might turn to compiling the compiler manually
23:59:04FromDiscord<rosewood> via `--HEAD` with homebrew
23:59:22FromDiscord<rosewood> I am thinking choosenim is just not working properly on macos
23:59:32FromDiscord<rosewood> but it seems to be the correct version when doing nim -v