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