<< 13-03-2021 >>

00:08:39*sz0 joined #nim
00:09:38*tane quit (Quit: Leaving)
00:15:04*krux02 quit (Remote host closed the connection)
00:30:31FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SCy
00:31:10FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SCz
00:36:58FromDiscord<InventorMatt> it's because known_subs is a global variable. if you turn it into a const it works or if you add that as a parameter to your func that would also solve it
00:42:15FromDiscord<Anonymous Poet> ahh, true, that makes sense
00:42:17FromDiscord<Anonymous Poet> thanks
00:45:34*lritter joined #nim
01:01:50*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:02:10*njoseph joined #nim
01:12:06FromDiscord<exelotl> I guess it's that way because even though _this_ let variable is completely immutable, in general let variables only have shallow immutability
01:22:26*rockcavera joined #nim
01:31:13*rockcavera is now known as Guest18711
01:31:14*rockcavera joined #nim
01:31:27*rockcavera quit (Remote host closed the connection)
01:34:00*Guest18711 quit (Ping timeout: 246 seconds)
01:38:54giaco_trying to deploy a nim program compiled with -d:ssl into a docker container, I'm getting "could not load: libcrypto.so(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|)"
01:39:07giaco_docker container is ubuntu 20.04
01:42:35giaco_nevermind, image was missing openssl
01:46:53*rockcavera joined #nim
01:56:05PrestigeIs there a way to get better info for failed tests with testament? Like if I doAssert foo == "myStr" I just get an error about the exit codes not matching, lol
01:56:46PrestigeI'd even settle for allowing echo statements in my tests, but they aren't output either it seems
02:08:21*lritter quit (Ping timeout: 264 seconds)
02:09:05*lritter joined #nim
02:21:41FromGitter<timotheecour> unittest.check,require
02:33:53FromDiscord<ElegantBeef> Eh i got nim code firing on the pico now, though the compiler didnt include the stdlib
02:35:49*rockcavera quit (Remote host closed the connection)
02:45:59Prestigehm unittest is much better than just using testament it seems, thanks
02:46:02saem@queersorceress: the vscode extension I ported is written in Nim, has lots of imports for the vscode and node APIs.
02:49:41PrestigeWould be nice if there was a way to mock functions
02:49:48FromDiscord<ElegantBeef> Just call them names
02:49:55PrestigeLol
02:50:16saemAll could define it locally in the test and that would resolve first, right?
02:51:09saemI mean you're naming things then calling them, so going with beef was right.
02:51:41FromDiscord<ElegantBeef> Doubly good humour even when fighting a cmake, i'm a comedic genius
02:52:54PrestigeNot sure I follow - I mean if I call foo and foo calls bar, I want to replace what bar is doing (and be able to check if it was invoked with the expected args)
02:53:22saemOh, not so much then. I was thinking top level.
02:53:41FromDiscord<ElegantBeef> Well you can always do `import x except y` and make a replicated proc signature with your hard coded response
02:54:05saemBut what if it's an import importing something?
02:54:12saemI think that's kinda the case
02:54:30PrestigeI'm think the same file - I'll write a little example
02:54:37FromDiscord<ElegantBeef> I dont know
02:54:41saemSomething something (pie in the sky) first class modules.
02:57:29FromDiscord<ElegantBeef> Dont make me mention forward declaration
02:58:18Prestigehttps://play.nim-lang.org/#ix=2SDa
02:58:20PrestigeYeah
02:58:33PrestigeI don't think anything exists to do this atm but it would be nice
02:59:28FromDiscord<ElegantBeef> Ah so i figured my cmake solution gotta add each source file "manually"
03:00:05saemWeeeeelll you could do terrible things with macros, right?
03:00:25saemI meant that for Prestige
03:00:42saemBut it's a pretty sure bet.
03:01:54Prestigesaem: possibly but I cbf to figure that all out
03:02:29*Prestige throws all the tests out the window
03:04:38saemLike write the mock proc, then the macro to include the module but blow away the mocked procs from the AST. It's pretty terrible
03:06:01PrestigeYeah, something like that. Also would have to keep track of invocations to any mocks
03:06:34Prestigemaybe first line of a mock just adds it to a table or some data structure
03:09:14PrestigeThat would actually work pretty well. Wonder if there's a more elegant solution
03:12:00FromDiscord<ElegantBeef> What's the best way to make sure the GC is working on embedded hardware? Just allocate a shit ton? 😛
03:17:11*abm quit (Quit: Leaving)
03:32:01*xioren quit (Quit: leaving)
03:55:04FromDiscord<Hi02Hi> i think https://nim-lang.org/docs/system.html#GC_getStatistics
04:14:50*spiderstew joined #nim
04:16:50*D_ quit (Ping timeout: 264 seconds)
04:17:24*spiderstew_ quit (Ping timeout: 256 seconds)
04:19:08*rockcavera joined #nim
05:25:53*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:26:02*njoseph joined #nim
05:26:48*njoseph quit (Client Quit)
05:26:56*njoseph joined #nim
05:29:31FromDiscord<fenrave> https://thehackernews.com/2021/03/researchers-spotted-malware-written-in.html
05:29:35FromDiscord<fenrave> Lmao
05:36:37PrestigeOh no, they found out
05:47:54ForumUpdaterBotNew post on r/nim by Thor-x86_128: Is there any "absolute" selling point of NIM lang?, see https://reddit.com/r/nim/comments/m407qi/is_there_any_absolute_selling_point_of_nim_lang/
05:49:09ForumUpdaterBotNew thread by Drkameleon: Templating dynlib calls, see https://forum.nim-lang.org/t/7617
05:58:07*fputs quit (Quit: WeeChat 3.0.1)
06:45:25*mmohammadi9812 joined #nim
07:02:43*superbia joined #nim
07:04:04sekao[m]How would I check if I'm compiling on an x86 or arm processor in a `when` condition?
07:17:46sekao[m]Ah I figured it out, it's defined(amd64) and defined(arm)
07:21:50*waleee-cl quit (Quit: Connection closed for inactivity)
07:23:35ForumUpdaterBotNew thread by Drkameleon: Splat operator in Nim?, see https://forum.nim-lang.org/t/7618
07:41:17PrestigeI know you can't use const to create a regex pattern but what's with this error if you try running it? https://play.nim-lang.org/#ix=2SEh
07:44:40FromDiscord<ElegantBeef> The Vm doesnt support casting many types
07:46:10PrestigeI expected a very different error
07:46:35FromDiscord<ElegantBeef> A "This module isnt supported on the NimVm"?
07:47:56PrestigeMore like, regex patterns cannot be defined at compile time
07:48:13*mmohammadi9812 quit (Quit: Leaving)
07:51:06FromDiscord<ElegantBeef> Well go make a PR 😛
07:52:15PrestigeMaybe I'll open an issue
08:10:08*rockcavera quit (Killed (orwell.freenode.net (Nickname regained by services)))
08:10:09*rockcavera joined #nim
08:19:22*haxscramper joined #nim
08:27:10*gmaggior joined #nim
09:00:09*Yardanico[m] quit (Quit: Idle for 30+ days)
09:00:09*alex[m]21 quit (Quit: Idle for 30+ days)
09:30:34*lritter quit (Ping timeout: 276 seconds)
09:30:40*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
09:31:08*Gustavo6046 joined #nim
09:32:12*vicfred quit (Quit: Leaving)
10:01:31*lritter joined #nim
10:19:38*lritter quit (Ping timeout: 245 seconds)
10:24:55*himu joined #nim
10:28:18FromDiscord<hobbledehoy> is it possible to write bindings to c macros?
10:30:22FromDiscord<mratsim> yes
10:30:29FromDiscord<mratsim> they bind like procs
10:31:59FromDiscord<mratsim> use {.nodecl, importc: "YOUR_MACRO".}, nodecl is necessary so that Nim doesn't produce a proc definition
10:32:05*lritter joined #nim
10:32:08FromDiscord<mratsim> (edit) "{.nodecl," => "`{.nodecl," | ""YOUR_MACRO".}," => ""YOUR_MACRO".}`,"
10:32:23FromDiscord<mratsim> (edit) "use `{.nodecl, ... importc:" added "header: "yourheader.h","
10:32:45FromDiscord<ElegantBeef> Header implies that no?
10:32:54FromDiscord<mratsim> maybe
10:33:32FromDiscord<ElegantBeef> I used it today with the pico stdlib so i hope so 😄
10:33:37FromDiscord<hobbledehoy> thanks a million↵thought I had to do something fancy
10:33:47FromDiscord<ElegantBeef> Nah it's super simple
10:33:53FromDiscord<mratsim> It's fancily simple.
10:34:01FromDiscord<ElegantBeef> Assuming the types are primitives
10:34:04FromDiscord<ElegantBeef> Bit more work if they arent
10:34:07FromDiscord<mratsim> Repeat after me "Nim has the best C FFI"
10:34:14FromDiscord<ElegantBeef> Zig has the best C FFI
10:34:16FromDiscord<hobbledehoy> Nim has the best C FFI
10:34:17FromDiscord<ElegantBeef> Shit that's not it
10:34:24FromDiscord<mratsim> V has the best C FFI?
10:34:48FromDiscord<ElegantBeef> Doesnt Zig let you just include C code and call it as if it's native Zig?
10:35:05FromDiscord<mratsim> you can do the same with emit or {.compile: foo.c.}
10:35:14FromDiscord<ElegantBeef> Well you still need Nim bindings
10:35:32FromDiscord<mratsim> ah you mean the compiler autogen the bindings?
10:35:38FromDiscord<mratsim> nimterop does that.
10:35:42FromDiscord<mratsim> as a library
10:35:55FromDiscord<mratsim> or even fragments for C++ code.
10:35:55FromDiscord<haxscramper> I don't think it is the right approach though
10:35:58FromDiscord<ElegantBeef> Yea i know that, but it's not apart of the language 😄
10:36:05FromDiscord<mratsim> stuffing things in the compiler is last resort
10:36:18FromDiscord<haxscramper> Too much implicit behavior, and it is not very clear what kind of code you are getting in result
10:36:34FromDiscord<haxscramper> So nim approach when you have to write explicit binding types is better
10:36:36FromDiscord<ElegantBeef> Oh i agree i was just commenting on how Zig does it
10:36:46FromDiscord<haxscramper> Though I thought about it
10:36:53FromDiscord<ElegantBeef> Like even for the Pico-sdk i did some idiomatic things
10:37:04FromDiscord<ElegantBeef> Like using a `distinct cuint` for the gpio pins
10:37:14FromDiscord<haxscramper> It wouldn't be terribly complicated to hack in `hcparse` as a separate semantic pass before semcheck and see how it goes
10:37:57FromDiscord<ElegantBeef> Also is a cuint the same as a uint32_t in C land?
10:37:58FromDiscord<haxscramper> So it won't be particularly difficult to write a tool that works just like nim compiler, but supports auto-import of everything from C/C++/ObjC
10:39:10FromDiscord<mratsim> In reply to @ElegantBeef "Also is a cuint": not on 16-bit arch
10:39:28FromDiscord<ElegantBeef> Ah so what's the proper datatype to put there? A `uint32`?
10:39:33FromDiscord<mratsim> the sole guarantee is that it's at least 16 bits iirc
10:40:03FromDiscord<mratsim> basically use the type used by your backend.
10:40:15FromDiscord<ElegantBeef> I mean i'm working with the pico, so it's fixed hardware just dont want any undesired behaviour
10:40:27FromDiscord<ElegantBeef> well it uses `uint32_t` so use a `uint32`?
10:40:38FromDiscord<mratsim> yes
10:40:59FromDiscord<mratsim> no undesired behavior? That's where all the fun is
10:41:10FromDiscord<KnorrFG> is there a syntax for "import everything from this module except x"
10:41:20FromDiscord<ElegantBeef> `import x except y`
10:41:20FromDiscord<mratsim> import foo except x
10:41:25FromDiscord<ElegantBeef> So close with your english
10:41:26FromDiscord<KnorrFG> cool 😄
10:41:44FromDiscord<รєคɭ๓๏שє> Guys I am finally implementing sum parsers for binarylang :))
10:42:31FromDiscord<รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SF3
10:42:36FromDiscord<ElegantBeef> Also is there any documentation in what `panicoveride.nim` is supposed to do
10:42:48FromDiscord<ElegantBeef> Write now i just print the message and quit, but yea
10:42:50FromDiscord<mratsim> that typo is glaring at me
10:43:28FromDiscord<ElegantBeef> "Write" or "overide" 😛
10:50:05FromDiscord<KnorrFG> btw, thank you guys, this server is awesome 🙂
11:00:11ForumUpdaterBotNew thread by Hronro: Why I can't unmarshal JSON with spaces in the JSON keys?, see https://forum.nim-lang.org/t/7619
11:06:15FromDiscord<รєคɭ๓๏שє> Is there a way to export object fields after they are defined?
11:07:39FromDiscord<รєคɭ๓๏שє> sent a code paste, see https://play.nim-lang.org/#ix=2SFb
11:11:26*himu quit (Ping timeout: 264 seconds)
11:12:35FromDiscord<รєคɭ๓๏שє> someone? :D
11:13:09FromDiscord<haxscramper> I doubt it
11:13:41FromDiscord<haxscramper> But you can try, it should be faster anyway
11:14:18liblq-dev@sealmove there isn't
11:14:21FromDiscord<haxscramper> > `Error: cannot export: MyType.x`
11:15:58FromDiscord<รєคɭ๓๏שє> hmm, ok :|
11:16:00FromDiscord<รєคɭ๓๏שє> thx
11:17:11*himu joined #nim
11:17:29*himu quit (Client Quit)
11:18:05FromDiscord<รєคɭ๓๏שє> so I macro needs to decide whether to export the symbols or not, based on its input
11:18:12FromDiscord<รєคɭ๓๏שє> so my
11:18:49*superbia quit (Quit: WeeChat 3.1)
11:26:14FromDiscord<รєคɭ๓๏שє> oh, I have a nice idea
11:26:52FromDiscord<รєคɭ๓๏שє> I can use both `->` and `=>`. If `->` is used, field is not exported. If `=>` is used, field will be exported.
11:27:06FromDiscord<mratsim> how grep-able is this?
11:27:18FromDiscord<KnorrFG> i just split some code into multiple modules, and suddenly i get this error, without an information which line is causing it, can someone explain this to me? `Error: request to generate code for .compileTime proc: Lit`
11:27:23FromDiscord<mratsim> symbols always cause issues with docs
11:28:37FromDiscord<KnorrFG> (edit) "i just split some code into multiple modules, and suddenly i get this error, without an information which line is causing it, can someone explain this to me? `Error: request to generate code for .compileTime proc: Lit` ... " added " (it says system / dollars but i mean in my code)"
11:29:42FromDiscord<รєคɭ๓๏שє> In reply to @mratsim "how grep-able is this?": @mratsim were you commenting on `->`/`=>` or to someone else?
11:29:51FromDiscord<mratsim> on -> and =>
11:30:10FromDiscord<mratsim> especially on github, symbols are awful to search for
11:30:16FromDiscord<mratsim> and google
11:30:41FromDiscord<รєคɭ๓๏שє> hmm, interesting point
11:31:36FromDiscord<รєคɭ๓๏שє> @KnorrFG You will see this error a lot as you dive into Nim
11:33:47FromDiscord<รєคɭ๓๏שє> @mratsim Do you have something to suggest instead of arrow-like operators? I thought of using those because I need very low precedence.
11:34:04FromDiscord<mratsim> Just make those easy to find
11:34:26FromDiscord<mratsim> have a section call "arrow operator" in your doc
11:34:38FromDiscord<mratsim> since that may be something people search for, and would remember
11:34:48FromDiscord<รєคɭ๓๏שє> oh, ok! thanks for the tip
11:34:56FromDiscord<mratsim> In reply to @KnorrFG "i just split some": are you using {.compileTime.} proc?
11:35:28*lritter quit (Ping timeout: 245 seconds)
11:35:30FromDiscord<KnorrFG> nope, nowhere
11:35:32*PMunch joined #nim
11:35:43*clyybber joined #nim
11:41:20FromDiscord<haxscramper> Maybe some compile-time type like `NimNode`?
11:41:44FromDiscord<haxscramper> If the proc returns/takes `NimNode` or any type that it uses it might cause this error
11:42:05FromDiscord<haxscramper> Any type that has a field of type `NimNode`
11:42:19*Vladar joined #nim
11:43:06FromDiscord<KnorrFG> yes, i have those ^^
11:43:17FromDiscord<KnorrFG> the intermediate representation u recomended me to make
11:43:36FromDiscord<KnorrFG> what exactly is the meaning of the error, why was it trying to generate code?
11:44:25FromDiscord<KnorrFG> sent a code paste, see https://play.nim-lang.org/#ix=2SFg
11:44:34FromDiscord<KnorrFG> i see the 11 before the compilation fails
11:44:49FromDiscord<KnorrFG> i also have echos in the macro code, and see all of them before the echos in the test
11:46:40*leorize quit (Remote host closed the connection)
11:47:11*leorize joined #nim
11:47:48PMunchI plan on streaming another "chapter" in the keyboard firmware programming soon
11:48:04PMunchGet some macros in there to optimise some things
11:57:30PMunchAh, nevermind..
11:57:36PMunchI just got a visitor :P
11:58:35*PMunch quit (Quit: leaving)
11:59:42FromDiscord<KnorrFG> i wish i would have been more diligent with the commits .... damn
12:05:33FromDiscord<haxscramper> In reply to @KnorrFG "what exactly is the": Most likely you are trying to call compile-time only proc at runtime somewhere
12:07:07FromDiscord<KnorrFG> and a compile time proc is anything that interacts with a nim node?
12:11:16FromDiscord<haxscramper> correct
12:11:26FromDiscord<haxscramper> `NimNode` value can only exist at compile-time.
12:13:16FromDiscord<KnorrFG> `Warning: method has lock level 0, but another method has <unknown> [LockLevel]` could that somehow be related?
12:14:39FromDiscord<haxscramper> When I was testing macro-generated values I had to declare a separate type, that I generated literals and then tested them. Or put all of your value tests in `macro()` body
12:15:03FromDiscord<haxscramper> Like this https://github.com/nim-lang/fusion/blob/master/tests/tmatching.nim#L48
12:30:49FromDiscord<KnorrFG> I found the reason, but I dont understand whats causing it.↵` check ui.children[0].Rectangle.color == color(0, 255, 255, 255)` this line is causing it. but if i change the `check` to an `echo` it compiles, and runs, and prints true.
12:34:58FromDiscord<haxscramper> `check` does some compile-time introspection for the expression (like splitting `==` on LHS/RHS to show values of the expressions for example), and this might cause your errors
12:35:04FromDiscord<haxscramper> (edit) "errors" => "error"
12:35:25FromDiscord<haxscramper> Try `doAssert a == b` then,
12:36:19FromDiscord<KnorrFG> yep, works
12:37:03FromDiscord<KnorrFG> hmmm, this has cost me a lot of time now ... a little depressing
12:37:21FromDiscord<KnorrFG> but thanks for the help
12:38:22FromDiscord<mratsim> I tend to avoid check more and more now
12:45:01FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2SFD
12:45:18FromDiscord<haxscramper> Not exactly this code, but close enough
12:52:55giaco_my async server application just crashed after running for 15h with "Error: unhandled exception: Too many open files", but I'm not opening any file in my program. Maybe I'm not closing sockets?
12:53:55giaco_crash happened in "lib/pure/asyncfutures.nim(372)"
12:56:12FromDiscord<mratsim> probably a file descriptor link
13:01:17FromDiscord<no name fits> With fear of this being a stupid question, which editor can I try that's like VSCode for Nim? I just want to try something else
13:01:34FromDiscord<Rika> why?
13:01:46FromDiscord<Rika> the "next best" thing would be neovim
13:02:09FromDiscord<no name fits> Sometimes VSCode janks on me with my Nim extension and it's just frustrating trying to get the autocomplete to work again
13:02:39FromDiscord<no name fits> I end up reading the libs manually rather than typing something like "getWhatever" and see what pops up
13:03:09FromDiscord<Rika> well i dont use autocomplete so i cant sympathise
13:03:14FromDiscord<no name fits> I don't know if that makes sense. It just sucks when working with Vulkan because it has so many enums and I can never remember the full names
13:03:31FromDiscord<no name fits> But I know what they all start with, and then I just browse the list for the right now
13:03:35FromDiscord<no name fits> (edit) "now" => "one"
13:04:17FromDiscord<no name fits> Maybe I should get used to doing the same, I dunno
13:04:21*Oddmonger quit (*.net *.split)
13:04:21*ForumUpdaterBot quit (*.net *.split)
13:04:22*ebb quit (*.net *.split)
13:04:22*jxy_ quit (*.net *.split)
13:04:22*Onionhammer quit (*.net *.split)
13:04:23*CcxWrk quit (*.net *.split)
13:04:23*lain quit (*.net *.split)
13:04:23*jken quit (*.net *.split)
13:04:23*ldlework quit (*.net *.split)
13:04:23*GaveUp quit (*.net *.split)
13:04:29*shodan45 quit (*.net *.split)
13:04:29FromDiscord<no name fits> It just seemed handy
13:04:29*shodan45 joined #nim
13:04:29FromDiscord<no name fits> When it works
13:04:31*GaveUp joined #nim
13:04:36*jxy joined #nim
13:04:38*CcxWrk joined #nim
13:04:40*ebb joined #nim
13:04:41*Onionhammer joined #nim
13:04:57*Oddmonger joined #nim
13:05:11FromDiscord<Rika> have fun trying to learn vim then 😛
13:05:15*lain joined #nim
13:05:15*ForumUpdaterBot joined #nim
13:05:22FromDiscord<Rika> the neovim plugin works pretty well
13:05:33*jken joined #nim
13:05:38*Oddmonger quit (Changing host)
13:05:38*Oddmonger joined #nim
13:05:38FromDiscord<no name fits> I can look like a hackerman in public then
13:06:29FromDiscord<haxscramper> @no name fits you can just go from top to first to last on this list https://media.discordapp.net/attachments/371759389889003532/820281665388544020/08.png
13:06:41FromDiscord<no name fits> Oh thanks!!
13:06:53FromDiscord<haxscramper> It is from https://nim-lang.org/blog/2021/01/20/community-survey-results-2020.html
13:06:54FromDiscord<no name fits> I just want to reiterate how helpful this community is
13:07:14FromDiscord<Rika> ngl expected more emacs users
13:07:44*ldlework joined #nim
13:10:46giaco_mratsim what do you mean?
13:43:13FromDiscord<no name fits> I've already managed to freeze my vim twice with ^Z already haha!
13:43:24FromDiscord<no name fits> Muscle memory
13:43:36FromDiscord<Rika> freeze? how?
13:43:48FromDiscord<no name fits> ^Z suspends the process
13:43:48FromDiscord<Rika> you mean put to background?
13:43:52FromDiscord<Rika> yeah just fg
13:43:55FromDiscord<no name fits> Yeah
13:44:46FromDiscord<Rika> i use ^z too much, i should use term buffers more but they just dont work as well as a real terminal...
13:47:03FromDiscord<no name fits> I have no idea what any of that is, except for a real terminal I guess
13:47:49FromDiscord<Rika> term buffer is what you get when you `:term`
13:48:15FromDiscord<no name fits> ah!
13:54:14federico3FOSSASIA Summit 2021 is ongoing this weekend https://www.youtube.com/watch?v=wRlh7ucic9U
14:02:56*D_ joined #nim
14:06:15*D_ quit (Client Quit)
14:07:21*D_ joined #nim
14:14:48FromDiscord<Yardanico> @giaco_ do you use httpclient in your code?
14:21:14FromDiscord<mratsim> In reply to @giaco_ "mratsim what do you": file descriptor leak
14:21:24FromDiscord<mratsim> not link
14:27:06FromGitter<HJarausch_gitlab> Is there something like a *C-style static* variable? E.g.
14:27:22*rockcavera quit (Remote host closed the connection)
14:28:19FromGitter<HJarausch_gitlab> Replace ⏎ ⏎ ```var level = 0 ⏎ proc traverse[T](Tr:RBTree[T]) = ⏎ inc(level) ⏎ ... ⏎ dec(level)``` ⏎ ⏎ by having ``level`` within the proc? ... [https://gitter.im/nim-lang/Nim?at=604ccc0395e23446e430e262]
14:29:45FromDiscord<haxscramper> {.global.} annotation for variable
14:30:33FromDiscord<Yardanico> Yeah, but it's better to not use it when you can
14:31:12FromDiscord<haxscramper> Is there anything else besides it's incompatibility with {.inline.}?
14:32:12FromDiscord<Yardanico> In reply to @haxscramper "Is there anything else": It's the same as with defer, it can affect a lot of stuff in weird ways :) there are also arc bugs with it
14:32:39FromGitter<HJarausch_gitlab> But I see only two alternatives, both of which are not optimal (IMHO) ⏎ ⏎ 1) a global variable ⏎ 2) a additional paramter [https://gitter.im/nim-lang/Nim?at=604ccd0795e23446e430e520]
14:33:28FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/15005
14:33:52FromDiscord<Yardanico> @HJarausch an additional parameter would be the best way
14:38:13FromGitter<HJarausch_gitlab> Indeed, --gc:org breaks my example ⏎ https://play.nim-lang.org/#ix=2SGa ⏎ ⏎ with ⏎ ... [https://gitter.im/nim-lang/Nim?at=604cce5544f5a454a47405fe]
14:53:18giaco_yardanico, yeah, I'm watching open sockets now and if seems like a lot of httpclient sockets
14:53:34FromDiscord<Yardanico> You need to close httpclient instance after usage
14:53:47FromDiscord<Yardanico> client.close()
14:54:44FromDiscord<Goel> Gedit has every single snippet for every language except for Nim. Where can i download and import the snippets for Nim?
14:56:27FromDiscord<Yardanico> no clue, if it's not in gedit I don't know where you can find them
14:56:37FromDiscord<Yardanico> Make them yourself I guess? What kind of snippets?
14:59:23FromDiscord<Goel> Maybe i can import the ones im using in VSCode?
15:01:01*rockcavera joined #nim
15:01:23giaco_thanks
15:12:11*shmorgle quit (Quit: [TalkSoup] via NEXTSPACE)
15:14:23*shmorgle joined #nim
15:17:54*NimBot joined #nim
15:27:51saemMorning
15:32:42saem@no name fits: unfortunately that's not the editor or plugin. It's most likely nimsuggest. If you can create a narrowed reproducible test case then I might be able to fix it.
15:34:59FromDiscord<mario2> How can a perl programmer adjust to nim? Can I have some degree of perl-isms with nim?
15:36:28FromDiscord<haxscramper> Just write code however you like, you will adjust over time
15:36:49ForumUpdaterBotNew post on r/nim by mescobal: Jester and forms, see https://reddit.com/r/nim/comments/m48m4x/jester_and_forms/
15:37:16saemWithout knowing what those are and preferring to remain that way, would this be solved by writing the occasional proc that does the missing thing you want when it's not available?
15:46:50*D_ quit (Ping timeout: 264 seconds)
15:57:29FromDiscord<mario2> @haxscramper But could I possibly make a macro to call variables with $?
15:59:42FromDiscord<Rika> What do you mean? What’s the use case
16:00:41FromDiscord<mario2> Is it possible to have a bit of perlisms with nim?
16:01:06FromDiscord<Yardanico> Araq made an article on that some years ago
16:01:24FromDiscord<Yardanico> Although it's not nearly as complete, maybe it'll help you https://nim-lang.org/araq/perlish.html
16:03:05FromDiscord<Yardanico> But IIRC `{.this.}` pragma has been removed from the language
16:04:12FromDiscord<Yardanico> oh wait it wasn't
16:04:21FromDiscord<Yardanico> But it's deprecated nonetheless
16:04:50k0mpjut0rHello all, I just realized that Nim's `string` type is not "8 bit clean", i.e. if I `readFile` some binary data, the returned data gets truncated at the first 0. What is the best way to read all the (binary) data from a file?
16:05:28FromDiscord<Yardanico> are you sure?
16:05:45FromDiscord<Yardanico> as far as I know it doesn't truncates data after the 0
16:05:49FromDiscord<Yardanico> (edit) "truncates" => "truncate"
16:06:08k0mpjut0rNeed to check, potentially `db_sqlite` might do the truncation...
16:07:03FromDiscord<Yardanico> well, nim strings are null-terminated but that is only used for the easy C interop
16:07:29FromDiscord<Yardanico> my guess is that db_sqlite internally converts the string to a cstring (because of the C FII) which is truncated
16:07:35*krux02 joined #nim
16:08:00FromDiscord<Yardanico> maybe https://github.com/nim-lang/Nim/blob/version-1-4/lib/impure/db_sqlite.nim#L770 will work for you?
16:08:09FromDiscord<Yardanico> sorry I meant https://nim-lang.org/docs/db_sqlite.html#bindParam%2CSqlPrepared%2Cint%2CopenArray%5Bbyte%5D
16:09:47FromDiscord<mario2> Thanks @Yardanico I can do perl like $variables in nim now.
16:10:16FromDiscord<Yardanico> @mario2 although I'd recommend learning the "proper" Nim way over time :)
16:10:59FromDiscord<Yardanico> yeah @k0mpjut0r it's exactly as I described
16:11:07FromDiscord<Yardanico> so I think the bindParam is the only way you can do it reliably
16:11:21k0mpjut0rThanks, that might do the trick! I confirmed with an `assert(len(readFile(path)) == knownFileSize)` that `readFile` does indeed read the entire binary chunk
16:11:30FromDiscord<Yardanico> or you can base64-encode the data
16:11:35*D_ joined #nim
16:11:54FromDiscord<zidsal> how do you guys structure nim projects that contain both a frontend and a backend if I want to keep them in the same repo? do you guys make 2 nimble projects or can I setup nimble in a way to handle both projects e.g. nimble build builds both the .js output and the server
16:12:20FromDiscord<Yardanico> @zidsal you might want to check out https://github.com/nim-lang/nimforum/ - it has both the frontend and the backend in a single repo
16:12:30FromDiscord<zidsal> ah amazing thanks yardanico
16:12:42FromDiscord<Yardanico> it just has separate nimble tasks for building the frontend/backend and running the backend
16:12:47FromDiscord<Yardanico> https://github.com/nim-lang/nimforum/blob/master/nimforum.nimble
16:13:28FromDiscord<dk> if you use .nims config files, `nimble build` will respect those too
16:13:37FromDiscord<queersorceress> you should be able to use a single .nimble file for that too, right?
16:13:43FromDiscord<dk> so just having `--backend:js` for js files should work too
16:13:49FromDiscord<zidsal> excellent thanks guys
16:14:26FromDiscord<zidsal> looks like this also does some crud testing with a web driver as well which answers 1 of my other questions
16:18:05FromDiscord<dk> actually `nim c` itself respects `--backend`
16:18:48FromDiscord<dk> kind removes the point of having `c`, `cpp`, `js` as first parameter 🤔
16:18:55FromDiscord<dk> (edit) "kind" => "kinda"
16:19:15FromDiscord<Yardanico> `c` stands both for C and `compile`
16:19:19FromDiscord<Yardanico> `nim compile` is the same as `nim c`
16:19:24k0mpjut0rNext challenge for me - how to cast `string` to `openArray[byte]` 🙂
16:19:25FromDiscord<Yardanico> so you can do `nim compile --backend:js`
16:19:40FromDiscord<dk> even if it does, I'm sure most people don't get the impression
16:19:42FromDiscord<Yardanico> cast[seq[byte]](mystr) if you're fine with a raw `cast` :P
16:19:47FromDiscord<dk> same with cstring etc
16:20:23*xet7 joined #nim
16:20:30FromDiscord<Yardanico> @k0mpjut0r nim strings and seqs have the same memory layout, so if you're fine with relying on an internal detail this will work
16:20:36k0mpjut0rThat worked surprisingly well :)
16:20:39FromDiscord<Yardanico> otherwise you can just do it the old-fashioned for loop way
16:21:42FromDiscord<Yardanico> sent a code paste, see https://paste.rs/Fi7
16:21:55FromDiscord<Yardanico> I guess that C compilers should be able to vectorize this pretty well
16:22:05FromDiscord<Yardanico> ah sorry, forgot byte(b) instead of b
16:22:11FromDiscord<mario2> How would a template for plain old `int` or `float` in nim work?
16:22:24FromDiscord<Yardanico> @mario2 wdym a template?
16:22:24k0mpjut0rStill it feels "dirty" and I think Nim would benefit from an explicit blessed / documented way to convert string to a sequence of bytes (given they are not equivalent to some APIs)
16:22:43FromDiscord<dk> In reply to @mario2 "How would a template": `type i = int` ?
16:24:51FromDiscord<Rika> @Yardanico c only stands for compile, cc force compiles to c, c is just a default
16:25:44FromDiscord<mario2> sent a code paste, see https://play.nim-lang.org/#ix=2SGP
16:25:48FromDiscord<Rika> Equals sign
16:25:54FromDiscord<Yardanico> @mario2 nonono, that's not how you do it
16:25:57FromDiscord<Rika> And the 3rd line isn’t possible
16:26:08FromDiscord<Yardanico> you want to have C-style var declarations in Nim? @mario2
16:26:13FromDiscord<Rika> I mean it is, but don’t...
16:26:20FromDiscord<mario2> Yes
16:26:47FromDiscord<dk> nim metaprogramming can't really change syntax
16:27:10FromDiscord<Yardanico> @dk this is valid nim syntax though
16:27:37FromDiscord<Yardanico> I mean it kind of is, but it won't work the way @mario2 wants
16:28:28FromDiscord<Yardanico> actually it can work, but god forgive me for doing this...
16:28:39FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2SGQ
16:29:35FromDiscord<Yardanico> the thing is that you only get `apple` in the macro itself, but not the equals because of the way command call syntax works
16:29:50FromDiscord<Yardanico> so you create a new variable and return it so that it can be assigned
16:30:06FromDiscord<Rika> I mean it’s basically exactly how c works
16:30:13FromDiscord<Yardanico> this way you can't really have type inference though
16:30:42FromDiscord<Yardanico> if you just want to define those for some of your existing types then it'll work fine, but if you don't know the type on the right-hand side, it won't
16:30:42FromDiscord<Rika> You forgot to remove an echo though
16:30:48FromDiscord<Yardanico> @Rika yeah I know, but it's obvious
16:30:49FromDiscord<KnorrFG> sent a code paste, see https://play.nim-lang.org/#ix=2SGR
16:31:05FromDiscord<Yardanico> just debugging code
16:31:24FromDiscord<queersorceress> oh geez, is this the same person as before but under a new name?
16:31:35FromDiscord<Yardanico> ?
16:32:00FromDiscord<queersorceress> we got the same question last week, about making C-style syntax for variable declaration.
16:32:20FromDiscord<Yardanico> lol
16:32:21FromDiscord<Rika> In reply to @KnorrFG "the following code produces": Setter shouldn’t have a return type
16:32:31FromDiscord<queersorceress> despite the fact it would loose nuance regarding mutability
16:32:41FromDiscord<Yardanico> yeah @KnorrFG you misplaced the return type
16:33:04FromDiscord<Rika> Ah I misread
16:33:10FromDiscord<Rika> It’s hard to read on mobile
16:33:22FromDiscord<queersorceress> `var` vs `let` vs `const` is important! just as important as the type the variable has, more important even!
16:33:53FromDiscord<Yardanico> wait @KnorrFG what EventT is supposed to be ?
16:33:58FromDiscord<Rika> Nothing looks wrong there
16:34:29FromDiscord<KnorrFG> a type, that is generated by a macro, that has basic callback functionality
16:34:38FromDiscord<Yardanico> but how does nim get to know it?
16:35:02FromDiscord<KnorrFG> i dont know, i guess thats what im asking. Its a type that can always be constructed without arguments. that is guaranteed
16:35:04FromDiscord<Rika> How do you use the initialiser
16:35:04FromDiscord<KnorrFG> but how to twll nim
16:35:46FromDiscord<Yardanico> @KnorrFG then you have to always provide the types in the generic instantiation
16:35:47FromDiscord<Rika> You have to define the generic parameters here since EventT cannot be inferred from the input parameters
16:36:19FromDiscord<KnorrFG> ah, i see, thanks
16:38:11FromDiscord<queersorceress> @Rika couldn't you also use varargs as the parameters, or would that require them all to be the same type?
16:38:25FromDiscord<Rika> What do you mean
16:39:13FromDiscord<queersorceress> oh, wait, sorry i misread that. nevermind.
16:39:38FromDiscord<Rika> Okay
16:42:59FromDiscord<KnorrFG> now it says `Error: object constructor needs an object type`
16:44:41FromDiscord<Rika> Well how are you passing it
16:44:52FromDiscord<Rika> Can you put how you call the initialiser
16:45:12FromDiscord<KnorrFG> sent a code paste, see https://play.nim-lang.org/#ix=2SGU
16:48:59FromDiscord<Rika> Point = cint?
16:50:31FromDiscord<KnorrFG> no, no its not ... cant believe i missed that. Maybe i should stop for today ...
16:51:51FromDiscord<KnorrFG> however, also after correcting it to cint, and yes, the defined type of x matches this, the error stays the same
16:51:53FromDiscord<Rika> Haha that’s probably a good idea if you’re really tired
16:52:09FromDiscord<Rika> Can you show what EventPoint looks like
16:52:53FromDiscord<KnorrFG> EventPoint and EventCint are defined via the event macro from https://github.com/beef331/constructor
16:53:34FromDiscord<KnorrFG> sent a code paste, see https://play.nim-lang.org/#ix=2SGW
16:55:50FromDiscord<Rika> I can’t think right now, I should be asleep so maybe someone else can help you for now...
16:56:08FromDiscord<KnorrFG> kk, thank you for oyour effort so far ^^
16:59:03FromDiscord<KnorrFG> nvm, i found it, the line `PropertyT(onChange: EventT(), get: getter, set: setter)` also needs the template args
17:09:07FromDiscord<รєคɭ๓๏שє> @giaco hey! So it's you on github issues ^^. I am preparing a new big feature!
17:54:46*gmaggior quit (Quit: Leaving)
17:57:40*rockcavera quit (Remote host closed the connection)
18:06:03*rockcavera joined #nim
18:10:11*waleee-cl joined #nim
18:27:13ForumUpdaterBotNew thread by Lhupfeldt: Get system wide config dir, see https://forum.nim-lang.org/t/7620
18:31:03FromDiscord<Yardanico> @รєคɭ๓๏שє why do you want to "torture" IRC users that much? :D
18:31:10FromDiscord<Yardanico> I mean your name :D
18:31:16idfrenders fine in emacs ;)
18:32:54FromDiscord<Yardanico> I didn't mean that it wouldn't render
18:33:01FromDiscord<Yardanico> but generally an ASCII-only name looks better :)
18:40:42*a_chou joined #nim
18:45:28FromDiscord<รєคɭ๓๏שє> Haha ok, I'll consider changing it :ρ
18:51:26*a_chou quit (Remote host closed the connection)
19:01:49*pbb quit (Remote host closed the connection)
19:02:07*wasted_youth2 quit (Quit: Leaving)
19:03:03*pbb joined #nim
19:13:46*rockcavera quit (Remote host closed the connection)
19:20:18*superbia joined #nim
19:25:03*superbia quit (Ping timeout: 245 seconds)
19:44:24saemthis is truly cursed, but I'm trying to reason about the precise reasons as to why I can't do this: https://play.nim-lang.org/#ix=2SHS
19:46:51FromDiscord<Clyybber> saem: Think about it, it doesn't make sense when the default params are expanded in sem
19:46:57FromDiscord<Clyybber> but maybe we should move to #internals :P
19:47:29saemI asked here because it was sort of a spec question than implementation.
19:47:36saemBut can do.
19:48:06FromDiscord<konsumlamm> In reply to @saem "this is truly cursed,": how would the compiler decide which `foo` you meant?
19:48:44saemThat's the fun thing, I don't think we currently specify where default values must be declared. They can be either in the forward or the impl. 😬
19:49:39FromDiscord<konsumlamm> h, i see
19:49:44saemI'm trying to scrap together clues from the manual as to what _should_ be the case or rather how much is specified and expected behaviour and then I can presume the rest to be undefined before a solution makes sense.
19:49:45FromDiscord<Clyybber> I mean, the current error kinda makes sense
19:50:47saemDoes it? I'm not saying it's a good reason,b ut say in C++, you can only declare default values in either the proto or impl, but not both. Not saying that's the right way to do it, but simply as a point of reference.
19:52:33*vicfred joined #nim
20:05:22FromDiscord<Clyybber> hmm yeah
20:06:19FromDiscord<Clyybber> but taking it from the impl and leaving it out in the forward decl is impossible because of the default value impl
20:06:54FromDiscord<Clyybber> which should stay the way it is IMO, since it's nicer for macros
20:07:25FromDiscord<mratsim> @rayman22201 I'm watching the continuation video you mention, very interesting https://www.youtube.com/watch?v=BAMtstt3Jp8 though the initial shenanigans with undelimited continuations are overkill I think 😉
20:15:26ForumUpdaterBotNew thread by Alexeypetrushin: Criticism of Parallel Nim, see https://forum.nim-lang.org/t/7621
20:26:16ForumUpdaterBotNew post on r/nim by indrgun: Nim used to write malware, see https://reddit.com/r/nim/comments/m4el3z/nim_used_to_write_malware/
20:31:00FromDiscord<konsumlamm> as if we didn't notice yet
20:32:25FromDiscord<Yardanico> yeah I downvoted it (that's my own right) :P
20:32:33FromDiscord<Yardanico> seen that article too many times already
20:35:16FromDiscord<dom96> zdnet coverage is awesome for nim
20:35:30FromDiscord<dom96> think of the citations we can now add to the Nim Wikipedia page 😄
20:53:19FromDiscord<mratsim> lol
20:53:26FromDiscord<mratsim> Nim is notable now
20:55:18FromDiscord<dom96> notability intensifies
20:57:37*haxscramper quit (Remote host closed the connection)
20:58:17*Vladar quit (Quit: Leaving)
21:04:18*Jesin quit (Quit: Leaving)
21:09:16giaco_รєคɭ๓๏שє hello!
21:11:38FromDiscord<dom96> Finally took the time to read https://theta.eu.org/2021/03/08/async-rust-2.html fully. I had no idea closures in Rust were so difficult to work with and surprised I haven't seen more people discussing this.
21:15:10*Jesin joined #nim
21:15:52*Jesin quit (Remote host closed the connection)
21:16:04*rockcavera joined #nim
21:20:01*Jesin joined #nim
21:20:37*Jesin quit (Remote host closed the connection)
21:23:10*Jesin joined #nim
21:24:46FromDiscord<mratsim> In reply to @dom96 "Finally took the time": People are also complaining about capturing var and openarrays in Nim
21:24:56FromDiscord<mratsim> it's the same underlying problem
21:25:26FromDiscord<mratsim> In terms of semantics we're marginally better with our `{.closure, gcsafe, locks: 0.}`
21:25:32FromDiscord<mratsim> (edit) "semantics" => "ergonomics"
21:26:20*letto quit (Quit: Konversation terminated!)
21:26:23FromDiscord<mratsim> I need to write a RFC for anonymous function, coroutines/closure iterators and channels ergonomics because without nice syntax, CSP and actors will be a pain to write.
21:26:46*Jesin quit (Client Quit)
21:27:50*Jesin joined #nim
21:28:11FromDiscord<dom96> From what I've seen we are significantly better in terms of ergonomics, not just marginally
21:28:20*letto joined #nim
21:29:07FromDiscord<dom96> var and openarrays are minor edge cases, the former of which can be worked around albeit likely not in the most efficient fashion (and the {.async.} macro could even do so in the background)
21:30:48FromDiscord<Gary M> is `at()` a valid proc for seqs?
21:31:11FromDiscord<konsumlamm> the reason for rust's ergonomics problems is mostly that it doesn't implicitly allocate
21:31:40FromDiscord<Gary M> because `structs.at(i).pNext = structs.at(i + 1)` compiles fine but I don't know if it's doing what I think it's doing lol
21:34:03FromDiscord<konsumlamm> In reply to @dom96 "Finally took the time": it's really not as bad as the author makes it out to be
21:37:16*rockcavera quit (Remote host closed the connection)
21:38:40FromDiscord<Yardanico> @Gary M first time seeing `at`
21:38:48FromDiscord<Gary M> right?
21:38:48FromDiscord<Yardanico> can you check where at comes from?
21:39:09FromDiscord<Gary M> nimsuggest isn't parsing me to any definition
21:39:28FromDiscord<Yardanico> are you sure that you're compiling that exact code ?:P
21:39:45FromDiscord<Gary M> idk, maybe?
21:40:18FromDiscord<Yardanico> i don't think that there's such proc in the stdlib
21:40:27FromDiscord<Yardanico> i just grepped
21:40:52FromDiscord<Yardanico> there's one in the compiler in injectdestructors, and one in a test
21:41:00FromDiscord<Gary M> yeah I'm fairly certain it's not right 😄
22:00:29*rockcavera joined #nim
22:05:39*azed joined #nim
22:09:13*xet7 quit (Quit: Leaving)
22:10:38FromDiscord<Gary M> `cstring` default is "" not nil right?
22:11:16*azed quit (Quit: WeeChat 3.0.1)
22:11:27FromDiscord<dom96> !eval var x: cstring; echo(x.repr)
22:11:29NimBotnil↵
22:11:36*azed joined #nim
22:11:54FromDiscord<Gary M> oh 😄
22:16:18FromDiscord<exelotl> makes sense cause a cstring is just a char pointer under the hood
22:24:36krux02clyybber, thank you for reviving my old PR.
23:17:29*wasted_youth2 joined #nim
23:37:33FromDiscord<ShadowElf37> is there a way to cast a macro body as something specific?
23:37:58FromDiscord<ShadowElf37> like instead of a stmtlist or whatever, make the compiler try to interpret it as a reclist?
23:47:10FromDiscord<Gary M> is it safe to cast a seq[cstring] to seq[string]
23:52:13FromDiscord<Clyybber> krux02: np
23:52:22FromDiscord<Clyybber> @Gary M nope
23:52:36FromDiscord<Gary M> :/
23:53:00FromDiscord<Gary M> well for some reason AllocCStringArray() only works with `string` seqs, not `cstring` seqs lol
23:53:41FromDiscord<Clyybber> oh yeah
23:53:46FromDiscord<Clyybber> I guess you could just copy it
23:53:48FromDiscord<Clyybber> and adapt it
23:54:29FromDiscord<Gary M> ` result = cast[cstringArray](alloc0((a.len+1) sizeof(cstring)))`
23:54:53FromDiscord<Clyybber> I think it will just work if you change the signature to openArray[string or cstring]
23:55:06FromDiscord<Gary M> why isn't that seq[cstring] to seq[string] cast safe?
23:55:41FromDiscord<Yardanico> because string is a nim string
23:55:53FromDiscord<Yardanico> nim strings are not raw c strings
23:55:55FromDiscord<Clyybber> because string has a length field
23:55:58FromDiscord<Yardanico> also capacity
23:55:59FromDiscord<Clyybber> and cstring is nullterminated
23:56:41FromDiscord<Clyybber> with arc string is a pointer, len pair while cstring is just a pointer
23:56:52FromDiscord<Clyybber> (edit) "with arc string is a pointer, len pair while cstring is just a pointer ... " added "for example"
23:56:54FromDiscord<Gary M> so you can cast a string to cstring but just not the other way?
23:57:08FromDiscord<Clyybber> you can't cast a string to cstring either
23:57:09FromDiscord<Gary M> I mean like stringVar.cstring
23:57:13FromDiscord<Clyybber> oh yeah
23:57:14FromDiscord<Clyybber> that works
23:57:17FromDiscord<Clyybber> and also works backwards
23:57:28FromDiscord<Clyybber> but not for a whole collection
23:57:29FromDiscord<Gary M> yeah it's just more complicated with a sequence
23:57:38FromDiscord<Clyybber> yeah
23:57:41FromDiscord<Gary M> I could just copy the whole collection but that feels wasteful
23:57:56FromDiscord<Clyybber> yeah, I'd just adapt allocCString
23:58:02FromDiscord<Clyybber> (edit) "allocCString" => "allocCStringArray"
23:58:05FromDiscord<Gary M> I guess we'll see if it blows up.