00:02:22 | * | krux02 quit (Quit: Leaving) |
00:02:32 | * | j-james[m] joined #nim |
00:04:35 | FromDiscord | <For Your Health> I've had the same thought. Continue has always confused me |
00:08:49 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:26:16 | FromDiscord | <Joe-23> Just curious, is there a way to replace these `:` with curly braces `{}` and when using `mod`, `and` and `or` operators to something like `%`, `&&` and `||` respectively and ending line using `;`, so to kinda give it a a more C-like feeling |
00:27:44 | * | vicfred quit (Quit: Leaving) |
00:28:07 | * | Tanger quit (Remote host closed the connection) |
00:28:14 | FromDiscord | <juan_carlos> Make template && that replaces `and` and so on. |
00:30:56 | FromDiscord | <nikki> is there a built-in way with std/algorithm to say to use a lexical sort on tuples |
00:31:07 | FromDiscord | <juan_carlos> https://play.nim-lang.org/#ix=2EDm xD |
00:32:34 | FromDiscord | <nikki> oh wait it already does lexical kk |
00:33:31 | FromDiscord | <Joe-23> @juan_carlos Oh how would I make a tamplate? |
00:33:48 | FromDiscord | <juan_carlos> See link |
00:51:40 | FromDiscord | <ElegantBeef> You can also use source code filters https://play.nim-lang.org/#ix=2EDw |
00:51:55 | FromDiscord | <ElegantBeef> But templates are less error prone 😄 |
00:56:19 | FromDiscord | <juan_carlos> That kills strings |
00:56:42 | FromDiscord | <ElegantBeef> Hence "less error prone" 😄 |
01:02:37 | * | muffindrake quit (Ping timeout: 272 seconds) |
01:05:21 | * | Tanger joined #nim |
01:09:18 | * | vicfred joined #nim |
01:25:45 | * | cgfuh quit (Ping timeout: 240 seconds) |
01:31:14 | ForumUpdaterBot | New thread by Gcao: Question about async, see https://forum.nim-lang.org/t/7118 |
01:48:58 | * | bung joined #nim |
02:02:43 | Zoom[m] | Hm, it's strange zip is taken by a proc returning a new seq, instead of being an iterator for pairs of items |
02:03:10 | Zoom[m] | Is there such? |
02:03:53 | FromDiscord | <Rika> what? |
02:03:57 | FromDiscord | <Rika> sorry i dont understand |
02:04:27 | disruptek | there are a couple. one in zero functional and another zipper by mratsim with a funny name like fusion. |
02:08:45 | Zoom[m] | Thanks. I see iterators are not the first-class citizens in std |
02:09:17 | FromDiscord | <Rika> oh zip as in the zip function, for some reason i was thinking the library... |
02:09:59 | Zoom[m] | @Rika I was looking for an iterator which takes two collections and.. you already know it |
02:12:20 | FromDiscord | <Rika> yeah nim doesnt really have many things for closure iterators (for some reason, idk why) |
02:13:23 | disruptek | because cps pwns. |
02:14:23 | disruptek | Zevv: did that gcsafe stuff work? |
02:15:43 | Zoom[m] | disruptek: I saw that cps repo, which paper of the bunch is the most accessible? |
02:16:00 | disruptek | let me see. |
02:16:29 | disruptek | i think the 1011 is the only one i care about. |
02:17:53 | disruptek | but note that we are hewing further afield than their cpc impl. |
02:17:53 | Zoom[m] | Thanks. Recon this will soothe me into sleep in no time |
02:18:03 | disruptek | heh |
02:18:20 | disruptek | i dunno, it's pretty exciting stuff. |
02:18:29 | FromDiscord | <Rebel> Best way to break up a thicc string? No "\" 😦 |
02:18:34 | FromDiscord | <Rebel> (edit) ""\"" => ""\\"" |
02:18:39 | FromDiscord | <Rika> wdym? |
02:18:45 | disruptek | i believe those are called g-strings. |
02:19:27 | Zoom[m] | Had total Baader Meinhof moment a couple of days ago when someone mentioned CPS as a tried and gotten over with thing |
02:19:29 | FromDiscord | <ElegantBeef> @Rebel eh? https://nim-lang.org/docs/manual.html#lexical-analysis-triple-quoted-string-literals |
02:19:31 | disruptek | use tripe-quoted literals. |
02:20:20 | disruptek | btw, cps != csp. |
02:20:39 | FromDiscord | <Rebel> 👍 |
02:20:59 | disruptek | neither is new; probably dating to mid-60s or so, iirc. |
02:21:21 | FromDiscord | <Rika> lua uses a sort of cps in its c interop for async lua stuff afaik |
02:21:32 | disruptek | csp introduced in '78. |
02:21:51 | Zoom[m] | "It’s a really bizarro way to represent code that happens to make some compiler optimizations easier to do." |
02:21:53 | FromDiscord | <Rika> i think cps could be really good if we didnt have to do it manually 😛 |
02:22:05 | Zoom[m] | "No one ever for a second thought that a programmer would write actual code like that." |
02:22:07 | disruptek | cps in '75. |
02:22:12 | Zoom[m] | lol |
02:22:22 | FromDiscord | <Rika> ~~which lua makes us do manually because c so i didnt like it that much :(~~ |
02:23:00 | * | xet7_ joined #nim |
02:23:28 | disruptek | it might take a new backend for us to introduce tail call optimization, but i honestly don't know. |
02:23:59 | disruptek | our approach will be okay until then. |
02:24:24 | FromDiscord | <nikki> @Rika i think in luajit, coroutines work across c calls on the stack |
02:24:28 | FromDiscord | <nikki> or is that not what you're talking about 🤔 |
02:24:49 | * | xet7 quit (Ping timeout: 264 seconds) |
02:24:50 | disruptek | programmers actually /do/ write code like that, though. |
02:24:53 | FromDiscord | <nikki> (puc-rio lua didn't support that; idk if it supports it in >=5.4) |
02:24:54 | disruptek | that's sorta the point. |
02:25:02 | FromDiscord | <Rika> im talking about official lua |
02:25:25 | FromDiscord | <nikki> word |
02:26:54 | disruptek | the cps impl they describe is for a massive torrent server, for those of you who think maybe this is all academic. |
02:26:59 | disruptek | warez, baby. |
02:27:06 | disruptek | and pr0n. lots of pr0n. |
02:28:03 | FromDiscord | <nikki> i thought it was purely academic. now i'm not interested |
02:28:05 | FromDiscord | <Rika> academic torrents of course 😉 |
02:30:49 | disruptek | ft. lauderdale girls gone wild, naturally. |
02:33:02 | * | apahl quit (Ping timeout: 264 seconds) |
02:35:07 | * | apahl joined #nim |
02:37:29 | Zoom[m] | Applied style according to the guide and other fixes: https://github.com/ZoomRmc/rosettacode_nim/blob/main/src/stable_marriage_gale_shapley.nim Camel Case will take a while to get used to! |
02:38:35 | FromDiscord | <Rika> ngl dont know why python uses snake case when camel case is so much faster to type lol |
02:38:49 | FromDiscord | <ElegantBeef> Cause python likes underscores for everything useless |
02:39:02 | FromDiscord | <ElegantBeef> That was too easy |
02:39:02 | FromDiscord | <Rika> why innit called p_y_t_h_o_n then xdddd |
02:39:06 | FromDiscord | <Rika> ~~i kid~~ |
02:39:39 | Zoom[m] | May be because not having capital letters everywhere allows for more fluid reading? |
02:41:21 | Zoom[m] | But Araq being from Germany may have other Views on the Topic |
02:42:03 | FromDiscord | <shadow.> is there any way to do an else statement with a for loop like in python? basically `else` only executes if for was not broken |
02:42:16 | FromDiscord | <shadow.> (edit) "is there any way to do an else statement with a for loop like in python? basically `else` only executes if for was not broken ... " added "with a `break`" |
02:42:31 | FromDiscord | <Rika> idk, i found camelcase much easier to read |
02:42:46 | FromDiscord | <Joe-23> I see, thanks mate |
02:43:10 | FromDiscord | <Rika> shadow, no, i believe a lot of us not from python find it confusing ~~even i, who comes from python~~ |
02:43:16 | FromDiscord | <shadow.> fair enoough |
02:43:21 | FromDiscord | <shadow.> i can probably use `block` creatively |
02:43:35 | FromDiscord | <Rika> or just use a conditional bool 😛 |
02:43:38 | FromDiscord | <shadow.> fair |
02:44:05 | FromDiscord | <Rika> dont know how many times i searched "for loop with else" |
02:44:12 | FromDiscord | <Rika> prolly a few 10s already |
02:44:43 | FromDiscord | <shadow.> lmfao |
02:45:30 | disruptek | that's the main reason i worked on cps. |
02:45:49 | FromDiscord | <Rika> because cps is confusing? what a god |
02:46:00 | disruptek | what? |
02:46:13 | Zoom[m] | @Rika in a regular human language capital letters mark the distinct chunks of information. Having them so frequently is like a bumpy ride. |
02:46:34 | disruptek | because i wanted to write while/else. |
02:46:38 | FromDiscord | <Rika> that is true, maybe i am just used to it |
02:46:48 | FromDiscord | <Rika> oh, i see, lol |
02:46:58 | Zoom[m] | Yeah, that's the strongest factor, I believe |
02:47:38 | Zoom[m] | gnite everyone |
02:47:43 | disruptek | peace. |
02:47:55 | disruptek | think of me and touch yourself. |
02:48:40 | FromDiscord | <Rika> now im not hard |
02:50:45 | * | vicfred quit (Quit: Leaving) |
03:18:08 | FromDiscord | <ElegantBeef> @shadow. To completely make something no one should use, here is a forelse 😛 https://play.nim-lang.org/#ix=2EE9 |
03:20:37 | FromDiscord | <shadow.> gracias |
03:20:49 | FromDiscord | <shadow.> i will most likely not use that but good to know lol |
03:28:21 | * | vicfred joined #nim |
03:29:26 | * | vicfred quit (Max SendQ exceeded) |
03:29:53 | * | vicfred joined #nim |
03:35:24 | * | rockcavera quit (Remote host closed the connection) |
03:51:25 | ForumUpdaterBot | New thread by Jasonfi: How to hot reload a Jester web app?, see https://forum.nim-lang.org/t/7119 |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:33 | * | supakeen joined #nim |
04:07:34 | disruptek | wut |
04:07:40 | disruptek | that's not for/else. |
04:08:02 | disruptek | first of all, it's called `what/else`. |
04:08:11 | disruptek | secondly, the else is a peer to the what. |
04:09:42 | disruptek | there's also a variant that has a clause that is executed if the loop body doesn't run at all. |
04:10:07 | FromDiscord | <ElegantBeef> > basically else only executes if for was not broken with a break |
04:10:27 | disruptek | yeah, i know. |
04:10:46 | FromDiscord | <ElegantBeef> That's exactly what that does |
04:10:58 | disruptek | i tried to get araq to add it to nim but he balked. |
04:11:14 | FromDiscord | <ElegantBeef> I mean yes it's garbage 😄 |
04:11:17 | disruptek | you have too many colons. and i don't say that lightly. |
04:11:34 | FromDiscord | <ElegantBeef> Yea i agree, also it's not nearly as usable |
04:11:53 | disruptek | but the version impl using cps can actually be more powerful. |
04:11:56 | FromDiscord | <ElegantBeef> Considering you need the condition, there and not just checking if it broke |
04:13:02 | disruptek | you should learn about named blocks in any event. |
04:13:24 | disruptek | and seriously, take a look at cps. |
04:13:35 | FromDiscord | <ElegantBeef> I know about them |
04:14:00 | disruptek | well, then... |
04:14:04 | disruptek | rtfm div operator. |
04:14:12 | FromDiscord | <ElegantBeef> Indeed |
04:44:58 | * | bung quit (Quit: Lost terminal) |
05:07:12 | * | thomasross quit (Ping timeout: 272 seconds) |
05:10:56 | * | mbomba quit (Quit: WeeChat 3.0) |
05:51:11 | * | NimBot joined #nim |
05:51:35 | ForumUpdaterBot | New thread by Jasonfi: Nim c stuck at 99% CPU, see https://forum.nim-lang.org/t/7120 |
06:05:09 | * | idf quit (Quit: ZNC 1.7.2+deb3 - https://znc.in) |
06:07:06 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:19:46 | * | habamax joined #nim |
06:26:07 | Zevv | disruptek: I didn't get to test it. I'm not sure what the right approach is. |
06:34:01 | * | narimiran joined #nim |
06:51:41 | ForumUpdaterBot | New thread by Benjamindlee: Why does JSON serializing a table not work properly?, see https://forum.nim-lang.org/t/7121 |
07:19:36 | * | PMunch joined #nim |
07:33:02 | * | apahl quit (Ping timeout: 260 seconds) |
07:35:08 | * | apahl joined #nim |
07:48:00 | * | D_ quit (Remote host closed the connection) |
07:48:57 | * | D_ joined #nim |
08:12:35 | PMunch | Hmm, anyone know how the Gtk icon cache format works? |
08:15:55 | disruptek | clyybber: it has to be able to rewrite itself because that's what it uses to persist data. |
08:29:28 | FromDiscord | <ElegantBeef> Pmunch what format? 😄 |
08:31:02 | PMunch | Look in /usr/share/icons/<Theme name>/ at the file called icon-theme.cache |
08:31:25 | PMunch | I was wondering if I could read bitmap data out of that instead of having to deal with SVGs |
08:32:51 | FromDiscord | <ElegantBeef> Depends on the icon theme |
08:33:25 | PMunch | What do you mean? |
08:33:36 | FromDiscord | <ElegantBeef> Some icon packs use pngs some use svgs |
08:34:59 | FromDiscord | <ElegantBeef> Like Moka for instance uses pngs |
08:35:08 | PMunch | I know that some uses SVGs |
08:35:15 | PMunch | But I just want bitmap data I can draw |
08:35:37 | * | zielmicha__ quit (Ping timeout: 264 seconds) |
08:35:38 | PMunch | I have actually considered writing a stand-alone program to interface with the freedesktop icon specification |
08:35:45 | * | zielmicha__ joined #nim |
08:36:05 | FromDiscord | <ElegantBeef> This is where i jokingly suggest making inkscape a dependancy and just export images when needed |
08:36:13 | * | fowl quit (Ping timeout: 246 seconds) |
08:36:19 | PMunch | To avoid having to write stuff like this: https://github.com/Tomas-M/xlunch/blob/master/extra/genentries#L172 |
08:36:34 | PMunch | (yes, that is freedesktop parsing in bash, apparently I hate myself) |
08:37:27 | PMunch | @ElegantBeef, that script actually supports the `convert` utility from imagemagick to convert svgs to pngs |
08:37:50 | * | fowl joined #nim |
08:37:53 | FromDiscord | <ElegantBeef> Oh yea imagemagick exists |
08:38:29 | PMunch | The annoying part is that these things exists in Gtk |
08:38:46 | PMunch | Like it has a function to get the icon for an app given whatever icon theme is set |
08:38:56 | PMunch | Which is part of what that horrible script does |
08:39:59 | PMunch | Try to figure out what your theme is, then go look for that icon theme (or themes, they can have fallbacks), then find the icon within the theme at the correct resolution, select the closest one, or convert it from svg |
08:44:16 | * | letto quit (Quit: Konversation terminated!) |
08:46:11 | * | letto joined #nim |
08:47:45 | lain | hm. when I build drnim on fresh installs of Debian Buster or Arch Linux, from version-1-4 or devel branches, the final link step for the drnim binary fails with "/usr/bin/ld: //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line". repeating the link command with -lpthread added makes it succeed |
08:48:24 | lain | this seems like a bug...? |
08:50:59 | PMunch | Hmm, that does in fact seem like a bug |
08:54:04 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
08:55:24 | * | vicfred quit (Quit: Leaving) |
08:57:11 | * | jjido joined #nim |
08:58:00 | lain | I'll file an issue with the details :3 |
09:24:04 | * | Tanger quit (Quit: Leaving) |
09:31:27 | * | sagax quit (Ping timeout: 260 seconds) |
09:36:05 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:41:30 | FromDiscord | <Ricky Spanish> does arraymancer have cnn layers available? |
09:50:48 | * | oculuxe quit (Read error: Connection reset by peer) |
09:52:41 | * | oculux joined #nim |
09:55:25 | FromDiscord | <Vindaar> @Ricky Spanish see here: https://github.com/mratsim/Arraymancer/blob/master/examples/ex02_handwritten_digits_recognition.nim |
09:55:53 | FromDiscord | <Ricky Spanish> ah awesome thank you @Vindaar |
10:05:04 | Araq | there is a new tag, 'vote', see https://github.com/nim-lang/Nim/pull/16034 |
10:05:05 | disbot | ➥ fix #16025 repr now consistent: does not insert trailing newline |
10:05:23 | Araq | maybe it works out, the idea is to do what the vote's outcome suggests we should do |
10:06:26 | PMunch | So you react thumbs up/down on the main post to cast you vote? |
10:17:06 | Araq | yeah |
10:29:53 | PMunch | Hmm, is there a project to read Xresources from Nim? |
10:44:25 | Zevv | dude this is 2020 |
10:44:27 | Zevv | who does X |
10:44:28 | Zevv | X is dead |
10:44:31 | Zevv | long live X! |
11:00:10 | * | D_ quit (Quit: No Ping reply in 180 seconds.) |
11:00:21 | * | D_ joined #nim |
11:08:48 | PMunch | I know X :( |
11:08:57 | PMunch | I don't (yet) know Wayland |
11:21:43 | * | krux02 joined #nim |
11:30:22 | * | krux02 quit (Remote host closed the connection) |
11:47:01 | FromDiscord | <Ricky Spanish> isnt weyland still a bit so-so with the support for many distros other than the top 5 lets say? |
11:53:38 | FromGitter | <AZ-X> Hello, about binary size, is this true? ⏎ ⏎ > https://forum.nim-lang.org/t/7021#44087 |
11:57:57 | Araq | read the thread |
11:58:07 | Araq | what do you think is false? |
11:58:42 | Araq | timezones can cause bloat but it depends on what package you use, the stdlib isn't affected |
12:01:08 | * | rockcavera joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:33 | * | supakeen joined #nim |
12:20:01 | * | lritter joined #nim |
12:44:03 | * | Vladar joined #nim |
12:46:11 | * | antranigv joined #nim |
12:46:16 | * | antranigv quit (Remote host closed the connection) |
12:46:42 | * | antranigv joined #nim |
12:52:19 | * | antranigv quit (Quit: ZNC 1.7.5 - https://znc.in) |
12:52:31 | * | Perkol joined #nim |
12:52:48 | * | antranigv joined #nim |
12:53:33 | FromGitter | <AZ-X> Why Nim's stdlib binds to openssl? |
12:57:12 | FromGitter | <AZ-X> https://github.com/nim-lang/Nim/issues/14719 |
12:57:13 | disbot | ➥ Make SSL/TLS implementation pluggable |
12:58:36 | FromGitter | <AZ-X> Even Google has its BoringSSL |
13:00:51 | FromGitter | <HJarausch_gitlab> How to find out the reasons the compiler "thinks" my func has side effects? |
13:02:11 | FromDiscord | <Joe-23> WIth its OS-development, do developers disable GC? |
13:02:20 | FromGitter | <ynfle> @HJarausch_gitlab, It's a pain part |
13:02:42 | FromGitter | <ynfle> Do you wanna share your code? |
13:03:38 | PMunch | AZ-X, I think Nim was built against OpenSSL before there were any good alternatives and everyone were using OpenSSL |
13:03:44 | * | qwertfisch quit (Read error: Connection reset by peer) |
13:04:02 | PMunch | Joe-23, typically disable the default GC, but ARC/ORC should work fine |
13:04:13 | PMunch | Is there a way to get the path to the running exe? |
13:04:34 | FromGitter | <AZ-X> not everyone |
13:04:43 | FromGitter | <AZ-X> I do NOT use opennssl |
13:05:28 | PMunch | Maybe not today, but when Nim was released 12 years ago? |
13:05:54 | * | qwertfisch joined #nim |
13:08:06 | PMunch | BearSSL was released 4 years ago, BoringSSL is a fork of OpenSSL that was released 4 years ago as well, and Google specifically tells you not to use it |
13:08:19 | FromGitter | <AZ-X> First appeared 2008; 12 years ago |
13:08:43 | FromDiscord | <Rika> what date is that for? BoringSSL? |
13:08:55 | FromGitter | <AZ-X> It's remarkable |
13:09:44 | * | bung joined #nim |
13:11:40 | PMunch | @Rika, Nim |
13:11:53 | FromDiscord | <Rika> yeah i know i was asking AZ though |
13:12:31 | * | hmmm joined #nim |
13:12:36 | hmmm | hallo! |
13:13:45 | PMunch | Hi hmmm |
13:14:29 | FromDiscord | <Rika> mmm levels fluctuate every day |
13:14:39 | FromDiscord | <Joe-23> @PMunch Isn't ARC a type of GC? |
13:14:46 | FromDiscord | <Joe-23> What is ORC? |
13:14:53 | PMunch | ARC with cycle collection |
13:14:58 | PMunch | And kinda, but not really |
13:15:14 | PMunch | https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |
13:16:37 | FromGitter | <AZ-X> The language itself looks better than Go and Rust |
13:18:07 | FromDiscord | <Rika> lol |
13:25:16 | FromDiscord | <Joe-23> @AZ-X Couldn't agree with you more |
13:25:19 | Araq | to the best of my knowledge ORC is ready for kernel development. It also builds on top of a O(1) allocator. But notice that other GCs could also be made to work in kernel-space. It's just a myth that kernels cannot have GCs. Also, if you think that C's way of MM is good for kernels you're mistaken, C makes it very easy to allocate on the stack but for a production OS you don't have much stack space |
13:25:24 | FromDiscord | <Joe-23> @PMunch Thanks |
13:25:44 | FromDiscord | <Joe-23> @PMunch Which one is more efficent, the ownership model or ARC/ORC that Nim does? |
13:26:23 | PMunch | No idea :P |
13:26:26 | PMunch | Maybe Araq knows |
13:26:45 | narimiran | hey hmmm! |
13:29:20 | Araq | ownership vs ARC, difficult question. ARC is an ownership model, Nim's view types are an ownership model. |
13:30:04 | Araq | in practice you have plenty of more time left for optimization with Nim than with Rust. |
13:30:30 | Araq | and Nim doesn't stigmatize unsafe code as much as Rust does. |
13:30:52 | FromDiscord | <Joe-23> @Araq So Nim can be safer than Rust? |
13:31:13 | FromDiscord | <Joe-23> @Araq Sorry what do you mean by this? |
13:31:30 | Araq | what do you mean? You just switched from "efficient" to "safer" |
13:31:59 | * | Romanson joined #nim |
13:34:44 | FromDiscord | <Joe-23> > and Nim doesn't stigmatize unsafe code as much as Rust does.↵Sorry mate what do you exactly mean by this |
13:36:12 | hmmm | is there any nim library that has dataframes like pandas? |
13:36:34 | narimiran | hmmm: https://nimble.directory/search?query=dataframe |
13:36:46 | hmmm | oh nari |
13:36:48 | hmmm | thanks :> |
13:36:54 | Araq | the way I wrote it. Nim's 'cast' is an expression, Rust's 'unsafe' is a block, you need the unsafe block to call into C functions iirc |
13:37:17 | FromDiscord | <Joe-23> @Araq I see |
13:37:57 | FromDiscord | <Joe-23> @Araq And what do you mean by this? |
13:38:20 | FromDiscord | <Joe-23> (edit) "And" => "Sorry mate but" |
13:40:49 | mipri | *shrug*, if the efficient thing to do involves derefencing a pointer, in Nim code you can do that without someone grepping your code for the required unsafe blocks and complaining about it. |
13:41:05 | planetis[m] | @Zoom for me your code went from unreadable to perfect (but I'm used to nim naming convention), nice stuff |
13:41:45 | mipri | the unsafe blocks themselves aren't that onerous, but you might accidentally optimize for complaints rather than speed. that's how I read that. |
13:42:06 | planetis[m] | also .compiletime pragma is not needed (line 32, 39) since it's not called from a macro |
13:42:31 | Zoom[m] | planetis: Nice to hear. |
13:42:33 | planetis[m] | and echo takes varargs so you can skip the string concats |
13:42:38 | Araq | mipri, well maybe they changed that but calling into C required 'unsafe' so you could have an unhealthy dose of unsafe blocks in your code |
13:43:10 | bung | on windows testament not work for pattern ? `no tests were found for pattern: 'tests/*.nim'` |
13:43:16 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
13:43:41 | * | qwertfisch joined #nim |
13:44:15 | mipri | no, that's the still the case, but the unsafes can stop at the first wrapper function with an unsafe block. |
13:44:22 | FromDiscord | <Joe-23> I see, thanks |
13:44:33 | FromDiscord | <Vindaar> @hmmmm NimData is nice if you have a static schema and want an iterator based library for your code. Mostly work with row based things. `numnim` I wasn't even aware of. The dataframe in ggplotnim is dynamic (columns defined at runtime) and is much closer to R's dplyr in syntax. For the latter I'm there to help 🙃 |
13:45:58 | FromDiscord | <Vindaar> hmmm ^ |
13:47:13 | Zoom[m] | planetis: I'm really annoyed by doing `for i, item in enumerate(array):` so I could index another array in the loop, instead of using proper `zip`. But since this code is intended for Rosetta I shouldn't use lang-sugaring libs |
13:47:52 | narimiran | Zoom[m], planetis[m]: what code are you talking about? |
13:48:18 | planetis[m] | https://github.com/ZoomRmc/rosettacode_nim/blob/main/src/stable_marriage_gale_shapley.nim |
13:48:42 | mipri | add your preferred version as an alternate |
13:48:45 | Zoom[m] | It doesn't matter. Code which traverses 2 arrays in parallel |
13:48:50 | planetis[m] | Zoom: which lines do you refer to? |
13:49:10 | Zoom[m] | 33-35, 40-42 |
13:49:34 | narimiran | do you really need `enumerate` there? |
13:49:56 | Zoom[m] | I could use indexes for both, but it's even more perverse |
13:50:13 | planetis[m] | how would you use zip? |
13:50:16 | hmmm | Vindaar I'm very very noob so I understand like 12% of what you said, I need a dataframe lib that takes my static tables, combine them together, maybe do some sums while we are there, and spit them out |
13:50:26 | planetis[m] | they are nested |
13:50:31 | Zoom[m] | `for a,b in zip(arrayA,arrayB):` |
13:50:50 | narimiran | but arrayB is a row in arrayA? |
13:50:52 | FromDiscord | <Rika> why cant you use zip? |
13:51:08 | Zoom[m] | @Rika, there isn't one in STD |
13:51:13 | narimiran | why can't you do `for r, prefArray in prefs):`? |
13:51:20 | Zoom[m] | There is one, but ot's not doing what it's supposed to |
13:51:34 | FromDiscord | <Rika> std? or `system`? |
13:51:45 | FromDiscord | <Rika> sequtils has a zip... |
13:52:03 | narimiran | but arrayB is a row in arrayA?? |
13:52:05 | Zoom[m] | I know! |
13:52:05 | FromDiscord | <Rika> > There is one, but ot's not doing what it's supposed to↵how so? |
13:52:30 | Zoom[m] | @Rika, it produces a new seq, instead of being an iterator for items |
13:52:56 | FromDiscord | <Rika> well okay understood |
13:53:05 | FromDiscord | <Rika> why cant you use `pairs` then? |
13:53:10 | FromDiscord | <Rika> why the enumerate, i mean |
13:53:24 | narimiran | that's what i asked too |
13:53:37 | narimiran | `for r, prefArray in prefs: for c, contender in prefArray:` works |
13:54:14 | planetis[m] | narimiran: i like your std/enumerate module any chance we can fit in more forloop macros like zip? |
13:54:50 | FromDiscord | <Rika> for loop macros are still experimental from what i know |
13:54:52 | narimiran | Zoom[m]: here's a version without enumerate: http://ix.io/2EGI |
13:54:56 | Zoom[m] | narimiran: Ah, it's the same thing as enumerate, in this instance. So it doesn't really matter. I wan to iterate items, not indexes |
13:55:24 | planetis[m] | Rika: not anymore! |
13:55:30 | narimiran | Zoom[m]: one meaningless import less. it matters to me :P |
13:55:32 | FromDiscord | <Rika> oh really? nice |
13:55:48 | Zoom[m] | narimiran: Yeah, it's just me not knowing the std well enough yet |
13:55:56 | narimiran | planetis[m]: what "forloop macro like zip"? |
13:55:57 | FromDiscord | <Rika> guess we're making a `forutils` module soon, i assume |
13:56:19 | planetis[m] | yeah just zip |
13:56:20 | FromDiscord | <Rika> narimiran, a zip that iterates instead of constructs a seq i assume |
13:56:35 | FromDiscord | <shadow.> is there a way to zip two range iterators? |
13:56:40 | FromDiscord | <shadow.> somethin like that |
13:56:40 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2EGJ |
13:56:46 | Zoom[m] | That would be nice, as well as a couple of other iterators |
13:56:54 | FromDiscord | <Rika> man what kinda damn timing do you have lol |
13:56:58 | FromDiscord | <shadow.> lol wait |
13:56:59 | FromDiscord | <shadow.> is this |
13:56:59 | FromDiscord | <Rika> that was nice timing |
13:57:01 | FromDiscord | <shadow.> what u guys r talking abt |
13:57:02 | FromDiscord | <shadow.> LMAO |
13:57:04 | FromDiscord | <Rika> zip |
13:57:07 | FromDiscord | <shadow.> damn |
13:57:08 | FromDiscord | <Rika> we were talking about zip |
13:57:12 | FromDiscord | <shadow.> so im going to assume there's no way to do that |
13:57:13 | FromDiscord | <shadow.> lmao |
13:57:20 | planetis[m] | mratsim has done something like that |
13:57:23 | FromDiscord | <Rika> yeah not right now unless you dont mind creating seqs |
13:57:25 | FromDiscord | <shadow.> ig i can just use math lmao |
13:57:33 | FromDiscord | <Rika> unless you dont mind a third party lib |
13:57:36 | FromDiscord | <shadow.> hmm well |
13:57:40 | FromDiscord | <Rika> in which case i think zerofunctional will work |
13:57:43 | FromDiscord | <shadow.> fair enough |
13:57:48 | FromDiscord | <shadow.> i might be able to get away w math lemme try this |
13:58:08 | Zoom[m] | I used iterators extensively in some code. For example, I implemented wheels (overlapping cycling over arrays of different length) completely without index arithmetic. It was sooooo satisfying. |
13:58:17 | narimiran | what is stopping one to write `zip` iterator, based on the current `sequtils.zip` proc? |
13:58:17 | FromDiscord | <shadow.> nvm |
13:58:18 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2EGK |
13:58:19 | FromDiscord | <shadow.> math saved the day |
13:58:46 | planetis[m] | narimiran: varargs zip(a, b, c, d) etc |
13:59:15 | Zoom[m] | narimiran: creating a new seq for each pair? |
13:59:43 | Zoom[m] | I don't need a new seq, I want a view/mutable view into pairs of contained items |
14:00:19 | planetis[m] | Zoom: your enumerate iteration shouldn't copy with gc:arc |
14:00:33 | FromDiscord | <Rika> theyre asking about zip not enumerate |
14:00:44 | FromDiscord | <Rika> zip will still copy with arc lol |
14:01:11 | Zoom[m] | planetis: I was answering narimiran on what's wrong with using current zip in my case. |
14:01:23 | planetis[m] | ok my bad |
14:01:44 | FromDiscord | <Vindaar> hmmm: gonna make food now, so afk a bit but: if you can link an example of what data you have and what you want I can show you how to use nimdata / ggplotnims df |
14:01:52 | Zoom[m] | I agree I used enumerate where I should have used pairs iter. I just didn't find it |
14:05:18 | narimiran | Zoom[m]: but how would you use `zip` instead of enumerate/pairs? |
14:08:22 | Zoom[m] | ```for a,b in zip(prefs,result): |
14:08:22 | Zoom[m] | for c,d in zip(a,b): |
14:08:22 | Zoom[m] | d=c``` |
14:08:30 | * | Zoom[m] sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/SpmAAgkkdEHLJBsswnGAYklj/message.txt > |
14:08:37 | Zoom[m] | daaaamn |
14:08:52 | Zoom[m] | Multiline in Element sucks |
14:09:18 | Zoom[m] | Sorry for that. |
14:09:30 | Zoom[m] | narimiran: `for a,b in zip(prefs,result): \ for c,d in zip(a,b): \ d=c` |
14:09:52 | FromGitter | <HJarausch_gitlab> I need to loop with an int8 loop variable (since it will be put into a bitset). Currently I have for i in 0i8..8i8 but that's ugly. Is there something more beautiful? |
14:10:22 | narimiran | Zoom[m] i don't think that would work as you expect/want |
14:11:11 | narimiran | the way it is written now, it looks like you just did `result = prefs` in a convoluted way |
14:12:38 | narimiran | @HJarusch - it is not ugly |
14:12:43 | Zoom[m] | narimiran: I just didn't do anything with the items |
14:13:15 | narimiran | @HJarusch - you might lose the latter `i8`, but not sure |
14:13:37 | Zoom[m] | Or better `for i,j in prefs.zip(result).flat_map((x,y) => zip(x,y)): \ doSomethingWithThePair(i,j)` |
14:13:53 | * | astronavt quit (Remote host closed the connection) |
14:14:03 | FromGitter | <HJarausch_gitlab> I have a 'func' where Nim complains it has side effects. Is there any means to ask Nim why it thinks so |
14:14:10 | narimiran | Zoom[m]: run before 4raq sees that `flat_map` there!! |
14:14:21 | narimiran | @HJarusch - show us the code |
14:14:23 | Zoom[m] | :D |
14:14:24 | planetis[m] | ot: i tryed an example with zip macro https://play.nim-lang.org/#ix=2EGU it does seem to copy string elements, but maybe it can work with views |
14:15:14 | Zoom[m] | planetis: isn't this what it promises to do in the docs? |
14:15:14 | * | astronavt joined #nim |
14:15:55 | * | rockcavera quit (Remote host closed the connection) |
14:16:27 | * | astronavt quit (Remote host closed the connection) |
14:17:22 | FromGitter | <HJarausch_gitlab> import sets ⏎ type ⏎ DigSet = array[9,set[int8]] ⏎ T2int = tuple[f:int8,s:int8] ⏎ var ... [https://gitter.im/nim-lang/Nim?at=5fb67e72b4283c208a74c1fd] |
14:17:30 | Zoom[m] | From what I can tell zip from zero_functional is what I wanted, but again, not for Rosetta. I find it silly when there's a smartass who finds one function in some 3d party lib for his lang which performs the task in question and writes a one-liner using that lib, instead of implementing at least a reasonable part of the logic. |
14:17:46 | narimiran | @HJarusch - please use https://play.nim-lang.org/ to share the code |
14:18:44 | FromGitter | <HJarausch_gitlab> https://play.nim-lang.org/#ix=2EGZ |
14:19:24 | FromGitter | <HJarausch_gitlab> But in future I'd like to find out myself. So, can the Nim compiler give me some hints? |
14:19:25 | narimiran | @HJarusch - you're accessing a var outside your func |
14:19:44 | narimiran | also, there's no bitset in sight |
14:19:48 | narimiran | you don't need int8 |
14:21:07 | narimiran | btw, try to run `nimpretty` on your file from time to time |
14:21:14 | planetis[m] | Zoom: you make a good point, rosseta code looses its value if people just import libs |
14:21:40 | narimiran | it won't fix wrong cases for your variables, but at least it will fix all the inconsistent whitespaces |
14:21:59 | FromGitter | <HJarausch_gitlab> I thought 'set[int8]' is a bit set - isn't it? Furthermore, why is 'read access' of a 'var' outside my func a side effect |
14:22:16 | narimiran | oh, true. sorry, i've only seen `HashSet` |
14:22:33 | * | astronavt joined #nim |
14:23:06 | narimiran | "The noSideEffect pragma is used to mark a proc/iterator to have no side effects. This means that the proc/iterator only changes locations that are reachable from its parameters and the return value only depends on the arguments. " |
14:23:14 | Zoom[m] | planetis: That's why I'm venting over that zip here. Didn't Araq said he's pro- "fat" standard lib? I think I read something like that recently |
14:23:15 | FromDiscord | <Rika> HJarausch because the parameters of the function do not dictate the state of the var outside the function |
14:23:16 | narimiran | from the manual: https://nim-lang.github.io/Nim/manual.html#pragmas-nosideeffect-pragma |
14:23:43 | Zoom[m] | * planetis: That's why I'm venting over that zip here. Didn't Araq said he's pro- feature-rich standard lib? I think I read something like that recently |
14:24:16 | FromDiscord | <Rika> i think its just that the core devs are very busy |
14:24:23 | FromDiscord | <Rika> and not that they dont like the idea |
14:24:54 | narimiran | give this a read: https://nim-lang.github.io/Nim/nep1.html |
14:27:59 | FromGitter | <HJarausch_gitlab> My func doesn't change a global variable, but yes, the return value depends on global variables. This type of "no side effects" is too strict for me. Is there something in between, i.e. let the compile check only if something is `changed` outside? |
14:28:00 | * | beatmox quit (Read error: Connection reset by peer) |
14:28:00 | * | sagax joined #nim |
14:28:27 | * | beatmox joined #nim |
14:28:32 | FromDiscord | <Rika> i dont understand, disallowing reading an outside variable is not strict at all |
14:28:45 | narimiran | here is the manually prettified version of your code: https://play.nim-lang.org/#ix=2EH4 |
14:29:06 | FromDiscord | <Rika> see: what if another function changes that outside variable? isnt it expected that "whatever goes in a func determines what goes out and nothing else"? |
14:29:16 | narimiran | pass the variable as a proc argument. problem solved |
14:30:45 | narimiran | 4 arguments in this case, if i counted correctly. or just make it a `proc` and call it a day |
14:35:35 | planetis[m] | i remembered i tried to add zip macro to stdlib but was rejected https://github.com/nim-lang/Nim/pull/12317 |
14:35:36 | disbot | ➥ Added zip macro |
14:36:24 | FromGitter | <HJarausch_gitlab> @narimiran Thanks for your help. It's hard to get accustomed the peculiarities of Nim. Probably I'll stick to Python/C++ unless I need the speed and parallelism of Nim |
14:37:04 | narimiran | even in python, you need to write your code following some conventions ;) |
14:37:42 | narimiran | it is `var_name` not `Var_Name`, etc. |
14:38:46 | narimiran | but don't dismiss nim too early, it might surprise you the more you use it |
14:39:58 | planetis[m] | now that forloop macros are official, can i try again? |
14:41:08 | narimiran | planetis[m]: yeah, i would say so (but you know who has the final word ;)) |
14:41:26 | planetis[m] | :p |
14:44:53 | ForumUpdaterBot | New thread by Pietroppeter: New video on move semantics by Araq (rebase conf 2020), see https://forum.nim-lang.org/t/7123 |
14:45:07 | Zoom[m] | planetis: I agree with the last comment there, having multiple args is not the first priority |
14:46:58 | planetis[m] | ok i will start with a simpler change and improve enumerate by supporting `for (i, x) in enumerate(a)` syntax |
14:47:33 | Zoom[m] | Eh, what's there to improve? |
14:47:53 | Zoom[m] | Haven't looked into the code, but it worked for me as I expected |
14:48:16 | * | hmmm quit () |
14:48:45 | planetis[m] | tuple unpacking syntax |
14:49:07 | planetis[m] | `for i, x in ..` vs `for (i, x) in ..` |
14:49:47 | planetis[m] | and also `for i in enumerate(x)` needs a proper error |
14:50:20 | planetis[m] | (it's not possible, unfortunately) |
14:52:26 | Zoom[m] | I got confused. Do you mean you want the immediate unpacking to not be necessary? |
14:54:07 | planetis[m] | no to support this syntax: https://play.nim-lang.org/#ix=2EHj |
14:54:59 | FromDiscord | <Quibono> How do you do an import of a file that is in another subdirectory of the same parent folder? |
14:55:14 | FromDiscord | <lqdev> you can use relative paths |
14:55:22 | FromDiscord | <lqdev> `import ../other_subdir/submod` |
14:55:43 | FromDiscord | <Quibono> Okay cool, I wasn't sure how it worked since you had to go up a level, but that makes sense, thank you. |
14:55:55 | FromDiscord | <Quibono> I really appreciate how supportive and helpful the Nim community is. |
14:58:11 | FromDiscord | <Quibono> Hrm, it's saying it can't open it. |
14:58:24 | Zoom[m] | planetis: In that case, I don't understand what's the difference between `for a,b` and `for (a,b)` are. I thought the first is the shorthand for the second, as with procs. |
14:58:45 | Zoom[m] | Also, did you intend to write `enumerate(a)`, not `x` |
14:58:48 | Zoom[m] | ? |
14:59:10 | FromDiscord | <Quibono> @lqdev I figured it out, nevermind, didn't realize it was literally .. |
14:59:20 | planetis[m] | none but it produces different ast |
14:59:27 | planetis[m] | yes |
14:59:51 | FromDiscord | <lqdev> i believe that there actually is a semantic difference |
14:59:59 | FromDiscord | <lqdev> because wrapping in `()` can do tuple unpacking |
15:00:08 | FromDiscord | <lqdev> eg. `for i, (a, b, c) in thing` |
15:00:39 | FromDiscord | <lqdev> this is interpreted as two loop variables, the latter to be tuple-unpacked |
15:03:33 | * | beatmox quit (Quit: ZNC 1.8.0 - https://znc.in) |
15:03:34 | * | hmmmmm joined #nim |
15:03:45 | * | beatmox joined #nim |
15:04:51 | FromGitter | <HJarausch_gitlab> Is there a base class for "file" and "StringStream". I'd like to path either an open file of an StringStream to a proc where it is accessed by the .lines iterator only. Is there a simple solution short some "union type"? |
15:05:33 | Zoom[m] | lqdev, you're right. I just thought it's always (x,y) under the hood and x,y is just a sugar |
15:06:18 | FromDiscord | <lqdev> @HJarausch_gitlab make the proc generic? |
15:06:28 | FromDiscord | <lqdev> `proc doStuff[T](file: T)` |
15:07:04 | FromDiscord | <lqdev> you can constrain T to accept File or Stream if you need to `proc doStuff[T: File | Stream](inp: T)` |
15:08:06 | FromGitter | <HJarausch_gitlab> Thanks, that's just what I was looking for. |
15:17:07 | * | waleee-cl joined #nim |
15:17:52 | * | Perkol quit (Quit: Leaving) |
15:19:41 | * | a_chou joined #nim |
15:27:05 | Zevv | disruptek: I got it to work with a compilation flag indeed. So now the user explicitly chooses to make a gcsafe npeg or not. |
15:32:19 | narimiran | Zevv: btw, did he tell you that he dreamed of me? |
15:32:34 | Zevv | he dreams of all of us. you are not unique |
15:32:45 | Zevv | you are not special |
15:32:48 | Zevv | i am not jealous |
15:33:48 | narimiran | nothing to be jealous at. it was just a wet dream, nothing more |
15:34:13 | Zevv | a bit old for that, eh |
15:35:01 | * | abm joined #nim |
15:35:14 | narimiran | not that kind of wet dream |
15:36:21 | Zevv | that's a relief |
15:36:39 | supakeen | what does gcsafe do |
15:37:36 | narimiran | Zevv: he wasn't very explicit about it, but i think it was a relief, yes |
15:39:02 | * | natrys joined #nim |
15:40:43 | * | NimBot joined #nim |
15:43:42 | * | PMunch quit (Quit: leaving) |
15:49:47 | * | D_ quit (Remote host closed the connection) |
15:52:01 | * | Zevv quit (Quit: Lost terminal) |
15:52:31 | * | Zevv joined #nim |
15:54:12 | * | natrys quit (Quit: natrys) |
15:54:23 | * | D_ joined #nim |
15:57:47 | * | hnOsmium0001 joined #nim |
16:04:26 | * | vicfred joined #nim |
16:05:08 | narimiran | if somebody would like to give Nim 1.4.1 a try: https://github.com/nim-lang/nightlies/releases/tag/2020-11-19-version-1-4-4ddb8feb939f57ea8df1ae9e05f47e26cd031209 |
16:05:24 | * | vicfred quit (Max SendQ exceeded) |
16:05:26 | narimiran | or grab it from version-1-4 branch on github: https://github.com/nim-lang/Nim/tree/version-1-4 |
16:05:51 | * | vicfred joined #nim |
16:06:59 | * | vicfred quit (Max SendQ exceeded) |
16:07:26 | * | vicfred joined #nim |
16:08:34 | * | vicfred quit (Max SendQ exceeded) |
16:09:05 | * | vicfred joined #nim |
16:11:03 | ForumUpdaterBot | New thread by AlectronikHQ: How to write a macro correctly which contains a 'char'?, see https://forum.nim-lang.org/t/7124 |
16:11:56 | * | a_chou quit (Remote host closed the connection) |
16:24:58 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2EI5 |
16:26:01 | FromDiscord | <Vindaar> @tinygiant `JsonNode` is a `ref object`. You need to add a `result = newJObject` somewhere before the loop |
16:26:11 | FromDiscord | <Vindaar> (edit) "newJObject`" => "newJObject()`" |
16:26:18 | * | Romanson quit (Quit: Connection closed for inactivity) |
16:26:54 | FromDiscord | <tinygiant> @Vindaar Awesome, worked perfectly. Thanks for the knowledge. |
16:30:03 | * | lritter quit (Quit: Leaving) |
16:31:19 | * | lritter joined #nim |
16:37:51 | FromDiscord | <Daniel> whats new in 1.4.1 |
16:37:56 | FromDiscord | <Daniel> (edit) "whats new in 1.4.1 ... " added "?" |
16:39:10 | * | rockcavera joined #nim |
16:41:15 | FromGitter | <AZ-X> I learned Nim for an hour and found this https://github.com/nim-lang/csources/issues/12 |
16:41:15 | disbot | ➥ Build setup is susceptible to backdooring |
16:42:49 | * | Vladar quit (Remote host closed the connection) |
16:43:20 | * | bung quit (Quit: Lost terminal) |
16:43:23 | FromGitter | <AZ-X> quote > dom96 : I'm certain that this issue will fix itself in the future. Once Nim is stable enough it will be buildable using a previous version of itself, after that the C sources will no longer be necessary. |
16:44:57 | * | Vladar joined #nim |
16:45:17 | FromGitter | <AZ-X> quote > dom96 : I'm certain that this issue will fix itself in the future. Once Nim is stable enough it will be buildable using a previous version of itself, after that the C sources will no longer be necessary. |
16:46:02 | FromGitter | <AZ-X> quote ⏎ ⏎ > dom96 : I'm certain that this issue will fix itself in the future. Once Nim is stable enough it will be buildable using a previous version of itself, after that the C sources will no longer be necessary. |
16:46:47 | FromDiscord | <Rika> you sent it thrice? |
16:47:24 | mipri | not intentionally. it's edited in gitter |
16:48:45 | FromGitter | <AZ-X> My browser blocks webfont... |
16:51:36 | * | solitudesf joined #nim |
16:52:19 | narimiran | @Daniel 1.4.1 is a beta-version of soon-to-be-released 1.4.2, which is a patch version for nim 1.4 |
16:55:00 | narimiran | to see what's in 1.4.1 that was not part of 1.4.0: https://github.com/nim-lang/Nim/compare/v1.4.0...version-1-4 |
16:59:32 | disruptek | Zevv: compilation flags suck. |
17:08:58 | FromDiscord | <Daniel> tnx, ....seems like there is alot of improvments/fixes 👍 |
17:10:25 | hmmmmm | I liked version 1.4.0 :| |
17:10:33 | hmmmmm | It's all I ever known :| |
17:10:44 | * | thomasross joined #nim |
17:10:56 | narimiran | @Daniel yeah, lots of stuff for 1.4.2! |
17:11:20 | FromDiscord | <Daniel> (edit) tnx, ....seems like there is alot of improvements/fixes 👍 |
17:12:40 | narimiran | now we want you (general you) to try it before the official release, so if there is some regression, we can fix it before the release |
17:14:08 | FromDiscord | <nikki> https://github.com/nim-lang/Nim/issues/15910 |
17:14:09 | disbot | ➥ Assignment to `Option[T]` doesn't call destructor on existing contained value ; snippet at 12https://play.nim-lang.org/#ix=2DGW |
17:14:12 | FromDiscord | <nikki> yesss |
17:15:29 | narimiran | yep, that fix will be part of 1.4.2 |
17:16:50 | FromDiscord | <nikki> narimiran: is 1.4.1 installable through choosenim? |
17:17:10 | narimiran | 1.4.1 is a "devel" (movable) version |
17:18:05 | narimiran | i'm not sure if you can use it via choosenim.... try `choosenim 1.4.1`, and tell me what does it say |
17:18:20 | narimiran | or maybe `choosenim version-1-4` |
17:18:30 | FromDiscord | <nikki> i'm afk rn but will try soon 🙂 |
17:30:22 | FromDiscord | <exelotl> I wasn't able to `choosenim 1.4.1` or `choosenim version-1-4` but cloning the Nim repo and doing `git checkout version-1-4 && ./build_all.sh && choosenim ./` worked for me |
17:31:05 | narimiran | that's how i would do it too :) |
17:31:29 | narimiran | but now i see that choosenim supports giving it a specific commit |
17:31:53 | narimiran | so maybe `choosenim 4ddb8fe` works? |
17:34:17 | disruptek | ~gitnim |
17:34:17 | disbot | gitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek |
17:34:28 | disruptek | think different. |
17:35:31 | FromDiscord | <Daniel> are header files for c, same as nim modules? |
17:37:37 | * | habamax quit (Ping timeout: 256 seconds) |
17:38:17 | * | astronavt quit (Quit: ...) |
17:38:47 | * | astronavt joined #nim |
17:39:53 | disruptek | no; you need a nim compiler to compile nim modules. |
17:40:36 | FromDiscord | <Recruit_main707> day 1 of asking for nimscript functions to be available in compile time code |
17:41:05 | disruptek | be specific. |
17:41:32 | FromDiscord | <Recruit_main707> https://nim-lang.org/docs/nimscript.html#12 |
17:42:05 | FromDiscord | <Daniel> well, in the book nim modules are just another nim files |
17:42:14 | disruptek | i wasn't asking for a specific url. |
17:42:31 | FromDiscord | <Daniel> so in context of c programing language i am trying to understand what are header files in c |
17:42:46 | FromGitter | <eagledot> Can somebody help me with this https://play.nim-lang.org/#ix=2EIy (https://play.nim-lang.org/#ix=2EIy) ? |
17:42:46 | FromDiscord | <Recruit_main707> be specific then |
17:42:55 | disruptek | amazon sells a lot of books on the c language. |
17:43:14 | * | natrys joined #nim |
17:43:29 | FromDiscord | <Daniel> i am sure it does |
17:43:58 | * | solitudesf quit (Quit: Leaving) |
17:44:00 | * | narimiran quit (Ping timeout: 256 seconds) |
17:44:08 | FromDiscord | <Daniel> I am just not interested in c to program with it, but rather from the aspect how to use it with nim(c2nim and such) |
17:44:30 | disruptek | _deep c secrets_ is about the only book i got anything from. |
17:45:23 | FromDiscord | <Recruit_main707> eagledot, you cannot change a variable's type after defining it |
17:45:48 | * | narimiran joined #nim |
17:46:03 | FromGitter | <eagledot> i am not trying to change the type, just want to update the initial value of an argument.. |
17:46:15 | FromDiscord | <Recruit_main707> you are though |
17:46:26 | FromDiscord | <Recruit_main707> do this: https://play.nim-lang.org/#ix=2EIA |
17:52:33 | disruptek | shashlick: need to pull this into the compiler for ic reasons; if you want to change the way it works, this is a good time to redesign it: https://github.com/disruptek/nimph/blob/master/src/nimph/config.nim#L466 |
17:52:34 | FromGitter | <eagledot> actually wanted to do https://play.nim-lang.org/#ix=2EID (https://play.nim-lang.org/#ix=2EID) |
17:53:21 | FromDiscord | <nikki> @Daniel the K&R book on C is maybe dated but also kinda classic |
17:54:02 | FromDiscord | <nikki> it's a pretty short read, you could glance through it until you get to header files. i actually forget whether they talk about header files that much though 🤔 |
17:55:38 | FromDiscord | <nikki> there's also this https://modernc.gforge.inria.fr/ (has a free download in the downloads section) which seemed kinda good, definitely leans into the "new" stuff in C tho |
18:01:45 | disruptek | i haven't written any c in like 20 years. i thought K&R was useless but maybe i was too young for it. |
18:02:22 | FromGitter | <eagledot> Can somebody just take a look ..https://play.nim-lang.org/#ix=2EII (https://play.nim-lang.org/#ix=2EII) ? |
18:02:57 | FromDiscord | <dom96> > so maybe `choosenim 4ddb8fe` works?↵@narimiran you might need to write `choosenim #4ddb8fe` |
18:03:04 | FromDiscord | <nikki> disruptek: it was mostly useless for me too because i just learned c/c++ by mostly writing it in the ctx of projects; but i think k&r is a good read for just reading to get a sense of c |
18:04:36 | disruptek | maybe, i dunno. it felt really old even 30 years ago. |
18:10:18 | FromGitter | <eagledot> is anybody around?? |
18:11:14 | FromDiscord | <dom96> maybe |
18:11:40 | FromGitter | <eagledot> Can you help me with this https://play.nim-lang.org/#ix=2EII (https://play.nim-lang.org/#ix=2EII) |
18:12:45 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2EIM |
18:12:48 | FromDiscord | <lqdev> eagledot: why not just make a proc with your desired default arguments that just calls the proc inside of your object? |
18:12:57 | FromDiscord | <lqdev> @eagledot ^ |
18:13:39 | FromDiscord | <exelotl> if I do `var g = GameState(actors: a.toOpenArray(a.low, a.high))` it works fine |
18:14:33 | FromDiscord | <lqdev> @eagledot see https://play.nim-lang.org/#ix=2EIN |
18:15:58 | FromGitter | <eagledot> @lqdev Thanks..i am taking a look. |
18:16:42 | disruptek | praise be to lemonboy. |
18:17:20 | disruptek | hearts and minds, my little nimlets; hearts and minds! |
18:17:23 | FromGitter | <eagledot> @ actually i have a small number of such objects, wanted to keep interface same by calling ``custom_obj.field_3()`` |
18:17:34 | FromGitter | <eagledot> @lqdev |
18:17:53 | FromDiscord | <Stuffe> @eagledot, are you creating the structs in a loop or something? |
18:18:04 | FromDiscord | <lqdev> @eagledot, so? |
18:18:12 | disruptek | come all ye unwashed nimpletons; let disruptek feed you. |
18:18:13 | FromDiscord | <lqdev> still doesn't stop you from creating a wrapper proc |
18:18:28 | FromDiscord | <Stuffe> im not exactly sure what you are trying to do, but i have a feeling you need "closureScope" |
18:19:16 | FromGitter | <eagledot> @lqdev but each of the custom object has different number of fields with only field_3 common as a procedure... |
18:20:02 | FromGitter | <eagledot> i get your point, and would do that as u suggested if not finding a cleaner version...cannot i emit code using template or something? |
18:20:08 | FromDiscord | <Daniel> @nikki looking into Modern C book, tnx mate |
18:20:18 | FromDiscord | <lqdev> @eagledot you can make the procedure generic |
18:20:47 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2EIP |
18:21:38 | FromDiscord | <nikki> `.getTypeInst.getTypeImpl` gives me an AST that is equivalent to the type of something, but is there a way to get to the original type definition AST that includes the pragmas too? 🤔 |
18:22:00 | FromDiscord | <nikki> or do i need to save it from a macro when the type is defined |
18:23:20 | FromGitter | <eagledot> @lqdev ,but what if have different number of fields in that case i have to write ``call_field_3`` for each of the object? |
18:23:39 | FromDiscord | <lqdev> yeah? |
18:23:51 | FromDiscord | <lqdev> the procedure is instantiated for each one of your types |
18:24:08 | FromDiscord | <lqdev> this means that every one of your type gets a specialized procedure for itself |
18:24:12 | FromDiscord | <lqdev> that's how generics work. |
18:26:04 | FromGitter | <eagledot> @lqdev i meant ``field_3`` procedure have different number arguments depending on the object.. |
18:26:18 | FromDiscord | <lqdev> well make it have the same number of args |
18:26:24 | FromDiscord | <lqdev> how'd you expect this to work anyways |
18:26:49 | FromGitter | <eagledot> i was thinking something like partial in python?? |
18:26:50 | FromDiscord | <lqdev> you can't pass one argument to a procedure with 5 arguments |
18:26:58 | FromDiscord | <lqdev> what's partial |
18:28:17 | FromGitter | <eagledot> No i meant to ask the first time, is not possible to assign variable a function with specific initial values? |
18:28:58 | FromDiscord | <lqdev> nope |
18:29:03 | * | opal quit (Ping timeout: 240 seconds) |
18:29:18 | FromDiscord | <nikki> eagledot: you can use a lambda |
18:29:33 | FromGitter | <eagledot> @lqdev ,thanks...that was my misunderstanding. |
18:30:02 | FromGitter | <eagledot> how to use lamda? can u point me to an example.. |
18:30:14 | FromDiscord | <nikki> if you have `proc foo(a, b, c: int)` you can do `let bar = proc(c: int) = foo(1, 2, c)` |
18:30:34 | FromDiscord | <nikki> i mean it doesn't have to be a lambda, but if you wanted to choose different values for 1, 2 based on stuff in some scope, it'll end up being one |
18:30:58 | FromDiscord | <nikki> it's kind of like partial application but spelled out |
18:31:42 | FromGitter | <eagledot> can i assign it as a field to an object as well? |
18:32:06 | FromDiscord | <nikki> you can if the type of the field is the same as the function you create |
18:32:21 | FromDiscord | <nikki> i'd start asking why you want to do that (just to make sure there isn't a better route to doing what you want to do in general), but it'll work |
18:33:39 | * | opal joined #nim |
18:33:58 | FromGitter | <eagledot> basically was writing code to call a function say ``forward`` ,on different object to do Deep learning in NIm |
18:35:06 | FromDiscord | <nikki> you can probably do what you want with normal procs, without needing to assign procs as fields of objects |
18:35:23 | FromDiscord | <nikki> the latter is really mostly needed when you need some kind of dynamic dispatch because the proc can change |
18:36:53 | FromGitter | <eagledot> actually was trying to store the actual algorithm/function in ``forward`` field, for each of the objects,so that i can call with same interface...but learning more as i go.. |
18:37:27 | FromDiscord | <Stuffe> Is this kind of what you want? https://play.nim-lang.org/#ix=2EIX |
18:37:56 | FromDiscord | <Stuffe> generating lambda functions with values known at run time in any case |
18:38:19 | FromGitter | <eagledot> @Stuffe yes, but want to pass arguments as well.. |
18:38:32 | FromGitter | <eagledot> arguments are known at run-time only.. |
18:38:36 | FromDiscord | <Stuffe> thats easy to add |
18:38:36 | FromDiscord | <nikki> you can put the arguments in the () |
18:38:46 | FromDiscord | <nikki> this example should be extendable to what you want at this point |
18:39:23 | FromDiscord | <nikki> in any case -- it's nice you have distinct types of objects and call procs on them and the dispatch is static (just leads to good codegen / perf / etc.) -- but if you really need this dynamic dispatch, this is how to do it |
18:39:47 | FromDiscord | <Stuffe> here you go https://play.nim-lang.org/#ix=2EJ0 |
18:41:06 | FromGitter | <eagledot> That works ...thanks for all the help. |
18:41:24 | FromDiscord | <Stuffe> great. youre welcome |
18:49:20 | * | hmmmmm quit (Remote host closed the connection) |
18:54:32 | * | jjido joined #nim |
19:20:36 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:23:19 | FromDiscord | <For Your Health> sent a code paste, see https://play.nim-lang.org/#ix=2EJb |
19:23:30 | FromGitter | <deech> How do get `--expandArc` to work with a imported proc? I tried `--expandArc:ModuleName.procName` but that didn't work. |
19:28:07 | FromDiscord | <pietroppeter> @For Your Health use with: https://nim-lang.org/docs/with.html |
19:32:28 | * | hmmm joined #nim |
19:34:18 | FromDiscord | <For Your Health> What import do I need to use that? I'm having trouble finding it |
19:36:07 | FromDiscord | <For Your Health> Oh, looks like std/with |
19:37:00 | FromDiscord | <For Your Health> I'm not sure how to use it in my case though |
19:39:07 | FromDiscord | <For Your Health> sent a code paste, see https://play.nim-lang.org/#ix=2EJi |
19:39:40 | FromDiscord | <Stuffe> @For Your Health maybe youre looking for something like this? https://play.nim-lang.org/#ix=2EJj |
19:42:16 | FromDiscord | <For Your Health> Is that idiomatic? It is a little unfortunate to have to use `[]` to dereference but I suppose it isn't a big deal |
19:45:32 | FromDiscord | <Stuffe> i really dont know |
19:45:44 | FromDiscord | <Stuffe> but I guess you could do it with the move keyword as well: https://play.nim-lang.org/#ix=2EJl |
19:47:19 | FromDiscord | <For Your Health> Seems a little bit clunky and spooky that you have to remember to move it back |
19:47:43 | FromDiscord | <Vindaar> what's wrong with the template approach? |
19:47:58 | FromDiscord | <For Your Health> Nothing as far as I know. I'm just wondering if that is the way people usually do it |
19:48:49 | FromDiscord | <Vindaar> that's definitely more idiomatic than doing pointer shenanigans 🙂 |
19:49:18 | FromDiscord | <For Your Health> I figured. Pointers are spooky |
19:49:28 | FromDiscord | <Stuffe> true, but its less effecient |
19:49:30 | FromDiscord | <Stuffe> just saying |
19:49:37 | FromDiscord | <Vindaar> of course |
19:49:46 | disruptek | nah; this boil on the inside of my thigh is spooky. |
19:49:48 | disruptek | pointers are fine. |
19:50:08 | FromDiscord | <Vindaar> but if you're worrying about performance and you notice that you have an n times nested call you have to make over and over, maybe something is wrong in your design |
19:50:53 | FromDiscord | <exelotl> yeah using pointers is not really ideal, I think `with` is kinda experimental too (hence why it's in its own module) but I might be wrong about that |
19:51:32 | FromDiscord | <exelotl> soon we will have the `byaddr` pragma: https://nim-lang.org/docs/decls.html#byaddr.t%2C%2C%2C |
19:51:44 | FromDiscord | <For Your Health> @Vindaar I'm finding it tends to happen when using the whole "composition over inheritance" idea. How can I avoid it? |
19:52:32 | FromDiscord | <exelotl> There was a forum thread about that recently with some answers: https://forum.nim-lang.org/t/7095#44696 |
19:53:19 | FromDiscord | <exelotl> (I'm biased but I think my solution is best lol) |
19:53:42 | FromDiscord | <pietroppeter> Sorry yes maybe with is not useful in your case. And template is actually fine and idiomatic. Example: https://play.nim-lang.org/#ix=2EJs |
19:54:16 | FromDiscord | <Vindaar> haha @exelotl your solution however is the only one that is used in practice 😄 I agree. I think PMunch and me just like to write fun macros 😉 |
19:54:22 | FromDiscord | <pietroppeter> But I might misunderstand what you are trying to do... |
19:54:47 | FromDiscord | <nikki> templates are fine and dandy until you call a function twice that has side effects 😐 |
19:54:52 | FromDiscord | <Vindaar> @For Your Health really depends on the context imo. There's no simple answer and it depends on the problem domain I guess |
19:55:22 | FromDiscord | <nikki> yeah it's all about context |
19:55:33 | * | PMunch joined #nim |
19:55:34 | FromDiscord | <nikki> you probably want some proc tha tyou pass a var parameter, and you pass the nested thing |
19:55:38 | FromDiscord | <nikki> and the proc acts on it |
19:55:58 | FromDiscord | <nikki> `proc foo(bleh: var Bloh) = bleh.x = 3; bleh.y = 4; foo(meh.bar.baz)` |
19:56:26 | FromDiscord | <nikki> like is this logic some reusable, nameable thing? if it isn't, but should be (rearchitect / redesign / rethink) then proc |
19:56:32 | FromDiscord | <nikki> if it isn't then just write it out probably |
19:56:40 | FromDiscord | <nikki> coding isn't about compression |
19:56:45 | FromDiscord | <nikki> if it were, then just run your code through gzip, it'll be smaller |
19:56:50 | FromDiscord | <exelotl> if all objects in the chain are normal object types (not ref objects) then the template approach shouldn't be any slower right? |
19:57:34 | FromDiscord | <exelotl> because the compiler can figure out the exact offset of foo.bar.baz.x relative to the location of foo |
19:58:13 | FromDiscord | <nikki> @exelotl i think so yeah. best way to find out is to -> c then -> godbolt |
19:58:15 | PMunch | Going to be streaming some TermFM development in a moment |
20:00:23 | FromDiscord | <nikki> but i think the main thing is that the template may make most sense when it's at least somewhat reusable |
20:00:38 | FromDiscord | <nikki> and if eg. you have `.foo.bar` where `.foo` is a ref or even a proc call; ... |
20:00:47 | FromDiscord | <nikki> altho in that case it's maybe an issue with `.foo` more than the template |
20:01:38 | PMunch | Sorry for the short notice, stream is already live at https://twitch.tv/PMunche and https://youtu.be/x3pYu7VdhNA |
20:04:06 | FromDiscord | <Stuffe> i personally would prefer a pointer because then its easier to read 6 months later when you forgot that this name represents an alias and not a direct variable |
20:04:46 | FromDiscord | <For Your Health> sent a code paste, see https://play.nim-lang.org/#ix=2EJy |
20:04:55 | FromDiscord | <For Your Health> Just as a crude example |
20:05:12 | Prestige | PMunch: not live yet? |
20:05:33 | PMunch | Prestige, stream is live, but I'm not doing anything yet |
20:05:33 | FromDiscord | <EL DIOS DE LOS MEMES> :nimAngry: |
20:05:33 | FromDiscord | <nikki> @For Your Health write a function for moving a player |
20:05:36 | FromDiscord | <EL DIOS DE LOS MEMES> :nimAngry: |
20:05:38 | FromDiscord | <EL DIOS DE LOS MEMES> :nimGlow2: |
20:05:40 | FromDiscord | <nikki> then call `movePlayer(self.players[0])` |
20:05:47 | FromDiscord | <nikki> or eg. `for player in palyers: player.movePlayer()` |
20:05:55 | Prestige | PMunch: oh, okay. I see the Please stand by message |
20:05:57 | FromDiscord | <nikki> and then in the function you just have a parameter, and less depth |
20:06:02 | FromDiscord | <nikki> templates is not the answer to this |
20:06:34 | FromDiscord | <nikki> @For Your Health you can see similar logic in the stuff i'm working on: https://github.com/nikki93/ng-public/blob/a1001d83ab6e428f6564579dce81863151c60ef4/src/game/player.nim#L45-L50 |
20:08:20 | Prestige | oh neat, I saw that on r/unixporn a long while ago PMunch. Looks very neat |
20:10:01 | FromDiscord | <For Your Health> @nikki That alleviates the issue to an extent, but the problem still exists in a capacity. Say in my example you pass in a player. You get rid of self.players[0], but you still have to do player.transform.origin.x |
20:10:24 | FromDiscord | <nikki> you have to think about what i'm saying at and extend it to the situation |
20:10:34 | FromDiscord | <nikki> it's not about just doing a find and replace with what i said |
20:10:46 | FromDiscord | <nikki> reapply the idea to transform and so on, and it'll start making sense |
20:11:06 | FromDiscord | <nikki> in the repo i linked, there are deep object compositions like this but because of reusable procs and other things it doesn't look deep in the code itself |
20:11:14 | FromDiscord | <nikki> you need to build up a suite of data types and procs on those data types |
20:11:34 | * | jjido joined #nim |
20:12:05 | FromDiscord | <nikki> you can also have a x proc on player that is ` |
20:12:09 | FromDiscord | <nikki> one sec sorry |
20:12:28 | FromDiscord | <nikki> `proc x(player: Player) {.inline} = player.transform.origin.x` then you can use `player.x` |
20:12:39 | FromDiscord | <nikki> (with the return type that i left out 😅 ) |
20:13:36 | FromDiscord | <nikki> the one thing i said is the general statement, but the repo i linked is a specific expansion across many types. the `.position` there is actually digging into the physics object |
20:15:11 | FromDiscord | <For Your Health> @nikki That's essentially following the law of demeter. Which I like the idea of, and have thought about before. But it can get unruly in some cases. |
20:15:47 | FromDiscord | <For Your Health> That is cleaner than doing a template though |
20:16:01 | FromDiscord | <nikki> i'm telling you how you can do what you want, but yeah, it stands that what you want is kind of a bad idea, which i agree with |
20:16:31 | FromDiscord | <nikki> your data structures should hopefully be organized so your code looks clean without needing shenanigans |
20:17:56 | FromDiscord | <For Your Health> I guess it is a matter of how many dot chains you are willing to repeat. In your code example you have some repeated dot chains in there |
20:18:39 | FromDiscord | <nikki> i don't care about repetition or not in a vaccum, the thing that matters is whether the code is understandable quickly and embodies less accidental complexity |
20:19:07 | FromDiscord | <nikki> which example, from the repo? |
20:19:31 | FromDiscord | <nikki> the main repetition is in the `for vars in ker.each(Query):` stuff it seems like; what else do you think is repetitive 🤔 |
20:21:22 | FromDiscord | <nikki> if i saw the definition for your data structures, then i went to the code and saw weird aliases that i have to go understand some templates for etc., it can potentailly make it less readable (but also more, if done right (?)) |
20:21:31 | FromDiscord | <For Your Health> sent a code paste, see https://play.nim-lang.org/#ix=2EJA |
20:21:45 | FromDiscord | <For Your Health> (edit) "https://play.nim-lang.org/#ix=2EJA" => "https://play.nim-lang.org/#ix=2EJB" |
20:22:20 | FromDiscord | <nikki> sent a code paste, see https://play.nim-lang.org/#ix=2EJC |
20:22:25 | FromDiscord | <nikki> but i did it this way because it's clearer to me and each line of the code stands on its own |
20:22:33 | FromDiscord | <nikki> "set the walk constraint max force to 2000" |
20:24:37 | FromDiscord | <nikki> another approach is to have setters that return a ref to the thing you're setting on, which i had in the c++ version of this code that i'm porting from: https://gist.github.com/nikki93/003d19e263931edf28ff5d0ebb1ec585#file-main-cc-L131-L133 |
20:24:47 | FromDiscord | <nikki> i don't actually like it that much tho |
20:26:21 | FromDiscord | <Quibono> Is there a way to get fmt to work with strings that contain quotes? |
20:26:39 | * | rockcavera quit (Remote host closed the connection) |
20:27:06 | mipri | use & instead of fmt |
20:27:36 | FromDiscord | <nikki> does fmt work with triple quotes? |
20:27:42 | mipri | as mentioned at the top of https://nim-lang.org/docs/strformat.html |
20:28:09 | FromDiscord | <Quibono> Thanks. |
20:29:40 | FromDiscord | <Quibono> Okay but minor problem, my string is json formatted so it has {} that /aren't/ enclosing variables. |
20:30:01 | FromDiscord | <Quibono> So like """ {"action": "auth", "params": "PKLANAPRKN7PZRW82K9U"} """ |
20:30:16 | mipri | what'd I do there is switch to % and use $# or $var for interpolation |
20:30:58 | mipri | https://nim-lang.org/docs/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D |
20:30:59 | FromDiscord | <Quibono> Can you show me the format to inject a variable following params where the PKL... is? |
20:31:12 | FromDiscord | <nikki> @For Your Health i'll let you know if i see any things to address this though 🤔 it definitely comes up in my code because of the component architecture. i'm just sticking with it till i get a bunch of features into the engine for now till i see some patterns to improve on |
20:31:22 | FromDiscord | <Quibono> Oooh, interesting |
20:32:07 | FromDiscord | <nikki> @For Your Health https://github.com/nikki93/ng-public/blob/139d6f141d4120ef688c306ba1c77e10c696886f/src/main.nim here's a version where the whole game fits in one 'main.nim' file so that everything is explained, it leads to a point and click style gameplay |
20:32:43 | FromDiscord | <For Your Health> @nikki I appreciate it! I will take a look. |
20:40:29 | FromDiscord | <Quibono> So I've got this code: |
20:40:29 | FromDiscord | <Quibono> var authCode = """ {"action": "auth", "params": $} """ % [pubKey] |
20:40:39 | FromDiscord | <Quibono> which is giving this error: |
20:40:58 | FromDiscord | <Quibono> /Users/xxx/.choosenim/toolchains/nim-1.4.0/lib/pure/strutils.nim(2870) %↵/Users/xxx/.choosenim/toolchains/nim-1.4.0/lib/pure/strutils.nim(2819) addf↵/Users/xxx/.choosenim/toolchains/nim-1.4.0/lib/pure/strutils.nim(2759) invalidFormatString↵Error: unhandled exception: invalid format string [ValueError] |
20:41:50 | FromDiscord | <Innokentiy Sokolov> is there any way to convert string in seq representation to actual seq like we can do it with Json string to actual json object? |
20:44:37 | FromDiscord | <InventorMatt> there is nothing in the standard library for parsing a string seq into a normal seq but its not a difficult function to make |
20:44:38 | Zevv | disruptek: yes it sucks, but what is the alternative? |
20:44:46 | Zevv | I can't think of a way to make it work automagically |
20:45:10 | FromDiscord | <Innokentiy Sokolov> @InventorMatt oh thanks. Will give it a second thought then |
20:45:26 | Zevv | disruptek: now it's just this: https://github.com/zevv/npeg/commit/21d923da701da0be484f30b5016344a82d44450f |
20:46:57 | FromDiscord | <InventorMatt> @Innokentiy Sokolov try this https://play.nim-lang.org/#ix=2EJN |
20:47:16 | mipri | Quibono: what are you trying to do? that an invalid format string as it says |
20:47:39 | mipri | you probably want "$#" where you have that bare $ |
20:48:08 | FromDiscord | <Quibono> Aaand that fixed it. |
20:48:17 | FromDiscord | <Quibono> So what's the difference between $# and $? |
20:48:26 | FromDiscord | <Quibono> Except that one does exactly what I want. |
20:49:12 | mipri | $# is the "select the next value" syntax as documented, and $ doesn't mean anything |
20:49:29 | mipri | if you want a literal $ you need to put $$. otherwise a $ needs to be followed by # or an identifier |
20:50:05 | mipri | or a number |
20:52:43 | FromDiscord | <Quibono> Gotcha, thank you. |
20:52:44 | FromDiscord | <Innokentiy Sokolov> @InventorMatt I take off my hat. That's exactly what I was looking for! Thank you! |
20:54:46 | FromDiscord | <InventorMatt> no problem, I made that a while back. |
20:57:13 | FromDiscord | <Innokentiy Sokolov> well I gave you a credit in the code I'm working right now anyway) |
20:59:08 | FromDiscord | <InventorMatt> sweet, now I can go down in history |
20:59:32 | FromDiscord | <exelotl> @For Your Health oh, byaddr actually does exist already! https://play.nim-lang.org/#ix=2EJU |
21:01:08 | FromDiscord | <For Your Health> @exelotl Very interesting. I'll have to mess around with that. Thanks for the tip |
21:05:08 | FromDiscord | <exelotl> np |
21:05:58 | FromDiscord | <exelotl> also I think we're getting something like `var n: var int = ...` in the future, but I'm having trouble making it work lol |
21:06:49 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2EK5 |
21:06:54 | FromDiscord | <exelotl> this compiles on 1.4.1 |
21:06:58 | FromDiscord | <exelotl> but immediately segfaults |
21:07:06 | FromDiscord | <For Your Health> That's kind of what I was originally expecting to be able to do |
21:07:15 | FromDiscord | <For Your Health> Since I can do that in a proc argument |
21:08:06 | * | ^Q-Master^ joined #nim |
21:09:19 | * | Q-Master quit (Read error: Connection reset by peer) |
21:09:27 | FromDiscord | <exelotl> it segfaults because `n` is a null pointer and it's trying to assign the value of `a[5]` to the memory pointed to by `n` |
21:09:43 | FromDiscord | <exelotl> ... I can see it being the idiomatic way to do what you want, when it works lol |
21:10:14 | FromDiscord | <exelotl> (edit) this compiles on 1.4.1 (with {.experimental:"views".} enabled) |
21:12:05 | FromDiscord | <For Your Health> Yeah it is definitely prettier than the byaddr pragma |
21:12:09 | FromDiscord | <nikki> yeah views stuff is super early and being built up right now |
21:12:32 | FromDiscord | <nikki> it'll definitely be pretty good when it works though |
21:12:44 | FromDiscord | <nikki> right now my ecs query stuff has to return ptrs instead of lents / views |
21:12:45 | FromDiscord | <For Your Health> Although it looks like it requires you to give up type inference right? |
21:12:58 | FromDiscord | <For Your Health> Whereas with the byaddr pragma you don't |
21:13:17 | FromDiscord | <nikki> i feel like there should be a `: var auto` kinda thing hopefully and that isn't as long |
21:13:44 | FromDiscord | <For Your Health> Oh yeah var auto I guess |
21:17:22 | FromDiscord | <For Your Health> I found myself trying something like `var foo = ref bar` but maybe that doesn't make much sense. |
21:17:40 | * | natrys quit (Quit: natrys) |
21:19:25 | * | narimiran quit (Ping timeout: 264 seconds) |
21:20:10 | FromDiscord | <nikki> i expect the view / borrow stuff to evolve a lot |
21:21:11 | * | Vladar quit (Quit: Leaving) |
21:25:17 | PMunch | Stream is over for tonight, if you missed it they are now uploaded to YouTube as soon as I'm done streaming: https://www.youtube.com/watch?v=x3pYu7VdhNA |
21:26:32 | * | muffindrake joined #nim |
21:29:53 | * | PMunch quit (Quit: leaving) |
21:32:11 | planetis[m] | nikki: you can do `let a: var typeof(b) = b` |
21:33:26 | planetis[m] | yeah a shortcat would be nice |
21:34:50 | planetis[m] | i tried it today but it didn't work for me either |
21:36:03 | FromDiscord | <nikki> nice. i'm probably not using view local vars soon tho 😅 |
21:36:11 | FromDiscord | <nikki> seems like it still needs building out |
21:37:20 | planetis[m] | i will keep using alias templates for my game they work fine |
21:37:22 | disruptek | narimiran: do you still like ocaml? |
22:11:12 | FromDiscord | <Recruit_main707> any examples on creating directories from a macro? |
22:35:16 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:37:57 | * | lritter quit (Quit: Leaving) |
22:42:24 | Zoom[m] | planetis: Hey, could you explain why I didn't need `compileTime` pragma in my functions? These funcs are only used for initializing constants |
22:42:49 | disruptek | that seems to answer the question. |
22:43:30 | Zoom[m] | So it's inferred? |
22:43:41 | disruptek | no, it's explicit. |
22:44:26 | Zoom[m] | ? |
22:44:49 | disruptek | that's what `const` means. |
22:45:02 | disruptek | when you type `const`, that's what you get. |
22:46:26 | Zoom[m] | Of course, I mean the functions are not explicitly marked as compileTime, so nothing prevents me from using them on runtime |
22:46:36 | disruptek | sure. |
22:47:19 | Zoom[m] | So I meant, if I'm not really using them in my runtime code, is it inferred that they shouldn't be included. |
22:50:17 | * | ^Q-Master^ quit (Read error: Connection reset by peer) |
22:50:28 | * | Q-Master joined #nim |
22:52:44 | * | rockcavera joined #nim |
23:01:56 | Zoom[m] | All right. I checked, {.compileTime.}` gives me an error if I use this func in runtime. So it's good and it should stay there for that exact reason |
23:02:31 | Zoom[m] | https://play.nim-lang.org/#ix=2EKF |
23:03:44 | mipri | make a file with a proc that returns a 2MB string. don't use it. compile. 99KB. use it. compile. 2MB+ |
23:07:40 | Zoom[m] | I understand that, I was interested why planetis advised to remove the pragma. |
23:08:25 | mipri | if what you want is a compile time error for trying to use those procs at runtime, that's fine. |
23:09:13 | mipri | you were advised to remove the pragma because it doesn't fulfill what planetis guessed was your aim: to permit the procs to be used at compile time |
23:14:25 | Zoom[m] | mipri: thanks |
23:41:03 | * | opal quit (Ping timeout: 240 seconds) |
23:42:21 | FromDiscord | <PizzaFox> whats `--asm` do |
23:45:44 | * | opal joined #nim |
23:46:32 | FromDiscord | <Clyybber> outputs assembler files |
23:46:57 | FromDiscord | <PizzaFox> is this good |
23:47:18 | FromDiscord | <ElegantBeef> If you want assembler files |