00:00:26 | FromGitter | <gogolxdong> It was perfect ,but according to the statement of author, his work was stolen in purpose of business, so he stopped opensourcing it on 2019-6-17 |
00:01:33 | FromGitter | <gogolxdong> binary release only from then on. |
00:03:10 | FromDiscord | <ElegantBeef> I mean this repo had a commit 11days ago https://github.com/weolar/miniblink49 |
00:05:00 | * | abm quit (Quit: Leaving) |
00:07:19 | * | kinkinkijkin quit (Remote host closed the connection) |
00:08:11 | * | Jjp137 quit (Quit: Leaving) |
00:08:16 | * | Jjp137_ joined #nim |
00:09:32 | FromGitter | <gogolxdong> yeah, no relatived new code I think. node.dll is required to run it. |
00:10:01 | FromGitter | <raydf> @EleganBeef i really don't know much about the js backend. I suppose it wouldn't work with Karax. |
00:15:14 | FromGitter | <gogolxdong> We used Karax to build one of our productions. https://cloudfastnet.com/ |
00:22:01 | FromGitter | <raydf> @gogolxdong is this a webapp? |
00:23:55 | FromGitter | <raydf> (https://files.gitter.im/5602f03e0fc9f982beb19f61/sJvw/image.png) |
00:24:12 | FromGitter | <raydf> Let me show an example of what i'm trying to avoid, using your app as an example: |
00:24:46 | FromGitter | <raydf> There's a lot of scripts code that is not needed in your signup route. |
00:28:13 | FromGitter | <raydf> I'm almost sure in your project it won't matter |
00:29:33 | FromGitter | <raydf> But i'm creating a integrated transactional webapp with a CMS. So i'll have a lot of routes and i'm just worried about SEO implications of not having code splitting. |
00:40:58 | voltist | Is there a proc to 'rotate' an arraymancer array by 90 degrees? Like swap the first and second axis |
00:41:22 | FromDiscord | <Rika> transpose i assume? |
00:41:29 | FromDiscord | <Rika> or i dont really get it |
00:42:44 | voltist | Oh yeah that looks right |
00:42:45 | voltist | Thanks |
00:43:40 | * | nixfreak quit (Ping timeout: 246 seconds) |
00:49:46 | Zoom[m] | What is Cond in locks and how to use it? The docs are empty, besides the facts that it needs to be [de]initialized, can be wait on and sent "signals" to |
00:59:21 | * | hmmm quit () |
01:19:35 | * | Tanger joined #nim |
01:20:45 | FromGitter | <gogolxdong> @raydf you are professional bro, karax creates a monolithic js file, splitting code is the work of js specific packaging tools which requires a lot of js backend background experience to make it right. |
01:22:46 | FromGitter | <gogolxdong> SEO was led to a js-specific world, while karax creates a monolithic js file only. |
01:44:05 | * | lritter quit (Ping timeout: 256 seconds) |
01:45:09 | * | krux02 quit (Remote host closed the connection) |
01:55:14 | FromDiscord | <fwsgonzo> it looks like nims build system is fundamentally incompatible with cmake |
01:55:42 | FromDiscord | <fwsgonzo> there is no way for cmake to read any input from a tool and then use that as the input for source files |
01:56:35 | FromDiscord | <fwsgonzo> the best way right now seems to be to run cmake twice each time, once to run nim - if it builds, it builds, otherwise run it again - now it will scoop up new files in the nimcache |
01:58:25 | FromDiscord | <ElegantBeef> @fwsgonzo @nikki does use cmake, but idk what you're going for |
01:58:30 | * | nixfreak joined #nim |
02:00:02 | FromDiscord | <fwsgonzo> its just a normal CMake project |
02:03:22 | * | sagax joined #nim |
02:08:38 | * | mbomba joined #nim |
02:09:50 | FromDiscord | <fwsgonzo> (edit) there is no way for cmake to read any input from a tool and then use that as the input for source files, at build-time |
02:16:09 | FromGitter | <raydf> @gogolxdong yeah, i believe is not the scope of Karax to do that, is there a framework like Ruby On Rails but for nim-lang? |
02:16:14 | FromDiscord | <nikki> @fwsgonzo -- i indeed do something like that in https://github.com/nikki93/ng-public -- the `run.sh` script reads off of nim's generated .json file listing sources, and then i cmake generate and then also build. the whole thing still leads to fast build times for me though (cmake configure part is just like 0.2 sec usually and not the bottleneck) |
02:20:11 | * | apahl quit (Ping timeout: 272 seconds) |
02:22:10 | * | apahl joined #nim |
02:27:08 | FromDiscord | <Quibono> So for UI choices, are any fully fleshed out yet? |
02:27:32 | * | vsantana joined #nim |
02:28:13 | FromDiscord | <ElegantBeef> You can use GTK, or QT, but for more Nim Pure things we've got Nimx, Fidget, and i guess WebView if you want to go that route |
02:28:45 | FromDiscord | <Quibono> So Nimx or fidget, gotcha, thanks |
02:29:03 | FromDiscord | <ElegantBeef> Guess also Nigui or w/e that Crossplatform abstraction for native gui is |
02:29:25 | * | mbomba quit (Quit: WeeChat 3.0) |
02:29:50 | FromDiscord | <Quibono> Fidget seems like the prettiest out the box lol. |
02:30:53 | FromDiscord | <fwsgonzo> it looks like it's possible to generate an amalgamation .cpp file from the nimcache JSON, but that was stopped short by re-defined macros in each generated source |
02:30:58 | FromDiscord | <fwsgonzo> too bad |
02:31:14 | FromDiscord | <ElegantBeef> Well it's not really a toolkit as much as it is just a renderer for simple commands |
02:31:29 | FromDiscord | <ElegantBeef> It's like html+css combined inside nim ๐ |
02:32:02 | FromDiscord | <fwsgonzo> (edit) "macros" => "stuff" |
02:33:16 | FromDiscord | <ElegantBeef> I say that just cause you say "out of the box" but it doesnt really have a "box" since you make the components you want yourself |
02:34:03 | FromDiscord | <nikki> @fwsgonzo yeah also i like that i don't have to rebuild all the source for my project every time |
02:34:14 | FromDiscord | <nikki> (as an amalgamation would do) |
02:36:03 | FromDiscord | <fwsgonzo> the problem is that im not making shell scripts |
02:36:05 | FromDiscord | <nikki> the run.sh + CMakeLists.txt setup in that repo makes it all work -- there's a bunch of other convenience stuff i added but the core part is the `nim_gen_srcs` part of the bash script and the `NIM_GEN_SRCS` variable that shows up in cmake as a result |
02:36:41 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2FZu |
02:36:48 | FromDiscord | <fwsgonzo> (edit) "https://play.nim-lang.org/#ix=2FZu" => "https://play.nim-lang.org/#ix=2FZv" |
02:37:17 | * | vsantana quit (Quit: Leaving.) |
02:37:20 | FromDiscord | <nikki> i already had a shell script for my proj just as a convenience over the cmake steps so i can eg. run with one command, and it didn't feel like a big addition |
02:37:32 | FromDiscord | <fwsgonzo> (edit) "https://play.nim-lang.org/#ix=2FZv" => "https://play.nim-lang.org/#ix=2FZw" |
02:37:35 | FromDiscord | <nikki> and i wasn't sure that i could make this work with just cmake logic (seems like that's what you're about to find out) |
02:38:01 | FromDiscord | <fwsgonzo> i already found out: the cmake manual is pretty clear - you can't generate the list of sources during build-time |
02:38:20 | FromDiscord | <fwsgonzo> if there was a static, finite list of nimcache files, it would have been OK |
02:38:22 | FromDiscord | <nikki> can you do it as the result of the running of an external program |
02:38:24 | FromDiscord | <fwsgonzo> i would just have listed them all |
02:38:47 | FromDiscord | <fwsgonzo> no, because at build-time CMake (and really, ninja/make) wants the files to be known |
02:39:16 | FromDiscord | <nikki> another approach is -- if you delete old nim files you can use cmake's glob stuff |
02:39:20 | FromDiscord | <fwsgonzo> I think what I have now can work, but it works until someone imports something new... ๐ |
02:39:25 | FromDiscord | <nikki> but then yeah you do need to configure_depends it |
02:39:49 | FromDiscord | <nikki> delete old nim cache files is what i mean |
02:39:59 | FromDiscord | <fwsgonzo> https://gist.github.com/fwsGonzo/6f07bd636e75ba2e6553c940040641ba |
02:40:08 | FromDiscord | <fwsgonzo> that's what I have now |
02:40:26 | FromDiscord | <fwsgonzo> as you can see, I just list all the nimcache imports that I have seen so far |
02:40:33 | FromDiscord | <fwsgonzo> it will fail if you import something new |
02:40:41 | FromDiscord | <nikki> yeah that just sounds pretty bad |
02:40:50 | FromDiscord | <nikki> so wondering if there's a way around it |
02:41:08 | FromDiscord | <nikki> bc. if a convenient magic thing just breaks when i do something normal, then it's not convenient magic, is it |
02:41:29 | FromDiscord | <nikki> hmm |
02:41:31 | FromDiscord | <fwsgonzo> the best way would be if nim generated source files that could be joined together into an amalgamation .cpp file |
02:41:42 | FromDiscord | <fwsgonzo> I already wrote a python script to join the generated sources into a single file |
02:41:50 | FromDiscord | <fwsgonzo> unfortunately, there's a ton of re-defined structs and macros |
02:42:22 | FromDiscord | <fwsgonzo> but it's certainly doable |
02:42:41 | FromDiscord | <nikki> that does sound like one way, but i'm not sure it's close to the best way bc. of the added time when changing something and building again bc. of recompiling all the code |
02:43:01 | FromDiscord | <nikki> in my project's scenario at least, a lot of time is saved by nim's way of splitting the code up |
02:43:03 | FromDiscord | <fwsgonzo> right, that's true |
02:43:26 | FromDiscord | <nikki> depends on use case, for sure. if it's just for the inclusing of a nim-made library as a cmake subdirectory, may be fine |
02:43:28 | FromDiscord | <fwsgonzo> well I just wanted to see if there existed a CMake solution - guess not |
02:43:49 | FromDiscord | <nikki> i wouldn't write it out just yet, because the cmake manual's suggestion that it isn't possible doesn't seem exhaustive |
02:43:49 | FromDiscord | <fwsgonzo> I could just build the generated sources as a library using a shell script |
02:44:53 | FromDiscord | <nikki> re: the amalgamation at least -- |
02:45:24 | FromDiscord | <nikki> i wonder if some crazy nim metaprogramming thing could be done at all |
02:45:33 | FromDiscord | <nikki> where you change what the main module emits -- haha |
02:46:03 | FromDiscord | <nikki> also `CONFIGURE_DEPENDS` with a glob actually works for me for example without an extra script |
02:46:27 | FromDiscord | <nikki> so i wonder if for example -- you could have a post build step with nim somehow that symlinks all of the stuff in the json into a specific subdir in the cache that you glob |
02:46:29 | FromDiscord | <nikki> and that subdir is always del'd before |
02:48:25 | FromDiscord | <fwsgonzo> the shell script idea is not going to work either - i can't add a library that doesn't exist yet, even if i were to generate it |
02:51:03 | FromDiscord | <fwsgonzo> I already have access to all the files, I just don't know every name at configure time, which is where CMake wants to know about all the files and libraries |
02:51:41 | FromDiscord | <fwsgonzo> that is, CMake simply won |
02:51:49 | FromDiscord | <fwsgonzo> (edit) "won" => "won't even run if there's something it can't find" |
02:52:20 | FromDiscord | <fwsgonzo> so whatever is needed really needs to be known beforehand, or it has to be generated before running cmake |
02:58:12 | FromDiscord | <fwsgonzo> I'll go to bed for now, but I might give this a forth try some other day ๐ |
02:59:20 | FromDiscord | <nikki> did you see the "`CONFIGURE_DEPENDS` with glob" part |
03:00:08 | FromDiscord | <reilly> I asked more or less this same question months and months ago. How do I do CSS w/ Jester? |
03:03:49 | FromDiscord | <fwsgonzo> Yes, just tried it - it seems to kinda work if you run cmake twice |
03:03:59 | FromDiscord | <fwsgonzo> it's better than guessing all the filenames |
03:04:17 | FromDiscord | <reilly> I figured it out, it was obvious in retrospect. |
03:06:27 | FromDiscord | <fwsgonzo> I can reliably build if i run ninja twice, at least - it's an improvement ๐ |
03:07:43 | FromDiscord | <fwsgonzo> alright, im out - and thanks for the help! |
03:19:44 | FromDiscord | <reilly> New question: Trying to do `resp meta(http-equiv="Refresh", content="0; url='/'")`. Obviously `http-equiv` isn't a valid keyword, so what am I supposed to use? `httpEquiv` (and all of it's case-insensitive variants) don't seem to work. |
03:20:12 | FromDiscord | <reilly> I wrote "it's" instead of "its" and now I want to shoot myself in the foot. Doesn't change the question though. |
03:21:47 | FromDiscord | <Rika> all of it is case-insensitive |
03:21:49 | FromDiscord | <Rika> ๐ |
03:23:23 | FromDiscord | <Rika> where is "meta" from? |
03:23:24 | FromDiscord | <reilly> I know. I'm saying I wrote "httpEquiv," nimsuggest complained ("invalid attribute for 'meta' element: httpequiv"), and despite knowing that Nim was case-sensitive, wrote "httpequiv" and "http_equiv" anyway. |
03:23:37 | FromDiscord | <reilly> `meta()` is from htmlgen. |
03:23:55 | FromDiscord | <reilly> case-insensitive |
03:23:58 | FromDiscord | <Rika> i mean the expansion of it's ๐ just poking fun |
03:24:24 | FromDiscord | <reilly> Oh, clearly we're not on the same page. |
03:24:57 | FromDiscord | <reilly> Nevermind, doesn't matter. What does matter is http-equiv. |
03:25:55 | FromDiscord | <Rika> you dont need to put the name |
03:25:58 | FromDiscord | <Rika> so uh |
03:26:36 | FromDiscord | <Rika> `meta("", "Refresh", "0....")` i believe? |
03:27:47 | FromDiscord | <reilly> `resp meta("", "Refresh", "0; url='/'")` -> "element meta cannot be nested" |
03:33:07 | FromDiscord | <Rika> wait |
03:33:11 | FromDiscord | <Rika> sorry huhuh |
03:34:25 | FromDiscord | <reilly> I wish htmlgen was better documented, or at least used actual arguments instead of varargs. |
03:35:18 | leorize[m]1 | htmlgen is kinda deprecated, I don't think it has been updated in awhile |
03:35:56 | leorize[m]1 | now karax is just better |
03:36:27 | leorize[m]1 | though I don't think the static rendering portions of it is documented |
03:41:42 | * | bung joined #nim |
03:54:22 | FromDiscord | <flywind> find this: https://users.rust-lang.org/t/rust-to-nim-a-comparison/52096 |
03:59:50 | FromDiscord | <ElegantBeef> Well seems they didnt use arc for the number -> string, so i guess there is the chance for arc to get it even faster |
04:03:35 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:05:16 | * | bung quit (Ping timeout: 246 seconds) |
04:05:35 | * | bung joined #nim |
04:05:52 | FromDiscord | <ElegantBeef> I also did suggest to use the C++ backend |
04:05:58 | FromDiscord | <ElegantBeef> So hey maybe it'll get even faster ๐ |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:35 | * | supakeen joined #nim |
04:12:00 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2FZI |
04:12:01 | FromDiscord | <Rika> but it still means nim defaults are slow |
04:12:51 | FromDiscord | <ElegantBeef> Sure the defaults might be slow, if it's a easy toggle to break that slight distance with rust it's nice |
04:13:15 | FromDiscord | <ElegantBeef> Like we dont know how slow in comparison atm, but we'll see i guess ๐ |
04:13:37 | FromDiscord | <Rika> i guess same goes with rust and binary size lol |
04:14:11 | FromDiscord | <ElegantBeef> This person seems interested in Rust vs. Other languages so it's fair to tinker with both as i see it with those binary comments |
04:14:36 | FromDiscord | <Rika> feel like rust can get to around 200% instead of 1000% binary size ww |
04:15:43 | FromDiscord | <ElegantBeef> Yea i'm interested in seeing the results from these additional tests if they do them, i know C++ builds tend to outperform the C builds, and arc should be a bit faster than the normal GC |
04:16:14 | leorize[m]1 | they wrote some very unidiomatic Nim |
04:16:41 | FromDiscord | <ElegantBeef> Yea i didnt read the code, just looked at build commands, we could also give more idiomatic Nim |
04:16:43 | leorize[m]1 | but I think I can guess why it's slow |
04:17:49 | FromDiscord | <ElegantBeef> What's your guess? |
04:19:29 | leorize[m]1 | string allocs |
04:20:06 | leorize[m]1 | and tuple unpacking is "slightly" slow |
04:21:35 | leorize[m]1 | looks like the code they use is on rosettacode so we can optimize that fairly quick |
04:22:05 | * | bung quit (Ping timeout: 240 seconds) |
04:22:08 | FromDiscord | <ElegantBeef> Well get on it, i already did my suggestion ๐ |
04:24:12 | FromDiscord | <Rika> lmao |
04:30:14 | FromDiscord | <ElegantBeef> I thought "Hey i can make even a basic code editor for NimX" and now i'm here completely clueless on how to get the `onTextInput` method to actual be invoked |
04:34:33 | FromDiscord | <Rika> congrats you baited yourself |
04:38:40 | FromDiscord | <Rebel> Why would C++ builds outperform C builds? |
04:38:48 | FromDiscord | <ElegantBeef> C++ compiler optimizations? |
04:39:06 | FromDiscord | <Rebel> Invoked via Nim or just baked in? |
04:39:10 | leorize[m]1 | because exceptions |
04:40:29 | leorize[m]1 | at least until orc becomes the default (exceptions:goto is generally superior) |
04:41:06 | FromDiscord | <ElegantBeef> Is it just soley exceptions and nothing else? |
04:42:36 | FromDiscord | <Rebel> really? Just due to exceptions that is impressive |
04:43:01 | FromDiscord | <nikki> exceptions:goto has codegen errors for me with std/json ๐ค i should make a gh issue soon |
04:43:06 | FromDiscord | <Rebel> I wonder if it would be more optimized if you used nlvm and did some llvm optimization afterwards |
04:43:17 | FromDiscord | <Rebel> (edit) "I wonder if it would be more optimized if you used nlvm and did some llvm optimization ... afterwards" added "on the IR" |
04:43:21 | FromDiscord | <nikki> i use c++ exceptions now but emscripten doesn't actually do c++ exceptions do well |
04:44:09 | FromDiscord | <ElegantBeef> I mean in some cases we're out preforming Rust already and it's LLVM so... ๐ |
04:44:16 | FromDiscord | <nikki> @Rebel there's a lot of c-specific optimizations in clang that nim benefits from, and it's not that abstracted from the c output; but yeah would be interesting if nlvm benefits from it more |
04:44:53 | FromDiscord | <nikki> i use clang for the c/c++ compilation of nim output for macos and emscripten |
04:45:33 | FromDiscord | <Rebel> clang is hot |
04:45:35 | FromDiscord | <Rebel> so is wclang ๐ |
04:46:00 | FromDiscord | <Rebel> What's even hotter is having some fun custom LLVM passes that do "fun" things to the IR ๐ |
04:46:42 | FromDiscord | <Rebel> There is a really good master's thesis that is around 200 pages about LLVM obfuscation it's quite a read |
04:48:50 | FromDiscord | <ElegantBeef> I guess i'm very much weird, since i've never cared if my code is obfuscated |
04:51:49 | leorize[m]1 | sigh, their nim code is not even the same as the rust code |
05:00:06 | * | superbia quit (Read error: Connection reset by peer) |
05:00:11 | * | superbia1 joined #nim |
05:06:35 | ForumUpdaterBot | New thread by Tinygiant: SIGSEGV on deleteContent, see https://forum.nim-lang.org/t/7174 |
05:12:48 | * | bung joined #nim |
05:17:31 | * | bung quit (Ping timeout: 272 seconds) |
05:22:37 | leorize[m]1 | @ElegantBeef I managed to beat rust :p |
05:22:44 | leorize[m]1 | I did it by... just copying the rust code |
05:23:15 | * | bung joined #nim |
05:23:23 | FromDiscord | <InventorMatt> are you going to post it on their thread? |
05:23:43 | FromDiscord | <ElegantBeef> Lol leorize, good job |
05:24:03 | FromDiscord | <ElegantBeef> With the default nim code did arc or cpp break the gap? |
05:25:32 | leorize[m]1 | I doubt it, it's too inefficient |
05:25:48 | leorize[m]1 | @InventorMatt probably, after I run the rust code |
05:26:26 | FromDiscord | <InventorMatt> okay, we just need to show rust people we are just as good as they are |
05:26:49 | leorize[m]1 | lol arc slows things down |
05:27:40 | FromGitter | <bung87> can `async` ` await` pragma transform exception raise to result `future.fails()` ? |
05:28:21 | FromDiscord | <ElegantBeef> ARC has let us down, i'm going back to nim 1.0 |
05:33:39 | FromGitter | <xflywind> https://github.com/nim-lang/Nim/issues/15392 |
05:33:41 | disbot | โฅ ARC/ORC loop string allocation slowdown ; snippet at 12https://play.nim-lang.org/#ix=2FZT |
05:34:25 | FromGitter | <xflywind> I sometimes benchmark string in loops too, it did not well than default gc. |
05:38:32 | bung | it may also a sequence assignment performance issue |
05:39:27 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:39:31 | * | vsantana joined #nim |
05:39:35 | * | njoseph joined #nim |
05:39:42 | * | njoseph quit (Client Quit) |
05:39:48 | * | njoseph joined #nim |
05:41:17 | * | njoseph quit (Client Quit) |
05:41:23 | * | njoseph joined #nim |
05:41:44 | * | njoseph quit (Client Quit) |
05:41:51 | * | njoseph joined #nim |
05:44:55 | * | bung quit (Ping timeout: 256 seconds) |
05:49:15 | * | vsantana quit (Quit: Leaving.) |
05:56:13 | * | narimiran joined #nim |
05:56:46 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2FZY |
05:58:36 | FromDiscord | <ElegantBeef> The best way to get Nil like behaviour is to use an option |
05:58:46 | leorize[m]1 | @ElegantBeef just replied to the thread |
05:58:57 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/options.html |
05:58:58 | FromDiscord | <ElegantBeef> Nice |
05:59:08 | FromDiscord | <ElegantBeef> I need to find something to program or i'm going to go mad |
05:59:24 | FromDiscord | <ElegantBeef> Lol i didnt post it |
05:59:26 | FromDiscord | <ElegantBeef> You lied! ๐ |
06:01:48 | FromDiscord | <tinygiant> @ElegantBeef Thanks, I'll start reading up on them. |
06:04:53 | leorize[m]1 | @ElegantBeef ah yea, sorry :P |
06:04:55 | leorize[m]1 | fixed |
06:08:15 | leorize[m]1 | fun fact: the Nim version can still be faster |
06:08:39 | FromDiscord | <ElegantBeef> I'm sure both can be |
06:08:55 | leorize[m]1 | the rust version use a simple ascii string reverse |
06:09:06 | leorize[m]1 | the nim version use the costlier unicode-aware reverse |
06:10:22 | FromGitter | <gogolxdong> By how much has ARC let you down? |
06:10:27 | leorize[m]1 | dropped another second using the dumb reverse proc |
06:12:27 | * | a_chou joined #nim |
06:12:40 | * | thomasross quit (Ping timeout: 246 seconds) |
06:16:55 | * | bung joined #nim |
06:16:59 | FromDiscord | <j-james> in what order does `walkDir` iterate through files? |
06:17:28 | FromDiscord | <j-james> it certainly does not seem to be alphanumerical unless something's wacked out in my code |
06:18:01 | FromDiscord | <Rika> I believe there is no order |
06:18:19 | FromGitter | <bung87> your program relys order? |
06:19:01 | FromGitter | <bung87> I havn't seen that kind of use case |
06:19:22 | FromDiscord | <j-james> not currently, but i'd like to go through them alphanumerically |
06:19:55 | FromGitter | <bung87> then store them seq do sort |
06:19:57 | FromDiscord | <j-james> it's parsing a bunch of json files named `2019-07-02` and the like |
06:19:59 | FromDiscord | <ElegantBeef> Well you could capture that walkdir into a seq then sort it then go through it |
06:20:16 | FromDiscord | <ElegantBeef> `sequtils` has a `toSeq` which lets you capture iterators |
06:20:53 | FromDiscord | <j-james> ooh, i'll look into that |
06:21:05 | FromDiscord | <j-james> haven't done much with iterators yet |
06:21:16 | * | bung quit (Ping timeout: 240 seconds) |
06:21:58 | FromDiscord | <ElegantBeef> `algorithm` has a sort proc for sequences, so you'll probably just have to write the comparison for the tuple |
06:25:19 | * | NimBot joined #nim |
06:32:25 | * | bung joined #nim |
06:35:36 | * | a_chou quit (Remote host closed the connection) |
06:39:25 | * | vicfred quit (Quit: Leaving) |
06:41:35 | * | nixfreak quit (Ping timeout: 256 seconds) |
06:58:37 | * | habamax joined #nim |
07:00:25 | FromDiscord | <Kaynato> Say that I want to call an efficient free on a sequence of some object that contains some unsafe memory. If I implement both a destructor for the single object and a destructor for the seq of that object, should I have the seq destructor call the efficient free and then the single-object destructor, if the single-object destructor inefficiently performs that free since it's called once for each single object instead of once per sequence? |
07:01:42 | FromDiscord | <Kaynato> Or would it be fine to, for example, in the T destructor just do, say, obj.handle != nil: customFree(obj.handle) or something |
07:14:22 | FromDiscord | <mratsim> a proper destructor has to do if obj.foo != nil anyway |
07:15:14 | FromDiscord | <mratsim> or more if not obj.handle.isNil: https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/flow_events.nim#L176-L178 |
07:15:27 | FromDiscord | <mratsim> prefer isNil to == nil or != nil |
07:17:14 | FromDiscord | <mratsim> and a sequence will call each elements destructors on destruction |
07:17:48 | FromDiscord | <mratsim> unless it's a type that "supportsCopyMem" (i.e. not a ref, seq, string or custom =destroy) in that case it won't do a thing |
07:20:44 | FromDiscord | <flywind> What should be preferred: isNil or != nil? |
07:20:46 | FromDiscord | <flywind> https://discord.com/channels/371759389889003530/371759389889003532/696718991019999252 |
07:22:42 | FromDiscord | <flywind> if `!= nil` is preferred according to the link I posts above, we should add comments to `isNil` at least. |
07:43:44 | FromDiscord | <mratsim> ah that changed |
07:44:07 | FromDiscord | <mratsim> I remember Araq saying that we should use isNil because maybe nil will be removed in the future. |
07:44:21 | FromDiscord | <mratsim> while isNil will be kept and be mapped to whatever we end up using |
07:46:41 | * | romkin joined #nim |
07:46:45 | FromDiscord | <flywind> It is a bit confusing. So I make a PR to clarify it. |
07:50:06 | * | romkin quit (Remote host closed the connection) |
07:51:07 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/pull/16191 |
07:51:08 | disbot | โฅ prefer x == nil to x.isNil |
08:00:24 | * | superbia1 quit (Quit: WeeChat 2.9) |
08:02:40 | FromDiscord | <lqdev> meanwhile `x == nil` tripping up the compiler so bad it produces a completely unrelated generic instantiation error |
08:03:06 | FromDiscord | <ElegantBeef> Guess flywind disregard mratsim ๐ |
08:03:11 | FromDiscord | <ElegantBeef> (edit) "disregard" => "disregarded" |
08:06:33 | FromDiscord | <flywind> Yeah, I see it now. |
08:07:39 | FromDiscord | <flywind> I will convert it to draft. |
08:08:06 | FromDiscord | <Kaynato> Hmm, I guess what my case is, is that there's vkFree... type function calls that expect pointer-len convention input |
08:08:46 | FromDiscord | <Kaynato> presumably calling it once on a collection is better than calling it one time per element, so I wanted to know if there was a general convention for that sort of case |
08:09:30 | FromDiscord | <Kaynato> And thanks about preferring !=/== nil, writing not isNil was getting frustrating |
08:17:28 | * | bung quit (Ping timeout: 260 seconds) |
08:36:09 | * | habamax_ joined #nim |
08:43:26 | * | PMunch joined #nim |
08:50:54 | * | bung joined #nim |
08:51:31 | * | vsantana joined #nim |
08:57:23 | * | habamax_ quit (Quit: leaving) |
09:00:05 | * | brainbomb[m] quit (Quit: Idle for 30+ days) |
09:01:14 | * | vsantana quit (Quit: Leaving.) |
09:05:12 | * | Tanger quit (Quit: Leaving) |
09:15:22 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:24:56 | * | krux02 joined #nim |
09:27:16 | * | krux02 quit (Remote host closed the connection) |
09:30:28 | * | Vladar joined #nim |
09:32:02 | * | hmmmmm joined #nim |
09:34:54 | * | habamax_ joined #nim |
09:35:30 | * | habamax_ quit (Client Quit) |
09:56:05 | * | bung quit (Ping timeout: 240 seconds) |
09:57:45 | * | bung joined #nim |
10:21:25 | ForumUpdaterBot | New thread by Kobi: Cs2nim update, see https://forum.nim-lang.org/t/7175 |
10:28:38 | * | MTRNord[m] is now known as MTRNord |
10:49:22 | FromDiscord | <fizzle_coder[terrorist]> hi how to setup nim with geany ide or how to setup aporia ide??? |
10:53:14 | * | kiwi_83 joined #nim |
10:53:18 | kiwi_83 | hi so % is overridden by json module as a create-new-json-object proc but what happens if I import another module that defines % again? |
10:53:25 | kiwi_83 | compiletime error? |
10:54:29 | FromDiscord | <Vindaar> kiwi_83 yes, if the signature is the same you get an ambiguous identifier error at compile time |
10:59:23 | kiwi_83 | hmm that is a bit odd to me...can the user redefine a differentn operator instead? |
11:03:35 | FromDiscord | <exelotl> @mixbot Aporia is outdated, you can find a list of Nim editor plugins here: https://github.com/nim-lang/Nim/wiki/Editor-Support |
11:05:26 | Clonkk[m] | What do you by 'redefine a different operator' ? |
11:05:42 | Clonkk[m] | * What do you mean by 'redefine a different operator' ? |
11:05:57 | kiwi_83 | if i write a library A and there is already another library B existing, both which define %, how can someone who imports both libraries use both definitions of %? |
11:06:06 | kiwi_83 | can you import % as something else |
11:09:29 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2G13 |
11:10:33 | Clonkk[m] | You can use ``module.proc`` syntax to remove ambiguity. You can use template to define alias as well ``template jsonpercentproc(x)= json.`%`(x) `` |
11:10:58 | FromDiscord | <exelotl> yep, template solution can work ^^ |
11:11:14 | FromDiscord | <exelotl> (edit) "yep, template solution can work ... ^^" added "too" |
11:16:31 | * | vsantana joined #nim |
11:21:34 | * | bung quit (Ping timeout: 265 seconds) |
11:21:40 | * | Q-Master quit (Quit: ะฃัะตะป) |
11:33:06 | * | abm joined #nim |
11:35:41 | * | Q-Master joined #nim |
11:36:04 | kiwi_83 | thanks, that code snippet is useful. what does qualified mean?? |
11:36:22 | * | Q-Master quit (Client Quit) |
11:36:33 | * | Q-Master joined #nim |
11:36:55 | kiwi_83 | and that `` around % is that stropping? |
11:37:03 | kiwi_83 | but % isnt a keyword is it? |
11:37:38 | FromDiscord | <haxscramper> `%` is not a keyword - you can define custom operators |
11:38:31 | FromDiscord | <haxscramper> Backticks are necessary to use operators as regular functions - `` `%`(arg1, arg2)`` |
11:38:44 | * | narimiran quit (Ping timeout: 260 seconds) |
11:39:47 | FromDiscord | <exelotl> kiwi_83: by qualified I meant prefixed with the name of the module |
11:40:11 | * | vsantana quit (Quit: Leaving.) |
11:40:18 | * | kiwi_835 joined #nim |
11:40:33 | * | vsantana joined #nim |
11:41:07 | * | kiwi_835 quit (Client Quit) |
11:41:27 | kiwi_83 | thanks @exelotl that clears it up |
11:42:17 | kiwi_83 | anyone know if the exercism nim track mentors are checking solutions? |
11:42:29 | kiwi_83 | I am unable to progress because no response from mentors :( |
11:42:45 | * | vsantana quit (Read error: Connection reset by peer) |
11:42:51 | PMunch | kiwi_83, probably no-one has been active |
11:42:56 | PMunch | I'll log on and have a look .) |
11:43:18 | kiwi_83 | thanks PMunch but only if you're not busy...wouldn't want to interrupt what youre doiing |
11:43:58 | kiwi_83 | can someone give me rule of thumb on when to use Distinct Types? |
11:44:15 | kiwi_83 | seems useful having to force type conversion but not sure when it will come in handy |
11:44:38 | * | vsantana joined #nim |
11:45:10 | FromDiscord | <lqdev> one example is units |
11:45:21 | FromDiscord | <lqdev> you can do `type Degrees = distinct float` and `type Radians = distinct float` |
11:45:23 | PMunch | In general most people tend to use them when you need to be absolutely sure you don't mix types, or as you say if you want to have automatic type conversions |
11:45:36 | FromDiscord | <lqdev> yeah |
11:45:54 | * | vsantana quit (Client Quit) |
11:50:28 | kiwi_83 | ohhh i see |
11:50:38 | kiwi_83 | so it prevents this type of implicit coercion? https://play.nim-lang.org/#ix=2G1b |
11:50:53 | FromDiscord | <lqdev> yes |
11:53:47 | * | bung joined #nim |
11:55:52 | * | krux02 joined #nim |
11:56:04 | PMunch | kiwi_83, what's your nick on exercism? |
11:58:18 | * | bung quit (Ping timeout: 265 seconds) |
11:59:20 | PMunch | Feel free to PM it to me if you don't want to share it here |
12:01:29 | * | bung joined #nim |
12:02:03 | * | vsantana joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:36 | * | supakeen joined #nim |
12:08:15 | * | krux02 quit (Remote host closed the connection) |
12:09:46 | kiwi_83 | pm'ed |
12:10:00 | kiwi_83 | I like the block break from loops; which other languages have this? |
12:10:14 | kiwi_83 | afaik you have to 'break' out of each loop separately |
12:10:19 | kiwi_83 | no jumping |
12:10:27 | kiwi_83 | i hope i make sense |
12:10:36 | * | bung quit (Ping timeout: 240 seconds) |
12:11:48 | PMunch | Well in C you can use jump |
12:11:56 | PMunch | Like goto |
12:12:39 | PMunch | But yeah, most languages have to use something like a variable declared outside the loops and then check against that in all the loops. |
12:12:55 | * | bung joined #nim |
12:16:37 | FromDiscord | <exelotl> It's a little known feature of JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label |
12:17:54 | kiwi_83 | oh wow, TIL |
12:19:19 | FromDiscord | <exelotl> haha, I think I used it once in my 2 years of writing mobile games in JS ๐
|
12:19:35 | PMunch | Huh, TIL indeed |
12:29:05 | * | vsantana quit (Quit: Leaving.) |
12:32:49 | FromDiscord | <mixbot> tnx I have setup nim with geany successfully |
12:35:30 | FromDiscord | <exelotl> nice! :) |
12:41:32 | FromDiscord | <mixbot> can nim just compile to the pure machine code without using gcc? |
12:42:31 | FromDiscord | <Imperatorn> @mixbot wdym, without compiling? ๐ค |
12:42:32 | Clonkk[m] | The closest thing I know of is nlvm |
12:42:41 | Clonkk[m] | Which used llvm to generate machine code |
12:43:02 | * | habamax_ joined #nim |
12:43:30 | * | habamax_ left #nim (#nim) |
12:44:15 | FromDiscord | <mixbot> btw rust does use llvm, r8? why choose llvm as backend? |
12:44:52 | * | hmmmmm quit (Remote host closed the connection) |
12:44:54 | FromDiscord | <mixbot> is there any chance that nim will adopt nlvm in future? |
12:46:03 | PMunch | Define adopt |
12:46:14 | PMunch | Move away from C compilers? Probably not |
12:46:30 | PMunch | Not that I see why we'd want to |
12:46:49 | FromDiscord | <mixbot> yea I meant shifting from gcc to nlvm |
12:47:18 | FromDiscord | <Cloufish> A silly question from a complete novice that is interested in nim: Can you use python libraries inside in nim lang? |
12:47:34 | FromDiscord | <Cloufish> (edit) "inside" => "" |
12:48:12 | * | Kaivo quit (Quit: WeeChat 2.9) |
12:48:39 | FromDiscord | <mixbot> I also think, because crystal has llvm backend but has no support for windows. and it compiles veey slow |
12:49:36 | PMunch | @Cloufish, have a look at nimpy and nimporter |
12:50:01 | FromDiscord | <flywind> Also you could look at this tutorial https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
12:50:09 | FromDiscord | <mixbot> but I am kind of curious over a statement about nim that I encounter many times that is "performance of nim is very close to c/c++" what does it mean??? |
12:50:37 | * | bung quit (Ping timeout: 264 seconds) |
12:51:08 | PMunch | @mixbot, but why would we want to? Using a C compiler (you can use other ones than GCC) gives you great C interop, and all the years of optimisations that has gone into C, not to mention the incredible platform support |
12:51:32 | PMunch | @mixbot, well it means pretty much what it says. If you write a program in Nim, or in C/C++ they will perform about the same |
12:57:10 | FromDiscord | <exelotl> Nim(rod) originally caught my attention specifically because it compiles to C/C++ |
12:57:19 | FromDiscord | <exelotl> it's such a brilliant idea and so few langs do it |
12:57:43 | FromDiscord | <mixbot> sent a long message, see http://ix.io/2G1B |
12:58:10 | FromDiscord | <Quibono> Kinda wish it was still called Nimrod |
12:59:09 | FromDiscord | <mixbot> it is indeed a good idea. What other languages do the same?? |
12:59:34 | FromDiscord | <Quibono> Mixbot thatโs kind of like saying โIsnโt Cโs performance really assemblyโs performanceโ |
12:59:54 | PMunch | Ah, Nim actually compiles to C, you can't go back from C to Nim code, partially because Nim has the powerful macro system |
13:00:10 | PMunch | But yes, Nim code -> C code -> binary |
13:00:33 | PMunch | Well it's not redundant, it is easy to write a language that compiles to extremely inefficient C code |
13:00:47 | PMunch | Nim in most cases maps to very efficient C code |
13:02:35 | FromDiscord | <mixbot> okay I understood it. then I have another question for you. That is, is it essential to have gcc to run a nim code? |
13:03:26 | FromDiscord | <exelotl> > What other languages do the same??โตI was previously using a language called "ooc" which did the same, but it's abandoned now.โตHaxe compiles to C++, JS and others, though I believe it's heavier than Nim (not suitable for embedded devlopment etc.) |
13:03:27 | PMunch | Well you need some kind of C compiler to compile C code, but to run the resulting binary you don't need one. |
13:03:52 | PMunch | (And again, you don't need GCC, pretty much any C compiler will do) |
13:05:15 | FromDiscord | <mixbot> Thanks for the info... |
13:05:33 | Clonkk[m] | You can compile Nim using as well clang |
13:05:44 | Clonkk[m] | * You can compile Nim using clang as well |
13:06:04 | * | DrWhax joined #nim |
13:06:18 | FromDiscord | <exelotl> Unity has some magic to compile C# to C++ for better performance. Likewise, Game Maker language also compiles to C++. But they are both closed source / proprietary solutions. |
13:06:25 | kiwi_83 | maybe offtopic but why name change from nimrod to nim? |
13:06:41 | FromDiscord | <flywind> `cython` compiles python like syntax to C. |
13:06:42 | FromDiscord | <Clyybber> Nim is shorter, more memorable |
13:07:13 | kiwi_83 | +1 makes sense |
13:08:31 | FromDiscord | <mixbot> is that true, nim was created for game development at first? |
13:09:26 | FromDiscord | <flywind> http://157.245.209.254/andreas-rumpf-on-creating-and-growing-nim/#why-did-you-start-nim |
13:10:14 | kiwi_83 | nim has a lot of interesting ideas and feels a bit more liberating to use (doesn't feel limited when programming) so I really hope it becomes the next python |
13:10:43 | FromDiscord | <exelotl> that article is really good |
13:11:11 | kiwi_83 | curious who the other 2 full time programmers working on nim are |
13:12:52 | FromDiscord | <mixbot> what is the USP for nim? As rust has one "Fearless Concurrency" or "No GC" |
13:17:09 | FromDiscord | <Idefau> "being epic" |
13:17:21 | * | bung joined #nim |
13:17:48 | FromDiscord | <haxscramper> I don't think there is official USP, but to me it has always been convenience-orientation. There is no ideology that you are advised to follow, and instead you can just code things |
13:17:54 | Clonkk[m] | <kiwi_83 "nim has a lot of interesting ide"> I know you mean well :), but thinking of Nim as "a better python" is a bad way to look at things. Beside, identation syntax Nim is not close to Python. Thinking in Nim feels very similar to C / C++ / Ada |
13:18:21 | Clonkk[m] | At least from my personal experience |
13:18:30 | FromDiscord | <haxscramper> Like eveything is optional and you can do OOP/FP/pure procedural etc. just as easily |
13:18:45 | FromDiscord | <flywind> The comment is very suitable to describe the advantage of Nim: https://old.reddit.com/r/programming/comments/jc91xp/nim_14/g90vg0j/ |
13:18:53 | FromDiscord | <haxscramper> But metaprogramming of this level is really uncommon. |
13:19:11 | FromDiscord | <haxscramper> My personal opinion is that nim beats even lisp family and by a large margin |
13:20:51 | Clonkk[m] | Maybe OCaml would come close ? |
13:21:06 | Clonkk[m] | Haven't used OCaml that much but I know it is quite powerful |
13:21:55 | kiwi_83 | Clonkk[m] oh i shouldve clarified. I meant in terms of popularity |
13:22:37 | FromDiscord | <haxscramper> It like, Perl has "there is more one to do this", Python "there should be one way to do this", and in nim it is "do it however you like" |
13:22:37 | kiwi_83 | what does sigil mean in that context flywin |
13:24:23 | FromDiscord | <haxscramper> I haven't used Ocaml metaprogramming either, but this is a first time I hear ocaml has good metaprogramming capabilities. Will look into it, thanks |
13:24:29 | * | habamax quit (Quit: leaving) |
13:24:33 | FromDiscord | <mixbot> my friend says perl is like regex, dont know what he meant though |
13:24:47 | * | habamax joined #nim |
13:25:51 | FromDiscord | <haxscramper> You can condense really complex text-processing logic in very few absolutely unreadable statements |
13:26:55 | PMunch | kiwi_83, there is actually a longer answer to the Nimrod -> Nim change, it's pretty fascinating |
13:26:57 | FromDiscord | <mixbot> Ocaml has been a major influence to rust i guess... |
13:27:14 | FromDiscord | <mixbot> tell us the story then |
13:31:01 | Clonkk[m] | <FromDiscord "<haxscramper> I haven't used Oca"> OCaml can have pre processor extensions which modify the AST before the compiler parse it. |
13:32:39 | FromDiscord | <haxscramper> Oh, well, this is not really a metaprogramming "in the language". Technically yes, but you need to write preprocessor extension and then use when compiling your code, and this is really bothersome |
13:32:39 | * | lritter joined #nim |
13:32:49 | Clonkk[m] | > <@freenode_FromDiscord:matrix.org> <haxscramper> I haven't used Ocaml metaprogramming either, but this is a first time I hear ocaml has good metaprogramming capabilities. Will look into it, thanks |
13:32:49 | Clonkk[m] | * OCaml can have pre processor extensions which modify the AST before the compiler parse it. It's called PPX (PreProcesor eXtension). That said, I've only used superfically (and it was a few years ago) so I'm not an expert by any means. |
13:32:53 | FromDiscord | <haxscramper> But this might count as metaprogramming techincally |
13:33:51 | kiwi_83 | PMunch any link for that? im curious |
13:33:58 | PMunch | Nim was originally called Nimrod after the king of Babel from the stories (which of is why Nim's logo is a crown. There is of course an even longer story for how the name came about). Nimrod the king is known as the great hunter king, and also the king that reigned during the building of the tower of Babel. The problem is that Bugs Bunny the cartoon has an episode in which Bugs sarcastically calls Elmer (which is trying to hunt him) for Nimrod. |
13:33:58 | PMunch | Unfortunately no-one in the US took the reference, and to this day a nimrod is synonymous to an idiot in the US. This isn't something you would know if you aren't from the US or have picked this up elsewhere, so Ar4q didn't think anything of it when he named the language Nimrod. But as more users came to the question about this was raised and the language finally changed name to Nim to avoid association with idiots. |
13:34:18 | PMunch | Oh wow, that was quite a bit longer than I expected :P |
13:34:46 | kiwi_83 | ohhh wow! that is even more satisfying to read haha |
13:35:26 | Clonkk[m] | <PMunch "Nim was originally called Nimrod"> So when is the next Nim-trivia night :D ? |
13:36:15 | PMunch | Haha, not sure what other trivia we have :P |
13:39:42 | FromDiscord | <Quibono> PMunch knowing the story of nimrod and bugs bunny, I still wish it was Nimrod. Biblical best hunter is cooler than whatever Nim is |
13:40:08 | PMunch | Well I like Nim, it has some story to it now :) |
13:40:26 | PMunch | And it allows us to call ourselves Nimrods when using Nim :P |
13:43:31 | Clonkk[m] | It also allows us to call ourselves Bunnies to confuse Americans :D |
13:51:53 | FromDiscord | <alehander42> the whole naming story is more nuanced than it seems biblically imo , but this is another discussion |
13:51:55 | FromDiscord | <alehander42> ๐ |
13:52:17 | FromDiscord | <alehander42> btw i started looking at greek / koine greek |
13:52:27 | FromDiscord | <alehander42> and it seems pretty cool ฮบฮฑฮปฮนฮผฮตฯฮฑ |
13:52:37 | FromDiscord | <alehander42> did we have greek ppl |
13:54:13 | * | lritter quit (Ping timeout: 264 seconds) |
13:54:24 | * | Kaivo joined #nim |
13:58:54 | * | lritter joined #nim |
14:07:16 | * | bung quit (Ping timeout: 240 seconds) |
14:07:51 | kiwi_83 | im about as greek as eating greek salad goes. that counts? ;) |
14:19:29 | * | bung joined #nim |
14:22:25 | FromDiscord | <Idefau> i want to learn greek |
14:28:59 | FromDiscord | <reilly> Follow-up from yesterday. I can't use Karax because my application needs multiple pages, and I need to make use of Jester's routes. Can I just `resp` an html file? |
14:29:29 | PMunch | Yup |
14:29:39 | PMunch | Or you can resp multiple karax pages |
14:29:46 | PMunch | Or anything else really |
14:31:17 | FromDiscord | <๐๐๐ฎ๐ฟ> Ist here a way to connect nim with rust lang |
14:31:22 | FromDiscord | <๐๐๐ฎ๐ฟ> (edit) "Ist here" => "Is there" |
14:32:29 | * | habamax_ joined #nim |
14:32:40 | mipri | they can both compile to the C ABI, and they both have an FFI for that, and they both can make static and shared libraries. So use one or the other as if it were a C library. |
14:32:41 | * | habamax_ left #nim (#nim) |
14:36:35 | FromDiscord | <reilly> How can I do that? My first guess was to read the file as a string `let index = readFile("html/index.html")` then just `resp index` in my `"/"` route, but that gives me "template/generic instantiation of `routes` from here" on my line with `routes:`. |
14:40:16 | * | narimiran joined #nim |
14:42:20 | avass | is there any good way of getting around '... is not gc-safe as it accesses ... which is a global ...' for dependencies? |
14:47:21 | * | habamax quit (Quit: leaving) |
14:47:28 | * | bung quit (Ping timeout: 265 seconds) |
14:47:38 | * | habamax joined #nim |
14:48:56 | * | habamax_ joined #nim |
14:50:44 | * | grorkster joined #nim |
14:51:50 | PMunch | By not doing that? |
14:51:57 | PMunch | Or using --gc:arc |
14:53:20 | avass | well then I'd need to fix the library, I might need to read up on the difference between --gc:boehm and --gc:arc |
14:55:01 | FromDiscord | <Imperatorn> I'm a nimrod. Feels good to say |
14:56:49 | * | grorkster left #nim ("Leaving") |
14:58:34 | avass | I guess there's no way to {.threadvar.} an entire library :) |
15:00:17 | * | vicfred joined #nim |
15:03:25 | FromDiscord | <Zachary Carter> You use `threadvar` where otherwise you'd use thread local storage |
15:03:33 | FromDiscord | <Zachary Carter> if you were writing C for instance |
15:04:00 | avass | yeah but the global variable is defined in a library |
15:04:06 | FromDiscord | <Zachary Carter> I'm guessing you can store the result of a call to `dlopen` or `loadSymbol` in a `threadvar` |
15:04:34 | avass | (not my library) |
15:05:08 | FromDiscord | <Zachary Carter> I'm not really sure what you're trying to do so I can't really comment further |
15:05:52 | * | PMunch quit (Quit: leaving) |
15:06:42 | avass | Trying to render the tui with illwill (https://github.com/johnnovak/illwill) in a separate thread, but that uses a global to store the state of the previous buffer which causes nim to complain |
15:07:19 | avass | more specifically this variable when calling display: https://github.com/johnnovak/illwill/blob/master/illwill.nim#L1106 |
15:07:58 | Clonkk[m] | <avass "Trying to render the tui with il"> Eh, you could try using Atomic ? |
15:08:27 | FromDiscord | <reilly> I was going through literally this exact same thing a while back. If I remember correctly, you can mark your illwill thread as {.gcsafe.} and it will be ignored. |
15:08:30 | avass | Clonkk[m]: Atomic? |
15:08:42 | avass | hmm thought I tried that |
15:09:13 | Clonkk[m] | https://nim-lang.org/docs/atomics.html#Atomic |
15:09:20 | FromDiscord | <reilly> Maybe there was something else to it, it was long ago enough that I can't remember exactly. Sounds about right to me. |
15:09:34 | FromDiscord | <Zachary Carter> `gPrevTerminalBuffer` isn't exported so how are you going to access it |
15:10:10 | avass | I'm not, I'm calling a function which modifies it's state |
15:10:29 | avass | https://github.com/johnnovak/illwill/blob/master/illwill.nim#L1210 |
15:11:07 | FromDiscord | <Zachary Carter> if you use `gc:arc` this shouldn't be an issue |
15:11:15 | avass | it didn't change anything |
15:12:21 | FromDiscord | <Zachary Carter> what verison of Nim are you using? stable? |
15:12:59 | avass | yeah |
15:13:22 | FromDiscord | <Zachary Carter> hmm - well that module would also have to be compiled with `--gc:arc` |
15:13:46 | * | bung joined #nim |
15:13:51 | * | kiwi_83 quit (Quit: Connection closed) |
15:14:03 | FromDiscord | <Zachary Carter> but assuming it is - it's strange it's not working |
15:14:07 | FromDiscord | <Zachary Carter> do you have any code to share? |
15:14:24 | avass | I think this is the current state https://github.com/albinvass/hatty/pull/10 |
15:14:26 | disbot | โฅ Separate requests into own thread |
15:14:33 | FromDiscord | <Zachary Carter> thanks let me take a look |
15:14:51 | avass | very much WIP :) |
15:15:04 | FromDiscord | <Zachary Carter> yeah no worries, no judgement here ๐ |
15:17:28 | FromDiscord | <Zachary Carter> okay I have it running with that branch checked out - do I need to do anything to reproduce the error? |
15:18:20 | FromDiscord | <Zachary Carter> https://media.discordapp.net/attachments/371759389889003532/782988893548183552/Screen_Shot_2020-11-30_at_10.18.01_AM.png |
15:18:24 | * | bung quit (Ping timeout: 265 seconds) |
15:18:35 | avass | It should probably be enough to remove the --threadAnalysis:off in nim.cfg |
15:18:45 | FromDiscord | <Zachary Carter> okay |
15:19:26 | avass | oh I think it might complain about the 'refresh' thread, but just remove that or comment it out or something |
15:19:46 | avass | s/thread/proc |
15:20:01 | * | waleee-cl joined #nim |
15:27:56 | FromDiscord | <Zachary Carter> Yeah - this one is a little complex because you're using `asyncdispatch` and `addCallback`... I know that Nim's async implementation requires `--gc:orc` first of all, because of cyclic data structures in its implementation (at least I believe that's still the case) |
15:28:02 | FromDiscord | <shadow.> how do you pass types to a generic call with `macros` `newCall`? |
15:28:15 | FromDiscord | <shadow.> like if i wanted to call `initTable[type, type]()` with `newCall` |
15:28:52 | FromDiscord | <Zachary Carter> but ultimately, as you've figured out, you're running into an issue where you're required to pass a function pointer that is GC safe to another procedure, and you're function isn't gcsafe because it mutates a global |
15:29:22 | avass | zachary: yeah, the requests is supposed to be reworked so that's not the main issue |
15:29:37 | * | habamax_ quit (Quit: leaving) |
15:32:06 | FromDiscord | <shadow.> ah ok so i think i need a bracket expression |
15:32:13 | FromDiscord | <shadow.> is there a proc to make a new bracket expression in macros? |
15:32:42 | FromDiscord | <Zachary Carter> you just create a new bracket expression node |
15:33:07 | FromDiscord | <shadow.> with newNimNode? |
15:33:12 | FromDiscord | <Zachary Carter> yeah you can do it that way |
15:33:23 | FromDiscord | <shadow.> kk |
15:33:36 | FromDiscord | <shadow.> ah right ive never really understood how do i add information to that node if i make it with newNimMode? |
15:33:40 | FromDiscord | <shadow.> like the types im passing |
15:34:16 | FromDiscord | <reilly> I still don't know how to `resp` an html document in Jester. If I can do that, I should be good to go. |
15:35:33 | FromDiscord | <reilly> Karax is not an option, by the way. |
15:35:44 | * | bung joined #nim |
15:36:38 | avass | zachary: I'll take it that the fix is: "Fork the library and push fix upstream" :) |
15:36:48 | FromDiscord | <Zachary Carter> avass: okay so the problem you're trying to solve is calling `display` from another thread |
15:37:00 | avass | yeah |
15:37:05 | avass | or not another thread |
15:37:20 | avass | it's supposed to only be used in a single thread unless I missed removing something |
15:37:24 | FromDiscord | <Zachary Carter> well - I just want to create a minimal reproducible example and then see if I can figure out a solution without you having to do that |
15:37:35 | FromDiscord | <Zachary Carter> hmm |
15:38:06 | FromDiscord | <Zachary Carter> no - you didn't, it doesn't look like you're calling `newThread` anywhere |
15:38:34 | avass | huh? |
15:38:55 | avass | oh sorry, got it |
15:39:45 | bung | @araq when you mark PR suggestions to resolved what I need to do ? |
15:40:25 | bung | right now I want take that suggestions |
15:41:38 | narimiran | bung: he has already commited that suggestion |
15:41:48 | Zevv | Araq: you here |
15:41:58 | bung | so he can merge PR with suggestions ? |
15:42:17 | narimiran | bung: yes, look at the PR page, you can see "Update lib/pure/strutils.nim" commit |
15:42:55 | bung | I thought suggestions need the PR author to commit, ok get new knowlege. |
15:43:30 | narimiran | bung: check https://github.com/nim-lang/Nim/pull/16193/files to see the latest changes from the PR - it is already incorporated there |
15:43:32 | disbot | โฅ toXXAscii use xor op, saving 30%~50% time ; snippet at 12https://play.nim-lang.org/#ix=2G2L |
15:45:34 | bung | oh ,that's behavior like someone can commits code to my branch.. |
15:45:50 | narimiran | bung: btw, i don't understand why you prefer cast in those examples? |
15:46:15 | FromDiscord | <shadow.> hmm |
15:46:46 | bung | well , char unit8 convert is fine , but other type like int to uint convert are different thing right ? |
15:47:15 | FromDiscord | <shadow.> how can i do the `[]=` operator with infix? |
15:47:39 | Zevv | how do you mena? |
15:47:44 | bung | when I write that code in my mind I dont want convert A type to different B type |
15:47:45 | Zevv | what should that look like? |
15:47:53 | FromDiscord | <shadow.> wait lemme check the dumptree nvm |
15:50:45 | * | rockcavera joined #nim |
15:52:17 | * | hnOsmium0001 joined #nim |
15:54:11 | FromDiscord | <reilly> I'm losing my mind here, please tell me why this throws an error (https://hastebin.com/uhejadeyab.nim) yet replacing `index` with `"<h1>Hello, world</h1>"` works just fine. |
15:54:25 | bung | narimiran does that explanation sound make sense ? |
15:55:19 | FromDiscord | <reilly> No, nevermind, it works, but Nimsuggest is complaining anyway. |
15:55:26 | bung | they all give that down vote, suprise me. |
15:55:53 | FromDiscord | <Clyybber> bung: Don't worry about it :) |
15:56:00 | FromDiscord | <Clyybber> but yeah the no cast way is better |
15:56:32 | FromDiscord | <Clyybber> bung: conversion from uint8 to char and back doesn't introduce any unneccessary checks so its fine for performance too |
15:57:02 | FromDiscord | <Clyybber> And after all nim's cast isn't really a "reinterpreting" cast either, since its not an lvalue |
15:58:00 | * | vicfred quit (Quit: Leaving) |
15:58:25 | bung | I've seen jsgen that convert doing more work |
15:58:58 | * | vicfred joined #nim |
16:05:05 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2G2U |
16:06:12 | FromDiscord | <fwsgonzo> (edit) "https://play.nim-lang.org/#ix=2G2U" => "https://play.nim-lang.org/#ix=2G2W" |
16:07:38 | FromGitter | <HJarausch_gitlab> Thanks! โ int <> cint Is there a way out? โ I try to use the ncurses library which interfaces directly to the dynamic system library. It defines many parameters like lengths, positions, etc of type *cint*. โ When I try to call these with expressions like *i-line_start+1* I always get compiler errors since *i, line_start* etc are just ints. โ Do I have to declare all variable as *cint* or is there a |
16:07:38 | FromGitter | ... nicer way out. ... [https://gitter.im/nim-lang/Nim?at=5fc518ca9cdc3e0d754e8667] |
16:09:04 | FromGitter | <iffy> How do I tell `ndb` to use a different sqlite3 dylib on macOS? https://github.com/xzfc/ndb.nim It keeps using v3.24.0 but I want to use /usr/local/Cellar/sqlite/3.33.0/lib/ |
16:10:32 | FromGitter | <iffy> I just realized that might not be a nim question... |
16:15:29 | FromGitter | <bung87> why not just convert your operands to cint ? |
16:17:29 | FromDiscord | <flywind> !eval for i in high(int64) .. high(int64): discard |
16:17:32 | NimBot | /playground/nim/lib/system/iterators_1.nim(97) inโต/playground/nim/lib/system/fatal.nim(49) sysFatalโตError: unhandled exception: over- or underflow [OverflowDefect] |
16:18:14 | FromDiscord | <๐๐๐ฎ๐ฟ> Is there a way to execute nim from rust |
16:18:16 | FromDiscord | <๐๐๐ฎ๐ฟ> https://developers.redhat.com/blog/2017/11/16/speed-python-using-rust/ |
16:18:28 | FromDiscord | <๐๐๐ฎ๐ฟ> Like that or smth sinilar |
16:18:43 | FromDiscord | <๐๐๐ฎ๐ฟ> (edit) "execute" => "use" | "from" => "with" |
16:19:11 | mipri | they can both compile to the C ABI, and they both have an FFI for that, and they both can make static and shared libraries. So use one or the other as if it were a C library. |
16:20:24 | FromDiscord | <flywind> !eval for i in high(int32) .. high(int32): discard |
16:20:26 | NimBot | /playground/nim/lib/system/iterators_1.nim(97) inโต/playground/nim/lib/system/fatal.nim(49) sysFatalโตError: unhandled exception: over- or underflow [OverflowDefect] |
16:20:33 | FromDiscord | <flywind> !eval for i in high(int16) .. high(int16): discard |
16:20:35 | NimBot | <no output> |
16:20:55 | bung | !eval for i in 1 .. 1 :discard |
16:20:57 | NimBot | <no output> |
16:22:49 | FromDiscord | <Zachary Carter> avass: I went ahead and reduced your example to only the code that messes with the TUI thread. I checked out `illwill` and made the three or four global vars, threadvars. This fixed all the issues with gc safety in your code - so I would recommend just issuing a PR to do that |
16:23:11 | FromDiscord | <Zachary Carter> I'm not sure why you want a terminal buffer per thread, but that's another issue ๐ |
16:24:45 | FromDiscord | <fwsgonzo> how do you convert a json object to a string? |
16:25:23 | FromDiscord | <fwsgonzo> looks like the pretty function ๐ |
16:26:29 | FromDiscord | <๐๐๐ฎ๐ฟ> How do u compile it to c? |
16:29:55 | FromDiscord | <lqdev> @HJarausch_gitlab use x.cint to convert x to a cint, or x.int to convert x to an int |
16:30:17 | FromDiscord | <lqdev> this works with any primitive type |
16:30:19 | avass | zachary: yep that was my initial idea as well, but I thought I'd check to see if there's a better way to handle it without needing to push something upstream :) |
16:30:20 | FromGitter | <bung87> just $yourObj |
16:30:26 | avass | thanks anyway! |
16:31:02 | FromGitter | <HJarausch_gitlab> @Bung I had hoped for an automatic conversion plus something for let all *ints* be of type *int32*. I don't "long int" anywhere. |
16:31:03 | FromDiscord | <Zachary Carter> No problem - sorry I don't think there is. |
16:31:28 | FromDiscord | <lqdev> nim is not C |
16:31:49 | FromDiscord | <lqdev> cint is potentially smaller than an int and all narrowing conversions are disallowed |
16:31:59 | FromDiscord | <Zachary Carter> `cint = int32` |
16:32:04 | FromDiscord | <lqdev> precisely |
16:32:06 | FromDiscord | <Zachary Carter> alwys |
16:32:09 | FromDiscord | <๐๐๐ฎ๐ฟ> How so |
16:32:12 | FromDiscord | <Zachary Carter> (edit) "alwys" => "always" |
16:32:38 | FromGitter | <HJarausch_gitlab> Therefore I'd like to set "standard" int to int32 in my code. |
16:32:44 | FromDiscord | <lqdev> but int may be int8, int16, int32 or int64 depending on your arch |
16:32:52 | narimiran | write nim in nim. |
16:32:53 | FromDiscord | <Zachary Carter> IMO just don't use `cint` use `int32` |
16:32:58 | FromDiscord | <lqdev> just use int always |
16:33:05 | FromGitter | <bung87> write a convert toCint(v:int) = v.cint ? |
16:33:15 | FromDiscord | <lqdev> unless you need super fast performance or are tight on memory |
16:33:22 | FromDiscord | <Zachary Carter> well if you're interoping with c code |
16:33:26 | FromDiscord | <Zachary Carter> or C++ |
16:33:26 | FromDiscord | <lqdev> or that |
16:33:48 | FromDiscord | <Zachary Carter> my point there is - don't use `cint` it's just confusing and at the end of the day, an alias |
16:33:55 | FromDiscord | <Zachary Carter> be specific and use `int32` if you need a 32 bit signed integer |
16:33:57 | FromGitter | <bung87> that need export that `convertor` everywhere |
16:34:58 | FromDiscord | <Giamby> Is there any way I can pass a reference to a `seq[ptr myObject]` to an object constructor so that if other pieces of code change that variable such changes reflect immediately everywhere? |
16:34:58 | FromDiscord | <Zachary Carter> I think `cstring` is fine because most people understand that C doesn't have Nim strings so this a type to specifically address that |
16:35:02 | FromGitter | <HJarausch_gitlab> @Bung Thanks, I'll try that. Isn't there something like a pragma to tell the compiler that I want *int32* as standard *int* on my 64bits architecture. |
16:35:06 | FromDiscord | <Giamby> Basically I need to pass by reference rather than by value |
16:35:32 | FromDiscord | <lqdev> @Giamby nope |
16:35:36 | FromDiscord | <Zachary Carter> you can use a `ptr` |
16:35:40 | FromDiscord | <Zachary Carter> or box your seq |
16:35:43 | FromDiscord | <lqdev> you can store your seq in a ref object |
16:35:50 | FromDiscord | <Zachary Carter> or that |
16:35:55 | FromDiscord | <InventorMatt> if you only want to access nim code from rust then you can check out this https://gradha.github.io/articles/2015/01/writing-c-libraries-with-nim.html for how to make a nim library into a c library |
16:36:03 | FromDiscord | <Giamby> yeah but then I'll have to dereference every time |
16:36:04 | FromGitter | <bung87> I dont think so these type design to match machine arch |
16:36:07 | FromDiscord | <Giamby> that's messy ๐ฆ |
16:36:20 | FromDiscord | <lqdev> seqs inherently have value semantics |
16:36:27 | FromDiscord | <Giamby> bummer |
16:36:31 | FromDiscord | <Zachary Carter> not if you use a `var seq` |
16:36:33 | FromDiscord | <lqdev> you can make your enclosing object ref and pass that around |
16:36:50 | FromDiscord | <Giamby> that would add an unneeded layer of indirection tho |
16:37:02 | FromDiscord | <Giamby> is that so? let me give it a try ๐ |
16:37:27 | FromDiscord | <Zachary Carter> just make the proc accesspting the seq take a `var seq[T]` as an argument instead of a `seq[T]` |
16:37:38 | FromDiscord | <lqdev> you can't store a var seq in an object |
16:37:55 | FromDiscord | <lqdev> unless you use EXPERIMENTAL!!! view types |
16:38:12 | FromDiscord | <Zachary Carter> yeah - this only works for passing a `seq` to a proc |
16:38:15 | FromDiscord | <lqdev> i shouted that out because in practice they barely work, but that's what makes them experimental |
16:39:42 | FromDiscord | <Giamby> yeaah that does not quite work |
16:39:57 | FromDiscord | <Giamby> `The VM:ObjectType type requires the following fields to be initialized: stack.`, but i I inizialize it other weird stuff happens |
16:40:14 | FromDiscord | <Giamby> so I guess my last chance is a ref seq |
16:40:34 | FromDiscord | <Zachary Carter> yeah - would need to see some example code |
16:42:11 | FromDiscord | <Giamby> it's a huge project, hard to take a small piece without making it useless |
16:42:30 | FromDiscord | <Giamby> I'll resort to using `self.stack[].stuff()` |
16:42:57 | FromDiscord | <Giamby> or maybe not, what was the pragma to automatically dereference the first parameter passed to a proc? |
16:45:48 | FromDiscord | <Zachary Carter> `{.experimental: "implicitDeref".}` |
16:46:09 | FromDiscord | <Giamby> it seems like everything is working ๐ |
16:46:21 | FromDiscord | <Giamby> nice to notice that weeks and weeks of debugging were basically useless |
16:46:39 | FromDiscord | <Giamby> note-to-self: ALWAYS check value vs ref semantics before anything else, lol |
16:48:09 | FromDiscord | <Zachary Carter> yeah - those are good to understand |
16:48:20 | FromDiscord | <Avatarfighter> Hello hello everyone |
16:48:44 | FromDiscord | <Zachary Carter> and seqs and strings can be confusing |
16:48:51 | FromDiscord | <Zachary Carter> o/ @Avatarfighter |
16:50:44 | FromDiscord | <Giamby> the funniest part of all that |
16:51:00 | FromDiscord | <Giamby> is that literally changing 2 lines resolved weeks of debugging |
16:51:23 | FromDiscord | <Giamby> it's incredible how a tiny little error can destroy a 2k+ lines codebase, now I wanna die ๐ |
16:55:39 | FromDiscord | <Zachary Carter> I mean I've spent weeks debugging a `+` vs a `-` |
16:55:50 | FromDiscord | <Zachary Carter> it happens |
16:56:07 | FromDiscord | <Zachary Carter> or maybe it was a ` -1` I don't remember |
16:56:11 | FromDiscord | <lqdev> @Giamby if i were you i'd just make VM a ref object and forget about it |
16:57:26 | FromDiscord | <shadow.> is it possible to do this with a `quote do:`? |
16:57:32 | FromDiscord | <shadow.> sent a code paste, see https://play.nim-lang.org/#ix=2G3b |
16:57:40 | FromDiscord | <shadow.> if i use a quote do to add then later on fStringResult is an unidentified identifier |
16:57:46 | FromDiscord | <shadow.> (edit) "add" => "add," |
16:58:17 | FromDiscord | <๐๐๐ฎ๐ฟ> sent a code paste, see https://play.nim-lang.org/#ix=2G3c |
16:58:23 | FromDiscord | <๐๐๐ฎ๐ฟ> (edit) |
16:58:41 | FromDiscord | <shadow.> have you checked your compile cache? |
16:59:17 | FromDiscord | <Recruit_main707> nim c --nimcache:,/cache test.nim |
16:59:26 | FromDiscord | <Recruit_main707> ./ not ,/ |
16:59:44 | FromDiscord | <lqdev> @shadow. yes. you need to declare `let fStringResult = ident"fStringResult"` outside of the quote do: block and then use that |
16:59:53 | FromDiscord | <lqdev> because quote do genSyms all identifiers |
17:00:00 | FromDiscord | <shadow.> ohhhh ok lemme try that ty |
17:00:30 | FromDiscord | <Giamby> the VM _is_ a ref object |
17:00:37 | FromDiscord | <lqdev> oh |
17:00:48 | FromDiscord | <lqdev> soโฆ store the seq there and just access it? |
17:01:18 | FromDiscord | <Giamby> I tried and the seq wouldn't get updated whenever my vm pushed and popped to it |
17:01:22 | FromDiscord | <๐๐๐ฎ๐ฟ> Nd what would be the main C file |
17:01:24 | FromDiscord | <lqdev> i usually structure my VMs to not have a stack stored inside of an object :p |
17:01:25 | FromDiscord | <Giamby> not inside my custom object |
17:01:32 | FromDiscord | <lqdev> just as a local variable in `interpret()` or whatever |
17:01:43 | FromDiscord | <Giamby> how would you make call frames work |
17:01:43 | FromDiscord | <๐๐๐ฎ๐ฟ> sent a long message, see http://ix.io/2G3e |
17:02:00 | FromDiscord | <Giamby> without storing a reference to where it starts and ends |
17:02:00 | FromDiscord | <lqdev> last time i managed to do this https://github.com/liquid600pgm/hayago/blob/master/src/hayago/private/vm.nim |
17:02:18 | FromDiscord | <lqdev> mainly to support reentrancy |
17:02:38 | FromDiscord | <lqdev> anyways, how do you initialize your stack |
17:02:43 | FromDiscord | <Giamby> so is it thread safe? |
17:02:45 | FromDiscord | <lqdev> yeah |
17:02:50 | FromDiscord | <Giamby> empty seq? xd |
17:02:56 | FromDiscord | <lqdev> no i mean |
17:02:57 | FromDiscord | <Giamby> new(seq[ptr thing]) |
17:03:01 | FromDiscord | <lqdev> hm |
17:03:18 | FromDiscord | <Giamby> before it was just self.stack = @[] |
17:03:27 | FromDiscord | <Giamby> is that vm based off craftinginterpreters? |
17:03:32 | FromDiscord | <lqdev> a bit |
17:03:34 | FromDiscord | <lqdev> but not really |
17:03:53 | FromDiscord | <lqdev> that sort of init should work |
17:04:03 | FromDiscord | <lqdev> if `self` is a ref object |
17:04:22 | FromDiscord | <Giamby> and it is |
17:04:26 | FromDiscord | <lqdev> you should be able to pass `self` around and stuff and `stack` should be shared between all the references to `self` |
17:04:33 | FromDiscord | <Giamby> idk, now it works, I need to fix recursion rn lol |
17:04:41 | FromDiscord | <lqdev> gl on your vm btw |
17:04:46 | FromDiscord | <Giamby> thx |
17:04:54 | FromDiscord | <Giamby> how feature complete is your lang btw? |
17:05:02 | FromDiscord | <๐๐๐ฎ๐ฟ> sent a long message, see http://ix.io/2G3f |
17:05:19 | FromDiscord | <Giamby> I see the vm is pretty small, mine is over 600 lines already xd |
17:05:42 | FromDiscord | <InventorMatt> @star the @mtest.nim.c would be the main c file the others are nim libraries it pulls in |
17:06:24 | FromDiscord | <lqdev> @Giamby the lang is quite feature complete except the stdlib, closures, and a bunch of features i wanted to impl like coroutines |
17:06:35 | FromDiscord | <lqdev> abandoned in favor of something simplerโฆ i got lost in type checking |
17:06:44 | FromDiscord | <Giamby> I see |
17:06:49 | FromDiscord | <Giamby> is it object oriented? |
17:06:59 | FromDiscord | <lqdev> not really, more procedural |
17:07:02 | FromDiscord | <lqdev> like nim |
17:07:15 | FromDiscord | <Giamby> Makes sense and keeps the code simple and small |
17:07:15 | FromDiscord | <lqdev> the new one i'm working on is more OO though |
17:07:28 | FromDiscord | <Giamby> I wanna implement coroutines too |
17:07:35 | FromDiscord | <Giamby> it seems quite trivial once you have generators |
17:07:53 | FromDiscord | <Giamby> and generators are basicallty functions that store a bytecode offset to the last position before yielding |
17:07:56 | FromDiscord | <Giamby> soo yeah |
17:08:01 | * | habamax quit (Quit: leaving) |
17:08:06 | FromDiscord | <Giamby> (edit) "basicallty" => "basically" |
17:08:23 | FromDiscord | <lqdev> i had a theory on how to implement coro but never got around to it D: |
17:08:36 | FromDiscord | <Giamby> My approach would be simple |
17:09:01 | FromDiscord | <Giamby> whenever you await (and therefore yield) the function returns but also store a reference to where to resume the next time you call it |
17:09:12 | FromDiscord | <Giamby> which is really what coroutines/generators are |
17:09:28 | FromDiscord | <๐๐๐ฎ๐ฟ> Oh well my gcc compiler wont find nimbase.h |
17:09:31 | FromDiscord | <๐๐๐ฎ๐ฟ> :ferrisThonk: |
17:09:32 | FromDiscord | <lqdev> yeah my approach was also storing a call stack |
17:09:48 | FromDiscord | <Giamby> I'd store just an integer |
17:09:59 | FromDiscord | <Giamby> an index in the bytecode sequence |
17:10:21 | FromDiscord | <Giamby> the stack would implicitly remain because of the way I've structured functions (as objects) |
17:10:29 | FromDiscord | <lqdev> mmkay |
17:10:42 | FromDiscord | <๐๐๐ฎ๐ฟ> Any1 wanna help? |
17:10:50 | FromDiscord | <Giamby> so the next time you resume, the function will start executing again from offset x |
17:11:01 | FromDiscord | <Giamby> where x is the instruction pointer of the last yield + 1 |
17:11:14 | FromDiscord | <๐๐๐ฎ๐ฟ> :ferrisThonk: |
17:11:36 | FromDiscord | <lqdev> cool. i'mma head back to work now, gotta get those method calls going |
17:14:37 | * | natrys joined #nim |
17:14:47 | ForumUpdaterBot | New thread by Viralpoetry: Simple way to have a dynamic shared list/sequence between threads, see https://forum.nim-lang.org/t/7176 |
17:15:28 | FromDiscord | <๐๐๐ฎ๐ฟ> Hm |
17:15:44 | FromDiscord | <InventorMatt> nimbase.h should be in your path path under the lib folder |
17:15:57 | FromDiscord | <๐๐๐ฎ๐ฟ> (edit) "Hm" => "Hm, help?" |
17:15:57 | FromDiscord | <InventorMatt> nim path |
17:16:59 | FromDiscord | <fwsgonzo> is the reasoning behind not being able to create a JSON object at compile time because of memory allocation? |
17:28:46 | bung | all ref objects maybe |
17:33:01 | FromDiscord | <๐๐๐ฎ๐ฟ> @InventorMatt wont find |
17:41:57 | FromDiscord | <InventorMatt> so you don't have nimbase.h in here nim\1.4.0\lib ? |
17:45:14 | * | bung quit (Quit: Lost terminal) |
17:52:01 | FromDiscord | <๐๐๐ฎ๐ฟ> I found tho now i get other errors |
17:52:43 | FromDiscord | <๐๐๐ฎ๐ฟ> sent a code paste, see https://play.nim-lang.org/#ix=2G3w |
17:52:53 | FromDiscord | <๐๐๐ฎ๐ฟ> sent a code paste, see https://play.nim-lang.org/#ix=2G3x |
17:54:40 | FromDiscord | <๐๐๐ฎ๐ฟ> Yikes |
17:57:10 | FromDiscord | <InventorMatt> now that I don't now how to solve. I've never attempted a c library with nim before. maybe someone that is more knowledgeable later can help. you could also try making a thread on the forum and see if you can someone there who can help |
17:58:01 | FromGitter | <deech> `./koch docs` is giving me the following error: `Error: unhandled exception: cannot open: doc/codeowners.rst [IOError]`. This is a fresh pull, should I be doing something different to generate docs, this is my first time. |
17:59:22 | * | vicfred quit (Quit: Leaving) |
17:59:58 | * | rockcavera quit (Remote host closed the connection) |
18:02:57 | FromDiscord | <Giamby> ok so I'm having a tini tiny issue here |
18:03:43 | FromDiscord | <Giamby> I've made so that all my procs now use `ref VM` rather than `var VM`, but now I'm having issues with my `initVM` procedure. When I set the fields of the object I get a NilAccessError |
18:05:23 | FromDiscord | <Giamby> sent a long message, see http://ix.io/2G3F |
18:05:47 | FromDiscord | <lqdev> you need to do `new result` at the top of your `initVM` proc |
18:05:50 | * | vsantana joined #nim |
18:06:01 | FromDiscord | <lqdev> also you said you were using a ref object alreadyโฆ |
18:06:12 | FromDiscord | <Giamby> yeah but for some reason I was not using new |
18:06:16 | FromDiscord | <Giamby> my code is probably a mess |
18:06:23 | FromDiscord | <Giamby> that's what 6 years of python do |
18:06:38 | pixtum[m] | Is work still being done on nim-lang/ui? |
18:06:49 | pixtum[m] | It says the last commit was last year |
18:07:50 | FromDiscord | <Giamby> mhh nope, same error, same line |
18:08:33 | FromDiscord | <Giamby> I hadn't felt this noob in a while lol |
18:19:15 | * | vicfred joined #nim |
18:20:08 | * | vicfred quit (Max SendQ exceeded) |
18:20:50 | * | vicfred joined #nim |
18:21:43 | * | vicfred quit (Max SendQ exceeded) |
18:22:13 | * | vicfred joined #nim |
18:26:37 | FromDiscord | <Giamby> it's weird because the object should be initialized |
18:28:48 | FromDiscord | <lander> @deech from fresh, ` ./build_all.sh && ./koch docs` should work. |
18:29:46 | FromGitter | <deech> lander: hmm that is what I'm doing. |
18:32:07 | FromGitter | <deech> Is subtyping inside a wrapper type expected to work? Here's an example of a dispatching on a subtype inside an `Option` causes a compiler error: https://play.nim-lang.org/#ix=2G3N |
18:32:28 | FromDiscord | <lander> No, idea, do you have a previous nim in the path? |
18:33:29 | FromGitter | <deech> lander: I did: `./koch boot -d:release && ./koch docs`. I *think* this is the same as what you suggested. |
18:36:42 | FromDiscord | <lander> But that's not bootstrapping, how did you compile koch? Not sure if it should work just with your that. I tried fully bootstrapped with ./build_all.sh and it worked for me |
18:37:10 | FromGitter | <deech> I'll try that. Thanks! |
18:41:30 | * | vsantana quit (Quit: Leaving.) |
18:44:59 | ForumUpdaterBot | New thread by Deech: Does subtyping inside a parameterized type work?, see https://forum.nim-lang.org/t/7177 |
18:46:01 | * | thomasross joined #nim |
18:50:55 | * | vsantana joined #nim |
18:54:16 | * | habamax joined #nim |
18:54:16 | * | natrys quit (Ping timeout: 246 seconds) |
18:59:49 | reversem3 | What libs do I need to extract information on an OS ? I found to extract Disk Free, network activity, CPU speed, Ram usage ect.. |
19:01:36 | FromDiscord | <Giamby> there are some constants defined in the system module such as `hostOS` and `hostCPU` |
19:07:30 | * | natrys joined #nim |
19:08:10 | reversem3 | sysinfo , osproc |
19:09:19 | * | superbia joined #nim |
19:23:04 | * | hmmm joined #nim |
19:23:14 | hmmm | hallo |
19:24:12 | hmmm | I miss disruptek :| |
19:29:06 | FromDiscord | <Giamby> can anyone help? |
19:29:22 | hmmm | state the nature of your emergency |
19:30:02 | * | apahl quit (Ping timeout: 264 seconds) |
19:30:26 | * | apahl joined #nim |
19:32:30 | FromDiscord | <tinygiant> sent a long message, see http://ix.io/2G48 |
19:34:39 | FromDiscord | <lqdev> @Giamby define your object as `type VM = ref object` first of all |
19:35:05 | FromDiscord | <lqdev> then, you'll need to use `new VM` to create your object |
19:35:07 | FromDiscord | <lqdev> or just `VM()` |
19:35:49 | FromDiscord | <lqdev> the default value for anything is binary 0, and because refs are really just pointers, that means that the default value of your ref is `nil`, so you must always initialize it with something |
19:36:13 | * | vicfred quit (Quit: Leaving) |
19:36:20 | FromDiscord | <lqdev> also, what do you need `ptr Obj` for? |
19:36:31 | FromDiscord | <lqdev> ptr is inherently unsafe, you should avoid it at all costs |
19:36:48 | FromDiscord | <lqdev> unless you really know what you're doing |
19:37:09 | * | vicfred joined #nim |
19:38:03 | * | vicfred quit (Max SendQ exceeded) |
19:38:32 | * | vicfred joined #nim |
19:40:00 | * | rockcavera joined #nim |
19:42:23 | * | rockcavera quit (Remote host closed the connection) |
19:45:09 | * | vicfred quit (Quit: Leaving) |
19:47:16 | FromDiscord | <fwsgonzo> is there a performance penalty when combining ARC with -d:useMalloc ? |
19:47:48 | FromDiscord | <Recruit_main707> Depending on the situation |
19:49:02 | * | habamax quit (Quit: leaving) |
19:53:18 | * | rockcavera joined #nim |
19:55:56 | FromDiscord | <Giamby> I plan to add a custom GC |
19:56:09 | FromDiscord | <Giamby> already did that |
19:56:40 | FromDiscord | <lqdev> @Giamby would you mind sharing the code? that would make it easier for us both |
19:59:34 | * | superbia quit (Quit: WeeChat 2.9) |
20:01:29 | FromDiscord | <Giamby> what code do you need specifically? I already shared the proc initializing the VM, do you need the type declaration too? |
20:01:50 | FromDiscord | <lqdev> that would help |
20:02:22 | FromDiscord | <lqdev> but really to see your problem i'd need to see the entire thing, it's hard to cross-reference stuff just based on some snippets |
20:02:41 | FromDiscord | <lqdev> is the return type of `initVM` still `ref VM`? |
20:05:10 | ForumUpdaterBot | New thread by Eyes: Nim (1.4 ORC) v.s. Rust in terms of safety?, see https://forum.nim-lang.org/t/7179 |
20:07:22 | * | rockcavera quit (Remote host closed the connection) |
20:11:46 | FromDiscord | <Giamby> Yep. If you give me a sec I'll push to my repo so that you can read the full code |
20:14:06 | FromDiscord | <Giamby> sent a long message, see http://ix.io/2G4B |
20:14:49 | FromDiscord | <nikki> you should return `: VM` not `ref VM` unless you actually want two levels of `ref` |
20:15:07 | FromDiscord | <Giamby> oh oof? |
20:15:09 | FromDiscord | <nikki> if you change that, the code you had with `new result` will work |
20:15:26 | FromDiscord | <lqdev> and you can get rid of `ref seq` |
20:15:49 | FromDiscord | <nikki> yeah unclear why you used `seq` everywhere else but `ref seq` for that one field |
20:15:56 | FromDiscord | <Giamby> tbh idk |
20:16:05 | FromDiscord | <Giamby> probably in an attempt to fix call frames |
20:16:16 | FromDiscord | <Giamby> ah yes the stack used to be a ref because the vm was not |
20:17:12 | FromDiscord | <Giamby> there is a slight problem |
20:17:30 | FromDiscord | <Giamby> if I don't set the return type as ref VM then the code kind of breaks where it expects a ref VM |
20:17:52 | FromDiscord | <Giamby> for instance I have the freeVM() proc that wants a ref VM and gets a VM instead and the compiler doesn't like it of course |
20:18:26 | FromDiscord | <nikki> freeVM should also not take a ref VM |
20:18:37 | FromDiscord | <nikki> your VM type is already a ref type, so it sounds like you want to take VM everywhere |
20:19:30 | FromDiscord | <Giamby> oh I see |
20:19:31 | FromDiscord | <nikki> you can't just keep adding / removing `ref` randomly until it compiles, it has to make sense ๐
|
20:19:38 | FromDiscord | <Giamby> so what I'm doing is a ref to a ref |
20:19:42 | FromDiscord | <Giamby> that sounds dumb |
20:19:51 | FromDiscord | <nikki> it's not dumb, it's just not what you probably want to do right now |
20:19:54 | FromDiscord | <Giamby> I thought that ref thing was just a type hint |
20:20:00 | FromDiscord | <Giamby> like "hey this is a ref to this" |
20:20:10 | * | vicfred joined #nim |
20:20:10 | FromDiscord | <Giamby> not that it actually made a ref to the thing you're passing |
20:20:13 | FromDiscord | <nikki> it is. you already defined `VM` as `ref object ...` |
20:20:18 | FromDiscord | <Giamby> yeaah |
20:20:23 | FromDiscord | <nikki> so `ref VM` is `ref ref object ...` |
20:20:30 | FromDiscord | <Giamby> I think it's quite evident this is a PEBKAC |
20:20:31 | FromDiscord | <nikki> it is the hint, it's not not the hint. it's just that you are saying this ^ |
20:20:53 | FromDiscord | <Giamby> is it so evident that I've been using Python for so long? |
20:21:14 | * | vicfred quit (Max SendQ exceeded) |
20:21:14 | FromDiscord | <nikki> only because you keep saying that |
20:21:42 | * | vicfred joined #nim |
20:21:51 | FromDiscord | <nikki> personally, i never really define types as `ref object` |
20:21:52 | FromDiscord | <Giamby> never had to deal with ref vs value semantics |
20:22:05 | FromDiscord | <nikki> i always explicitly write `ref X` in places. things can 'hide refs' by having them as fields, for sure |
20:22:08 | FromDiscord | <Giamby> It says it's recommended for inheritance on the docs and I do that |
20:22:17 | FromDiscord | <nikki> ah word. well, i don't really use inheritance lol so |
20:22:29 | FromDiscord | <Giamby> I'm too OOP biased not to use it I fear |
20:22:34 | FromDiscord | <nikki> but yeah i like the clarity of having `ref T` somewhere |
20:22:47 | FromDiscord | <Giamby> well for sure you can't make such mistakes by having a ref to a ref |
20:22:59 | FromDiscord | <Giamby> only god knows how deep the reference calls in my code were |
20:23:00 | FromDiscord | <Giamby> lol |
20:26:19 | * | Vladar quit (Quit: Leaving) |
20:28:19 | Zevv | !last disruptek |
20:28:19 | disbot | disruptek spoke in 12disbot 2 days ago |
20:30:24 | * | narimiran quit (Ping timeout: 256 seconds) |
20:34:00 | FromDiscord | <alehander42> hey guys, do you need any update from me about the nil thing before december |
20:36:44 | * | vicfred quit (Quit: Leaving) |
20:37:28 | * | vicfred joined #nim |
20:46:54 | FromGitter | <deech> How do I use the covariance feature ( https://nim-lang.org/docs/manual_experimental.html#covariance )? Hunting around the source I see `nimEnableCovariance` flag but setting it with `-d:nimEnableCovariance` doesn't seem to enable it. |
20:47:47 | FromGitter | <deech> Also tried `--experimental`. |
20:51:11 | mipri | I don't see a feature for it in compiler/options.nim, and the code doesn't work as is, so there may not be a way to do that |
20:52:39 | FromGitter | <deech> There's a test for it but I guess that never gets run: https://github.com/nim-lang/Nim/blob/devel/tests/cpp/tcovariancerules.nim |
20:55:05 | * | vicfred quit (Quit: Leaving) |
21:01:16 | * | vesper11 quit (K-Lined) |
21:17:45 | * | vicfred joined #nim |
21:18:37 | * | vicfred quit (Max SendQ exceeded) |
21:19:05 | * | vicfred joined #nim |
21:20:16 | * | vicfred quit (Max SendQ exceeded) |
21:20:50 | * | vicfred joined #nim |
21:21:52 | * | vicfred quit (Max SendQ exceeded) |
21:22:24 | * | vicfred joined #nim |
21:33:54 | * | vicfred_ joined #nim |
21:36:51 | * | vicfred quit (Ping timeout: 265 seconds) |
21:39:51 | * | rockcavera joined #nim |
21:40:28 | * | vicfred joined #nim |
21:40:53 | * | vicfred_ quit (Ping timeout: 256 seconds) |
21:41:45 | * | vicfred quit (Client Quit) |
21:44:58 | FromDiscord | <reilly> I have a Jester web app I want to deploy. What service would be easiest to do this on? I ask because I don't know how well-supported Nim is. |
21:47:30 | FromDiscord | <Zachary Carter> probably digital ocean |
21:51:20 | * | hmmm quit (Ping timeout: 272 seconds) |
21:53:25 | * | vicfred joined #nim |
22:01:59 | * | gangstacat quit (Ping timeout: 272 seconds) |
22:17:42 | * | NimBot joined #nim |
22:26:05 | FromDiscord | <Recruit_main707> Disruptek still banned? |
22:26:52 | FromDiscord | <Recruit_main707> @Zachary Carter is digital ocean free? |
22:27:02 | * | gangstacat joined #nim |
22:27:14 | FromDiscord | <ache of head> wait what |
22:27:20 | FromDiscord | <ache of head> is disruptek banned???? |
22:27:27 | FromDiscord | <Recruit_main707> Muted |
22:27:39 | FromDiscord | <Quibono> I believe so. |
22:27:45 | FromDiscord | <Zachary Carter> lol why did he get banned? |
22:28:08 | FromDiscord | <Recruit_main707> Async argument got a bit personal w/ dom iirc |
22:29:01 | FromDiscord | <ache of head> dang |
22:29:35 | mipri | he's since been unmuted. |
22:31:33 | FromDiscord | <Zachary Carter> ah |
22:31:52 | FromDiscord | <Recruit_main707> He hasnโt talked in 2 days, without being muted? |
22:34:05 | * | natrys quit (Quit: natrys) |
22:35:25 | * | hmmm joined #nim |
22:35:30 | FromDiscord | <Recruit_main707> I wonder if I can contact him through discord then |
22:42:02 | * | hmmm quit () |
22:56:41 | FromDiscord | <squid> What is escape character \L? |
22:58:24 | mipri | !eval echo '\L'.int |
22:58:27 | NimBot | 10 |
22:58:38 | FromDiscord | <squid> Is that the ascii character? |
22:59:33 | FromDiscord | <squid> I would think so as Ascii 10 is Line Return |
22:59:44 | FromDiscord | <squid> So thats \n in other languages |
22:59:59 | reversem3 | @treeform are you around |
23:00:20 | mipri | https://nim-lang.org/docs/manual.html#lexical-analysis-string-literals |
23:01:00 | FromDiscord | <squid> I was trying to communicate with async tcp server and C# |
23:01:10 | FromDiscord | <squid> So I had some problems with RecvLine |
23:01:34 | FromDiscord | <squid> Checked documentation and said something about "\r\L". Tried to google to figure out \L |
23:01:36 | * | reversem3 sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/ccvEjPMbddvadWxMCZFZRIdr/message.txt > |
23:01:46 | FromDiscord | <squid> Thank you for the help |
23:01:52 | reversem3 | what does sub and key mean ? |
23:02:44 | FromDiscord | <squid> Seems to just to be arguments to the wmic command |
23:03:02 | mipri | that's what they are, just arguments. the meaning probably would make more sense if I knew what 'wmic' was. |
23:03:05 | reversem3 | so it could be x and y also right |
23:03:22 | reversem3 | wmic is just a way to interface with windows cli |
23:03:24 | FromDiscord | <squid> wmic <sub here> get < key here > |
23:03:30 | mipri | as a rule, don't do that though -- don't build a string to pass to the OS. it's asking for a backdoor, intentional or not. |
23:03:30 | FromDiscord | <squid> It runs that on cmd |
23:03:48 | FromDiscord | <squid> Might depend on usage tho. |
23:04:03 | FromDiscord | <squid> If its his own program not supposed to be handed out might not matter but sure. |
23:04:22 | FromDiscord | <squid> Cant be bad to have that embedded into his mind |
23:04:33 | mipri | hence, as a rule. It's incredibly rare to actually need to do that. |
23:05:10 | reversem3 | yeah not finding anything on sub and key for wmic , its weird |
23:05:15 | mipri | the alternative is just execProcess and using the args array |
23:05:49 | reversem3 | he's using osproc cmdexec |
23:05:49 | FromDiscord | <squid> reversem3, It is just arguments passed. On wmic they are probably not named sub and key |
23:06:07 | reversem3 | ok , thats what I thought |
23:06:07 | mipri | yes, I see what he's using. That is what I am suggesting he not use. |
23:08:24 | FromDiscord | <squid> reversem, "wmic PROCESS GET NAME" It seems like sub means the specific process and key might be specific options of that process |
23:08:38 | reversem3 | well it works great lol , just trying to figure out how to get network stats now |
23:08:50 | reversem3 | psutil doesn't work with 1.4 right now |
23:10:58 | * | FromDiscord quit (Remote host closed the connection) |
23:11:11 | * | FromDiscord joined #nim |
23:11:58 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
23:12:11 | * | qwertfisch joined #nim |
23:19:23 | * | vsantana quit (Quit: Leaving.) |
23:25:30 | FromDiscord | <treeform> @reversem3 what do you need? |
23:27:43 | * | oprypin quit (Quit: Bye) |
23:27:51 | * | oprypin joined #nim |
23:37:37 | * | apahl quit (Ping timeout: 272 seconds) |
23:38:25 | * | apahl joined #nim |
23:42:48 | FromDiscord | <Rebel> What are you trying to do with wmic? Are you just creating a wrapper for it in Nim? |
23:48:06 | FromDiscord | <Rebel> Could also use osqury |
23:48:09 | FromDiscord | <Rebel> (edit) "osqury" => "osquery" |
23:50:30 | FromDiscord | <Imperatorn> Not my business, but shouldn't you use the wmi api directly instead? ๐ค |
23:50:46 | FromDiscord | <Rebel> Also whoever said there was no task scheduling lib in Nim is a liar |
23:50:54 | FromDiscord | <Rebel> Weave looks pretty hot |
23:51:40 | FromDiscord | <Rebel> I mean it really depends what you are trying to do... osquery is cross-platform as well. |
23:54:38 | FromDiscord | <Imperatorn> Cool, didn't know about osquery |
23:56:07 | FromDiscord | <Rebel> (edit) I mean it really depends on what you are trying to do... osquery is cross-platform as well. |