00:02:01 | * | jess quit (Quit: Lost terminal) |
00:02:29 | * | jess joined #nim |
00:39:19 | ForumUpdaterBot | New 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:16 | FromDiscord | <🍍phylum🍍> sent a code paste, see https://play.nim-lang.org/#ix=2WzE |
04:00:54 | FromDiscord | <ElegantBeef> You cannot use `var T` as an object field |
04:01:04 | FromDiscord | <ElegantBeef> you probably want a `ref Deque[Frame]` |
04:03:26 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2WzH |
04:05:11 | FromDiscord | <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:12 | FromDiscord | <🍍phylum🍍> ah yeah that would be it haha. thanks |
04:16:35 | FromDiscord | <ElegantBeef> No problem |
04:16:45 | FromDiscord | <🍍phylum🍍> thinking about reference vs value with python syntax is still melting my brain a bit |
04:16:59 | FromDiscord | <ElegantBeef> Eh it's fine, i abused refs alot coming from C# 😄 |
04:17:40 | FromDiscord | <ElegantBeef> Normal to get abused by things you arent used to, but it's rather simple in Nim imo |
04:48:48 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2WzO |
04:49:57 | FromDiscord | <ElegantBeef> @mattrb Current bug with Nim, inferred generic + explict generic = compile bug |
04:50:10 | FromDiscord | <mattrb> Right, that seems like the one you helped me with before |
04:50:12 | FromDiscord | <mattrb> (edit) "https://play.nim-lang.org/#ix=2WzO" => "https://play.nim-lang.org/#ix=2WzQ" |
04:50:20 | FromDiscord | <ElegantBeef> Yep |
04:50:29 | FromDiscord | <mattrb> What worked at the time was to put a colon before the `uint32` |
04:50:44 | FromDiscord | <mattrb> Although I don't know why, and that doesn't seem to be working here :p |
04:51:31 | FromDiscord | <Rika> thats for a.generic[:T] only |
04:51:41 | FromDiscord | <Rika> for the form generic[T](a), no colon |
04:53:00 | FromDiscord | <ElegantBeef> @mattrb Does this work for you? https://play.nim-lang.org/#ix=2WzS |
04:54:18 | FromDiscord | <ElegantBeef> It's an annoying but 😄 |
04:54:21 | FromDiscord | <ElegantBeef> (edit) "but" => "bug" |
04:56:29 | FromDiscord | <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:41 | FromDiscord | <mattrb> And hopefully this issue just gets picked up soon 😬 https://github.com/nim-lang/Nim/issues/17212 |
04:57:20 | FromDiscord | <ElegantBeef> I do think saem intends to dedicate time fixing up generics, but time isnt unlimted 😄 |
04:57:40 | FromDiscord | <mattrb> Yeah totally understand. I'll be looking forward to that day 🙏 |
04:58:36 | saem | Turns out IC work fixed some typedesc shenanigans. |
04:58:53 | FromDiscord | <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:11 | FromDiscord | <ElegantBeef> use a template to emit all of them |
05:00:46 | FromDiscord | <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:59 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2WzX |
05:01:20 | FromDiscord | <mattrb> You may have suggested something like that last time I brought this up |
05:01:59 | FromDiscord | <ElegantBeef> Yea i think i might have |
05:04:36 | FromDiscord | <ElegantBeef> Saem do you know if this specific one has been resolved? |
05:07:03 | FromDiscord | <ElegantBeef> Guess this isnt a typedesc issue and i'm too tired to reason for myself 😄 |
05:10:19 | saem | Let me look in a bit, playing video games. 😁 |
05:12:31 | FromDiscord | <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:10 | saem | That's fair (and true) |
05:21:02 | saem | back |
05:24:19 | saem | I 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:08 | FromDiscord | <ElegantBeef> It's just the infered typeclass generic + explict generic bug we talked about previously |
05:34:25 | saem | I thought you wanted a suggestion as to how to work around it. |
05:34:33 | saem | I couldn't figure it out... maybe it'll be easier on a second go. |
06:12:53 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WAk |
06:17:12 | FromDiscord | <Rika> `tmp and 0xFF00'u16` is not a bool |
06:17:25 | * | threenp left #nim ("User left") |
06:17:26 | FromDiscord | <Rika> im not too sure, but i assume that its because of that |
06:17:45 | saem | did 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:52 | FromDiscord | <jtiai> In reply to @Rika "`tmp and 0xFF00'u16` is": It's not a bool but apparently it slips through compiler checks. |
06:23:38 | saem | Unfortunately that snippet is very incomplete and isn't enough to reproduce the error in playground. |
06:23:48 | FromDiscord | <jtiai> Whole source is at github |
06:24:02 | FromDiscord | <Rika> jtiai prolly why its an error in semcheck |
06:24:14 | FromDiscord | <Rika> i mean semcall, misred |
06:24:15 | FromDiscord | <Rika> (edit) "misred" => "misread" |
06:27:25 | FromDiscord | <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:35 | saem | Pretty 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:41 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WAs |
06:47:46 | saem | you 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:47 | saem | Nice! |
06:48:34 | * | saem you can remove `.` template too |
06:49:06 | saem | Whoops, hit a shortcut accidentally, but yeah. |
06:51:11 | FromDiscord | <jtiai> How come invalid? |
06:51:56 | FromDiscord | <jtiai> And why I can remove dot template? |
06:52:03 | saem | Because those aren't part of the identifier nor are they necessarily valid identifiers. Might be a rendering issue. |
06:52:14 | saem | Because the template isn't required for the reproduction of the issue. |
06:52:30 | saem | You only need the `.=` because that's all you're actually using there. |
06:52:42 | FromDiscord | <ElegantBeef> `` gets destroyed across the irc bridge, so that's probably why the red dot |
06:52:49 | FromDiscord | <jtiai> if I remove templates: `Error: attempting to call undeclared routine: 'A='` |
06:53:16 | saem | Note, I didn't say templateS, I only referred to the `.` one. |
06:54:18 | FromDiscord | <jtiai> Well anyways that throws the semcall error. |
06:56:39 | FromDiscord | <ElegantBeef> Why are you doing `= 123`? |
06:57:18 | * | Mister_Magister quit (Ping timeout: 240 seconds) |
06:57:19 | FromDiscord | <ElegantBeef> Replacing that with true makes it work, so seems like dot ops have a bug not enforcing types |
06:57:26 | FromDiscord | <jtiai> because essentually that's my code. |
06:57:43 | FromDiscord | <ElegantBeef> But you're passing an int to a template that expects a bool |
06:58:10 | saem | yeah, the compiler is trying to report a type mismatch error and there is an assert it's tripping over. |
06:58:30 | FromDiscord | <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:45 | FromDiscord | <ElegantBeef> Well Nim's falsey's are `false` 😄 |
06:58:46 | saem | It was fixed as part of this: https://github.com/nim-lang/Nim/commit/a6526695f0972513913498c7b049a8dfb76814a3 |
06:58:51 | FromDiscord | <ElegantBeef> But yes it should error properly |
06:59:29 | FromDiscord | <ElegantBeef> Good to see |
06:59:34 | FromDiscord | <jtiai> But it gets tedious to write bool(123) all the time. |
06:59:38 | * | vicfred quit (Quit: Leaving) |
06:59:39 | FromDiscord | <ElegantBeef> so then write true |
07:00:11 | FromDiscord | <jtiai> well my code is something like `a and 0x0080`. |
07:00:11 | FromDiscord | <ElegantBeef> or `convert toBool(i: SomeInteger): bool = a != 0` |
07:00:15 | FromDiscord | <ElegantBeef> (edit) "`convert" => "`converter" |
07:00:21 | FromDiscord | <ElegantBeef> Use bitsets |
07:00:32 | FromDiscord | <ElegantBeef> then it's just `a in set` |
07:00:43 | FromDiscord | <jtiai> ? |
07:00:59 | FromDiscord | <jtiai> a in 0x0080 ? |
07:01:12 | FromDiscord | <ElegantBeef> You're using the right hand as a set right? |
07:01:20 | FromDiscord | <jtiai> No. |
07:01:25 | FromDiscord | <jtiai> It's bitwise operation. |
07:01:32 | FromDiscord | <ElegantBeef> I know what it is |
07:01:44 | FromDiscord | <ElegantBeef> `0x0080` is a set of bits right? |
07:02:16 | FromDiscord | <jtiai> technically one bit but yes... |
07:03:12 | saem | Nim 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:21 | FromDiscord | <ElegantBeef> ^ |
07:03:49 | FromDiscord | <jtiai> so I can do `(a xor b) and (a xor c)` with bitsets? |
07:04:36 | * | PMunch joined #nim |
07:06:06 | saem | Yes, just expressed differently. https://nim-lang.org/docs/manual.html#types-set-type |
07:06:53 | FromDiscord | <ElegantBeef> Sets are a much nicer API to the bitwise logic |
07:06:56 | FromDiscord | <jtiai> So how that would work with 16 bit unsigned numbers? |
07:07:02 | FromDiscord | <jtiai> given my example above? |
07:07:06 | FromDiscord | <ElegantBeef> `set[uint16]` |
07:07:25 | saem | That's the sections right below the section I linked above: https://nim-lang.org/docs/manual.html#set-type-bit-fields |
07:08:15 | saem | Since there is a minimal reproduction of the error, could you please raise an issue. |
07:08:40 | FromDiscord | <jtiai> Ah sorry. Forgot that totally. Will do it ASAP. |
07:09:26 | FromDiscord | <jtiai> only 1.8k issues. Far more less than my work app.. 🙂 |
07:10:21 | FromDiscord | <jtiai> (we're around 2.5k open and aroud 50k closed) |
07:11:04 | FromDiscord | <jtiai> Probably should check if issue persist in latest main branch. |
07:12:59 | * | fredrikhr joined #nim |
07:18:12 | ForumUpdaterBot | New thread by Halloleo: How to access n theJS backend Bootstrap's "modal" method?, see https://forum.nim-lang.org/t/7825 |
07:25:02 | FromDiscord | <jtiai> And I really didn't got how bitsets would make my code simpler? |
07:27:05 | FromDiscord | <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:43 | FromDiscord | <Rika> Because the forum is using a very old version of its code base I think |
07:27:51 | FromDiscord | <Rika> Anyway you can make a code snippet using the playground |
07:28:10 | FromDiscord | <Rika> https://play.nim-lang.org/ |
07:28:32 | FromDiscord | <ElegantBeef> This is fine for asking here 😄 |
07:28:58 | FromDiscord | <ElegantBeef> I personally prefer people asking questions here, isnt good for longevity but great for help/community 😄 |
07:29:41 | FromDiscord | <mrotaru> Ah yes, forgot about the playground 😄 |
07:29:59 | FromDiscord | <mrotaru> made a gist: https://gist.github.com/mrotaru/dfa728ce90d9869518b865a677750e46 |
07:31:17 | FromDiscord | <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:18 | FromDiscord | <ElegantBeef> Where is the blocking at? |
07:31:35 | FromDiscord | <mrotaru> Not sure to be honest; I run it, and it doesn't respond to any requests |
07:32:26 | FromDiscord | <Rika> Does it print listening |
07:32:33 | FromDiscord | <mrotaru> Yes |
07:33:25 | FromDiscord | <Rika> I think it has something to do with you running both run forever and poll but I don’t know |
07:36:01 | FromDiscord | <mrotaru> Hmm doesn't look like it; this has the same behaviour: https://play.nim-lang.org/#ix=2WAK |
07:36:23 | FromDiscord | <mrotaru> `cb` doesn't get invoked |
07:42:42 | * | jjido joined #nim |
07:44:26 | FromDiscord | <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:16 | FromDiscord | <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:01 | FromDiscord | <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:56 | PMunch | If you want to you could do `writeLine[myType](f: File; x: varargs[myType, `$`])` |
08:36:04 | PMunch | `T` is just the convention |
08:50:02 | * | krux02 joined #nim |
08:55:38 | giaco__ | 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:40 | giaco__ | been received, but I don't have a length field that tells me when is "all" |
08:57:29 | FromDiscord | <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:56 | FromDiscord | <Goel> (edit) "[T]" => "[T]. Anyway end of the topic, thanks for explanation 😄" |
08:59:04 | PMunch | Some 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:06 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WBg |
09:28:17 | FromDiscord | <Rika> what is a |
09:28:18 | FromDiscord | <Rika> what is b |
09:28:20 | FromDiscord | <Rika> what is c |
09:28:34 | FromDiscord | <Rika> this is too nondescript |
09:30:32 | * | abm quit (Quit: Leaving) |
09:31:24 | FromDiscord | <jtiai> They are emulated cpu registers. |
09:31:32 | FromDiscord | <jtiai> literally called a, b and c. |
09:32:05 | FromDiscord | <jtiai> So they are unsigned 16 bit values. |
09:32:27 | FromDiscord | <jtiai> And I was told that I should use bitfields/bitsets instead of doing those bitwise operations. |
09:35:48 | PMunch | I think they must've been mistaken |
09:35:57 | PMunch | Or at least misunderstood what you where trying to do |
09:36:25 | PMunch | Bitsets are nice if you have single bit flags that you want to set in a mask |
09:36:39 | FromDiscord | <jtiai> And that's I do have for CPU flags. |
09:36:52 | PMunch | But for just xoring together random uint16s they're not really doing anything |
09:37:51 | FromDiscord | <jtiai> specially since most of the time data comes emulated memory it's "random"... |
09:44:14 | FromDiscord | <🍍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:28 | FromDiscord | <jtiai> And a stupid question but does nim support overloading? like `proc x(z: uint8)` and `proc x(z: uint16)` ? |
09:44:36 | FromDiscord | <🍍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:53 | FromDiscord | <ElegantBeef> Yes nim has type based, and even name base overloading |
09:45:14 | FromDiscord | <🍍phylum🍍> does overloading occur on distinct types or are non-distinct aliases good for it too |
09:46:16 | FromDiscord | <ElegantBeef> I believe aliases can overload aswell, but i could be wrong cannot think clearly atm |
09:49:17 | FromDiscord | <jtiai> Hopefully I could finish my cpu emulation today... learned so much about Nim along the road. |
09:51:05 | PMunch | You can of course create a macro or template to make these xors nicer to work with by the way |
09:51:14 | PMunch | What kind of CPU are you emulating? |
09:51:23 | FromDiscord | <jtiai> Good old 6502. |
09:52:22 | PMunch | Just for fun? |
09:52:24 | FromDiscord | <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:32 | FromDiscord | <jtiai> Learning process. |
09:52:38 | FromDiscord | <jtiai> Never wrote anykind of emulator. |
09:52:58 | PMunch | Aah, cool |
09:54:25 | FromDiscord | <jtiai> First I though Z80 but when looking datasheets that darned thing has very complex up to 4 byte opcodes. |
10:00:22 | FromDiscord | <jtiai> I already wrote backbone of i686 (32bit) OS... At least it boots and has keyboard input... |
10:00:35 | FromDiscord | <jtiai> (with nim) |
10:02:21 | PMunch | Dom wrote a small kernel in Nim for fun I believe |
10:03:01 | FromDiscord | <jtiai> There was something it really didn't worked well.. |
10:04:43 | FromDiscord | <jtiai> I think it was missing gdt and then idt for keyboard forexample. |
10:05:28 | FromDiscord | <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:51 | FromDiscord | <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:49 | giaco__ | these kind of projects makes nim shine out there. Thanks! |
10:18:39 | PMunch | Hmm, 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:00 | PMunch | Never 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:14 | ForumUpdaterBot | New 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:08 | PMunch | Hmm, 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:47 | FromDiscord | <🍍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:21 | PMunch | Something like this? https://github.com/PMunch/MannBarSchwein-arduboy/blob/master/nim.cfg#L4-L6 |
11:32:24 | PMunch | Oops |
11:32:25 | FromDiscord | <Solitude> you can pass sequence to varargs already |
11:32:30 | PMunch | https://stackoverflow.com/questions/48418386/tuple-to-function-arguments-in-nim |
11:32:40 | PMunch | Oh you can? |
11:33:59 | * | xet7 joined #nim |
11:34:43 | FromDiscord | <Solitude> !eval (proc(a: varargs[int]) = echo a.len) @[1, 2, 3] |
11:34:45 | NimBot | 3 |
11:35:37 | PMunch | Huh, 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:37 | FromDiscord | <zetashift> TIL |
13:28:18 | FromDiscord | <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:35 | PMunch | Oh wow, something is very broken about the asynchttpserver example.. |
13:30:51 | PMunch | It just racks up a huge amount of RAM while consuming 100% of a core |
13:30:56 | FromDiscord | <mrotaru> Also can't seem to be able to use getFuturesInProgress() - "undeclared identifier" |
13:31:12 | FromDiscord | <mrotaru> Oh, so that's why the computer was getting slow 😄 |
13:31:34 | PMunch | Hmm, this might be the same issue that has plagued me with the HomeAssistant addons I've been writing |
13:31:46 | PMunch | Basically async callbacks seems to not work.. |
13:31:59 | PMunch | Or at least that's when I ran into issues |
13:32:01 | FromDiscord | <mrotaru> Buzkill 😄 |
13:32:31 | FromDiscord | <mrotaru> But yea, from a noob perspective, something seems wrong with async |
13:39:18 | PMunch | Hmm, can't find a Nim version that can run that example without doing that.. |
13:39:24 | PMunch | What OS are you on by the way? |
13:39:31 | FromDiscord | <mrotaru> Looks like it's the same for `devel` - just tried, and it will happily eat all the RAM available |
13:39:33 | FromDiscord | <mrotaru> Ubuntu |
13:41:34 | PMunch | Might be a Linux-only thing then |
13:42:16 | FromDiscord | <mrotaru> So it's fine on Windows ? or mac ? |
13:42:38 | PMunch | No idea |
13:42:51 | FromDiscord | <mrotaru> Oh ok |
13:42:51 | PMunch | But I assume someone has run that example without any issues :P |
13:43:02 | FromDiscord | <mrotaru> At some point 😄 |
13:43:55 | PMunch | I 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:09 | FromDiscord | <mrotaru> Damn, that sucks |
13:46:20 | FromDiscord | <mrotaru> Should i rise a bug, github ticket or smth ? |
13:46:43 | PMunch | https://github.com/nim-lang/Nim/issues/17783 |
13:51:43 | FromDiscord | <Rika> mrotaru on discord |
13:51:46 | FromDiscord | <Rika> you're on irc lol |
13:52:07 | PMunch | I'm on IRc :P |
13:52:31 | PMunch | There, better? |
13:53:45 | FromDiscord | <Rika> lol sorry heehee |
13:57:41 | PMunch | I mean from my point of view you're all on IRC :P |
13:57:46 | * | fredrikhr quit (Ping timeout: 240 seconds) |
13:59:14 | FromDiscord | <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:49 | PMunch | Haha, the Nim community just has some really clever bots! |
14:00:17 | PMunch | Even coming up with their own problems and discussing between them how to solve them |
14:00:54 | FromDiscord | <Rika> pmunch is a bot?!? |
14:00:58 | FromDiscord | <Rika> god damn |
14:01:04 | FromDiscord | <Rika> i cant believe im stupider than a bot |
14:01:15 | FromDiscord | <Rika> tbf though i have the iq of a rock so |
14:02:08 | FromDiscord | <clyybber> a rock may be very smart. It just wouldn't talk much. |
14:02:27 | FromDiscord | <Rika> i hate this |
14:02:40 | FromDiscord | <exelotl> Groundbreaking advancements in the "PMunch and exelotl are the same person because they never talk at the same time" theory |
14:02:45 | FromDiscord | <clyybber> lol |
14:03:45 | FromDiscord | <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:25 | FromDiscord | <no name fits> A seq that isn't a ref is on the stack, right? |
14:38:38 | FromDiscord | <clyybber> a seq is on the heap |
14:38:48 | FromDiscord | <clyybber> but it behaves like a value type |
14:39:55 | FromDiscord | <zetashift> Can a seq even be on the stack? |
14:40:02 | FromDiscord | <zetashift> Or a similiar datastructure? |
14:40:10 | FromDiscord | <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:37 | FromDiscord | <clyybber> @zetashift Yeah, you can make a VLA |
14:40:58 | FromDiscord | <clyybber> @no name fits nope, not worth it; probably will only affect performance negatively |
14:54:13 | FromDiscord | <dk> I think the compiler can allocate a ref on the stack as an optimization |
14:55:20 | * | WilhelmVonWeiner joined #nim |
15:10:36 | FromDiscord | <carpal> In reply to @dk "I think the compiler": at this point it should pass it as reference everywhere |
15:24:52 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WDb |
15:30:33 | FromDiscord | <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:05 | FromDiscord | <zajrik> so you wouldn't need to set it to 0 |
15:37:41 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2WDe |
15:37:59 | FromDiscord | <jtiai> (edit) "https://play.nim-lang.org/#ix=2WDe" => "https://play.nim-lang.org/#ix=2WDf" |
15:43:21 | FromDiscord | <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:10 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2WDj |
15:46:17 | FromDiscord | <exelotl> something like that? |
15:47:06 | FromDiscord | <clyybber> maybe when declared(foo) works :D |
15:47:12 | FromDiscord | <clyybber> didn't try tho |
15:47:26 | FromDiscord | <clyybber> oh, nevermind that isn't gonna solve that |
15:47:50 | FromDiscord | <clyybber> @exelotl maybe declaredInScope |
15:50:23 | FromDiscord | <exelotl> I'll give it a try, cheers :) |
15:50:35 | FromDiscord | <exelotl> In reply to @jtiai "So there is no": You can use templates: https://play.nim-lang.org/#ix=2WDk |
15:51:37 | FromDiscord | <jtiai> That is interesting. What I've understood that macros would be closely the same. |
15:54:08 | FromDiscord | <exelotl> Macros are often overkill when a template will do :) |
15:55:13 | FromDiscord | <jtiai> Right. I'm still complete noob what comes to Nim. |
15:59:42 | FromDiscord | <jtiai> But it's been fun ride so far. It's been years since I last time learned new programming language. |
16:00:55 | FromDiscord | <exelotl> yeah I'm so glad I finally bit the bullet and learned it a couple of years ago |
16:01:13 | FromDiscord | <exelotl> I could never go back now x) |
16:03:58 | FromDiscord | <jtiai> Well Python code still pays my bills. |
16:09:09 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2WDs |
16:09:29 | FromDiscord | <exelotl> I'll have to make the forum thread I was thinking about after all |
16:17:30 | * | tane joined #nim |
16:24:17 | ForumUpdaterBot | New thread by Exelotl: Accessing {.emit.}'d variables across modules?, see https://forum.nim-lang.org/t/7827 |
16:28:17 | ForumUpdaterBot | New 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:19 | FromDiscord | <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:39 | FromDiscord | <dk> I have no idea why `cuint` exists |
17:28:52 | FromDiscord | <Heav> hello. |
17:28:57 | FromDiscord | <Heav> is this a known issue? https://media.discordapp.net/attachments/371759389889003532/833756065169539132/unknown.png |
17:29:10 | FromDiscord | <Heav> is https://nim-lang.org/install_windows.html the correct place to install Nim for windows? |
17:29:22 | FromDiscord | <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:47 | redchirp | Hi, could anyone tell me how to transpile nim to C without actually compiling it? |
17:33:59 | reversem3 | Does parsexml work like lxml for python ? |
17:34:00 | reversem3 | The examples only use an html file on an actual xml file , anyone now how to parse an xml file ? |
17:34:31 | reversem3 | * Does parsexml work like lxml for python ? |
17:34:31 | reversem3 | The examples only use an html file not an actual xml file , anyone now how to parse a xml file ? |
17:35:35 | FromDiscord | <Heav> virustotal also seems to flag this. https://www.virustotal.com/gui/file/3f84514da7641e400a202094691468a791ed168a36d70de415586e349b5fa370/summary |
17:36:18 | FromDiscord | <Solitude> yes, official source distributes a virus |
17:36:38 | FromDiscord | <dk> inside job? |
17:36:55 | FromDiscord | <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:37 | FromDiscord | <clyybber> In reply to @ForumUpdaterBot "New thread by Exelotl:": @exelotl does the variable have to be {.emit.} ed? |
17:55:43 | FromDiscord | <clyybber> Or would exportc work too? |
17:55:50 | reversem3 | proc open(my: var XmlParser; input: Stream; filename: string; |
17:55:50 | reversem3 | options: set[XmlParseOption] = {}) {.raises: [IOError, OSError], |
17:55:50 | reversem3 | tags: [ReadIOEffect].} Do you have to name the xmlparser first ? |
17:58:34 | FromDiscord | <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:57 | FromDiscord | <exelotl> @clyybber the actual pattern I'm doing is like this: http://ix.io/2WEc.nim |
18:08:25 | FromDiscord | <exelotl> I haven't found any other way to create a `const` dispatch table that I can pass by address |
18:08:32 | FromDiscord | <exelotl> besides using emit |
18:16:32 | * | xet7 quit (Quit: Leaving) |
18:20:26 | * | xet7 joined #nim |
18:34:10 | reversem3 | ok so I'm stupid I figured out you have to use path to load the xml file |
18:34:34 | reversem3 | but how can I extract certain tags ? |
18:41:20 | FromDiscord | <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:57 | FromDiscord | <haxscramper> If you need SAX parser specifically you basically have to write most of the tree construction logic yourself |
18:42:15 | FromDiscord | <haxscramper> tree or any other data structure you would want to parse XML into |
18:43:39 | * | rockcavera joined #nim |
18:44:57 | FromDiscord | <haxscramper> And if you need only tags and nothing else you just loop with `parser.next()` and check `parser.kind()` each time |
18:49:13 | FromDiscord | <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:53 | FromDiscord | <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:53 | FromDiscord | <sealmove> why don't we have a `split()` proc that takes a string as separator? |
18:51:56 | reversem3 | I'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:37 | FromDiscord | <sealmove> In reply to @รєคɭ๓๏שє "why don't we have": oh we do |
18:53:05 | FromDiscord | <haxscramper> In reply to @reversem3 "I'm looking at this": `node.tag()` https://nim-lang.org/docs/xmltree.html#tag%2CXmlNode |
18:54:31 | FromDiscord | <haxscramper> !eval import std/[xmlparser, xmltree]; echo parseXml("<a>b</a>").tag() |
18:54:35 | NimBot | a |
18:54:51 | FromDiscord | <haxscramper> Or `loadXml` for file in your case |
18:56:27 | FromDiscord | <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:01 | FromDiscord | <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:09 | FromDiscord | <haxscramper> Or vice-versa |
18:57:15 | * | mario-goulart left #nim ("ERC (IRC client for Emacs 26.1)") |
19:14:56 | FromDiscord | <exelotl> In reply to @Clyybber "<@!90614688374624256> I don't think": yooo the helper module actually worked :D |
19:16:29 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=2WEM |
19:18:20 | FromDiscord | <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:31 | FromDiscord | <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:49 | FromDiscord | <haxscramper> E.g. `-passl:-lsomerustlib` I think. |
19:19:32 | FromDiscord | <ajusa> ` libdl.so and libpthread.so.`? I'll try that, found those being referenced in a post online |
19:20:07 | FromDiscord | <ajusa> hey that worked! Thanks! |
19:29:06 | FromDiscord | <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:16 | FromDiscord | <konsumlamm> no, though that's the default behaviour now on devel |
19:30:28 | FromDiscord | <konsumlamm> or already? idk |
19:31:31 | FromDiscord | <konsumlamm> i mean, it really depends on your type, there is no general answer |
19:32:35 | FromDiscord | <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:32 | reversem3 | To find children in xml node it says proc child(n: XmlNode; name: string): XmlNode , why do I need a name " xml.child() |
19:34:04 | reversem3 | * 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:38 | FromDiscord | <haxscramper> Yes. The procedure has a documentation example that illustrates how to use it |
19:42:30 | FromDiscord | <willyboar> gitter bridge down? |
19:44:07 | FromGitter | <Willyboar> ?? |
19:44:18 | * | lritter quit (Ping timeout: 252 seconds) |
19:45:25 | FromDiscord | <willyboar> only on #offtopic |
19:47:54 | FromGitter | <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:08 | FromDiscord | <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:52 | FromGitter | <codewski> Yes sorry for that. I am planning for a general-purpose static site/blog generator |
19:57:47 | FromDiscord | <haxscramper> It would be nice if it can be used as a library - i.e. API for manipulation of the intermediate representation |
19:58:37 | FromDiscord | <haxscramper> That way it could be adapted to any input source without having to go through some templating format first |
20:00:54 | FromDiscord | <jtiai> Probably providing some default templating could be useful. |
20:02:00 | FromGitter | <codewski> I am planned to use moustache and maybe scf for beginning |
20:05:35 | FromGitter | <codewski> @haxscramper I think I prefer an app rather than a lib |
20:07:54 | FromDiscord | <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:56 | FromGitter | <codewski> I want something like Hugo. In the simplest form of course :) |
20:20:14 | * | vicfred quit (Quit: Leaving) |
20:36:37 | Prestige | hugo 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:15 | FromDiscord | <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:42 | FromDiscord | <clyybber> We could map {.nodecl, importc.} with an export to that behaviour maybe |
20:40:56 | * | mids joined #nim |
20:41:01 | FromDiscord | <clyybber> so that it would get replicated automatically for each module that imports it |
20:44:47 | federico3 | codewski: I prefer Pelican |
20:50:46 | FromGitter | <codewski> federico3 what feature of pelican you like most? |
20:51:07 | * | PMunch quit (Quit: leaving) |
20:53:00 | federico3 | clean design, less dependencies than others, easy to debug |
20:53:11 | * | natrys quit (Ping timeout: 240 seconds) |
20:58:19 | FromGitter | <codewski> sounds fair. The only disadvantage is that does not support direct netlify deployments |
20:59:37 | FromGitter | <codewski> but I suppose is easy to implement |
21:12:47 | * | xet7 quit (Remote host closed the connection) |
21:15:26 | FromDiscord | <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:09 | FromDiscord | <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:17 | FromDiscord | <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:11 | FromDiscord | <ElegantBeef> until what? |
21:54:29 | FromDiscord | <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:31 | giaco__ | hi sealmove! |
22:02:50 | FromDiscord | <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:01 | FromDiscord | <Nisha's alt> Is Nim available on WASM? |
22:22:10 | FromDiscord | <Nisha's alt> Well, can i compile it to WASM? |
22:22:47 | FromDiscord | <dom96> yes |
22:22:55 | FromDiscord | <Nisha's alt> Oh? Is there a link? |
22:22:57 | FromDiscord | <dom96> but WASM is overhyped |
22:23:18 | FromDiscord | <dom96> https://forum.nim-lang.org/t/4779 |
22:25:12 | FromDiscord | <sealmove> @giaco hi |
22:25:20 | FromDiscord | <Nisha's alt> Thanks |
22:27:06 | FromDiscord | <sealmove> @giaco your request is reasonable but rn binarylang has more pressing issues (there is a critical bug in bitstreams) |
22:30:22 | giaco__ | sealmove, which critical bug? the one about u24? |
22:30:29 | FromDiscord | <sealmove> yes |
22:30:54 | FromDiscord | <sealmove> also there is an idea to add socket streams |
22:32:13 | giaco__ | 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:11 | FromDiscord | <sealmove> there also a plan to add syntax sugar for auto-generating templates |
22:33:44 | giaco__ | templates? |
22:34:01 | FromDiscord | <sealmove> plugins |
22:34:12 | giaco__ | oh! |
22:34:56 | giaco__ | 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:14 | FromDiscord | <sealmove> something like this: `s {@conv[int]: (_.parseInt, $_)}: num` |
22:36:40 | * | vicfred joined #nim |
22:37:01 | FromDiscord | <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:25 | FromDiscord | <sealmove> (edit) "newSocketStream(s: string)`" => "newSocketStream(host: string, port: int)`" |
22:37:51 | FromDiscord | <sealmove> Something like this. I haven't designed it yet, but it will use stuff from `net` module of course. |
22:38:21 | FromDiscord | <sealmove> actually there is also: https://nim-lang.github.io/Nim/socketstreams.html |
22:39:16 | FromDiscord | <sealmove> so probably a thin wrapper around it, just like `newStringBitStream` and `newFileBitStream` |
22:39:17 | giaco__ | I'm using newAsyncSocket right now |
22:40:55 | FromDiscord | <sealmove> tbh I have no idea if it will help for integrating with `asyncdispatch`. |
22:41:52 | giaco__ | 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:53 | FromDiscord | <reilly> Are any of Nim's GCs meaningfully faster than the others? |
22:43:24 | giaco__ | 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:36 | FromDiscord | <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:13 | FromDiscord | <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:16 | ForumUpdaterBot | New 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:29 | giaco__ | 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 |