00:00:00 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:01:01 | * | njoseph joined #nim |
00:32:00 | FromDiscord | <Nisha's alt> So how do i define a function in Nim programmatically? |
00:32:13 | FromDiscord | <Nisha's alt> Like, at runtime |
00:32:16 | FromDiscord | <Nisha's alt> Is it possible? |
00:35:08 | FromDiscord | <ElegantBeef> You dont |
00:38:42 | * | jess quit (Quit: K-Lined) |
00:38:52 | * | jess joined #nim |
00:40:21 | FromDiscord | <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:45 | FromDiscord | <Nisha's alt> What's a closure? :P |
01:00:10 | FromDiscord | <Nisha's alt> :p |
01:01:29 | saem | Closures 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:55 | FromDiscord | <Nisha's alt> Oh okay |
01:04:09 | FromDiscord | <Nisha's alt> How does Nimscripter even expose the functions that it does? |
01:05:13 | FromDiscord | <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:23 | FromDiscord | <exelotl> example: https://play.nim-lang.org/#ix=2VF1 |
01:05:37 | FromDiscord | <Nisha's alt> Oh okay! |
01:06:28 | FromDiscord | <Nisha's alt> Ah! Makes sense, thanks! |
01:18:14 | FromDiscord | <Nisha's alt> How do i set Zig as the C compiler? :P |
01:19:20 | saem | That 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:33 | FromDiscord | <Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VF6 |
01:25:54 | saem | hmm, is zig's CLI compatible with llvm, gcc, etc? |
01:25:57 | FromDiscord | <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:12 | FromDiscord | <Nisha's alt> Yeah, it's compatible with llvm |
01:26:12 | saem | oh, just specify more, because it can't guess those things. |
01:26:27 | FromDiscord | <Nisha's alt> Idk what the Linux alternative for those args are tho |
01:26:31 | FromDiscord | <Nisha's alt> For aarch64 |
01:26:46 | saem | I was going to say you could be sneaky and just symlink or something |
01:26:52 | FromDiscord | <Chem> You need to set `cc` to `env` and probably a good handful of other flags too |
01:31:02 | FromDiscord | <Nisha's alt> Oh okay |
01:31:10 | FromDiscord | <Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VFl |
01:31:16 | FromDiscord | <Chem> Change the target to whatever |
01:31:18 | FromDiscord | <Chem> (edit) "https://play.nim-lang.org/#ix=2VFl" => "https://paste.rs/Xsl" |
01:31:29 | FromDiscord | <Chem> Also works with |
01:31:38 | FromDiscord | <Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VFo |
01:31:41 | FromDiscord | <Nisha's alt> Oh, thanks! |
01:31:57 | FromDiscord | <Nisha's alt> But how would i make it compile for linux aarch64? |
01:32:00 | FromDiscord | <Chem> (edit) "https://play.nim-lang.org/#ix=2VFo" => "https://play.nim-lang.org/#ix=2VFq" |
01:32:11 | FromDiscord | <Chem> Pass the target triple for linux aarch64 |
01:32:15 | FromDiscord | <Chem> is that your operating system>? |
01:32:16 | FromDiscord | <Chem> (edit) "system>?" => "system?" |
01:32:19 | FromDiscord | <Nisha's alt> Yeah |
01:32:28 | FromDiscord | <Nisha's alt> Idk how to get the triple target :p |
01:32:53 | FromDiscord | <Chem> `zig targets | jq .native` |
01:35:00 | FromDiscord | <Nisha's alt> Is this the entire triple? `"aarch64-linux.4.14.116...4.14.116-musl` |
01:35:21 | FromDiscord | <Nisha's alt> Or is it only `"aarch64-linux.4.14.116-musl`? |
01:40:21 | FromDiscord | <Chem> You want `aarch64-linux-musl` |
01:40:32 | FromDiscord | <Nisha's alt> Alright! |
01:40:42 | FromDiscord | <Chem> `<architecture>-<operating system>-<ABI>` |
01:42:12 | FromDiscord | <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:27 | FromDiscord | <nsauzede> how can we install/setup `nimpretty` ? |
01:43:30 | FromDiscord | <ElegantBeef> how did you install nim? |
01:43:44 | FromDiscord | <nsauzede> I built it from (GH) source |
01:44:00 | FromDiscord | <nsauzede> and added `nim` bin to my PATH |
01:44:10 | FromDiscord | <ElegantBeef> So nimpretty should've been built with it |
01:44:16 | FromDiscord | <nsauzede> (doesn't sound cannonical π ) |
01:44:21 | FromDiscord | <nsauzede> (edit) "cannonical" => "canonical" |
01:44:49 | FromDiscord | <ElegantBeef> Yea if you use `./koch` to build it it should've pooped out `nimpretty` |
01:45:04 | FromDiscord | <nsauzede> oof |
01:45:06 | FromDiscord | <ElegantBeef> I do suggest using choosenim for installing it to easily change versions |
01:45:08 | FromDiscord | <nsauzede> (edit) "oof ... " added "true" |
01:46:10 | FromDiscord | <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:23 | FromDiscord | <nsauzede> thanks ! |
01:46:26 | FromDiscord | <ElegantBeef> No problem |
01:46:32 | FromDiscord | <Nisha's alt> :p |
01:46:37 | FromDiscord | <Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VG8 |
01:46:46 | FromDiscord | <Nisha's alt> Probably saying android because I'm using Termux :p |
01:46:53 | FromDiscord | <ElegantBeef> choosenim does alias it all so you get nim, nimsuggest, nimpretty all built per version |
01:48:15 | FromDiscord | <nsauzede> I don't know what is `choosenim` and I can't find such file in my Nim git workdir |
01:48:23 | FromDiscord | <Nisha's alt> sent a code paste, see https://paste.rs/Fbr |
01:48:28 | FromDiscord | <ElegantBeef> https://github.com/dom96/choosenim |
01:48:42 | FromDiscord | <nsauzede> oh, ok a 3rdparty right |
01:48:49 | FromDiscord | <ElegantBeef> Well it's "1st" party |
01:48:58 | FromDiscord | <ElegantBeef> Dom is apart of the Nim team |
01:49:39 | FromDiscord | <nsauzede> hmm 3rd in the sense : not shipped/available in regular Nim workdir after build π |
01:49:50 | FromDiscord | <nsauzede> but I get it π |
01:49:54 | FromDiscord | <ElegantBeef> Yea |
01:54:43 | FromDiscord | <Chem> @Nisha's alt What is `znim` |
01:55:22 | FromDiscord | <Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGz |
01:55:33 | FromDiscord | <Nisha's alt> Just an alias to compile with Zig instead of Clang |
01:55:56 | FromDiscord | <Chem> Is `zigcc` a real command π€ |
01:56:00 | FromDiscord | <Chem> I thought it was `zig cc` |
01:57:02 | FromDiscord | <Chem> sent a code paste, see https://play.nim-lang.org/#ix=2VGB |
01:58:05 | FromDiscord | <Nisha's alt> Yeay i did that |
01:58:40 | FromDiscord | <Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGC |
01:58:49 | FromDiscord | <Nisha's alt> (edit) "https://play.nim-lang.org/#ix=2VGC" => "https://play.nim-lang.org/#ix=2VGD" |
01:59:03 | FromDiscord | <Nisha's alt> It fails at the Android glob part |
02:00:12 | FromDiscord | <Nisha's alt> sent a code paste, see https://play.nim-lang.org/#ix=2VGE |
02:00:40 | FromDiscord | <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:52 | FromDiscord | <Gary M> So I can do `nimble windows release` |
02:01:09 | FromDiscord | <Gary M> I think nake would work similarly |
02:01:14 | FromDiscord | <Nisha's alt> Hm |
02:01:27 | FromDiscord | <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:26 | FromDiscord | <Nisha's alt> Ah |
02:02:40 | FromDiscord | <Nisha's alt> It uses `android-glob` when it should be `libandroid-glob` |
02:02:45 | FromDiscord | <Nisha's alt> How do i change that? |
02:08:40 | * | sagax joined #nim |
02:13:55 | FromDiscord | <Nisha's alt> :p |
02:33:41 | FromDiscord | <Nisha's alt> No-one?- |
03:17:11 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:20:39 | FromDiscord | <Nisha's alt> :p |
03:29:55 | FromDiscord | <exelotl> I guess everyone's asleep π
|
03:30:40 | FromDiscord | <exelotl> (I'm also asleep, its 4:30am, zzzzzzz) |
03:33:52 | FromDiscord | <Nisha's alt> Nah I'm awake~ |
03:33:56 | FromDiscord | <Nisha's alt> (edit) "awake~" => "awake" |
03:33:58 | FromDiscord | <Rika> just put it thru sed lmao |
03:34:12 | FromDiscord | <Nisha's alt> Wut?- |
03:34:46 | FromDiscord | <Rika> since zigcc is a script you can get the parameters and put that thru sed xdddd |
03:35:23 | FromDiscord | <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:40 | FromDiscord | <Rika> do you not understand what i mean |
03:40:50 | FromDiscord | <Nisha's alt> No- |
03:41:08 | FromDiscord | <Nisha's alt> I'm having a hard time reading tone conveyed through text rn |
03:41:41 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2VGT |
03:42:39 | FromDiscord | <Nisha's alt> Sorry I'm dumb rn |
03:42:47 | FromDiscord | <Nisha's alt> I really don't understand π
|
03:43:19 | FromDiscord | <Nisha's alt> (edit) "I really don't understand ... π
" added "what you mean rn" |
03:44:33 | FromDiscord | <Rika> then disregard |
03:45:17 | FromDiscord | <Nisha's alt> Okay then :p |
03:46:36 | FromDiscord | <Mustache Man> something i'm finding with nim's OO is i have tended to name the 1st parameter a single letter |
03:47:29 | FromDiscord | <Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VGU |
03:47:39 | FromDiscord | <Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGU" => "https://play.nim-lang.org/#ix=2VGV" |
03:47:41 | FromDiscord | <Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGV" => "https://play.nim-lang.org/#ix=2VGW" |
03:47:50 | FromDiscord | <Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGW" => "https://play.nim-lang.org/#ix=2VGX" |
03:48:34 | FromDiscord | <Mustache Man> is there a more idiomatic way? |
03:48:34 | FromDiscord | <exelotl> How very golang of you :p |
03:49:00 | FromDiscord | <ElegantBeef> Some people prefer `self` i personally prefer writing `node` in that case |
03:49:28 | FromDiscord | <Mustache Man> self is the python way π |
03:49:32 | FromDiscord | <Nisha's alt> How about `this`? |
03:49:32 | FromDiscord | <Mustache Man> i would prefer this |
03:49:48 | FromDiscord | <ElegantBeef> i dont like `this` since it's not descriptive enough since we arent class based |
03:50:15 | FromDiscord | <Mustache Man> i think they are equally non-descript |
03:50:21 | FromDiscord | <Mustache Man> it's just whatever you're used to surely |
03:50:22 | FromDiscord | <ElegantBeef> `node` is rather descript |
03:50:29 | FromDiscord | <Mustache Man> oh i meant this vs self |
03:50:35 | FromDiscord | <exelotl> Yeah I think `node: Node` is what I'd expect to find in the stdlib |
03:50:47 | FromDiscord | <ElegantBeef> or for longer words short forms |
03:50:59 | FromDiscord | <ElegantBeef> like `ContextManager` might be `ctxMgr` or similar |
03:51:19 | FromDiscord | <exelotl> But I too get lazy and write n sometimes in my own project |
03:51:33 | FromDiscord | <ElegantBeef> With helper procedures i do tend to default to single variable names |
03:51:36 | FromDiscord | <ElegantBeef> (edit) "With helper procedures i do tend to default to single ... variable" added "character" |
03:52:00 | FromDiscord | <ElegantBeef> And the stdlib tends to do it aswell |
03:52:04 | FromDiscord | <Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VGZ |
03:52:21 | FromDiscord | <Mustache Man> (edit) "https://play.nim-lang.org/#ix=2VGZ" => "https://play.nim-lang.org/#ix=2VH0" |
03:52:23 | FromDiscord | <ElegantBeef> i tend to do `node` there as well, but yea `n` wouldnt be outrageous to me |
03:52:57 | FromDiscord | <Mustache Man> well they can't both be node π |
03:53:10 | FromDiscord | <ElegantBeef> They can be |
03:53:16 | FromDiscord | <ElegantBeef> just would change the view |
03:53:26 | FromDiscord | <Mustache Man> the view? |
03:53:27 | FromDiscord | <ElegantBeef> Shadowing the parameter in that case is bad |
03:53:30 | FromDiscord | <Mustache Man> ah |
03:53:56 | FromDiscord | <ElegantBeef> Shadowing is nice but only when it makes sense, so yea in that case `n` or `child` might be more descript |
03:55:13 | FromDiscord | <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:29 | FromDiscord | <Mustache Man> thanks for your input everyone |
03:55:44 | FromDiscord | <Mustache Man> i have another question. i've been learning nim for about two weeks now |
03:55:46 | FromDiscord | <Mustache Man> if i wanted to expand my horizons with Nim, what's a smallish project i could take a look at? |
03:56:19 | FromDiscord | <ElegantBeef> You mean looking at a created program or something to work on? |
03:56:31 | FromDiscord | <Mustache Man> looking at someone else's work. something that displays how deep the rabbit hole goes |
03:56:35 | FromDiscord | <ElegantBeef> Ah |
03:56:46 | FromDiscord | <ElegantBeef> Got some gui frameworks like `nigui` or `nimx` |
03:56:50 | FromDiscord | <Mustache Man> high level that is, not low-level stuff necessarily |
03:57:12 | FromDiscord | <ElegantBeef> Can look at treeforms repos since they're assorted categories and complexities https://github.com/treeform |
03:58:10 | FromDiscord | <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:33 | FromDiscord | <Mustache Man> wow treeform has a lot of projects |
03:58:35 | FromDiscord | <Mustache Man> thank you |
03:58:49 | FromDiscord | <ElegantBeef> Yea it's all pretty useful and good code |
03:58:58 | FromDiscord | <ElegantBeef> `benchy` is pretty fricken nice |
04:01:02 | FromDiscord | <ElegantBeef> Also were you just learning OOP or actively planning on using it? |
04:01:22 | FromDiscord | <Mustache Man> i'm using it |
04:01:27 | FromDiscord | <Mustache Man> in a simulation |
04:02:05 | FromDiscord | <Mustache Man> it's a sort of network traffic simulator |
04:02:37 | FromDiscord | <ElegantBeef> It's just always a question to be had when people tend to come from OOP languages π |
04:03:24 | FromDiscord | <Mustache Man> my background is mostly Java & R |
04:03:24 | FromDiscord | <ElegantBeef> Since depending on what you're doing it could be completely unneeded/unwarranted |
04:03:40 | FromDiscord | <ElegantBeef> Yea based of `this` i reasoned C#/Java |
04:04:18 | FromDiscord | <Mustache Man> mmhmm. Java's concept of OO is insane, hence why i'm trying to leave it. |
04:04:35 | FromDiscord | <ElegantBeef> Everything is a heap allocated object, what could go wrong?! |
04:04:56 | FromDiscord | <ElegantBeef> Looks at minecraft performance graphs |
04:05:16 | FromDiscord | <Mustache Man> and R on the other hand doesn't properly support OO. |
04:06:25 | FromDiscord | <ElegantBeef> And if you ever want a code review there's always atleast one opinionated Nim user around π |
04:06:34 | FromDiscord | <Mustache Man> i appreciate that! |
04:06:56 | FromDiscord | <Mustache Man> i've managed to 100x the performance of my simulation so far |
04:07:10 | FromDiscord | <ElegantBeef> You mean Nim vs. Java? |
04:07:32 | FromDiscord | <Mustache Man> ah, no, just from making improvements to my understandings of Nim |
04:07:36 | FromDiscord | <ElegantBeef> Ah |
04:07:46 | FromDiscord | <ElegantBeef> are you building a release version? |
04:07:57 | FromDiscord | <ElegantBeef> That's a common failure of people benchmarking |
04:08:14 | FromDiscord | <Mustache Man> What do you mean by a release version? |
04:08:18 | FromDiscord | <Rika> -d:release |
04:08:22 | FromDiscord | <ElegantBeef> `-d:release` or `-d:danger` |
04:08:24 | FromDiscord | <Mustache Man> no |
04:08:26 | FromDiscord | <ElegantBeef> Well |
04:08:27 | FromDiscord | <Rika> use that |
04:08:31 | FromDiscord | <ElegantBeef> Get ready for free performance |
04:08:33 | FromDiscord | <Rika> youll see more improvement |
04:08:36 | FromDiscord | <Mustache Man> oh my |
04:08:40 | FromDiscord | <Mustache Man> i'll give it a shot. |
04:08:42 | FromDiscord | <Rika> prolly another 2x to the 100x |
04:08:46 | FromDiscord | <Rika> so total 200x prolly |
04:08:47 | FromDiscord | <ElegantBeef> even more with `-d:lto` and `--opt:speed` |
04:08:54 | FromDiscord | <ElegantBeef> The last should be implied but some times it's not |
04:09:34 | FromDiscord | <ElegantBeef> Gary was testing his simd optimized vectors and inline was being the least aggressive feature ever without the `--opt:speed` |
04:10:00 | FromDiscord | <ElegantBeef> inb4 "Holy shit speed" |
04:11:13 | FromDiscord | <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:15 | FromDiscord | <ElegantBeef> (edit) "`-d:danger`" => "`-d:danger`"" |
04:11:16 | FromDiscord | <Mustache Man> uhhhh |
04:11:23 | FromDiscord | <Mustache Man> it's 15x faster |
04:11:27 | FromDiscord | <Mustache Man> o_0 |
04:11:29 | FromDiscord | <ElegantBeef> Yea |
04:11:34 | FromDiscord | <ElegantBeef> Optimizers tend to optimize |
04:12:03 | FromDiscord | <Mustache Man> i guess i should have read the compiler guide |
04:12:31 | FromDiscord | <ElegantBeef> It's also listed in the tutorial briefly |
04:12:44 | FromDiscord | <ElegantBeef> But yea many people miss it so we're here saying "To get free speed dont test a debug build" |
04:13:15 | FromDiscord | <ElegantBeef> Like this was a laugh/good read https://github.com/treeform/raytracer/blob/master/nim/story.md |
04:14:10 | FromDiscord | <Mustache Man> so then what's the right way to profile? |
04:14:26 | FromDiscord | <Mustache Man> sent a code paste, see https://play.nim-lang.org/#ix=2VH4 |
04:15:18 | FromDiscord | <ElegantBeef> all you need is `--debugger:native` afaik |
04:15:37 | FromDiscord | <ElegantBeef> then you can use your profiler and output what you need |
04:15:42 | FromDiscord | <Mustache Man> oh forgot to mention i was using nimprof |
04:15:54 | FromDiscord | <ElegantBeef> I've never used it so no clue |
04:16:05 | FromDiscord | <Mustache Man> ok |
04:16:17 | FromDiscord | <ElegantBeef> I've never really profiled code outside benchmarks |
04:17:14 | * | vicfred quit (Quit: Leaving) |
04:18:50 | FromDiscord | <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:14 | FromDiscord | <Rika> dont try it |
04:20:14 | FromDiscord | <Mustache Man> but violent explosions are the best way to learn |
04:20:17 | FromDiscord | <ElegantBeef> Uhh |
04:20:37 | FromDiscord | <ElegantBeef> I dont even know what you're asking, making it so the array `[]` is offset by a value? |
04:22:38 | FromDiscord | <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:49 | FromDiscord | <Mustache Man> (edit) "24," => "24. let's say i want to remove the first element: 0. " |
04:23:52 | FromDiscord | <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:09 | FromDiscord | <ElegantBeef> (edit) "than" => "then" |
04:24:20 | FromDiscord | <Mustache Man> yes that's okay. |
04:24:40 | FromDiscord | <Mustache Man> (edit) "yes that's okay. ... " added "the point is just to make it less expensive to remove that 0th element." |
04:24:57 | FromDiscord | <Mustache Man> (edit) "0th element." => "elemtn at index 0" |
04:25:01 | FromDiscord | <Mustache Man> (edit) "elemtn" => "elemnt" |
04:25:04 | FromDiscord | <Mustache Man> (edit) "elemnt" => "element" |
04:25:34 | FromDiscord | <ElegantBeef> Every remove would shrink the collection by 1 |
04:25:40 | FromDiscord | <ElegantBeef> So you'd have to grow it more often |
04:26:04 | FromDiscord | <ElegantBeef> Could you re explain what this sequence was for? |
04:26:07 | FromDiscord | <ElegantBeef> (edit) "re explain" => "reexplain" |
04:26:10 | FromDiscord | <Mustache Man> perhaps i don't know how sequences maintain their size |
04:26:27 | FromDiscord | <Mustache Man> do they grow whenever they exceed a portion of their max capacity? |
04:26:30 | FromDiscord | <Rika> sequences kinda look like (size, ptr -> (capacity, ptr -> data)) |
04:26:32 | FromDiscord | <ElegantBeef> Yes |
04:26:39 | FromDiscord | <Rika> i think |
04:26:55 | FromDiscord | <ElegantBeef> Close enough rika |
04:27:33 | FromDiscord | <Mustache Man> hmm. well it's probably not worth it to me right now |
04:28:07 | FromDiscord | <Mustache Man> i was just intrigued and figured it was worth asking about |
04:28:19 | FromDiscord | <ElegantBeef> ah actually rika it's (ptr -> size, capacity, ptr -> data) |
04:28:26 | FromDiscord | <ElegantBeef> Sequence is the size of a pointer |
04:32:00 | FromDiscord | <Rika> In reply to @ElegantBeef "ah actually rika it's": why would the size be in a pointer |
04:33:10 | FromDiscord | <ElegantBeef> to make the stack size smaller i presume |
04:34:01 | FromDiscord | <ElegantBeef> The size is halved by having two sources of indirection |
04:43:28 | FromDiscord | <Rika> oh you're not doing it properly!!! |
04:43:40 | FromDiscord | <Rika> (ptr -> (size, capacity), ptr -> data) |
04:43:41 | FromDiscord | <Rika> smh |
04:44:03 | FromDiscord | <ElegantBeef> ah |
04:49:19 | * | vicfred joined #nim |
05:24:41 | FromDiscord | <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:45 | saem | What do you mean by seen? |
05:27:39 | FromDiscord | <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:54 | FromDiscord | <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:50 | saem | Treeform does know about it and it was discussed: https://forum.nim-lang.org/t/5363 |
05:35:55 | FromDiscord | <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:48 | saem | Guess so |
05:39:09 | FromDiscord | <Nisha's alt> What's aklomp? |
05:39:45 | FromDiscord | <reilly> In reply to @Charlotte|π»β "What's aklomp?": https://github.com/aklomp/base64/ |
05:40:03 | FromDiscord | <reilly> Very very fast base64 encoder/decoder. |
05:40:03 | FromDiscord | <Nisha's alt> O |
05:40:06 | FromDiscord | <Nisha's alt> Nice |
06:14:03 | ForumUpdaterBot | New 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:54 | FromDiscord | <Gary M> hey, how is genSym used? |
08:10:37 | FromDiscord | <haxscramper> `let yourVar = genSym(nskVar, "varName")` |
08:11:25 | FromDiscord | <haxscramper> Just keep check of where you put the generated symbol - `nskVar`/ `nskLet` / etc. https://nim-lang.org/docs/macros.html#NimSymKind |
08:12:06 | FromDiscord | <haxscramper> E.g. don't put `var` symbol in the for loop variable (it should be `nskForVar`) etc. |
08:12:15 | FromDiscord | <haxscramper> (edit) "`var`" => "`nskVar`" |
08:15:53 | * | vicfred quit (Quit: Leaving) |
08:21:46 | FromDiscord | <Gary M> Thanks. |
08:22:00 | FromDiscord | <Gary M> I sort of fixed the issue I was having differently. |
08:22:13 | FromDiscord | <Gary M> Which was gensym clashes via chained templates |
08:22:22 | * | letto quit (Quit: Konversation terminated!) |
08:22:33 | FromDiscord | <Gary M> I put them inside a `block:` and it scopes well now |
08:27:19 | * | letto joined #nim |
08:27:54 | FromDiscord | <hamidb80> i wrote a sha256 algorithm in nim |
08:28:23 | FromDiscord | <hamidb80> but it's so damn slow π |
08:28:35 | FromDiscord | <hamidb80> can anyone give me a point to make it faster? |
08:28:37 | FromDiscord | <hamidb80> https://github.com/hamidb80/nim_days/blob/main/SHA256/sha256.nim |
08:30:55 | FromDiscord | <hamidb80> or suggest an article or something |
08:33:35 | * | narimiran joined #nim |
08:38:27 | ForumUpdaterBot | New thread by 19: C library with custom build system to Nim, see https://forum.nim-lang.org/t/7775 |
08:40:06 | FromDiscord | <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:16 | FromDiscord | <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:38 | FromDiscord | <mratsim> or https://github.com/status-im/nim-blscurve/blob/master/benchmarks/bench_sha256.nim |
08:56:55 | FromDiscord | <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:31 | ForumUpdaterBot | New 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:40 | FromDiscord | <hamidb80> In reply to @mratsim "don't use sequences, don't": so, how can i do `rotateRight`/`rotateLeft` with int? |
09:33:15 | FromDiscord | <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:29 | FromDiscord | <mratsim> this compiles to a single rol instruction |
09:33:37 | FromDiscord | <mratsim> or ror for right |
09:35:12 | * | arecaceae quit (Remote host closed the connection) |
09:35:31 | * | arecaceae joined #nim |
09:36:15 | FromDiscord | <ElegantBeef> Do want to point out that `bitops` does exist if hambid didnt know |
09:37:27 | FromDiscord | <Rika> hamidb |
09:38:01 | FromDiscord | <ElegantBeef> I swear sometimes i have minor dyslexia since i looked three times to spell it properly |
09:38:04 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Do want to point": i really didn't know |
09:43:34 | FromDiscord | <hamidb80> π i don't know why but it makes me laugh https://media.discordapp.net/attachments/371759389889003532/830739840621740052/unknown.png |
09:43:54 | FromDiscord | <hamidb80> (edit) "why" => "why." |
09:50:49 | FromDiscord | <hamidb80> https://www.youtube.com/watch?v=IB8Yt2dqZbo |
09:55:16 | * | mikey2132 joined #nim |
10:22:26 | FromDiscord | <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:07 | FromDiscord | <hamidb80> `myobject.bitfield.X.int` i think |
10:25:10 | FromDiscord | <eddned> What's the most reliable GUI library for nim? |
10:28:03 | * | mikey2132 left #nim ("Leaving") |
10:29:31 | FromDiscord | <carpal> sent a code paste, see https://play.nim-lang.org/#ix=2VIF |
10:29:39 | FromDiscord | <carpal> (edit) "https://play.nim-lang.org/#ix=2VIF" => "https://play.nim-lang.org/#ix=2VIG" |
10:33:00 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VII |
10:34:39 | FromDiscord | <Rika> can you give code? |
10:34:40 | FromDiscord | <Gary M> In reply to @carpal "is the instance copied": believe so |
10:34:53 | FromDiscord | <Rika> In reply to @Gary M "believe so": not if the type is sufficiently large |
10:34:55 | FromDiscord | <Rika> i belive |
10:35:01 | FromDiscord | <Gary M> unless you have a ref object or that I guess |
10:35:01 | FromDiscord | <Rika> believe |
10:35:32 | FromDiscord | <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:33 | FromDiscord | <Gary M> @jtiai Yeah please show the code. |
10:38:48 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2VIJ |
10:40:09 | FromDiscord | <Rika> thats not how enums work |
10:41:20 | FromDiscord | <jtiai> So I should do traditional bit orring like in C? |
10:43:20 | FromDiscord | <Gary M> @jtiai did you look at the documentation for bitfields? |
10:43:41 | FromDiscord | <jtiai> Yes but it was a bit confusing how I can assign values. |
10:44:08 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2VIK |
10:44:09 | FromDiscord | <Rika> Flags enum only stores one value |
10:44:15 | FromDiscord | <Rika> you use a set if you want a bitfield |
10:44:37 | FromDiscord | <konsumlamm> i'm pretty sure those are called (bit)sets and not bitfields |
10:44:41 | FromDiscord | <Gary M> yes |
10:44:46 | FromDiscord | <Rika> sorry |
10:44:58 | FromDiscord | <Rika> im trying to think in two languages at the same time right now |
10:45:07 | FromDiscord | <Gary M> more of the actual example : P |
10:45:07 | FromDiscord | <Gary M> sent a code paste, see https://paste.rs/NNf |
10:45:47 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2VIM |
10:45:52 | FromDiscord | <konsumlamm> instead of cast, you should also be able to use `ord` for the first one |
10:46:23 | FromDiscord | <jtiai> So I can't do `somefield.somebit = X` ? |
10:46:42 | FromDiscord | <konsumlamm> no, but you can to `someset.incl(X)` |
10:47:11 | FromDiscord | <jtiai> Ah, so whole enum/bitflags is a bit useless in this case. |
10:47:18 | FromDiscord | <konsumlamm> ? |
10:47:33 | FromDiscord | <Gary M> no, it's a set of flags |
10:47:43 | FromDiscord | <konsumlamm> a `set[T]` is bitflags essentially |
10:47:50 | FromDiscord | <jtiai> Such a messy language. |
10:47:55 | FromDiscord | <konsumlamm> and the `T` can be an enum |
10:48:02 | FromDiscord | <Gary M> what? There's nothing messy about it. |
10:48:26 | FromDiscord | <Gary M> just because something you can do in C doesn't directly translate to Nim doesn't make it messy |
10:48:30 | FromDiscord | <jtiai> so how I can do `cpu.flags.carry = 1` ? |
10:48:56 | FromDiscord | <Gary M> `cpu.flags.incl(carry)` |
10:49:05 | FromDiscord | <Gary M> where flags is a set |
10:49:13 | FromDiscord | <Gary M> ` MyFlags = set[MyFlag]` |
11:04:41 | * | beenz quit (Ping timeout: 240 seconds) |
11:06:56 | FromDiscord | <carpal> In reply to @Gary M "believe so": ok so, why not to pass as reference also to x? |
11:07:02 | FromDiscord | <carpal> isn't faster? |
11:07:22 | FromDiscord | <Gary M> that largely depends on what you're trying to copy |
11:07:23 | FromDiscord | <Rika> not always i believe? |
11:07:49 | FromDiscord | <carpal> rarely a struct has a size less than 8 bytes |
11:07:52 | FromDiscord | <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:21 | FromDiscord | <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:49 | FromDiscord | <carpal> yes that's its purpose |
11:09:01 | FromDiscord | <carpal> but also out of nim |
11:09:13 | FromDiscord | <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:26 | FromDiscord | <madman> does the `--path:` compiler option give the compiler search paths to include nim modules? |
11:25:15 | FromDiscord | <carpal> cls |
11:25:17 | FromDiscord | <carpal> ops |
11:25:18 | FromDiscord | <carpal> lol |
11:25:54 | * | al1ranger quit (Quit: Leaving) |
11:26:10 | FromDiscord | <madman> ??? |
11:26:11 | FromDiscord | <madman> xD |
11:26:45 | * | xet7 quit (Quit: Leaving) |
11:33:46 | FromDiscord | <madman> sent a code paste, see https://play.nim-lang.org/#ix=2VJ9 |
11:37:48 | FromDiscord | <clyybber> yeah |
11:38:23 | FromDiscord | <Gary M> @madman you're a mad man |
11:38:31 | FromDiscord | <madman> xD |
11:38:45 | FromDiscord | <madman> @Gary M you the G-Man |
11:39:35 | liblq-dev | rise and shine, mr. freeman |
11:39:37 | FromDiscord | <madman> @clyybber i tried but i cannot seem to find where i am in the root |
11:39:37 | liblq-dev | rise and shine |
11:39:58 | FromDiscord | <madman> exactly! |
11:40:10 | FromDiscord | <madman> G-Man and the madman |
11:40:17 | FromDiscord | <clyybber> In reply to @x19 "<@!107882072974065664> i tried but": hmm, I think it's relative to your CWD |
11:40:19 | FromDiscord | <madman> hl3 released |
11:40:27 | liblq-dev | and the freeman |
11:40:30 | FromDiscord | <clyybber> you can make it relative to the config file though |
11:41:49 | FromDiscord | <madman> config file okey |
11:43:31 | FromDiscord | <carpal> I'm sorry for the off-topic question, is there a way to convert time_point to long long in c++? |
11:43:46 | FromDiscord | <carpal> to get nanos without doing time_point - time_point? |
11:44:32 | FromDiscord | <carpal> what does the nim's getTicks function wrap? |
11:46:03 | FromDiscord | <Rika> you can get nanos by using monotimes |
11:47:31 | FromDiscord | <carpal> mhh https://media.discordapp.net/attachments/371759389889003532/830771037678469121/unknown.png |
11:48:18 | FromDiscord | <Gary M> int64 should basically be long long no? π |
11:49:44 | FromDiscord | <Rika> isnt long long int80 (min int64)? |
11:49:49 | FromDiscord | <Rika> "int80" if it existed |
11:49:54 | FromDiscord | <Rika> oh wait no |
11:49:56 | FromDiscord | <Rika> thats for floats |
11:49:58 | FromDiscord | <Rika> me big brain |
11:51:04 | FromDiscord | <carpal> In reply to @Rika "isnt long long int80": long long is int64 |
11:51:14 | FromDiscord | <carpal> long is int32 |
11:51:23 | FromDiscord | <carpal> no ideas why |
11:53:08 | FromDiscord | <Gary M> because that's the contrived descriptor they used for the bit size of ints in C/C++ |
11:53:22 | FromDiscord | <Gary M> where now it's best not to even use those |
11:56:04 | * | filcuc_ joined #nim |
11:59:13 | FromDiscord | <nsauzede> is it possible to limit float decimal print format ? (eg: like in C `printf("%.6f")` |
11:59:36 | FromDiscord | <nsauzede> in this `stdout.write(&"u={u} v={v}\n")` |
11:59:49 | FromDiscord | <Rika> echo &"{thefloat:6}" or something i forget, check docs |
12:00:03 | FromDiscord | <nsauzede> thank you |
12:00:10 | FromDiscord | <Rika> but theres a :, after that, you can specify stuff |
12:00:18 | FromDiscord | <Rika> like in python if youre familiar with that |
12:00:51 | FromDiscord | <nsauzede> I quickly grepped `format` in the manual and didn't find something related hence my lazy q here |
12:01:58 | FromDiscord | <Rika> https://nim-lang.org/docs/strformat.html#formatting-floats |
12:04:22 | FromDiscord | <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:21 | FromDiscord | <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:27 | FromDiscord | <carpal> nanos, ticks? |
12:32:50 | FromDiscord | <Yardanico> https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter |
12:33:31 | FromDiscord | <Yardanico> also, why didn't you just use std/monotimes ? |
12:33:48 | FromDiscord | <carpal> because I'm not using nim |
12:34:33 | FromDiscord | <Yardanico> you can still check the source code of monotimes |
12:38:05 | FromDiscord | <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:54 | FromDiscord | <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:03 | FromDiscord | <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:18 | FromDiscord | <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:30 | FromDiscord | <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:04 | FromDiscord | <mratsim> In reply to @haxscramper "If my data structure": with cursor maybe |
14:14:21 | * | PMunch joined #nim |
14:27:35 | Oddmonger | i'm using a nim lib (godot nim) which has a file containing only Β«importΒ» orders |
14:27:59 | Oddmonger | when compiling, i get warnings because they are not used in the file |
14:28:51 | Oddmonger | is 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:16 | Oddmonger | maybe exporting them⦠|
14:31:37 | Oddmonger | yes perfect, Β« import mainpanel Β» and then Β« export mainpanel Β» and that's ok ,no more warnings |
14:48:33 | FromDiscord | <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:35 | FromDiscord | <gollark> Which one is good? |
14:49:09 | FromDiscord | <DavidKunz> sent a code paste, see https://play.nim-lang.org/#ix=2VKf |
14:51:33 | FromDiscord | <Yardanico> In reply to @DavidKunz "Hi, is there an": your key name is declared at runtime? |
14:51:59 | FromDiscord | <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:01 | FromDiscord | <DavidKunz> My main task is to make object variants comparable (which unfortunately isn't possible at the moment) |
14:52:17 | FromDiscord | <Yardanico> oh, object variants |
14:52:58 | FromDiscord | <DavidKunz> `fieldPairs` works great, but I need to compare two objects |
14:54:06 | FromDiscord | <Yardanico> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT |
14:54:35 | ForumUpdaterBot | New thread by Mantielero: Arduino with Nim, see https://forum.nim-lang.org/t/7777 |
14:55:42 | FromDiscord | <DavidKunz> @Yardanico , this doesn't work for case objects π¦ |
14:55:50 | FromDiscord | <gollark> This seems like a usecase for macros mostly. |
14:56:28 | FromDiscord | <gollark> Objects compile to structs, so picking out fields by name at runtime probably won't work. |
14:58:34 | FromDiscord | <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:27 | FromDiscord | <Gary M> Comparing 2 objects? Override `=` with the intended functionality |
14:59:38 | FromDiscord | <Rika> < you mean? |
14:59:39 | FromDiscord | <Rika> and ==? |
14:59:46 | FromDiscord | <Gary M> That too |
14:59:55 | FromDiscord | <Rika> i dont think you can override = |
15:00:01 | FromDiscord | <Rika> i dont recall being able to |
15:00:02 | FromDiscord | <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:22 | FromDiscord | <Gary M> Pretty sure you can check which variant the object is |
15:00:55 | FromDiscord | <Gary M> And then you'd have to manually compare the fields of those variants |
15:01:18 | FromDiscord | <DavidKunz> `fieldPairs` doesn't work with object variants |
15:01:28 | FromDiscord | <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:37 | FromDiscord | <konsumlamm> then just hardcode it, where's the problem? |
15:01:57 | FromDiscord | <Gary M> The solution doesn't have to be elegant always |
15:02:23 | FromDiscord | <DavidKunz> That's true, I was just wondering if there's a more elegant way |
15:02:44 | FromDiscord | <DavidKunz> Would be great if the standard library could compare object variants, so I tried to come up with a solution |
15:03:44 | FromDiscord | <DavidKunz> Do you think it would make sense to open an RFC? |
15:05:42 | FromDiscord | <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:52 | FromDiscord | <haxscramper> But honestly my implementation is just unholy abomination |
15:06:28 | FromDiscord | <DavidKunz> `macro parallelFieldPairs(lhsObj, rhsObj: typed; body: untyped): untyped` <-- yes, that's exactly what I would need! Thanks! |
15:06:46 | FromDiscord | <haxscramper> don't use |
15:06:47 | FromDiscord | <haxscramper> it |
15:07:01 | FromDiscord | <haxscramper> It's just so badly implemeted internally, this can't be done via macro API |
15:07:24 | FromDiscord | <haxscramper> Or rather do use it only with objects that are (1) variant and (2) have all fields exported |
15:07:44 | FromDiscord | <haxscramper> For private fields do use `hackPrivateParallelFieldPairs`, but better just don't |
15:07:46 | FromDiscord | <DavidKunz> I won't use it, but the idea to have it exactly would solve my problem |
15:08:32 | FromDiscord | <DavidKunz> So I could at least write up an RFC with my use case |
15:09:19 | FromDiscord | <DavidKunz> (without implementation) |
15:09:31 | FromDiscord | <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:39 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2VKz |
15:11:13 | FromDiscord | <Yardanico> the time has come https://media.discordapp.net/attachments/371759389889003532/830822300462219274/unknown.png |
15:11:42 | FromDiscord | <Rika> wdym |
15:11:45 | FromDiscord | <Yardanico> 7777 |
15:11:48 | FromDiscord | <Rika> oh |
15:11:50 | FromDiscord | <Rika> i didnt notice |
15:14:42 | saem | Hmm, needs more 7s. |
15:24:31 | * | SebastianM joined #nim |
15:28:23 | SebastianM | Hi 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:41 | FromDiscord | <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:53 | FromDiscord | <haxscramper> So far I've seen it only use exceptions, template syntax for typedef (when using `importcpp` for a template type) |
15:34:37 | SebastianM | haxscramper: thank you for your quick and detailed answer. |
15:34:55 | FromDiscord | <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:07 | FromDiscord | <Gary M> Something like gcc 6.0 |
15:35:18 | FromDiscord | <Gary M> gcc/g++ :P |
15:36:30 | FromDiscord | <Gary M> Which kinda makes Linux the easier platform for building windows with an up-to-date mingw |
15:37:04 | FromDiscord | <Gary M> Building to windows |
15:37:32 | SebastianM | gary m: yeah, windows has some outdated tools |
15:38:06 | * | SebastianM quit (Quit: -a- Bye Bye) |
15:38:13 | FromDiscord | <Yardanico> In reply to @haxscramper "IIRC it emits very": sadly that's kind of old news |
15:38:20 | FromDiscord | <Yardanico> the default is c++14 |
15:38:23 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/compiler/extccomp.nim#L89 |
15:38:59 | FromDiscord | <Yardanico> or idk |
15:40:22 | FromDiscord | <Yardanico> there's even a PR that switches it to c++17 |
15:40:23 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/pull/17375 |
15:43:41 | FromDiscord | <geekrelief> In reply to @Oddmonger "yes perfect, Β« import": You can also use the `warning` pragma to disable warnings |
15:44:40 | FromDiscord | <haxscramper> In reply to @Yardanico "the default is c++14": Does it explicitly use any C++14-only constructs? |
15:44:53 | FromDiscord | <haxscramper> Like lambdas, or some generic constraints somewhere |
15:44:59 | FromDiscord | <haxscramper> Or something like that? |
15:45:00 | cornfeedhobo | I 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:49 | FromDiscord | <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:58 | FromDiscord | <Yardanico> before there was no "default" std version for C++ |
15:46:52 | FromDiscord | <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:28 | leorize[m] | cornfeedhobo: usually you need a alloc/dealloc heavy benchmark like havlak |
15:48:29 | FromDiscord | <haxscramper> Like nim generating some code that would fail on C++98/C++11 compiler? |
15:49:28 | * | xace joined #nim |
15:56:05 | FromDiscord | <DavidKunz> Regarding comparable object variants, I created an RFC: https://github.com/nim-lang/RFCs/issues/367 |
15:57:03 | ForumUpdaterBot | New 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:59 | FromDiscord | <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:11 | FromDiscord | <Yardanico> it's from that video about branchless programming |
15:59:13 | FromDiscord | <Yardanico> suddently ifs are slow now |
15:59:52 | FromDiscord | <Yardanico> (from that SO question) |
15:59:53 | FromDiscord | <Gary M> I did a seq of proc()'s before idk why you couldn't do an array |
16:00:13 | FromDiscord | <Yardanico> x > 5 still does "if" inside |
16:00:17 | FromDiscord | <Rika> yeah but that would likely be slower than ifs |
16:00:21 | FromDiscord | <Yardanico> it has to use comparison |
16:00:33 | FromDiscord | <Gary M> @Rika indexing an array? |
16:01:44 | FromDiscord | <Rika> calling the proc i believe |
16:01:44 | FromDiscord | <Gary M> Regardless it's silly optimization |
16:02:02 | FromDiscord | <Gary M> @Rika nah should be just as fast as any nimcall |
16:02:19 | FromDiscord | <Tavon> The issue with ifs is when there is a branch misprediction, that's "pretty costly" |
16:02:25 | FromDiscord | <Gary M> You can even force it to only accept {.nimcall.} procs so no closures |
16:03:00 | FromDiscord | <Gary M> You'd think so but sometimes the alternative is just plain slower @Tavon |
16:03:04 | FromDiscord | <Rika> idk dude, i know you're right but ive always the feeling that itd still be slower |
16:03:31 | FromDiscord | <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:46 | FromDiscord | <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:48 | PMunch | Anyone ready for some more keyboard firmware programming? |
16:04:30 | FromDiscord | <Gary M> Well you can make an enum indexed array of procedures to have some fucked up jump table I guess idk |
16:05:42 | PMunch | Stream is live: https://www.twitch.tv/pmunche |
16:10:59 | FromDiscord | <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:08 | FromDiscord | <Nisha's alt> Nvm there's a better way to do what i want |
16:17:05 | FromDiscord | <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:01 | FromDiscord | <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:50 | liblq-dev | you should probably ping @ElegantBeef |
16:26:12 | liblq-dev | probably the more dangerous ones are io, os |
16:26:28 | liblq-dev | possibly also net, httpclient, and such |
16:26:36 | liblq-dev | depends on whether you want to allow network connections or not |
16:31:20 | FromDiscord | <Yardanico> @liblq-dev beef said that he won't help with that :) |
16:41:26 | FromDiscord | <Nisha's alt> Well, this isn't strictly Python related- |
16:41:43 | FromDiscord | <Nisha's alt> Since I'm definitely gonna reuse Nimscripter in an actual Nim project when i get home |
16:41:57 | FromDiscord | <Nisha's alt> I just wanna know which ones i should remove |
16:42:05 | FromDiscord | <Nisha's alt> In reply to @liblq-dev "possibly also net, httpclient,": But thanks! |
16:45:11 | FromDiscord | <Nisha's alt> Uhh i have no idea what does what xD |
16:45:45 | FromDiscord | <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:06 | FromDiscord | <Nisha's alt> (edit) "`pure`" => "`pure`?" |
16:47:18 | FromDiscord | <Nisha's alt> Like, what type of things would i actually need to keep |
16:47:28 | FromDiscord | <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:57 | FromDiscord | <treeform> In reply to @Mustache Man "wow treeform has a": I do, if you find a bug, please submit and issue. |
16:49:37 | FromDiscord | <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:40 | FromDiscord | <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:39 | FromDiscord | <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:30 | FromDiscord | <treeform> everyone can't switch to UTF8 fast enough. |
16:54:11 | FromDiscord | <Rika> utf8 with bom |
17:02:11 | * | Vladar joined #nim |
17:03:33 | FromDiscord | <treeform> that does happen |
17:04:04 | FromDiscord | <treeform> it supposed to be ignored though as utf8 is not big or little endian dependent. |
17:06:50 | FromDiscord | <Rika> still annoying when its encounterrd |
17:06:52 | FromDiscord | <Rika> (edit) "encounterrd" => "encountered" |
17:12:15 | FromDiscord | <DavidKunz> @haxscramper , thanks for the hint, I will do that! |
17:25:12 | FromDiscord | <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:34 | PMunch | Anyone knows how I can add a flexible array at the end of an object in Nim? |
17:25:42 | PMunch | https://en.wikipedia.org/wiki/Flexible_array_member like this |
17:29:05 | ForumUpdaterBot | New thread by Rozzamarine: NDustman (random URL generator), see https://forum.nim-lang.org/t/7778 |
17:34:02 | FromDiscord | <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:37 | FromDiscord | <haxscramper> And they are implemented using compiler magic, each one differently |
17:34:51 | FromDiscord | <haxscramper> Wait a second, I will pull up the implementation source |
17:37:05 | FromDiscord | <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:14 | FromDiscord | <DavidKunz> Ok, thank you @hexscramper |
17:39:17 | liblq-dev | PMunch: yes, `UncheckedArray` |
17:39:35 | FromDiscord | <haxscramper> In reply to @DavidKunz "Ok, thank you @hexscramper": I'm still waiting for someone to call be `hex scraper` |
17:39:43 | FromDiscord | <haxscramper> (edit) "be" => "me" |
17:40:14 | FromDiscord | <DavidKunz> I double checked π |
17:40:34 | FromDiscord | <DavidKunz> but only the scamper part |
17:44:15 | m33[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:59 | PMunch | liblq-dev, and how would I assign to that in an object constructor? |
17:47:09 | liblq-dev | good question |
17:47:25 | liblq-dev | you probably need to allocate the memory for the object manually in this case |
17:47:25 | PMunch | I just get an error that array[0..0, int16] doesn't match UncheckedArray[int16] |
17:47:30 | PMunch | Hmm |
17:47:36 | PMunch | That won't work for this.. |
17:47:36 | liblq-dev | just like in C |
17:47:45 | PMunch | Since I need to use PROGMEM |
17:48:06 | FromDiscord | <Yardanico> @m33 nice! care if I add the website to https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim ? |
17:48:43 | FromDiscord | <Yardanico> oh, I misunderstood what you written, sorry :P |
17:49:06 | FromDiscord | <Yardanico> also 600kb might be a little big, did you compile with -d:release ? |
17:51:58 | m33[m] | <FromDiscord "<Yardanico> @m33 nice! care if I"> I might if I get a clearance from the management |
17:53:06 | m33[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:53 | FromDiscord | <Yardanico> -d:release in config.nims doesn't work, that's why :) |
17:54:05 | m33[m] | HA! |
17:54:08 | FromDiscord | <Yardanico> you must provide it when calling nim/nimble |
17:54:13 | FromDiscord | <Yardanico> nimble build -d:release |
17:54:17 | m33[m] | Good , that will same be more time searching for this :) |
17:54:45 | FromDiscord | <Yardanico> also of course you can get it even smaller after that with "strip -s" - that removes some C-side debugging info |
17:54:50 | m33[m] | currious btw, since this config.nims does get the d : ssl right |
17:55:49 | FromDiscord | <Yardanico> it' |
17:55:56 | m33[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:09 | FromDiscord | <Yardanico> it's because -d:release and -d:danger are checked in the main nim config file |
17:56:14 | FromDiscord | <Yardanico> and that is evaluated before user configs |
17:56:21 | FromDiscord | <Yardanico> see https://github.com/nim-lang/Nim/issues/14272 for more info |
17:56:21 | m33[m] | I'm happy enough already to have 1 bin instead of the python stuff |
17:57:50 | FromDiscord | <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:14 | FromDiscord | <Yardanico> not sure about nimble, I rarely use it to compile |
17:58:21 | FromDiscord | <Yardanico> most of the time I just use "nim" directly |
17:59:23 | FromDiscord | <Anuke> I can build it myself, but I'd rather have nimble install it into the right directories |
18:00:20 | FromDiscord | <Yardanico> nimble install provides -d:release for binaries by default I think |
18:00:32 | FromDiscord | <Anuke> `nimble install -d:danger` doesn't even try to build, while `nimble install` does, which is strange |
18:00:36 | FromDiscord | <Anuke> no new warnings either |
18:01:29 | FromDiscord | <Solitude> In reply to @Anuke "`nimble install -d:danger` doesn't": `nimble install -p:-d:danger` |
18:01:46 | FromDiscord | <Solitude> -d flag is install dependencies only |
18:02:00 | FromDiscord | <Solitude> -p is for passing options to compiler |
18:03:11 | FromDiscord | <Anuke> oh |
18:03:42 | FromDiscord | <Solitude> nimble build and nimble install have different flags |
18:05:37 | PMunch | Damn it, ran into the PROGMEM bug again.. |
18:09:09 | FromDiscord | <Anuke> I get a C memcpy warning when compiling, should I be concerned? <https://play.nim-lang.org/#ix=2VLD> |
18:09:30 | FromDiscord | <Solitude> nah |
18:15:42 | FromDiscord | <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:36 | FromDiscord | <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:25 | FromDiscord | <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:08 | FromDiscord | <GE> vscodium is visual studio code with all the microsoft branding and telemetry removed or disabled. |
19:37:23 | FromDiscord | <GE> Some plugins won't work with vscodium however. |
19:46:00 | FromDiscord | <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:49 | FromDiscord | <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:23 | FromDiscord | <GE> https://github.com/VSCodium/vscodium/blob/master/DOCS.md#proprietary-extensions |
20:00:54 | FromDiscord | <nsauzede> I see, ok; thanks |
20:04:48 | FromDiscord | <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:21 | ForumUpdaterBot | New 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:33 | FromDiscord | <sealmove> hi |
20:19:01 | FromDiscord | <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:12 | FromDiscord | <sealmove> `socket.recvLine()` works but I don't want to read only 1 line |
20:19:31 | FromDiscord | <sealmove> and I don't know how many bytes or lines I'll receive |
20:20:09 | FromDiscord | <sealmove> I tried `recv` with a big number but it just blocks |
20:21:29 | FromDiscord | <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:52 | FromDiscord | <ElegantBeef> In reply to @nsauzede "Is it possible to": you can `cast[uint32](float32)` |
20:24:16 | FromDiscord | <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:56 | FromDiscord | <Mustache Man> is there a better way to get a root? i'm saddened by what i've had to do |
20:25:04 | FromDiscord | <ElegantBeef> "get a root"? |
20:25:09 | FromDiscord | <Mustache Man> like square root |
20:25:27 | FromDiscord | <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:32 | FromDiscord | <ElegantBeef> !eval import math; echo sqrt(100.0) |
20:25:37 | NimBot | 10.0 |
20:25:50 | FromDiscord | <Mustache Man> to do 4^0.5, i have to do 4.float().pow(0.5) |
20:26:13 | FromDiscord | <Mustache Man> i don't want to do the float operation |
20:26:14 | FromDiscord | <ElegantBeef> !eval import math; echo 4.float.sqrt |
20:26:17 | NimBot | 2.0 |
20:26:27 | FromDiscord | <ElegantBeef> Well you can make a sqrt proc then |
20:26:36 | FromDiscord | <ElegantBeef> takes in integers and casts them |
20:26:54 | FromDiscord | <Mustache Man> i suppose, i feel like the math pow implementation should handle it |
20:27:12 | FromDiscord | <Mustache Man> and ^ handles different types as well |
20:27:36 | FromDiscord | <ElegantBeef> Well it |
20:27:46 | FromDiscord | <ElegantBeef> (edit) "it" => "it's ambigious if you want float64 or 32 from an int sqrt imo" |
20:28:58 | FromDiscord | <Mustache Man> hmm why not use a default |
20:29:15 | FromDiscord | <Mustache Man> let the user provide an additional argument for what type they would like to receive |
20:29:19 | FromDiscord | <Nisha's alt> In reply to @ElegantBeef "<@!524288464422830095> most of the": Okay |
20:29:23 | FromDiscord | <ElegantBeef> Well we have generics for that |
20:29:28 | FromDiscord | <Mustache Man> pow(4, 0.5, int64) |
20:29:33 | FromDiscord | <Mustache Man> (edit) "int64)" => "float64)" |
20:30:57 | FromDiscord | <Mustache Man> generics in what sense? |
20:31:21 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2VMg |
20:31:49 | FromDiscord | <ElegantBeef> Dammit saem ran into typeclass + generic issue writing that example π |
20:32:45 | FromDiscord | <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:59 | FromDiscord | <ElegantBeef> So i guess the typedesc might be the wisest |
20:34:02 | FromDiscord | <konsumlamm> fwiw, instead of `4.float`, you can just do `4.0` |
20:34:09 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2VMi |
20:34:19 | FromDiscord | <ElegantBeef> Sure but i assume that was a placeholder for an integer |
20:34:29 | FromDiscord | <Mustache Man> yes |
20:34:39 | FromDiscord | <ElegantBeef> Feel free to submit a PR to the stdlib and write tests for this procedure π |
20:35:23 | FromDiscord | <Yardanico> In reply to @konsumlamm "fwiw, instead of `4.float`,": even shorter: 4d |
20:35:32 | FromDiscord | <Yardanico> :P |
20:36:16 | FromDiscord | <Mustache Man> thanks for this proc |
20:36:38 | FromDiscord | <nsauzede> what means `4d` ? |
20:36:47 | FromDiscord | <Yardanico> d is a type suffix for float64 |
20:36:52 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#lexical-analysis-numerical-constants |
20:36:54 | FromDiscord | <konsumlamm> eww |
20:36:58 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/830904275575898152/unknown.png |
20:37:02 | FromDiscord | <konsumlamm> at least use `4'd` :P |
20:37:05 | FromDiscord | <nsauzede> oh right `double` π |
20:37:09 | FromDiscord | <Yardanico> the apostrophe can be omitted |
20:37:12 | FromDiscord | <Yardanico> In reply to @konsumlamm "at least use `4'd`": no, why |
20:37:30 | FromDiscord | <konsumlamm> it can, but with custom literal suffixes, it can only for builtin suffixes |
20:37:49 | FromDiscord | <konsumlamm> so imo it's more consistent to use the ' |
20:38:00 | FromDiscord | <nsauzede> I find `4.0` more readable π |
20:38:52 | FromDiscord | <nsauzede> but TIL, thanks |
20:39:22 | PMunch | Can you control where an emit is placed in the C code? |
20:39:28 | FromDiscord | <ElegantBeef> yes |
20:39:36 | PMunch | The compiler reorders my code so stuff isn't declared.. |
20:39:40 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
20:39:48 | PMunch | I'm streaming right now by the way if you want to help live :P |
20:39:54 | FromDiscord | <ElegantBeef> mentions `/TYPESECTION/` |
20:41:43 | FromDiscord | <sealmove> how to read from socket until there is nothing more to read? >< |
20:41:50 | FromDiscord | <Mustache Man> also seems like ceiling and floor should return an int |
20:42:02 | FromDiscord | <ElegantBeef> Nah they generally return floats in most languages |
20:42:05 | FromDiscord | <ElegantBeef> They're float operations |
20:42:34 | FromDiscord | <ElegantBeef> Without lenientops it'd get annoying |
20:42:52 | FromDiscord | <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:30 | FromDiscord | <sealmove> with `newSocket(buffered = false)` it works!! |
20:44:40 | FromDiscord | <Yardanico> i know |
20:45:46 | PMunch | @ElegantBeef, thanks. Worked a treat |
20:45:48 | FromDiscord | <dom96> In reply to @ΰΈ£ΡΰΈΙΰΉΰΉΧ©Ρ "how to read from": if you're doing this then you're likely following the wrong path π |
20:45:58 | FromDiscord | <dom96> why do you think you need to do this? |
20:46:09 | FromDiscord | <ElegantBeef> I noticed, there is this live stream someone whored π |
20:47:30 | FromDiscord | <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:57 | FromDiscord | <ElegantBeef> Yea in most cases it's in the float or double related math so is odd to see int |
20:48:07 | FromDiscord | <Mustache Man> then again, R uses a special 'numeric' type that abstracts that away |
20:49:17 | FromDiscord | <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:52 | FromDiscord | <exelotl> if only @clyybber was here yesterday I bet he could have told me that x) |
20:56:57 | FromDiscord | <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:11 | FromDiscord | <sealmove> Basically doing programmatically what I would do with netcat |
20:57:19 | * | ckafi[m] joined #nim |
21:08:05 | FromGitter | <awr1> question: is there a reason overflows at compiletime don't seem to raise? they seem to just crash and are unrecoverable |
21:08:10 | FromGitter | <awr1> example https://play.nim-lang.org/#ix=2VMA |
21:08:43 | FromDiscord | <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:00 | FromGitter | <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:08 | FromDiscord | <ElegantBeef> does it still error in `-d:danger`? |
21:13:25 | FromDiscord | <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:07 | FromDiscord | <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:58 | FromDiscord | <clyybber> =copy is = btw, better to use =copy though, ideally we want to keep = free as a general operator |
22:26:53 | FromDiscord | <exelotl> yep, I remember that part :) |
22:26:57 | FromDiscord | <exelotl> just forgot that =sink exists |
22:31:16 | FromDiscord | <Nisha's alt> NLVM isn't being updated anymore? :P |
22:31:32 | FromDiscord | <Nisha's alt> Or is it just gonna be slow to reimplement everything |
22:31:40 | FromDiscord | <Nisha's alt> And that's why it's slow (in terms of development) |
22:31:49 | FromDiscord | <clyybber> In reply to @Charlotte|π»β "NLVM isn't being updated": it is, just in less frequent batches |
22:32:15 | FromDiscord | <Nisha's alt> Oh okay |
22:51:24 | FromDiscord | <Nisha's alt> Kinda wanna make a shitty language now lmao |
22:51:42 | FromDiscord | <Nisha's alt> Hm... |
22:54:47 | FromDiscord | <exelotl> I made a super crappy language for uni once |
22:55:19 | FromDiscord | <exelotl> spent more time fighting the ocaml compiler than making the language :( |
22:55:25 | FromDiscord | <Nisha's alt> Lmao |
22:56:39 | FromDiscord | <GE> What's the most reliable cross platform (works on BSD, linux, mac, and windows) GUI for nim? |
22:57:00 | FromDiscord | <Nisha's alt> Probably nimx (i think that's what it's called) iirc |
23:05:34 | FromDiscord | <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:20 | FromDiscord | <ElegantBeef> No it should still work |
23:06:41 | FromDiscord | <ElegantBeef> Though you might want to checkout nimscripter for a easier experience in life |
23:07:00 | FromDiscord | <ElegantBeef> But either way yea it really should work |
23:08:12 | FromDiscord | <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:54 | FromDiscord | <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:38 | FromDiscord | <ElegantBeef> But no nimscripter atleast doesnt support turning the nimscript into compiled code out of the box |
23:14:13 | FromDiscord | <rosewood> sent a long message, see https://paste.rs/xvt |
23:14:38 | FromDiscord | <rosewood> (edit) "http://ix.io/2VN0" => "http://ix.io/2VMZ" |
23:14:54 | FromDiscord | <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:59 | FromDiscord | <ElegantBeef> It's not a too crazy idea |
23:16:08 | FromDiscord | <ElegantBeef> I have a slightly outdated video explaining nimscripter, but it's relatively simple |
23:16:14 | FromDiscord | <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:25 | FromDiscord | <ElegantBeef> Well you need to expose the api |
23:16:53 | FromDiscord | <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:27 | FromDiscord | <ElegantBeef> Since one does `loadScript` and the other needs to do some dynamic library logic |
23:17:47 | FromDiscord | <ElegantBeef> It's probably worthwhile to just look at Nim's HCR or a plugin system for your example |
23:18:24 | FromDiscord | <ElegantBeef> Nimscript's VM is slow and copies all objects so isnt overly intuitive to work with for gameplay |
23:18:58 | FromDiscord | <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:11 | FromDiscord | <ElegantBeef> I dont think optimizing it is on anyones priority |
23:19:24 | FromDiscord | <ElegantBeef> Got other more important thing the people that are capable are working on π |
23:19:48 | FromDiscord | <rosewood> wouldn't improving nimscript improve compilation times (w.r.t macros ofc)? |
23:19:57 | FromDiscord | <rosewood> surprised it's not a priority |
23:21:50 | FromDiscord | <ElegantBeef> Well IC is currently being worked on |
23:21:59 | FromDiscord | <rosewood> IC? |
23:22:03 | FromDiscord | <ElegantBeef> Incremental compilation |
23:22:25 | FromDiscord | <ElegantBeef> Which would make the hot code reloading less of a tedious thing |
23:23:47 | FromDiscord | <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:04 | FromDiscord | <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:02 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> Well you could use a plugin system or HCR |
23:32:30 | FromDiscord | <ElegantBeef> I was uncertain what the overall desired endgoal was |
23:34:17 | FromDiscord | <ElegantBeef> https://github.com/genotrance/plugins seems like it might hit what you need |
23:42:07 | FromDiscord | <rosewood> sent a long message, see http://ix.io/2VN8 |
23:43:42 | FromDiscord | <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:05 | FromDiscord | <ElegantBeef> I dont see seemless running the nim compiler on a nimscript file to get a usable binary |
23:44:15 | FromDiscord | <ElegantBeef> But someone smarter than i might have an idea |
23:44:34 | FromDiscord | <Nisha's alt> ;) |
23:44:56 | FromDiscord | <Nisha's alt> ~~Use YAML as the scripting language, adding logic and everything lmao-~~ |
23:45:02 | FromDiscord | <Nisha's alt> /j btw |
23:45:11 | FromDiscord | <Nisha's alt> Please don't do this, even I wouldn't |
23:45:24 | FromDiscord | <ElegantBeef> Of course you wouldnt you didnt mention python or java |
23:45:42 | FromDiscord | <Nisha's alt> Lmaooo |
23:45:55 | FromDiscord | <Nisha's alt> I'll do this JUST BECAUSE you said that now :) |
23:46:32 | FromDiscord | <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:41 | FromDiscord | <Nisha's alt> Lmao- |
23:46:51 | FromDiscord | <Nisha's alt> You know me too well /hj |
23:46:59 | FromDiscord | <Nisha's alt> Though it's doable in Python easily |
23:47:12 | FromDiscord | <Nisha's alt> Nim is another story, since it's compiled, so i can't do it all dynamically |
23:47:20 | FromDiscord | <ElegantBeef> I mean it's super easy in Nim |
23:47:56 | FromDiscord | <Nisha's alt> Really? Dynamically calling existing functions? |
23:48:06 | FromDiscord | <ElegantBeef> Well yea you expose all the functions with a macro |
23:48:17 | FromDiscord | <Nisha's alt> Meh cnba for that- |
23:48:33 | FromDiscord | <Nisha's alt> ~~I'll just make a YAML to Nim transpiler-~~ |
23:49:24 | FromDiscord | <Nisha's alt> ~~And I'll make the transpiler in Python-~~ |
23:50:10 | FromDiscord | <Nisha's alt> Wait, does nim check actually work well compared to actually compiling the code? |
23:50:19 | FromDiscord | <Nisha's alt> Does it show all possible compilation errors? |
23:50:43 | FromDiscord | <ElegantBeef> it does if you tell it to |
23:50:51 | FromDiscord | <ElegantBeef> `nimcheck --errorMax:100` |
23:50:57 | FromDiscord | <ElegantBeef> `nim c --errorMax:100` |
23:50:58 | FromDiscord | <Nisha's alt> Why 100? :P |
23:51:11 | FromDiscord | <ElegantBeef> I mean i'm just showing how to get more errors |
23:51:15 | FromDiscord | <Nisha's alt> O |
23:56:36 | FromDiscord | <ElegantBeef> @rosewood all in all, hopefully someone with more than 1 braincell can answer the best way to handle this π |
23:57:04 | FromDiscord | <rosewood> I think I can probably figure it out |
23:57:20 | FromDiscord | <rosewood> Just need to get `import compiler` working haha |
23:57:27 | FromDiscord | <rosewood> so maybe I wont be able to aylmao |
23:57:50 | FromDiscord | <ElegantBeef> Is the compiler erroring or just your editor? |
23:57:56 | FromDiscord | <rosewood> compiler |
23:58:54 | FromDiscord | <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:04 | FromDiscord | <rosewood> via `--HEAD` with homebrew |
23:59:22 | FromDiscord | <rosewood> I am thinking choosenim is just not working properly on macos |
23:59:32 | FromDiscord | <rosewood> but it seems to be the correct version when doing nim -v |