<< 14-03-2021 >>

00:01:00FromDiscord<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:04FromDiscord<Yardanico> with refc bugs don't always surface
00:01:10FromDiscord<Yardanico> so its better to use arc
00:01:26FromDiscord<Clyybber> nice !
00:01:33FromDiscord<Clyybber> the demand seems to be there
00:01:48FromDiscord<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:05FromDiscord<Yardanico> with refc it worked but with arc it crashed because destructors were trying to deallocate sciter's own stuff
00:02:19FromDiscord<Yardanico> (the solution is to copy the value, sciter has functions for that specifically)
00:02:33FromDiscord<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:13FromDiscord<Snippy Nippy> Hi
01:35:34FromDiscord<Snippy Nippy> Is there a code formatter in nim
01:36:05FromDiscord<Snippy Nippy> Like something similar to black in python
01:37:31Prestigeis there a way to escape curly brackets when using fmt on a string?
01:44:30*cyraxjoe joined #nim
01:50:19FromDiscord<Clyybber> Prestige: Just repeat them
01:50:27Prestigety
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:29FromDiscord<ElegantBeef> Prestige did you get around to trying nimscripter?
04:16:29FromDiscord<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:41FromDiscord<ElegantBeef> @Snippy Nippylate response aside there is nimpretty and morepretty
04:22:27FromDiscord<Snippy Nippy> Np
04:23:20FromDiscord<Snippy Nippy> Also does these tools have an integration for vscode
04:23:28FromDiscord<Snippy Nippy> Like format on save?
04:23:30Prestige@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:52PrestigeWas contemplating using IPC to compose multiple executables
04:25:39FromDiscord<ElegantBeef> It should work with format on save
04:26:50FromDiscord<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:29FromDiscord<ElegantBeef> Unless there is a way i'm missing 😄
04:27:31saemMaybe, that sounds doable
04:28:52saemLike all a config for custom formatter, maybe it could look for a named task
04:28:56FromDiscord<ElegantBeef> Honestly i think the JS version actually had it
04:29:04saemDid it?
04:29:18FromDiscord<ElegantBeef> I swear i remember a field for giving the path of nimpretty
04:29:55FromDiscord<ElegantBeef> Checking now
04:30:37FromDiscord<ElegantBeef> Nope i was wrong
04:30:42saemNow with more nim and less typescript
04:31:24saemI'm eating but you wanna take a gander at the format provider (?) File
04:31:57saemShould have the be nim pretty invocation there or as a command in vscodeext.nim
04:33:50xiorenare regular objects handled by the garbage collector too, or only ref objects?
04:34:18FromDiscord<ElegantBeef> Regular objects are stack allocated so no need for gc
04:34:35xiorenah i see, thanks
04:37:37*sz0 quit (Quit: Connection closed for inactivity)
04:38:02*vicfred joined #nim
04:38:26FromDiscord<ElegantBeef> So since you're doing `getOptionalToolPath` you could just use a string for the binary you look for
04:38:48FromDiscord<ElegantBeef> Though that gets weird since Morepretty works on the entire project
04:41:09FromDiscord<ElegantBeef> Speaking of morepretty, i just did morepretty and it started formatting the stdlib in `.choosenim` 😄
04:41:49FromDiscord<ElegantBeef> Sorry i did `morepretty -h`
04:42:53Prestige!eval echo "a" * 2
04:42:54NimBotCompile failed: /usercode/in.nim(1, 10) Error: type mismatch: got <string, int literal(2)>
04:43:17FromDiscord<ElegantBeef> Are you trying to get `"aa"` 😄
04:43:33FromDiscord<ElegantBeef> if so `strutils.repeat`
04:43:34Prestigenah I wanted to see the bot's response to an error
04:44:13FromDiscord<ElegantBeef> Good cover
04:44:41Prestigelol
04:44:53PrestigeI'm writing an irc bot that does the !eval, so I wanted to see
04:45:24Prestigethe response back from nim-playground is weird to parse when there's an error
04:53:30saemBeef, 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:32saems/bit/big
04:55:58FromDiscord<ElegantBeef> Yea i dont even think morepretty is meant to be used on a per file basis
04:56:11FromDiscord<ElegantBeef> So i guess no real value in doing it
04:56:28saemCould do a project wide command.
05:03:46*xioren quit (Quit: leaving)
05:15:40FromDiscord<Hi02Hi> In reply to @ElegantBeef "Regular objects are stack": except for objects with seqs/strings in them right?
05:16:08FromDiscord<ElegantBeef> I mean the object should still be stack allocated afaik
05:16:31FromDiscord<ElegantBeef> remember that a string/seq is just a pointer + size and capacity
05:17:36FromDiscord<Hi02Hi> true, ok
05:18:02FromDiscord<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:01FromDiscord<ElegantBeef> What's the proper way to handle `attribute ((packed))` is it just `{.packed.}`?
06:30:16FromDiscord<mratsim> yes
06:30:21FromDiscord<mratsim> @ElegantBeef
06:30:47FromDiscord<ElegantBeef> This pico sdk has a lot of weird/ugly code we get for free from Nim 😄
06:31:10FromDiscord<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:06FromDiscord<Gary M> !eval 2'u32.bool
08:02:07NimBotCompile failed: /usercode/in.nim(1, 6) Error: expression 'bool(2'u32)' is of type 'bool' and has to be used (or discarded)
08:02:16FromDiscord<Gary M> lol
08:02:28FromDiscord<Gary M> !eval echo $2'u32.bool
08:02:30NimBottrue
08:07:09FromDiscord<Araq> what's the name of the http server benchmarking tool?
08:08:17FromDiscord<Araq> 'wrk', found it
08:16:39FromDiscord<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:33FromDiscord<ElegantBeef> Oh yea it cannot find a type! 😄
09:00:09*kaputse[m] quit (Quit: Idle for 30+ days)
09:12:03ForumUpdaterBotNew 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:51FromDiscord<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:33FromDiscord<Rika> we dont have the scale for that
09:51:14FromDiscord<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:33FromDiscord<Rika> there are not a lot of people who would step up
09:52:27FromDiscord<fenrave> Nim is fairly small scale but most packages I've seen are somewhat actively maintained
09:52:38FromDiscord<fenrave> at least on a monthly basis or so
09:53:14FromDiscord<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:56FromDiscord<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:44FromDiscord<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:12FromDiscord<fenrave> that's not something most people want to spend their time on unless they rely on it
09:57:28FromDiscord<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:51FromDiscord<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:00FromDiscord<Yardanico> (to update compat to latest nim or fix issues that haven't been fixed)
10:39:32FromDiscord<Yardanico> do we care about supporting older macOS versions btw - like 10.10?
10:39:35FromDiscord<Yardanico> @flywind ^
10:40:00FromDiscord<Yardanico> a friend of mine can't compile latest nim because of the same issue as in https://bugs.python.org/issue29057
10:40:03FromDiscord<Yardanico> related to std/sysrand
10:50:19FromDiscord<Yardanico> wait actually
10:50:29FromDiscord<Yardanico> @flywind why does sysrand use different functions for ios and macosx?
10:50:37FromDiscord<Yardanico> https://developer.apple.com/documentation/security/1399291-secrandomcopybytes seems to be available on macOS 10.7+
10:50:44FromDiscord<Yardanico> so we can have the same one for macosx and ios, no?
10:51:05FromDiscord<dom96> @Yardanico create an issue, IMO we should at least track this support
10:57:31FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/17370
11:11:28*krux02 joined #nim
11:20:06FromDiscord<konsumlamm> In reply to @whisperdev "Hi all.Do we have": are you referring to anything particular?
11:20:32FromDiscord<flywind> rust way is good, but i have no idea how to fall back to other implementation in Nim
11:21:04FromDiscord<Rika> what are you talking about?
11:23:47FromDiscord<flywind> In reply to @Yardanico "(to update compat to": ^
11:24:16FromDiscord<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:22FromDiscord<flywind> one possible ugly solution https://github.com/timotheecour/Nim/issues/556
11:29:17FromDiscord<Yardanico> why not use the ios solution for macos?
11:29:25FromDiscord<Yardanico> it's supported on macos 10.7+ as the apple docs say
11:29:33FromDiscord<Yardanico> which is still not perfect though
11:31:06FromDiscord<flywind> that's OK. we need to have minimal support version I guess.
11:31:25FromDiscord<flywind> other apis has version requirement too.
11:31:33FromDiscord<Yardanico> right now nim readme says that nim supports macos 10.4 and up :P
11:32:47FromDiscord<flywind> I see, maybe make a PR.
11:34:08FromDiscord<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:54FromDiscord<Yardanico> @flywind that weak is https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unix/weak.rs#L29
11:39:19FromDiscord<Yardanico> it's weak linkage
11:39:30FromDiscord<Yardanico> https://stdrs.dev/nightly/x86_64-unknown-linux-gnu/src/std/sys/unix/weak.rs.html
11:40:09FromDiscord<flywind> i saw it, PR is welcome
11:40:43FromDiscord<Yardanico> i wonder if that's a reliable way though :P
11:41:06FromDiscord<Yardanico> and I can't find the impl of sys::weak
11:41:36FromDiscord<flywind> maybe use timothee's way, then no performance loss 😀
11:42:39FromDiscord<Yardanico> it's even less reliable imo :)
11:43:26FromDiscord<flywind> or just use c wrapper
11:43:38FromDiscord<flywind> i think this way is more reliable
11:44:17FromDiscord<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:54FromDiscord<Yardanico> the timo's way?
11:45:06FromDiscord<Yardanico> I actually think that it's less reliable because of having an additional C file
11:47:47FromDiscord<flywind> no, just import c file.
11:48:35FromDiscord<flywind> as a temporary plan, waiting for weak linkage
11:49:48FromDiscord<Yardanico> "waiting for weak linkage" won't really happen
11:49:54FromDiscord<Yardanico> because rust only has a single backend target - LLVM
11:50:04FromDiscord<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:57FromDiscord<Yardanico> ah wait actually
11:53:07FromDiscord<Yardanico> maybe that rust thing can be ported
11:53:27FromDiscord<Yardanico> it basically uses dlsym
11:57:36FromDiscord<Yardanico> yeah it should be fairly easy to replicate that in Nim, but I'm not sure if we'd want that
12:06:19FromDiscord<Yardanico> but rust does it :P
12:06:25FromDiscord<Clyybber> don't use emit for that, this should work on llvm too
12:06:34FromDiscord<Clyybber> can't we just check the macos version?
12:06:44FromDiscord<Yardanico> @Clyybber we can, but in the C stage
12:06:58FromDiscord<Gary M> How do you choose llvm for Nim?
12:07:03FromDiscord<Yardanico> nlvm exists
12:07:05FromDiscord<Yardanico> and also cc:clang
12:07:08FromDiscord<Yardanico> https://opensource.apple.com/source/xnu/xnu-4903.270.47/EXTERNAL_HEADERS/Availability.h.auto.html
12:07:11FromDiscord<Yardanico> MAC_10_12 define
12:07:11*kenran joined #nim
12:07:23FromDiscord<Clyybber> what yard said :D
12:07:31FromDiscord<Gary M> Does cc:clang allow the clang mingw target in any way?
12:09:37*Gustavo6046 joined #nim
12:11:14FromDiscord<Clyybber> I think yes
12:11:46FromDiscord<Gary M> nlvm doesn't support windows or arm yet 😄
12:12:01FromDiscord<Gary M> So that's already two of my targets unusable
12:13:00FromDiscord<Gary M> I guess I'll just stick with gcc
12:13:22*fredrikhr joined #nim
12:13:23*kenran_ joined #nim
12:14:14FromDiscord<รєคɭ๓๏שє> How to functionally add an element to a seq?
12:14:36FromDiscord<Gary M> Uh .add()?
12:14:59FromDiscord<รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SNk
12:15:04FromDiscord<Clyybber> & instead of +
12:15:14FromDiscord<รєคɭ๓๏שє> oh that works for seqs? nice
12:15:19FromDiscord<Clyybber> sure :D
12:16:14FromDiscord<Gary M> Technically it's a concat
12:17:08FromDiscord<รєคɭ๓๏שє> one element is `seq[int]` and the other an `int`
12:17:29*kenran quit (Quit: Lost terminal)
12:17:35FromDiscord<Rika> lets see if it works then
12:17:37FromDiscord<Rika> !eval echo @[3] & 3
12:17:39FromDiscord<Clyybber> works
12:17:39NimBot@[3, 3]
12:18:35FromDiscord<Gary M> Wonder if you can concat arrays on seqs
12:18:40FromDiscord<Yardanico> yes
12:18:53FromDiscord<Yardanico> !eval echo [1, 2] & @[3] & 4
12:18:54NimBotCompile failed: /usercode/in.nim(1, 13) Error: type mismatch: got <array[0..1, int], seq[int]>
12:18:59FromDiscord<Yardanico> almost
12:19:01FromDiscord<Gary M> !eval @[3] & [4,5]
12:19:03NimBotCompile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <seq[int], array[0..1, int]>
12:19:05FromDiscord<Yardanico> wasn't it defined on an openarray
12:19:10FromDiscord<Gary M> Huh.
12:19:18*livcd joined #nim
12:19:36FromDiscord<รєคɭ๓๏שє> oh well
12:19:40FromDiscord<Clyybber> I mean the first element should probably be a seq
12:19:40FromDiscord<รєคɭ๓๏שє> it could work maybe
12:19:50FromDiscord<Clyybber> since otherwise it becomes prepend instead of append
12:20:04FromDiscord<Rika> technically it doesnt matter
12:20:10FromDiscord<Gary M> Well you can still add elements with concat just fine, that's what you wanted right @รєคɭ๓๏שє
12:20:27FromDiscord<รєคɭ๓๏שє> yeah sure
12:21:04FromDiscord<Clyybber> yeah, it's only defined on seq not openarray
12:21:30FromDiscord<Clyybber> !eval 3 & @[3]
12:21:31NimBotCompile failed: /usercode/in.nim(1, 3) Error: expression '3 & @[3]' is of type 'seq[int]' and has to be used (or discarded)
12:21:41FromDiscord<Gary M> Lol
12:21:45FromDiscord<Clyybber> !eval echo 3 & @[3]
12:21:47FromDiscord<Clyybber> don't mind me
12:21:47NimBot@[3, 3]
12:21:53FromDiscord<Clyybber> hey, works
12:23:00FromDiscord<Gary M> !eval var arr = [5,6]; echo @[7,8] & @arr
12:23:02NimBot@[7, 8, 5, 6]
12:23:42FromDiscord<Gary M> Easy enough to just slap a @ on it I guess.
12:23:56FromDiscord<Rika> @@@@@@@@@@@@@@
12:24:01FromDiscord<Gary M> Anything rotten going on there like surprise allocations? Lol
12:24:18FromDiscord<Clyybber> @ allocates since array is on stack and seq on heap
12:24:23FromDiscord<Gary M> Yeah
12:24:33FromDiscord<Clyybber> but other than that. & is documented to copy
12:24:36FromDiscord<Rika> not very surprising
12:24:38FromDiscord<Clyybber> yeah
12:25:14*lritter quit (Ping timeout: 265 seconds)
12:25:23FromDiscord<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:35FromDiscord<Clyybber> and could reuse the memory
12:25:49FromDiscord<Gary M> Exactly what I was wondering.
12:26:28FromDiscord<Gary M> Also I've been experimenting very briefly with useMalloc with the new gc's
12:26:36FromDiscord<Gary M> Seems really nice
12:27:08FromDiscord<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:39FromDiscord<Gary M> Basically I did massive allocCstringArray's followed by dealloc
12:28:13FromDiscord<Gary M> Roughly 6 times faster than the normal allocator even with arc/orc
12:28:41FromDiscord<Clyybber> heh, yeah the default allocator is a O(1) one so it might be slower for some stuff
12:28:53FromDiscord<Clyybber> even though it's faster asymptotically
12:29:11FromDiscord<Gary M> If that's O(1) then what is malloc?
12:29:58FromDiscord<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:45FromDiscord<Gary M> I'm no expert but maybe you want a macro for that?
12:30:58FromDiscord<Gary M> Or just use a silly proc like add()
12:31:28FromDiscord<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:42FromDiscord<Clyybber> (edit) "linux" => "glibc"
12:31:42FromDiscord<Gary M> Instead of x + y just add x, y
12:31:49FromDiscord<Gary M> No reliance on operator
12:32:09FromDiscord<Clyybber> @KnorrFG doubling didn't work?
12:32:18FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2SNp
12:32:34FromDiscord<Gary M> I guess I'd have to do more tests then because O(n) sounds bad
12:32:36FromDiscord<Clyybber> I think doubling is suppsoed to work, but not sure
12:32:37FromDiscord<KnorrFG> good idea
12:33:21FromDiscord<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:32FromDiscord<Clyybber> basically unpredictable if you will
12:33:45FromDiscord<Clyybber> that's why Nim's default allocator is O(1)
12:33:49FromDiscord<Clyybber> to keep it predictable
12:33:57FromDiscord<Rika> O(n) vs O(1) doesnt give the whole picture
12:34:02FromDiscord<Rika> they only give the shape, not the values
12:34:19federico3(that's the whole point of O-notation)
12:34:23FromDiscord<Rika> O(n) for some value lower than N can be faster than O(1)
12:34:25FromDiscord<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:01FromDiscord<Gary M> Really depends on my use case I guess.
12:35:04FromDiscord<Clyybber> yeah, fair
12:35:10FromDiscord<Clyybber> you could also try mimalloc
12:35:11FromDiscord<Gary M> I'm also considering using a memory pool
12:35:34FromDiscord<Clyybber> for stuff you only need for a frame?
12:35:57FromDiscord<Gary M> Something like that.
12:36:14FromDiscord<Gary M> One allocation
12:36:53FromDiscord<Gary M> I know there's like one or two in Nim
12:42:18FromDiscord<Gary M> One thing I need to figure out is SSDP
12:42:38FromDiscord<Gary M> Simple Service Discovery Protocol
12:43:35FromDiscord<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:01FromDiscord<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:27FromGitter<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:42FromDiscord<Yardanico> can you show the full error?
12:55:50FromDiscord<Yardanico> we have some code so that you can compile nim in termux
12:55:53FromDiscord<Yardanico> also you can just
12:55:55FromDiscord<Yardanico> pkg install nim
13:01:54FromGitter<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:31FromGitter<HJarausch_gitlab> Probably I have to patch the file ``koch.nim.cfg``
13:07:09FromDiscord<Rika> is there a way to pass more arguments to a forloopmacro?
13:09:33FromDiscord<Gary M> What do you mean
13:10:04FromDiscord<Rika> for i in anFLM(iterable, extra_args): ...
13:11:30FromDiscord<Gary M> I don't know anything about macros like that 😄
13:11:40FromDiscord<Rika> doesnt seem to anyway
13:11:53FromDiscord<Gary M> Is it just to modify the iterable?
13:12:05FromDiscord<Rika> https://nim-lang.org/docs/manual.html#macros-for-loop-macro
13:12:12FromDiscord<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:10FromDiscord<Gary M> How do you compile for android?
13:28:37FromGitter<HJarausch_gitlab> I use ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ nim.cfg.patch is similar. ... [https://gitter.im/nim-lang/Nim?at=604e0f85d71b6554cd42e8ba]
13:30:01FromDiscord<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:29FromDiscord<Rika> ptr Vector2 is correct
13:30:43FromDiscord<Yardanico> it's actually probably ptr UncheckedArray[Vector2]
13:30:44FromDiscord<Goel> (edit) removed "not" | removed "the"
13:30:50FromDiscord<Rika> oh thats true
13:30:51FromDiscord<Yardanico> because points is prular
13:30:53FromDiscord<Rika> didnt notice its called points
13:30:53FromDiscord<Gary M> Or not using addr
13:30:53FromDiscord<Yardanico> (edit) "prular" => "plural"
13:31:33FromDiscord<Gary M> It'll say a Vector2 is wrong type if it's not Vector2.addr :P
13:31:41FromDiscord<Rika> what?
13:32:03FromDiscord<Rika> you mean if youre not passing in an address
13:32:09FromDiscord<Gary M> Yeah it'll say type of `Vector2` does not match type of `ptr Vector2`
13:32:45FromDiscord<Yardanico> it's something like that
13:32:46FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SNQ
13:32:51FromDiscord<Yardanico> mypoints can be an array too
13:33:32FromDiscord<Gary M> That looks accurate, considering you have to pass in the length
13:33:54FromDiscord<Gary M> So it gets the start memory address and the stride length to read
13:34:04FromDiscord<Yardanico> yeah that's the usual pattern
13:34:05FromDiscord<Yardanico> for C FFI
13:34:27FromDiscord<Goel> `Vector2.addr` Thow worked
13:34:34FromDiscord<Goel> (edit) "Thow" => "This"
13:34:37FromDiscord<Yardanico> for a single point it'll work
13:34:43FromDiscord<Yardanico> for multiple - no
13:34:44FromDiscord<Gary M> For a single point yeah.
13:35:06FromDiscord<Gary M> Make it an array or seq of points and use Yard's example with the 0 index.
13:35:18FromDiscord<Gary M> It'll still be a Vector2 at the zero index so it will work
13:36:57FromDiscord<Gary M> Remember, triangles need 3 points, not one haha
13:36:57FromDiscord<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:36FromDiscord<Gary M> A point is just a single coordinate, a dot
13:38:31FromDiscord<Gary M> Vec2 typically would be representing the (x,y)
13:38:43FromDiscord<Yardanico> @Goel drawTriangleFan expects one _or more_ points
13:38:46FromDiscord<Rika> are `ForLoopStmt`s more equivalent to `untyped` or `typed`?
13:38:51FromDiscord<Yardanico> so it's more correct to do it my way
13:39:02FromDiscord<Yardanico> because you might want to pass multiple Vector2 points to drawTriangleFan
13:39:12FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2SNU
13:39:15FromDiscord<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:21FromDiscord<Yardanico> no
13:39:35FromDiscord<Yardanico> it reads as "a pointer to a sequence of one or more points"
13:39:38FromDiscord<Yardanico> one point is one Vector2
13:39:43FromDiscord<Gary M> Listen to yard, he's very smart 😄
13:39:48FromDiscord<Yardanico> official doc is "Draw a triangle fan defined by points (first vertex is the center)"
13:40:13FromDiscord<Yardanico> in 2D (x, y) is a single point - that is your Vector2
13:40:34FromDiscord<Goel> Isee
13:40:39FromDiscord<Yardanico> @Rika I think untyped because typed resolves all stuff
13:40:46FromDiscord<Gary M> That's what I tried to explain
13:40:54FromDiscord<Gary M> But I don't even know the api lol
13:41:11FromDiscord<Yardanico> neither do I, I just searched the function name in github
13:41:17FromDiscord<Gary M> Oh lol
13:41:21*Q-Master quit (Ping timeout: 264 seconds)
13:41:22FromDiscord<Yardanico> and it's apparently from raylib
13:41:25FromDiscord<Gary M> Ah
13:41:30FromDiscord<Yardanico> also https://github.com/greenfork/nimraylib_now has a wrong definition for it :P
13:41:43FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/820652915756367912/unknown.png
13:41:51FromDiscord<Gary M> Anyways yeah you're going to want to use an array or sequence of vector2's
13:42:01FromDiscord<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:11FromDiscord<Gary M> And just point to the addr of the 1st point and pass in the length of the whole sequence
13:42:30FromDiscord<Yardanico> @Rika you kind of can by generating code that'll call other macros
13:42:35FromDiscord<Gary M> It'll read all points in the sequence that way
13:42:36FromDiscord<Yardanico> that then accept typed
13:42:46FromDiscord<Rika> sounds CURSED
13:42:50FromDiscord<Yardanico> but you can't just say "give me the type of this untyped node" in macros
13:42:59FromDiscord<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:15FromDiscord<Gary M> You'll get the hang of it over time.
13:43:26FromDiscord<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:29FromDiscord<Gary M> You just need to know the quirks and isms of working with C libs
13:43:37FromDiscord<Goel> (edit) "is" => "are"
13:43:48FromDiscord<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:05FromDiscord<Yardanico> @Rika yeah you surely can
13:44:06FromDiscord<Gary M> So a pointer is just saying look at this 👉 memory address for the data
13:44:16FromDiscord<Rika> now, i dont know how that would work ;^^
13:45:10FromDiscord<Gary M> You're pointing 👉 at the array/seq of Vector2's [0] or 1st point
13:45:19FromDiscord<Gary M> And then you're telling it how long that sequence is
13:47:30FromDiscord<Gary M> Which example is this one?
13:47:54FromDiscord<Goel> sent a long message, see http://ix.io/2SNZ
13:48:00FromDiscord<Yardanico> nonono, you're passing a _single_ Vector2
13:48:03FromDiscord<Yardanico> a vector is two points
13:48:07FromDiscord<Yardanico> (a 2d vector)
13:48:10FromDiscord<Goel> Exactly
13:48:14FromDiscord<Yardanico> it doesn't give you an error
13:48:19FromDiscord<Gary M> Okay so hold up for 2 seconds.
13:48:21FromDiscord<Goel> Thats what i told you before, you tell me i was passing a single point
13:48:23FromDiscord<Yardanico> but if you tried to pass _two_ Vector2Ds, it'll fail
13:48:37FromDiscord<Yardanico> that's why it's more correct to define it as ptr UncheckedArray[Vector2]
13:49:29FromDiscord<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:40FromDiscord<Yardanico> it'll give you an error because you need to change your code
13:50:25FromDiscord<Yardanico> ah wait actually your code is wrong?
13:50:31FromDiscord<Yardanico> compiles != that it would work
13:50:34FromDiscord<Goel> I'm not going to modify the bindings at all, nor do i want to
13:50:36FromDiscord<Yardanico> you're passing a single vector but saying 3 points
13:51:15FromDiscord<Gary M> you don't have to modify the bindings
13:51:35FromDiscord<Gary M> which ones are you using?
13:52:38FromDiscord<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:47FromDiscord<Gary M> just the vec2 and the proc call
13:52:50FromDiscord<Yardanico> okay, guess I won't be able to help with that issue more, I'll step out of this question now :)
13:54:48FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SO3
13:54:56FromDiscord<Gary M> I don't see why this wouldn't work
13:55:01*livcd quit (Quit: Lost terminal)
13:55:22ForumUpdaterBotNew 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:03FromDiscord<Gary M> and he's gone silent, oh well
13:56:09*oz joined #nim
13:56:40FromDiscord<Goel> sent a long message, see http://ix.io/2SO5
13:56:43*Araq quit (Ping timeout: 260 seconds)
13:56:46FromDiscord<Yardanico> yeah that's not how you would do it :P
13:56:49*Oddmonger quit (Ping timeout: 276 seconds)
13:57:02FromDiscord<Goel> (edit) "long message," => "code paste," | "http://ix.io/2SO5" => "https://play.nim-lang.org/#ix=2SO6"
13:57:58FromDiscord<Yardanico> one sec
13:58:16FromDiscord<Gary M> sent a code paste, see https://paste.rs/pdB
13:58:37FromDiscord<Yardanico> yeah I pointed out above that it's wrong
13:58:44FromDiscord<Gary M> yes
13:58:54FromDiscord<Gary M> I mean we've explained it several times
13:58:57*Araq joined #nim
13:59:04FromDiscord<Gary M> array/sequence, addr of [0]
13:59:17*livcd joined #nim
14:00:37FromDiscord<Yardanico> @Goel
14:00:48FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SOb
14:00:53FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/820657735288094720/unknown.png
14:00:57FromDiscord<Gary M> also wait wait
14:01:05FromDiscord<Gary M> why is nimraylib_now in your src directory?
14:01:11FromDiscord<Gary M> do you know how to use nimble install?
14:01:19FromDiscord<Yardanico> yeah that was in Goel's example
14:01:26FromDiscord<Yardanico> (I installed from nimble myself)
14:01:27FromDiscord<Gary M> I know, I'm asking Goel
14:01:38FromDiscord<Yardanico> a proper way is to `nimble install nimraylib_now` and `import nimraylib_now/[raylib, raygui, raymath, physac]`
14:02:02FromDiscord<Gary M> It shows that on the readme in the git
14:02:26FromDiscord<Gary M> you typically don't have to manually copy nim libraries
14:04:15FromDiscord<Goel> No thats not the main folder i use for RayLib, the master folder of the bindings are in another directory
14:04:35FromDiscord<Gary M> but you're importing from /src/
14:04:40FromDiscord<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:08FromDiscord<Gary M> use `nimble install <package name>` and then `import <package name>`
14:05:10FromDiscord<Rika> not really better just preferred
14:05:18FromDiscord<Gary M> no, it's better lol
14:05:24FromDiscord<Gary M> unless you have to modify the file directly
14:05:29FromDiscord<Rika> no, its not better
14:05:32FromDiscord<Gary M> it is better
14:05:36FromDiscord<Rika> why so?
14:05:41FromDiscord<Gary M> updates to the library.
14:05:47FromDiscord<Gary M> adding dependencies
14:05:48FromDiscord<Gary M> etc
14:05:49FromDiscord<Rika> you can do that with git submodules
14:05:54FromDiscord<Gary M> that's way worse
14:05:58FromDiscord<Rika> why so?
14:06:04FromDiscord<Gary M> why use that when nimble already exists and solves the problem
14:06:13FromDiscord<Rika> same question reversed.
14:06:14FromDiscord<Gary M> much easier at that
14:06:19FromDiscord<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:46FromDiscord<Gary M> because if you start mixing submodules and nimble installs that's dumb
14:06:58FromDiscord<Rika> well if you are mixing them then sure its dumb
14:07:06FromDiscord<Rika> that doesnt make one system inherently better for everyone
14:07:10FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SOd
14:07:11FromDiscord<Gary M> why WOULDN'T you
14:07:21FromDiscord<Gary M> it is better
14:07:23FromDiscord<Gary M> it's easier to install
14:07:26FromDiscord<Gary M> it's easier to manage
14:07:32FromDiscord<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:00FromDiscord<Gary M> nimble install <package name> is significantly better than adding a git submodule and polluting your local file structure
14:08:19FromDiscord<Gary M> and then anyone who wants to use your lib has to pull submodules? Please.
14:08:29FromDiscord<Rika> i dont see the difference
14:08:36FromDiscord<Yardanico> @gollark can you show a C example of CARRAY from somewhere?
14:08:37FromDiscord<Gary M> smh
14:08:38FromDiscord<Rika> you're polluting something global instead of locally
14:08:42FromDiscord<Rika> (edit) "locally" => "local"
14:08:53FromDiscord<Gary M> out of your project structure, yes
14:08:54FromDiscord<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:56FromDiscord<Gary M> this is a good thing
14:09:18FromDiscord<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:35FromDiscord<Rika> and submodules are harder?
14:09:51FromDiscord<Rika> how so? its the same difficulty in my eyes
14:10:01FromDiscord<Gary M> adding, pulling, updating? Yes.
14:10:18FromDiscord<Gary M> `nimble install --depsOnly`
14:10:41FromDiscord<Gary M> and again, polluted local file structure is not great.
14:10:47FromDiscord<Rika> because
14:10:52FromDiscord<Gary M> Your project should be your project, not your deps
14:11:09FromDiscord<Rika> because
14:11:14FromDiscord<Gary M> literally that
14:11:17FromDiscord<Gary M> that's the because
14:11:19FromDiscord<Gary M> that
14:11:20*Q-Master joined #nim
14:11:21FromDiscord<Gary M> literally that
14:11:29FromDiscord<Rika> very explanatory thank you
14:11:34FromDiscord<Gary M> you're welcome lol
14:11:42FromDiscord<Rika> -_-
14:12:22FromDiscord<Gary M> so you seriously think that `git submodule update --init --recursive` is easier than `nimble install --depsOnly`?
14:12:28FromDiscord<Gary M> or at least equal
14:13:06FromDiscord<Gary M> and then oh you want to update? `git submodule update --remote --merge`, elegant
14:14:20FromDiscord<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:31FromDiscord<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:40FromDiscord<Gary M> `git submodule deinit <submodule>`
14:14:48FromDiscord<Gary M> vs nimble literally just remove the import
14:14:50FromDiscord<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:58FromDiscord<Gary M> doesn't affect your file structure or anything
14:15:03FromDiscord<Rika> and the requires.
14:15:10FromDiscord<Gary M> still, very simple.
14:15:17FromDiscord<Rika> and a command isnt?
14:15:21FromDiscord<Rika> what?
14:15:31FromDiscord<Rika> dude
14:15:32FromDiscord<Rika> whatever
14:15:34FromDiscord<Gary M> uh, it's objectively better?
14:15:36FromDiscord<Gary M> what?
14:15:36FromDiscord<Gary M> dude
14:15:38FromDiscord<Gary M> lol
14:15:42*Q-Master quit (Ping timeout: 256 seconds)
14:16:04FromDiscord<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:24FromDiscord<Gary M> you can even point it to gits directly
14:16:33FromDiscord<Gary M> so like why would you ever need to use git submodules, ever
14:17:57FromDiscord<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:17FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/820662115748282429/trifan.png
14:18:19FromDiscord<Gary M> this is a fan
14:18:27FromDiscord<Gary M> they all share the v1
14:18:36FromDiscord<Gary M> you see how it resembles a fan shape?
14:18:53FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/820662264017059870/tristrip.png
14:18:55FromDiscord<Gary M> this is a triangle strip
14:19:42FromDiscord<Yardanico> btw it might be better to move to #gamedev @Gary M @Goel
14:19:48FromDiscord<Yardanico> just for more like-minded people :P
14:26:34FromDiscord<Gary M> @Yardanico hey yard I have these uint32 bitflags and I'm doing comparisons like if(flag and flag).bool right
14:26:43FromDiscord<Yardanico> yeah?
14:26:48FromDiscord<Gary M> what would I have to do to make it implicitly cast to bool?
14:27:13FromDiscord<Yardanico> well, you'll have to write a converter from int to bool
14:27:18FromDiscord<Gary M> ah gross
14:27:30FromDiscord<Yardanico> also, did you see https://nim-lang.org/docs/manual.html#set-type-bit-fields ?
14:27:37FromDiscord<Yardanico> you can model c bitflags with nim's enum
14:27:40FromDiscord<Gary M> converters are really dangerous no?
14:28:15FromDiscord<Gary M> the wrapper I'm using wants to just use uint32's for that.
14:28:32FromDiscord<Clyybber> oh
14:28:39FromDiscord<Clyybber> @Gary M what do you need?
14:28:48FromDiscord<Rika> can probably use a cast to a set type for that
14:29:05FromDiscord<Yardanico> @Gary M they're not "dangerous", but implicit and sometimes can lead to surprising behaviours/errors
14:29:07FromDiscord<Gary M> I was just hoping I could just not have to wrap them in parenthesis and .bool them
14:29:09FromDiscord<Yardanico> so the manual way might be more preferred
14:29:21FromDiscord<Gary M> but it's the end of the world at all lol
14:29:53FromDiscord<Clyybber> freudian slip
14:30:01FromDiscord<Gary M> ouch
14:30:07FromDiscord<Gary M> it's definitely the end of the world now
14:30:27FromDiscord<Rika> sorry, my fault
14:30:34FromDiscord<Rika> hit the nuke button by accidenta
14:30:35FromDiscord<Rika> (edit) "accidenta" => "accident"
14:30:38FromDiscord<Clyybber> damn it
14:30:57FromDiscord<Clyybber> happens to the best of us
14:31:16FromDiscord<Rika> im clearly not one of the best though
14:31:24FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/820665415235010650/unknown.png
14:31:31FromDiscord<Gary M> look how nice this is too (unrelated to the bitflags) lol
14:31:40FromDiscord<Yardanico> yeah an enum would be much better
14:31:51FromDiscord<Gary M> these are actually VkBool32's
14:31:53FromDiscord<Yardanico> like muuuuuuuuuuuch better
14:32:05FromDiscord<Clyybber> In reply to @Rika "im clearly not one": that's what they want you to think
14:32:07FromDiscord<Rika> much better but itll still look like a fuckin mess
14:32:13FromDiscord<Yardanico> In reply to @Rika "much better but itll": not at all
14:32:22FromDiscord<Gary M> these I probably could convert from VkBool32 to bool
14:32:22FromDiscord<Rika> really? the list looks massive
14:32:24FromDiscord<Yardanico> you just check if there's at least one element that's in the second set
14:32:27FromDiscord<Yardanico> but not in the first one
14:32:29FromDiscord<Rika> a massive enum is still pretty bad
14:32:33FromDiscord<Yardanico> i mean otherwise
14:32:35FromDiscord<Gary M> like I said, unrelated to the bitflag issue
14:32:35FromDiscord<Yardanico> @Rika not "bad"
14:32:36FromDiscord<Rika> oh
14:32:37FromDiscord<Rika> OH
14:32:40FromDiscord<Rika> i misread the code
14:32:41FromDiscord<Gary M> these are actually bools
14:32:51FromDiscord<Clyybber> lmao @Gary M why don't you just check them by comparing them directly?
14:33:05FromDiscord<Clyybber> oh neverimnd
14:33:05FromDiscord<Rika> yeah you only need to intersect them and see if the intersection is not equal to the requested set...
14:33:07FromDiscord<Gary M> because if wants a real bool lol
14:33:10FromDiscord<Rika> that sounds really good
14:33:20FromDiscord<Rika> In reply to @Gary M "these are actually bools": rest in peace
14:33:33FromDiscord<Gary M> and I'm checking if `bool` and not `otherbool`
14:33:41FromDiscord<Clyybber> @Gary M you can do a for fields
14:33:45FromDiscord<Gary M> so if true and not true
14:33:57FromDiscord<Rika> In reply to @Clyybber "<@!177350766229454848> you can do": yeah but over two objects?
14:34:03FromDiscord<Rika> has to iterate both fields sooooooo
14:34:07FromDiscord<Gary M> that's the messy thing 😄
14:34:19FromDiscord<Gary M> this is how it was done in the original C++ and I'm not too worried.
14:34:26FromDiscord<Rika> >C++
14:34:29FromDiscord<Rika> theres your problem
14:34:31FromDiscord<Clyybber> In reply to @Rika "yeah but over two": easy, there's a fieldParis iterator
14:34:33FromDiscord<Gary M> lol
14:34:46FromDiscord<Gary M> show me fieldPairs 😄
14:34:46FromDiscord<Rika> i remember seeing fieldpairs
14:34:49FromDiscord<Rika> never checked it
14:35:14FromDiscord<Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i,S,T
14:35:22FromDiscord<Rika> doesnt sound like it helps much
14:35:23FromDiscord<Gary M> is it possible to make a converter local scoped?
14:35:35FromDiscord<Rika> oh
14:35:38FromDiscord<Rika> i think it helps
14:35:42FromDiscord<Rika> if you use this in a macro context
14:35:49FromDiscord<Gary M> hold on let me see
14:36:01FromDiscord<Rika> but you gotta learn macros if you havent already
14:36:10FromDiscord<Clyybber> oh actually there's even an overload for two objects
14:36:14FromDiscord<Rika> https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT
14:36:16FromDiscord<Clyybber> yeah
14:36:17FromDiscord<Rika> didnt see the overload
14:36:18FromDiscord<Rika> yeah
14:36:25FromDiscord<Rika> there was an overload, ive never seen the overload before
14:36:28FromDiscord<Rika> when was that added?
14:36:31FromDiscord<Clyybber> no idea
14:36:41FromDiscord<Rika> git blame time
14:37:15FromDiscord<Rika> its two years old
14:37:19FromDiscord<Rika> aka i should have known
14:37:20FromDiscord<Yardanico> more
14:37:28FromDiscord<Rika> i meant over yes
14:37:45FromDiscord<Rika> im prolly just becoming stupid
14:37:56FromDiscord<Rika> anyway @Gary M have a look at this one https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CS%2CT
14:38:07FromDiscord<Rika> just in case you're still looking at the other one
14:38:24FromDiscord<Gary M> `The current implementation also has a bug that affects symbol binding in the loop body.`
14:38:29FromDiscord<Gary M> what does that even mean
14:39:04FromDiscord<Rika> uh
14:39:05FromDiscord<Rika> yes
14:39:17FromDiscord<Rika> i understand but i dont know how to explain
14:40:46FromDiscord<Clyybber> @Gary M it's because it's expanded at compile time
14:40:53FromDiscord<Clyybber> it shouldn't matter for your use case
14:40:58FromDiscord<Clyybber> only in some edge cases
14:41:06FromDiscord<Gary M> I just don't understand what it means let alone the because
14:43:35FromDiscord<Clyybber> @Gary M https://github.com/nim-lang/Nim/issues/11046
14:43:42FromDiscord<Clyybber> it just means that after the loop is unrolled
14:43:50FromDiscord<Clyybber> name isn't a variable anymore
14:43:52FromDiscord<Clyybber> but a string literal
14:43:58*kenran quit (Quit: leaving)
14:44:49FromDiscord<Gary M> is it actually able to iterate over object fields themselves
14:44:53FromDiscord<Clyybber> yeah
14:45:00FromDiscord<Rika> not in the classical sense
14:45:03FromDiscord<Clyybber> but at compile time
14:45:05FromDiscord<Rika> its an unrolled for loop
14:45:12FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/820668891449393182/unknown.png
14:45:16FromDiscord<Rika> so none of the "variables" are actually variables
14:45:18FromDiscord<Gary M> because it's an object with a ton of fields
14:45:22FromDiscord<Clyybber> easy
14:45:29FromDiscord<Clyybber> will expand exactly to your code
14:45:47FromDiscord<Rika> doesnt matter how many fields there are i believe...
14:45:54FromDiscord<Clyybber> yeah
14:45:55FromDiscord<Gary M> ` for req, sup in (requested, supported).fieldPairs:` this is not correct
14:46:02FromDiscord<Gary M> how should I be doing it?
14:46:17FromDiscord<Clyybber> three values
14:46:18FromDiscord<Rika> probably have to use the regular syntax `fieldPairs(requested, supported)` instead
14:46:30FromDiscord<Rika> oh yeah that too
14:46:37FromDiscord<Clyybber> for name, req, sup in fieldPairs(requested , supported)
14:46:38FromDiscord<Rika> name, req, sup
14:46:40FromDiscord<Rika> yeah
14:46:49FromDiscord<Clyybber> yeah, and normal params of course, because you are constructing a tuple
14:47:12FromDiscord<Rika> `(requested, supported).fieldPairs` this passes one parameter (a tuple), not two parameters
14:48:07FromDiscord<Gary M> so this?
14:48:10FromDiscord<Clyybber> yeah
14:48:10FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2SOn
14:48:31FromDiscord<Gary M> now my other question idk if someone answered, can I define a converter only in local scope?
14:48:36FromDiscord<Clyybber> nope
14:48:40FromDiscord<Clyybber> afaik
14:48:43FromDiscord<Rika> wdym local?
14:48:47FromDiscord<Rika> module wide only i believe
14:48:52FromDiscord<Gary M> inside a proc 😛
14:48:54FromDiscord<Rika> any smaller not possible
14:48:58FromDiscord<Clyybber> yeah
14:49:07FromDiscord<Clyybber> would be nice if that worked tho
14:49:15FromDiscord<Clyybber> probably not too hard with todays compiler
14:49:16FromDiscord<Rika> sounds hard to impl
14:49:19FromDiscord<Rika> really?
14:49:33FromDiscord<Rika> might be a bad idea though?
14:49:42FromDiscord<Clyybber> hmm, I like the idea
14:49:51FromDiscord<Clyybber> because it allows to restrain the scope of converters then
14:49:53FromDiscord<Clyybber> seems handy
14:49:58FromDiscord<Gary M> I would like it so I can very specifically convert exactly what I want
14:50:00FromDiscord<Rika> hm
14:50:06FromDiscord<Rika> i dont think there are downsides yeah
14:50:06FromDiscord<Gary M> and not get UB in the rest of the module
14:50:17FromDiscord<Rika> tfw U means a lot of things
14:50:18giaco_elegant way to convert an object made of ints/floats into url parameters like field1=value&field2=value&field3... ?
14:50:25FromDiscord<Gary M> undefined behaviour
14:50:30FromDiscord<Rika> i believe theres a proc for that giaco
14:50:43FromDiscord<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:44FromDiscord<Rika> i was thinking "unexpected" for your scenario
14:50:57FromDiscord<Rika> not really undefined, just unexpected
14:51:11giaco_Rike yeah probably but don't know how to name it or where in std should I find it
14:51:17FromDiscord<Gary M> https://nim-lang.org/docs/uri.html#encodeUrl%2Cstring ?
14:51:41FromDiscord<Rika> i dont have internet fast enough to load the docs
14:51:47FromDiscord<Rika> i mean
14:51:54FromDiscord<Rika> i can load it its just that it takes a pretty long time
14:52:20FromDiscord<Clyybber> damn
14:52:49FromDiscord<Yardanico> @giaco_ https://nim-lang.org/docs/uri.html#encodeQuery%2CopenArray%5B%5D
14:52:56FromDiscord<Gary M> yeah that's the one
14:53:03FromDiscord<Yardanico> but you'd need $ first, but that's easy
14:54:05giaco_Yardanico, thanks, you say it is easy to convert object into openArray[(string,string)]?
14:54:27FromDiscord<Gary M> !eval import uri; echo encodeQuery({"a": "1", "b": "2"})
14:54:31NimBota=1&b=2
14:54:49FromDiscord<Yardanico> @giaco_ object?
14:55:06FromDiscord<Yardanico> you can make your custom encodeQuery with fieldPairs for that :D
14:56:36FromDiscord<Gary M> does eval work multiline
14:56:53FromDiscord<Yardanico> no
14:56:56FromDiscord<Yardanico> @giaco_ this will work:
14:56:56FromDiscord<Gary M> you could just overload the $ for the object type can't you?
14:57:02FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SOo
14:57:15FromDiscord<Yardanico> copied encodeQuery and adapted to fieldPairs
14:57:26FromDiscord<Gary M> oh nice
14:57:40FromDiscord<Yardanico> hm, but it's not really efficient for objects with a lot of fields
14:57:43FromDiscord<Yardanico> the binary will get bloated
14:58:22FromDiscord<Yardanico> hm
14:58:27giaco_how can you write a solution so fast! Damn I feel stupid :D thanks
14:59:01FromDiscord<Yardanico> yeah, just bear in mind that this code will negatively affect binary sizes if object has a lot of fields
14:59:04FromDiscord<Yardanico> because the loop is unrolled
14:59:52FromDiscord<Gary M> not necessarily the worst tradeoff
15:00:10FromDiscord<Gary M> don't unrolled loops usually run faster unless they're vectorized?
15:00:15FromDiscord<Gary M> But you can't really vectorize strings lol
15:00:28FromDiscord<Yardanico> @giaco_ the non-bloated solution would be something like this
15:00:40*Q-Master joined #nim
15:00:41FromDiscord<Yardanico> I mean less bloated
15:02:22FromDiscord<Yardanico> but it'll allocate seqs each time the proc is called 🤔
15:02:25FromDiscord<Yardanico> sent a code paste, see https://paste.rs/yv1
15:02:44FromDiscord<Gary M> lol can you rewrite it as arrays
15:03:02FromDiscord<Yardanico> yeah but it'll still require allocation, even if a stack one :P
15:03:30ForumUpdaterBotNew thread by Livingstone1337: Assigning an array of an array, see https://forum.nim-lang.org/t/7624
15:05:00giaco_Yardanico, you're adding to a seq without initializing it?!
15:05:09FromDiscord<Rika> you dont need to
15:05:42*Q-Master quit (Ping timeout: 260 seconds)
15:05:49giaco_stack/heap confusion growing
15:06:21FromDiscord<Yardanico> replied to that forum thread
15:06:24FromDiscord<Yardanico> fast responses
15:06:25FromDiscord<Gary M> the only trouble I've ever had with uninitialized seqs was with C ffi addr's 😛
15:06:47FromDiscord<Gary M> but generally no you don't have to initialize them to add to them.
15:09:09FromDiscord<Gary M> anyways, the whole scoped converter idea, think about it haha
15:09:52FromDiscord<Gary M> is there any way to make {.link: "".} search system paths like dynlib?
15:10:11giaco_so an uninitialized seq lives on the stuck but has dynamic resizing?!
15:10:14giaco_*stack
15:10:17FromDiscord<Yardanico> no
15:10:27FromDiscord<Gary M> heap
15:10:28FromDiscord<Yardanico> it depends on what you call "seq"
15:10:32FromDiscord<Rika> uninit seqs are just "implicitly init"
15:10:37FromDiscord<Yardanico> seq data always lives on the heap
15:10:55FromDiscord<Yardanico> but internal capacity and/or length fields might be on the stack
15:11:28FromDiscord<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:46FromDiscord<Yardanico> https://github.com/nim-lang/nim/blob/devel/lib/system/seqs_v2.nim
15:12:18giaco_ok
15:12:32giaco_thanks, didn't know it was a wrapped object
15:13:05FromDiscord<Yardanico> in old runtime (refc) it's a bit different
15:13:52FromDiscord<Yardanico> it's a reference (pointer) to len: int, capacity: int, data
15:14:09FromDiscord<Yardanico> so with new runtime to access a seq's length you have to do 0 pointer indirections
15:16:43FromDiscord<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:35FromDiscord<Gary M> that's cool
15:18:23FromDiscord<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:42FromDiscord<Gary M> I forget the exact instance, but I needed to newSeq it
15:18:50FromDiscord<Yardanico> newSeq with size maybe?
15:19:03FromDiscord<Yardanico> if it's the C side that fills the data then you don't need to initialize it
15:19:14FromDiscord<Yardanico> usually
15:19:20FromDiscord<Gary M> it was nim friendly code, but on execution it was attempt to read from nil or something like that
15:19:25FromDiscord<Clyybber> yeah but that's not related to uninit seqs are empty
15:19:26FromDiscord<Gary M> wish I could remember what it was
15:19:30giaco_so now newSeq returns a struct and not a pointer?
15:19:51FromDiscord<Clyybber> because uninit vs empty can't matter for accessing the first elem
15:19:56FromDiscord<Clyybber> or the addr of the first elem
15:19:57FromDiscord<Yardanico> with arc/orc yes @giaco_, but that's all an internal detail anyway
15:20:02FromDiscord<Rika> it returns whatever a seq is defined as internally
15:20:03FromDiscord<Yardanico> seq is a seq :)
15:20:39FromDiscord<Gary M> all I know is whatever it was I was doing really didn't like the uninit seq
15:20:47FromDiscord<Gary M> big shrug
15:21:56FromDiscord<Rika> shurg
15:22:09FromDiscord<Clyybber> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:22:21FromDiscord<Clyybber> oh wow you can chain them
15:22:27FromDiscord<Clyybber> /shrug ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:22:34FromDiscord<Clyybber> huh
15:22:44FromDiscord<Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:22:45FromDiscord<Clyybber> /shrug ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:22:54FromDiscord<Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:22:57FromDiscord<Yardanico> can't do more than 2
15:23:00FromDiscord<Clyybber> yeah
15:23:03FromDiscord<Yardanico> ¯\_(ツ)_/¯ ¯\_(ツ)_/¯
15:23:51FromDiscord<Rika> thats strange
15:24:14giaco_I think I need an antispam for irc. My client is filled with private spam messages
15:24:17FromDiscord<Clyybber> it kinda makes sense
15:24:33FromDiscord<Clyybber> giaco_: oh, the spammers were us in this case
15:24:43FromDiscord<Clyybber> if you mean the emojis
15:24:58FromDiscord<Clyybber> (edit) "emojis" => "emojis/shrugs"
15:25:50giaco_no no, I'm receiving private messages from one-shot users that dump strange phrases and disconnects
15:25:56FromDiscord<Clyybber> oh
15:26:42FromDiscord<Gary M> how do I make a proc get a lent openArray?
15:26:55FromDiscord<Gary M> or should I just not worry about doing that lol
15:27:28FromDiscord<Rika> if you're not trying to optimize dont worry about it i think
15:28:07FromDiscord<Clyybber> yeah, better not worry about that yet
15:28:21FromDiscord<Clyybber> openArray's are views anyways, so lent openArray is another layer
15:28:50FromDiscord<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:51FromDiscord<Yardanico> random nim programming (not really interesting), doing some sciter things too - twitch.tv/yardanico or Music channel in Discord
15:45:20FromDiscord<Yardanico> General
15:51:53FromDiscord<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:45FromDiscord<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:40FromDiscord<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:09leorize[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:37FromDiscord<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:19FromDiscord<Yardanico> @Goel that's why it's called "pseudorandom"
16:06:05FromDiscord<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:42FromDiscord<Yardanico> you can get true random by observing the nature
16:06:56FromDiscord<Yardanico> https://www.cloudflare.com/learning/ssl/lava-lamp-encryption/
16:07:04FromDiscord<Yardanico> for example
16:07:30FromDiscord<Rika> i also asked a few days (or weeks? idk) ago if we could extract randomness from camera noise
16:07:53leorize[m]camera noise is not that random
16:08:16FromDiscord<Rika> is it not?
16:08:17FromDiscord<Rika> hm
16:09:13FromDiscord<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:26FromDiscord<Goel> (edit) ""extrely" => ""extremly"
16:10:57leorize[m]frankly, random as we conceptualize it doesn't exist, except maybe at quantum levels
16:12:05FromDiscord<Goel> I understand, thanks
16:13:14leorize[m]@Rika I might be wrong, actually
16:13:19FromDiscord<Gary M> Isn't there a "true" random based on Geiger counter readings or whatever
16:14:05FromDiscord<Rika> well yes but the question was about functions that dont take external environment data
16:14:17FromDiscord<Clyybber> all of our computations are random; because if we are unlucky a bit might get flipped :p
16:14:22FromDiscord<Rika> lol
16:15:39FromDiscord<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:49FromDiscord<Gary M> Give it the same seed, get the same result :P
16:16:19FromDiscord<Gary M> Now you can make that really hard to spoof by basing it on hardware and clock shit
16:16:30FromDiscord<Gary M> But then I guess for some people skilled enough that's still easy lol
16:16:32FromDiscord<Clyybber> the OS might use voltage fluctuations of your hardware ports
16:17:13FromDiscord<Gary M> For the case of video games though: who really cares?
16:17:16FromDiscord<Clyybber> but if you don't believe in locality, then not even quantum mechanics can get you randomness
16:17:31FromDiscord<Clyybber> In reply to @Gary M "For the case of": nobody, in video games I think fair random generators are far better
16:17:46FromDiscord<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:59FromDiscord<Clyybber> true randomness sucks for games
16:18:15FromDiscord<gollark> CPUs have onboard random number generators using thermal noise or something now.
16:18:20FromDiscord<Clyybber> yeah
16:18:31FromDiscord<gollark> And OSes have rather a lot of sources of unpredictable data which is aggregated into "random" values.
16:18:40FromDiscord<Gary M> Well you wouldn't want easily reproducible prng exploits in a multiplayer game
16:18:47FromDiscord<Gary M> But other than that it's not an issue
16:19:29FromDiscord<Clyybber> depends on what you consider a prng exploit
16:19:48FromDiscord<Gary M> However any networked game that actually cares about exploits is going to use an authoritative server
16:20:02FromDiscord<Gary M> So then all prng that matters goes through the server not the client
16:20:37FromDiscord<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:09FromDiscord<Gary M> What I would consider a prng exploit is like exploiting monster loot or chest drop tables
16:21:31FromDiscord<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:34FromDiscord<Gary M> If you can make it consistently give you that 1% chance item, you have a major unintended advantage
16:22:23FromDiscord<Gary M> I mean for single player it doesn't matter at all
16:22:35FromDiscord<Gary M> Exploits are pretty cool even, usually.
16:22:42FromDiscord<Gary M> It makes for interesting speedruns
16:23:00FromDiscord<Gary M> But for a multiplayer game like an mmo or a moba you would want exploits
16:23:05FromDiscord<Gary M> Wouldn't
16:23:54FromDiscord<Clyybber> but you wouldn't want true randomness either
16:24:03FromDiscord<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:23FromDiscord<Clyybber> or maybe you do want true randomness in a MMO; after all randomness makes people go insane
16:24:29FromDiscord<Gary M> Yeah no I mean honestly a lot of rng in games is weighted
16:24:38FromDiscord<Gary M> But that wouldn't be right in multiplayer
16:24:47FromDiscord<Clyybber> oh, I don't mean weighted or not
16:24:50FromDiscord<Gary M> People would figure out the formulas are off and bitch
16:25:14FromDiscord<dom96> I had to write my own RNG to ensure its synced between the client and server
16:25:15FromDiscord<dom96> that was fun
16:25:17FromDiscord<Clyybber> I mean rng with rules such as "after 50 tries you are guaranteed to get a 100"
16:25:27FromDiscord<dom96> IIRC I just copied Doom 😄
16:25:31FromDiscord<Gary M> Well in a way that's weighted
16:25:38FromDiscord<Gary M> Just what, weighted distribution?
16:25:43FromDiscord<Clyybber> @dom96 oh you did? You could just have used stdlib's random and synced the seeds/states I think
16:25:49FromDiscord<Gary M> It's the vending machine method lol
16:25:52FromDiscord<Clyybber> yeah
16:25:56FromDiscord<Gary M> I mean claw machine
16:25:58FromDiscord<Gary M> Whatever
16:26:02FromDiscord<dom96> @Clyybber it wouldn't sync on the JS backend
16:26:11FromDiscord<dom96> because it uses the JS random IIRC
16:26:17FromDiscord<Clyybber> oh, it does?
16:26:46FromDiscord<dom96> or there was some other reason it wasn't syncing
16:26:49FromDiscord<dom96> but I definitely tried it first
16:26:50FromDiscord<Clyybber> oh I don't think it does
16:27:00FromDiscord<Clyybber> I think the reason is that js is 32bit
16:27:04FromDiscord<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:19FromDiscord<Gary M> But it doesn't tell the player that, it shows the unweighted like 85%
16:27:21FromDiscord<Clyybber> In reply to @Clyybber "I think the reason": as in, the random generator uses different constants
16:27:33FromDiscord<dom96> yeah
16:27:41FromDiscord<Clyybber> In reply to @Gary M "In fire emblem when": ah, that's neat
16:27:52FromDiscord<Gary M> Yeah, it's a big S curve
16:28:04FromDiscord<Gary M> Because people are bad at judgement lol
16:28:17FromDiscord<Gary M> They expect something that is 95% to be 100%
16:28:36FromDiscord<Gary M> How could the 5% ever possibly trigger!? On me!? Such bullshit!
16:28:40FromDiscord<Clyybber> I mean, it's probably best in a tactic based game like that
16:28:49FromDiscord<Clyybber> gotta make it more predictable
16:28:55FromDiscord<รєคɭ๓๏שє> it's ready!! https://github.com/sealmove/binarylang/blob/main/tests/testsuite.nim#L348 @giaco
16:28:57FromDiscord<Gary M> Yep but then there's Xcom
16:29:02FromDiscord<Gary M> Pretty sure they don't do that
16:29:06FromDiscord<Clyybber> yeah they don't
16:29:16FromDiscord<Gary M> And it's known for being very unforgiving lol
16:30:26FromDiscord<Gary M> But yeah if you do the guaranteed nice drop after 100 shitty ones you have a cool static rewards/time
16:31:19FromDiscord<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:33FromDiscord<Clyybber> huh
16:32:34FromDiscord<Gary M> Which means they did have a static delivery of the nice chests rather than it being actually random.
16:32:39FromDiscord<Clyybber> that's nice
16:34:05*drdee quit (Quit: Leaving)
16:34:51FromDiscord<Gary M> What's the preferred method of outputting Nim's raw C files for use in something like cmake?
16:35:33FromDiscord<Clyybber> maybe using --nimcache
16:48:04*sixtyten joined #nim
17:00:05ForumUpdaterBotNew thread by Vitreo12: Using typedesc in function arguments, see https://forum.nim-lang.org/t/7625
17:00:54FromDiscord<Yardanico> i wonder if it's safe to pass a nim int to a C function that expects an pointer int32?
17:01:09FromDiscord<Yardanico> i guess not 🤔
17:03:07*wasted_youth2 quit (Quit: Leaving)
17:08:36FromDiscord<Clyybber> @Yardanico int is the size of a pointer, so it's safe
17:09:07FromDiscord<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:16FromDiscord<Yardanico> will it work if I have a `var a: int` and pass `addr a`
17:09:24FromDiscord<Yardanico> because nim int is 64-bit on a 64-bit platform
17:13:20leorize[m]on LE architecture, it probably will
17:17:18*azed joined #nim
17:23:23FromDiscord<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:59FromDiscord<Yardanico> this seems to be a fork of PMunch's binaryparse
17:24:03FromDiscord<รєคɭ๓๏שє> yeah, I started by modifying PMunch's binaryparse, but it turned into a completely new and bigger project
17:24:24FromDiscord<รєคɭ๓๏שє> it's a complete rewrite, keeping the basic idea same
17:25:50FromDiscord<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:44FromDiscord<รєคɭ๓๏שє> yup, you get data parsed into tuples or (just today) in object variants
17:26:57FromDiscord<รєคɭ๓๏שє> and serialization works too
17:32:15FromDiscord<รєคɭ๓๏שє> 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:58FromDiscord<รєคɭ๓๏שє> Nim opens tons of new possibilities, so I think it surpasses Python's construct library, who is the strongest competitor
17:33:22FromDiscord<รєคɭ๓๏שє> Kaitai Struct has its own problems as an external DSL
17:33:31FromDiscord<รєคɭ๓๏שє> But the IDE is really strong
17:33:36federico3giaco_: 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:53FromDiscord<รєคɭ๓๏שє> I plan to write a Kaitai Struct backend which translates specs to BinaryLang
17:34:04giaco_hi sealmove!
17:34:08giaco_federico3: thanks
17:34:12FromDiscord<รєคɭ๓๏שє> hey!
17:36:38FromDiscord<รєคɭ๓๏שє> checkout the new macro `createVariantParser` ;)
17:37:15giaco_sealmove yeah I was waiting for that! I saw readme coming before code and I've been puzzled for a while
17:37:28FromDiscord<รєคɭ๓๏שє> sorry for that :3
17:37:34giaco_np haha
17:39:30federico3@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:23FromDiscord<รєคɭ๓๏שє> @giaco btw there are some details regarding the exportation of the fields, which I haven't documented yet
17:41:10Yardanico@Yardanico test ping
17:41:14FromDiscord<Yardanico> huh
17:41:28FromDiscord<รєคɭ๓๏שє> `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:57Yardanicorestarted ircord
17:42:01Yardanico@Yardanico asd
17:42:35giaco_yeah reading docs into code
17:44:36giaco_wow if I got it correcly it can cover a lot of new cases!
17:45:17FromDiscord<รєคɭ๓๏שє> yeah :) I think I got the design right. It models closely Nim's object variants
17:48:04FromDiscord<ajusa> Is there any way to change endianess for just a single field?
17:48:20*xet7 joined #nim
17:48:23FromDiscord<รєคɭ๓๏שє> btw @giaco, if you want to collaborate, you can always upload your parsers to: https://github.com/sealmove/n4n6
17:48:48FromDiscord<รєคɭ๓๏שє> In reply to @ajusa "Is there any way": sure, just add `l` or `b`, for example `lu32` instead of `u32`
17:50:01FromDiscord<ajusa> Ah, now I understand the readme. I thought that was for the entire createParser call, not for a specific field.
17:50:32FromDiscord<รєคɭ๓๏שє> you can pass options to createParser for setting a default endianness
17:51:27FromDiscord<รєคɭ๓๏שє> this default can be overwritten by each field
17:51:55FromDiscord<รєคɭ๓๏שє> the default default (:P) is bigEndian
17:56:13FromDiscord<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:41saemBTW, @clyybber I'm upto no good again. :D
17:56:53FromDiscord<ajusa> (edit) "it's" => "its"
17:56:59FromDiscord<Clyybber> hehe
18:00:28FromDiscord<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:38FromDiscord<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:51FromDiscord<Yardanico> then I guess I'll have to resort to runnableExamples("-r:off")
18:09:06*aenesidemus joined #nim
18:13:14FromDiscord<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:28FromDiscord<Yardanico> can you show more code?
18:14:52FromDiscord<Livingstone> Var X, y: array[data.len, float]
18:15:09FromDiscord<Livingstone> for i, a in data:
18:15:19FromDiscord<Yardanico> you can paste all the code in a single message
18:15:29FromDiscord<Yardanico> also, you can't reshape arrays as they have fixed length
18:15:31FromDiscord<Livingstone> I'm doing this across virtual box lol
18:15:34FromDiscord<Yardanico> why?
18:15:51FromDiscord<Livingstone> coz my computer is windows and ubuntu helps me code better
18:16:09FromDiscord<Yardanico> you can install discord on both windows and/or ubuntu
18:17:27FromDiscord<exelotl> federico3: what's the difference between cryptographic randomness and CSPRNG ?
18:17:40FromDiscord<Livingstone> I'm installing it now
18:19:20giaco_"echo 9.0 0.2228" prints 9.222799999999999, but in c "printf("%f",9.0 + 0.2228)) prints correctly 9.222800
18:19:33giaco_I mean "echo 9.0 + 0.2228"
18:21:01FromDiscord<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:39leorize[m]megatest is an automated feature of testament
18:22:21leorize[m]it will merge tests together into a "megatest" for faster build time
18:23:39FromDiscord<Livingstone> sent a long message, see http://ix.io/2SQ2
18:23:42FromDiscord<Livingstone> boom there it is
18:23:49FromDiscord<Yardanico> and where does reshape come from?
18:24:12FromDiscord<Livingstone> np = pyImport("numpy")
18:24:51FromDiscord<รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SQ3
18:24:53FromDiscord<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:57federico3@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:02FromDiscord<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:26FromDiscord<Livingstone> ok
18:26:40FromDiscord<Livingstone> what should I do instead?
18:26:44*aenesidemus quit (Quit: Leaving)
18:26:51FromDiscord<Livingstone> or what do you suggest I do?
18:27:42FromDiscord<Livingstone> I'll still use numpy for matplot lib but I'll do the calculations in nim then
18:28:19FromDiscord<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:34FromDiscord<Yardanico> it makes sense to use Nim if numpy is only a part of your calculations
18:28:46FromDiscord<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:59FromDiscord<Yardanico> anyway, your code is wrong because you have to use np arrays there, not nim arrays
18:29:07FromDiscord<Yardanico> i'll try to fix it
18:29:08FromDiscord<Livingstone> ok
18:29:12FromDiscord<Livingstone> nah don't fix it
18:29:19FromDiscord<Livingstone> I wan't to do it myself
18:29:50FromDiscord<Yardanico> well if you're asking people to help then they'll help :P
18:30:31FromDiscord<Livingstone> where should I look for the function that python uses to do reshape?
18:31:15FromDiscord<Livingstone> I'm just left university so I don't know much about the wider world of coding
18:31:22FromDiscord<Livingstone> I can code a calculator but not much else
18:32:17FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQ7
18:33:59FromDiscord<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:07FromDiscord<Livingstone> guess I'll have to try something else
18:34:21FromDiscord<Yardanico> then check e.g. https://github.com/mratsim/Arraymancer
18:34:28FromDiscord<Livingstone> thanks for telling me
18:35:07FromDiscord<Yardanico> the thing with numpy is that even if it's a python module, it's mostly written in hand-optimized C
18:35:11FromDiscord<Yardanico> not in Python
18:36:28FromDiscord<Livingstone> I got a solution for this but honestly I just wanted to cheat
18:36:36FromDiscord<Livingstone> and take the easy way out
18:36:55FromDiscord<รєคɭ๓๏שє> @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:07FromDiscord<รєคɭ๓๏שє> (edit) "@ajusa ... I'll" added ""
18:37:52FromDiscord<Yardanico> @Livingstone out of curiosity, but "left university" you meant "finished"?
18:38:01FromDiscord<Livingstone> yah
18:38:04FromDiscord<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:13FromDiscord<ajusa> (edit) "quick," => "quick"
18:38:55FromDiscord<รєคɭ๓๏שє> Yeah, this got out of hand 😅 Will fix the situation soon
18:39:58FromDiscord<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:47FromDiscord<รєคɭ๓๏שє> Thank you so much :) I am glad a few people appreciate it.
18:41:14FromDiscord<รєคɭ๓๏שє> Btw you can look into my n4n6 repo for examples
18:41:28FromDiscord<รєคɭ๓๏שє> There is a PE parser there for example
18:42:48FromDiscord<รєคɭ๓๏שє> Hopefully giaco will share some of his parsers and we can grow a collection there ;)
18:43:49FromDiscord<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:33FromDiscord<รєคɭ๓๏שє> Great, this would be nice. It will help me document examples
18:44:52*azed quit (Ping timeout: 256 seconds)
18:52:07FromDiscord<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:36FromDiscord<รєคɭ๓๏שє> The obvious answer is "use testament" :ρ
18:54:24FromDiscord<รєคɭ๓๏שє> Recently it got proper documentation
18:54:36FromDiscord<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:30FromDiscord<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:24FromDiscord<รєคɭ๓๏שє> Ah ok 😅 Can't help you then. You probably know more about it at this point.
18:58:59FromDiscord<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:33FromDiscord<zidsal> apologies in advance if I just Schroedinbug your project
19:02:33FromDiscord<รєคɭ๓๏שє> But is it in a block? I generate them at the top level
19:03:32FromDiscord<zidsal> unless I am misunderstanding you're code at line 354 you call createParser in a block as its inside a suite
19:03:41FromDiscord<zidsal> (edit) "you're" => "your"
19:07:53*livcd is now known as pauwel_kwak
19:09:53FromDiscord<รєคɭ๓๏שє> But
19:10:15FromDiscord<รєคɭ๓๏שє> When the macros are expanded there is no block left
19:10:30FromDiscord<รєคɭ๓๏שє> Unittest is also a macro
19:11:03FromDiscord<รєคɭ๓๏שє> I mean unittests's `suite` macro
19:11:43*xioren joined #nim
19:11:57FromDiscord<รєคɭ๓๏שє> Also createParser doesn't produce a type. createVariantParser does though.
19:20:44xiorenI 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:23FromDiscord<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:28FromDiscord<Livingstone> sent a long message, see http://ix.io/2SQt
19:24:22FromDiscord<Yardanico> you need to declare mean_error as a new variable, and ^ needs a math import
19:24:29FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQu
19:24:39FromDiscord<Yardanico> also you don't need conversions to float here
19:25:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQv
19:25:59FromDiscord<Livingstone> thanks
19:28:46FromDiscord<Goel> Yardanico i need your help again with Raylib C / to Nim
19:29:08FromDiscord<Yardanico> well, it's better to describe the issue right away :)
19:30:13FromDiscord<Goel> sent a long message, see http://ix.io/2SQx
19:30:24FromDiscord<Goel> (edit) "http://ix.io/2SQx" => "http://ix.io/2SQy"
19:31:05FromDiscord<Yardanico> it's `true` not `True`
19:31:06FromDiscord<Goel> (edit) "http://ix.io/2SQy" => "http://ix.io/2SQz"
19:31:55FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SQA
19:32:47FromDiscord<Goel> Oh wow, yes this way smarter and shorter code, i'll use it
19:44:50FromDiscord<Livingstone> How do you initialize an empty sequence?
19:45:48FromDiscord<Solitude> `var s: seq[int]`↵badabing
19:46:13FromDiscord<Livingstone> ah ok I feel stupid
19:46:24FromDiscord<Solitude> https://media.discordapp.net/attachments/371759389889003532/820744692643397702/unknown.png
19:46:28FromDiscord<Solitude> wrong one
19:46:32FromDiscord<Solitude> https://nim-lang.org/docs/tut1.html
19:49:44xiorenDoes 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:25xiorenballoon*
19:51:31*haxscramper quit (Remote host closed the connection)
19:51:44ForumUpdaterBotNew 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:47ForumUpdaterBotNew 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:31FromDiscord<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:31FromDiscord<Yardanico> The problem is in the closure vs nimcall difference:
20:05:35FromDiscord<Yardanico> sent a code paste, see https://paste.rs/uBK
20:05:43FromDiscord<Yardanico> This will work fine if you're sure that your callbacks wouldn't capture anything
20:07:02FromDiscord<Yardanico> but otherwise it seems that nim doesn't autoconvert nimcall procs to closures if they're in varargs
20:10:00FromDiscord<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:08FromDiscord<DarkArctic> oh, and thanks by the way 🙂
20:16:59*azed joined #nim
20:20:31FromDiscord<dk> doesn't hurt if you report it
20:25:02FromDiscord<dom96> !eval echo(toSeq(1..5))
20:25:04NimBotCompile failed: /usercode/in.nim(1, 6) Error: undeclared identifier: 'toSeq'
20:25:19FromDiscord<dom96> !eval import sequtils; echo(toSeq(1..5))
20:25:21NimBot@[1, 2, 3, 4, 5]
20:27:43*allin joined #nim
20:30:44allinhi dom96
20:33:50*xioren quit (Quit: leaving)
20:35:00FromDiscord<dom96> hi
20:36:26allinLet's not put GuildenServer and httpbeast against each other
20:36:41allinFor most use cases httpbeast is ok
20:37:19allinbut GuildenStern is proves that other solutions are also possible in Nim
20:38:44allini.e. GuildenStern should be ok for the esoteric parallel problems that the OP had
20:41:40reversem3https://play.nim-lang.org/#ix=2SR1
20:41:51reversem3not sure why float32 doesn't work
20:41:56FromDiscord<Yardanico> ptr float32 vs float32
20:42:22FromDiscord<Yardanico> See https://github.com/nimgl/imgui/blob/master/tests/tnull.nim#L31 for an example on that proc
20:43:48FromDiscord<Yardanico> args are: string label, pointer to the float which will get the slider value, min float value, max float value
20:43:58FromDiscord<Yardanico> also optionally the sprintf formatting string and slider flags
20:44:09reversem3ok thanks
20:44:45allindon't send float, send unsafeAddr of variable holding the float
20:46:14reversem3ok so float.addr
20:46:47FromDiscord<Yardanico> yes, as in the example
20:52:39allindom96: 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:18allinI don't know any good websocket benchmarks. Maybe write one...
20:56:19*krux02_ is now known as krux02
21:04:15FromDiscord<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:57FromDiscord<dom96> there is plenty of web socket benchmarks already out there, for example https://github.com/hashrocket/websocket-shootout
21:05:03giaco_suggested trick to add version number defined in myproject.nimble into project to print it on program startup?
21:05:46FromDiscord<dom96> echo(NimbleVersion) should work, Nimble adds a `NimbleVersion` define when you compile using it
21:07:29giaco_I'm getting "Error: undeclared identifier: 'NimbleVersion'" in "nimble run"
21:08:06*rockcavera quit (Remote host closed the connection)
21:08:25FromDiscord<dom96> oh sorry, it's `NimblePkgVersion`
21:09:23giaco_Error: undeclared identifier: 'NimblePkgVersion'
21:09:54FromDiscord<dom96> can you run nimble with `--debug` and check what it's doing?
21:10:10giaco_sure
21:16:03allindom96: thanks for the link! nice to be able to inspect some competitors to Nim.
21:20:21giaco_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:32allinquite here. Here comes a quizz. What will compiler say about the next line. What should it say?...
21:22:40FromDiscord<ElegantBeef> What's the Nim version of `uint8_t const buffer` just a `ptr byte`?
21:22:50allinproc p(): int {.discardable.} = 1 ; p()
21:23:11FromDiscord<ElegantBeef> It'll live hapily
21:23:17allinno!
21:23:33FromDiscord<Yardanico> that code is not correct though
21:23:43allin??
21:23:45FromDiscord<Yardanico> it's parsed as proc p(): int {.discardable.} = (1; p())
21:23:47FromDiscord<ElegantBeef> yea you need` ()`
21:23:59FromDiscord<ElegantBeef> the `;` doesnt end the proc definition
21:24:02FromDiscord<Yardanico> exactly
21:24:03allinwait...
21:24:19FromDiscord<Yardanico> proc p(): int {.discardable.} = (result = 1); p()
21:24:19FromDiscord<Yardanico> works
21:25:32allinthat one the Nim community solved in 5 seconds
21:25:51FromDiscord<ElegantBeef> You'd hope people that use Nim know how it works 😛
21:25:58allinnext one is harder, but it is a two-liner:
21:26:15superbiawait a bit
21:26:22allinproc p(): int {.discardable.}
21:26:40allin{.gcsafe.}: p()
21:26:44allinhahaa?!
21:26:52FromDiscord<Yardanico> ????????????????
21:26:54FromDiscord<ElegantBeef> Error implementation expected
21:27:03FromDiscord<Yardanico> this needs an implementation, yes
21:27:03FromDiscord<ElegantBeef> But anyway
21:27:07FromDiscord<Yardanico> @allin are you okay?
21:27:13FromDiscord<Yardanico> your questions are... strange
21:27:23FromDiscord<Yardanico> make it's better to take a break
21:27:23FromDiscord<ElegantBeef> Yard got any clue how to do that C interop? 😄
21:27:31FromDiscord<Yardanico> of course (not)
21:27:33FromDiscord<Yardanico> give me the code
21:27:34FromDiscord<ElegantBeef> Lol
21:27:36FromDiscord<Yardanico> ah that one
21:27:53FromDiscord<ElegantBeef> I dont know C well but i though a `ptr byte` would be the same
21:27:55FromDiscord<Yardanico> I mean you can try ptr UncheckedArray[uint8]
21:28:02FromDiscord<ElegantBeef> Yea i tried but it complained
21:28:10FromDiscord<Yardanico> complained like what?
21:28:20FromDiscord<ElegantBeef> https://hatebin.com/cfndcemirs
21:28:52allinsorry, too wild, of cours first line must be:
21:28:56allinproc p(): int {.discardable.} = 1
21:29:10FromDiscord<ElegantBeef> You know you can download the compiler and see the results right?
21:29:29allinthis is a late night quizz
21:29:41FromDiscord<dk> !eval echo "dont even need to download the compiler"
21:29:44NimBotdont even need to download the compiler
21:29:57FromDiscord<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:15giaco_dom96 sorry I was missing 'const NimblePkgVersion {.strdefine.} = ""'
21:31:39allincorrect answer: Error: expression ' {.gcsafe.}: p()' is of type 'int' and has to be used (or discarded)
21:31:52FromDiscord<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:05allin(parsing error)
21:32:16FromDiscord<Yardanico> (that's not a parsing error but whatever)
21:32:30FromDiscord<ElegantBeef> So `byte, myWrappedType, ptr byte, uint16` is what i've got
21:32:37allincompiler error anyway
21:33:46FromDiscord<ElegantBeef> Ok so i did have it returning an uint16 which was wrong but still same error
21:35:01FromDiscord<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:02giaco_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:41FromDiscord<ElegantBeef> For ints, strs, and boolsyou can do https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas
21:48:11allinI 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:51allinMaybe you should use a .cfg file?
21:51:09giaco_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:05FromDiscord<Yardanico> yes, you can import nim files from .nimble
21:52:25allinwwhat?
21:52:36FromDiscord<Yardanico> .nimble files are nimscript
21:52:45FromDiscord<Yardanico> https://nim-lang.org/docs/nims.html https://nim-lang.org/docs/nimscript.html
21:53:08FromDiscord<Yardanico> you can use quite a lot of stdlib modules in nimscript even
21:53:17FromDiscord<Yardanico> (it uses the same VM that is used for compile-time code execution)
21:53:39giaco_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:51allinyou live, you learn...
21:54:27FromDiscord<Yardanico> @giaco_ did you export them?
21:54:41giaco_yes
21:54:45FromDiscord<Yardanico> then it should work
21:55:00FromDiscord<Yardanico> see e.g. https://github.com/h3rald/hastyscribe/blob/master/hastyscribe.nimble
21:55:02FromDiscord<dk> try including
21:55:06FromDiscord<Yardanico> no need to include
21:57:16allinif someone puts a rmDir command into .nimble file...
21:57:37FromDiscord<Yardanico> that's no different to most packages' PMs
21:57:48giaco_ah, ok, I have to copy the vars included with import to the variables defined in the nimble file
21:57:48FromDiscord<Yardanico> you can do the same with npm or whatever
21:57:54*kenran quit (Remote host closed the connection)
21:58:19FromDiscord<Solitude> no one stops you from putting `exec("rm -rf ~")` in static blocks
21:58:23giaco_I was just importing the nim file that defines "version", "author", etc
21:58:56FromDiscord<Yardanico> "defines"?
21:58:58FromDiscord<Yardanico> or actual constants?
21:59:04FromDiscord<Yardanico> const myConst = "hello"
21:59:11FromDiscord<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:24giaco_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:26giaco_no, I still can't succeed in that
22:13:11allinI have version number in nimble and version number on .nim and tell myself to update both at the same time
22:13:35FromDiscord<Yardanico> you can have NimplePkgVersions
22:20:29giaco_ok solved, I was just creating a mess by naming shared file "version.nim"
22:20:36giaco_now it works nicely
22:22:38FromDiscord<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:15allinnaming is one of the hardest CS problems
22:25:20allin(apart from 'nim doc')
22:26:00FromDiscord<Yardanico> what about https://github.com/Yardanico/nuglifier/blob/master/example_output/example_case.nim
22:26:08FromDiscord<Yardanico> (and yes that code is compilable if you download the file directly)
22:27:18FromDiscord<Yardanico> just dont show it to nim newbies
22:28:37FromDiscord<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:02allinI guess there's the hidden `exec("rm -rf ~")` gem, if someone tries to compile it...
22:29:08FromDiscord<Yardanico> sadly no :)
22:29:34FromDiscord<Yardanico> but you can find out for yourself, hehe
22:29:39allinNot bold enough to try...
22:29:50FromDiscord<Yardanico> https://forum.nim-lang.org/t/6497
22:30:08giaco_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:21FromDiscord<Yardanico> there's CompileTime and CompileDate
22:30:23FromDiscord<Yardanico> in system
22:30:29FromDiscord<Yardanico> https://nim-lang.org/docs/system.html#CompileDate
22:30:46giaco_that's magic!
22:36:20allinAltough APL was my very first language, I prefer readibility over terseness.
22:37:04allinFor example, @ is a mistake in Nim (compared to newSeq or something)
22:37:56FromDiscord<ElegantBeef> Well then use `newSeq` 😄
22:38:19FromDiscord<Yardanico> @allin fun fact: @ is an operator convert something to a seq
22:38:24FromDiscord<Yardanico> like a string or an array
22:38:44FromDiscord<ElegantBeef> Nim is nothing if not flexible
22:38:52FromDiscord<ElegantBeef> Thought you were going to bed yard
22:39:11FromDiscord<Yardanico> i was going to watch anime and go to bed
22:39:15FromDiscord<Yardanico> oops
22:39:34FromDiscord<Yardanico> \s/anime/historical documentaries
22:40:20allinAnother mistake was to use [] for pointer deference
22:40:49FromDiscord<ElegantBeef> TudHidMouseReport
22:40:52FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual_experimental.html#automatic-dereferencing
22:40:54FromDiscord<Yardanico> another mistake was `***** ** * * *`
22:40:55FromDiscord<ElegantBeef> Didnt copy
22:41:21FromDiscord<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:04allin 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:25FromDiscord<ElegantBeef> I disagree `@[]` isnt that scary
22:43:29FromDiscord<Solitude> matter most for who?
22:43:30giaco_Yardanico I've just found strenc. That's a quite impressive hack
22:43:32FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2SRS
22:43:44FromDiscord<ElegantBeef> There we go we made it more readable
22:43:50FromDiscord<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:54FromDiscord<Yardanico> also it's quite broken
22:44:21FromDiscord<Yardanico> 4 issues for 24sloc = 1 issue per 6 sloc
22:44:39giaco_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:34allinSolitude: if the barrier to entry (your first emotions with the language) is too high, many souls may be lost.
22:50:59allinNim is one of the most readable languages but then the exceptions hurt even more
22:52:19allinTo be honest, I have avoided Haskell and Rust just because the code looks so unreadable...
22:52:26giaco_just compare readability of nim with other system-level languages
22:52:37giaco_not "every language"
22:54:50allinWell my point was/is that @ and [] operators are not up the readibility level of Nim in general
22:55:09FromDiscord<Solitude> i dont see how they are not
22:56:03*tane quit (Quit: Leaving)
22:56:27FromDiscord<ElegantBeef> You act like dereferencing is a common thing in nim
22:56:35*fputs quit (Quit: WeeChat 3.1)
22:57:38allin[] is problematic because it has multiple meanings
22:58:29FromDiscord<mratsim> `[]` is meh in macros and templates
22:59:12allin@[] does not compute for me, but I might be an exception
22:59:44allinhi mratsim
23:01:05FromDiscord<mratsim> Personally I've never used the `@` operator except in tests
23:04:35allinI see upcoming orc-friendly channel implementation based on Weave...
23:04:38FromDiscord<ElegantBeef> Yea i've rarely used it aswell
23:05:34allinCould we get a stable threapool also?
23:06:10allin(Without work stealing, that is)
23:06:14FromDiscord<ElegantBeef> What do you mean? We already have stable threadpool?
23:06:42FromDiscord<mratsim> work-stealing is really super simple.
23:07:10allinunfortunately it is unstable API
23:07:14FromDiscord<mratsim> the current Nim channels are in better state than the current threadpool :p
23:07:47FromDiscord<mratsim> the threadpool API is somewhat OK, at least spawn and `^` and Flowvar: https://github.com/nim-lang/RFCs/issues/347
23:08:10FromDiscord<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:34allinBut work-stealing AND blocking threads is the mother of all evil
23:09:01FromDiscord<mratsim> not really
23:09:18FromDiscord<mratsim> other threads can pick from the blocked queue
23:09:21allinwell I'd love to see the words "unstable API" disappear from threadpool docs somehow
23:10:36FromDiscord<mratsim> also it's better to create a blocking_pool dedicated for blocking threads.
23:11:04FromDiscord<mratsim> and this one should be managed by the event loop
23:11:06allinWell then we need cooperative threads, that inform that they have sync points?
23:11:16FromDiscord<mratsim> because only IO can have blocking calls.
23:11:45allinLike in every for loop iteration...
23:12:53allinRight - we definitely could have two kinds of pools
23:13:13*hyiltiz quit (Ping timeout: 260 seconds)
23:13:32allinBut 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:41giaco_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:08allinWell every long running procedure that does not have sync points is blocking
23:16:05allin(Blocking in the sense that it stole work from other thread)
23:16:10*superbia quit (Ping timeout: 260 seconds)
23:16:44ForumUpdaterBotNew post on r/nim by nuL808: Seq of procs, see https://reddit.com/r/nim/comments/m56ypt/seq_of_procs/
23:18:19allinConcerning 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:52allinOr let's say one consumer, otherwise might be hard to prove in the first place...
23:21:19allinIn other words: does the channel remember the order of the waiting threads
23:25:21allinIf 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:08allinif this invariant does not hold, it must be stated in the docs...
23:34:06allinsleep time, bye
23:35:01allinquit
23:35:30*allin quit (Quit: leaving)
23:58:04*kuon joined #nim