<< 06-01-2021 >>

00:05:43*cyraxjoe joined #nim
00:09:32FromDiscord<VVX7> what version of MinGW should I use to cross-compile a library using bearssl from linux to windows?
00:10:22FromDiscord<VVX7> I installed MinGw following the Nim compiler docs here https://nim-lang.github.io/Nim/nimc.html#crossminuscompilation-for-windows
00:18:39adnan338Ok another question regarding enums; I have a enum of strings only. When I pass an item of that enum to 'echo' it's able to print the string but why can't it be passed to '$' function?
00:18:59adnan338https://play.nim-lang.org/#ix=2L09
00:19:50adnan338oh wait it does
00:19:53adnan338nevermind hahah
00:31:16*Gustavo6046 quit (Ping timeout: 240 seconds)
00:34:28*D_ quit (Quit: No Ping reply in 180 seconds.)
00:35:34*D_ joined #nim
00:44:12*krux02 quit (Remote host closed the connection)
00:54:10*Tanger joined #nim
00:55:47*adnan338 quit (Quit: adnan338)
00:58:30*Gustavo6046 joined #nim
01:00:20FromDiscord<KallDrexx> So I'm confused. On this box I have a global MinGW setup and Nim does not seem happy with it. A simple `echo "hi"` program fails with the following output: https://gist.github.com/KallDrexx/941560895d1387961bdbd49a2d292493
01:00:59FromDiscord<KallDrexx> I don't know enough about C to understand those compile errors
01:01:48FromDiscord<KallDrexx> Anyone have any idea?
01:04:39mipriNIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, "");
01:04:58mipriNI isn't the same size as a pointer, and NIM_INTBITS isn't the same size as eight NIs
01:06:27mipriNim is producing code that expects a compilation environment that doesn't match your actual one. Maybe just 64bit vs. 32bit.
01:06:45mipriyou can probably fix that by telling Nim that you've got some other kind of environment.
01:06:47FromDiscord<KallDrexx> yeah when you said pointer size I realized maybe mingw installed 32bit not 64bit
01:20:23*adnan338 joined #nim
01:20:29*adnan338 quit (Client Quit)
01:20:43*adnan338 joined #nim
01:25:37*junland_ quit (Quit: %ZNC Disconnected%)
01:27:26*junland joined #nim
01:32:00*abm quit (Quit: Leaving)
01:43:15FromDiscord<KallDrexx> Well that was annoying so I just figured out why nim's `finish.exe` wasn't working for me and used that
02:06:22*Gustavo6046_ joined #nim
02:06:43*Gustavo6046 quit (Ping timeout: 258 seconds)
02:08:21*Gustavo6046_ is now known as Gustavo6046
02:15:39*taprack quit (Remote host closed the connection)
02:16:05*taprack joined #nim
02:29:25*taprack quit (Ping timeout: 240 seconds)
02:40:17saem@leorize[m]: check it: https://github.com/nim-lang/nimsuggest/issues/119
02:40:18disbotnimsuggest outline doesn't account for includes
02:40:46saemHopefully it makes sense. :D
03:00:18leorize[m]yea that's a bug
03:01:01leorize[m]iirc it used to show everything, will try to debug it later
03:01:28saemhmm
03:02:31leorize[m]I used to jump around sem with outline so pretty sure it's supposed to work
03:04:37FromGitter<redblack3_gitlab> Hey guys, I'm trying to get this code to work: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ The second line is gibberish. Seems like the `importcpp` pragma is trying to get generic params from the `Vector3` type alias, which only has 1 generic parameter. [https://gitter.im/nim-lang/Nim?at=5ff528c54498e01bbf8d4199]
03:05:24FromGitter<redblack3_gitlab> Anyone know if there a work-around for this, or am I doing it wrong?
03:07:03leorize[m]I think you would have to define it for each tvec separately
03:07:50leorize[m]you can use a template for that
03:09:01FromGitter<redblack3_gitlab> Ya I did try that, but that introduced complications with the functions that work on those types, since Vector[3, T] and Vector3[T] need to be fully interchangeable.
03:09:43leorize[m]saem: not sure if my memory is still correct, but the include should share the same owner as the main one
03:09:45FromGitter<redblack3_gitlab> How would I use a template? I tried something like `template Vector3[T] = Vector[3, T]` before, but that doesn't work with `type[]`
03:10:23leorize[m]saem so you can probably use that to figure if a node is a part of the file nimsuggest is inspecting
03:14:43leorize[m]redblack3_gitlab: you would wanna make the template define the type for you
03:15:26leorize[m]but you want to define functions that will work on the Vector[S, T] typeclass too?
03:18:26FromGitter<redblack3_gitlab> Yes, like this one: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ff52c02d5f4bf2965cb6e98]
03:28:37*muffindrake quit (Ping timeout: 260 seconds)
03:30:54*muffindrake joined #nim
03:36:30disruptekleorize[m]: you figured out testes, right?
03:37:30disrupteki think i added code to do a debug run after a release failure (on ci only) but i can't remember.
03:37:48disrupteki might have been high.
03:45:52*Gustavo6046 quit (Ping timeout: 260 seconds)
03:50:25*Gustavo6046 joined #nim
03:51:16leorize[m]disruptek: yea, though you should make it output all the error messages always
03:51:22leorize[m]don't know why you would hide them
03:51:53disruptekwell, it was made to help me debug cps. 😁
03:52:57disrupteki often want to see which tests succeed. i don't really want to run individual compiler processes for each test.
03:53:10leorize[m]redblack3_gitlab: so you don't need the `S` in `[S, T]`, ever?
03:53:32leorize[m]then we can autogenerate that stuff
03:53:39leorize[m]but why don't you use nim-glm though
03:54:55leorize[m]disruptek: it certainly confused me the first time I tried
03:55:35disruptekit's weird how few people read READMEs. i will raise it on the page.
04:00:13disrupteki guess i did add a debug build but it doesn't work.
04:00:18disruptekso, yeah, i guess i was high.
04:04:04*Gustavo6046 quit (Remote host closed the connection)
04:04:18*Gustavo6046 joined #nim
04:05:27*Jesin quit (Read error: Connection reset by peer)
04:11:34FromDiscord<Anonymous Poet> hey all, has anyone had issues with nim's http server and the Content Length header?
04:11:57FromDiscord<Anonymous Poet> im trying to use nim with openfaas and mostly got it set up, but ran into an issue with POST
04:12:10FromDiscord<Anonymous Poet> im trying to debug the go + nim http boundary
04:12:12disruptek!issues content length http
04:12:13disbothttps://github.com/nim-lang/Nim/issues/16436 -- 3AsyncHttpClient doesn't handle errors
04:12:13disbothttps://github.com/nim-lang/Nim/issues/14794 -- 3Multipart upload in httpclient broken
04:12:13disbothttps://github.com/nim-lang/Nim/issues/13923 -- 3Very high memory usage due to numerous inefficiencies in the STD lib (async) 7& 27 more...
04:12:38disrupteklooks like at least 30 likely candidates for your consideration, if you have access to a web-browser.
04:13:18FromDiscord<Anonymous Poet> interesting, thanks, ill dig into them if needed, but my issue seems pretty surface level still
04:13:29FromDiscord<Anonymous Poet> (also only the first 3 show up on discord)
04:13:32disruptekwhat does that mean?
04:13:37FromDiscord<Anonymous Poet> like, the header doesnt seem to get passed at all
04:13:53disruptekso?
04:13:58FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L0S
04:14:10disruptekif you're on irc you can speak to disbot directly to get more than 3 results.
04:14:15disrupteksadly, you're not on irc.
04:14:18FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L0T
04:20:24FromDiscord<Anonymous Poet> looking at the issue tracker on nim-lang, the closest ones are https://github.com/nim-lang/Nim/issues/6870 https://github.com/nim-lang/Nim/issues/10726 but both are closed, and neither is about receiving a non-zero content length (the first one is the closest)
04:20:33disbotHTTP response without Content-Length is not accessible ; snippet at 12https://play.nim-lang.org/#ix=2L0U
04:21:17disrupteki would look at the raw string prior to parse.
04:21:22FromDiscord<Anonymous Poet> i was on here the other day and i think either beef or someone else helped me narrow down the relevant line from asynchttpserver where the content length was checked; now im wondering if theres a step earlier in the process
04:21:33FromDiscord<Anonymous Poet> do you know what file that would be in?
04:21:46miprilib/pure/asynchttpserver.nim
04:22:10leorize[m]disruptek: if you ever wonder about how the matcher thingy for github actions looks like when it works: https://github.com/alaviss/nim-sys/commit/2ed66db9eb002022d926043a51ef95e91d4fdef0
04:22:32FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L0V
04:22:57disruptekleorize[m]: yeah, it spams me all the time. 😆
04:25:01FromDiscord<Anonymous Poet> it seems like that is the raw strings, and indeed they dont contain a content length
04:25:22FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L0X
04:25:26disruptekwhere is your GOd now
04:25:34FromDiscord<Anonymous Poet> hm?
04:25:55disruptekobvs, it's time to write your client in nim, too.
04:26:17FromDiscord<Anonymous Poet> oh, the go code isnt mine, its openfaas
04:26:41disruptekwell, i won't tell anyone.
04:26:44FromDiscord<Anonymous Poet> i made a ticket a few days ago but its not gotten any attention yet
04:26:47disrupteki can't vouch for mipri, though.
04:26:55FromDiscord<Anonymous Poet> so im trying to fix the thing myself, haha
04:28:24*spiderstew_ joined #nim
04:31:57*spiderstew quit (Ping timeout: 265 seconds)
04:35:29FromDiscord<VVX7> I'm confused by wrapping exteranl C libraries. I'm trying to cross-compile somethign with BearSSL from Linnux to Windows but Nim complains that the imported C lib is not found. I expected MinGW to build it. Do I need to build the DLL first and then pass it to Nim during build?
04:35:45FromDiscord<VVX7> or is there something else going on there I'm not grasping
04:36:23saemOh, it's a silly environment variable, isn't it poet?
04:36:29disruptekdoes the .dll file exist?
04:36:38disruptekif so, put it adjacent to the .exe.
04:37:24disruptekyes, it does need to be built first, just as you'd need to build it on linux, first.
04:38:21disruptekactually, i'm not sure it needs to exist at build time.
04:38:31disrupteki don't x-compile windows garbage.
04:38:32FromDiscord<VVX7> the dll does not exist. Am building from Linux and the build fails because Nim doesn't see the library. I just expected that it would be built automatically as a dependancy
04:38:44disrupteki doubt it would be.
04:39:02disruptekbut it sounds like it /is/ needed. 😉
04:39:34FromDiscord<Anonymous Poet> not sure i follow, but i dont think so. do you mind elaborating?
04:41:08FromDiscord<Anonymous Poet> i dont have too much experience cross compiling, but i think by default cross compiling c/c++ code doesnt "just work"; usually you need to compile in the same env you want to run in
04:43:27FromDiscord<ElegantBeef> Poet discord's reply system doesnt work for the irc bridge 😄
04:44:33FromDiscord<VVX7> sent a code paste, see https://play.nim-lang.org/#ix=2L0Z
04:45:20FromDiscord<Anonymous Poet> oh, good to know about the replies
04:45:31FromDiscord<Anonymous Poet> @VVX7 can you build on the windows machine?
04:45:35FromDiscord<Anonymous Poet> or is it only a deploy target?
04:46:25*adnan338 quit (Quit: adnan338)
04:47:43FromDiscord<VVX7> I could build it on Windows but it's an extra step. Seems like something I'm not getting right. But I haven't found any examples of cross compiling with imported c libs that would help me understand if it's my fault.
04:48:19*rockcavera quit (Remote host closed the connection)
04:50:15FromDiscord<Anonymous Poet> do you have the sources all they way down? ie. including for bearssl?
04:50:38FromDiscord<Anonymous Poet> because if not, its possible that theres some unix deps somewhere that you wouldnt be able to work around no matter what
04:56:21FromDiscord<VVX7> @Anonymous Poet Yep, their installed with nim-bearssl. I can build the binary as an ELF and it works. But it complains the same C sources are not found when the target is for windows. 🤷‍♂️
04:57:30ForumUpdaterBotNew thread by Chris3606: Export by Ordinal for Windows DLLs?, see https://forum.nim-lang.org/t/7338
04:59:02FromDiscord<Anonymous Poet> just because you can build the elf binary doesnt necessarily mean you have all the sources (you may need to check for dynamically linked deps, like with `ld`) but assuming that you do have all the sources, thats maybe weird
04:59:41FromDiscord<Anonymous Poet> one observation is that the path you posted above goes to `\csources\src\codec\dec32be.c` - im not sure if unix will treat that as a path or an escape char
05:00:13FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2L10
05:02:56FromDiscord<Anonymous Poet> disruptek, if you're still around, i think ive identified my issue
05:03:01disruptekwhat is it?
05:03:22FromDiscord<Anonymous Poet> it seems like even though go has the content length, for whatever reason, it passes "Transfer-Encoding: chunked" instead of content length
05:03:33FromDiscord<Anonymous Poet> and it doesnt seem like the nim http server has any support for this atm
05:03:42disruptekneat.
05:03:46FromDiscord<Anonymous Poet> or at the very least, the check for Content-Length is hard coded and non-optional
05:04:38FromDiscord<Anonymous Poet> im willing to try adding this and making a PR, but im not sure what would actually be required to implement chunked encoding
05:05:15disrupteki think it's pretty straightforward but that doesn't mean the impl will be trivial.
05:08:02saemhttps://github.com/nim-lang/Nim/issues/7126
05:08:03disbotNo way to process async HTTP response in chunks
05:09:51saemYou should still be able to buffer it, but ouch.
05:09:53FromDiscord<Anonymous Poet> saem, that looks like its on the sending end, whereas im talking on the receiving end
05:11:48FromDiscord<Anonymous Poet> i think this is the most appropriate place for changes: https://github.com/nim-lang/Nim/blob/d721f5cecad90a0aa7e2ea144607ffafdf647e31/lib/pure/asynchttpserver.nim#L252
05:16:37saemRegardless, the faas send out of spec, it needs to provide the size in bytes
05:19:46saemBut I could be remembering the spec wrong.
05:22:43FromDiscord<Anonymous Poet> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding
05:22:54FromDiscord<Anonymous Poet> its valid, sadly
05:23:10FromDiscord<Anonymous Poet> and i dont see it dont it explicitly, i think its a go stdlib thing unfortunately
05:24:03FromDiscord<Anonymous Poet> the good news is that maybe ill contribute something to nim! 😄
05:26:52FromDiscord<flywind> see https://github.com/nim-lang/Nim/pull/8447
05:26:53disbotAdded chunked response to asynchttpserver.
05:27:30disruptekshocker.
05:28:29FromDiscord<flywind> And https://github.com/iocrate/netkit/blob/master/netkit/http/chunk.nim
05:33:20leorizesaem: so what have you found when debugging outline?
05:33:44leorizedoes it work if you remove the file check?
05:33:48saemWas making dinner and watching TV
05:34:00saemGoing to give it a go now, but I have an idea of where to look
05:35:41FromDiscord<Anonymous Poet> the first example flywind linked is definitely for sending, so while it might be useful for inspiration, its not what i need
05:35:50leorizesaem: haven't run any tests other than the one you shown, but this should work: http://ix.io/2L14/patch
05:36:05leorizebasically I change the file check into owner check
05:36:13FromDiscord<Anonymous Poet> the second file linked also seems to be sending, but not 100%, and it seems like the rest of the repo might be useful; i need to dig around more
05:36:19FromDiscord<Anonymous Poet> but thanks everyone for the help
05:36:38*adnan338 joined #nim
05:36:39*adnan338 quit (Client Quit)
05:36:53*adnan338 joined #nim
05:39:03saemYup, I see that. I'm just hitting it with the debugger so I can test some assumptions
05:48:18*narimiran joined #nim
05:50:05saemI _think_ the code walk up the owners (successive includes) until it encounters a skPackage owner, then take the previous skModule's fileIndex as that means it would work regardless of the depth of includes... presently it would break for immediate symbols AFAICT.
05:50:15saemGonna give that a shot
05:51:15disruptekowners is being deprecated; you might be able to use the new itemId instead.
05:51:30saemThanks for the tidbit!
05:51:52disrupteki mean, use what works, but know that owners is rather brittle by comparison.
05:52:59saemIs owners going away because ownership can change from the perspective of IC when thinking about different compilation branches?
05:53:31disruptekno, it's just annoying. 😁
05:53:36saemLoL
05:54:03disruptekslow and brittle.
05:54:15leorizethis seems to be simpler than what you were talking about yesterday :P I thought you found the grand bug of nimsuggest
05:55:46saemOh no, I think those are there... I mean we're relying on this stuff to be accurate and I saw some things that make me wondering how consistent/clean this data is.
05:56:34leorizeone thing I do know is that TLineInfo and TFileInfo is very accurate due to their simple construction (they're built during parsing with very simple code paths)
05:56:49leorizeexcept when `{.line.}` come into play because that pragma is evil
05:56:54disrupteksaem: one ownership element that changes, possibly, is generics that get recorded in the modules in which they are used.
05:57:42saemdisruptek: I mean couldn't someone be a jerk and have a when with one branch as include and another as import and then it gets hilarious?
05:58:05disruptekthey may be owned by an external module. i don't actually how how it ended up being impl'd.
05:58:20disruptekthe include/import is pretty harmless.
06:00:18saemThat makes sense now that I think about it more, because since the forked path is in the module with the when statement, it should end up as two different things in IC terms.
06:01:07disruptekright.
06:11:22*Tlangir joined #nim
06:14:26*Tanger quit (Ping timeout: 272 seconds)
06:27:49*nyd joined #nim
06:27:55*nyd left #nim (#nim)
06:37:20*waleee-cl quit (Quit: Connection closed for inactivity)
06:41:01saemUnfortunately, I can't seem to find an index structure that lets me use the item id to walk back up the tree of includes like owner id does. I thought I'd seen something a while back but who knows. Owner id it is.
06:45:01*greenfork joined #nim
06:48:07FromDiscord<Zed> Well i've been away from nim for a while now, what's been happening?
06:49:52*Tlanger joined #nim
06:49:56FromDiscord<ElegantBeef> Nimthing much
06:50:19leorizeIC happened
06:50:35leorizedoesn't seem to improve performance by much though
06:51:25FromDiscord<ElegantBeef> Clearly we're just missing the `doItFaster` macro
06:52:59saemStop trying to make fetch happen.
06:53:04*Tlangir quit (Ping timeout: 272 seconds)
06:53:14FromDiscord<Zed> the discord certainly grew a bit
06:53:25FromDiscord<Zed> (edit) "the discord ... certainly" added "channels"
06:53:27saemRude
06:53:44FromDiscord<Zed> lol
06:54:42saemWhat brought you to Nim in the first place?
06:55:25FromDiscord<Zed> my hate for python slowness
06:55:46FromDiscord<Zed> and the fact that i cant stick to one language
06:56:36saemCan I ask what took you away (you don't have to answer if it's a sore spot)?
06:57:55FromDiscord<Zed> Uni did, went to swift and java
06:58:14saemThat'll do it. What brings you back?
06:58:20FromDiscord<Zed> tried go for a bit but hate the amount on `if err != nil{}` you have to put everywhere
06:58:34FromDiscord<ElegantBeef> Clearly they just missed me
06:58:36saemIs it the need... the need for speed?
06:58:44FromDiscord<Zed> yes
06:59:03FromDiscord<Zed> i am speed
06:59:06saemElegantBeef every morning when I'm in work slack I wish I was here so I stop missing you.
06:59:24FromDiscord<Zed> what about you? what brought you here?
06:59:35FromDiscord<ElegantBeef> Saem for some reason i just dont believe you
06:59:54saemDon't torture me. :(
07:00:20FromDiscord<ElegantBeef> Saem is here cause he really is masochistic and loves working on tooling
07:00:33saemOr is one
07:00:56FromDiscord<Zed> ah
07:01:15saemMy day job took me away from programming, I get to talk about it... and even then not even that. Wanted to just do things in my spare time, figured I'd try to get into making crappy games. Started with Typescript, wanted type driven emit, when to Haxe, tried hashlink, it's okish to use, but don't look under the covers...
07:01:54saemThen I saw Nim and HCR and the JS target, figured Haxe is so raw, how far off could Nim be? I'm already in the boonies at this point.
07:02:23FromDiscord<ElegantBeef> It's ok that's where i live
07:02:57FromDiscord<Zed> haha, i assume you've tried impboxs game framework then
07:03:02saemAnyhow... Figured I'd start by fixing the tooling because I want a productive environment and wanted to learn Nim, and the next thing you know I ported the TypeScript extension for Nim to Nim.
07:03:13saemnah, heaps mostly
07:03:16FromDiscord<ElegantBeef> My reason is i wanted to learn something lower than C# and nothing else tickled my fancy at a glance
07:03:37saemin Haxe that is. In Nim I haven't touched anything yet.
07:03:44saemI'm at like step -13
07:03:55FromDiscord<ElegantBeef> I've been toying with godot + nim
07:03:57leorizeI got here because I need pascal with metaprogramming
07:04:24FromDiscord<ElegantBeef> I now cannot use a language without metaprogramming without going crazy
07:04:50saemIt's not that hard, but I also think code generation is good so I'm a little weird.
07:04:58leorizeI can't live without something like Nim's `template` anymore
07:05:11FromDiscord<ElegantBeef> Indeed
07:05:43FromDiscord<ElegantBeef> I wrote a small airplane controller in godot and possibly wrote 1 template to reduce redundant logic
07:06:13FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2L1i
07:06:13FromDiscord<ElegantBeef> Totally not a silly use case 😄
07:06:42FromDiscord<ElegantBeef> ~~Dont say i could just use a var proc~~ that makes too much sense
07:46:38FromDiscord<lqdev> beef lol `lazyClamp(x, y, a, b)` isn't any more readable than `clamp(x + y, a, b)`
07:49:05Zevvno, but it's lazy
07:50:07ZevvI bet it tries not to evaluate "x+y" if not needed
07:51:04FromDiscord<Randall> How do I test a function that raises an exception at compile time? `doAssertRaises` doesn't work (is the code expanded before the template?)
07:51:31FromGitter<ornamentist> The Nim experimental documentation (https://nim-lang.org/docs/manual_experimental.html#concepts) for Concepts shows an example with a Haskell style Functor
07:51:58FromGitter<ornamentist> The last line of that example says the example code prints "true", but for me it prints "false"
07:52:21FromGitter<ornamentist> Has the compiler implementation diverged from that documentation?
07:53:09FromDiscord<CodeHz> why, template is just ast transformer, should got same result as hand-written
07:53:11FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L1t
07:56:02FromDiscord<CodeHz> that's why it is experimental (:
07:57:48FromDiscord<CodeHz> the problem is Option has not export his field
07:58:23FromDiscord<CodeHz> so val is private, maybe they used to be public field
07:58:44FromGitter<ornamentist> Fair enough--I expect experimental features to change as needed by the implementers
08:00:48FromDiscord<CodeHz> (edit) the problem is Option has not export its field
08:03:47FromGitter<offbeat-stuff> https://play.nim-lang.org/#ix=2L1x throws error
08:06:13saemspelling mistake, cxt?
08:06:47FromGitter<offbeat-stuff> thanks very confused myself
08:10:10*PMunch joined #nim
08:10:58FromGitter<offbeat-stuff> print expersion inside templates
08:11:51FromGitter<offbeat-stuff> Like print(createWin("Hello")) becomes like echo "createWin(\"Hello\")"
08:12:45*Tlanger quit (Ping timeout: 240 seconds)
08:13:59*Tanger joined #nim
08:17:41*saem leorize: https://github.com/nim-lang/Nim/pull/16608 that's ma fix.
08:17:42disbotoutline shows included declarations
08:18:39saemOnce that's accepted I gotta tweak the caching structure in my extension but otherwise it should work well. \o/
08:27:22adnan338Hello, How does one define an optional range literal in function arguments. Compiler thinks `proc minute(m : Option[0 .. 59]) = echo m.get()` means m is an Option of a slice
08:31:33FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L1D
08:36:11adnan338https://play.nim-lang.org/#ix=2L1E
08:36:32adnan338Still giving me an issue
08:37:10FromDiscord<Rika> You need to specify it is a range I believe
08:37:22adnan338Did that too
08:37:24adnan338https://play.nim-lang.org/#ix=2L1F
08:38:02FromDiscord<Rika> No, I mean in the some call
08:38:41FromDiscord<Rika> https://play.nim-lang.org/#ix=2L1H
08:39:54adnan338Ah I see. Thank you.
08:40:00*taprack joined #nim
08:46:17*Tanger quit (Remote host closed the connection)
08:54:39FromGitter<offbeat-stuff> How do i import this enum
08:54:41FromGitter<offbeat-stuff> enum class FramebufferClear: GLbitfield { ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ }; [https://gitter.im/nim-lang/Nim?at=5ff57ad081c55b09c7ee4fb5]
08:56:50FromDiscord<mratsim> @offbeat-stuff: type FrameBufferClear {.importcpp, size: sizeof(cint).} = enum
08:57:39FromDiscord<mratsim> for example: https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim#L66-L81
08:58:03FromGitter<offbeat-stuff> Also how do i importcpp values for its fields or do i not need to
08:58:24FromDiscord<mratsim> and another: https://github.com/SciNim/flambeau/blob/master/flambeau/raw_bindings/tensors.nim#L135-L147
08:58:41FromDiscord<mratsim> an enum doesn't have fields
08:58:55FromGitter<offbeat-stuff> For the possible values
08:59:00FromDiscord<mratsim> you need to specify the name = value map yourself
08:59:22FromDiscord<mratsim> especially if they don't go from 0 to max-1
08:59:59FromDiscord<mratsim> you can c2nim that though
09:00:55FromGitter<offbeat-stuff> Well It's quite a big game engine like framework so I don't want to do it also very deep c++ library from magnum.graphics
09:04:04FromGitter<offbeat-stuff> Also cannot convert array[4,float32] to const Color4&
09:04:20FromGitter<offbeat-stuff> In c++ {1.0f,1.0f,1.0f,1.0f} works
09:07:02FromGitter<offbeat-stuff> typedef Math::Color4<Float> Color4;
09:08:56*polm joined #nim
09:15:21FromDiscord<mratsim> you can c2nim the specific enum declaration if it's big
09:15:40FromDiscord<mratsim> you can do initializer lists with varargs
09:16:34FromDiscord<mratsim> this is the syntax: https://github.com/SciNim/flambeau/blob/master/flambeau/raw_bindings/tensors.nim#L318↵@offbeat-stuff
09:19:22FromGitter<offbeat-stuff> mratsim Does 0x00000100 not mean the same in nim
09:19:27FromGitter<offbeat-stuff> as in c++
09:20:11FromDiscord<mratsim> so you can just do proc color4(a0, a1, a2, a3): Color4 {.constructor, importcpp: "Math::Color4<Float>({@}).} and create a small wrapper that unpacks the array[4, float] in individual components
09:20:38FromDiscord<mratsim> it's the same but Nim defaults to int which are 64 bit on 64-bit platforms
09:20:43*Vladar joined #nim
09:20:46FromGitter<offbeat-stuff> typedef unsigned int GLbitfield;
09:20:49FromDiscord<mratsim> C++ default to C int which are 32-bit
09:21:23FromGitter<offbeat-stuff> I think I should just pull em from opengl wrapper
09:21:59FromDiscord<mratsim> so your enum is deriving from an unsigned integer?
09:22:07FromDiscord<mratsim> that's a weird declaration
09:24:07FromGitter<offbeat-stuff> What does invalid order in enum 'DepthBufferBit' even mean
09:27:35PMunchThat you have the elements out of order
09:27:37PMunchBy their value
09:28:01PMunchenum One = 1, Zero = 0 for example
09:28:13PMunchInstead of enum Zero = 0, One = 1
09:30:55*Tanger joined #nim
09:36:38narimiranhey PMunch! i tried to rebase https://github.com/nim-lang/Nim/pull/15729 on the latest devel, but i cannot force-push to your repo. could you do it? (and while at it, you can remove 4 out of 5 my commits - the ones that were reverted)
09:36:39disbotImplements streams for sockets
09:37:00*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:38:50PMunchThe ones from November?
09:40:50polmHello, I'm trying to wrap a C++ library and getting an error on compilation about an "undefined reference to systemInit000" I don't understand
09:41:17polmdetailed error is here: https://gist.github.com/polm/7a6baeed8a49a84b46c4e0285c085514
09:41:27polmcode is here: https://github.com/polm/hajikami/blob/main/hajikami.nim
09:41:32*krux02 joined #nim
09:41:42*taprack quit (Ping timeout: 260 seconds)
09:41:58polmThe systemInit000 seems to be something nim defines internally in c++ code, and I saw some references to it on the forums, but didn't see a similar problem anywhere, so I'm not sure what's going on...
09:46:16narimiranPMunch: you can remove all of mine except "a different way to fix mismatching tags"
09:48:02FromDiscord<inv> Hi. Are there any way to unpublish package from nimble? I want to republish it with lower-case name
09:48:27FromDiscord<Rika> You can rename
09:48:34FromDiscord<Rika> See the packages repo
09:48:34narimiran@inv send a PR where you rename it
09:48:42FromDiscord<inv> yep, thx
09:50:35FromDiscord<inv> https://github.com/nim-lang/packages/pull/1773
09:50:36disbotDecimal => decimal
09:51:08*mids joined #nim
09:53:49*taprack joined #nim
09:56:29narimiranPMunch: heh, you don't believe in force push, huh? :D
09:56:38PMunchThat was a force push..
09:56:44PMunchBut I messed it up
09:57:39PMunchI'm not quite sure what you want me to do TBH
09:58:48narimiransorry :)
09:59:12narimirani guess you merged devel, not rebased
09:59:48narimiranoh, now is ok
10:00:24narimirani guess the only problem was that github showed me "there are xyz changes since you last viewed this PR"
10:01:02PMunchOnly thing I did was force-push the backup I took of the old branch before I started messing about with it :P
10:01:17PMunchAnd yeah, I messed up and merged with devel at some point..
10:01:58PMunchTo tidy it up I think I need to start on a fresh devel and cherry-pick in our changes
10:02:12PMunchThen force-pushing that
10:02:29narimirani have that version, but i cannot force-push it
10:03:48narimiranbut i didn't have to do any cherry picking, it was just `git rebase devel`
10:04:28narimiranand then `git rebase -i HEAD~10` to remove my unneeded commits
10:05:09FromGitter<HJarausch_gitlab> Have a macro disabling itself if called a second time *within the same namespace*. E.g. if it is within the same proc outside of any *block*. Is this possible?
10:07:11FromDiscord<haxscramper> You probably can hack it with two-step macro, something like `when not declared(macroWasEvaluated): macroBody` and `const macroWasEvaluated = true` following it
10:07:42FromDiscord<haxscramper> This might prevent evaluation of the same macro in the scope
10:07:43PMunchnarimiran, there, better?
10:08:04PMunchMaybe I should've renamed your commit while I was at it..
10:08:14narimiranyeah :)
10:08:16narimiranand yeah :)
10:08:30FromDiscord<haxscramper> But that is an ugly hack, and you should really try to avoid this
10:08:58PMunchThere you go
10:12:49narimiranPMunch: great, thanks! now, what to do with @planetis-m's remarks? should `rsPeekData` be changed or not?
10:13:02narimiran(i can do that, just want your input on it0
10:14:56*polm left #nim (#nim)
10:20:00PMunchNope, his changes doesn't make sense in the slightest
10:20:20PMunchHe sets result to the amount of data received, which is just wrong
10:21:16PMunchImagine I read 10 bytes, then setPosition to 5 and then read 10 bytes. Then if will see that it needs to read 5 more bytes, read those into the buffer, copy ten bytes from position 5 and out into the buffer, and return 10.
10:21:27PMunchHis version will do the same reading, but return 5
10:24:58PMunchOnly problem in my solution is if `recv` reads less than the given amount of bytes, then it will return a buffer with 0s in it
10:25:05PMunchGuess that should be fixed
10:30:43narimiranPMunch: before you do that, let me push just the move to `std/`
10:31:33narimirandone. and your explanation for rsPeekData makes sense to me
10:36:03PMunchGood, want to try your hand at implementing it? :P
10:36:43narimirannot sure you really want that :P :D
10:38:20narimiranoh, wait. can we use the value we now discard?
10:57:36PMunchYup, that's the idea
11:00:33narimiranPMunch: ok, i'll give it a try after lunch and i'll ping you when i have something (most likely: something = questions)
11:00:42PMunchHaha, sounds good
11:08:10FromDiscord<inv> @timotheecour Hi, Are you here? What do you think about the line? Should it pass opt param?: https://github.com/nim-lang/Nim/blob/version-1-4/lib/std/jsonutils.nim#L214
11:08:33*planetis[m] joined #nim
11:09:07FromDiscord<inv> I think probably yes, but maybe there are some meanings why it was not passed
11:17:04FromGitter<timotheecour> @inv indeed, seems like just a bug (and likewise with a few other cases in this file), PR welcome
11:21:54*NimBot joined #nim
11:24:13*taprack quit (Ping timeout: 264 seconds)
11:31:39*reversem3 joined #nim
11:38:14*planetis[m] joined #nim
11:38:15planetis[m]PMunch: imo rsReadData should save the read bytes into result and rest of the procs would use that
11:38:23planetis[m]just like other stream implementations
11:40:24PMunchInstead of doing it the other way round like I do?
11:41:07PMunchI just felt that was the more natural way of doing it when I wrote it. One that reads data, and one that reads data and updates the position
11:41:16PMunchSeems like a pretty obvious composition
11:41:29PMunchInstead of one that reads and updates, and one that reads, updates, and resets the position
11:42:50planetis[m]Well that way, you can fix reading '\0' more easily, but I guess this is only one way to do it
11:43:14PMunchWhy would that be easier?
11:45:12*lf joined #nim
11:45:36*lf is now known as Guest25945
11:52:01narimiranPMunch: planetis[m]'s way indeed fixes his example
11:52:58PMunchYes, but it doesn't work in the general case if you use setPosition
11:53:22PMunchWhat he does is basically an incorrect version of returning the actual amount
11:53:38PMunchIt only works correctly for the s.pos == oldPos branch
11:53:53PMunchOr oldLen I think the variable is called
11:55:41narimirantrue, i'll try to see if i can make it generally correct
12:04:28*rockcavera joined #nim
12:11:57*GitterIntegratio joined #nim
12:11:57*jaens[m] joined #nim
12:11:57*leorize[m] joined #nim
12:11:57*lytedev[m] joined #nim
12:11:57*unclechu joined #nim
12:11:57*Avatarfighter[m] joined #nim
12:11:57*lnxw37d4 joined #nim
12:11:58*xigoi[m] joined #nim
12:11:58*MTRNord1 joined #nim
12:11:58*juanfra__ joined #nim
12:11:58*Avahe[m] joined #nim
12:11:58*BitPuffin joined #nim
12:12:03*JochenSchroeder[ joined #nim
12:12:03*Zoom[m] joined #nim
12:12:04*pixtum[m] joined #nim
12:12:04*j-james[m] joined #nim
12:12:04*ee7[m] joined #nim
12:12:04*Clonkk[m] joined #nim
12:12:04*VijayMarupudi[m] joined #nim
12:12:04*nikki93[m] joined #nim
12:12:04*Juno[m] joined #nim
12:12:06*dilawar_uchiha[m joined #nim
12:12:08*cmc[m] joined #nim
12:20:02*xet7 joined #nim
12:20:23*spiderstew_ quit (Ping timeout: 272 seconds)
12:21:02*spiderstew joined #nim
12:28:03*Arrrrrrrr joined #nim
12:28:16*adnan338 quit (Remote host closed the connection)
12:30:36*Guest25945 quit (Quit: Guest25945)
12:31:12PMunchHmm, got an issue with running stuff on the ESP8266
12:31:32*vsantana joined #nim
12:31:36PMunchIt runs my loop just fine, but after the loop it seems like the garbage collector is taking too long, so the hardware reset triggers
12:32:05PMunchFor that to happen it needs to run for over a second..
12:34:14*Arrrrrrrr quit (Ping timeout: 264 seconds)
12:34:25PMunchhttp://ix.io/2L2M
12:34:33PMunchThat's my setup ^
12:34:43*Arrrrrrrr joined #nim
12:34:44PMunchWeirdly the reset doesn't seem to work either, it just never comes back
12:35:06PMunchUntil I hard reset
12:35:31PMunchOh wait, now the reset seems to work
12:36:03PMunchThis is the output by the way: http://ix.io/2L2N
12:36:36PMunchAs you can see it prints the "Solved in: 99" part, so it completes everything I have in my loop
12:37:37narimiranPMunch, planetis[m]: this seems to me like a fix: https://play.nim-lang.org#ix=2L2P
12:38:21narimiranwait, line 7 might not be correct; line 11 should be
12:39:39narimiranyeah, line 7 should be as it was before, we need to change only line 11 as shown
12:40:08PMunchWhat do you mean as before?
12:40:17narimiran`result = s.data.recv(s.buf[s.pos].addr, s.pos - s.buf.len + bufLen)`
12:40:34PMunchNope
12:40:37PMunchThat's not correct
12:40:45PMunchOh wait
12:40:51PMunchI think that whole line might be wrong..
12:41:20PMunchBasically that case is for when setPosition is put into the unread part of the buffer
12:41:26narimiranyes
12:41:38PMunchIt should read all from the last read byte up to the byte requested
12:41:46narimiranoh!
12:41:48PMunchImage I sent "Hello"
12:42:03PMunchThe receiver calls read(2) which puts He in the buffer
12:42:21narimiranthen `s.buf[s.pos].addr` should be `s.buf[oldLen].addr` and the remaining logic also changes
12:42:23PMunchThen setPosition(4) which sets the position to where the o would go
12:43:49PMunchnarimiran, correct
12:44:23narimiranPMunch: ok, let me work on that one. can you see if line 11 (when s.pos is somewhere earlier) seems correct to you?
12:44:32PMunchBasically all those recv(s.buf[s.pos]) should read to the old top of the buffer
12:45:11narimiranindeed
12:46:07PMunchYeah that one seems correct
12:46:39narimiran`s.buf.setLen(max(s.pos + bufLen, s.buf.len))` -- this might need a change too, huh?
12:47:13PMunchNo that's correct
12:47:32narimiraneven if `s.pos` is set somewhere further down?
12:47:43PMunchMhm
12:47:44narimiran(your example with setPosition(4))
12:48:08PMunchsetPosition(4) read(1) would set the buffer size to 5
12:48:11PMunchWhich is correct
12:48:12narimiranok
12:49:00PMunchThe buffer never shrinks (that's why we need the resetStream procedure) as the user can setPosition(0) at any point
12:49:58PMunchHmm, this ESP8266 error is really weird
12:50:26PMunchI added a Serial.println("Done") manually in the generated .cpp file at the very end of my loop procedure. And that works fine
12:50:49PMunchAnd `loop` is called by the ESP8266 firmware..
12:51:37narimiranPMunch: https://play.nim-lang.org#ix=2L2S - updated version
12:53:57narimiraneh, either my test example is shit, or my implementation is :)
12:59:14narimiran(found the problem)
13:00:02PMunchYeah, that + s.pos - oldLen should be - (s.pos - oldLen)
13:02:12narimiranyeah
13:03:16narimiranbut, there are corner cases (end of stream), where we need to do that a bit more differently. let me test it a bit more, before showing you
13:03:29PMunchThere is?
13:03:40narimiranyep
13:03:56narimiranif you read zero, it should stay at zero
13:04:18PMunchShould it though?
13:04:53PMunchIf position is smaller than end of buffer we still have data to give back
13:05:26PMunchI mean if it's larger it should obviously return 0 and not a negative number
13:07:47narimiranPMunch: here you go, together with the test i run: https://play.nim-lang.org#ix=2L32
13:08:21narimiranboth of the "unequal cases" have the same logic!
13:08:23*opal quit (Ping timeout: 240 seconds)
13:09:17narimiranand you cannot add `oldLen - s.pos` to the result unconditionally
13:10:50PMunchThat won't work
13:11:10PMunchIf position + bufLen is smaller than oldLen
13:11:29PMunchBasically if we have read(10) setPos(0) read(5)
13:11:47PMunchThat would now call recv(10, 0)
13:12:28PMunchWhich I guess might be a nop, but it would return 0 so nothing would be copied and result would be 0
13:21:25*opal joined #nim
13:27:17FromDiscord<fwsgonzo> is it possible to add an import path to the nim invocation?
13:27:28FromDiscord<fwsgonzo> so that "import ffi" will find ffi.nim in a specific path
13:28:10*Tanger quit (Read error: Connection reset by peer)
13:31:07*Guest25945 joined #nim
13:31:18FromDiscord<fwsgonzo> I found it, it's -p=PATH
13:37:42FromDiscord<fwsgonzo> can I create comptime hash sets and trees?
13:37:48*filcuc joined #nim
13:37:53FromDiscord<fwsgonzo> for perfect hashing
13:38:14FromDiscord<fwsgonzo> I used frozen a lot with C++ (https://github.com/serge-sans-paille/frozen)
13:48:59FromDiscord<fwsgonzo> (edit) can I create compile-time hash sets and trees?
13:53:20FromDiscord<mratsim> @fwsgonzo yes you can
13:53:53FromDiscord<mratsim> Nim tables and set work at compile-time
13:54:09FromDiscord<mratsim> for example: https://github.com/mratsim/compute-graph-optim/blob/master/e07_part1_var_ADTs_tables.nim#L30-L34
13:54:54FromDiscord<mratsim> and this state machine generator makes liberal use of compiletime hashsets and ashtables: https://github.com/mratsim/Synthesis/blob/master/synthesis/factory.nim#L35-L74
13:57:46FromDiscord<fwsgonzo> do you use unreachable to teach the compile-time that it stops there?
13:58:41FromDiscord<mratsim> it's for the C compiler to also check that it's unreachable, and it reduces codesize as well because it won't insert a return/jump
14:00:51ForumUpdaterBotNew thread by Pumpus: Acquire webcam on Windows 10, see https://forum.nim-lang.org/t/7339
14:04:57*PMunch quit (Quit: leaving)
14:07:39FromDiscord<mratsim> @Recruit_main707 you are wanted: https://forum.nim-lang.org/t/7334#46535
14:11:24*taprack joined #nim
14:12:26FromDiscord<fwsgonzo> is it possible to use the official hash sets at compile time? like toHashSet
14:13:09FromDiscord<fwsgonzo> I suppose that at least it's possible to create frozen containers in Nim? that's good enough for me, I'm just surveying the language
14:13:21FromDiscord<mratsim> I use the official hashsets in synthesis
14:14:01mipri!eval import sets; const t = {1: 2, 3: 4}.toHashSet; echo t
14:14:04NimBot{(3, 4), (1, 2)}
14:14:05FromDiscord<mratsim> not sure what frozen containers are. Most of Nim can work at compile-time as long as it doesn't use FFI or pointers
14:14:31FromDiscord<mratsim> I do BigInt and cryptography at compile-time
14:14:35FromDiscord<fwsgonzo> it's for perfect hashing and building other compile-structures using them
14:14:52FromDiscord<mratsim> I do compilers at compile-time 😛
14:15:03FromDiscord<fwsgonzo> cool 😉
14:15:34FromDiscord<mratsim> not joking, you can build a compiler for your own language in Nim macros.
14:16:07FromDiscord<fwsgonzo> I will try to make do with Nim
14:16:22FromDiscord<fwsgonzo> I'm using it for general computatin at the edge in $enterpriseproduct
14:16:23FromDiscord<mratsim> I don't think there is a language that even come close to Nim in terms of compile-time capabilities.
14:16:32FromDiscord<fwsgonzo> (edit) "I'm using it for general computatin at the edge in $enterpriseproduct ... " added "so cycles count"
14:16:36FromDiscord<mratsim> including D and C++
14:17:13FromDiscord<fwsgonzo> perhaps, but I can do crazy things like handle C calling convention using template arguments in C++
14:17:40FromDiscord<fwsgonzo> auto [i, f, counter, t] = vm.sysargs<int, float, uint64_t, struct test> ();
14:17:43FromDiscord<mratsim> calling convention is a runtime thing
14:17:44FromDiscord<fwsgonzo> (edit) "auto" => "`auto" | "();" => "();`"
14:17:57FromDiscord<mratsim> and Nim can use C++ tricks just fine
14:18:13FromDiscord<fwsgonzo> it's also runtime to frozen.contains(item)
14:18:37FromDiscord<fwsgonzo> but C++ has some extra oomph with parameter packs and lambda fols
14:18:38FromDiscord<fwsgonzo> (edit) "fols" => "folds"
14:18:49FromDiscord<mratsim> this is an example to wrap C++ initalizer lists: https://github.com/SciNim/flambeau/blob/master/flambeau/raw_bindings/tensors.nim#L318
14:20:06FromDiscord<fwsgonzo> https://github.com/fwsGonzo/libriscv/blob/master/lib/libriscv/machine_vmcall.hpp#L4-L25↵↵^ there I am using a lambda fold to place all the correct types in the correct registers for a call
14:21:06FromDiscord<fwsgonzo> so ints go into integer registers, floats into FP regs and structs get pushed on the stack and then the resulting address in an integer register
14:22:09*waleee-cl joined #nim
14:22:09filcucis there a way to display the nim code for a NimNode
14:22:13FromDiscord<mratsim> C++ is limited to work with assembly and registers
14:22:15filcucjust for debugging a macro output
14:22:15FromDiscord<mratsim> https://github.com/mratsim/constantine/blob/master/constantine/arithmetic/assembly/limbs_asm_montred_x86_adx_bmi2.nim#L142
14:22:28FromDiscord<mratsim> You can have an assembler in Nim macro
14:22:38FromDiscord<mratsim> @filcuc: echo myNode.repr
14:22:51FromDiscord<mratsim> treerepr and toStrLit are also useful
14:23:07FromDiscord<fwsgonzo> yes I dont doubt that the compile time features are stronger
14:23:38FromDiscord<mratsim> when you need low-level stuff, you don't need tricks, you can make inline assembly very convenient.
14:23:56FromDiscord<fwsgonzo> I don't see much inline functions in regular nim code, are they lacking features?
14:24:23FromDiscord<mratsim> inline functions as {.inline.}?
14:24:33FromDiscord<fwsgonzo> no, lambdas, like for custom sorting of a container
14:24:43FromDiscord<mratsim> closures you mean
14:25:00FromDiscord<mratsim> you can use templates like mapIt to avoid the function call overhead
14:25:26FromDiscord<mratsim> but the closure syntax is a bit noisy that's true, but it does work, you'll see it in networking library
14:25:39FromDiscord<mratsim> you have "onConnect" "onDrop" things
14:25:46FromDiscord<fwsgonzo> right
14:26:50FromDiscord<mratsim> you can also pass them to C: https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/mp4.nim#L116-L150
14:29:03filcucanother one...is there a way fields associated to a type. Usually this can be done for procs. A workaround/idea is to declare globals and add procs associated to the type for returning those globals
14:29:08filcucis this the way to go?
14:30:54*Guest25945 quit (Quit: Guest25945)
14:31:03*opal quit (Ping timeout: 240 seconds)
14:31:11*Guest25945 joined #nim
14:31:53*opal joined #nim
14:31:58FromDiscord<mratsim> @filcuc, I'm not sure what you mean by fields associated to a type
14:32:11FromDiscord<mratsim> like "foo: int"
14:32:15FromDiscord<fwsgonzo> right, you can pass closures as long as they are .cdecl. ?
14:32:22FromDiscord<mratsim> yes
14:32:38FromDiscord<fwsgonzo> ill have to remember that
14:32:43FromDiscord<mratsim> and push checks:off, and gcsafe to ensure no GC and Nim checks
14:33:05FromDiscord<mratsim> otherwise if you use Nim ints inside it might want to throw.
14:35:56*taprack quit (Ping timeout: 240 seconds)
14:36:52FromDiscord<mratsim> @fwsgonzo My assembler as macro is pretty simple and should be easily adaptable to Riscv5: https://github.com/mratsim/constantine/blob/master/constantine/primitives/macro_assembler_x86.nim#L431-L650
14:37:18filcucmratsim i mean: given a type T writing something like T.foo
14:37:24filcucwhere foo could be a string
14:38:42FromDiscord<mratsim> @filcuc, does that inspire you? https://github.com/status-im/nim-cookbook/blob/master/dynamic_approximating_dynamic_types.nim#L35-L38
14:38:47FromDiscord<fwsgonzo> you mean for binary translation?
14:38:52filcuc...sorry for the stupid questions but i'm really rusty with Nim..it's been a while
14:40:17filcucmratsim i don't see something like `type Machine = object` and somewhere `Machine.foo`...am i missing something?
14:40:31FromDiscord<mratsim> @fwsgonzo I mean it seems like you need to carefully maniuplate the stack and registers of a Riscv5 machine.
14:40:43FromDiscord<VVX7> sent a code paste, see https://paste.rs/z3e
14:41:24FromDiscord<VVX7> so I just want to confirm if I need to build bearssl for my target first and then cross-compile, or if nim should do this magically
14:41:51FromDiscord<mratsim> @filcuc, this is an example of using the `.` and `.=` operators to do Something.foo
14:41:57FromDiscord<mratsim> that something can be a T
14:42:33FromDiscord<mratsim> @VVX7 Bearssl should be built magically
14:43:07filcucmratsim...mh i fill stupid...but isn't `a` and instance of an Action istead of the type itself?
14:43:30filcucmratsim my idea was to use typedesc in practice
14:43:33FromDiscord<mratsim> sure but you can change the template `.`(a: type Action)
14:43:41FromDiscord<mratsim> instead of a: Action
14:44:08filcucah didn't knew the syntax (a: type Foo)
14:44:11filcuc:)
14:44:12FromDiscord<mratsim> @VVX7 can you check if it uses a submodule? you might be missing the submodule
14:44:18FromDiscord<VVX7> @mratsim thanks, now to figure out why it thinks the library isn't there
14:44:59FromDiscord<mratsim> @VVX7 https://github.com/status-im/nim-bearssl/tree/master/bearssl
14:45:25FromDiscord<mratsim> we use bearssl as a git submodule so git submodule update --init --recursive handles that for us
14:45:52FromDiscord<mratsim> I think nimble is supposed to do the submodules as well cc @dom96
14:45:54FromDiscord<VVX7> innstalling from nimble I can see that it pulled the csources
14:46:01FromDiscord<mratsim> ah
14:46:51FromDiscord<VVX7> and I can compile the same nim file on linux to an ELF,, but it complains the file is not there when the target is windows
14:47:37FromDiscord<mratsim> we test on windows though: https://github.com/status-im/nim-json-rpc/blob/master/.appveyor.yml
14:49:39*abm joined #nim
14:58:00FromDiscord<inv> I am a bit confised: I am trying to make a PR, doing ./koch test, and I see that it tests my local Nim code, not from the folder I cloned to fix bug
14:58:11FromDiscord<inv> Could you please let me know how to avoid it ?
14:58:31FromDiscord<inv> (edit) "?" => "and test local-dir-nim only?"
14:58:37FromDiscord<inv> (edit) "confised:" => "confused:"
14:59:24FromDiscord<inv> (edit) removed "local" | "code," => "code from HOME,"
15:01:03*opal quit (Ping timeout: 240 seconds)
15:03:01FromDiscord<mratsim> echo $PATH and check if you didn't override stuff?
15:04:38FromDiscord<inv> @mratsim pretty sure I did not, But I was not sure I have to overrite it
15:04:47FromDiscord<inv> (edit) "overrite" => "overwrite"
15:04:59saemDid you install Nim via choosenim
15:05:03saem?
15:05:03FromDiscord<mratsim> you don't have to
15:05:10*opal joined #nim
15:06:02saemIf so, you need to tell choosenim to use your local repo as the Nim install
15:06:51saemThis and more is covered in the complier build instructions.
15:08:34FromDiscord<Recruit_main707> @mratsim thanks for the ping
15:09:03saemWhich are briefly covered in the readme and then more detailed ones are linked from there. I bumped into some walls myself at first and made a PR to docs to make it a little easier. So keep at it, inv.
15:17:52*PMunch joined #nim
15:19:18PMunchHmm, my ESP8266 runs out of memory when I run some Nim code on it
15:19:44PMunchOr rather the Nim code runs fine, but it takes up all the memory and the ESP code crashes when it tries to get some more
15:19:59PMunch(I'm using ARC by the way)
15:20:31PMunchThe strange thing is that looking at the C code it appears to do the right thing and call free at the end of the procedure
15:21:34narimiranwas that pun intended?
15:21:49PMunchHuh?
15:21:52PMunchWhich one? :P
15:21:56narimirani use ARC, btw
15:22:05PMunchHaha, no that wasn't intentional
15:22:29narimiranwe should use that one officially! :D
15:24:49FromDiscord<inv> saem, I just jumped to Running Tests on the page: https://nim-lang.github.io/Nim/contributing.html
15:25:35FromDiscord<inv> and nothing about choosenim there
15:26:11FromDiscord<Enimatek> is there a way to do something like `var list: seq[typed] ` and have an array-kind that is .add()-ble ? except for varargs that is predefined i can't seem to find a solution for this
15:26:34FromDiscord<Rika> wdym? seq typed?
15:26:35PMunchHmm changing from "for line in grid: serialPrintLn($line)" to "for i in 0..grid.high: serialPrintLn($grid[i])" everything works fine
15:26:50FromDiscord<Rika> you cannot have a heterogeneous seq
15:26:55FromDiscord<Enimatek> a seq that can be filled with all kinds of stuff
15:27:05FromDiscord<Rika> no, impossible
15:27:07disrupteki've had hetero seqs many times.
15:27:17PMunch<_<
15:27:19FromDiscord<Rika> unless you do what in rst land is called boxing i think
15:27:27mipriuse OO or variant types.
15:27:29FromDiscord<jken> sent a code paste, see https://play.nim-lang.org/#ix=2L3Q
15:27:47FromDiscord<Rika> jken its not even a good solution imo
15:28:02FromDiscord<mratsim> @Rika Rust Box = putting on the heap. Nim ref T == Rc[Box[T]] in Rust
15:28:04FromDiscord<Enimatek> problem is, the exec of sql has a varargs[typed] input
15:28:06FromDiscord<jken> I am learning 🤷‍♂️
15:28:18PMunchShouldn't you theoretically be able to store an "ref object of RootObj" in a seq as pointers and get them out and read their types?
15:28:21FromDiscord<Rika> now everything is scattered everywhere in memory
15:28:22PMunchThose store types right?
15:28:25FromDiscord<Rika> i see, thanks
15:28:46FromDiscord<mratsim> @Enimatek it's a compile-time sequence, in the compiler everything is an AST node so it technically has the same type.
15:28:50PMunchEnimatek, that is because it's a macro
15:29:01FromDiscord<jken> @Rika I was working on an ECS, and was only concerned about fragmentation in the seqs themselves, not fragmentation of list locations in memory
15:29:06FromDiscord<jken> but you are right
15:29:27FromDiscord<Rika> yeah it can be a problem in the common applications for a seq
15:30:07saem@inv those docs could probably use a minor improvement reminding first timers to go read the complier development set up docs.
15:30:17FromDiscord<Rika> solution here would be to make whatever youre using a macro as well, or if that doesnt fit what you need then maybe manual work will 😉
15:30:58*Guest25945 quit (Quit: Guest25945)
15:31:27Oddmongerwhat is the best way to extract a line in a buffer ? regex ?
15:31:32*Guest25945 joined #nim
15:31:41FromDiscord<Enimatek> hm, ok, thnx, im not familliar with marcros so i will see how that works for me, else i can use .exec 'unsafe' but i'd rather not
15:31:41saemBeyond that the complier isn't a simple project, so I would perhaps adjust your expectations slightly in that you're like not going to be able to jump to a subsection and have sufficient context to succeed without prior knowledge which it far too large to cover/reference each time.
15:32:30FromDiscord<inv> Fk Yeah, I am Nim contributor 🙂 https://github.com/nim-lang/Nim/pull/16612
15:32:31disbotjsonutils: fromJson forward opt param fix
15:32:52FromDiscord<mratsim> not merged yet
15:32:53FromDiscord<mratsim> :p
15:33:12FromDiscord<inv> @mratsim you know how to destroy the day 🙂
15:33:20saemLoL
15:33:39FromDiscord<inv> I am going to try to backport it into 1.4
15:33:43saemI've made one or two myself, you're well on your way
15:35:33FromDiscord<inv> I have a question, If it will in in dev branch - will it appear in 1.4.x later?
15:35:33saemAnyhow, I had to choosenim path/to/my/git/local/repo so my pathing behaved. It sounded like you might be having the same issue.
15:35:37*filcuc quit (Ping timeout: 264 seconds)
15:35:50FromDiscord<fwsgonzo> there is nothing special about db_sqlite, right? so I can use ":memory:" for an in-memory database?
15:36:02FromDiscord<Rika> will whoever managed nim-lang/packages reject my pr to add my package if it has no tests?
15:36:09FromDiscord<Rika> manages not ed
15:36:10disruptekno.
15:36:17disruptekgonzo: yes.
15:36:47FromDiscord<fwsgonzo> nvm, db_sqlite seems to include dlfcn.h which is a bad sign 😉
15:37:07FromDiscord<Rika> what is wrong with whatever dlfcn.h is?
15:37:45FromDiscord<fwsgonzo> its for linuxs dynamic loader/linker, and this is in a VM, there's no dlopen here
15:37:56FromDiscord<fwsgonzo> but I can embed sqlite myself
15:40:23FromDiscord<mratsim> @fwsgonzo: you can use this code for sqlite3 as a in-memory KVstore: https://github.com/status-im/nim-eth/blob/master/eth/db/kvstore_sqlite3.nim#L344
15:40:56FromDiscord<mratsim> it's a wrapper around this sqlite3 package into a single C file: https://github.com/arnetheduck/nim-sqlite3-abi
15:41:38FromDiscord<fwsgonzo> oh nice
15:42:49^Q-Master^I've updated my https://github.com/Q-Master/packets.nim. Comments are welcome.
15:46:08FromDiscord<andeee> Could someone help me with fixing this error? I've also tried to do strVal(n) but there is an error for that as well. I'm working on some code written by someone else from 2 years ago. Thanks https://media.discordapp.net/attachments/371759389889003532/796404238707589160/unknown.png
15:46:24Oddmongeri'me trying to do some string extraction, but i'm not accustomed to nim regex, and i don't understand the problem here: https://play.nim-lang.org/#ix=2L3Y
15:46:53FromDiscord<Rika> andeee maybe `$n`?
15:47:21FromDiscord<Rika> i do not remember how macros worked back in 0.18 (even though i used nim briefly then)
15:47:39FromDiscord<andeee> i get `type mismatch: got <string> but expected 'NimNode = ref NimNodeObj'` for bot $n and n.strVal()
15:47:40disruptekrepr n
15:47:47Oddmongerforget the previous and use this one, without the typo: https://play.nim-lang.org/#ix=2L3Z
15:49:06FromDiscord<andeee> ok nevermind, i made it a template instead of a macro
15:49:26FromDiscord<andeee> maybe the old macros became templates in the meantime?
15:49:46disruptekoddmonger: use nre
15:50:23FromDiscord<Rika> andeee doubt that, maybe this use case for a macro no longer applies
15:50:59Oddmongerdisruptek: nre"…" , in the regex string definition ? I get the same strange error ( missing closing bracket)
15:51:07mipriOddmonger: https://play.nim-lang.org/#ix=2L42
15:51:38Oddmongerah ok, i see
15:51:42disruptekno, the nre stdlib package. ideally, use nitely's pure-nim regex.
15:51:54FromDiscord<Rika> mipri why would the backslashes in the re"" be interpreted raw though i do wonder
15:52:17FromDiscord<Rika> i know re"" is raw
15:52:21Oddmongerthank you mipri, and i have now a look on nre package
15:52:23disrupteki don't think they are anchored by default but i could be wrong.
15:53:09Oddmongeranyway, returned seq is still empty ^^'
15:53:20miprihttps://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals - and before that, raw string literals. \" isn't a special escape. It's just \ and then the end of the string literal.
15:53:38disruptekoddmonger: nre example of match here:
15:53:41disruptek!repo bump
15:53:42disbothttps://github.com/disruptek/bump -- 9bump: 11a tiny tool to bump nimble versions 🍻 15 19⭐ 2🍴 7& 1 more...
15:53:47FromDiscord<Rika> i know they are raw
15:53:53disrupteksearch for `crazy spaces`.
15:54:02FromDiscord<Rika> i just wonder why backslashes before quotes wouldnt be a special case
15:54:30mipriOddmonger: https://play.nim-lang.org/#ix=2L44
15:55:34miprimanual: it's like this. you: but shouldn't something else be the case? \ isn't interpreted at all, so \" can't be, and or else you'd then need some way to express a literal \" in your string, needing \\, which means you have to interpret \ again.
15:56:19disruptekyou're blowin' my mind right now.
15:57:17miprithere is another way to do it: `discard match(buffer, re".*name:""([^""]+).*", extract)`, doubling the internal "
15:57:41Oddmongerin short, \ is a regular char in re, and not in nre ? (looking at «crazy spaces» from disruptek )
15:58:00mipriwhat I'd really prefer is some way to have an arbitrary delimeter for strings, like Perl/Ruby q{}, or Rust's r####""####, or D's q"blah
15:58:23Oddmonger[[ ]] in Lua
15:59:38Oddmongerthank you btw for the answer ,it was not so easy
15:59:52*taprack joined #nim
16:00:35*lritter joined #nim
16:01:00mipriit's certainly unfortunate that syntax highlighting doesn't follow how raw strings actually work.
16:01:35Oddmongerand now, why seq[string] returns empty , and array[1,string] is ok, that's another mysterii
16:03:08miprihttps://play.nim-lang.org/#ix=2L4b
16:03:18disrupteksyntax highlighting does follow raw strings.
16:04:58mipridisruptek: https://play.nim-lang.org/#ix=2L4c <- that's highlighted as one contiguous string literal. The string ends at the first " and another one starts at the second ", and the 'internal' [ in the gap causes a syntax error as it's unmatched.
16:05:43FromDiscord<andeee> noob stupid question, how do i convert from an int to a csize_t, I've tried to do .toU16 cause from what i know the csize is an unsigned int but still get complaints
16:05:46disrupteki don't consider the playground, period.
16:05:59disruptekx.csize_t
16:05:59mipriit's the same in vim.
16:06:06disrupteknope.
16:06:48FromDiscord<andeee> dirsuptek, that was easy 🤦‍♂️, thanks
16:07:05disruptekmipri: see the nimTripleQuote syntax identifier.
16:07:06Oddmongerah seq must be initialized… but shouldn't the match function raise an exception with an empty seq ?
16:07:20disruptekoddmonger: yes; it's annoying. i complained about it.
16:07:27FromDiscord<Rika> im not a fan of the custom string delimiter idea
16:07:31miprino, the seq is initialized. it's just zero-length, so the group isn't saved.
16:07:40FromDiscord<Rika> can become confusing since i sometimes code with no highlighting
16:10:44mipriOddmonger: this is a mistake you make once, and then you learn how re works, and then you don't need it again. Doesn't seem like a good candidate for a permanent runtime cost.
16:11:58miprinim-regex lets you have a RegexMatches object that accepts as many groups as are in the regex, so no need to care about the size in two places. It also stores indices there instead of always copying into the matches array.
16:23:36*taprack quit (Ping timeout: 256 seconds)
16:26:25*letto quit (Ping timeout: 240 seconds)
16:26:29*letto_ joined #nim
16:27:32*habamax joined #nim
16:28:48*taprack joined #nim
16:31:19*Guest25945 quit (Quit: Guest25945)
16:31:34*Guest25945 joined #nim
16:35:56*taprack quit (Ping timeout: 240 seconds)
16:38:16*filcuc joined #nim
16:42:31*taprack joined #nim
16:44:38*filcuc quit (Ping timeout: 256 seconds)
16:46:12disruptekHEARTS AND MINDS
16:46:25disrupteki'm looking at you, rika.
16:47:49Zevvooh living on the edge. code with no highlighting
16:49:45FromDiscord<Randall> How can I test a function with `{.compileTime.}` that throws an exception (which is expected behaviour). Should I eliminate the exception from the function, and return a different result?
16:50:01disruptekuse my testes; go on, use them.
16:50:04disruptek!repo testes
16:50:05disbothttps://github.com/disruptek/testes -- 9testes: 11a small unittest framework with decent support 🔴🟡🟢 15 24⭐ 1🍴 7& 29 more...
16:50:17disrupteksee the `expect:` template.
16:50:22disruptekZevv: today is a cps day.
16:51:12FromDiscord<mratsim> 😄
16:51:50FromDiscord<mratsim> @Randall you like to live dangerously
16:52:04FromDiscord<mratsim> maybe to try except
16:52:07FromDiscord<mratsim> do
16:52:21FromDiscord<Randall> Yeah, trying to do some parsing at compile time, but things like `doAssertRaises` cannot handle this use case
16:52:42FromDiscord<Rika> disruptek sorry for having a lower iq recently
16:52:49disruptekfile a bug report if my testes don't fit.
16:52:55FromDiscord<mratsim> the thing is, {.compileTime.} function don't work in a static block and I think try/except won't catch at compile-time unless in a static block
16:53:02disruptekyour needs, i mean.
16:53:44FromDiscord<Randall> I'll see if disruptek's testes work as expected.
16:54:44FromDiscord<Randall> @mratsim it's not happening in a static block, but in a macro. So the macro parses some ast stuff which yields some strings I'd like to parse
16:54:48*fputs joined #nim
16:55:16FromDiscord<mratsim> I think try except work in macro but in macros I try to use bool.
16:55:45FromDiscord<Randall> Considering this function is supposed to return a seq, it might just return an empty seq and check on that
16:55:48FromDiscord<mratsim> just do all your processing in a proc, the macro should only convert an input to nimnode
16:57:36FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L4A
16:58:59FromDiscord<Randall> (edit) "https://play.nim-lang.org/#ix=2L4A" => "https://play.nim-lang.org/#ix=2L4B"
16:59:36*hnOsmium0001 joined #nim
16:59:52FromDiscord<mratsim> use parseutils, it returns a bool
17:00:08FromDiscord<mratsim> regex at compile-time is asking for troubles
17:00:25FromDiscord<Randall> I'm not using regex
17:02:25FromDiscord<Randall> What I meant by regex, is that the `router` macro should compile to a `proc match(path: string): Route` that is effectively a parser based on the route definitions.
17:02:51FromDiscord<Randall> (edit) "What I meant by ... regex," added "unrolled"
17:04:42Zevvdisruptek: never skip cps day
17:04:48FromGitter<HJarausch_gitlab> How to disable *genSym* in a macro? ⏎ If have ``` ⏎ result = quote do: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ff5edb0d5f4bf2965cd5c46]
17:04:54disruptekbut i must.
17:05:02FromDiscord<Enimatek> hm macros and sequences with untyped stuff is not needed, db_sqlite also has a way to prepare the insert statement and slowly add all data with bindParam.. pfew.. was reading about macro's but its maybe a step too far for a nimmer of 2 weeks 😛
17:05:24disruptektoday's problem is that break-in-while isn't managing to emit the actual splat proc.
17:06:11ZevvI'll try to peek in today, but I'm totally done for for now. Work & home schooling is a utter PITA
17:06:19disrupteki feel you.
17:06:27disrupteki'm sure this is something simple.
17:06:31ZevvNow I will just eat my dinner, drink beer and stare at the wall
17:07:00*haxscramper joined #nim
17:07:07FromDiscord<Randall> Is it expected that `nimble install` doesn't update the `requires` in the nimble file?
17:07:08disrupteki'm trying to milk the elation from last night's election.
17:07:12disruptekyes.
17:07:31mipriyeah, nimble install is completely indepedent of the .nimble in the current directory you're in
17:07:49FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2L4F
17:08:10mipriit also wouldn't make sense for it to update that file. The code's actual version requirements don't change
17:08:23FromGitter<haxscramper> @HJarausch_gitlab either annotate `as EXC` with `{.inject.}` if syntax allows this, or generate identifier for `EXC` outside of `quote` do via `ident "EXC"`
17:08:45FromDiscord<jken> I also assumed nimble worked like npm when I started with nim
17:09:06FromDiscord<Randall> I'd prefer nothing work like npm, but yeah i expected similar results
17:09:19disrupteksuckers.
17:10:00FromDiscord<jken> disruptek, is nimph technically closer to npm? With local deps and lock files?
17:10:04FromDiscord<Randall> Where's my 100k lines lockfile of json?
17:11:26FromDiscord<Rika> and the black hole called node_modules?
17:11:57disruptekjken: i hope not.
17:12:35FromDiscord<jken> I suppose I should just try it out
17:12:36disrupteklocal deps and lockfiles don't define npm; the ridiculous tree is its defining characteristic.
17:12:53FromGitter<HJarausch_gitlab> Thanks to you both, @lqdev and @haxscramper !
17:13:00disruptekjken: are you on linux?
17:13:16FromDiscord<jken> I guess my question should have been "will nimph be more in-line with what I already expect from a package manager coming from a JS background"
17:13:22FromDiscord<jken> disruptek, yeah
17:13:29disruptekyou should try it.
17:14:04haxscramperI want to take an arbutrary piece of nim code and annotate each ast element with information about symbol definitions, similarly to https://code.woboq.org/qt5/qtcanvas3d/src/imports/qtcanvas3d/activeinfo3d_p.h.html#68 - I thought of using nimsuggest (either as a library or by copying high-level implementation details) to do this - I can parse, then use line/column position of each parsed node to get all necessary information. Note that
17:14:04haxscramperI need to annotate all entries in **original** source file, so just adding own pass after `sempass` is not an option
17:14:17disrupteknimph is more about reseting expectations of what package management is and is not.
17:14:32haxscramperIs going with nimsuggest a good idea in this case, or I'd better dig another part of compiler?
17:14:52disruptekyou don't need to use it except to measure your environment or try to fix it to match your declarative compiler configuration.
17:15:43FromDiscord<mratsim> @haxscramper, push a custom pragma
17:15:53haxscramperI need to write a tool that does that
17:16:01disrupteki dunno why you'd bother with nimsuggest.
17:16:05FromDiscord<mratsim> {.push mycustompragma.}
17:16:14FromDiscord<mratsim> done
17:16:14haxscramperThat is for documentation generator, it must be a standalone tool that requires no code modifications
17:16:53haxscramperI want to extract standalone usage examples for all unit tests
17:16:59FromDiscord<mratsim> then gorge the whole Nim file, push a custom pragma, generate a new temp file
17:17:02haxscramperAnd put this in documentation alongside each proc
17:17:09disruptekscramper: the compiler has compiler-as-api tests that demonstrate really trivial use.
17:17:35FromDiscord<mratsim> and complain about dev tooling doc tooling on the tracker, and ping @himu
17:17:57FromDiscord<mratsim> I'm tired of spending hours fighting doc generation :/
17:18:54haxscrampermratsim: me too
17:19:48haxscramperdisruptek: there is `compilerapi` test, but this one is for nimscript. Can you tell me specific test you have in mind, or you just generally remember we had something like this
17:20:08haxscramperBut not specific file/name/whatever
17:20:25disruptekit's a general memory, but if you want a simpler use, you could start with dust.
17:20:33disruptek!repo dust
17:20:34disbothttps://github.com/disruptek/dust -- 9dust: 11DUST is Unattended Syntax Truncation 15 6⭐ 1🍴 7& 1 more...
17:20:35haxscramperyes, that's what I started with
17:21:00haxscramperAnd I already have custom sempass working, but as I said earlier that's only part of what I need
17:21:16disruptekmy first thought was two passes; one pre-sem and one post-sem.
17:21:22disruptekbut i'm not sure you really need two.
17:22:07disrupteki had an introspection hack once in which i was doing two passes. 🤷
17:22:16haxscramperWell, to be fair, ultimately I wanted to somehow inject directly /in/ sempass to log all template/macro instantiations
17:22:26haxscrampers/log/store information about/
17:22:46haxscramperBut that is not something that has good effort/gain ratio, so I've put it aside for now
17:23:09haxscramperbefore-sempass is basically just plain unexpanded/uncompiled ast
17:23:25haxscramperright?
17:23:28disruptekyes.
17:23:58disruptekthe idea is that you plant seeds and see how they've grown post-sem.
17:24:34haxscramperseeds?
17:25:30haxscramperWell, I get general idea, but not sure if I know what exactly do I need to do this
17:25:43FromDiscord<Randall> @disruptek testes doesn't seem to like my comptime code. Tests fail with "compile failed" using the `expect` macro.
17:25:43disrupteki was just injecting comments and then unpacking them later; they are fairly safe from rewrites.
17:26:05disruptekrandall: can you gimme a repro in an issue?
17:26:18FromDiscord<Randall> I'll check if I can make a repo real quick
17:26:22disruptekaight, thanks.
17:26:42haxscramperdisruptek: alright, I will keep this option in mind, though this is hacky has hell
17:26:52disruptekyes.
17:27:25disruptekit was back when i was trying to fix async.
17:29:14FromDiscord<Meowz> Is there some easy way to statically link `pcre64.dll` if a tool uses `re` for example?
17:29:35disruptekno.
17:30:14FromDiscord<Meowz> Aw
17:30:31*Vladar quit (Remote host closed the connection)
17:30:50FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L4S
17:31:38disruptekwhat does it do in a block? same thing?
17:31:38FromDiscord<CodeHz> You cannot statically link dll(
17:32:02FromDiscord<Randall> Wrapping the expect in a block still fails
17:32:11disruptekokay, i will create an issue. thanks.
17:32:36FromDiscord<Randall> tho I do run it with testament
17:32:45disruptekdoesn't matter.
17:33:27FromDiscord<Randall> If you send me link I'll add the failure message
17:33:40disruptek!issues expect testes compile time
17:33:40disbotno results 😢
17:33:51disruptekhttps://github.com/disruptek/testes/issues/28
17:33:51disbotmake expect work for compile-time if possible
17:35:59*Vladar joined #nim
17:39:18ForumUpdaterBotNew thread by VVX7: Error cross-compiling json-nim-rpc, see https://forum.nim-lang.org/t/7340
17:40:03FromDiscord<Randall> The manual mentions `out T` but doesn't specify it's usage anywhere: https://nim-lang.org/docs/manual.html#overloading-resolution-overloading-based-on-var-t-slash-out-t↵Is this the same as just `var T`, or is there some distinction?
17:40:17disruptekpretend `out` doesn't exist.
17:40:25FromDiscord<Randall> What `out`?
17:40:54disruptekit's not really implemented.
17:41:30FromDiscord<Randall> Will it be? What was the intended purpose that distinguishes it from var?
17:42:28disruptekgood question. the difference is in initialization logic, like result.
17:43:06disruptekthe problem with out vars is that they entice people into implementing yet another API in addition to returning a result or mutating the input.
17:43:13disruptekthis is annoying.
17:44:31FromDiscord<Randall> That was kind of my next question. Since I cannot test my comptime function, I figured I might change the result to something like `func parsePath(path: string, success: bool): seq[RoutePart] {.compileTime.}` (or just remove the `compileTime` and live with it.
17:44:48FromDiscord<Randall> Or just return empty `seq` in case of failure and have the caller handle it
17:44:52FromDiscord<haxscramper> For now you can us it to crash compiler
17:45:11FromDiscord<haxscramper> The only use I could find for it
17:45:27FromDiscord<Randall> I prefer `macros.error` for that, but give a completely random node as second argument so the cause can never be found
17:45:46disruptekthe usual idiom is `func foo(x: var): bool`
17:46:05disruptekas in hasKeyOrPut, containsOrIncl, etc.
17:46:05haxscramper!eval func foo(x: var): bool
17:46:06NimBotCompile failed: /usercode/in.nim(1, 6) Error: implementation of 'in.foo(x: var) [declared in /usercode/in.nim(1, 6)]' expected
17:46:14disruptekshhh.
17:46:24haxscramper!eval func foo(x: var): bool = discard
17:46:26NimBot<no output>
17:46:30FromDiscord<Randall> So basically swap the bool and seq's positions
17:47:19disruptekit could save you a seq alloc, maybe, so... yes.
17:48:13FromDiscord<Randall> Thanks. I've never programmed in a non-memory-managed language so that'll all take a while for me to learn
17:59:48*Jesin joined #nim
18:15:03FromDiscord<Clyybber> Araq: ping
18:15:33reversem3I created a header string for my file like this . var box1_header = "Date: \t\t\tHostname: \t\tCPU"
18:17:10reversem3since this is going to be run all the time , I need a conditional to look for this string in the file before appending to it. can I use if box1_header notin statFile: ?
18:17:39reversem3How can I check for that header in the file before appending to it?
18:21:42*krux02 quit (Remote host closed the connection)
18:23:37*hmmm joined #nim
18:31:04saemWhen taking about nimsuggest do you really mean suggest, because the former is really just the interface
18:31:24*Guest25945 quit (Quit: Guest25945)
18:34:17haxscrampersaem: I meant `nimsuggest.nim`, at least at the time of writing my original question
18:34:33haxscramperBut now I narrowed it down to `sysFromInfo`/`findNode`
18:35:12haxscramperThough I'm still in process of figuring things out
18:37:38saem`markUsed` seems like it's called in all the places you care about?
18:39:39saemThe debugger helped a bit at times double edged sword
18:40:17disrupteki use s-words, f-words, and even some c-words from time to time.
18:47:53FromDiscord<Balen> Does the options module have a template that unwraps an option, getting its value but returns none from the calling scope if the option is none? If not, which I think is the case, would it be useful?
18:49:00haxscramperYou mean something like `mapIt` for `options`?
18:49:15haxscramperNo, it is not implemented
18:50:02FromDiscord<Rika> ??? https://nim-lang.org/docs/options.html#map%2COption%5BT%5D%2Cproc%28T%29_2
18:50:28FromDiscord<Rika> is this what you mean
18:50:43miprithe key text there is "but returns none from the calling scope if the option is none"
18:51:07FromDiscord<Rika> does this not return none?
18:51:10FromDiscord<Balen> sent a code paste, see https://play.nim-lang.org/#ix=2L5h
18:51:15FromGitter<awr1> @Balen there isn't to my knowledge but it would be very easy to implement. See `{.inject.}`
18:51:18miprithe key text of the key text is "from the calling scope"
18:51:18FromDiscord<Balen> if x is none, it'll return none from foo instead of throwing
18:51:22mipriit's control flow.
18:51:33FromGitter<awr1> e.g. as `tables.withValue` uses it
18:51:33FromGitter<awr1> https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/collections/tables.nim#L606
18:52:26FromDiscord<Balen> Yeah I know it's easy to implement but I thought it'd be common to be in the module.
18:52:31FromDiscord<Rika> i dont think it woul
18:52:33FromDiscord<Rika> d
18:54:43reversem3do I have to convert a var holding a string using if logic to check if a string is present in a file?
18:55:04reversem3any examples someone can point me to?
18:56:31FromGitter<awr1> what are you suggesting
18:56:36FromDiscord<Balen> do you mean if you have to read a file's content into a string to check if a substring is present in file?
18:56:42*haxscram` joined #nim
18:56:58FromGitter<awr1> like do you want to find if a string is present in a file without gathering up the file's contents into a string?
18:57:49reversem3meaning read a string from a file , use if logic to see if it exists
18:57:49FromGitter<awr1> It's easier to do it if you gather it up into a string but I can understand if you want to forego the extra allocation if you have no need for the total-file string
18:58:16*haxscramper quit (Ping timeout: 246 seconds)
18:58:34disruptekwithValue sucks.
18:58:36reversem3I have a header in a file that i want to check if it exists so I don't keep writing another header
18:59:26ForumUpdaterBotNew thread by JohnAD: Usefulness of a BPMN compiler package for Nim?, see https://forum.nim-lang.org/t/7341
18:59:33reversem3Do I have to read the actual number of chars https://nim-lang.org/docs/io.html
19:00:08FromGitter<awr1> `withValue`'s needing of a pointer is meh
19:00:26FromGitter<awr1> if you are fine with copying the whole file into a string
19:00:37FromGitter<awr1> `import strutils; let idx = path.open.readAll.find(target)`
19:01:58FromGitter<awr1> If you don't want to copy the entire file into a string you have to roll up your own solution using `std / streams`
19:02:00reversem3now the target has to be a string right ? I am using a var that holds the header string and then I write that string using the var into a file
19:02:24FromGitter<awr1> Yes, target is the string you're searching for.
19:02:42FromGitter<awr1> idx is -1 if it can't find anything iirc
19:02:48FromDiscord<andeee> sent a code paste, see https://play.nim-lang.org/#ix=2L5o
19:03:08FromGitter<awr1> i wish enum macro-nodes supported doc comments
19:03:14reversem3ok , and thats really the only way right ? I can't just use ngrep to find it ?
19:04:09FromGitter<awr1> That is the laziest way. You can use regex if you want
19:04:48FromGitter<awr1> Or roll your own solution using `streams` if you don't want to make a string out of the whole file
19:05:10reversem3"Date: \t\t\tHostname: \t\tCPU:" thats the string
19:05:22FromDiscord<Balen> so it doesn't span more than one line
19:05:42FromDiscord<Balen> using streams should be trivial, you should do that
19:06:01FromDiscord<andeee> sent a code paste, see https://play.nim-lang.org/#ix=2L5p
19:06:47FromDiscord<mratsim> the symbol must be visible at the template invocation site
19:07:16FromDiscord<mratsim> not where the template is defined (for untyped template)
19:07:46FromDiscord<mratsim> so make sure the module that calls asd, imports the module that defines someType
19:08:00FromDiscord<andeee> ahh ok makes sense yeah
19:08:01FromDiscord<mratsim> or reexport it from the module that defines template
19:09:14FromDiscord<andeee> how do i reexport?
19:09:26FromDiscord<mratsim> import foo↵export foo
19:09:39FromDiscord<andeee> amazing, thanks
19:11:27ForumUpdaterBotNew thread by Svtz: Failed trying to wrap macro in another macro, see https://forum.nim-lang.org/t/7342
19:13:04FromDiscord<lqdev> or, add `bind someType` to your template
19:13:15FromDiscord<lqdev> it's the exact problem `bind` is supposed to solve
19:15:49reversem3awr1 - this is what I'm trying to do https://play.nim-lang.org/#ix=2L5t
19:16:00reversem3If you wouldn't mind taking a look
19:17:11reversem3I haven't put the if logic into it yet
19:21:08*JustASlacker joined #nim
19:21:22*tane joined #nim
19:23:16reversem3What if I just did this:
19:23:17*reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/gWsdRQcWfKxlqkMpVrBAARye/message.txt >
19:23:29reversem3since its the first line anyway ?
19:24:01FromDiscord<Avatarfighter> Yo yo o7 everyone
19:26:38PMunchHi @Avatar
19:29:36*greenfork quit (Remote host closed the connection)
19:29:57*greenfork joined #nim
19:30:07FromGitter<awr1> it would be `let idx = statFile.readAll.find("Date: \t\t\tHostname: \t\tCPU:") `
19:30:26FromGitter<awr1> or well
19:30:27FromGitter<awr1> hm
19:30:34FromGitter<awr1> I don't actually know what file you're reading from
19:30:44*fputs quit (Quit: WeeChat 3.0)
19:31:02reversem3statFile.txt
19:31:03*fputs joined #nim
19:33:17FromGitter<awr1> You would need to add `fmRead` too
19:35:08*Guest25945 joined #nim
19:39:04reversem3Yeah I have to fix something because now it won't write unless there is something already in the file
19:39:25disruptekHOW DO IT KNOW?
19:45:13*habamax quit (Ping timeout: 264 seconds)
19:50:18*matthias[m]2 joined #nim
19:53:34ForumUpdaterBotNew thread by Adnan: Unable to use HashSet for my type, see https://forum.nim-lang.org/t/7343
19:54:14*clemens3 quit (Quit: brb)
19:54:32haxscram`New users getting clobbered to death by compilation errors
19:54:56Zevvwhy was there never a generic hash[T: object]() proc that just does a fieldpairs
19:55:00Zevvthat would make a lot of people happy
19:56:20haxscram`I guess because this naturally drags need for `==` and case objects later on. Though this would still solve the problem partially
19:56:54disruptek== is already impl for objects afaik.
19:57:02haxscram`Not for case objects, no
19:57:11disruptekbananas.
19:57:32haxscram`And for case objects it gives cryptic error message without even showing type of the objects that it tried to compare
19:57:43disruptekZevv: someone the whiles aren't resuming from the goto stack.
19:57:54disrupteks/someone/somehow/. should be another easy fix.
19:58:05disruptekyour tests only have 3 failures now, iirc.
19:58:10Zevvnice nice
19:58:27disrupteki think they are all the same little bug.
19:58:34Zevvlikely
19:58:44Zevvbut someone made 73 commits with the tests broken
19:58:46Zevvthat's what you get, right
19:58:57disruptekit has been pretty easy going so far.
19:59:09Zevvhey, there's party in DC. hope they do wear their masks
19:59:22disruptekmy tests are way more fux0red.
19:59:29Zevvhehe
19:59:42Zevvstart low & simple
19:59:47disrupteki guess the good news is that we don't seem to have any more blockers for tzevv.
19:59:53FromDiscord<Clyybber> disruptek: Indeed bananas, I was reminded of that today too
20:00:26disruptekwe probably need a little more comfort in macros.nim for case objects.
20:00:33disrupteksome convenience procs.
20:01:05*haxscram` left #nim ("ERC (IRC client for Emacs 27.1)")
20:01:37*haxscramper joined #nim
20:01:55disruptekmy assignment shim doesn't compile. hmmph.
20:08:31reversem3damn ok I can why you use readAll.find("string")
20:09:02reversem3all if statements have to have a bool correct ?
20:12:18haxscramperYes on second. First - this will work, but `readAll` reads whole file into memory
20:12:54FromDiscord<Randall> Is there a pragma for a proc/func that enforces that it be called with names for each param? (`function(param1=value1, ...)`)
20:13:06haxscramper`for line in lines("yourFile"): if "string" in line:` will give you what you need without reading whole file, because `lines()` is an iterator which does not read whole file at once
20:13:52haxscramperAt least if I remember how it works correctly **and** you search for a line that does not contain newline breaks (which seems to be the case for your string)
20:14:08reversem3oh I will try that thanks
20:14:18haxscramperRandall: just make param non-defaulted?
20:14:39haxscramperOr you specifically need `name=value`, and not just `value`?
20:14:53FromDiscord<Randall> I mean that `function(value1)` should fail while `function(param1=value1)` should be ok
20:15:26PMunchI think you need a macro for that
20:15:39haxscramperNo, there is not such thing for a functio, but you could write your own macro that declares second layer of indirection that will check for `ExprEqExpr` AST being passed
20:15:42PMunchI mean you could write a macro that works as a pragma you can attach to any procedure
20:16:23Zevvtzevv looks good disruptek, nice work
20:16:44FromDiscord<Randall> I think that'd be a good macro exercise sometime
20:16:50haxscramperOr you can write macro that enforces this at callsite, if you accept `typed` ast you can even inspect definition of the proc and provide error messages for that
20:17:18haxscramperOr take untyped and just check for `a=b` pattern
20:18:54*NimBot joined #nim
20:18:56reversem3hmm so it compiles find but then crashes on run
20:19:06FromDiscord<Randall> Always hate seeing code like `someProc(true, true, false, 'wow')`
20:19:13reversem3Bad file descriptor . Thats a new one
20:21:55reversem3https://play.nim-lang.org/#ix=2L5R
20:22:07disruptekZevv: gotta beat the dog and then i'll look at the missing goto.
20:22:21*Arrrrrrrr quit (Quit: Arrrrrrrr)
20:23:04PMunchI hope that is a euphemism..
20:24:06PMunch@Randall, it could be done pretty easily by just wrapping the procedure in a macro that verifies that all arguments are ExprEqExpr and passes it on to the underlying procedure
20:26:09disruptekyou only want to validate params with defaults.
20:26:20disruptekwould be nice to auto-rename deprecated param names, though.
20:26:40disruptek(because params without defaults may be optionally named in calls)
20:34:57*Guest25945 quit (Quit: Guest25945)
20:35:28*Guest25945 joined #nim
20:42:21*Guest94576 joined #nim
20:42:45*Guest94576 quit (Client Quit)
20:45:58*hmmm quit (Quit: WeeChat 3.0)
20:49:01*narimiran quit (Quit: leaving)
20:55:14*JustASlacker quit (Ping timeout: 264 seconds)
20:56:06FromDiscord<Recruit_main707> why are .rst files so weird...
20:59:19disruptekotherwise there'd be nothing interesting to talk about in #nim.
20:59:26*haxscramper quit (Remote host closed the connection)
21:02:08PMunchdisruptek, well we'd still have case-insensitivity :P
21:02:23PMunch@Recruit_main707, what do you mean "weird"
21:06:13*greenfork quit (Ping timeout: 264 seconds)
21:07:27FromDiscord<Anonymous Poet> you can statically link the pcre code though ... pass `--define: usePcreHeader --passL: "/usr/lib/x86_64-linux-gnu/libpcre.a"` when you're compiling (the path is the standard when installing on ubuntu 20.04 via `apt-get install libpcre3-dev -y`)
21:23:28*vsantana quit (Quit: vsantana)
21:24:08FromDiscord<Recruit_main707> PMunch, https://github.com/RecruitMain707/NimFlatbuffers/blob/master/README.rst↵those 2 rows are the same, but one is separated correctly, and the other one isnt
21:25:15PMunchWhich two rows?
21:25:28PMunchThe "Wont do | Nested namespaces" bit?
21:26:35FromDiscord<Recruit_main707> yes
21:28:22FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L6i
21:29:11PMunch@Recruit_main707, that's because the last line of ===== is contiguous
21:29:18PMunchYou need to break it up like the top one
21:29:22PMunchhttps://gist.github.com/javiertejero/4585196#tables
21:30:05PMunchOr just remove it completely I think
21:31:23PMunch@Randall, give me sec
21:35:11FromDiscord<Randall> Oh, I think it's possible with varargs.
21:35:14*Guest25945 quit (Quit: Guest25945)
21:35:33*Guest25945 joined #nim
21:35:47FromDiscord<Randall> sent a code paste, see https://play.nim-lang.org/#ix=2L6l
21:35:58FromDiscord<Randall> (edit) "https://play.nim-lang.org/#ix=2L6l" => "https://play.nim-lang.org/#ix=2L6m"
21:37:39FromDiscord<Meowz> How do I get the start of a slice object?
21:40:57FromDiscord<Meowz> sent a code paste, see https://play.nim-lang.org/#ix=2L6n
21:40:58FromDiscord<Meowz> I want `6` to be more precise
21:42:41PMunchhttps://play.nim-lang.org/#ix=2L6p
21:43:22PMunch@Meowz, myslice.low?
21:43:48PMunchmyslice.a
21:43:53FromDiscord<Randall> Otherwise, quite hacky, you could use slice.a
21:44:05PMunchYeah low didn't work: https://play.nim-lang.org/#ix=2L6q
21:44:13FromDiscord<Randall> Kind of odd that low isn't defined for HSlice tho
21:44:19FromDiscord<Meowz> Thanks, was just going to use .len + 1. Whatever `.a`does 😄
21:44:49FromDiscord<Randall> A slice is defined as an object with 2 fields: `a` and `b`, `a` being the low part of the slice
21:44:57disruptekleorize: wrt the compiler error messages from testes... what if we do the build without --run to confirm that we can compile it, and then do the same operation with --run to actually run it? the issue i'm trying to get around is the fact that i can't be certain of where the binary will end up due to custom configs, and binary location could be critical.
21:47:25FromDiscord<exelotl> > _withValue sucks_↵Yeah, though I appreciate the problem it's trying to solve
21:48:14disrupteki know, but it's really irritating that i can rarely use it because it's so lame.
21:48:54disruptekZevv: more tests, please. 😘
21:49:41FromDiscord<exelotl> it's unfortunately the only way we have to safely "do something with the result of a lookup" without doing the lookup twice
21:49:58disruptekyeah, but you can't use result, etc.
21:50:13disruptekit should simply be fixed.
21:50:19FromDiscord<mratsim> a, b are unfortunate names for the start and stop of a slice
21:51:02Zevvdisruptek: \o/
21:51:10ZevvI'll try to get stash/ up and running tomorrow!
21:51:32Zevvif you're bored: stash/iterator.nim complains about node having no tpe
21:51:47disruptekyeah, that's my current taste bug.
21:52:05Zevvright
21:53:03FromGitter<awr1> is there a way to render NimNode to a string of nim code
21:53:21FromDiscord<exelotl> yeah, `repr(node)`
21:54:18FromGitter<awr1> thx
21:55:34*hmmm joined #nim
21:55:45disruptekhmmm.
21:55:47FromDiscord<exelotl> there's also `treeRepr(node)` to see the tree structure, and `astGenRepr(node)` to see the nim code that you would have to write in order to produce that node
21:56:05*JustASlacker joined #nim
21:56:25FromDiscord<exelotl> (edit) "there's also `treeRepr(node)` to see the tree structure, and `astGenRepr(node)` to see the nim code that you would have to write ... in" added "(inside the macro)"
21:57:17FromGitter<awr1> yeah im familiar with treeRepr but was just looking for one that gave me what the generated Nim would theoretically look like
21:58:01FromDiscord<fwsgonzo> this might seem like a strange question but is there an absolute guarantee that if you create a var object of any kind inside a function, that this object will never (unless it's a very weird and specific object) write to .data?
21:58:16FromDiscord<fwsgonzo> (edit) "there an absolute guarantee" => "it extremely likely"
21:58:43FromDiscord<fwsgonzo> (edit) ".data?" => ".data/.bss?"
22:02:13FromGitter<awr1> Shouldn't be, unless something points to somewhere in the BSS/Data segment, the var is `{.global.}`, or the context is a compiletime procedure, in which the output of the function may potentially be in BSS/Data
22:04:24*xet7 quit (Remote host closed the connection)
22:04:37FromGitter<awr1> (more than likely compiletime procs will be statically writing to Data, but ofc this is not at runtime)
22:07:29FromDiscord<fwsgonzo> right, reading .rodata is fine so thats OK
22:10:04FromDiscord<fwsgonzo> sent a long message, see http://ix.io/2L6x
22:11:01FromDiscord<andeee> when interfacing with c code should there be any distinction made between void and void, or should I use pointer for both?
22:12:39FromDiscord<Randall> Turned out to be quite simple to disallow non-named-parameter function calls https://play.nim-lang.org/#ix=2L6z
22:14:13FromGitter<awr1> @andee not sure if typo but do you mean `void` and `void*`?
22:14:23FromGitter<awr1> *andeee
22:14:34FromDiscord<andeee> nope i mean void and voi, unfortunately 😄
22:14:49FromDiscord<andeee> (edit) "voi," => "void,"
22:15:10FromDiscord<andeee> this for example https://media.discordapp.net/attachments/371759389889003532/796502144085262427/unknown.png
22:15:20FromGitter<awr1> `void` is the same if you're talking about the return type.
22:15:48FromGitter<awr1> `void*` is `pointer`
22:15:50FromDiscord<Randall> I've never programmed C, but void pointers are different from void return type
22:16:02FromDiscord<andeee> a void pointer is a pointer to any type
22:16:28FromDiscord<andeee> and a void from what i understand is a pointer to void and is used when the thing you're passing it to needs to initialize that void in memory
22:16:40FromGitter<awr1> If you need `void*` use `pointer`, which is the typeless version of `ptr T`.
22:16:44FromDiscord<andeee> im not sure if it affects the nim code however but im a nim noob and dont know
22:17:17FromDiscord<andeee> i guess i'll just stick with pointer
22:19:42FromDiscord<mratsim> @zevv @disruptek did you have time to think about my continuations and coroutines API?
22:19:48FromDiscord<andeee> I see nim allows me to do `ptr pointer` but it just feels wrong lol
22:20:06PMunch`void *` is a pointer to any type, in Nim a `pointer` a `void **` is a pointer to a void pointer, in Nim a `ptr pointer`
22:20:08FromDiscord<mratsim> do var pointer then
22:20:09*JustASlacker quit (Ping timeout: 272 seconds)
22:20:31*taprack quit (Remote host closed the connection)
22:20:40FromGitter<awr1> `void` by itself - is just the return type that returns nothing. `void*` is a typeless pointer. You are not really supposed to be able to "dereference it", typically you cast it to something else. Unlike other pointer types in C `void*` has no actual relationship to `void` which contrasts with, say, how `int*` is a pointer to an `int`.
22:21:38FromDiscord<mratsim> ptr blackhole is the better name
22:21:48FromGitter<awr1> IMO generally avoid using `pointer` if you can help it
22:21:57FromGitter<awr1> It's there for C purposes
22:22:53FromGitter<awr1> Nim treats typed pointers (i.e. `ptr T`) as generic types so most of the need for `pointer` is not necessary
22:23:20FromDiscord<mratsim> you can even replace ptr+len is C APi by openarray
22:23:38FromDiscord<andeee> i wish i could but im interfacing with the c node api
22:24:29FromDiscord<mratsim> for example: https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_abi.nim#L289-L300↵https://github.com/supranational/blst/blob/master/bindings/blst.h#L214-L230
22:25:48FromDiscord<mratsim> btw someone knows how to wrap C++ constructor with initializer list?
22:26:47*PMunch quit (Quit: leaving)
22:35:15*Guest25945 quit (Quit: Guest25945)
22:35:45*Guest25945 joined #nim
22:37:07*krux02 joined #nim
22:40:41leorizedisruptek: you can set the binary location with --outdir, no?
22:41:36leorizemratsim: initializer list should just be fancy syntax for `field = something` afaik
22:41:53ForumUpdaterBotNew thread by Mratsim: Generating C++ constructor with initialization list., see https://forum.nim-lang.org/t/7344
22:42:37FromDiscord<mratsim> sometimes it's necessary when a field is declared const, fortunately I don't have this problem yet
22:42:48FromDiscord<mratsim> I'll have to sleep on it
22:43:24leorizeZevv might know a thing or tw
22:43:28leorizetwo*
22:51:04*taprack joined #nim
22:52:07*Gustavo6046 quit (Ping timeout: 260 seconds)
22:53:08FromDiscord<exelotl> if I have a top level variable `var foo: int` is there a way for me to look up the sym in a macro?
22:53:19FromDiscord<exelotl> I want to know if someone passed that exact variable to the macro
22:53:35*fputs quit (Quit: WeeChat 3.0)
22:53:57*Gustavo6046 joined #nim
22:54:58FromDiscord<mratsim> the owned macro can tell you if it's a global AFAIK
22:57:18*oddp joined #nim
22:58:03FromDiscord<dom96> The IC PRs are giving me deja vu
22:58:19FromDiscord<exelotl> this works: https://play.nim-lang.org/#ix=2L6P
22:58:25FromDiscord<dom96> Is it Araq giving me a sign that I'm really in the matrix?
22:58:49*Gustavo6046_ joined #nim
22:58:54*Gustavo6046 quit (Ping timeout: 272 seconds)
23:00:23*Gustavo6046_ is now known as Gustavo6046
23:06:23*Gustavo6046 quit (Ping timeout: 260 seconds)
23:07:55FromDiscord<exelotl> Is this a bug? https://play.nim-lang.org/#ix=2L6W
23:07:56ForumUpdaterBotNew thread by Snej: NimDBX (libmdbx key/value database wrapper) now nimble-installable, whew, see https://forum.nim-lang.org/t/7345
23:16:40*tane quit (Quit: Leaving)
23:17:30FromDiscord<ElegantBeef> Exelotl the only thing i can say for certainty is i've no clue what this does 😄
23:17:53*oddp quit (Quit: quit)
23:23:36FromDiscord<exelotl> it should rewrite `x = 10` to `x = 10 + 1` and then not rewrite it again after that
23:23:53FromDiscord<exelotl> but it seems like the noRewrite pragma is just totally broken lol
23:24:29FromDiscord<shadow.> is there any way to like get the current day as a number 0-36(3/4)?
23:24:34FromDiscord<shadow.> or something similar
23:24:38FromDiscord<shadow.> anything dealing w calendars ig
23:24:42FromDiscord<shadow.> i can figure out the rest by myself
23:24:53FromDiscord<shadow.> (edit) "0-36(3/4)?" => "1-365?"
23:25:38FromDiscord<shadow.> im guessing times?
23:28:01FromDiscord<shadow.> yep got it
23:30:13FromDiscord<juan_carlos> I think norewrite has nothing to do with `variable` like this, that only makes a variable, I dont understand the backticks on the example. Last time I tried it was working.
23:32:11*Vladar quit (Quit: Leaving)
23:35:27*Guest25945 quit (Quit: Guest25945)
23:35:50*Guest25945 joined #nim
23:36:35FromDiscord<ElegantBeef> @shadow. https://nim-lang.org/docs/times.html#yearday%2CDateTime
23:37:47*Gustavo6046 joined #nim
23:39:45FromDiscord<shadow.> yep i got it
23:39:48FromDiscord<shadow.> now().yearday
23:39:55FromDiscord<shadow.> ty
23:39:57FromDiscord<ElegantBeef> I'm blind didnt see that
23:40:02FromDiscord<shadow.> hm?
23:40:10FromDiscord<ElegantBeef> Your original "got it"
23:40:12FromDiscord<shadow.> ohh
23:40:14FromDiscord<shadow.> its fine lol
23:40:56FromDiscord<shadow.> lol i took a little time to try rust and ive gotta say i was like "eh this isnt that bad" and then i just wrote some nim again and im like "ok nvm this is what i was missing" lmao
23:47:45FromGitter<alehander92> disruptek
23:48:02FromDiscord<exelotl> the backticks aren't important, same thing happens without them
23:48:04FromGitter<alehander92> some love from bulgaria
23:48:07FromGitter<alehander92> good nightt
23:49:25FromDiscord<juan_carlos> I think no rewrite is like for proc/func/iterator/etc maybe not for whole blocks or expressions?.
23:55:33disruptekleorize: what if the user "needs" the binary output to a specific spot in order to make the tests work? or a specific filename?
23:56:11disruptekalehander92: how did you get stuck on gitter?
23:56:35leorize[m]disruptek then they need to provide the test runner with additional metadata
23:57:08disruptekisn't that what nim.cfg or test.nim.cfg is for?
23:57:29disrupteki can do it "correctly", it's just more work. 😉
23:58:11leorize[m]then you can make that happen :p
23:58:32disruptekhmmph.