<< 19-04-2021 >>

00:02:01*jess quit (Quit: Lost terminal)
00:02:29*jess joined #nim
00:39:19ForumUpdaterBotNew thread by Masiarek2: Unicode string print - the four faces look different when printing - why?, see https://forum.nim-lang.org/t/7824
00:40:43*vicfred quit (Quit: Leaving)
00:50:16*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:50:37*njoseph joined #nim
01:01:24*vicfred joined #nim
01:04:40*krux02 quit (Remote host closed the connection)
01:26:26*wasted_youth2 quit (Quit: Leaving)
02:00:41*hyiltiz quit (Ping timeout: 240 seconds)
02:09:00*hyiltiz joined #nim
02:15:36*Tanger joined #nim
02:28:08*NimBot joined #nim
03:04:59*spiderstew joined #nim
03:06:05*spiderstew_ quit (Ping timeout: 250 seconds)
04:00:16FromDiscord<🍍phylum🍍> sent a code paste, see https://play.nim-lang.org/#ix=2WzE
04:00:54FromDiscord<ElegantBeef> You cannot use `var T` as an object field
04:01:04FromDiscord<ElegantBeef> you probably want a `ref Deque[Frame]`
04:03:26FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2WzH
04:05:11FromDiscord<ElegantBeef> `var` without the experimental views is a limited keyword in most cases, and even with the experimental views doesnt enable this since it'd be a reference to a variable that outlives the original
04:09:56*rockcavera quit (Remote host closed the connection)
04:16:12FromDiscord<🍍phylum🍍> ah yeah that would be it haha. thanks
04:16:35FromDiscord<ElegantBeef> No problem
04:16:45FromDiscord<🍍phylum🍍> thinking about reference vs value with python syntax is still melting my brain a bit
04:16:59FromDiscord<ElegantBeef> Eh it's fine, i abused refs alot coming from C# 😄
04:17:40FromDiscord<ElegantBeef> Normal to get abused by things you arent used to, but it's rather simple in Nim imo
04:48:48FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2WzO
04:49:57FromDiscord<ElegantBeef> @mattrb Current bug with Nim, inferred generic + explict generic = compile bug
04:50:10FromDiscord<mattrb> Right, that seems like the one you helped me with before
04:50:12FromDiscord<mattrb> (edit) "https://play.nim-lang.org/#ix=2WzO" => "https://play.nim-lang.org/#ix=2WzQ"
04:50:20FromDiscord<ElegantBeef> Yep
04:50:29FromDiscord<mattrb> What worked at the time was to put a colon before the `uint32`
04:50:44FromDiscord<mattrb> Although I don't know why, and that doesn't seem to be working here :p
04:51:31FromDiscord<Rika> thats for a.generic[:T] only
04:51:41FromDiscord<Rika> for the form generic[T](a), no colon
04:53:00FromDiscord<ElegantBeef> @mattrb Does this work for you? https://play.nim-lang.org/#ix=2WzS
04:54:18FromDiscord<ElegantBeef> It's an annoying but 😄
04:54:21FromDiscord<ElegantBeef> (edit) "but" => "bug"
04:56:29FromDiscord<mattrb> Yeah I can provide the second type in there for now. Definitely annoying haha but I can make that work for the time-being
04:56:41FromDiscord<mattrb> And hopefully this issue just gets picked up soon 😬 https://github.com/nim-lang/Nim/issues/17212
04:57:20FromDiscord<ElegantBeef> I do think saem intends to dedicate time fixing up generics, but time isnt unlimted 😄
04:57:40FromDiscord<mattrb> Yeah totally understand. I'll be looking forward to that day 🙏
04:58:36saemTurns out IC work fixed some typedesc shenanigans.
04:58:53FromDiscord<mattrb> I also don't _need_ to do it with generics, plus this proc is being shoved away in another file. Is there a way you can think of that I could make this work without making the code that uses it not have to specify both types?
04:59:11FromDiscord<ElegantBeef> use a template to emit all of them
05:00:46FromDiscord<mattrb> That's what came to mind, although I'm not sure how that'd actually work. The generic arg is just to specify the output type
05:00:59FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2WzX
05:01:20FromDiscord<mattrb> You may have suggested something like that last time I brought this up
05:01:59FromDiscord<ElegantBeef> Yea i think i might have
05:04:36FromDiscord<ElegantBeef> Saem do you know if this specific one has been resolved?
05:07:03FromDiscord<ElegantBeef> Guess this isnt a typedesc issue and i'm too tired to reason for myself 😄
05:10:19saemLet me look in a bit, playing video games. 😁
05:12:31FromDiscord<ElegantBeef> I bet you still havent played my game, so ... i dont care ;P
05:12:50*a_chou joined #nim
05:13:13*a_chou quit (Remote host closed the connection)
05:14:10saemThat's fair (and true)
05:21:02saemback
05:24:19saemI get that there is a bug, but what is it that you need/want to do?
05:25:07*happycorsair[m] left #nim ("User left")
05:33:08FromDiscord<ElegantBeef> It's just the infered typeclass generic + explict generic bug we talked about previously
05:34:25saemI thought you wanted a suggestion as to how to work around it.
05:34:33saemI couldn't figure it out... maybe it'll be easier on a second go.
06:12:53FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WAk
06:17:12FromDiscord<Rika> `tmp and 0xFF00'u16` is not a bool
06:17:25*threenp left #nim ("User left")
06:17:26FromDiscord<Rika> im not too sure, but i assume that its because of that
06:17:45saemdid you build the compiler yourself? There should be a stack trace -- it's definitely a bug as that shouldn't crash -- but there are definitely errors.
06:22:52FromDiscord<jtiai> In reply to @Rika "`tmp and 0xFF00'u16` is": It's not a bool but apparently it slips through compiler checks.
06:23:38saemUnfortunately that snippet is very incomplete and isn't enough to reproduce the error in playground.
06:23:48FromDiscord<jtiai> Whole source is at github
06:24:02FromDiscord<Rika> jtiai prolly why its an error in semcheck
06:24:14FromDiscord<Rika> i mean semcall, misred
06:24:15FromDiscord<Rika> (edit) "misred" => "misread"
06:27:25FromDiscord<jtiai> <https://github.com/jtiai/nimoric> there is the repo, and <https://github.com/jtiai/nimoric/blob/main/src/cpu6502.nim#L206> the row causing the troubles if someone want to take a look.↵↵I tried to compile nim but it complained missing gcc...
06:32:35saemPretty sure you can shrink that code down into a minimum reproduction. You might be able to use dust to shrink it for you: https://github.com/disruptek/dust
06:45:58*johannes_ joined #nim
06:46:41FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WAs
06:47:46saemyou have some invalid characters in there that render as a red dot, as soon as I remove those I get a failing case.
06:47:47saemNice!
06:48:34*saem you can remove `.` template too
06:49:06saemWhoops, hit a shortcut accidentally, but yeah.
06:51:11FromDiscord<jtiai> How come invalid?
06:51:56FromDiscord<jtiai> And why I can remove dot template?
06:52:03saemBecause those aren't part of the identifier nor are they necessarily valid identifiers. Might be a rendering issue.
06:52:14saemBecause the template isn't required for the reproduction of the issue.
06:52:30saemYou only need the `.=` because that's all you're actually using there.
06:52:42FromDiscord<ElegantBeef> `` gets destroyed across the irc bridge, so that's probably why the red dot
06:52:49FromDiscord<jtiai> if I remove templates: `Error: attempting to call undeclared routine: 'A='`
06:53:16saemNote, I didn't say templateS, I only referred to the `.` one.
06:54:18FromDiscord<jtiai> Well anyways that throws the semcall error.
06:56:39FromDiscord<ElegantBeef> Why are you doing `= 123`?
06:57:18*Mister_Magister quit (Ping timeout: 240 seconds)
06:57:19FromDiscord<ElegantBeef> Replacing that with true makes it work, so seems like dot ops have a bug not enforcing types
06:57:26FromDiscord<jtiai> because essentually that's my code.
06:57:43FromDiscord<ElegantBeef> But you're passing an int to a template that expects a bool
06:58:10saemyeah, the compiler is trying to report a type mismatch error and there is an assert it's tripping over.
06:58:30FromDiscord<jtiai> I would have expected nim to either have similar boolean falsey and truthy values as many others or then throw me an error I can comprehend.
06:58:45FromDiscord<ElegantBeef> Well Nim's falsey's are `false` 😄
06:58:46saemIt was fixed as part of this: https://github.com/nim-lang/Nim/commit/a6526695f0972513913498c7b049a8dfb76814a3
06:58:51FromDiscord<ElegantBeef> But yes it should error properly
06:59:29FromDiscord<ElegantBeef> Good to see
06:59:34FromDiscord<jtiai> But it gets tedious to write bool(123) all the time.
06:59:38*vicfred quit (Quit: Leaving)
06:59:39FromDiscord<ElegantBeef> so then write true
07:00:11FromDiscord<jtiai> well my code is something like `a and 0x0080`.
07:00:11FromDiscord<ElegantBeef> or `convert toBool(i: SomeInteger): bool = a != 0`
07:00:15FromDiscord<ElegantBeef> (edit) "`convert" => "`converter"
07:00:21FromDiscord<ElegantBeef> Use bitsets
07:00:32FromDiscord<ElegantBeef> then it's just `a in set`
07:00:43FromDiscord<jtiai> ?
07:00:59FromDiscord<jtiai> a in 0x0080 ?
07:01:12FromDiscord<ElegantBeef> You're using the right hand as a set right?
07:01:20FromDiscord<jtiai> No.
07:01:25FromDiscord<jtiai> It's bitwise operation.
07:01:32FromDiscord<ElegantBeef> I know what it is
07:01:44FromDiscord<ElegantBeef> `0x0080` is a set of bits right?
07:02:16FromDiscord<jtiai> technically one bit but yes...
07:03:12saemNim has bitsets built right in. So the whole enum, masking, and all that is wrapped up in bitsets. You can do intersections, differences, unions, etc... which will work out what you're after. AFAICS
07:03:21FromDiscord<ElegantBeef> ^
07:03:49FromDiscord<jtiai> so I can do `(a xor b) and (a xor c)` with bitsets?
07:04:36*PMunch joined #nim
07:06:06saemYes, just expressed differently. https://nim-lang.org/docs/manual.html#types-set-type
07:06:53FromDiscord<ElegantBeef> Sets are a much nicer API to the bitwise logic
07:06:56FromDiscord<jtiai> So how that would work with 16 bit unsigned numbers?
07:07:02FromDiscord<jtiai> given my example above?
07:07:06FromDiscord<ElegantBeef> `set[uint16]`
07:07:25saemThat's the sections right below the section I linked above: https://nim-lang.org/docs/manual.html#set-type-bit-fields
07:08:15saemSince there is a minimal reproduction of the error, could you please raise an issue.
07:08:40FromDiscord<jtiai> Ah sorry. Forgot that totally. Will do it ASAP.
07:09:26FromDiscord<jtiai> only 1.8k issues. Far more less than my work app.. 🙂
07:10:21FromDiscord<jtiai> (we're around 2.5k open and aroud 50k closed)
07:11:04FromDiscord<jtiai> Probably should check if issue persist in latest main branch.
07:12:59*fredrikhr joined #nim
07:18:12ForumUpdaterBotNew thread by Halloleo: How to access n theJS backend Bootstrap's "modal" method?, see https://forum.nim-lang.org/t/7825
07:25:02FromDiscord<jtiai> And I really didn't got how bitsets would make my code simpler?
07:27:05FromDiscord<mrotaru> I've got a relatively simple program with some async code in there which seems to make it block and is unresponsive. This would be more appropriate to ask on the forum, but i didn't get a confirmation email and when i tried to recreate the account i got an "unknown error"... Any idea why i can't create a forum account ?
07:27:43FromDiscord<Rika> Because the forum is using a very old version of its code base I think
07:27:51FromDiscord<Rika> Anyway you can make a code snippet using the playground
07:28:10FromDiscord<Rika> https://play.nim-lang.org/
07:28:32FromDiscord<ElegantBeef> This is fine for asking here 😄
07:28:58FromDiscord<ElegantBeef> I personally prefer people asking questions here, isnt good for longevity but great for help/community 😄
07:29:41FromDiscord<mrotaru> Ah yes, forgot about the playground 😄
07:29:59FromDiscord<mrotaru> made a gist: https://gist.github.com/mrotaru/dfa728ce90d9869518b865a677750e46
07:31:17FromDiscord<mrotaru> Also regarding forum - i did get the email, but it went to spam and Thunderbird doesn't show spam by default... but i can see it in the web interface
07:31:18FromDiscord<ElegantBeef> Where is the blocking at?
07:31:35FromDiscord<mrotaru> Not sure to be honest; I run it, and it doesn't respond to any requests
07:32:26FromDiscord<Rika> Does it print listening
07:32:33FromDiscord<mrotaru> Yes
07:33:25FromDiscord<Rika> I think it has something to do with you running both run forever and poll but I don’t know
07:36:01FromDiscord<mrotaru> Hmm doesn't look like it; this has the same behaviour: https://play.nim-lang.org/#ix=2WAK
07:36:23FromDiscord<mrotaru> `cb` doesn't get invoked
07:42:42*jjido joined #nim
07:44:26FromDiscord<mrotaru> actually there's two `poll`s in there so could be
07:52:09*xet7_ joined #nim
07:52:23*xet7_ quit (Remote host closed the connection)
07:52:46*xet7_ joined #nim
07:52:52*xet7 quit (Ping timeout: 240 seconds)
07:53:04*xet7_ is now known as xet7
08:08:16FromDiscord<Goel> `writeLine[Ty](f: File; x: varargs[Ty, `$`])` ↵What does it stand for [Ty]? i though [T] was the type, but don't know about [Ty]
08:09:01FromDiscord<Rika> T can be anything, it’s the name of a, let’s call it, “type variable”
08:14:50*abm joined #nim
08:19:38*wasted_youth2 joined #nim
08:32:46*xet7 quit (Remote host closed the connection)
08:35:56PMunchIf you want to you could do `writeLine[myType](f: File; x: varargs[myType, `$`])`
08:36:04PMunch`T` is just the convention
08:50:02*krux02 joined #nim
08:55:38giaco__I'm reading from a TCP socket with asynchronously with "proc recv*(socket: AsyncSocket, size: int, flags = {SocketFlag.SafeDisconn}): owned(Future[string]) {.async.}". I don't know if I should expect function to return empty string "" only in case of disconnection, or also in case of no more data to receive but socket still connected. I have to solve the problem to respond only after "all" data has
08:55:40giaco__been received, but I don't have a length field that tells me when is "all"
08:57:29FromDiscord<Goel> @PMunch I understand, still i don't get why in this case it was named [Ty] if the convention is [T], since this proc is in into the module `io` of `system.nim` im sure there was a reason if they decided to use [Ty], also because so far in all the other docs i always found simply [T]
08:57:56FromDiscord<Goel> (edit) "[T]" => "[T]. Anyway end of the topic, thanks for explanation 😄"
08:59:04PMunchSome parts of the standard library predate the conventions :P I don't think there was any particular rationale to it
09:03:09*Tanger quit (Remote host closed the connection)
09:23:32*clyybber joined #nim
09:25:06FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WBg
09:28:17FromDiscord<Rika> what is a
09:28:18FromDiscord<Rika> what is b
09:28:20FromDiscord<Rika> what is c
09:28:34FromDiscord<Rika> this is too nondescript
09:30:32*abm quit (Quit: Leaving)
09:31:24FromDiscord<jtiai> They are emulated cpu registers.
09:31:32FromDiscord<jtiai> literally called a, b and c.
09:32:05FromDiscord<jtiai> So they are unsigned 16 bit values.
09:32:27FromDiscord<jtiai> And I was told that I should use bitfields/bitsets instead of doing those bitwise operations.
09:35:48PMunchI think they must've been mistaken
09:35:57PMunchOr at least misunderstood what you where trying to do
09:36:25PMunchBitsets are nice if you have single bit flags that you want to set in a mask
09:36:39FromDiscord<jtiai> And that's I do have for CPU flags.
09:36:52PMunchBut for just xoring together random uint16s they're not really doing anything
09:37:51FromDiscord<jtiai> specially since most of the time data comes emulated memory it's "random"...
09:44:14FromDiscord<🍍phylum🍍> bitfields are for when you have different stuff crammed together into one variable at fixed offsets, like if you store RGB data in one 32bit int
09:44:28FromDiscord<jtiai> And a stupid question but does nim support overloading? like `proc x(z: uint8)` and `proc x(z: uint16)` ?
09:44:36FromDiscord<🍍phylum🍍> not a good fit for general purpose registers unless you're cramming 2 16bit registers together into one 32bit register but don't do that
09:44:53FromDiscord<ElegantBeef> Yes nim has type based, and even name base overloading
09:45:14FromDiscord<🍍phylum🍍> does overloading occur on distinct types or are non-distinct aliases good for it too
09:46:16FromDiscord<ElegantBeef> I believe aliases can overload aswell, but i could be wrong cannot think clearly atm
09:49:17FromDiscord<jtiai> Hopefully I could finish my cpu emulation today... learned so much about Nim along the road.
09:51:05PMunchYou can of course create a macro or template to make these xors nicer to work with by the way
09:51:14PMunchWhat kind of CPU are you emulating?
09:51:23FromDiscord<jtiai> Good old 6502.
09:52:22PMunchJust for fun?
09:52:24FromDiscord<jtiai> And then I hope to be able to smash in few other part emulations and emulate Oric Atmos computer - the very first one I ever owned.
09:52:32FromDiscord<jtiai> Learning process.
09:52:38FromDiscord<jtiai> Never wrote anykind of emulator.
09:52:58PMunchAah, cool
09:54:25FromDiscord<jtiai> First I though Z80 but when looking datasheets that darned thing has very complex up to 4 byte opcodes.
10:00:22FromDiscord<jtiai> I already wrote backbone of i686 (32bit) OS... At least it boots and has keyboard input...
10:00:35FromDiscord<jtiai> (with nim)
10:02:21PMunchDom wrote a small kernel in Nim for fun I believe
10:03:01FromDiscord<jtiai> There was something it really didn't worked well..
10:04:43FromDiscord<jtiai> I think it was missing gdt and then idt for keyboard forexample.
10:05:28FromDiscord<jtiai> Now I'm process that I should write simple memory manager to have kernel libc built and be able to use string stuff from nim.
10:07:51FromDiscord<jtiai> just out of curiosity - does nim have Oracle database "driver" and ORM that would support Oracle and GIS?
10:11:56*xet7 joined #nim
10:15:04*skelett joined #nim
10:15:49giaco__these kind of projects makes nim shine out there. Thanks!
10:18:39PMunchHmm, how do I define the C++ compiler to use? I have `avr.any.gcc.exe = "avr-gcc"` but I can't change it to `avr.any.g++.exe = "avr-g++"` is an "Error: expected identifier, but got: ++." error..
10:20:00PMunchNever mind, remembered I had done it in my Arduboy code :P https://github.com/PMunch/MannBarSchwein-arduboy/blob/master/nim.cfg#L4-L6
10:43:14ForumUpdaterBotNew thread by Alexeypetrushin: Simple RPC, call remote Nim functions as if its local, experimenting..., see https://forum.nim-lang.org/t/7826
10:44:01*xet7 quit (Quit: Leaving)
10:51:28*fredrikhr quit (Read error: Connection reset by peer)
10:52:08PMunchHmm, inline/noinline can have drastic effects on program size. I wonder if inlining everything, and then analysing the binary and deduplicating it would work. Or if it has ever been tried
10:55:58*fredrikhr joined #nim
10:59:11*lritter joined #nim
11:29:47FromDiscord<🍍phylum🍍> does nim hae a "spread" operator? like a way to expand a seq[T] and pass it to a function expecting a varargs[T]?
11:31:48*Vladar joined #nim
11:32:21PMunchSomething like this? https://github.com/PMunch/MannBarSchwein-arduboy/blob/master/nim.cfg#L4-L6
11:32:24PMunchOops
11:32:25FromDiscord<Solitude> you can pass sequence to varargs already
11:32:30PMunchhttps://stackoverflow.com/questions/48418386/tuple-to-function-arguments-in-nim
11:32:40PMunchOh you can?
11:33:59*xet7 joined #nim
11:34:43FromDiscord<Solitude> !eval (proc(a: varargs[int]) = echo a.len) @[1, 2, 3]
11:34:45NimBot3
11:35:37PMunchHuh, neat
12:27:32*PMunch quit (Ping timeout: 240 seconds)
12:28:02*PMunch joined #nim
13:15:07*natrys joined #nim
13:16:46*rockcavera joined #nim
13:25:37FromDiscord<zetashift> TIL
13:28:18FromDiscord<mrotaru> So i've been trying to get this snippet to run (https://play.nim-lang.org/#ix=2WAK) but it just hangs, does not respond to any requests - but it seems like the example on https://nim-lang.org/docs/asynchttpserver.html has the same behaviour ! Any idea what's going on here ?
13:30:35PMunchOh wow, something is very broken about the asynchttpserver example..
13:30:51PMunchIt just racks up a huge amount of RAM while consuming 100% of a core
13:30:56FromDiscord<mrotaru> Also can't seem to be able to use getFuturesInProgress() - "undeclared identifier"
13:31:12FromDiscord<mrotaru> Oh, so that's why the computer was getting slow 😄
13:31:34PMunchHmm, this might be the same issue that has plagued me with the HomeAssistant addons I've been writing
13:31:46PMunchBasically async callbacks seems to not work..
13:31:59PMunchOr at least that's when I ran into issues
13:32:01FromDiscord<mrotaru> Buzkill 😄
13:32:31FromDiscord<mrotaru> But yea, from a noob perspective, something seems wrong with async
13:39:18PMunchHmm, can't find a Nim version that can run that example without doing that..
13:39:24PMunchWhat OS are you on by the way?
13:39:31FromDiscord<mrotaru> Looks like it's the same for `devel` - just tried, and it will happily eat all the RAM available
13:39:33FromDiscord<mrotaru> Ubuntu
13:41:34PMunchMight be a Linux-only thing then
13:42:16FromDiscord<mrotaru> So it's fine on Windows ? or mac ?
13:42:38PMunchNo idea
13:42:51FromDiscord<mrotaru> Oh ok
13:42:51PMunchBut I assume someone has run that example without any issues :P
13:43:02FromDiscord<mrotaru> At some point 😄
13:43:55PMunchI tried some older versions of Nim and `server.listen` was apparently only added in 1.4.2, so can't be that long ago
13:46:09FromDiscord<mrotaru> Damn, that sucks
13:46:20FromDiscord<mrotaru> Should i rise a bug, github ticket or smth ?
13:46:43PMunchhttps://github.com/nim-lang/Nim/issues/17783
13:51:43FromDiscord<Rika> mrotaru on discord
13:51:46FromDiscord<Rika> you're on irc lol
13:52:07PMunchI'm on IRc :P
13:52:31PMunchThere, better?
13:53:45FromDiscord<Rika> lol sorry heehee
13:57:41PMunchI mean from my point of view you're all on IRC :P
13:57:46*fredrikhr quit (Ping timeout: 240 seconds)
13:59:14FromDiscord<mrotaru> On discord IRC people show up with "bot" label; initially i though they were actual bots and thought to myself "wow, AI has really advanced a lot lately" 😄
13:59:34*fredrikhr joined #nim
13:59:49PMunchHaha, the Nim community just has some really clever bots!
14:00:17PMunchEven coming up with their own problems and discussing between them how to solve them
14:00:54FromDiscord<Rika> pmunch is a bot?!?
14:00:58FromDiscord<Rika> god damn
14:01:04FromDiscord<Rika> i cant believe im stupider than a bot
14:01:15FromDiscord<Rika> tbf though i have the iq of a rock so
14:02:08FromDiscord<clyybber> a rock may be very smart. It just wouldn't talk much.
14:02:27FromDiscord<Rika> i hate this
14:02:40FromDiscord<exelotl> Groundbreaking advancements in the "PMunch and exelotl are the same person because they never talk at the same time" theory
14:02:45FromDiscord<clyybber> lol
14:03:45FromDiscord<mrotaru> reminds me of this: https://www.youtube.com/watch?v=Y1gFSENorEY
14:06:21*johannes_ quit (Quit: leaving)
14:07:53*jess quit (Ping timeout: 622 seconds)
14:18:26*PMunch quit (Quit: leaving)
14:38:25FromDiscord<no name fits> A seq that isn't a ref is on the stack, right?
14:38:38FromDiscord<clyybber> a seq is on the heap
14:38:48FromDiscord<clyybber> but it behaves like a value type
14:39:55FromDiscord<zetashift> Can a seq even be on the stack?
14:40:02FromDiscord<zetashift> Or a similiar datastructure?
14:40:10FromDiscord<no name fits> Oh, so if I have to iterate big seqs, is it worth it to copy them into an array before iterating? or is there a way to use arrays for this, when I don't know the size at compile time?
14:40:37FromDiscord<clyybber> @zetashift Yeah, you can make a VLA
14:40:58FromDiscord<clyybber> @no name fits nope, not worth it; probably will only affect performance negatively
14:54:13FromDiscord<dk> I think the compiler can allocate a ref on the stack as an optimization
14:55:20*WilhelmVonWeiner joined #nim
15:10:36FromDiscord<carpal> In reply to @dk "I think the compiler": at this point it should pass it as reference everywhere
15:24:52FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WDb
15:30:33FromDiscord<zajrik> Like to just not have to set result to 0? Because the result value is automatically initialized to the default for the proc return type
15:32:05FromDiscord<zajrik> so you wouldn't need to set it to 0
15:37:41FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WDe
15:37:59FromDiscord<jtiai> (edit) "https://play.nim-lang.org/#ix=2WDe" => "https://play.nim-lang.org/#ix=2WDf"
15:43:21FromDiscord<exelotl> is there a way to make a template do something different depending on whether it's called in the same module as where it's declared?
15:46:10FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2WDj
15:46:17FromDiscord<exelotl> something like that?
15:47:06FromDiscord<clyybber> maybe when declared(foo) works :D
15:47:12FromDiscord<clyybber> didn't try tho
15:47:26FromDiscord<clyybber> oh, nevermind that isn't gonna solve that
15:47:50FromDiscord<clyybber> @exelotl maybe declaredInScope
15:50:23FromDiscord<exelotl> I'll give it a try, cheers :)
15:50:35FromDiscord<exelotl> In reply to @jtiai "So there is no": You can use templates: https://play.nim-lang.org/#ix=2WDk
15:51:37FromDiscord<jtiai> That is interesting. What I've understood that macros would be closely the same.
15:54:08FromDiscord<exelotl> Macros are often overkill when a template will do :)
15:55:13FromDiscord<jtiai> Right. I'm still complete noob what comes to Nim.
15:59:42FromDiscord<jtiai> But it's been fun ride so far. It's been years since I last time learned new programming language.
16:00:55FromDiscord<exelotl> yeah I'm so glad I finally bit the bullet and learned it a couple of years ago
16:01:13FromDiscord<exelotl> I could never go back now x)
16:03:58FromDiscord<jtiai> Well Python code still pays my bills.
16:09:09FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2WDs
16:09:29FromDiscord<exelotl> I'll have to make the forum thread I was thinking about after all
16:17:30*tane joined #nim
16:24:17ForumUpdaterBotNew thread by Exelotl: Accessing {.emit.}'d variables across modules?, see https://forum.nim-lang.org/t/7827
16:28:17ForumUpdaterBotNew thread by Francisl: Need help implementing bind for C for webview.h, see https://forum.nim-lang.org/t/7828
16:28:20*mario-goulart joined #nim
16:35:27*letto quit (Quit: Konversation terminated!)
16:37:33*letto joined #nim
16:39:19FromDiscord<Goel> `extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window window);`↵Reading come C bindings i noticed in the case of a `Uint32` sometimes it convertet in nim with a `cuint` and somewith with `uint32`. Which one is preferable in case of bindings?
16:50:39FromDiscord<dk> I have no idea why `cuint` exists
17:28:52FromDiscord<Heav> hello.
17:28:57FromDiscord<Heav> is this a known issue? https://media.discordapp.net/attachments/371759389889003532/833756065169539132/unknown.png
17:29:10FromDiscord<Heav> is https://nim-lang.org/install_windows.html the correct place to install Nim for windows?
17:29:22FromDiscord<Heav> (edit) "https://nim-lang.org/install_windows.html" => "<https://nim-lang.org/install_windows.html>"
17:29:40*letto quit (Quit: Konversation terminated!)
17:30:23*rockcavera quit (Remote host closed the connection)
17:31:27*letto joined #nim
17:32:23*redchirp joined #nim
17:32:47redchirpHi, could anyone tell me how to transpile nim to C without actually compiling it?
17:33:59reversem3Does parsexml work like lxml for python ?
17:34:00reversem3The examples only use an html file on an actual xml file , anyone now how to parse an xml file ?
17:34:31reversem3 * Does parsexml work like lxml for python ?
17:34:31reversem3The examples only use an html file not an actual xml file , anyone now how to parse a xml file ?
17:35:35FromDiscord<Heav> virustotal also seems to flag this. https://www.virustotal.com/gui/file/3f84514da7641e400a202094691468a791ed168a36d70de415586e349b5fa370/summary
17:36:18FromDiscord<Solitude> yes, official source distributes a virus
17:36:38FromDiscord<dk> inside job?
17:36:55FromDiscord<zetashift> In reply to @Heav "is <https://nim-lang.org/install_windows.html> the ": It is, but it's a false positive you're seeing
17:55:37FromDiscord<clyybber> In reply to @ForumUpdaterBot "New thread by Exelotl:": @exelotl does the variable have to be {.emit.} ed?
17:55:43FromDiscord<clyybber> Or would exportc work too?
17:55:50reversem3proc open(my: var XmlParser; input: Stream; filename: string;
17:55:50reversem3 options: set[XmlParseOption] = {}) {.raises: [IOError, OSError],
17:55:50reversem3 tags: [ReadIOEffect].} Do you have to name the xmlparser first ?
17:58:34FromDiscord<clyybber> @exelotl I don't think there's a way around it; or do you have an idea on how the C code would have to look for that that coud work?↵One thing I can imagine doing is creating a helper module that just does `import mymodule` and declares the var and then include that;↵or maybe instead of a module make it a template
18:04:18*vicfred joined #nim
18:06:57FromDiscord<exelotl> @clyybber the actual pattern I'm doing is like this: http://ix.io/2WEc.nim
18:08:25FromDiscord<exelotl> I haven't found any other way to create a `const` dispatch table that I can pass by address
18:08:32FromDiscord<exelotl> besides using emit
18:16:32*xet7 quit (Quit: Leaving)
18:20:26*xet7 joined #nim
18:34:10reversem3ok so I'm stupid I figured out you have to use path to load the xml file
18:34:34reversem3but how can I extract certain tags ?
18:41:20FromDiscord<haxscramper> If you just want to extract things from XML file I would recommend using https://nim-lang.org/docs/xmlparser.html#loadXml%2Cstring%2Cset%5BXmlParseOption%5D instead of SAX parser from std/parsexml. It returns XmlNode that you can work using helper functions defined in `std/xmltree`
18:41:57FromDiscord<haxscramper> If you need SAX parser specifically you basically have to write most of the tree construction logic yourself
18:42:15FromDiscord<haxscramper> tree or any other data structure you would want to parse XML into
18:43:39*rockcavera joined #nim
18:44:57FromDiscord<haxscramper> And if you need only tags and nothing else you just loop with `parser.next()` and check `parser.kind()` each time
18:49:13FromDiscord<ajusa> are there any examples of calling Rust code from Nim? I tried doing c interop from both of them and get a whole bunch of errors
18:50:53FromDiscord<ajusa> I found https://github.com/arnetheduck/nbindgen, thought I had seen it before. Guess I'll try it, unless someone has a better way of doing this
18:51:53FromDiscord<sealmove> why don't we have a `split()` proc that takes a string as separator?
18:51:56reversem3I'm looking at this doc https://nim-lang.org/docs/xmltree.html#kind%2CXmlNode how do you actually extract instead of having to add elements
18:52:37FromDiscord<sealmove> In reply to @รєคɭ๓๏שє "why don't we have": oh we do
18:53:05FromDiscord<haxscramper> In reply to @reversem3 "I'm looking at this": `node.tag()` https://nim-lang.org/docs/xmltree.html#tag%2CXmlNode
18:54:31FromDiscord<haxscramper> !eval import std/[xmlparser, xmltree]; echo parseXml("<a>b</a>").tag()
18:54:35NimBota
18:54:51FromDiscord<haxscramper> Or `loadXml` for file in your case
18:56:27FromDiscord<haxscramper> In reply to @ajusa "are there any examples": I'm not aware of any other approach for interfacing nim and rust rather than via C interop (and I suppose this is the only way it could work). You should try `nbindgen` as it would probably automate a lot of boilerplate actions that might be the cause for "whole bunch of errors"
18:57:01FromDiscord<haxscramper> I.e. most likely this is all caused by some misconfiguration where some "very important rust header" is missing when importing to nim
18:57:09FromDiscord<haxscramper> Or vice-versa
18:57:15*mario-goulart left #nim ("ERC (IRC client for Emacs 26.1)")
19:14:56FromDiscord<exelotl> In reply to @Clyybber "<@!90614688374624256> I don't think": yooo the helper module actually worked :D
19:16:29FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2WEM
19:18:20FromDiscord<exelotl> I emit the vtables in the same module where they're declared, but I {.importc.} the pointer to the vtable which is emitted in a helper module that gets imported last of all once the names of all the vtables are known
19:18:31FromDiscord<haxscramper> In reply to @ajusa "Alright, yeah I just": You have to statically list with some rust runtime library in order to resolve this reference
19:18:49FromDiscord<haxscramper> E.g. `-passl:-lsomerustlib` I think.
19:19:32FromDiscord<ajusa> ` libdl.so and libpthread.so.`? I'll try that, found those being referenced in a post online
19:20:07FromDiscord<ajusa> hey that worked! Thanks!
19:29:06FromDiscord<zidsal> is there any good example code of what an `==` should look like for a type that extends ref object. Would you only expect 2 ref objects to equal if they pointed to the same address in memory?
19:30:16FromDiscord<konsumlamm> no, though that's the default behaviour now on devel
19:30:28FromDiscord<konsumlamm> or already? idk
19:31:31FromDiscord<konsumlamm> i mean, it really depends on your type, there is no general answer
19:32:35FromDiscord<exelotl> In reply to @exelotl "I emit the vtables": ideally I'd emit the vtable itself in the helper module, but idk if it's possible to declare an `extern` function with an unknown signature in C 😅
19:33:32reversem3To find children in xml node it says proc child(n: XmlNode; name: string): XmlNode , why do I need a name " xml.child()
19:34:04reversem3 * To find children in xml node it says proc child(n: XmlNode; name: string): XmlNode , why do I need a name " would it be just xmlFile.child() ?
19:39:38FromDiscord<haxscramper> Yes. The procedure has a documentation example that illustrates how to use it
19:42:30FromDiscord<willyboar> gitter bridge down?
19:44:07FromGitter<Willyboar> ??
19:44:18*lritter quit (Ping timeout: 252 seconds)
19:45:25FromDiscord<willyboar> only on #offtopic
19:47:54FromGitter<codewski> Hello. I am planning to build a static site generator with Nim. What features do you want to see in such a project?
19:55:08FromDiscord<jtiai> In reply to @codewski "Hello. I am planning": Definition of static site generator is rather vague. Are you targetting some spesific area?
19:56:52FromGitter<codewski> Yes sorry for that. I am planning for a general-purpose static site/blog generator
19:57:47FromDiscord<haxscramper> It would be nice if it can be used as a library - i.e. API for manipulation of the intermediate representation
19:58:37FromDiscord<haxscramper> That way it could be adapted to any input source without having to go through some templating format first
20:00:54FromDiscord<jtiai> Probably providing some default templating could be useful.
20:02:00FromGitter<codewski> I am planned to use moustache and maybe scf for beginning
20:05:35FromGitter<codewski> @haxscramper I think I prefer an app rather than a lib
20:07:54FromDiscord<haxscramper> I'm talking about keeping IR clean and accessible to external users, not about implementing it as a library instead of an application. But considering you want to use moustache/scf we are probably thinking about different implementation routes so
20:09:56FromGitter<codewski> I want something like Hugo. In the simplest form of course :)
20:20:14*vicfred quit (Quit: Leaving)
20:36:37Prestigehugo is cool
20:37:47*ormiret quit (Ping timeout: 250 seconds)
20:37:51*euantorano quit (Ping timeout: 245 seconds)
20:37:55*fowl quit (Ping timeout: 246 seconds)
20:38:06*surma quit (Read error: Connection reset by peer)
20:38:07*Adeon quit (Ping timeout: 258 seconds)
20:38:15*robertmeta quit (Ping timeout: 246 seconds)
20:38:16*mids quit (Ping timeout: 245 seconds)
20:38:23*surma joined #nim
20:38:40*ormiret joined #nim
20:39:08*robertmeta joined #nim
20:39:15FromDiscord<clyybber> In reply to @exelotl "yooo the helper module": nice to hear!
20:39:21*euantorano joined #nim
20:39:33*fowl joined #nim
20:39:37*PMunch joined #nim
20:39:43*Adeon joined #nim
20:40:42FromDiscord<clyybber> We could map {.nodecl, importc.} with an export to that behaviour maybe
20:40:56*mids joined #nim
20:41:01FromDiscord<clyybber> so that it would get replicated automatically for each module that imports it
20:44:47federico3codewski: I prefer Pelican
20:50:46FromGitter<codewski> federico3 what feature of pelican you like most?
20:51:07*PMunch quit (Quit: leaving)
20:53:00federico3clean design, less dependencies than others, easy to debug
20:53:11*natrys quit (Ping timeout: 240 seconds)
20:58:19FromGitter<codewski> sounds fair. The only disadvantage is that does not support direct netlify deployments
20:59:37FromGitter<codewski> but I suppose is easy to implement
21:12:47*xet7 quit (Remote host closed the connection)
21:15:26FromDiscord<exelotl> In reply to @Clyybber "We could map {.nodecl,": It would be nice but I think there are other use cases for `var foo {.nodecl, importc.}` though... For example↵`var dispcnt {.nodecl, importc:"(volatile NU16)0x04000000".}: uint16`
21:23:09FromDiscord<zidsal> so it turns out you can configure vsc to hide files and folders, no more do I need to look at all the files testament generates!
21:24:17*tiorock joined #nim
21:24:17*tiorock quit (Changing host)
21:24:17*tiorock joined #nim
21:24:17*rockcavera is now known as Guest25852
21:24:17*Guest25852 quit (Killed (tolkien.freenode.net (Nickname regained by services)))
21:24:17*tiorock is now known as rockcavera
21:39:57*tane quit (Quit: Leaving)
21:53:17FromDiscord<sealmove> When using sockets a receive until proc would be super useful. Is such a proc implemented somewhere? I don't see it in stdlib but is it available by some package in nimble at least?
21:54:11FromDiscord<ElegantBeef> until what?
21:54:29FromDiscord<sealmove> keep receiving data until a string is matched
21:58:22*rockcavera is now known as Guest74352
21:58:22*Guest74352 quit (Killed (verne.freenode.net (Nickname regained by services)))
21:58:23*rockcavera joined #nim
22:00:31giaco__hi sealmove!
22:02:50FromDiscord<ElegantBeef> It shouldnt be too bad to implement, but yea it's not in the stdlib since it's rather weird
22:10:23*NimBot joined #nim
22:22:01FromDiscord<Nisha's alt> Is Nim available on WASM?
22:22:10FromDiscord<Nisha's alt> Well, can i compile it to WASM?
22:22:47FromDiscord<dom96> yes
22:22:55FromDiscord<Nisha's alt> Oh? Is there a link?
22:22:57FromDiscord<dom96> but WASM is overhyped
22:23:18FromDiscord<dom96> https://forum.nim-lang.org/t/4779
22:25:12FromDiscord<sealmove> @giaco hi
22:25:20FromDiscord<Nisha's alt> Thanks
22:27:06FromDiscord<sealmove> @giaco your request is reasonable but rn binarylang has more pressing issues (there is a critical bug in bitstreams)
22:30:22giaco__sealmove, which critical bug? the one about u24?
22:30:29FromDiscord<sealmove> yes
22:30:54FromDiscord<sealmove> also there is an idea to add socket streams
22:32:13giaco__sealmove, that would be interesting. The more I build with binarylang, the more I find myself writing converters to/from int/string and adding sockets to the mixture is not making the solution as lean as it should be
22:33:11FromDiscord<sealmove> there also a plan to add syntax sugar for auto-generating templates
22:33:44giaco__templates?
22:34:01FromDiscord<sealmove> plugins
22:34:12giaco__oh!
22:34:56giaco__what's your plan about sockets? I'm dealing with them right now and facing the problem about how to bridge them with binarylang
22:36:14FromDiscord<sealmove> something like this: `s {@conv[int]: (_.parseInt, $_)}: num`
22:36:40*vicfred joined #nim
22:37:01FromDiscord<sealmove> In reply to @giaco__ "what's your plan about": stuff will be added in bitstreams. for example a `proc newSocketStream(s: string)`
22:37:25FromDiscord<sealmove> (edit) "newSocketStream(s: string)`" => "newSocketStream(host: string, port: int)`"
22:37:51FromDiscord<sealmove> Something like this. I haven't designed it yet, but it will use stuff from `net` module of course.
22:38:21FromDiscord<sealmove> actually there is also: https://nim-lang.github.io/Nim/socketstreams.html
22:39:16FromDiscord<sealmove> so probably a thin wrapper around it, just like `newStringBitStream` and `newFileBitStream`
22:39:17giaco__I'm using newAsyncSocket right now
22:40:55FromDiscord<sealmove> tbh I have no idea if it will help for integrating with `asyncdispatch`.
22:41:52giaco__I think no, but I also think that binarylang + sockets would just save some string copying, not really speeding up the development of parsers
22:41:53FromDiscord<reilly> Are any of Nim's GCs meaningfully faster than the others?
22:43:24giaco__there are too many options around sockets to wrap them with binarylang, to me stringstream is the thing I've been using for all my buffer/unbuffered sync/async tcp/udp sockets
23:02:36FromDiscord<ElegantBeef> @reilly Each memory option has a benefit, Arc/Orc have lower latency, but tend to have a lower throughput, then each GC has different implications for memory/threads
23:03:13FromDiscord<ElegantBeef> When dealing mainly with sequences arc seems faster in my testing
23:06:55*fredrikhr quit (Ping timeout: 252 seconds)
23:12:57*Vladar quit (Remote host closed the connection)
23:25:16ForumUpdaterBotNew question by user14370162: how can i include a file via a variables value, see https://stackoverflow.com/questions/67170501/how-can-i-include-a-file-via-a-variables-value
23:30:58*clyybber quit (Quit: WeeChat 3.1)
23:39:29giaco__sealmove, forget about what I've just said about sockets and binarylang. Your integration would be a great thing, I've just realized how flawed my idea is
23:52:12*Kumool joined #nim