00:01:00 | FromDiscord | <Yardanico> maybe I should spend some time on the nim sciter bindings, like today I made more of the stuff work with arc (utf16 and destructors stuff) |
00:01:04 | FromDiscord | <Yardanico> with refc bugs don't always surface |
00:01:10 | FromDiscord | <Yardanico> so its better to use arc |
00:01:26 | FromDiscord | <Clyybber> nice ! |
00:01:33 | FromDiscord | <Clyybber> the demand seems to be there |
00:01:48 | FromDiscord | <Yardanico> i mean for example I was getting a key: value map from the sciter side and it was only providing a "view", I didn't get the ownership of the values |
00:02:05 | FromDiscord | <Yardanico> with refc it worked but with arc it crashed because destructors were trying to deallocate sciter's own stuff |
00:02:19 | FromDiscord | <Yardanico> (the solution is to copy the value, sciter has functions for that specifically) |
00:02:33 | FromDiscord | <Clyybber> deterministic crashes \o/ |
00:42:55 | * | grobe0ba quit (Quit: ZNC 1.7.5 - https://znc.in) |
00:43:06 | * | grobe0ba joined #nim |
00:51:37 | * | krux02 quit (Ping timeout: 276 seconds) |
01:28:38 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:28:58 | * | njoseph joined #nim |
01:35:13 | FromDiscord | <Snippy Nippy> Hi |
01:35:34 | FromDiscord | <Snippy Nippy> Is there a code formatter in nim |
01:36:05 | FromDiscord | <Snippy Nippy> Like something similar to black in python |
01:37:31 | Prestige | is there a way to escape curly brackets when using fmt on a string? |
01:44:30 | * | cyraxjoe joined #nim |
01:50:19 | FromDiscord | <Clyybber> Prestige: Just repeat them |
01:50:27 | Prestige | ty |
02:03:41 | * | clyybber quit (Quit: WeeChat 3.1) |
02:05:34 | * | fputs joined #nim |
02:26:30 | * | clyybber joined #nim |
02:36:31 | * | lritter joined #nim |
02:54:45 | * | azed quit (Ping timeout: 246 seconds) |
03:42:59 | * | rockcavera quit (Remote host closed the connection) |
03:49:49 | * | rockcavera joined #nim |
04:10:50 | * | xioren joined #nim |
04:12:54 | * | spiderstew_ joined #nim |
04:14:13 | * | spiderstew quit (Ping timeout: 245 seconds) |
04:15:29 | FromDiscord | <ElegantBeef> Prestige did you get around to trying nimscripter? |
04:16:29 | FromDiscord | <ElegantBeef> Hopefully i'm not being a bother, only know of one person that's used nimscripter(and that was for some malware related stuff) 😛 |
04:16:41 | * | vicfred quit (Quit: Leaving) |
04:18:38 | * | clyybber quit (Quit: WeeChat 3.1) |
04:21:41 | FromDiscord | <ElegantBeef> @Snippy Nippylate response aside there is nimpretty and morepretty |
04:22:27 | FromDiscord | <Snippy Nippy> Np |
04:23:20 | FromDiscord | <Snippy Nippy> Also does these tools have an integration for vscode |
04:23:28 | FromDiscord | <Snippy Nippy> Like format on save? |
04:23:30 | Prestige | @ElegantBeef I've still be contemplating how I want to go about the structure, but I'll need async in my irc bot so I'll have to decide soon |
04:23:52 | Prestige | Was contemplating using IPC to compose multiple executables |
04:25:39 | FromDiscord | <ElegantBeef> It should work with format on save |
04:26:50 | FromDiscord | <ElegantBeef> Speaking of saem can you expose a way to change the formatter? Since Nimpretty and Morepretty both exist makes it easier to switch between them |
04:27:29 | FromDiscord | <ElegantBeef> Unless there is a way i'm missing 😄 |
04:27:31 | saem | Maybe, that sounds doable |
04:28:52 | saem | Like all a config for custom formatter, maybe it could look for a named task |
04:28:56 | FromDiscord | <ElegantBeef> Honestly i think the JS version actually had it |
04:29:04 | saem | Did it? |
04:29:18 | FromDiscord | <ElegantBeef> I swear i remember a field for giving the path of nimpretty |
04:29:55 | FromDiscord | <ElegantBeef> Checking now |
04:30:37 | FromDiscord | <ElegantBeef> Nope i was wrong |
04:30:42 | saem | Now with more nim and less typescript |
04:31:24 | saem | I'm eating but you wanna take a gander at the format provider (?) File |
04:31:57 | saem | Should have the be nim pretty invocation there or as a command in vscodeext.nim |
04:33:50 | xioren | are regular objects handled by the garbage collector too, or only ref objects? |
04:34:18 | FromDiscord | <ElegantBeef> Regular objects are stack allocated so no need for gc |
04:34:35 | xioren | ah i see, thanks |
04:37:37 | * | sz0 quit (Quit: Connection closed for inactivity) |
04:38:02 | * | vicfred joined #nim |
04:38:26 | FromDiscord | <ElegantBeef> So since you're doing `getOptionalToolPath` you could just use a string for the binary you look for |
04:38:48 | FromDiscord | <ElegantBeef> Though that gets weird since Morepretty works on the entire project |
04:41:09 | FromDiscord | <ElegantBeef> Speaking of morepretty, i just did morepretty and it started formatting the stdlib in `.choosenim` 😄 |
04:41:49 | FromDiscord | <ElegantBeef> Sorry i did `morepretty -h` |
04:42:53 | Prestige | !eval echo "a" * 2 |
04:42:54 | NimBot | Compile failed: /usercode/in.nim(1, 10) Error: type mismatch: got <string, int literal(2)> |
04:43:17 | FromDiscord | <ElegantBeef> Are you trying to get `"aa"` 😄 |
04:43:33 | FromDiscord | <ElegantBeef> if so `strutils.repeat` |
04:43:34 | Prestige | nah I wanted to see the bot's response to an error |
04:44:13 | FromDiscord | <ElegantBeef> Good cover |
04:44:41 | Prestige | lol |
04:44:53 | Prestige | I'm writing an irc bot that does the !eval, so I wanted to see |
04:45:24 | Prestige | the response back from nim-playground is weird to parse when there's an error |
04:53:30 | saem | Beef, if you want to try a PR and want a hand getting started or whatever LMK. I'm barely using nimpretty right now so extra formatters isn't a bit itch to scratch. |
04:54:32 | saem | s/bit/big |
04:55:58 | FromDiscord | <ElegantBeef> Yea i dont even think morepretty is meant to be used on a per file basis |
04:56:11 | FromDiscord | <ElegantBeef> So i guess no real value in doing it |
04:56:28 | saem | Could do a project wide command. |
05:03:46 | * | xioren quit (Quit: leaving) |
05:15:40 | FromDiscord | <Hi02Hi> In reply to @ElegantBeef "Regular objects are stack": except for objects with seqs/strings in them right? |
05:16:08 | FromDiscord | <ElegantBeef> I mean the object should still be stack allocated afaik |
05:16:31 | FromDiscord | <ElegantBeef> remember that a string/seq is just a pointer + size and capacity |
05:17:36 | FromDiscord | <Hi02Hi> true, ok |
05:18:02 | FromDiscord | <ElegantBeef> It's explained somewhere in the manual or tutorial |
05:26:31 | * | head_ joined #nim |
05:28:52 | * | head_ left #nim (#nim) |
05:33:53 | * | sixtyten joined #nim |
06:09:01 | FromDiscord | <ElegantBeef> What's the proper way to handle `attribute ((packed))` is it just `{.packed.}`? |
06:30:16 | FromDiscord | <mratsim> yes |
06:30:21 | FromDiscord | <mratsim> @ElegantBeef |
06:30:47 | FromDiscord | <ElegantBeef> This pico sdk has a lot of weird/ugly code we get for free from Nim 😄 |
06:31:10 | FromDiscord | <ElegantBeef> They defined preprocessors for making bitsets and applying things like that |
07:04:13 | * | rockcavera quit (Read error: Connection reset by peer) |
07:04:16 | * | tiorock joined #nim |
07:04:16 | * | tiorock quit (Changing host) |
07:04:16 | * | tiorock joined #nim |
07:04:17 | * | tiorock is now known as rockcavera |
07:19:31 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
07:22:22 | * | haxscramper joined #nim |
07:36:09 | * | sixtyten quit (Ping timeout: 246 seconds) |
07:55:41 | * | tiorock joined #nim |
07:55:41 | * | rockcavera is now known as Guest9787 |
07:55:41 | * | Guest9787 quit (Killed (tolkien.freenode.net (Nickname regained by services))) |
07:55:41 | * | tiorock is now known as rockcavera |
08:02:06 | FromDiscord | <Gary M> !eval 2'u32.bool |
08:02:07 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: expression 'bool(2'u32)' is of type 'bool' and has to be used (or discarded) |
08:02:16 | FromDiscord | <Gary M> lol |
08:02:28 | FromDiscord | <Gary M> !eval echo $2'u32.bool |
08:02:30 | NimBot | true |
08:07:09 | FromDiscord | <Araq> what's the name of the http server benchmarking tool? |
08:08:17 | FromDiscord | <Araq> 'wrk', found it |
08:16:39 | FromDiscord | <ElegantBeef> It's time! I get to attempt the rpi pico's tinyusb code, and cry when it inevitably fails |
08:29:00 | * | Cthalupa quit (Ping timeout: 246 seconds) |
08:31:34 | * | Cthalupa joined #nim |
08:37:33 | FromDiscord | <ElegantBeef> Oh yea it cannot find a type! 😄 |
09:00:09 | * | kaputse[m] quit (Quit: Idle for 30+ days) |
09:12:03 | ForumUpdaterBot | New thread by Mantielero: Async - noob question, see https://forum.nim-lang.org/t/7622 |
09:20:14 | * | haxscramper quit (Remote host closed the connection) |
09:27:40 | * | tane joined #nim |
09:43:51 | FromDiscord | <whisperdev> Hi all.Do we have any solution for when people get banned or abandon Nim what to do?I know this can happen in any community and it's foolish to rely one a single package without fully understanding it but usually in larger communities economies of scale kick in and someone will step up to maintain the package. |
09:50:33 | FromDiscord | <Rika> we dont have the scale for that |
09:51:14 | FromDiscord | <fenrave> I'd expect most, if not all packages are open source to an extent. Considering that, unless it's a very specific package, I highly doubt that people would not step up on their own accord should the original dev(s) abandon it for whatever reason |
09:51:33 | FromDiscord | <Rika> there are not a lot of people who would step up |
09:52:27 | FromDiscord | <fenrave> Nim is fairly small scale but most packages I've seen are somewhat actively maintained |
09:52:38 | FromDiscord | <fenrave> at least on a monthly basis or so |
09:53:14 | FromDiscord | <Rika> yes but when people do suddenly abandon nim there is not a lot of people to step in to make a fork |
09:54:26 | * | haxscramper joined #nim |
09:54:56 | FromDiscord | <fenrave> I would imagine that a commonly used package would quickly get support from other people. Like I said, unless it's a highly specific use case, I doubt a package would die that fast if there was competent users of said package |
09:55:44 | FromDiscord | <fenrave> though agreeably the issue here is not necessarily support on its own, it's a long term effort to fork it and to maintain it |
09:56:12 | FromDiscord | <fenrave> that's not something most people want to spend their time on unless they rely on it |
09:57:28 | FromDiscord | <fenrave> I'd more or so expect packages to remain compatible for long enough to switch off of or to port it to later versions |
10:12:10 | * | Tuatarian quit (Ping timeout: 260 seconds) |
10:18:38 | * | Gustavo6046 quit (Ping timeout: 264 seconds) |
10:31:44 | * | NimBot joined #nim |
10:36:37 | * | Tuatarian joined #nim |
10:37:51 | FromDiscord | <Yardanico> @whisperdev well if someone wants to, they can generally take over nimble packages if the author hasn't responded or is fine with it |
10:38:00 | FromDiscord | <Yardanico> (to update compat to latest nim or fix issues that haven't been fixed) |
10:39:32 | FromDiscord | <Yardanico> do we care about supporting older macOS versions btw - like 10.10? |
10:39:35 | FromDiscord | <Yardanico> @flywind ^ |
10:40:00 | FromDiscord | <Yardanico> a friend of mine can't compile latest nim because of the same issue as in https://bugs.python.org/issue29057 |
10:40:03 | FromDiscord | <Yardanico> related to std/sysrand |
10:50:19 | FromDiscord | <Yardanico> wait actually |
10:50:29 | FromDiscord | <Yardanico> @flywind why does sysrand use different functions for ios and macosx? |
10:50:37 | FromDiscord | <Yardanico> https://developer.apple.com/documentation/security/1399291-secrandomcopybytes seems to be available on macOS 10.7+ |
10:50:44 | FromDiscord | <Yardanico> so we can have the same one for macosx and ios, no? |
10:51:05 | FromDiscord | <dom96> @Yardanico create an issue, IMO we should at least track this support |
10:57:31 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/17370 |
11:11:28 | * | krux02 joined #nim |
11:20:06 | FromDiscord | <konsumlamm> In reply to @whisperdev "Hi all.Do we have": are you referring to anything particular? |
11:20:32 | FromDiscord | <flywind> rust way is good, but i have no idea how to fall back to other implementation in Nim |
11:21:04 | FromDiscord | <Rika> what are you talking about? |
11:23:47 | FromDiscord | <flywind> In reply to @Yardanico "(to update compat to": ^ |
11:24:16 | FromDiscord | <Yardanico> @flywind yeah I'll check how they do it to understand |
11:24:34 | * | Tuatarian quit (Read error: Connection reset by peer) |
11:25:15 | * | Tuatarian joined #nim |
11:28:22 | FromDiscord | <flywind> one possible ugly solution https://github.com/timotheecour/Nim/issues/556 |
11:29:17 | FromDiscord | <Yardanico> why not use the ios solution for macos? |
11:29:25 | FromDiscord | <Yardanico> it's supported on macos 10.7+ as the apple docs say |
11:29:33 | FromDiscord | <Yardanico> which is still not perfect though |
11:31:06 | FromDiscord | <flywind> that's OK. we need to have minimal support version I guess. |
11:31:25 | FromDiscord | <flywind> other apis has version requirement too. |
11:31:33 | FromDiscord | <Yardanico> right now nim readme says that nim supports macos 10.4 and up :P |
11:32:47 | FromDiscord | <flywind> I see, maybe make a PR. |
11:34:08 | FromDiscord | <whisperdev> I was referring to Disruptek's banning.I took a look at his openapi macro package but it's beyond my skill to maintain it and I am worried it will break with future versions of Nim. |
11:38:54 | FromDiscord | <Yardanico> @flywind that weak is https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unix/weak.rs#L29 |
11:39:19 | FromDiscord | <Yardanico> it's weak linkage |
11:39:30 | FromDiscord | <Yardanico> https://stdrs.dev/nightly/x86_64-unknown-linux-gnu/src/std/sys/unix/weak.rs.html |
11:40:09 | FromDiscord | <flywind> i saw it, PR is welcome |
11:40:43 | FromDiscord | <Yardanico> i wonder if that's a reliable way though :P |
11:41:06 | FromDiscord | <Yardanico> and I can't find the impl of sys::weak |
11:41:36 | FromDiscord | <flywind> maybe use timothee's way, then no performance loss 😀 |
11:42:39 | FromDiscord | <Yardanico> it's even less reliable imo :) |
11:43:26 | FromDiscord | <flywind> or just use c wrapper |
11:43:38 | FromDiscord | <flywind> i think this way is more reliable |
11:44:17 | FromDiscord | <flywind> i will use c wrapper for macos |
11:44:21 | * | Tuatarian quit (Ping timeout: 264 seconds) |
11:44:30 | * | Tuatarian joined #nim |
11:44:54 | FromDiscord | <Yardanico> the timo's way? |
11:45:06 | FromDiscord | <Yardanico> I actually think that it's less reliable because of having an additional C file |
11:47:47 | FromDiscord | <flywind> no, just import c file. |
11:48:35 | FromDiscord | <flywind> as a temporary plan, waiting for weak linkage |
11:49:48 | FromDiscord | <Yardanico> "waiting for weak linkage" won't really happen |
11:49:54 | FromDiscord | <Yardanico> because rust only has a single backend target - LLVM |
11:50:04 | FromDiscord | <Yardanico> nim has to support a lot of C compilers some of which might not support weak linkage |
11:52:11 | * | Tuatarian quit (Read error: Connection reset by peer) |
11:52:36 | * | Tuatarian joined #nim |
11:52:57 | FromDiscord | <Yardanico> ah wait actually |
11:53:07 | FromDiscord | <Yardanico> maybe that rust thing can be ported |
11:53:27 | FromDiscord | <Yardanico> it basically uses dlsym |
11:57:36 | FromDiscord | <Yardanico> yeah it should be fairly easy to replicate that in Nim, but I'm not sure if we'd want that |
12:06:19 | FromDiscord | <Yardanico> but rust does it :P |
12:06:25 | FromDiscord | <Clyybber> don't use emit for that, this should work on llvm too |
12:06:34 | FromDiscord | <Clyybber> can't we just check the macos version? |
12:06:44 | FromDiscord | <Yardanico> @Clyybber we can, but in the C stage |
12:06:58 | FromDiscord | <Gary M> How do you choose llvm for Nim? |
12:07:03 | FromDiscord | <Yardanico> nlvm exists |
12:07:05 | FromDiscord | <Yardanico> and also cc:clang |
12:07:08 | FromDiscord | <Yardanico> https://opensource.apple.com/source/xnu/xnu-4903.270.47/EXTERNAL_HEADERS/Availability.h.auto.html |
12:07:11 | FromDiscord | <Yardanico> MAC_10_12 define |
12:07:11 | * | kenran joined #nim |
12:07:23 | FromDiscord | <Clyybber> what yard said :D |
12:07:31 | FromDiscord | <Gary M> Does cc:clang allow the clang mingw target in any way? |
12:09:37 | * | Gustavo6046 joined #nim |
12:11:14 | FromDiscord | <Clyybber> I think yes |
12:11:46 | FromDiscord | <Gary M> nlvm doesn't support windows or arm yet 😄 |
12:12:01 | FromDiscord | <Gary M> So that's already two of my targets unusable |
12:13:00 | FromDiscord | <Gary M> I guess I'll just stick with gcc |
12:13:22 | * | fredrikhr joined #nim |
12:13:23 | * | kenran_ joined #nim |
12:14:14 | FromDiscord | <รєคɭ๓๏שє> How to functionally add an element to a seq? |
12:14:36 | FromDiscord | <Gary M> Uh .add()? |
12:14:59 | FromDiscord | <รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SNk |
12:15:04 | FromDiscord | <Clyybber> & instead of + |
12:15:14 | FromDiscord | <รєคɭ๓๏שє> oh that works for seqs? nice |
12:15:19 | FromDiscord | <Clyybber> sure :D |
12:16:14 | FromDiscord | <Gary M> Technically it's a concat |
12:17:08 | FromDiscord | <รєคɭ๓๏שє> one element is `seq[int]` and the other an `int` |
12:17:29 | * | kenran quit (Quit: Lost terminal) |
12:17:35 | FromDiscord | <Rika> lets see if it works then |
12:17:37 | FromDiscord | <Rika> !eval echo @[3] & 3 |
12:17:39 | FromDiscord | <Clyybber> works |
12:17:39 | NimBot | @[3, 3] |
12:18:35 | FromDiscord | <Gary M> Wonder if you can concat arrays on seqs |
12:18:40 | FromDiscord | <Yardanico> yes |
12:18:53 | FromDiscord | <Yardanico> !eval echo [1, 2] & @[3] & 4 |
12:18:54 | NimBot | Compile failed: /usercode/in.nim(1, 13) Error: type mismatch: got <array[0..1, int], seq[int]> |
12:18:59 | FromDiscord | <Yardanico> almost |
12:19:01 | FromDiscord | <Gary M> !eval @[3] & [4,5] |
12:19:03 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <seq[int], array[0..1, int]> |
12:19:05 | FromDiscord | <Yardanico> wasn't it defined on an openarray |
12:19:10 | FromDiscord | <Gary M> Huh. |
12:19:18 | * | livcd joined #nim |
12:19:36 | FromDiscord | <รєคɭ๓๏שє> oh well |
12:19:40 | FromDiscord | <Clyybber> I mean the first element should probably be a seq |
12:19:40 | FromDiscord | <รєคɭ๓๏שє> it could work maybe |
12:19:50 | FromDiscord | <Clyybber> since otherwise it becomes prepend instead of append |
12:20:04 | FromDiscord | <Rika> technically it doesnt matter |
12:20:10 | FromDiscord | <Gary M> Well you can still add elements with concat just fine, that's what you wanted right @รєคɭ๓๏שє |
12:20:27 | FromDiscord | <รєคɭ๓๏שє> yeah sure |
12:21:04 | FromDiscord | <Clyybber> yeah, it's only defined on seq not openarray |
12:21:30 | FromDiscord | <Clyybber> !eval 3 & @[3] |
12:21:31 | NimBot | Compile failed: /usercode/in.nim(1, 3) Error: expression '3 & @[3]' is of type 'seq[int]' and has to be used (or discarded) |
12:21:41 | FromDiscord | <Gary M> Lol |
12:21:45 | FromDiscord | <Clyybber> !eval echo 3 & @[3] |
12:21:47 | FromDiscord | <Clyybber> don't mind me |
12:21:47 | NimBot | @[3, 3] |
12:21:53 | FromDiscord | <Clyybber> hey, works |
12:23:00 | FromDiscord | <Gary M> !eval var arr = [5,6]; echo @[7,8] & @arr |
12:23:02 | NimBot | @[7, 8, 5, 6] |
12:23:42 | FromDiscord | <Gary M> Easy enough to just slap a @ on it I guess. |
12:23:56 | FromDiscord | <Rika> @@@@@@@@@@@@@@ |
12:24:01 | FromDiscord | <Gary M> Anything rotten going on there like surprise allocations? Lol |
12:24:18 | FromDiscord | <Clyybber> @ allocates since array is on stack and seq on heap |
12:24:23 | FromDiscord | <Gary M> Yeah |
12:24:33 | FromDiscord | <Clyybber> but other than that. & is documented to copy |
12:24:36 | FromDiscord | <Rika> not very surprising |
12:24:38 | FromDiscord | <Clyybber> yeah |
12:25:14 | * | lritter quit (Ping timeout: 265 seconds) |
12:25:23 | FromDiscord | <Clyybber> although when the first param is a seq it could be declared sink and then with arc it would move into it if it's the last use |
12:25:35 | FromDiscord | <Clyybber> and could reuse the memory |
12:25:49 | FromDiscord | <Gary M> Exactly what I was wondering. |
12:26:28 | FromDiscord | <Gary M> Also I've been experimenting very briefly with useMalloc with the new gc's |
12:26:36 | FromDiscord | <Gary M> Seems really nice |
12:27:08 | FromDiscord | <Gary M> I don't know if there's any gotchas there, but it's a lot faster in some artificial shitty benchmarks I did |
12:27:39 | FromDiscord | <Gary M> Basically I did massive allocCstringArray's followed by dealloc |
12:28:13 | FromDiscord | <Gary M> Roughly 6 times faster than the normal allocator even with arc/orc |
12:28:41 | FromDiscord | <Clyybber> heh, yeah the default allocator is a O(1) one so it might be slower for some stuff |
12:28:53 | FromDiscord | <Clyybber> even though it's faster asymptotically |
12:29:11 | FromDiscord | <Gary M> If that's O(1) then what is malloc? |
12:29:58 | FromDiscord | <KnorrFG> i want a template to generate operator procs, but within a template the backticks have meaning, how can i escape them? (tried doubling them, and escaping via backslash, neither worked) |
12:30:45 | FromDiscord | <Gary M> I'm no expert but maybe you want a macro for that? |
12:30:58 | FromDiscord | <Gary M> Or just use a silly proc like add() |
12:31:28 | FromDiscord | <Clyybber> @Gary M depends on your allocator, but I think the default one on linux is O(n) but not respective to the memory you are requesting, but the amount of internal chunks it has to juggle |
12:31:42 | FromDiscord | <Clyybber> (edit) "linux" => "glibc" |
12:31:42 | FromDiscord | <Gary M> Instead of x + y just add x, y |
12:31:49 | FromDiscord | <Gary M> No reliance on operator |
12:32:09 | FromDiscord | <Clyybber> @KnorrFG doubling didn't work? |
12:32:18 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2SNp |
12:32:34 | FromDiscord | <Gary M> I guess I'd have to do more tests then because O(n) sounds bad |
12:32:36 | FromDiscord | <Clyybber> I think doubling is suppsoed to work, but not sure |
12:32:37 | FromDiscord | <KnorrFG> good idea |
12:33:21 | FromDiscord | <Clyybber> In reply to @Gary M "I guess I'd have": it's not respective to the amount of requested memory tho, so it might depend on fragmentation etc |
12:33:32 | FromDiscord | <Clyybber> basically unpredictable if you will |
12:33:45 | FromDiscord | <Clyybber> that's why Nim's default allocator is O(1) |
12:33:49 | FromDiscord | <Clyybber> to keep it predictable |
12:33:57 | FromDiscord | <Rika> O(n) vs O(1) doesnt give the whole picture |
12:34:02 | FromDiscord | <Rika> they only give the shape, not the values |
12:34:19 | federico3 | (that's the whole point of O-notation) |
12:34:23 | FromDiscord | <Rika> O(n) for some value lower than N can be faster than O(1) |
12:34:25 | FromDiscord | <Gary M> But if in theory malloc's worst is still faster than Nim's O(1) I would still probably go with malloc |
12:35:01 | FromDiscord | <Gary M> Really depends on my use case I guess. |
12:35:04 | FromDiscord | <Clyybber> yeah, fair |
12:35:10 | FromDiscord | <Clyybber> you could also try mimalloc |
12:35:11 | FromDiscord | <Gary M> I'm also considering using a memory pool |
12:35:34 | FromDiscord | <Clyybber> for stuff you only need for a frame? |
12:35:57 | FromDiscord | <Gary M> Something like that. |
12:36:14 | FromDiscord | <Gary M> One allocation |
12:36:53 | FromDiscord | <Gary M> I know there's like one or two in Nim |
12:42:18 | FromDiscord | <Gary M> One thing I need to figure out is SSDP |
12:42:38 | FromDiscord | <Gary M> Simple Service Discovery Protocol |
12:43:35 | FromDiscord | <Gary M> Basically I'm going to have an android app that broadcasts itself on the LAN and then on the PC side Nim will be able to discover and connect to it |
12:44:01 | FromDiscord | <Gary M> And hopefully establish a TCP connection to stream assets and debug logs |
12:47:54 | * | couven92 joined #nim |
12:51:18 | * | fredrikhr quit (Ping timeout: 260 seconds) |
12:54:27 | FromGitter | <HJarausch_gitlab> Building *koch* on Android/Termux - howto. ⏎ I just failed trying to update my develoment ``Nim`` on Termux. ⏎ ⏎ ``build_all.sh`` tries to run ⏎ ... [https://gitter.im/nim-lang/Nim?at=604e0783d2619a4f2e44b98a] |
12:54:54 | * | couven92 is now known as fredrikhr |
12:55:42 | FromDiscord | <Yardanico> can you show the full error? |
12:55:50 | FromDiscord | <Yardanico> we have some code so that you can compile nim in termux |
12:55:53 | FromDiscord | <Yardanico> also you can just |
12:55:55 | FromDiscord | <Yardanico> pkg install nim |
13:01:54 | FromGitter | <HJarausch_gitlab> pkg install nim installs nim-1.4.2, but I want the devel version (an older version of which is already running). ⏎ The error message is the linker error ⏎ ⏎ ```@mkoch.nim.c undefined reference to globfree``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=604e0942d71b6554cd42d3cf] |
13:02:58 | * | kenran_ quit (Quit: Lost terminal) |
13:03:08 | * | kenran joined #nim |
13:03:31 | FromGitter | <HJarausch_gitlab> Probably I have to patch the file ``koch.nim.cfg`` |
13:07:09 | FromDiscord | <Rika> is there a way to pass more arguments to a forloopmacro? |
13:09:33 | FromDiscord | <Gary M> What do you mean |
13:10:04 | FromDiscord | <Rika> for i in anFLM(iterable, extra_args): ... |
13:11:30 | FromDiscord | <Gary M> I don't know anything about macros like that 😄 |
13:11:40 | FromDiscord | <Rika> doesnt seem to anyway |
13:11:53 | FromDiscord | <Gary M> Is it just to modify the iterable? |
13:12:05 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#macros-for-loop-macro |
13:12:12 | FromDiscord | <Rika> `A macro that takes as its only input parameter an expression of the special type system.ForLoopStmt can rewrite the entirety of a for loop:` |
13:21:10 | FromDiscord | <Gary M> How do you compile for android? |
13:28:37 | FromGitter | <HJarausch_gitlab> I use ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ nim.cfg.patch is similar. ... [https://gitter.im/nim-lang/Nim?at=604e0f85d71b6554cd42e8ba] |
13:30:01 | FromDiscord | <Goel> How do i translate the pointers of C like this:↵`drawTriangleFan(Vector2 points, int pointsCount, Color color)`↵Into pointers of Nim? I tried `ptr Vector2` but tells me Vector2 is not of the wrong type |
13:30:29 | FromDiscord | <Rika> ptr Vector2 is correct |
13:30:43 | FromDiscord | <Yardanico> it's actually probably ptr UncheckedArray[Vector2] |
13:30:44 | FromDiscord | <Goel> (edit) removed "not" | removed "the" |
13:30:50 | FromDiscord | <Rika> oh thats true |
13:30:51 | FromDiscord | <Yardanico> because points is prular |
13:30:53 | FromDiscord | <Rika> didnt notice its called points |
13:30:53 | FromDiscord | <Gary M> Or not using addr |
13:30:53 | FromDiscord | <Yardanico> (edit) "prular" => "plural" |
13:31:33 | FromDiscord | <Gary M> It'll say a Vector2 is wrong type if it's not Vector2.addr :P |
13:31:41 | FromDiscord | <Rika> what? |
13:32:03 | FromDiscord | <Rika> you mean if youre not passing in an address |
13:32:09 | FromDiscord | <Gary M> Yeah it'll say type of `Vector2` does not match type of `ptr Vector2` |
13:32:45 | FromDiscord | <Yardanico> it's something like that |
13:32:46 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SNQ |
13:32:51 | FromDiscord | <Yardanico> mypoints can be an array too |
13:33:32 | FromDiscord | <Gary M> That looks accurate, considering you have to pass in the length |
13:33:54 | FromDiscord | <Gary M> So it gets the start memory address and the stride length to read |
13:34:04 | FromDiscord | <Yardanico> yeah that's the usual pattern |
13:34:05 | FromDiscord | <Yardanico> for C FFI |
13:34:27 | FromDiscord | <Goel> `Vector2.addr` Thow worked |
13:34:34 | FromDiscord | <Goel> (edit) "Thow" => "This" |
13:34:37 | FromDiscord | <Yardanico> for a single point it'll work |
13:34:43 | FromDiscord | <Yardanico> for multiple - no |
13:34:44 | FromDiscord | <Gary M> For a single point yeah. |
13:35:06 | FromDiscord | <Gary M> Make it an array or seq of points and use Yard's example with the 0 index. |
13:35:18 | FromDiscord | <Gary M> It'll still be a Vector2 at the zero index so it will work |
13:36:57 | FromDiscord | <Gary M> Remember, triangles need 3 points, not one haha |
13:36:57 | FromDiscord | <Goel> What do you mean for a single point? if it pointes to the Vector, my Vector has been initialized with two points |
13:37:36 | FromDiscord | <Gary M> A point is just a single coordinate, a dot |
13:38:31 | FromDiscord | <Gary M> Vec2 typically would be representing the (x,y) |
13:38:43 | FromDiscord | <Yardanico> @Goel drawTriangleFan expects one _or more_ points |
13:38:46 | FromDiscord | <Rika> are `ForLoopStmt`s more equivalent to `untyped` or `typed`? |
13:38:51 | FromDiscord | <Yardanico> so it's more correct to do it my way |
13:39:02 | FromDiscord | <Yardanico> because you might want to pass multiple Vector2 points to drawTriangleFan |
13:39:12 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2SNU |
13:39:15 | FromDiscord | <Goel> So this is: "Vector2 points" I read this as, The position if memory of the two points of Vector2, that are like x and y |
13:39:21 | FromDiscord | <Yardanico> no |
13:39:35 | FromDiscord | <Yardanico> it reads as "a pointer to a sequence of one or more points" |
13:39:38 | FromDiscord | <Yardanico> one point is one Vector2 |
13:39:43 | FromDiscord | <Gary M> Listen to yard, he's very smart 😄 |
13:39:48 | FromDiscord | <Yardanico> official doc is "Draw a triangle fan defined by points (first vertex is the center)" |
13:40:13 | FromDiscord | <Yardanico> in 2D (x, y) is a single point - that is your Vector2 |
13:40:34 | FromDiscord | <Goel> Isee |
13:40:39 | FromDiscord | <Yardanico> @Rika I think untyped because typed resolves all stuff |
13:40:46 | FromDiscord | <Gary M> That's what I tried to explain |
13:40:54 | FromDiscord | <Gary M> But I don't even know the api lol |
13:41:11 | FromDiscord | <Yardanico> neither do I, I just searched the function name in github |
13:41:17 | FromDiscord | <Gary M> Oh lol |
13:41:21 | * | Q-Master quit (Ping timeout: 264 seconds) |
13:41:22 | FromDiscord | <Yardanico> and it's apparently from raylib |
13:41:25 | FromDiscord | <Gary M> Ah |
13:41:30 | FromDiscord | <Yardanico> also https://github.com/greenfork/nimraylib_now has a wrong definition for it :P |
13:41:43 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/820652915756367912/unknown.png |
13:41:51 | FromDiscord | <Gary M> Anyways yeah you're going to want to use an array or sequence of vector2's |
13:42:01 | FromDiscord | <Rika> In reply to @Yardanico "<@!259277943275126785> I think untyped": ;^^ does that mean i cant determine whether something is an iterator or a type within the macro? |
13:42:11 | FromDiscord | <Gary M> And just point to the addr of the 1st point and pass in the length of the whole sequence |
13:42:30 | FromDiscord | <Yardanico> @Rika you kind of can by generating code that'll call other macros |
13:42:35 | FromDiscord | <Gary M> It'll read all points in the sequence that way |
13:42:36 | FromDiscord | <Yardanico> that then accept typed |
13:42:46 | FromDiscord | <Rika> sounds CURSED |
13:42:50 | FromDiscord | <Yardanico> but you can't just say "give me the type of this untyped node" in macros |
13:42:59 | FromDiscord | <Goel> Yes i'm trying to covert more examples from C using the RayLib cheatsheet to Nim, but im not able to do it since i barely understand Nim and i know nothing about C |
13:43:15 | FromDiscord | <Gary M> You'll get the hang of it over time. |
13:43:26 | FromDiscord | <Goel> But so far i had no problem at all with other C examples using the bindings, the only think i dont understand is the Pointers |
13:43:29 | FromDiscord | <Gary M> You just need to know the quirks and isms of working with C libs |
13:43:37 | FromDiscord | <Goel> (edit) "is" => "are" |
13:43:48 | FromDiscord | <Rika> In reply to @Yardanico "but you can't just": but i can make a macro that makes it bool? i just need to know if something is an inline iterator or not, ill leave nim to resolve whether anything else has a `len` proc or not |
13:44:05 | FromDiscord | <Yardanico> @Rika yeah you surely can |
13:44:06 | FromDiscord | <Gary M> So a pointer is just saying look at this 👉 memory address for the data |
13:44:16 | FromDiscord | <Rika> now, i dont know how that would work ;^^ |
13:45:10 | FromDiscord | <Gary M> You're pointing 👉 at the array/seq of Vector2's [0] or 1st point |
13:45:19 | FromDiscord | <Gary M> And then you're telling it how long that sequence is |
13:47:30 | FromDiscord | <Gary M> Which example is this one? |
13:47:54 | FromDiscord | <Goel> sent a long message, see http://ix.io/2SNZ |
13:48:00 | FromDiscord | <Yardanico> nonono, you're passing a _single_ Vector2 |
13:48:03 | FromDiscord | <Yardanico> a vector is two points |
13:48:07 | FromDiscord | <Yardanico> (a 2d vector) |
13:48:10 | FromDiscord | <Goel> Exactly |
13:48:14 | FromDiscord | <Yardanico> it doesn't give you an error |
13:48:19 | FromDiscord | <Gary M> Okay so hold up for 2 seconds. |
13:48:21 | FromDiscord | <Goel> Thats what i told you before, you tell me i was passing a single point |
13:48:23 | FromDiscord | <Yardanico> but if you tried to pass _two_ Vector2Ds, it'll fail |
13:48:37 | FromDiscord | <Yardanico> that's why it's more correct to define it as ptr UncheckedArray[Vector2] |
13:49:29 | FromDiscord | <Goel> I tried in your way, it gives me an error, only with .addr works. Don't ask me why or how, im just testing it |
13:49:40 | FromDiscord | <Yardanico> it'll give you an error because you need to change your code |
13:50:25 | FromDiscord | <Yardanico> ah wait actually your code is wrong? |
13:50:31 | FromDiscord | <Yardanico> compiles != that it would work |
13:50:34 | FromDiscord | <Goel> I'm not going to modify the bindings at all, nor do i want to |
13:50:36 | FromDiscord | <Yardanico> you're passing a single vector but saying 3 points |
13:51:15 | FromDiscord | <Gary M> you don't have to modify the bindings |
13:51:35 | FromDiscord | <Gary M> which ones are you using? |
13:52:38 | FromDiscord | <Gary M> In reply to @Goel "I'm not going to": Which bindings are you using? Also, can you post the code you're using right now so I can adjust it? |
13:52:47 | FromDiscord | <Gary M> just the vec2 and the proc call |
13:52:50 | FromDiscord | <Yardanico> okay, guess I won't be able to help with that issue more, I'll step out of this question now :) |
13:54:48 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SO3 |
13:54:56 | FromDiscord | <Gary M> I don't see why this wouldn't work |
13:55:01 | * | livcd quit (Quit: Lost terminal) |
13:55:22 | ForumUpdaterBot | New thread by Livingstone1337: Importing a function from a module, see https://forum.nim-lang.org/t/7623 |
13:55:31 | * | oz quit (Ping timeout: 276 seconds) |
13:55:47 | * | spiderstew_ quit (Quit: ZNC 1.7.2+deb3 - https://znc.in) |
13:56:01 | * | spiderstew joined #nim |
13:56:03 | FromDiscord | <Gary M> and he's gone silent, oh well |
13:56:09 | * | oz joined #nim |
13:56:40 | FromDiscord | <Goel> sent a long message, see http://ix.io/2SO5 |
13:56:43 | * | Araq quit (Ping timeout: 260 seconds) |
13:56:46 | FromDiscord | <Yardanico> yeah that's not how you would do it :P |
13:56:49 | * | Oddmonger quit (Ping timeout: 276 seconds) |
13:57:02 | FromDiscord | <Goel> (edit) "long message," => "code paste," | "http://ix.io/2SO5" => "https://play.nim-lang.org/#ix=2SO6" |
13:57:58 | FromDiscord | <Yardanico> one sec |
13:58:16 | FromDiscord | <Gary M> sent a code paste, see https://paste.rs/pdB |
13:58:37 | FromDiscord | <Yardanico> yeah I pointed out above that it's wrong |
13:58:44 | FromDiscord | <Gary M> yes |
13:58:54 | FromDiscord | <Gary M> I mean we've explained it several times |
13:58:57 | * | Araq joined #nim |
13:59:04 | FromDiscord | <Gary M> array/sequence, addr of [0] |
13:59:17 | * | livcd joined #nim |
14:00:37 | FromDiscord | <Yardanico> @Goel |
14:00:48 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SOb |
14:00:53 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/820657735288094720/unknown.png |
14:00:57 | FromDiscord | <Gary M> also wait wait |
14:01:05 | FromDiscord | <Gary M> why is nimraylib_now in your src directory? |
14:01:11 | FromDiscord | <Gary M> do you know how to use nimble install? |
14:01:19 | FromDiscord | <Yardanico> yeah that was in Goel's example |
14:01:26 | FromDiscord | <Yardanico> (I installed from nimble myself) |
14:01:27 | FromDiscord | <Gary M> I know, I'm asking Goel |
14:01:38 | FromDiscord | <Yardanico> a proper way is to `nimble install nimraylib_now` and `import nimraylib_now/[raylib, raygui, raymath, physac]` |
14:02:02 | FromDiscord | <Gary M> It shows that on the readme in the git |
14:02:26 | FromDiscord | <Gary M> you typically don't have to manually copy nim libraries |
14:04:15 | FromDiscord | <Goel> No thats not the main folder i use for RayLib, the master folder of the bindings are in another directory |
14:04:35 | FromDiscord | <Gary M> but you're importing from /src/ |
14:04:40 | FromDiscord | <Yardanico> @Goel yeah we understand, we just mean that it's usually better to use `nimble` to manage your dependencies rather than to manually bundle libraries |
14:05:08 | FromDiscord | <Gary M> use `nimble install <package name>` and then `import <package name>` |
14:05:10 | FromDiscord | <Rika> not really better just preferred |
14:05:18 | FromDiscord | <Gary M> no, it's better lol |
14:05:24 | FromDiscord | <Gary M> unless you have to modify the file directly |
14:05:29 | FromDiscord | <Rika> no, its not better |
14:05:32 | FromDiscord | <Gary M> it is better |
14:05:36 | FromDiscord | <Rika> why so? |
14:05:41 | FromDiscord | <Gary M> updates to the library. |
14:05:47 | FromDiscord | <Gary M> adding dependencies |
14:05:48 | FromDiscord | <Gary M> etc |
14:05:49 | FromDiscord | <Rika> you can do that with git submodules |
14:05:54 | FromDiscord | <Gary M> that's way worse |
14:05:58 | FromDiscord | <Rika> why so? |
14:06:04 | FromDiscord | <Gary M> why use that when nimble already exists and solves the problem |
14:06:13 | FromDiscord | <Rika> same question reversed. |
14:06:14 | FromDiscord | <Gary M> much easier at that |
14:06:19 | FromDiscord | <Goel> I did that because once im done with the examples in the subfolders i'll also have the src on the top folder so i can zip that and upload to gdrive without bothering it other stuff |
14:06:46 | FromDiscord | <Gary M> because if you start mixing submodules and nimble installs that's dumb |
14:06:58 | FromDiscord | <Rika> well if you are mixing them then sure its dumb |
14:07:06 | FromDiscord | <Rika> that doesnt make one system inherently better for everyone |
14:07:10 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SOd |
14:07:11 | FromDiscord | <Gary M> why WOULDN'T you |
14:07:21 | FromDiscord | <Gary M> it is better |
14:07:23 | FromDiscord | <Gary M> it's easier to install |
14:07:26 | FromDiscord | <Gary M> it's easier to manage |
14:07:32 | FromDiscord | <gollark> Does anyone know how to give SQL queries array parameters in `tiny_sqlite`? SQLite has a CARRAY thing but it's not builtin and `tiny_sqlite` doesn't mention any support for it. Are there other libraries which can do this? I think I can use the JSON extension for this but ew. |
14:08:00 | FromDiscord | <Gary M> nimble install <package name> is significantly better than adding a git submodule and polluting your local file structure |
14:08:19 | FromDiscord | <Gary M> and then anyone who wants to use your lib has to pull submodules? Please. |
14:08:29 | FromDiscord | <Rika> i dont see the difference |
14:08:36 | FromDiscord | <Yardanico> @gollark can you show a C example of CARRAY from somewhere? |
14:08:37 | FromDiscord | <Gary M> smh |
14:08:38 | FromDiscord | <Rika> you're polluting something global instead of locally |
14:08:42 | FromDiscord | <Rika> (edit) "locally" => "local" |
14:08:53 | FromDiscord | <Gary M> out of your project structure, yes |
14:08:54 | FromDiscord | <Yardanico> ah @gollark "The carray() function is not compiled into SQLite by default. It is available as a loadable extension in the ext/misc/carray.c source file." |
14:08:56 | FromDiscord | <Gary M> this is a good thing |
14:09:18 | FromDiscord | <Gary M> if your project requires it as a dependency, you add it to the nimble. EASY |
14:09:24 | * | Oddmonger joined #nim |
14:09:35 | FromDiscord | <Rika> and submodules are harder? |
14:09:51 | FromDiscord | <Rika> how so? its the same difficulty in my eyes |
14:10:01 | FromDiscord | <Gary M> adding, pulling, updating? Yes. |
14:10:18 | FromDiscord | <Gary M> `nimble install --depsOnly` |
14:10:41 | FromDiscord | <Gary M> and again, polluted local file structure is not great. |
14:10:47 | FromDiscord | <Rika> because |
14:10:52 | FromDiscord | <Gary M> Your project should be your project, not your deps |
14:11:09 | FromDiscord | <Rika> because |
14:11:14 | FromDiscord | <Gary M> literally that |
14:11:17 | FromDiscord | <Gary M> that's the because |
14:11:19 | FromDiscord | <Gary M> that |
14:11:20 | * | Q-Master joined #nim |
14:11:21 | FromDiscord | <Gary M> literally that |
14:11:29 | FromDiscord | <Rika> very explanatory thank you |
14:11:34 | FromDiscord | <Gary M> you're welcome lol |
14:11:42 | FromDiscord | <Rika> -_- |
14:12:22 | FromDiscord | <Gary M> so you seriously think that `git submodule update --init --recursive` is easier than `nimble install --depsOnly`? |
14:12:28 | FromDiscord | <Gary M> or at least equal |
14:13:06 | FromDiscord | <Gary M> and then oh you want to update? `git submodule update --remote --merge`, elegant |
14:14:20 | FromDiscord | <Goel> @Gary M I don't get what is the difference between `drawTriangleStrip` and `drawTriangleFan` Probably im passing the wrong values for the Vector points, because they both look identical to me |
14:14:31 | FromDiscord | <Gary M> how about a project where you add a git submodule then want to remove it later because you're changing libs or don't need it anymore? |
14:14:40 | FromDiscord | <Gary M> `git submodule deinit <submodule>` |
14:14:48 | FromDiscord | <Gary M> vs nimble literally just remove the import |
14:14:50 | FromDiscord | <Goel> (edit) "@Gary M I don't get what is the difference between `drawTriangleStrip` and `drawTriangleFan` Probably im passing the wrong values for the Vector points, because they both look identical to me ... " added "(Im using the proved version of Yardanico)" |
14:14:58 | FromDiscord | <Gary M> doesn't affect your file structure or anything |
14:15:03 | FromDiscord | <Rika> and the requires. |
14:15:10 | FromDiscord | <Gary M> still, very simple. |
14:15:17 | FromDiscord | <Rika> and a command isnt? |
14:15:21 | FromDiscord | <Rika> what? |
14:15:31 | FromDiscord | <Rika> dude |
14:15:32 | FromDiscord | <Rika> whatever |
14:15:34 | FromDiscord | <Gary M> uh, it's objectively better? |
14:15:36 | FromDiscord | <Gary M> what? |
14:15:36 | FromDiscord | <Gary M> dude |
14:15:38 | FromDiscord | <Gary M> lol |
14:15:42 | * | Q-Master quit (Ping timeout: 256 seconds) |
14:16:04 | FromDiscord | <Gary M> nimble is so well integrated into the nim ecosystem, there are plenty of reasons why it's "better" |
14:16:23 | * | Oddmonger quit (Changing host) |
14:16:23 | * | Oddmonger joined #nim |
14:16:24 | FromDiscord | <Gary M> you can even point it to gits directly |
14:16:33 | FromDiscord | <Gary M> so like why would you ever need to use git submodules, ever |
14:17:57 | FromDiscord | <Gary M> In reply to @Goel "<@!177350766229454848> I don't get": A triangle fan is similar to a triangle strip, except that all the triangles share one vertex |
14:18:17 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/820662115748282429/trifan.png |
14:18:19 | FromDiscord | <Gary M> this is a fan |
14:18:27 | FromDiscord | <Gary M> they all share the v1 |
14:18:36 | FromDiscord | <Gary M> you see how it resembles a fan shape? |
14:18:53 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/820662264017059870/tristrip.png |
14:18:55 | FromDiscord | <Gary M> this is a triangle strip |
14:19:42 | FromDiscord | <Yardanico> btw it might be better to move to #gamedev @Gary M @Goel |
14:19:48 | FromDiscord | <Yardanico> just for more like-minded people :P |
14:26:34 | FromDiscord | <Gary M> @Yardanico hey yard I have these uint32 bitflags and I'm doing comparisons like if(flag and flag).bool right |
14:26:43 | FromDiscord | <Yardanico> yeah? |
14:26:48 | FromDiscord | <Gary M> what would I have to do to make it implicitly cast to bool? |
14:27:13 | FromDiscord | <Yardanico> well, you'll have to write a converter from int to bool |
14:27:18 | FromDiscord | <Gary M> ah gross |
14:27:30 | FromDiscord | <Yardanico> also, did you see https://nim-lang.org/docs/manual.html#set-type-bit-fields ? |
14:27:37 | FromDiscord | <Yardanico> you can model c bitflags with nim's enum |
14:27:40 | FromDiscord | <Gary M> converters are really dangerous no? |
14:28:15 | FromDiscord | <Gary M> the wrapper I'm using wants to just use uint32's for that. |
14:28:32 | FromDiscord | <Clyybber> oh |
14:28:39 | FromDiscord | <Clyybber> @Gary M what do you need? |
14:28:48 | FromDiscord | <Rika> can probably use a cast to a set type for that |
14:29:05 | FromDiscord | <Yardanico> @Gary M they're not "dangerous", but implicit and sometimes can lead to surprising behaviours/errors |
14:29:07 | FromDiscord | <Gary M> I was just hoping I could just not have to wrap them in parenthesis and .bool them |
14:29:09 | FromDiscord | <Yardanico> so the manual way might be more preferred |
14:29:21 | FromDiscord | <Gary M> but it's the end of the world at all lol |
14:29:53 | FromDiscord | <Clyybber> freudian slip |
14:30:01 | FromDiscord | <Gary M> ouch |
14:30:07 | FromDiscord | <Gary M> it's definitely the end of the world now |
14:30:27 | FromDiscord | <Rika> sorry, my fault |
14:30:34 | FromDiscord | <Rika> hit the nuke button by accidenta |
14:30:35 | FromDiscord | <Rika> (edit) "accidenta" => "accident" |
14:30:38 | FromDiscord | <Clyybber> damn it |
14:30:57 | FromDiscord | <Clyybber> happens to the best of us |
14:31:16 | FromDiscord | <Rika> im clearly not one of the best though |
14:31:24 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/820665415235010650/unknown.png |
14:31:31 | FromDiscord | <Gary M> look how nice this is too (unrelated to the bitflags) lol |
14:31:40 | FromDiscord | <Yardanico> yeah an enum would be much better |
14:31:51 | FromDiscord | <Gary M> these are actually VkBool32's |
14:31:53 | FromDiscord | <Yardanico> like muuuuuuuuuuuch better |
14:32:05 | FromDiscord | <Clyybber> In reply to @Rika "im clearly not one": that's what they want you to think |
14:32:07 | FromDiscord | <Rika> much better but itll still look like a fuckin mess |
14:32:13 | FromDiscord | <Yardanico> In reply to @Rika "much better but itll": not at all |
14:32:22 | FromDiscord | <Gary M> these I probably could convert from VkBool32 to bool |
14:32:22 | FromDiscord | <Rika> really? the list looks massive |
14:32:24 | FromDiscord | <Yardanico> you just check if there's at least one element that's in the second set |
14:32:27 | FromDiscord | <Yardanico> but not in the first one |
14:32:29 | FromDiscord | <Rika> a massive enum is still pretty bad |
14:32:33 | FromDiscord | <Yardanico> i mean otherwise |
14:32:35 | FromDiscord | <Gary M> like I said, unrelated to the bitflag issue |
14:32:35 | FromDiscord | <Yardanico> @Rika not "bad" |
14:32:36 | FromDiscord | <Rika> oh |
14:32:37 | FromDiscord | <Rika> OH |
14:32:40 | FromDiscord | <Rika> i misread the code |
14:32:41 | FromDiscord | <Gary M> these are actually bools |
14:32:51 | FromDiscord | <Clyybber> lmao @Gary M why don't you just check them by comparing them directly? |
14:33:05 | FromDiscord | <Clyybber> oh neverimnd |
14:33:05 | FromDiscord | <Rika> yeah you only need to intersect them and see if the intersection is not equal to the requested set... |
14:33:07 | FromDiscord | <Gary M> because if wants a real bool lol |
14:33:10 | FromDiscord | <Rika> that sounds really good |
14:33:20 | FromDiscord | <Rika> In reply to @Gary M "these are actually bools": rest in peace |
14:33:33 | FromDiscord | <Gary M> and I'm checking if `bool` and not `otherbool` |
14:33:41 | FromDiscord | <Clyybber> @Gary M you can do a for fields |
14:33:45 | FromDiscord | <Gary M> so if true and not true |
14:33:57 | FromDiscord | <Rika> In reply to @Clyybber "<@!177350766229454848> you can do": yeah but over two objects? |
14:34:03 | FromDiscord | <Rika> has to iterate both fields sooooooo |
14:34:07 | FromDiscord | <Gary M> that's the messy thing 😄 |
14:34:19 | FromDiscord | <Gary M> this is how it was done in the original C++ and I'm not too worried. |
14:34:26 | FromDiscord | <Rika> >C++ |
14:34:29 | FromDiscord | <Rika> theres your problem |
14:34:31 | FromDiscord | <Clyybber> In reply to @Rika "yeah but over two": easy, there's a fieldParis iterator |
14:34:33 | FromDiscord | <Gary M> lol |
14:34:46 | FromDiscord | <Gary M> show me fieldPairs 😄 |
14:34:46 | FromDiscord | <Rika> i remember seeing fieldpairs |
14:34:49 | FromDiscord | <Rika> never checked it |
14:35:14 | FromDiscord | <Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i,S,T |
14:35:22 | FromDiscord | <Rika> doesnt sound like it helps much |
14:35:23 | FromDiscord | <Gary M> is it possible to make a converter local scoped? |
14:35:35 | FromDiscord | <Rika> oh |
14:35:38 | FromDiscord | <Rika> i think it helps |
14:35:42 | FromDiscord | <Rika> if you use this in a macro context |
14:35:49 | FromDiscord | <Gary M> hold on let me see |
14:36:01 | FromDiscord | <Rika> but you gotta learn macros if you havent already |
14:36:10 | FromDiscord | <Clyybber> oh actually there's even an overload for two objects |
14:36:14 | FromDiscord | <Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT |
14:36:16 | FromDiscord | <Clyybber> yeah |
14:36:17 | FromDiscord | <Rika> didnt see the overload |
14:36:18 | FromDiscord | <Rika> yeah |
14:36:25 | FromDiscord | <Rika> there was an overload, ive never seen the overload before |
14:36:28 | FromDiscord | <Rika> when was that added? |
14:36:31 | FromDiscord | <Clyybber> no idea |
14:36:41 | FromDiscord | <Rika> git blame time |
14:37:15 | FromDiscord | <Rika> its two years old |
14:37:19 | FromDiscord | <Rika> aka i should have known |
14:37:20 | FromDiscord | <Yardanico> more |
14:37:28 | FromDiscord | <Rika> i meant over yes |
14:37:45 | FromDiscord | <Rika> im prolly just becoming stupid |
14:37:56 | FromDiscord | <Rika> anyway @Gary M have a look at this one https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT |
14:38:07 | FromDiscord | <Rika> just in case you're still looking at the other one |
14:38:24 | FromDiscord | <Gary M> `The current implementation also has a bug that affects symbol binding in the loop body.` |
14:38:29 | FromDiscord | <Gary M> what does that even mean |
14:39:04 | FromDiscord | <Rika> uh |
14:39:05 | FromDiscord | <Rika> yes |
14:39:17 | FromDiscord | <Rika> i understand but i dont know how to explain |
14:40:46 | FromDiscord | <Clyybber> @Gary M it's because it's expanded at compile time |
14:40:53 | FromDiscord | <Clyybber> it shouldn't matter for your use case |
14:40:58 | FromDiscord | <Clyybber> only in some edge cases |
14:41:06 | FromDiscord | <Gary M> I just don't understand what it means let alone the because |
14:43:35 | FromDiscord | <Clyybber> @Gary M https://github.com/nim-lang/Nim/issues/11046 |
14:43:42 | FromDiscord | <Clyybber> it just means that after the loop is unrolled |
14:43:50 | FromDiscord | <Clyybber> name isn't a variable anymore |
14:43:52 | FromDiscord | <Clyybber> but a string literal |
14:43:58 | * | kenran quit (Quit: leaving) |
14:44:49 | FromDiscord | <Gary M> is it actually able to iterate over object fields themselves |
14:44:53 | FromDiscord | <Clyybber> yeah |
14:45:00 | FromDiscord | <Rika> not in the classical sense |
14:45:03 | FromDiscord | <Clyybber> but at compile time |
14:45:05 | FromDiscord | <Rika> its an unrolled for loop |
14:45:12 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/820668891449393182/unknown.png |
14:45:16 | FromDiscord | <Rika> so none of the "variables" are actually variables |
14:45:18 | FromDiscord | <Gary M> because it's an object with a ton of fields |
14:45:22 | FromDiscord | <Clyybber> easy |
14:45:29 | FromDiscord | <Clyybber> will expand exactly to your code |
14:45:47 | FromDiscord | <Rika> doesnt matter how many fields there are i believe... |
14:45:54 | FromDiscord | <Clyybber> yeah |
14:45:55 | FromDiscord | <Gary M> ` for req, sup in (requested, supported).fieldPairs:` this is not correct |
14:46:02 | FromDiscord | <Gary M> how should I be doing it? |
14:46:17 | FromDiscord | <Clyybber> three values |
14:46:18 | FromDiscord | <Rika> probably have to use the regular syntax `fieldPairs(requested, supported)` instead |
14:46:30 | FromDiscord | <Rika> oh yeah that too |
14:46:37 | FromDiscord | <Clyybber> for name, req, sup in fieldPairs(requested , supported) |
14:46:38 | FromDiscord | <Rika> name, req, sup |
14:46:40 | FromDiscord | <Rika> yeah |
14:46:49 | FromDiscord | <Clyybber> yeah, and normal params of course, because you are constructing a tuple |
14:47:12 | FromDiscord | <Rika> `(requested, supported).fieldPairs` this passes one parameter (a tuple), not two parameters |
14:48:07 | FromDiscord | <Gary M> so this? |
14:48:10 | FromDiscord | <Clyybber> yeah |
14:48:10 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SOn |
14:48:31 | FromDiscord | <Gary M> now my other question idk if someone answered, can I define a converter only in local scope? |
14:48:36 | FromDiscord | <Clyybber> nope |
14:48:40 | FromDiscord | <Clyybber> afaik |
14:48:43 | FromDiscord | <Rika> wdym local? |
14:48:47 | FromDiscord | <Rika> module wide only i believe |
14:48:52 | FromDiscord | <Gary M> inside a proc 😛 |
14:48:54 | FromDiscord | <Rika> any smaller not possible |
14:48:58 | FromDiscord | <Clyybber> yeah |
14:49:07 | FromDiscord | <Clyybber> would be nice if that worked tho |
14:49:15 | FromDiscord | <Clyybber> probably not too hard with todays compiler |
14:49:16 | FromDiscord | <Rika> sounds hard to impl |
14:49:19 | FromDiscord | <Rika> really? |
14:49:33 | FromDiscord | <Rika> might be a bad idea though? |
14:49:42 | FromDiscord | <Clyybber> hmm, I like the idea |
14:49:51 | FromDiscord | <Clyybber> because it allows to restrain the scope of converters then |
14:49:53 | FromDiscord | <Clyybber> seems handy |
14:49:58 | FromDiscord | <Gary M> I would like it so I can very specifically convert exactly what I want |
14:50:00 | FromDiscord | <Rika> hm |
14:50:06 | FromDiscord | <Rika> i dont think there are downsides yeah |
14:50:06 | FromDiscord | <Gary M> and not get UB in the rest of the module |
14:50:17 | FromDiscord | <Rika> tfw U means a lot of things |
14:50:18 | giaco_ | elegant way to convert an object made of ints/floats into url parameters like field1=value&field2=value&field3... ? |
14:50:25 | FromDiscord | <Gary M> undefined behaviour |
14:50:30 | FromDiscord | <Rika> i believe theres a proc for that giaco |
14:50:43 | FromDiscord | <Clyybber> @Rika and I think implementation is just instead of just searching in the global converters list for a type, search in the scopes too |
14:50:44 | FromDiscord | <Rika> i was thinking "unexpected" for your scenario |
14:50:57 | FromDiscord | <Rika> not really undefined, just unexpected |
14:51:11 | giaco_ | Rike yeah probably but don't know how to name it or where in std should I find it |
14:51:17 | FromDiscord | <Gary M> https://nim-lang.org/docs/uri.html#encodeUrl%2Cstring ? |
14:51:41 | FromDiscord | <Rika> i dont have internet fast enough to load the docs |
14:51:47 | FromDiscord | <Rika> i mean |
14:51:54 | FromDiscord | <Rika> i can load it its just that it takes a pretty long time |
14:52:20 | FromDiscord | <Clyybber> damn |
14:52:49 | FromDiscord | <Yardanico> @giaco_ https://nim-lang.org/docs/uri.html#encodeQuery%2CopenArray%5B%5D |
14:52:56 | FromDiscord | <Gary M> yeah that's the one |
14:53:03 | FromDiscord | <Yardanico> but you'd need $ first, but that's easy |
14:54:05 | giaco_ | Yardanico, thanks, you say it is easy to convert object into openArray[(string,string)]? |
14:54:27 | FromDiscord | <Gary M> !eval import uri; echo encodeQuery({"a": "1", "b": "2"}) |
14:54:31 | NimBot | a=1&b=2 |
14:54:49 | FromDiscord | <Yardanico> @giaco_ object? |
14:55:06 | FromDiscord | <Yardanico> you can make your custom encodeQuery with fieldPairs for that :D |
14:56:36 | FromDiscord | <Gary M> does eval work multiline |
14:56:53 | FromDiscord | <Yardanico> no |
14:56:56 | FromDiscord | <Yardanico> @giaco_ this will work: |
14:56:56 | FromDiscord | <Gary M> you could just overload the $ for the object type can't you? |
14:57:02 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SOo |
14:57:15 | FromDiscord | <Yardanico> copied encodeQuery and adapted to fieldPairs |
14:57:26 | FromDiscord | <Gary M> oh nice |
14:57:40 | FromDiscord | <Yardanico> hm, but it's not really efficient for objects with a lot of fields |
14:57:43 | FromDiscord | <Yardanico> the binary will get bloated |
14:58:22 | FromDiscord | <Yardanico> hm |
14:58:27 | giaco_ | how can you write a solution so fast! Damn I feel stupid :D thanks |
14:59:01 | FromDiscord | <Yardanico> yeah, just bear in mind that this code will negatively affect binary sizes if object has a lot of fields |
14:59:04 | FromDiscord | <Yardanico> because the loop is unrolled |
14:59:52 | FromDiscord | <Gary M> not necessarily the worst tradeoff |
15:00:10 | FromDiscord | <Gary M> don't unrolled loops usually run faster unless they're vectorized? |
15:00:15 | FromDiscord | <Gary M> But you can't really vectorize strings lol |
15:00:28 | FromDiscord | <Yardanico> @giaco_ the non-bloated solution would be something like this |
15:00:40 | * | Q-Master joined #nim |
15:00:41 | FromDiscord | <Yardanico> I mean less bloated |
15:02:22 | FromDiscord | <Yardanico> but it'll allocate seqs each time the proc is called 🤔 |
15:02:25 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/yv1 |
15:02:44 | FromDiscord | <Gary M> lol can you rewrite it as arrays |
15:03:02 | FromDiscord | <Yardanico> yeah but it'll still require allocation, even if a stack one :P |
15:03:30 | ForumUpdaterBot | New thread by Livingstone1337: Assigning an array of an array, see https://forum.nim-lang.org/t/7624 |
15:05:00 | giaco_ | Yardanico, you're adding to a seq without initializing it?! |
15:05:09 | FromDiscord | <Rika> you dont need to |
15:05:42 | * | Q-Master quit (Ping timeout: 260 seconds) |
15:05:49 | giaco_ | stack/heap confusion growing |
15:06:21 | FromDiscord | <Yardanico> replied to that forum thread |
15:06:24 | FromDiscord | <Yardanico> fast responses |
15:06:25 | FromDiscord | <Gary M> the only trouble I've ever had with uninitialized seqs was with C ffi addr's 😛 |
15:06:47 | FromDiscord | <Gary M> but generally no you don't have to initialize them to add to them. |
15:09:09 | FromDiscord | <Gary M> anyways, the whole scoped converter idea, think about it haha |
15:09:52 | FromDiscord | <Gary M> is there any way to make {.link: "".} search system paths like dynlib? |
15:10:11 | giaco_ | so an uninitialized seq lives on the stuck but has dynamic resizing?! |
15:10:14 | giaco_ | *stack |
15:10:17 | FromDiscord | <Yardanico> no |
15:10:27 | FromDiscord | <Gary M> heap |
15:10:28 | FromDiscord | <Yardanico> it depends on what you call "seq" |
15:10:32 | FromDiscord | <Rika> uninit seqs are just "implicitly init" |
15:10:37 | FromDiscord | <Yardanico> seq data always lives on the heap |
15:10:55 | FromDiscord | <Yardanico> but internal capacity and/or length fields might be on the stack |
15:11:28 | FromDiscord | <Yardanico> for example with arc/orc (newruntime), seq is an object with len: int and a pointer to seq payload which has capacity: int and the actual data |
15:11:46 | FromDiscord | <Yardanico> https://github.com/nim-lang/nim/blob/devel/lib/system/seqs_v2.nim |
15:12:18 | giaco_ | ok |
15:12:32 | giaco_ | thanks, didn't know it was a wrapped object |
15:13:05 | FromDiscord | <Yardanico> in old runtime (refc) it's a bit different |
15:13:52 | FromDiscord | <Yardanico> it's a reference (pointer) to len: int, capacity: int, data |
15:14:09 | FromDiscord | <Yardanico> so with new runtime to access a seq's length you have to do 0 pointer indirections |
15:16:43 | FromDiscord | <Yardanico> you can easily check the diff between old runtime and new runtime - on x86_64 `sizeof` of a seq with refc is 8 (pointer size), with arc/orc - 16 (len and a pointer) |
15:17:35 | FromDiscord | <Gary M> that's cool |
15:18:23 | FromDiscord | <Clyybber> In reply to @Gary M "the only trouble I've": how so? You can't take the addr of the first elem anyways if they are empty |
15:18:42 | FromDiscord | <Gary M> I forget the exact instance, but I needed to newSeq it |
15:18:50 | FromDiscord | <Yardanico> newSeq with size maybe? |
15:19:03 | FromDiscord | <Yardanico> if it's the C side that fills the data then you don't need to initialize it |
15:19:14 | FromDiscord | <Yardanico> usually |
15:19:20 | FromDiscord | <Gary M> it was nim friendly code, but on execution it was attempt to read from nil or something like that |
15:19:25 | FromDiscord | <Clyybber> yeah but that's not related to uninit seqs are empty |
15:19:26 | FromDiscord | <Gary M> wish I could remember what it was |
15:19:30 | giaco_ | so now newSeq returns a struct and not a pointer? |
15:19:51 | FromDiscord | <Clyybber> because uninit vs empty can't matter for accessing the first elem |
15:19:56 | FromDiscord | <Clyybber> or the addr of the first elem |
15:19:57 | FromDiscord | <Yardanico> with arc/orc yes @giaco_, but that's all an internal detail anyway |
15:20:02 | FromDiscord | <Rika> it returns whatever a seq is defined as internally |
15:20:03 | FromDiscord | <Yardanico> seq is a seq :) |
15:20:39 | FromDiscord | <Gary M> all I know is whatever it was I was doing really didn't like the uninit seq |
15:20:47 | FromDiscord | <Gary M> big shrug |
15:21:56 | FromDiscord | <Rika> shurg |
15:22:09 | FromDiscord | <Clyybber> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:22:21 | FromDiscord | <Clyybber> oh wow you can chain them |
15:22:27 | FromDiscord | <Clyybber> /shrug ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:22:34 | FromDiscord | <Clyybber> huh |
15:22:44 | FromDiscord | <Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:22:45 | FromDiscord | <Clyybber> /shrug ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:22:54 | FromDiscord | <Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:22:57 | FromDiscord | <Yardanico> can't do more than 2 |
15:23:00 | FromDiscord | <Clyybber> yeah |
15:23:03 | FromDiscord | <Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯ |
15:23:51 | FromDiscord | <Rika> thats strange |
15:24:14 | giaco_ | I think I need an antispam for irc. My client is filled with private spam messages |
15:24:17 | FromDiscord | <Clyybber> it kinda makes sense |
15:24:33 | FromDiscord | <Clyybber> giaco_: oh, the spammers were us in this case |
15:24:43 | FromDiscord | <Clyybber> if you mean the emojis |
15:24:58 | FromDiscord | <Clyybber> (edit) "emojis" => "emojis/shrugs" |
15:25:50 | giaco_ | no no, I'm receiving private messages from one-shot users that dump strange phrases and disconnects |
15:25:56 | FromDiscord | <Clyybber> oh |
15:26:42 | FromDiscord | <Gary M> how do I make a proc get a lent openArray? |
15:26:55 | FromDiscord | <Gary M> or should I just not worry about doing that lol |
15:27:28 | FromDiscord | <Rika> if you're not trying to optimize dont worry about it i think |
15:28:07 | FromDiscord | <Clyybber> yeah, better not worry about that yet |
15:28:21 | FromDiscord | <Clyybber> openArray's are views anyways, so lent openArray is another layer |
15:28:50 | FromDiscord | <Clyybber> the design for lent/view types isn't quite finished yet, so maybe lent openArray will be a thing |
15:29:28 | * | Q-Master joined #nim |
15:30:43 | * | kenran joined #nim |
15:35:55 | * | xet7 joined #nim |
15:40:36 | * | waleee-cl joined #nim |
15:44:51 | FromDiscord | <Yardanico> random nim programming (not really interesting), doing some sciter things too - twitch.tv/yardanico or Music channel in Discord |
15:45:20 | FromDiscord | <Yardanico> General |
15:51:53 | FromDiscord | <Goel> Question out of Nowhere: Who was the genious who first created a way to generate random number in a programming language? And how did he implemented it? I mean i was thinking about this a few days ago, and if there is and there will always be something that a computer will fail at, will be to generate anything thats close to our concept of "random" |
15:52:45 | FromDiscord | <Goel> (edit) "Question out of Nowhere: Who was the genious who first created a way to generate random number in a programming language? And how did he implemented it? I mean i was thinking about this a few days ago, and if there is and there will always be something that a computer will fail at, will be to generate anything thats close to our concept of "random" ... " added "I mean without external inputs to base off its -random-calculations, |
15:57:40 | FromDiscord | <Rika> john von neumann wikipedia says, https://en.wikipedia.org/wiki/Middle-square_method |
16:00:02 | * | headache quit (Quit: Idle for 30+ days) |
16:00:09 | leorize[m] | randomness can be expressed pretty well in math and statistics, so you really just need to met those criteria to be random |
16:02:19 | * | xet7 quit (Quit: Leaving) |
16:04:37 | FromDiscord | <Goel> I just don't understand how. Random means it not soemthing defined, and every piece of code was written by someone with the knowledge of what "random" means for us. But for the simpliest elaborator, i don't think that random really mean anything. It will never be able to "generate" something out of nowhere |
16:05:13 | * | drdee joined #nim |
16:05:19 | FromDiscord | <Yardanico> @Goel that's why it's called "pseudorandom" |
16:06:05 | FromDiscord | <Goel> I suppose so. So we call it "random" but in fact there will never be anything close to our / humans definition of random. If i'm correct. Not even in future |
16:06:42 | FromDiscord | <Yardanico> you can get true random by observing the nature |
16:06:56 | FromDiscord | <Yardanico> https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/ |
16:07:04 | FromDiscord | <Yardanico> for example |
16:07:30 | FromDiscord | <Rika> i also asked a few days (or weeks? idk) ago if we could extract randomness from camera noise |
16:07:53 | leorize[m] | camera noise is not that random |
16:08:16 | FromDiscord | <Rika> is it not? |
16:08:17 | FromDiscord | <Rika> hm |
16:09:13 | FromDiscord | <Goel> To me even that example Yardanico is still something that hide very well the concept of random under the word "extrely hard if not impossible to find out with our current technology" |
16:09:26 | FromDiscord | <Goel> (edit) ""extrely" => ""extremly" |
16:10:57 | leorize[m] | frankly, random as we conceptualize it doesn't exist, except maybe at quantum levels |
16:12:05 | FromDiscord | <Goel> I understand, thanks |
16:13:14 | leorize[m] | @Rika I might be wrong, actually |
16:13:19 | FromDiscord | <Gary M> Isn't there a "true" random based on Geiger counter readings or whatever |
16:14:05 | FromDiscord | <Rika> well yes but the question was about functions that dont take external environment data |
16:14:17 | FromDiscord | <Clyybber> all of our computations are random; because if we are unlucky a bit might get flipped :p |
16:14:22 | FromDiscord | <Rika> lol |
16:15:39 | FromDiscord | <Gary M> Yeah I don't think there's a way to get actual true random out of a function. You give the function the same inputs, it will give the same outputs. |
16:15:49 | FromDiscord | <Gary M> Give it the same seed, get the same result :P |
16:16:19 | FromDiscord | <Gary M> Now you can make that really hard to spoof by basing it on hardware and clock shit |
16:16:30 | FromDiscord | <Gary M> But then I guess for some people skilled enough that's still easy lol |
16:16:32 | FromDiscord | <Clyybber> the OS might use voltage fluctuations of your hardware ports |
16:17:13 | FromDiscord | <Gary M> For the case of video games though: who really cares? |
16:17:16 | FromDiscord | <Clyybber> but if you don't believe in locality, then not even quantum mechanics can get you randomness |
16:17:31 | FromDiscord | <Clyybber> In reply to @Gary M "For the case of": nobody, in video games I think fair random generators are far better |
16:17:46 | FromDiscord | <Gary M> If you make it too hard to calculate you're just going to bottleneck your shit because you want it to be more random |
16:17:59 | FromDiscord | <Clyybber> true randomness sucks for games |
16:18:15 | FromDiscord | <gollark> CPUs have onboard random number generators using thermal noise or something now. |
16:18:20 | FromDiscord | <Clyybber> yeah |
16:18:31 | FromDiscord | <gollark> And OSes have rather a lot of sources of unpredictable data which is aggregated into "random" values. |
16:18:40 | FromDiscord | <Gary M> Well you wouldn't want easily reproducible prng exploits in a multiplayer game |
16:18:47 | FromDiscord | <Gary M> But other than that it's not an issue |
16:19:29 | FromDiscord | <Clyybber> depends on what you consider a prng exploit |
16:19:48 | FromDiscord | <Gary M> However any networked game that actually cares about exploits is going to use an authoritative server |
16:20:02 | FromDiscord | <Gary M> So then all prng that matters goes through the server not the client |
16:20:37 | FromDiscord | <Gary M> At which point it would be extremely difficult if not nigh impossible to reproduce a prng glitch with several people getting the next rng |
16:21:09 | FromDiscord | <Gary M> What I would consider a prng exploit is like exploiting monster loot or chest drop tables |
16:21:31 | FromDiscord | <Clyybber> if your random generator for your game is `if bag.notEmpty: bag.pop else: bag.populate; bag.pop` that is exploitable, but if you prevent exploiting that, then you also prevent a poor player with bad luck from being rewarded for retrying |
16:21:34 | FromDiscord | <Gary M> If you can make it consistently give you that 1% chance item, you have a major unintended advantage |
16:22:23 | FromDiscord | <Gary M> I mean for single player it doesn't matter at all |
16:22:35 | FromDiscord | <Gary M> Exploits are pretty cool even, usually. |
16:22:42 | FromDiscord | <Gary M> It makes for interesting speedruns |
16:23:00 | FromDiscord | <Gary M> But for a multiplayer game like an mmo or a moba you would want exploits |
16:23:05 | FromDiscord | <Gary M> Wouldn't |
16:23:54 | FromDiscord | <Clyybber> but you wouldn't want true randomness either |
16:24:03 | FromDiscord | <Gary M> And if you have several other people adding the randomness of human input to your prng, that's at least one step against exploitation |
16:24:23 | FromDiscord | <Clyybber> or maybe you do want true randomness in a MMO; after all randomness makes people go insane |
16:24:29 | FromDiscord | <Gary M> Yeah no I mean honestly a lot of rng in games is weighted |
16:24:38 | FromDiscord | <Gary M> But that wouldn't be right in multiplayer |
16:24:47 | FromDiscord | <Clyybber> oh, I don't mean weighted or not |
16:24:50 | FromDiscord | <Gary M> People would figure out the formulas are off and bitch |
16:25:14 | FromDiscord | <dom96> I had to write my own RNG to ensure its synced between the client and server |
16:25:15 | FromDiscord | <dom96> that was fun |
16:25:17 | FromDiscord | <Clyybber> I mean rng with rules such as "after 50 tries you are guaranteed to get a 100" |
16:25:27 | FromDiscord | <dom96> IIRC I just copied Doom 😄 |
16:25:31 | FromDiscord | <Gary M> Well in a way that's weighted |
16:25:38 | FromDiscord | <Gary M> Just what, weighted distribution? |
16:25:43 | FromDiscord | <Clyybber> @dom96 oh you did? You could just have used stdlib's random and synced the seeds/states I think |
16:25:49 | FromDiscord | <Gary M> It's the vending machine method lol |
16:25:52 | FromDiscord | <Clyybber> yeah |
16:25:56 | FromDiscord | <Gary M> I mean claw machine |
16:25:58 | FromDiscord | <Gary M> Whatever |
16:26:02 | FromDiscord | <dom96> @Clyybber it wouldn't sync on the JS backend |
16:26:11 | FromDiscord | <dom96> because it uses the JS random IIRC |
16:26:17 | FromDiscord | <Clyybber> oh, it does? |
16:26:46 | FromDiscord | <dom96> or there was some other reason it wasn't syncing |
16:26:49 | FromDiscord | <dom96> but I definitely tried it first |
16:26:50 | FromDiscord | <Clyybber> oh I don't think it does |
16:27:00 | FromDiscord | <Clyybber> I think the reason is that js is 32bit |
16:27:04 | FromDiscord | <Gary M> In fire emblem when a to-hit chance is over or under a certain threshold it basically clamps pretty hard towards the extreme (0% or 100%) |
16:27:19 | FromDiscord | <Gary M> But it doesn't tell the player that, it shows the unweighted like 85% |
16:27:21 | FromDiscord | <Clyybber> In reply to @Clyybber "I think the reason": as in, the random generator uses different constants |
16:27:33 | FromDiscord | <dom96> yeah |
16:27:41 | FromDiscord | <Clyybber> In reply to @Gary M "In fire emblem when": ah, that's neat |
16:27:52 | FromDiscord | <Gary M> Yeah, it's a big S curve |
16:28:04 | FromDiscord | <Gary M> Because people are bad at judgement lol |
16:28:17 | FromDiscord | <Gary M> They expect something that is 95% to be 100% |
16:28:36 | FromDiscord | <Gary M> How could the 5% ever possibly trigger!? On me!? Such bullshit! |
16:28:40 | FromDiscord | <Clyybber> I mean, it's probably best in a tactic based game like that |
16:28:49 | FromDiscord | <Clyybber> gotta make it more predictable |
16:28:55 | FromDiscord | <รєคɭ๓๏שє> it's ready!! https://github.com/sealmove/binarylang/blob/main/tests/testsuite.nim#L348 @giaco |
16:28:57 | FromDiscord | <Gary M> Yep but then there's Xcom |
16:29:02 | FromDiscord | <Gary M> Pretty sure they don't do that |
16:29:06 | FromDiscord | <Clyybber> yeah they don't |
16:29:16 | FromDiscord | <Gary M> And it's known for being very unforgiving lol |
16:30:26 | FromDiscord | <Gary M> But yeah if you do the guaranteed nice drop after 100 shitty ones you have a cool static rewards/time |
16:31:19 | FromDiscord | <Gary M> I remember when somebody figured out the Clash Royale chest unlock prng and could give you a 100% accurate list of your next chests |
16:32:33 | FromDiscord | <Clyybber> huh |
16:32:34 | FromDiscord | <Gary M> Which means they did have a static delivery of the nice chests rather than it being actually random. |
16:32:39 | FromDiscord | <Clyybber> that's nice |
16:34:05 | * | drdee quit (Quit: Leaving) |
16:34:51 | FromDiscord | <Gary M> What's the preferred method of outputting Nim's raw C files for use in something like cmake? |
16:35:33 | FromDiscord | <Clyybber> maybe using --nimcache |
16:48:04 | * | sixtyten joined #nim |
17:00:05 | ForumUpdaterBot | New thread by Vitreo12: Using typedesc in function arguments, see https://forum.nim-lang.org/t/7625 |
17:00:54 | FromDiscord | <Yardanico> i wonder if it's safe to pass a nim int to a C function that expects an pointer int32? |
17:01:09 | FromDiscord | <Yardanico> i guess not 🤔 |
17:03:07 | * | wasted_youth2 quit (Quit: Leaving) |
17:08:36 | FromDiscord | <Clyybber> @Yardanico int is the size of a pointer, so it's safe |
17:09:07 | FromDiscord | <Yardanico> no I mean the C function has an argument `ptr int32` so that it can assign a value to my own int |
17:09:16 | FromDiscord | <Yardanico> will it work if I have a `var a: int` and pass `addr a` |
17:09:24 | FromDiscord | <Yardanico> because nim int is 64-bit on a 64-bit platform |
17:13:20 | leorize[m] | on LE architecture, it probably will |
17:17:18 | * | azed joined #nim |
17:23:23 | FromDiscord | <ajusa> In reply to @รєคɭ๓๏שє "it's ready!! https://github.com/sealmove/binarylang": Is this like an alternative to Katai or PMunch's binary parse? |
17:23:59 | FromDiscord | <Yardanico> this seems to be a fork of PMunch's binaryparse |
17:24:03 | FromDiscord | <รєคɭ๓๏שє> yeah, I started by modifying PMunch's binaryparse, but it turned into a completely new and bigger project |
17:24:24 | FromDiscord | <รєคɭ๓๏שє> it's a complete rewrite, keeping the basic idea same |
17:25:50 | FromDiscord | <ajusa> That seems super cool! I've been looking into a few projects like this. There are a few custom protocols/file formats I wanted to interface with, I assume that this means I can basically "declare" the format and have everything get parsed using the DSL into Nim type? |
17:26:44 | FromDiscord | <รєคɭ๓๏שє> yup, you get data parsed into tuples or (just today) in object variants |
17:26:57 | FromDiscord | <รєคɭ๓๏שє> and serialization works too |
17:32:15 | FromDiscord | <รєคɭ๓๏שє> I really hope more people will use it. Not to brag, but I think it's the very best tool in this area ^^ |
17:32:58 | FromDiscord | <รєคɭ๓๏שє> Nim opens tons of new possibilities, so I think it surpasses Python's construct library, who is the strongest competitor |
17:33:22 | FromDiscord | <รєคɭ๓๏שє> Kaitai Struct has its own problems as an external DSL |
17:33:31 | FromDiscord | <รєคɭ๓๏שє> But the IDE is really strong |
17:33:36 | federico3 | giaco_: look at the freenode announce: [global notice] Due to today's high wave of spam, you might want to set yourself +R to block PMs from unidentified users. In many clients this is "/mode YourNickHere +R" and we've enabled this as a default mode for the duration. |
17:33:53 | FromDiscord | <รєคɭ๓๏שє> I plan to write a Kaitai Struct backend which translates specs to BinaryLang |
17:34:04 | giaco_ | hi sealmove! |
17:34:08 | giaco_ | federico3: thanks |
17:34:12 | FromDiscord | <รєคɭ๓๏שє> hey! |
17:36:38 | FromDiscord | <รєคɭ๓๏שє> checkout the new macro `createVariantParser` ;) |
17:37:15 | giaco_ | sealmove yeah I was waiting for that! I saw readme coming before code and I've been puzzled for a while |
17:37:28 | FromDiscord | <รєคɭ๓๏שє> sorry for that :3 |
17:37:34 | giaco_ | np haha |
17:39:30 | federico3 | @Goel don't confuse PRNG with "true" randomness with cryptographic randomness and CSPRNG, they are all very different things. For cryptography most hacks involving lava lams, CCD noise and similar are not suitable |
17:40:23 | FromDiscord | <รєคɭ๓๏שє> @giaco btw there are some details regarding the exportation of the fields, which I haven't documented yet |
17:41:10 | Yardanico | @Yardanico test ping |
17:41:14 | FromDiscord | <Yardanico> huh |
17:41:28 | FromDiscord | <รєคɭ๓๏שє> `createParser` uses tuples which are value types, but `createVariantParser` uses object variants, so one must consider if fields are exported or not. |
17:41:40 | * | FromDiscord quit (Remote host closed the connection) |
17:41:52 | * | FromDiscord joined #nim |
17:41:57 | Yardanico | restarted ircord |
17:42:01 | Yardanico | @Yardanico asd |
17:42:35 | giaco_ | yeah reading docs into code |
17:44:36 | giaco_ | wow if I got it correcly it can cover a lot of new cases! |
17:45:17 | FromDiscord | <รєคɭ๓๏שє> yeah :) I think I got the design right. It models closely Nim's object variants |
17:48:04 | FromDiscord | <ajusa> Is there any way to change endianess for just a single field? |
17:48:20 | * | xet7 joined #nim |
17:48:23 | FromDiscord | <รєคɭ๓๏שє> btw @giaco, if you want to collaborate, you can always upload your parsers to: https://github.com/sealmove/n4n6 |
17:48:48 | FromDiscord | <รєคɭ๓๏שє> In reply to @ajusa "Is there any way": sure, just add `l` or `b`, for example `lu32` instead of `u32` |
17:50:01 | FromDiscord | <ajusa> Ah, now I understand the readme. I thought that was for the entire createParser call, not for a specific field. |
17:50:32 | FromDiscord | <รєคɭ๓๏שє> you can pass options to createParser for setting a default endianness |
17:51:27 | FromDiscord | <รєคɭ๓๏שє> this default can be overwritten by each field |
17:51:55 | FromDiscord | <รєคɭ๓๏שє> the default default (:P) is bigEndian |
17:56:13 | FromDiscord | <ajusa> Sorry for all the questions, but how would I read a string that is prefixed with it's size? Minecraft uses this for example |
17:56:41 | saem | BTW, @clyybber I'm upto no good again. :D |
17:56:53 | FromDiscord | <ajusa> (edit) "it's" => "its" |
17:56:59 | FromDiscord | <Clyybber> hehe |
18:00:28 | FromDiscord | <ajusa> Hm, looks like strings need to be null terminated, so I think I would need to write some custom code for strings to be prefixed by length? @รєคɭ๓๏שє |
18:05:27 | * | wasted_youth2 joined #nim |
18:05:38 | FromDiscord | <Yardanico> I forgot if there's a way to have some common code for runnableExamples in a module? There's no such thing right? |
18:05:51 | FromDiscord | <Yardanico> then I guess I'll have to resort to runnableExamples("-r:off") |
18:09:06 | * | aenesidemus joined #nim |
18:13:14 | FromDiscord | <Livingstone> Hi, I'm trying to use the reshape function from python however when I use the line X = X.reshape(X.len,1), it gives me an error of type mismatch but expected varargs. do I need to type the reshape function or do I have to do something about the array? |
18:13:28 | FromDiscord | <Yardanico> can you show more code? |
18:14:52 | FromDiscord | <Livingstone> Var X, y: array[data.len, float] |
18:15:09 | FromDiscord | <Livingstone> for i, a in data: |
18:15:19 | FromDiscord | <Yardanico> you can paste all the code in a single message |
18:15:29 | FromDiscord | <Yardanico> also, you can't reshape arrays as they have fixed length |
18:15:31 | FromDiscord | <Livingstone> I'm doing this across virtual box lol |
18:15:34 | FromDiscord | <Yardanico> why? |
18:15:51 | FromDiscord | <Livingstone> coz my computer is windows and ubuntu helps me code better |
18:16:09 | FromDiscord | <Yardanico> you can install discord on both windows and/or ubuntu |
18:17:27 | FromDiscord | <exelotl> federico3: what's the difference between cryptographic randomness and CSPRNG ? |
18:17:40 | FromDiscord | <Livingstone> I'm installing it now |
18:19:20 | giaco_ | "echo 9.0 0.2228" prints 9.222799999999999, but in c "printf("%f",9.0 + 0.2228)) prints correctly 9.222800 |
18:19:33 | giaco_ | I mean "echo 9.0 + 0.2228" |
18:21:01 | FromDiscord | <zidsal> has anyone got testament running on windows? when I run it it complains that it cannot find megatest.exe where can I get this program as it wasn't included in the nim download |
18:21:39 | leorize[m] | megatest is an automated feature of testament |
18:22:21 | leorize[m] | it will merge tests together into a "megatest" for faster build time |
18:23:39 | FromDiscord | <Livingstone> sent a long message, see http://ix.io/2SQ2 |
18:23:42 | FromDiscord | <Livingstone> boom there it is |
18:23:49 | FromDiscord | <Yardanico> and where does reshape come from? |
18:24:12 | FromDiscord | <Livingstone> np = pyImport("numpy") |
18:24:51 | FromDiscord | <รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SQ3 |
18:24:53 | FromDiscord | <zidsal> @leorize thanks, my test nim.cfg had an outdir for the exe which testament did not like. I am presuming there is no way to notify testament about the new outdir |
18:24:57 | federico3 | @exelotl the CSPRNG is only the algorithm; in itself it's deterministic and that's ok. But you need to seed it from another source and that one needs to be high quality entropy |
18:25:02 | FromDiscord | <Yardanico> also @Livingstone I hope you know that if you only use numpy for your code with nimpy (for almost all operations), then it'll actually be slower than using python directly |
18:25:26 | FromDiscord | <Livingstone> ok |
18:26:40 | FromDiscord | <Livingstone> what should I do instead? |
18:26:44 | * | aenesidemus quit (Quit: Leaving) |
18:26:51 | FromDiscord | <Livingstone> or what do you suggest I do? |
18:27:42 | FromDiscord | <Livingstone> I'll still use numpy for matplot lib but I'll do the calculations in nim then |
18:28:19 | FromDiscord | <Yardanico> wdym "what should I do instead"? I just meant that if you're writing numpy code then it won't magically get faster with Nim |
18:28:34 | FromDiscord | <Yardanico> it makes sense to use Nim if numpy is only a part of your calculations |
18:28:46 | FromDiscord | <Livingstone> well I want to use nim to do this, and you make a valid point about relying on python to do it |
18:28:59 | FromDiscord | <Yardanico> anyway, your code is wrong because you have to use np arrays there, not nim arrays |
18:29:07 | FromDiscord | <Yardanico> i'll try to fix it |
18:29:08 | FromDiscord | <Livingstone> ok |
18:29:12 | FromDiscord | <Livingstone> nah don't fix it |
18:29:19 | FromDiscord | <Livingstone> I wan't to do it myself |
18:29:50 | FromDiscord | <Yardanico> well if you're asking people to help then they'll help :P |
18:30:31 | FromDiscord | <Livingstone> where should I look for the function that python uses to do reshape? |
18:31:15 | FromDiscord | <Livingstone> I'm just left university so I don't know much about the wider world of coding |
18:31:22 | FromDiscord | <Livingstone> I can code a calculator but not much else |
18:32:17 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQ7 |
18:33:59 | FromDiscord | <Livingstone> I don't want to rely on python if it's just going to not make it matter if I do it nim |
18:34:03 | * | rockcavera quit (Remote host closed the connection) |
18:34:07 | FromDiscord | <Livingstone> guess I'll have to try something else |
18:34:21 | FromDiscord | <Yardanico> then check e.g. https://github.com/mratsim/Arraymancer |
18:34:28 | FromDiscord | <Livingstone> thanks for telling me |
18:35:07 | FromDiscord | <Yardanico> the thing with numpy is that even if it's a python module, it's mostly written in hand-optimized C |
18:35:11 | FromDiscord | <Yardanico> not in Python |
18:36:28 | FromDiscord | <Livingstone> I got a solution for this but honestly I just wanted to cheat |
18:36:36 | FromDiscord | <Livingstone> and take the easy way out |
18:36:55 | FromDiscord | <รєคɭ๓๏שє> @ajusa I'll add an example of parsing Pascal strings in README.md tomorrow. There are a lot of examples that need to get documented. Also README.md is getting quite long, so I am thinking I should create a website or something. |
18:37:07 | FromDiscord | <รєคɭ๓๏שє> (edit) "@ajusa ... I'll" added "" |
18:37:52 | FromDiscord | <Yardanico> @Livingstone out of curiosity, but "left university" you meant "finished"? |
18:38:01 | FromDiscord | <Livingstone> yah |
18:38:04 | FromDiscord | <ajusa> In reply to @รєคɭ๓๏שє "<@102899813149855744> I'll add": Sounds good. I think that a readme should mostly include quick, examples, and the rest should be a normal nim documentation page. |
18:38:13 | FromDiscord | <ajusa> (edit) "quick," => "quick" |
18:38:55 | FromDiscord | <รєคɭ๓๏שє> Yeah, this got out of hand 😅 Will fix the situation soon |
18:39:58 | FromDiscord | <ajusa> In reply to @รєคɭ๓๏שє "Yeah, this got out": The more I look at this though the more impressed I am. This'll save me literally hours for one of the projects I've wanted to work on, fantastic job you've done. |
18:40:47 | FromDiscord | <รєคɭ๓๏שє> Thank you so much :) I am glad a few people appreciate it. |
18:41:14 | FromDiscord | <รєคɭ๓๏שє> Btw you can look into my n4n6 repo for examples |
18:41:28 | FromDiscord | <รєคɭ๓๏שє> There is a PE parser there for example |
18:42:48 | FromDiscord | <รєคɭ๓๏שє> Hopefully giaco will share some of his parsers and we can grow a collection there ;) |
18:43:49 | FromDiscord | <ajusa> Yup, I was just looking at that. I'll open a github issue if I ever run into questions/need feedback on the best way of parsing something using it 😄 |
18:44:18 | * | rockcavera joined #nim |
18:44:33 | FromDiscord | <รєคɭ๓๏שє> Great, this would be nice. It will help me document examples |
18:44:52 | * | azed quit (Ping timeout: 256 seconds) |
18:52:07 | FromDiscord | <zidsal> if I call a macro inside a block that generates types that are public it fails e.g. https://play.nim-lang.org/#ix=2SQd obviously this is to be expected as blocks are scoped. But unfortunately this doesn't play very nicely with writing more then 1 macro test inside a single test fail. How do people get round this, should I just pass a param to my macro to decide on if the types should be exported or not? |
18:53:36 | FromDiscord | <รєคɭ๓๏שє> The obvious answer is "use testament" :ρ |
18:54:24 | FromDiscord | <รєคɭ๓๏שє> Recently it got proper documentation |
18:54:36 | FromDiscord | <zidsal> ah seal I am one step ahead of you! and I started writing a test with testament which is how I realised this is to do with blocks rather then the unitest library |
18:55:30 | FromDiscord | <zidsal> I guess I could write a individual testfile for each macro but that feels a bit sucky, also is that going to play nicely when megatest comes along and merges it all into 1 file? |
18:56:08 | * | leorize quit (Quit: WeeChat 3.0) |
18:56:24 | FromDiscord | <รєคɭ๓๏שє> Ah ok 😅 Can't help you then. You probably know more about it at this point. |
18:58:59 | FromDiscord | <zidsal> I am actually a bit puzzled because I took a look at your test sealmove https://github.com/sealmove/binarylang/blob/main/tests/testsuite.nim#L348 and it looks like you're generating exported types without getting failures which really puzzles me |
19:00:33 | FromDiscord | <zidsal> apologies in advance if I just Schroedinbug your project |
19:02:33 | FromDiscord | <รєคɭ๓๏שє> But is it in a block? I generate them at the top level |
19:03:32 | FromDiscord | <zidsal> unless I am misunderstanding you're code at line 354 you call createParser in a block as its inside a suite |
19:03:41 | FromDiscord | <zidsal> (edit) "you're" => "your" |
19:07:53 | * | livcd is now known as pauwel_kwak |
19:09:53 | FromDiscord | <รєคɭ๓๏שє> But |
19:10:15 | FromDiscord | <รєคɭ๓๏שє> When the macros are expanded there is no block left |
19:10:30 | FromDiscord | <รєคɭ๓๏שє> Unittest is also a macro |
19:11:03 | FromDiscord | <รєคɭ๓๏שє> I mean unittests's `suite` macro |
19:11:43 | * | xioren joined #nim |
19:11:57 | FromDiscord | <รєคɭ๓๏שє> Also createParser doesn't produce a type. createVariantParser does though. |
19:20:44 | xioren | I have been digging around trying to understand https://github.com/nim-lang/Nim/issues/17345 and had a rough theory if i can bounce it off someone to see if im way off base or not? |
19:22:23 | FromDiscord | <Livingstone> Ok here I got a question I'm getting an error of expected int but I'm doing calculations in terms of floats |
19:22:28 | FromDiscord | <Livingstone> sent a long message, see http://ix.io/2SQt |
19:24:22 | FromDiscord | <Yardanico> you need to declare mean_error as a new variable, and ^ needs a math import |
19:24:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQu |
19:24:39 | FromDiscord | <Yardanico> also you don't need conversions to float here |
19:25:24 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQv |
19:25:59 | FromDiscord | <Livingstone> thanks |
19:28:46 | FromDiscord | <Goel> Yardanico i need your help again with Raylib C / to Nim |
19:29:08 | FromDiscord | <Yardanico> well, it's better to describe the issue right away :) |
19:30:13 | FromDiscord | <Goel> sent a long message, see http://ix.io/2SQx |
19:30:24 | FromDiscord | <Goel> (edit) "http://ix.io/2SQx" => "http://ix.io/2SQy" |
19:31:05 | FromDiscord | <Yardanico> it's `true` not `True` |
19:31:06 | FromDiscord | <Goel> (edit) "http://ix.io/2SQy" => "http://ix.io/2SQz" |
19:31:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQA |
19:32:47 | FromDiscord | <Goel> Oh wow, yes this way smarter and shorter code, i'll use it |
19:44:50 | FromDiscord | <Livingstone> How do you initialize an empty sequence? |
19:45:48 | FromDiscord | <Solitude> `var s: seq[int]`↵badabing |
19:46:13 | FromDiscord | <Livingstone> ah ok I feel stupid |
19:46:24 | FromDiscord | <Solitude> https://media.discordapp.net/attachments/371759389889003532/820744692643397702/unknown.png |
19:46:28 | FromDiscord | <Solitude> wrong one |
19:46:32 | FromDiscord | <Solitude> https://nim-lang.org/docs/tut1.html |
19:49:44 | xioren | Does a queue ever shrink back down after expandIfNeeded() gets called on it? What happens if expandIfNeeded() keeps getting called? Wouldn't the queue size ballon up? |
19:50:25 | xioren | balloon* |
19:51:31 | * | haxscramper quit (Remote host closed the connection) |
19:51:44 | ForumUpdaterBot | New post on r/nim by David-Kunz: Learning Nim: Web Server with Jester and Norm [video], see https://reddit.com/r/nim/comments/m52n9x/learning_nim_web_server_with_jester_and_norm_video/ |
19:51:57 | * | haxscramper joined #nim |
19:54:47 | ForumUpdaterBot | New thread by DavidKunz: Learning Nim: Web Server with Jester and Norm [video], see https://forum.nim-lang.org/t/7626 |
19:58:48 | * | haxscramper quit (Remote host closed the connection) |
20:04:00 | * | tiorock joined #nim |
20:04:00 | * | tiorock quit (Changing host) |
20:04:00 | * | tiorock joined #nim |
20:04:01 | * | rockcavera quit (Killed (tepper.freenode.net (Nickname regained by services))) |
20:04:01 | * | tiorock is now known as rockcavera |
20:04:31 | FromDiscord | <DarkArctic> hey i was wondering if i could get some help. i'm trying to make a helper function that invokes a bunch of procs, but i get some type mismatch error. am i doing something wrong with how i'm using varargs↵↵https://play.nim-lang.org/#ix=2SQK |
20:05:31 | FromDiscord | <Yardanico> The problem is in the closure vs nimcall difference: |
20:05:35 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/uBK |
20:05:43 | FromDiscord | <Yardanico> This will work fine if you're sure that your callbacks wouldn't capture anything |
20:07:02 | FromDiscord | <Yardanico> but otherwise it seems that nim doesn't autoconvert nimcall procs to closures if they're in varargs |
20:10:00 | FromDiscord | <DarkArctic> ah okay, i think i saw some references to the calling convention. but ya, i was assuming the varargs would act the same way when i tried with just a single proc type as a parameter.↵↵would that be a compiler bug that i could report maybe? or is that something i should expect? |
20:15:08 | FromDiscord | <DarkArctic> oh, and thanks by the way 🙂 |
20:16:59 | * | azed joined #nim |
20:20:31 | FromDiscord | <dk> doesn't hurt if you report it |
20:25:02 | FromDiscord | <dom96> !eval echo(toSeq(1..5)) |
20:25:04 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: undeclared identifier: 'toSeq' |
20:25:19 | FromDiscord | <dom96> !eval import sequtils; echo(toSeq(1..5)) |
20:25:21 | NimBot | @[1, 2, 3, 4, 5] |
20:27:43 | * | allin joined #nim |
20:30:44 | allin | hi dom96 |
20:33:50 | * | xioren quit (Quit: leaving) |
20:35:00 | FromDiscord | <dom96> hi |
20:36:26 | allin | Let's not put GuildenServer and httpbeast against each other |
20:36:41 | allin | For most use cases httpbeast is ok |
20:37:19 | allin | but GuildenStern is proves that other solutions are also possible in Nim |
20:38:44 | allin | i.e. GuildenStern should be ok for the esoteric parallel problems that the OP had |
20:41:40 | reversem3 | https://play.nim-lang.org/#ix=2SR1 |
20:41:51 | reversem3 | not sure why float32 doesn't work |
20:41:56 | FromDiscord | <Yardanico> ptr float32 vs float32 |
20:42:22 | FromDiscord | <Yardanico> See https://github.com/nimgl/imgui/blob/master/tests/tnull.nim#L31 for an example on that proc |
20:43:48 | FromDiscord | <Yardanico> args are: string label, pointer to the float which will get the slider value, min float value, max float value |
20:43:58 | FromDiscord | <Yardanico> also optionally the sprintf formatting string and slider flags |
20:44:09 | reversem3 | ok thanks |
20:44:45 | allin | don't send float, send unsafeAddr of variable holding the float |
20:46:14 | reversem3 | ok so float.addr |
20:46:47 | FromDiscord | <Yardanico> yes, as in the example |
20:52:39 | allin | dom96: httpbeast is already one of the fastest CRUD (techempower-type) servers. GuildenStern should be one of the fastest websocket (Single Page Application) servers. |
20:54:18 | * | Vladar joined #nim |
20:55:32 | * | krux02_ joined #nim |
20:55:50 | * | krux02 quit (Read error: Connection reset by peer) |
20:56:18 | allin | I don't know any good websocket benchmarks. Maybe write one... |
20:56:19 | * | krux02_ is now known as krux02 |
21:04:15 | FromDiscord | <dom96> hm, I don't see a reason not to compare with benchmarks. But indeed we should always keep in mind that benchmarks can be gamed. |
21:04:57 | FromDiscord | <dom96> there is plenty of web socket benchmarks already out there, for example https://github.com/hashrocket/websocket-shootout |
21:05:03 | giaco_ | suggested trick to add version number defined in myproject.nimble into project to print it on program startup? |
21:05:46 | FromDiscord | <dom96> echo(NimbleVersion) should work, Nimble adds a `NimbleVersion` define when you compile using it |
21:07:29 | giaco_ | I'm getting "Error: undeclared identifier: 'NimbleVersion'" in "nimble run" |
21:08:06 | * | rockcavera quit (Remote host closed the connection) |
21:08:25 | FromDiscord | <dom96> oh sorry, it's `NimblePkgVersion` |
21:09:23 | giaco_ | Error: undeclared identifier: 'NimblePkgVersion' |
21:09:54 | FromDiscord | <dom96> can you run nimble with `--debug` and check what it's doing? |
21:10:10 | giaco_ | sure |
21:16:03 | allin | dom96: thanks for the link! nice to be able to inspect some competitors to Nim. |
21:20:21 | giaco_ | dom96 I actually see "nim c --colors:on --noNimblePath -d:NimblePkgVersion=0.1.0" not sure why it doesn't like to get printed |
21:21:46 | * | superbia joined #nim |
21:22:32 | allin | quite here. Here comes a quizz. What will compiler say about the next line. What should it say?... |
21:22:40 | FromDiscord | <ElegantBeef> What's the Nim version of `uint8_t const buffer` just a `ptr byte`? |
21:22:50 | allin | proc p(): int {.discardable.} = 1 ; p() |
21:23:11 | FromDiscord | <ElegantBeef> It'll live hapily |
21:23:17 | allin | no! |
21:23:33 | FromDiscord | <Yardanico> that code is not correct though |
21:23:43 | allin | ?? |
21:23:45 | FromDiscord | <Yardanico> it's parsed as proc p(): int {.discardable.} = (1; p()) |
21:23:47 | FromDiscord | <ElegantBeef> yea you need` ()` |
21:23:59 | FromDiscord | <ElegantBeef> the `;` doesnt end the proc definition |
21:24:02 | FromDiscord | <Yardanico> exactly |
21:24:03 | allin | wait... |
21:24:19 | FromDiscord | <Yardanico> proc p(): int {.discardable.} = (result = 1); p() |
21:24:19 | FromDiscord | <Yardanico> works |
21:25:32 | allin | that one the Nim community solved in 5 seconds |
21:25:51 | FromDiscord | <ElegantBeef> You'd hope people that use Nim know how it works 😛 |
21:25:58 | allin | next one is harder, but it is a two-liner: |
21:26:15 | superbia | wait a bit |
21:26:22 | allin | proc p(): int {.discardable.} |
21:26:40 | allin | {.gcsafe.}: p() |
21:26:44 | allin | hahaa?! |
21:26:52 | FromDiscord | <Yardanico> ???????????????? |
21:26:54 | FromDiscord | <ElegantBeef> Error implementation expected |
21:27:03 | FromDiscord | <Yardanico> this needs an implementation, yes |
21:27:03 | FromDiscord | <ElegantBeef> But anyway |
21:27:07 | FromDiscord | <Yardanico> @allin are you okay? |
21:27:13 | FromDiscord | <Yardanico> your questions are... strange |
21:27:23 | FromDiscord | <Yardanico> make it's better to take a break |
21:27:23 | FromDiscord | <ElegantBeef> Yard got any clue how to do that C interop? 😄 |
21:27:31 | FromDiscord | <Yardanico> of course (not) |
21:27:33 | FromDiscord | <Yardanico> give me the code |
21:27:34 | FromDiscord | <ElegantBeef> Lol |
21:27:36 | FromDiscord | <Yardanico> ah that one |
21:27:53 | FromDiscord | <ElegantBeef> I dont know C well but i though a `ptr byte` would be the same |
21:27:55 | FromDiscord | <Yardanico> I mean you can try ptr UncheckedArray[uint8] |
21:28:02 | FromDiscord | <ElegantBeef> Yea i tried but it complained |
21:28:10 | FromDiscord | <Yardanico> complained like what? |
21:28:20 | FromDiscord | <ElegantBeef> https://hatebin.com/cfndcemirs |
21:28:52 | allin | sorry, too wild, of cours first line must be: |
21:28:56 | allin | proc p(): int {.discardable.} = 1 |
21:29:10 | FromDiscord | <ElegantBeef> You know you can download the compiler and see the results right? |
21:29:29 | allin | this is a late night quizz |
21:29:41 | FromDiscord | <dk> !eval echo "dont even need to download the compiler" |
21:29:44 | NimBot | dont even need to download the compiler |
21:29:57 | FromDiscord | <ElegantBeef> I dont know what conflicting types even means in this context, i dont know if it's the parameters or telling me it's redefined |
21:30:15 | giaco_ | dom96 sorry I was missing 'const NimblePkgVersion {.strdefine.} = ""' |
21:31:39 | allin | correct answer: Error: expression ' {.gcsafe.}: p()' is of type 'int' and has to be used (or discarded) |
21:31:52 | FromDiscord | <ElegantBeef> `void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const buffer, uint16_t bufsize);` is the type signature i need to match |
21:32:05 | allin | (parsing error) |
21:32:16 | FromDiscord | <Yardanico> (that's not a parsing error but whatever) |
21:32:30 | FromDiscord | <ElegantBeef> So `byte, myWrappedType, ptr byte, uint16` is what i've got |
21:32:37 | allin | compiler error anyway |
21:33:46 | FromDiscord | <ElegantBeef> Ok so i did have it returning an uint16 which was wrong but still same error |
21:35:01 | FromDiscord | <ElegantBeef> Though the way these callbacks work are through `attribute ((weak))` so i imagine that could be an issue since Nim does functions as pointers |
21:44:02 | giaco_ | how can I share variables between nimble and its nim program? I've tried moving nimble variables to independent nim file as consts and import nim file in .nimble, but I'm getting errors |
21:46:41 | FromDiscord | <ElegantBeef> For ints, strs, and boolsyou can do https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas |
21:48:11 | allin | I guess .nimble file is not nim source code, so you cannot import anything to it. But you can staticRead a nimble file to source code. |
21:49:51 | allin | Maybe you should use a .cfg file? |
21:51:09 | giaco_ | no, I already have a -d:definition solution working, but I was trying to follow what araq was suggesting in a forum post saying that the correct solution would be both nimble and nim including same variables from single file |
21:52:05 | FromDiscord | <Yardanico> yes, you can import nim files from .nimble |
21:52:25 | allin | wwhat? |
21:52:36 | FromDiscord | <Yardanico> .nimble files are nimscript |
21:52:45 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nims.html https://nim-lang.org/docs/nimscript.html |
21:53:08 | FromDiscord | <Yardanico> you can use quite a lot of stdlib modules in nimscript even |
21:53:17 | FromDiscord | <Yardanico> (it uses the same VM that is used for compile-time code execution) |
21:53:39 | giaco_ | I've moved all variables on top of my nimble file (version, author, description, ...) to an independent .nim file as const and then I've imported it back into nimble file, but doesn't seem to like it |
21:53:51 | allin | you live, you learn... |
21:54:27 | FromDiscord | <Yardanico> @giaco_ did you export them? |
21:54:41 | giaco_ | yes |
21:54:45 | FromDiscord | <Yardanico> then it should work |
21:55:00 | FromDiscord | <Yardanico> see e.g. https://github.com/h3rald/hastyscribe/blob/master/hastyscribe.nimble |
21:55:02 | FromDiscord | <dk> try including |
21:55:06 | FromDiscord | <Yardanico> no need to include |
21:57:16 | allin | if someone puts a rmDir command into .nimble file... |
21:57:37 | FromDiscord | <Yardanico> that's no different to most packages' PMs |
21:57:48 | giaco_ | ah, ok, I have to copy the vars included with import to the variables defined in the nimble file |
21:57:48 | FromDiscord | <Yardanico> you can do the same with npm or whatever |
21:57:54 | * | kenran quit (Remote host closed the connection) |
21:58:19 | FromDiscord | <Solitude> no one stops you from putting `exec("rm -rf ~")` in static blocks |
21:58:23 | giaco_ | I was just importing the nim file that defines "version", "author", etc |
21:58:56 | FromDiscord | <Yardanico> "defines"? |
21:58:58 | FromDiscord | <Yardanico> or actual constants? |
21:59:04 | FromDiscord | <Yardanico> const myConst = "hello" |
21:59:11 | FromDiscord | <Yardanico> and then import it in a nimble file and use myConst |
22:00:55 | * | fredrikhr quit (Quit: Client Disconnecting) |
22:04:03 | * | hyiltiz quit (Quit: hyiltiz) |
22:06:24 | giaco_ | I mean, I cannot just import "version" const, I have to define myVersion in .nim file, import .nim file and then do "version = myVersion" in nimble file |
22:11:25 | * | azed quit (Quit: WeeChat 3.0.1) |
22:11:26 | giaco_ | no, I still can't succeed in that |
22:13:11 | allin | I have version number in nimble and version number on .nim and tell myself to update both at the same time |
22:13:35 | FromDiscord | <Yardanico> you can have NimplePkgVersions |
22:20:29 | giaco_ | ok solved, I was just creating a mess by naming shared file "version.nim" |
22:20:36 | giaco_ | now it works nicely |
22:22:38 | FromDiscord | <ElegantBeef> Oh god i have to interface with this https://github.com/raspberrypi/tinyusb/blob/e0aa405d19e35dbf58cf502b8106455c1a3c2a5c/src/class/hid/hid_device.h#L170-L258 |
22:24:15 | allin | naming is one of the hardest CS problems |
22:25:20 | allin | (apart from 'nim doc') |
22:26:00 | FromDiscord | <Yardanico> what about https://github.com/Yardanico/nuglifier/blob/master/example_output/example_case.nim |
22:26:08 | FromDiscord | <Yardanico> (and yes that code is compilable if you download the file directly) |
22:27:18 | FromDiscord | <Yardanico> just dont show it to nim newbies |
22:28:37 | FromDiscord | <ajusa> Can't wait to post that next time a Nim related discussion pops up and someone starts bashing the fact that snake case and camel case are equivalent, saying it isn't maintainable. |
22:29:02 | allin | I guess there's the hidden `exec("rm -rf ~")` gem, if someone tries to compile it... |
22:29:08 | FromDiscord | <Yardanico> sadly no :) |
22:29:34 | FromDiscord | <Yardanico> but you can find out for yourself, hehe |
22:29:39 | allin | Not bold enough to try... |
22:29:50 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/6497 |
22:30:08 | giaco_ | any idea on how can I store compile time into binary? if I try to import times and use "now" in nimble or nim as consts I get "Error: cannot 'importc' variable at compile time; clock_gettime" |
22:30:21 | FromDiscord | <Yardanico> there's CompileTime and CompileDate |
22:30:23 | FromDiscord | <Yardanico> in system |
22:30:29 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#CompileDate |
22:30:46 | giaco_ | that's magic! |
22:36:20 | allin | Altough APL was my very first language, I prefer readibility over terseness. |
22:37:04 | allin | For example, @ is a mistake in Nim (compared to newSeq or something) |
22:37:56 | FromDiscord | <ElegantBeef> Well then use `newSeq` 😄 |
22:38:19 | FromDiscord | <Yardanico> @allin fun fact: @ is an operator convert something to a seq |
22:38:24 | FromDiscord | <Yardanico> like a string or an array |
22:38:44 | FromDiscord | <ElegantBeef> Nim is nothing if not flexible |
22:38:52 | FromDiscord | <ElegantBeef> Thought you were going to bed yard |
22:39:11 | FromDiscord | <Yardanico> i was going to watch anime and go to bed |
22:39:15 | FromDiscord | <Yardanico> oops |
22:39:34 | FromDiscord | <Yardanico> \s/anime/historical documentaries |
22:40:20 | allin | Another mistake was to use [] for pointer deference |
22:40:49 | FromDiscord | <ElegantBeef> TudHidMouseReport |
22:40:52 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#automatic-dereferencing |
22:40:54 | FromDiscord | <Yardanico> another mistake was `***** ** * * *` |
22:40:55 | FromDiscord | <ElegantBeef> Didnt copy |
22:41:21 | FromDiscord | <ElegantBeef> You can sit here all day saying "mistakes" but i mean that's up to you and Nim is flexible enough you can "Alias" it to whatever you want |
22:43:04 | allin | Well, it's the first couple of hours with a new language that matter the most, and @[] -structure for me was the scariest syntax at the time |
22:43:11 | * | xet7 quit (Remote host closed the connection) |
22:43:25 | FromDiscord | <ElegantBeef> I disagree `@[]` isnt that scary |
22:43:29 | FromDiscord | <Solitude> matter most for who? |
22:43:30 | giaco_ | Yardanico I've just found strenc. That's a quite impressive hack |
22:43:32 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2SRS |
22:43:44 | FromDiscord | <ElegantBeef> There we go we made it more readable |
22:43:50 | FromDiscord | <Yardanico> @giaco_ the idea's not mine, I simply combined some code (you can see the links to forum threads in the source file) :P |
22:43:54 | FromDiscord | <Yardanico> also it's quite broken |
22:44:21 | FromDiscord | <Yardanico> 4 issues for 24sloc = 1 issue per 6 sloc |
22:44:39 | giaco_ | yeah I just tested it quickly and it worked on single file but failed when combined with a real project, but yet brilliant mechanism |
22:47:17 | * | Vladar quit (Quit: Leaving) |
22:50:34 | allin | Solitude: if the barrier to entry (your first emotions with the language) is too high, many souls may be lost. |
22:50:59 | allin | Nim is one of the most readable languages but then the exceptions hurt even more |
22:52:19 | allin | To be honest, I have avoided Haskell and Rust just because the code looks so unreadable... |
22:52:26 | giaco_ | just compare readability of nim with other system-level languages |
22:52:37 | giaco_ | not "every language" |
22:54:50 | allin | Well my point was/is that @ and [] operators are not up the readibility level of Nim in general |
22:55:09 | FromDiscord | <Solitude> i dont see how they are not |
22:56:03 | * | tane quit (Quit: Leaving) |
22:56:27 | FromDiscord | <ElegantBeef> You act like dereferencing is a common thing in nim |
22:56:35 | * | fputs quit (Quit: WeeChat 3.1) |
22:57:38 | allin | [] is problematic because it has multiple meanings |
22:58:29 | FromDiscord | <mratsim> `[]` is meh in macros and templates |
22:59:12 | allin | @[] does not compute for me, but I might be an exception |
22:59:44 | allin | hi mratsim |
23:01:05 | FromDiscord | <mratsim> Personally I've never used the `@` operator except in tests |
23:04:35 | allin | I see upcoming orc-friendly channel implementation based on Weave... |
23:04:38 | FromDiscord | <ElegantBeef> Yea i've rarely used it aswell |
23:05:34 | allin | Could we get a stable threapool also? |
23:06:10 | allin | (Without work stealing, that is) |
23:06:14 | FromDiscord | <ElegantBeef> What do you mean? We already have stable threadpool? |
23:06:42 | FromDiscord | <mratsim> work-stealing is really super simple. |
23:07:10 | allin | unfortunately it is unstable API |
23:07:14 | FromDiscord | <mratsim> the current Nim channels are in better state than the current threadpool :p |
23:07:47 | FromDiscord | <mratsim> the threadpool API is somewhat OK, at least spawn and `^` and Flowvar: https://github.com/nim-lang/RFCs/issues/347 |
23:08:10 | FromDiscord | <mratsim> I'll just rename `^` to sync because `^` is really bad :/ |
23:08:27 | * | hyiltiz joined #nim |
23:08:27 | * | hyiltiz quit (Changing host) |
23:08:27 | * | hyiltiz joined #nim |
23:08:34 | allin | But work-stealing AND blocking threads is the mother of all evil |
23:09:01 | FromDiscord | <mratsim> not really |
23:09:18 | FromDiscord | <mratsim> other threads can pick from the blocked queue |
23:09:21 | allin | well I'd love to see the words "unstable API" disappear from threadpool docs somehow |
23:10:36 | FromDiscord | <mratsim> also it's better to create a blocking_pool dedicated for blocking threads. |
23:11:04 | FromDiscord | <mratsim> and this one should be managed by the event loop |
23:11:06 | allin | Well then we need cooperative threads, that inform that they have sync points? |
23:11:16 | FromDiscord | <mratsim> because only IO can have blocking calls. |
23:11:45 | allin | Like in every for loop iteration... |
23:12:53 | allin | Right - we definitely could have two kinds of pools |
23:13:13 | * | hyiltiz quit (Ping timeout: 260 seconds) |
23:13:32 | allin | But implementation better be at stdlib level |
23:13:47 | * | hyiltiz joined #nim |
23:13:47 | * | hyiltiz quit (Changing host) |
23:13:47 | * | hyiltiz joined #nim |
23:14:41 | giaco_ | if I include some .nim files into .nimble it works with "build" task, but fails with "install" as it keep serching for imports after workspace moves to ~/.nimble |
23:15:08 | allin | Well every long running procedure that does not have sync points is blocking |
23:16:05 | allin | (Blocking in the sense that it stole work from other thread) |
23:16:10 | * | superbia quit (Ping timeout: 260 seconds) |
23:16:44 | ForumUpdaterBot | New post on r/nim by nuL808: Seq of procs, see https://reddit.com/r/nim/comments/m56ypt/seq_of_procs/ |
23:18:19 | allin | Concerning the channel implementation: if channel buffer is full, is it guaranteed that messages will be picked by consumers in same order that they were inserted? |
23:19:52 | allin | Or let's say one consumer, otherwise might be hard to prove in the first place... |
23:21:19 | allin | In other words: does the channel remember the order of the waiting threads |
23:25:21 | allin | If thread A sends to channel first and thread B later, the consumer should receive A before B even if channel buffer was full and threads were put to wait state... |
23:27:08 | allin | if this invariant does not hold, it must be stated in the docs... |
23:34:06 | allin | sleep time, bye |
23:35:01 | allin | quit |
23:35:30 | * | allin quit (Quit: leaving) |
23:58:04 | * | kuon joined #nim |