00:18:52 | arkanoid | mh, how broken are distinct range types? my program goes sigsegv if I turn "type Percent = range[0.0 .. 100.0]" into "type Percent = distinct range[0.0 .. 100.0]" |
01:43:16 | * | krux02_ quit (Quit: Leaving) |
02:54:39 | FromDiscord | <leorize> your program shouldn't crash at least |
03:10:54 | * | lucasta quit (Remote host closed the connection) |
05:35:30 | FromDiscord | <sOkam! 🫐> is there any way to wrap an object from C, without importing any of its fields at all, but still make it be the same object in the generated C code? |
05:36:06 | FromDiscord | <Elegantbeef> Might be able to make it an incomplete struct |
05:37:10 | FromDiscord | <sOkam! 🫐> how is the syntax for them? |
05:37:17 | FromDiscord | <Elegantbeef> It's a pragma |
05:38:37 | FromDiscord | <sOkam! 🫐> im still confused. i figure its a pragma, but don't know how its syntax works |
05:38:52 | FromDiscord | <sOkam! 🫐> can you give a mock example? |
05:39:45 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-incompletestruct-pragma |
05:41:08 | FromDiscord | <sOkam! 🫐> what's the benefit of the incomplete struct?↵it says to "not use the underlying C struct".... but do I not want the exact opposite? |
05:41:39 | FromDiscord | <Elegantbeef> It means the Nim generated struct I believe |
05:44:12 | FromDiscord | <Elegantbeef> actually in hindsight you can just importc and header with an object |
05:45:45 | FromDiscord | <sOkam! 🫐> i see, ty |
05:46:03 | FromDiscord | <sOkam! 🫐> what's the usecase for `pure` when importing C objects? 🤔 |
05:49:33 | FromDiscord | <Elegantbeef> There is no point there |
05:49:39 | FromDiscord | <Elegantbeef> Unless you're using inheritance |
06:00:53 | FromDiscord | <sOkam! 🫐> kk ty |
06:29:37 | FromDiscord | <nnsee> In reply to @user2m "this is cool didn't": on windows, you can use winim and the FindFirstChangeNotification win32 API call, see https://gist.github.com/mashingan/4a31d3a630e22cf9274eebf475ee60e6 for an example |
06:30:15 | FromDiscord | <nnsee> I don't recommend using the lib you linked since it seems to be using polling, which is very inefficient |
07:06:13 | * | ntat joined #nim |
07:40:26 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
07:45:01 | * | SchweinDeBurg joined #nim |
08:12:08 | * | advesperacit joined #nim |
09:04:33 | NimEventer | New thread by Araq: Challenge: Weak linking on Windows, see https://forum.nim-lang.org/t/11228 |
09:17:42 | * | ntat quit (Quit: Leaving) |
09:44:31 | FromDiscord | <jhgalino> is it alright to call `assert` in the middle of a program? will it have any performance impact on the program itself? |
10:09:01 | om3ga | it should affect as any additional code |
11:26:13 | advesperacit | @jhgalino note that `assert` is skipped in release builds |
11:49:49 | FromDiscord | <demotomohiro> assert is skipped when you set `-d:danger` or `--assertions:off`.↵assert is checked in `-d:release`. |
11:50:31 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L72 |
11:57:59 | advesperacit | ah, right.. how long ago was this changed? it was skipped on -d:release earlier |
12:14:10 | * | ntat joined #nim |
13:45:37 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=ASOeUPJUrwqa |
13:47:19 | FromDiscord | <odexine> In reply to @advesperacit "ah, right.. how long": i believe at least since 1.0 it has been enabled on release. |
13:49:07 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=giuhnlrqTmge |
13:50:38 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=SXzEqvHJazwA |
13:50:52 | FromDiscord | <odexine> okay, then the one i made is fine |
13:51:09 | FromDiscord | <myxi> thanks |
14:07:30 | FromDiscord | <myxi> let's say i have a --debug flag for my program, how do i let my all my modules know the state of this flag |
14:07:54 | FromDiscord | <myxi> is there like some way to define maybe process level environment vars or smth like that |
14:09:07 | FromDiscord | <myxi> hmm, i guess i'm just looking for https://nim-lang.org/docs/envvars.html |
14:23:16 | FromDiscord | <wick3dr0se> Is there a solid wrapper for libsecp256k1? The two I found have same stars and both could have died for all I know. My scrap repos get more stars so its hard to tell lol |
14:28:11 | * | ntat quit (Quit: Leaving) |
14:30:39 | * | tc424 quit (Ping timeout: 268 seconds) |
14:31:12 | * | ntat joined #nim |
14:37:04 | * | tc424 joined #nim |
15:12:44 | FromDiscord | <myxi> do we use `let`for constants in nim? |
15:14:47 | FromDiscord | <zumi.dxy> that's run-time "constants" |
15:15:00 | FromDiscord | <zumi.dxy> you should use `const` if you can because those are compile-time |
15:15:42 | FromDiscord | <myxi> ah |
15:16:53 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=ECoioCCkpudV |
15:18:45 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=oizqRjjwHeSj |
15:18:48 | FromDiscord | <myxi> (edit) "https://play.nim-lang.org/#pasty=gwGCIuTdHxRD" => "https://play.nim-lang.org/#pasty=ionMtQrWWEOk" |
15:20:00 | FromDiscord | <zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=bLafvwDBCqDa |
15:20:10 | FromDiscord | <zumi.dxy> (in case you want to define multiple `const`s) |
15:20:29 | FromDiscord | <zumi.dxy> also for slightly fitting stuff within some column limit |
15:20:42 | FromDiscord | <myxi> ahh, that's a good idea, thanks! |
15:25:19 | FromDiscord | <myxi> also, do you happen to know a good lib for terminal colored output and stuff? preferably one with emoji support |
15:25:33 | FromDiscord | <myxi> (edit) "support" => "support, but one without it would work just as fine" |
15:28:11 | FromDiscord | <myxi> https://nim-lang.org/docs/terminal.html↵oh damn, |
15:28:29 | FromDiscord | <myxi> (edit) "https://nim-lang.org/docs/terminal.html↵oh damn, ... " added "i thought i'd need an external lib, but the std lib got me covered even here" |
15:48:25 | FromDiscord | <Robyn [She/Her]> @myxi https://github.com/PMunch/termstyle termstyle is pretty nice imo |
15:48:42 | * | une joined #nim |
15:48:47 | FromDiscord | <Robyn [She/Her]> Since it lets you do stuff like `red("string")` |
15:48:59 | FromDiscord | <saint.___.> That's nice |
16:00:00 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
16:01:05 | FromDiscord | <sOkam! 🫐> is it possible to wrap a C enum to a Nim enum, without declaring its contained entries? |
16:02:16 | FromDiscord | <sOkam! 🫐> I'm doing `type Thing {.importc, header: "header.h"}= enum`... but it wants fields beside the enum keyword apparently 😦 |
16:05:29 | * | SchweinDeBurg joined #nim |
16:27:52 | FromDiscord | <enthus1ast.> i think i broke the forum (while crawling) |
16:28:46 | FromDiscord | <enthus1ast.> maybe someone with access could fix it (so that i can crawl more :D) |
16:29:28 | FromDiscord | <enthus1ast.> ah no thats interesting:↵↵https://forum.nim-lang.org/posts.json?id=7909 |
16:29:35 | FromDiscord | <enthus1ast.> this shows a cloudflare error |
16:29:50 | FromDiscord | <enthus1ast.> but the startpage is working |
16:48:06 | FromDiscord | <tapeda> Amazing since resetting my windows yesterday and commenting out 1 os.sleep function, I've managed to trigger 4 different windows defender threats from the same program |
16:48:48 | FromDiscord | <tapeda> even after allowing them them all through individually the program runs slower than before resetting windows lmfao |
16:48:58 | FromDiscord | <tapeda> (edit) "resetting" => "reinstalling" |
16:54:29 | FromDiscord | <enthus1ast.> i completely switched to linux, also for work. |
16:54:43 | FromDiscord | <enthus1ast.> work was missing all those years |
16:55:49 | FromDiscord | <enthus1ast.> and to get a working desktop linux mint + cinnamon is quite unshitty |
17:03:33 | FromDiscord | <Robyn [She/Her]> I'm currently considering switching to FreeBSD for my next install :P |
17:03:41 | FromDiscord | <Robyn [She/Her]> Don't really have any pros or cons for it specifically though |
17:08:25 | FromDiscord | <enthus1ast.> idk FreeBSD has no real alternative to systemd, all the solutions they offer feel hacky. |
17:08:52 | FromDiscord | <enthus1ast.> and the bsd tooling lacks behind the gnu/linux tooling imho |
17:13:47 | FromDiscord | <enthus1ast.> i think the next (private) installation for me will be nixos. ↵I can also imagine nixos for my work, since i need to support quite old software (science software...) and sometimes its terrible to get stuff running when they just run with one particular version of python or tcl/tk or this and that. |
17:14:15 | FromDiscord | <enthus1ast.> or when they only compile with this particular gcc/gfortran |
17:14:43 | FromDiscord | <enthus1ast.> with nixos this would be a non issue ithink |
17:15:13 | FromDiscord | <enthus1ast.> currently i ship docker for such cases, but only for tools without gui |
17:32:14 | FromDiscord | <ambient3332> I don't really understand why this works in the web sandbox, but locally just dies without giving anything outside "it failed" https://play.nim-lang.org/#pasty=riqhAagxNTRC |
17:32:28 | FromDiscord | <ambient3332> Illegal memory writes? |
17:34:13 | FromDiscord | <Robyn [She/Her]> In reply to @enthus1ast. "and the bsd tooling": Fair enough |
17:36:05 | FromDiscord | <Robyn [She/Her]> In reply to @ambient3332 "I don't really understand": This runs just fine on my Aarch64 phone via Termux |
17:36:28 | FromDiscord | <ambient3332> Maybe something is messing my Nim cache? I'm really confused why it just dies |
17:38:19 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=JazgByXwQBmF |
17:39:58 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#pasty=WYoAaWihPCiS |
17:40:40 | FromDiscord | <ambient3332> Both GCC and MSVC |
17:42:34 | FromDiscord | <myxi> In reply to @chronos.vitaqua "<@598134630104825856> https://github.com/PMunch/ter": looks good |
17:45:53 | FromDiscord | <Robyn [She/Her]> In reply to @ambient3332 "Here's the full error:": Could it be an error specific to Windows, then? |
17:46:07 | FromDiscord | <Robyn [She/Her]> I don't know anyone else here who develops on Windows to test it, unfortunately (since I have my development environment set up in WSL) |
17:46:19 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=Qdujsofaruww |
17:46:40 | FromDiscord | <ambient3332> In reply to @chronos.vitaqua "Could it be an": Possibly. Would be nice to get more debug info on what is going on tho |
17:46:43 | FromDiscord | <jaar23> any tutorial or doc on guiding me how to use nimterop to wrap a c library? newbie in this area |
17:48:16 | FromDiscord | <enthus1ast.> @myxi prolly just followed the redirect |
17:48:42 | FromDiscord | <Robyn [She/Her]> In reply to @ambient3332 "Possibly. Would be nice": You can use a C debugger if you compile with `--debugger:native` |
17:49:04 | FromDiscord | <enthus1ast.> @myxi maybe try to set `maxRedirects = 0` |
17:49:28 | FromDiscord | <myxi> In reply to @enthus1ast. "<@598134630104825856> prolly just followed": you're right, i turned off redirects, now it works |
17:50:38 | FromDiscord | <ambient3332> In reply to @chronos.vitaqua "You can use a": Ok I got Segmentation fault "cygwin.S: No such file or directory" using gdb. at least that's something 🙂 |
17:51:14 | FromDiscord | <ambient3332> Nim gcc compiler is not setup quite right? |
17:51:23 | FromDiscord | <ambient3332> I'm using choosenim if that has something to do with it |
17:52:53 | FromDiscord | <ambient3332> Although then MSVC should work... |
17:56:11 | FromDiscord | <Robyn [She/Her]> In reply to @ambient3332 "I'm using choosenim if": It shouldn't |
17:56:44 | FromDiscord | <Robyn [She/Her]> If you have clang installed, could try that? |
17:56:53 | FromDiscord | <Robyn [She/Her]> Though I'm not sure if the playground uses gcc |
17:57:43 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=FnRObTwSHYrZ |
17:58:09 | FromDiscord | <myxi> (edit) "https://play.nim-lang.org/#pasty=YFrfQFSXeLTy" => "https://play.nim-lang.org/#pasty=jWnvmUtFUoOq" |
17:59:16 | FromDiscord | <ambient3332> In reply to @chronos.vitaqua "It shouldn't": Seems like Nim just hates my ring buffer implementation and there's something goin under the surface that I'm not aware of |
17:59:58 | FromDiscord | <ambient3332> Implementing ringbuf that doesn't rely on uin16 wraparound seems to work fine |
18:02:00 | FromDiscord | <enthus1ast.> In reply to @myxi "is there some way": Have a look at the `Location` header |
18:03:02 | FromDiscord | <enthus1ast.> ^ https://developer.mozilla.org/en-US/docs/web/http/headers/location |
18:04:14 | FromDiscord | <myxi> sent a code paste, see https://play.nim-lang.org/#pasty=HevgtFEjweyt |
18:04:56 | FromDiscord | <myxi> oh, i think i did a oopsie |
18:05:41 | FromDiscord | <myxi> yep, now it's there. Thanks! |
18:43:26 | FromDiscord | <myxi> https://nim-lang.org/docs/xmltree.html#findAll%2CXmlNode%2Cstring%2Cseq%5BXmlNode%5D↵is this recursive? |
18:48:11 | * | def- quit (Quit: -) |
18:48:11 | FromDiscord | <enthus1ast.> looks like it: https://github.com/nim-lang/Nim/blob/e374759f29da733f3c404718c333f5f3cb5f332d/lib/pure/xmltree.nim#L888 |
18:48:41 | FromDiscord | <myxi> great |
18:48:50 | FromDiscord | <enthus1ast.> there is a source link in the docs |
18:49:16 | * | def- joined #nim |
18:50:02 | FromDiscord | <myxi> yup, for some reason I didn't think of checking the source this time even though I used for everywhere else where I was doubtful |
18:50:14 | FromDiscord | <myxi> (edit) "yup, for some reason I didn't think of checking the source this time even though I used ... for" added "it" |
19:29:57 | FromDiscord | <norbert3873> sent a code paste, see https://play.nim-lang.org/#pasty=rwtodeklLsXo |
19:33:16 | FromDiscord | <norbert3873> The function delegates are all working when I write it myself like: `var myFunc = cast[proc (arg1: string, arg2: int): string {.nimcall.}](ptrTable["originalFunc"])` |
19:37:01 | FromDiscord | <enthus1ast.> it might be easier with a macro |
19:40:01 | FromDiscord | <enthus1ast.> what is generated from the template? |
19:40:10 | FromDiscord | <enthus1ast.> maybe the replacement is not working |
19:40:23 | FromDiscord | <enthus1ast.> you can check with `expandMacros` from macros |
19:40:34 | FromDiscord | <enthus1ast.> sent a code paste, see https://play.nim-lang.org/#pasty=TOIfcECMYdhk |
19:41:11 | FromDiscord | <norbert3873> One sec I'll check now. |
19:42:54 | FromDiscord | <enthus1ast.> i am by far an expert on nim macro programming, but what i do in such cases is, use `dumpAstGen` from macros with the code i wanna generate, copy and paste the ast generating code, put it in a macro and tweak the ast generating to my liking |
19:43:34 | FromDiscord | <norbert3873> error (in the cast): type expected. Seems to be the case that the replacement is not working... |
19:44:35 | FromDiscord | <norbert3873> Was trying to stay away from macros for my own sanity but it looks like thats the path forward. Thanks for the re-vectoring. |
19:45:20 | FromDiscord | <enthus1ast.> i mean, it could be also possible with those template syntax, i've not used it much though and cannot really help |
19:46:12 | FromDiscord | <norbert3873> No worries, bout time I learn nim macro's any way. |
19:46:52 | FromDiscord | <norbert3873> I suspect it just may not be possible in a template when trying to replace the symbol name of a type - but I don't know for sure... |
19:57:38 | FromDiscord | <sunpoke04> hey, was gonna try the language today |
19:58:08 | FromDiscord | <sunpoke04> thought of something like wang tiles, is there an easy way to represent a 4 bit structure? |
19:58:22 | FromDiscord | <sunpoke04> or should I just use booleans and the compiler will optimize that for me? |
20:05:04 | FromDiscord | <enthus1ast.> i think not bool is 1 byte |
20:05:11 | FromDiscord | <enthus1ast.> `echo sizeof(bool)` |
20:07:35 | FromDiscord | <enthus1ast.> https://nim-lang.org/docs/bitops.html could help, though |
20:07:54 | FromDiscord | <Elegantbeef> You should use a bitsety |
20:07:55 | FromDiscord | <Elegantbeef> bitset\ |
20:08:10 | FromDiscord | <enthus1ast.> ah this bot again 🙂 |
20:08:57 | FromDiscord | <Elegantbeef> Lol |
20:11:21 | FromDiscord | <.bobbbob> smartest most sarcastic bot |
20:15:21 | NimEventer | New thread by lou15b: Destructors for "ref object" types?, see https://forum.nim-lang.org/t/11229 |
20:15:31 | FromDiscord | <.bobbbob> and you can use uint8 to be sure that it's an 8 bit value |
20:15:39 | FromDiscord | <Elegantbeef> Don't do that |
20:15:48 | FromDiscord | <sunpoke04> In reply to @Elegantbeef "You should use a": doesn't that use bytes? I don't know much, sry |
20:16:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zIwNxVmqMvXr |
20:16:51 | FromDiscord | <Elegantbeef> A bitset packs into the least amount of bytes required |
20:17:00 | FromDiscord | <Elegantbeef> So in the above case you have 4 bits of a byte used |
20:17:41 | FromDiscord | <sunpoke04> what, I'm lost |
20:17:52 | FromDiscord | <sunpoke04> https://github.com/nim-lang/Nim/blob/version-2-0/compiler/bitsets.nim#L18 isn't this a bitset thingy? |
20:18:01 | FromDiscord | <Elegantbeef> No |
20:18:04 | FromDiscord | <Elegantbeef> That's the compiler |
20:18:16 | FromDiscord | <Elegantbeef> We do not look at the compiler for user space code |
20:18:28 | FromDiscord | <sunpoke04> sent a code paste, see https://play.nim-lang.org/#pasty=JNmKYZoeLRTI |
20:18:36 | FromDiscord | <Elegantbeef> Nim has built in bitsets for ordinals with a range less than uint16.high |
20:18:39 | FromDiscord | <Elegantbeef> No you could not |
20:18:43 | FromDiscord | <Elegantbeef> Cause a set is unique |
20:18:58 | FromDiscord | <sunpoke04> In reply to @Elegantbeef "That's the compiler": https://nim-lang.org/docs/compiler/bitsets.html I just clicked at source in the stdlib stuff |
20:19:16 | FromDiscord | <Elegantbeef> That's the compiler docs |
20:19:23 | FromDiscord | <Elegantbeef> A `set` is a builtin Nim type |
20:19:33 | FromDiscord | <.bobbbob> I think he means this https://nim-lang.org/docs/system.html#system-module-sets I forgot about these |
20:19:50 | FromDiscord | <Elegantbeef> How does one forget about one of the best Nim primitives 😛 |
20:20:29 | FromDiscord | <.bobbbob> because Ive only ever been able to use hash sets since the stuff didnt fit in the bitsets 😢 |
20:22:40 | FromDiscord | <sunpoke04> I'm lost there... |
20:23:13 | FromDiscord | <.bobbbob> In reply to @sunpoke04 "I'm lost there...": this is probably a better link to learn https://nim-lang.org/docs/manual.html#types-set-type |
20:24:00 | FromDiscord | <Elegantbeef> Nim's bitset is an abstraction ontop of manually doing `((myVal shr 2) and 1) == 1` |
20:24:06 | FromDiscord | <Elegantbeef> where `2` is the bit you want to set |
20:25:34 | FromDiscord | <Elegantbeef> want to see\ |
20:26:39 | FromDiscord | <sunpoke04> sent a code paste, see https://play.nim-lang.org/#pasty=VBxYeSYOvcHZ |
20:27:02 | FromDiscord | <sunpoke04> you guys are talking about using a set for that? |
20:27:11 | FromDiscord | <Q-Master> If one needs bitfields there's an option of using bitsize pragma as in https://github.com/nim-lang/c2nim/blob/master/testsuite/results/bitfield.nim |
20:27:40 | FromDiscord | <Elegantbeef> Yes sun |
20:28:07 | FromDiscord | <Elegantbeef> A `set[Colours]` is better than an array if you are attempting to use on or off logic |
20:30:05 | FromDiscord | <sunpoke04> I'm a bit lost there, isn't a static array faster and more efficient than a set? |
20:30:07 | FromDiscord | <Q-Master> Also there might be used union pragma to map that bitfields to any other type. |
20:30:21 | FromDiscord | <sunpoke04> also how are bots talking... |
20:31:12 | FromDiscord | <sunpoke04> In reply to @sunpoke04 "I'm a bit lost": or like, storing stuff as `0b0110` |
20:33:55 | FromDiscord | <Elegantbeef> I mean that's what a bitset does |
20:33:55 | FromDiscord | <Elegantbeef> A bitset is a 0 cost abstraction onto of manually bit twiddling |
20:33:55 | FromDiscord | <Elegantbeef> We're using bridges I'm on matrix for instance |
20:34:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JqfpoGSPcimS |
20:34:51 | FromDiscord | <.bobbbob> I think it's faster for inserting things is what beef means, but isn't it way slower for modifying it afterwards? |
20:35:30 | FromDiscord | <.bobbbob> So creating a set of the Colour enum will minimize the bits used and make it easy to insert new ones right? |
20:36:40 | * | ntat quit (Quit: Leaving) |
20:37:29 | FromDiscord | <Elegantbeef> It also is more readable and easier to use 😄 |
20:37:52 | FromDiscord | <Elegantbeef> Want to add red you just do `.incl Red` instead of `val = val or 0b1` |
20:44:21 | FromDiscord | <sunpoke04> I'm not crazy... |
20:45:07 | FromDiscord | <sunpoke04> why am I doing this again... |
20:46:37 | FromDiscord | <.bobbbob> In reply to @sunpoke04 "why am I doing": if you dont know any of this stuff you're probably better off going through the tutorial to learn the basics first https://nim-lang.org/docs/tut1.html |
20:46:40 | FromDiscord | <Elegantbeef> Doing what? |
20:46:52 | FromDiscord | <sunpoke04> In reply to @Elegantbeef "Doing what?": Wang tiles |
20:47:00 | FromDiscord | <Elegantbeef> No clue |
20:47:14 | FromDiscord | <Elegantbeef> Always a fun learning experience |
20:47:25 | FromDiscord | <sunpoke04> where fun T- |
20:50:12 | FromDiscord | <sunpoke04> sent a code paste, see https://play.nim-lang.org/#pasty=twDwCiqZydeZ |
20:51:43 | FromDiscord | <Elegantbeef> `incl` does not return |
20:51:47 | FromDiscord | <Elegantbeef> `horizontal + vertical` |
20:55:05 | FromDiscord | <sunpoke04> it's confirmed: this is weird |
20:55:25 | FromDiscord | <Elegantbeef> It's not weird |
20:58:22 | FromDiscord | <sunpoke04> it's weird for me T- |
21:06:13 | FromDiscord | <sunpoke04> wait, is there an way to represent 4bits? |
21:06:32 | FromDiscord | <sunpoke04> like, other than using a byte and like adding comments to not use it as a byte |
21:08:14 | FromDiscord | <Elegantbeef> Yea use a bitset |
21:08:43 | FromDiscord | <Elegantbeef> You can always make your own bitset doing `type MyBitSet = distinct uint8` and add your own procedures to it |
21:08:49 | FromDiscord | <Elegantbeef> But why would you want to we have first class bitsets |
21:09:06 | FromDiscord | <sunpoke04> erm... |
21:11:12 | FromDiscord | <sunpoke04> sent a code paste, see https://play.nim-lang.org/#pasty=DPULnqOvstyf |
21:11:24 | FromDiscord | <sunpoke04> but that's not just gonna be written in code |
21:11:34 | FromDiscord | <sunpoke04> I'm gonna save it in a file or something like that |
21:13:11 | FromDiscord | <Elegantbeef> What's the issue? |
21:17:20 | FromDiscord | <sunpoke04> I don't understand how I would do that with that set |
21:27:17 | FromDiscord | <Elegantbeef> You'd convert the bits to a tile by doing `cast[set[Position]](bits)` or `copyMem` |
21:27:35 | FromDiscord | <Elegantbeef> Bitsets are implemented the same as numbers they're just packed bits |
21:27:48 | FromDiscord | <Elegantbeef> So you can safely cast between them if you know what you're doing |
21:28:02 | FromDiscord | <Elegantbeef> IE `sizeof(set[Position]) == sizeof(uint8)` |
21:28:37 | FromDiscord | <sunpoke04> In reply to @Elegantbeef "You'd convert the bits": nope ` VM does not support 'cast' from tyInt to tySet` |
21:28:40 | FromDiscord | <sunpoke04> (edit) "` VM" => "`VM" |
21:29:47 | FromDiscord | <Elegantbeef> Right the vm does not |
21:29:53 | FromDiscord | <Elegantbeef> So you get to manually do it |
21:31:22 | FromDiscord | <Elegantbeef> Or you just don't use const in the above |
21:34:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=DqDpTuJAMWUj |
21:34:24 | FromDiscord | <Elegantbeef> Or there abouts |
21:37:26 | FromDiscord | <juancarlospaco> https://www.unrealengine.com/en-US/tech-blog/bringing-verse-transactional-memory-semantics-to-c |
21:45:17 | FromDiscord | <saint.___.> In reply to @sunpoke04 "also how are bots": Thats just how messages appear over the bridge to matrix or irc |
21:47:27 | FromDiscord | <ezquerra> I am compiling some code I did not write and I get the following warning:↵> Warning: Deprecated since 1.5; TaintedString is deprecated [Deprecated]↵The offending code is a proc that has an argument that is specified as `str: string|TaintedString`. Can I simply remove the `TaintedString` from there? I don't really know what TaintedStrings were supposed to do before 1.6... |
21:49:24 | FromDiscord | <Elegantbeef> They were supposed to be any string that you do not know is a valid input |
21:49:45 | FromDiscord | <Elegantbeef> So like `stdin.readLine` would've returned `TaintedString` and you were supposed to validate it before working with it |
22:04:55 | FromDiscord | <nnsee> In reply to @sunpoke04 "also how are bots": it's just a bridge from matrix (and irc) to discord |
22:05:08 | FromDiscord | <nnsee> since it uses webhooks, discord labels them as bots |
22:05:27 | FromDiscord | <Elegantbeef> Don't let them gaslight you into thinking I'm a real boy |
22:06:25 | FromDiscord | <nnsee> you're real to me, damn it |
22:14:15 | FromDiscord | <ezquerra> OK, then it seems I can just remove it and let the function take just strings, right? |
22:16:26 | FromDiscord | <Elegantbeef> Yep |
22:19:05 | FromDiscord | <ezquerra> Thanks |
22:27:23 | FromDiscord | <ezquerra> There is another warning I'm to trying to remove from Arraymancer. For some reason I am getting a "Warning: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated]" even though AFAIK there is no such a destroy hook |
22:27:55 | FromDiscord | <ezquerra> In fact the location that the compiler indicates is not the definition of a `=destroy` procedure |
22:28:44 | FromDiscord | <ezquerra> sent a code paste, see https://play.nim-lang.org/#pasty=exuOWZAFPGHH |
22:29:24 | FromDiscord | <ezquerra> And in that location the code is simply `new result, deallocTiles[T]` |
22:30:10 | FromDiscord | <Elegantbeef> https://github.com/mratsim/Arraymancer/blob/7d6d21cbcafda25201f4fd2fb481fb1316704813/src/arraymancer/laser/tensor/datatypes.nim#L80 probably due to |
22:30:12 | FromDiscord | <Elegantbeef> But no clue |
22:31:32 | FromDiscord | <ezquerra> That warning happens in a branch in which I think I have already fixed that `=destroy` proc to not use var |
22:32:59 | FromDiscord | <Elegantbeef> Wait `new X, T` makes a destructor |
22:33:00 | FromDiscord | <Elegantbeef> So that's the issue |
22:33:14 | FromDiscord | <Elegantbeef> Finaliser code has not been changed to work with non var destroy |
22:34:25 | FromDiscord | <ezquerra> So what you mean is that there is an implicit destructor that is created that uses var? |
22:34:33 | FromDiscord | <Elegantbeef> Yes |
22:34:39 | FromDiscord | <ezquerra> i.e. there is nothing that I can do to fix that warning? |
22:34:49 | FromDiscord | <Elegantbeef> You can disable the warning then turn it back on |
22:39:16 | FromDiscord | <ezquerra> OK, that works. Thanks! |
23:05:02 | * | krux02 joined #nim |
23:18:40 | * | advesperacit quit () |
23:20:59 | * | cornfeedhobo quit (Ping timeout: 268 seconds) |
23:26:48 | * | cornfeedhobo joined #nim |
23:27:34 | FromDiscord | <ezquerra> There is a macro in arraymancer that sometimes seems to declare some variables that are not used. Is it possible to disable that hint? I tried to use `{.push hint[XDeclaredButNotUsed]: off.}` but that does not seem to work... Maybe the macro must _add_ that push to the code it generates? |
23:44:32 | FromDiscord | <sunpoke04> In reply to @saint.___. "Thats just how messages": what's matrix |
23:48:43 | FromDiscord | <Elegantbeef> https://matrix.org/ |
23:50:22 | FromDiscord | <sunpoke04> In reply to @Elegantbeef "https://matrix.org/": this looks like a... "not discord" discord |
23:53:00 | FromDiscord | <saint.___.> In reply to @sunpoke04 "this looks like a...": Yeah it's like an open source discord thing but a lot less features in general |
23:55:17 | * | cornfeedhobo quit (Quit: ZNC - https://znc.in) |
23:57:14 | * | krux02_ joined #nim |