00:04:38 | * | neurocyte091709 joined #nim |
00:05:02 | FromDiscord | <that_dude> Can a template do any calculations, or is that reserved entirely to macros? |
00:05:39 | FromDiscord | <Elegantbeef> Templates are code substitution, they cannot compute anything |
00:05:53 | FromDiscord | <that_dude> ok |
00:06:36 | * | neurocyte09170 quit (Ping timeout: 250 seconds) |
00:07:36 | FromDiscord | <that_dude> and to follow that up, in general, is there a major performance diff to using a template with a lot of if statements when I could just use the macro to properly generate the one path I need |
00:07:59 | FromDiscord | <that_dude> It shouldn't be bad right? |
00:08:13 | FromDiscord | <Elegantbeef> Well yea if you have a bunch of if statements you're evaluating them, why not use when if you can do it in a macro? |
00:09:32 | FromDiscord | <Rika> Well unless if you need it on runtime of course |
00:09:55 | FromDiscord | <that_dude> I'm using it as a helper for another macro I wrote |
00:10:01 | FromDiscord | <Elegantbeef> They said they could generate the single path in a macro rika |
00:10:29 | FromDiscord | <that_dude> > The statements within a branch do not open a new scope.↵What does this mean? |
00:10:40 | FromDiscord | <that_dude> I look up the doc for when statemnt |
00:10:42 | FromDiscord | <that_dude> (edit) "statemnt" => "statement" |
00:10:51 | FromDiscord | <that_dude> So like no proc call? |
00:11:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3McW |
00:11:13 | FromDiscord | <Rika> Any statements in a when statement is part of the outer scope only, no branching and local scope variables etc |
00:11:44 | FromDiscord | <Rika> You can access things inside a when from the outside |
00:12:27 | FromDiscord | <that_dude> ah ok |
00:12:41 | FromDiscord | <that_dude> so like a normal if statement |
00:12:54 | FromDiscord | <Elegantbeef> No |
00:12:59 | FromDiscord | <Elegantbeef> If statements make scope |
00:13:03 | FromDiscord | <Elegantbeef> When statements do not make scope |
00:13:04 | FromDiscord | <that_dude> wait they do? |
00:13:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3McX |
00:14:06 | FromDiscord | <that_dude> Damn I never encounted that. I always define the `a` before to avoid accidentally going down a path that doesn't set it |
00:14:40 | FromDiscord | <leorize> i take it that you come from python \:p |
00:16:38 | FromDiscord | <that_dude> Yeah lol |
00:17:03 | FromDiscord | <that_dude> Tbh I assumed most do |
00:17:42 | FromDiscord | <Rika> I came from Python and I knew this |
00:18:21 | FromDiscord | <leorize> you just have to remember that no matter how much nim resembles python, it's a very different language |
00:18:55 | FromDiscord | <Rika> It’s something to be thankful of coming from Python lol |
00:19:49 | FromDiscord | <leorize> oh and there's no such thing as global namespace in nim, everything is module-scoped |
00:20:28 | FromDiscord | <leorize> that's a knowledge that will help you avoid the from-import trap that newcomers from python frequently fall into |
00:34:39 | FromDiscord | <theangryepicbanana> lmao people voted for nim's editor support in the community survey |
00:35:04 | FromDiscord | <theangryepicbanana> why tho |
00:35:29 | FromDiscord | <Elegantbeef> What do you mean? |
00:35:49 | FromDiscord | <theangryepicbanana> nim has very poor editor support compared to similar languages |
00:35:58 | FromDiscord | <theangryepicbanana> and uh in general |
00:36:01 | FromDiscord | <Elegantbeef> And they want it better |
00:36:28 | FromDiscord | <theangryepicbanana> well yeah but this was under the "what do you like about nim?" section |
00:36:29 | FromDiscord | <Rika> That’s not what they mean |
00:39:29 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Md1 |
00:39:42 | FromDiscord | <huantian> cast it to an array of Window, not ptr Window |
00:39:46 | FromDiscord | <huantian> sigh |
00:39:59 | FromDiscord | <Elegantbeef> The fuck it says `Window` |
00:42:00 | FromDiscord | <Rika> No I get it |
00:42:04 | FromDiscord | <Rika> It’s a pointer to an array |
00:42:05 | FromDiscord | <Rika> Var array |
00:42:21 | FromDiscord | <Elegantbeef> It's a pointer to an array of pointers to windows |
00:42:34 | FromDiscord | <Rika> That would be a triple pointer |
00:43:09 | FromDiscord | <Elegantbeef> `WIndow` is a pointer to a window |
00:43:19 | FromDiscord | <Rika> Or an array |
00:43:19 | FromDiscord | <Elegantbeef> `Window` is a pointer to an array of pointer windows |
00:43:39 | FromDiscord | <Elegantbeef> This is why pointer collections should be statically typed |
00:43:49 | FromDiscord | <Rika> Beef I think this is where your lack of c knowledge doesn’t help |
00:44:11 | FromDiscord | <Elegantbeef> I mean it's ambiguous |
00:44:24 | FromDiscord | <Rika> Yes but your meaning is not one of the choices |
00:44:34 | FromDiscord | <Rika> It’s either a pointer to an array or an array of pointers |
00:44:50 | FromDiscord | <Elegantbeef> And my meaning is the array of pointers |
00:45:12 | FromDiscord | <leorize> it could also be pointer to pointer \:p |
00:45:17 | FromDiscord | <Rika> Okay I see what you mean now |
00:45:25 | FromDiscord | <Rika> In reply to @leorize "it could also be": I guess? |
00:45:39 | FromDiscord | <Rika> I don’t think it makes much sense though considering it’s named children |
00:45:45 | FromDiscord | <Elegantbeef> It's ambiguous and the reason we cannot have nice things |
00:45:47 | FromDiscord | <Rika> Nor does a double array but yes it can |
00:47:16 | FromDiscord | <leorize> https://linux.die.net/man/3/xquerytree |
00:47:28 | FromDiscord | <Rika> Now I question the meaning and pronunciation of array damn it |
00:47:29 | FromDiscord | <leorize> according to the docs it's pointer to array |
00:48:38 | FromDiscord | <Elegantbeef> "a ray" |
00:59:49 | FromDiscord | <Rika> I mean to me the pronunciation (and context of course) changes the meaning |
01:01:40 | FromDiscord | <huantian> oh yeah funnily enough beef you had this convo with someone else previously |
01:01:52 | FromDiscord | <Elegantbeef> Probably |
01:06:16 | FromDiscord | <Bung> @ElegantBeef hi , after you refactor nimscripter , i dont know how to use it now |
01:06:41 | FromDiscord | <Elegantbeef> It's much simpler now |
01:06:55 | FromDiscord | <Elegantbeef> What's your issue? |
01:07:50 | FromDiscord | <Bung> when call intr.invoke(myMethod) where is myMethod it show compiler cant find it |
01:08:09 | FromDiscord | <Elegantbeef> Put an export marker on `myMethod` |
01:10:18 | * | kayabaNerve quit (Ping timeout: 250 seconds) |
01:11:09 | FromDiscord | <Bung> am confusing your first example on readme contains exporto and loadScript |
01:11:36 | FromDiscord | <Bung> dont know which part put into script which put into my main program |
01:12:01 | FromDiscord | <Elegantbeef> I mean the first example doesnt require a script |
01:12:12 | FromDiscord | <Elegantbeef> `assert doThing() == 42` is the script |
01:12:43 | FromDiscord | <Elegantbeef> `exportTo` is how you add stuff to share with the nimscript |
01:13:18 | FromDiscord | <Bung> I only need call script from my main program what should I do ? |
01:13:47 | FromDiscord | <Elegantbeef> You dont want to call anything in your program? |
01:13:51 | FromDiscord | <Elegantbeef> If not you just use loadScript |
01:14:23 | FromDiscord | <Elegantbeef> Then in your script you mark your procedures with `` so you can call them from the nim code |
01:14:43 | FromDiscord | <Elegantbeef> There is an example btw |
01:14:53 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/blob/master/examples/macrorepl/macrorepl.nim is the main Nim program |
01:14:58 | FromDiscord | <Bung> I do it like https://github.com/beef331/nimscripter#calling-code-from-nim but fancyStuff whill be `Error: undeclared identifier` |
01:15:20 | FromDiscord | <Elegantbeef> It's certainly not |
01:15:47 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/blob/master/tests/texamples.nim i do test the examples |
01:16:46 | FromDiscord | <Elegantbeef> `fancyStuff` is exported from the script so it's accessible from the compiled Nim code |
01:17:43 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=3Md6 |
01:18:02 | FromDiscord | <Elegantbeef> What is your themeFIle? |
01:18:47 | FromDiscord | <Bung> it just contains karax render proc like `proc renderLayout(conf: Config; n: VNode = nil): VNode =` |
01:19:18 | FromDiscord | <Elegantbeef> Any chance you can share the example? |
01:20:37 | FromDiscord | <Bung> https://github.com/bung87/crown_ui/tree/nimscripter you can run `nim c -r src/crown_ui.nim build --cwd ./example/` to check |
01:30:16 | FromDiscord | <Elegantbeef> Ah you're passing multiple parameters which might be the issue |
01:30:25 | * | LyndsySimon_ joined #nim |
01:30:31 | FromDiscord | <Elegantbeef> You may need to do `[a, b, c]` returnTyp = void\` |
01:32:10 | * | redj_ joined #nim |
01:33:44 | FromDiscord | <Bung> it cant return value now ? |
01:33:53 | * | greaser|q joined #nim |
01:34:02 | * | cyraxjoe joined #nim |
01:34:41 | FromDiscord | <Elegantbeef> Content has `proc`s as fields |
01:34:44 | FromDiscord | <Elegantbeef> Those are not serializable |
01:35:26 | FromDiscord | <Elegantbeef> You need to convert it to a type that can go across the bridge or again not use nimscripter 😀 |
01:36:05 | * | zgasma[m]1 joined #nim |
01:36:29 | FromDiscord | <Elegantbeef> I mean i suppose i could just Nil procs |
01:36:31 | FromDiscord | <Bung> oh , I may choose convert it , as I use dll approach but it cant pass variable. |
01:37:21 | FromDiscord | <Bung> I can write macro turn result into string |
01:39:01 | FromDiscord | <Bung> could this be improved that support multiple parameters ? it"s boring combine params to single type |
01:39:04 | * | LyndsySimon quit (Ping timeout: 240 seconds) |
01:39:05 | * | LyndsySimon_ is now known as LyndsySimon |
01:39:05 | * | redj quit (Ping timeout: 240 seconds) |
01:39:06 | * | zgasma[m] quit (Ping timeout: 240 seconds) |
01:39:07 | * | MightyJoe quit (Ping timeout: 240 seconds) |
01:39:07 | * | xet7 quit (Ping timeout: 240 seconds) |
01:39:07 | * | GreaseMonkey quit (Ping timeout: 240 seconds) |
01:40:06 | FromDiscord | <Alea> is there some seq like type with arbitrary indexes? |
01:41:42 | FromDiscord | <Elegantbeef> You can just do `libTheme.invoke(renderPost, conf, data, contentNode, returnType = void)` |
01:41:42 | FromDiscord | <Elegantbeef> Right now the issue is `ref seq[string]` |
01:41:43 | FromDiscord | <Elegantbeef> I dont handle ref semantics apparently |
01:41:43 | FromDiscord | <Elegantbeef> Which i guess i'll look at tomorrow |
01:41:44 | FromDiscord | <Elegantbeef> Sorry |
01:46:52 | * | xet7 joined #nim |
01:46:57 | FromDiscord | <Bung> but I need return value |
01:47:23 | FromDiscord | <Elegantbeef> I mean you can use return type |
01:47:30 | FromDiscord | <Elegantbeef> You just have to explicitly annotate it |
01:47:56 | FromDiscord | <Bung> returnType = VNode , like this ? |
01:48:21 | FromDiscord | <Elegantbeef> Yea but we presently cannot convert `Vnode` |
01:48:39 | FromDiscord | <Elegantbeef> It has `proc` fields and also `ref seq[string]` |
01:50:03 | FromDiscord | <Bung> ah move one forward step I get `Error: type mismatch` , I'll use macro turn proc result to string then thing's get simpler |
01:50:13 | FromDiscord | <Elegantbeef> the procs can just be converted to `nil` but the `ref T` needs to handled |
01:51:22 | FromDiscord | <Bung> the conf fields also contains json so this also be a problem ? |
01:51:38 | FromDiscord | <Elegantbeef> Nah i can parse json |
01:51:42 | FromDiscord | <Elegantbeef> Well convert json |
01:51:58 | FromDiscord | <Elegantbeef> I just forgot about `ref T` existing and `proc` being in fields |
01:53:04 | FromDiscord | <Bung> okay, I get it, thanks, Think I can complete my project through nimscripter approach |
02:17:27 | adigitoleo | Can I do type unions in the return typedesc of a proc? Couldn't find the syntax |
02:19:48 | adigitoleo | looking for something like foo(): seq[a|b] |
02:20:58 | FromDiscord | <Elegantbeef> Are you looking for a return type that is heterogenous? |
02:21:11 | adigitoleo | yep but could be seq[a] or seq[b] |
02:21:26 | FromDiscord | <Elegantbeef> Ok so no hetregenous |
02:21:49 | FromDiscord | <Elegantbeef> you can do `seq[a] or seq[b]` |
02:22:09 | FromDiscord | <Elegantbeef> If you want unions https://github.com/alaviss/union |
02:23:18 | adigitoleo | thanks |
02:25:44 | * | neurocyte0917099 joined #nim |
02:27:37 | * | neurocyte091709 quit (Ping timeout: 240 seconds) |
02:27:37 | * | neurocyte0917099 is now known as neurocyte091709 |
02:45:55 | * | greaser|q quit (Changing host) |
02:45:55 | * | greaser|q joined #nim |
02:46:58 | * | greaser|q is now known as GreaseMonkey |
02:47:20 | FromDiscord | <Elegantbeef> @IsaacPaul\: didnt you make something like this already? https://forum.nim-lang.org/t/8806 |
02:47:41 | FromDiscord | <Elegantbeef> If so ping geekrelief and send them it 😛 |
02:55:32 | FromDiscord | <geekrelief> @ElegantBeef does @IsaacPaul have something online? |
02:56:04 | FromDiscord | <Elegantbeef> I think he does but i dont remember his github name so aside from stalking all of his messages i cant get it 😛 |
02:57:07 | FromDiscord | <geekrelief> I'm scrolling through them 🙂 |
02:57:09 | FromDiscord | <IsaacPaul> Izackp |
02:57:18 | FromDiscord | <IsaacPaul> Is the git hub |
02:57:22 | FromDiscord | <IsaacPaul> Imma send it in a sec |
02:58:13 | FromDiscord | <IsaacPaul> https://github.com/izackp/questionable |
02:58:28 | FromDiscord | <geekrelief> cool! thx |
02:59:45 | FromDiscord | <geekrelief> In reply to @IsaacPaul "https://github.com/izackp/questionable": Do you think your library can solve my issue with this? https://play.nim-lang.org/#ix=3Md8 |
03:01:50 | FromDiscord | <geekrelief> My issue with chaining is that it doesn't work if I have a call with args. With no args it works. |
03:02:40 | FromDiscord | <IsaacPaul> I’d like to help but I’m indisposed atm |
03:02:47 | FromDiscord | <IsaacPaul> Check out the readme |
03:02:59 | FromDiscord | <geekrelief> no worries. yeah I looked at the readme. I'm looking through the code now |
03:03:11 | FromDiscord | <IsaacPaul> In reply to @geekrelief "Do you think your": Also not really my library. Someone else’s + modifications |
03:03:23 | FromDiscord | <geekrelief> oh haha I see |
03:28:23 | * | Lord_Nightmare quit (Ping timeout: 256 seconds) |
03:39:21 | * | redj_ is now known as redj |
03:40:03 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
03:41:06 | * | redj joined #nim |
04:03:07 | NimEventer | New post on r/nim by distractedbytheworld: Using javascript arguments in a Nim function, see https://reddit.com/r/nim/comments/s4bb5g/using_javascript_arguments_in_a_nim_function/ |
04:49:11 | * | arkurious quit (Quit: Leaving) |
05:18:22 | adigitoleo | playground is *ahem* playing up for me, but I'm confused why this doesn't work https://x0.at/znQC.txt |
05:22:19 | FromDiscord | <Rika> table.mitems |
05:22:34 | FromDiscord | <Rika> Iterator values are immutable by default |
05:22:56 | adigitoleo | Ah |
05:45:31 | NimEventer | New thread by Cantanima: Suppressing non-exported fields in nim doc, see https://forum.nim-lang.org/t/8809 |
06:49:50 | * | Gustavo6046 joined #nim |
06:49:56 | adigitoleo | does unittest run tests in async? I'm getting barf in my logging that I can't seem to repro in a simple example |
06:50:03 | adigitoleo | running with nimble test |
06:52:44 | nrds | <Prestige99> barf? |
06:52:46 | FromDiscord | <Elegantbeef> I dont think so |
06:52:59 | FromDiscord | <Elegantbeef> I could be wrong, but there is no mention of it and `suite` is just a template |
06:53:23 | adigitoleo | there's some {.threadvar.} in unittest source, I'm not savvy enough to now completely what it's about tho |
06:53:46 | adigitoleo | maybe I need to mark my logger with that also? |
06:55:49 | adigitoleo | nrds: I mean like repeated log entries |
06:59:35 | adigitoleo | Maybe relevant https://nim-lang.org/docs/logging.html#basic-usage-notes-when-using-multiple-threads |
06:59:50 | adigitoleo | Not sure how I'd set the handler in each thread... |
07:10:56 | adigitoleo | Hmm nevermind must be something else, can't see any thread creation in unittest source |
08:47:15 | * | jjido joined #nim |
09:08:39 | FromDiscord | <retkid> my latest nim problem is the compiler is either underflowing or overflowing |
09:08:46 | FromDiscord | <retkid> whats the general cause of this |
09:10:02 | FromDiscord | <mratsim> are you doing compile-time computation? |
09:10:17 | FromDiscord | <retkid> no consts |
09:10:31 | FromDiscord | <retkid> in the entire project |
09:13:07 | FromDiscord | <Elegantbeef> That doesnt answer the question |
09:13:33 | FromDiscord | <Rika> Macros count as compile time |
09:13:44 | FromDiscord | <Elegantbeef> So does `static:` |
09:15:18 | FromDiscord | <Rika> A lot of things too |
09:15:43 | FromDiscord | <Rika> So what exactly is the error? |
09:15:47 | FromDiscord | <retkid> no macros, templates, statics |
09:15:50 | FromDiscord | <retkid> (edit) "statics" => "statics, etc" |
09:16:06 | FromDiscord | <retkid> it just raises overflow and sysfatals |
09:16:13 | FromDiscord | <Rika> That’s not a compiler error |
09:16:15 | FromDiscord | <Rika> That’s a runtime error |
09:16:24 | FromDiscord | <retkid> during compile time |
09:16:24 | FromDiscord | <Rika> The whole error please |
09:18:52 | FromDiscord | <Elegantbeef> There is a non 0 chance they have code that causes a compiler crash, but I'm cautious of that assertion |
09:19:21 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/931839964541485056/unknown.png |
09:19:23 | FromDiscord | <Rika> We can’t tell of course until error and source |
09:19:40 | FromDiscord | <retkid> literally |
09:19:42 | FromDiscord | <retkid> thats it |
09:19:58 | FromDiscord | <retkid> as you can tell its very imformative |
09:19:58 | FromDiscord | <Rika> Okay now that we know it is the compiler what’s the source |
09:20:02 | FromDiscord | <Elegantbeef> That's a compiler error |
09:20:04 | FromDiscord | <retkid> (edit) "imformative" => "informative" |
09:20:11 | FromDiscord | <Elegantbeef> Give me code please |
09:20:29 | FromDiscord | <retkid> In reply to @Rika "Okay now that we": yea I have no clue where it is, 53 of the main doesn't contain any math so its kinda like wat |
09:20:37 | FromDiscord | <Rika> I mean the source code lol |
09:20:43 | FromDiscord | <Elegantbeef> Alternatively build/run with a debug compiler |
09:21:10 | FromDiscord | <Rika> In reply to @Elegantbeef "Alternatively build/run with a": Note that things are somewhat slow this way so if the thing is slow building theeeen |
09:21:59 | FromDiscord | <retkid> i might just start hacking things out because inim doesn't work |
09:22:31 | FromDiscord | <Rika> Well we could help better if we could see the code, of course though it is your choice |
09:22:32 | FromDiscord | <Elegantbeef> like i said if you want to see the issue compile with a debug compiler and you'll get a useful stacktrace to see where the overflow happens |
09:22:43 | FromDiscord | <Elegantbeef> It wont help you much as you arent a compiler dev but it'll say where |
09:23:04 | FromDiscord | <Rika> If you want beef here will guide you with the process of that xddd |
09:23:16 | FromDiscord | <enthus1ast> why is a debug compiler needed for this? |
09:23:43 | FromDiscord | <Elegantbeef> Cause the compiler strips out stacktrace for performance reasons in release |
09:23:45 | * | Gustavo6046 quit (Quit: Leaving) |
09:23:54 | FromDiscord | <enthus1ast> knowing where the error is could interest any one imho |
09:24:03 | FromDiscord | <Elegantbeef> Sure but it's also costly for all operations |
09:24:14 | FromDiscord | <Elegantbeef> Storing stack traces slows compilation down |
09:24:19 | FromDiscord | <Rika> I’m assuming a massive performance loss with it in |
09:24:21 | FromDiscord | <Rika> On |
09:24:23 | FromDiscord | <Elegantbeef> Nim now ships with a debug compiller iirc but i could be wrong |
09:24:37 | FromDiscord | <enthus1ast> could it be stripped out on a release build? |
09:24:37 | FromDiscord | <Elegantbeef> Indeed |
09:24:44 | FromDiscord | <retkid> something to do with another function i wrote but that function compiles file |
09:24:49 | FromDiscord | <retkid> so its kindaaaaaaa stupid |
09:24:55 | FromDiscord | <Elegantbeef> I mean it's a compiiler error |
09:25:05 | FromDiscord | <Elegantbeef> I'd happily look into it if you provide a reproduction |
09:25:35 | FromDiscord | <retkid> oh hell no this code isn't code I'd show my therapist |
09:25:51 | FromDiscord | <Rika> We’re not your therapist so it’s fine |
09:25:56 | FromDiscord | <Elegantbeef> Well then i can only say stupid in stupid out |
09:26:14 | FromDiscord | <Rika> Garbage in garbage out you mean? |
09:26:15 | FromDiscord | <retkid> its not stupid, just ugly |
09:26:17 | FromDiscord | <Elegantbeef> The debug compiler option will also give helpful information though |
09:26:32 | FromDiscord | <retkid> how would one do that |
09:26:51 | FromDiscord | <Elegantbeef> Clone https://github.com/nim-lang/Nim |
09:27:06 | FromDiscord | <Elegantbeef> do `./build_all.sh` or `./build_all.bat` |
09:27:17 | FromDiscord | <retkid> how long will building nim from source take... |
09:27:21 | FromDiscord | <retkid> wel |
09:27:22 | FromDiscord | <Elegantbeef> then do `./koch temp c ./path/to/your/nimFile.nim` |
09:27:24 | FromDiscord | <retkid> thats not a good question |
09:27:28 | FromDiscord | <Elegantbeef> Takes about 2 minutes from fresh on my machine |
09:27:48 | FromDiscord | <enthus1ast> choosenim should have an option to also build/download a nim debug compiler and put it next to the release one, maybe called nimdbg |
09:27:50 | FromDiscord | <retkid> alright I'll ``time`` it and see how much faster your machne is |
09:28:01 | FromDiscord | <Elegantbeef> I have a xeon1231v3 |
09:28:07 | FromDiscord | <Elegantbeef> Not an amazing cpu but not a shitty one either |
09:28:13 | FromDiscord | <retkid> it-4790S |
09:28:17 | FromDiscord | <retkid> (edit) "it-4790S" => "I5-4790S" |
09:28:24 | FromDiscord | <Elegantbeef> I mean i think araq wants to ship a debug compiler with the standard one |
09:28:28 | FromDiscord | <Elegantbeef> So skips the debug path |
09:28:32 | FromDiscord | <Elegantbeef> Yea about the same IPC |
09:28:37 | FromDiscord | <Elegantbeef> So going to take about the same time |
09:28:55 | FromDiscord | <Elegantbeef> Both haswell cpus |
09:29:38 | FromDiscord | <Elegantbeef> But yes enthus having easy access to a debug compiler makes bugs like this easier to resolve/provide min repros |
09:30:14 | FromDiscord | <Elegantbeef> Might be a bit biased given my compiler contributions 😀 |
09:30:32 | FromDiscord | <Elegantbeef> I feel having the source is just better than a debug binary |
09:30:47 | FromDiscord | <Elegantbeef> Like sure the debug binary gives a line number, but having the source means you can atleast try to fix it |
09:30:53 | FromDiscord | <Elegantbeef> But i also dont mind wasting time |
09:31:14 | FromDiscord | <enthus1ast> yeah i mean, its always annoying when eg an assert breaks your code, but you don't know why and where |
09:31:36 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/931843047564668928/unknown.png |
09:31:39 | FromDiscord | <Elegantbeef> Yea i have compiler cloned so it's more like a puzzle to me than a nuisance 😛 |
09:31:40 | FromDiscord | <retkid> optimization is to be had |
09:31:48 | FromDiscord | <enthus1ast> then it feels stupid because i have the feeling that the compiler COULD tell me where it breaks but does not |
09:32:03 | FromDiscord | <Elegantbeef> It's "Aw hell yea, i get to bug hunt and possibly have another PR" |
09:32:38 | FromDiscord | <retkid> In reply to @enthus1ast "yeah i mean, its": seems like a solvable problem |
09:32:55 | FromDiscord | <Elegantbeef> I mean it is with stack traces, they're heavy though |
09:32:58 | FromDiscord | <enthus1ast> sure maybe the debug compiler can do this already |
09:33:11 | FromDiscord | <retkid> what if you just print the line and the file as it goes along |
09:33:15 | FromDiscord | <Elegantbeef> Even timothee's optimized stack traces were considered too heavy iirc |
09:33:15 | FromDiscord | <retkid> so you can see where it stops |
09:33:21 | FromDiscord | <Elegantbeef> I mean that's' a stack trace |
09:33:26 | FromDiscord | <enthus1ast> i mean, you would just use the debug compiler when you want to debug |
09:33:33 | FromDiscord | <Elegantbeef> Exactly |
09:33:44 | FromDiscord | <retkid> it took me 4.4 minutes |
09:34:00 | FromDiscord | <Elegantbeef> is that a mobile Cpu? |
09:34:14 | FromDiscord | <retkid> no lol |
09:34:25 | FromDiscord | <Elegantbeef> I couldnt remember what the S stood for |
09:34:37 | FromDiscord | <retkid> i had no money this was the cheapest ok-cpu i could find |
09:34:41 | FromDiscord | <retkid> I dont know either |
09:34:48 | FromDiscord | <Elegantbeef> Yea that's why i have a xeon1231v3 |
09:35:04 | FromDiscord | <Elegantbeef> I couldnt afford a K series so went with the xeon |
09:35:08 | FromDiscord | <enthus1ast> but 4.4 minutes is not bad, i remember the times when arch did not ship with mingw, o my gawd |
09:35:23 | FromDiscord | <enthus1ast> 30 - 60 minutes building mingw |
09:35:25 | FromDiscord | <retkid> well i had ordered the MB before because i thought my old cpu worked |
09:35:43 | FromDiscord | <retkid> I've had data take 8 hours to fully compile and save to a json\ |
09:35:46 | FromDiscord | <Elegantbeef> Rust from source laughs |
09:35:51 | FromDiscord | <Elegantbeef> Anyway |
09:35:56 | FromDiscord | <Elegantbeef> Test the code now |
09:36:20 | FromDiscord | <retkid> its goin |
09:36:21 | FromDiscord | <retkid> slowly |
09:36:33 | FromDiscord | <Elegantbeef> Yea debug is slow 😛 |
09:36:50 | FromDiscord | <Elegantbeef> I tend to run one build find the path/ast that causes the error then minimize it |
09:37:02 | FromDiscord | <retkid> its also compiling literally every fil |
09:37:37 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/931844562857644053/unknown.png |
09:37:41 | FromDiscord | <enthus1ast> wait\: `./koch temp c ./path/to/your/nimFile.nim` is building the debug compiler then compiles the file with the debug compiler? |
09:37:53 | FromDiscord | <Elegantbeef> Yes |
09:37:53 | FromDiscord | <retkid> In reply to @retkid "": anticlimactic |
09:38:22 | FromDiscord | <enthus1ast> maybe you've cloned the #head |
09:38:34 | FromDiscord | <enthus1ast> not the version your where useing all the time |
09:38:46 | FromDiscord | <enthus1ast> cloned and build i mean |
09:38:49 | FromDiscord | <Elegantbeef> Not using 1.6.2... that's a paddling 😀 |
09:39:13 | FromDiscord | <Elegantbeef> I joke cause i'm presently on devel to play with new features! |
09:39:26 | FromDiscord | <Rika> Isnt 1.6.2 the version where a billion regressions reared their heads |
09:39:48 | FromDiscord | <Elegantbeef> Perhaps dont recall, I havent had any issues yet |
09:39:55 | FromDiscord | <Elegantbeef> Thought it was 1.6.0 that had regressions |
09:40:05 | FromDiscord | <Elegantbeef> Surprisingly none have been attributed to my code |
09:40:41 | FromDiscord | <Rika> That could mean no one uses what you added |
09:40:43 | FromDiscord | <Rika> xd |
09:40:47 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/931845359423082526/unknown.png |
09:41:07 | FromDiscord | <Elegantbeef> there we go |
09:41:11 | FromDiscord | <retkid> this is more insightful? |
09:41:21 | FromDiscord | <Rika> Yes |
09:41:45 | FromDiscord | <retkid> im not seein it |
09:42:13 | FromDiscord | <Rika> I intuit that it’s a syntax issue |
09:42:26 | FromDiscord | <Rika> Of course I have no idea because I can’t read the source code |
09:42:27 | FromDiscord | <Elegantbeef> We know it's a lexer issue |
09:42:42 | FromDiscord | <Elegantbeef> I've not touch the lexer so i dont know how to debug it |
09:42:43 | FromDiscord | <retkid> my code is so unreadable that the lexer has given up upon me |
09:42:46 | FromDiscord | <Rika> (I don’t have the source handy right now and I’m on mobile lol) |
09:42:59 | FromDiscord | <Rika> What does the line where it crashes look like at least |
09:43:01 | FromDiscord | <Elegantbeef> Eh the line that's the issue is an `inc` call |
09:43:13 | FromDiscord | <retkid> In reply to @Rika "What does the line": wait where does it say that |
09:43:20 | FromDiscord | <Rika> It’s a question |
09:43:31 | FromDiscord | <retkid> i dont know where it says the line to look at it |
09:43:42 | FromDiscord | <Rika> “What does <the line [of your code] where it crashes> look like, at least?” |
09:43:54 | FromDiscord | <Rika> Ah was it not there I don’t remember |
09:43:56 | FromDiscord | <retkid> ah |
09:43:58 | FromDiscord | <retkid> 78,9 |
09:44:14 | FromDiscord | <Elegantbeef> That line is the last known good line |
09:44:27 | FromDiscord | <retkid> ah |
09:44:31 | FromDiscord | <retkid> so we dont know the line |
09:44:32 | NimEventer | New thread by Argl: Namespaces for non-enums without customizing the import statement?, see https://forum.nim-lang.org/t/8810 |
09:45:07 | FromDiscord | <Elegantbeef> Well i know it's a string literal |
09:45:16 | FromDiscord | <Elegantbeef> So what string lits do you have after line `78` |
09:45:42 | FromDiscord | <Rika> Oh I’m betting it’s an invalid escape code |
09:46:11 | FromDiscord | <Elegantbeef> To answer "how do you know it's a strlit" |
09:46:33 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3MeL |
09:46:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MeM |
09:47:03 | FromDiscord | <Rika> That’s strange |
09:47:33 | FromDiscord | <retkid> something weird with these strings? |
09:47:37 | FromDiscord | <Rika> No |
09:47:38 | FromDiscord | <retkid> its not in tohex |
09:47:41 | FromDiscord | <Rika> That’s the strange thing |
09:47:44 | FromDiscord | <Rika> Nothing looks weird |
09:48:11 | FromDiscord | <retkid> theres no other string literals in this funtion |
09:48:14 | FromDiscord | <Elegantbeef> If you want to know what causes the error you can go to parser.nim line 731 and put `echo p.tok.literal` |
09:48:16 | FromDiscord | <retkid> (edit) "funtion" => "function" |
09:48:23 | FromDiscord | <Elegantbeef> It doesnt have to be in that function |
09:48:27 | FromDiscord | <Rika> Wouldn’t that mean a recompile of the compiler hahaha |
09:48:32 | FromDiscord | <Elegantbeef> It's anywhere after that module and line is processed |
09:48:36 | FromDiscord | <Elegantbeef> Recompilation is quick |
09:48:37 | FromDiscord | <Rika> Another 4 minutes of waiting for you |
09:48:40 | FromDiscord | <Elegantbeef> Nah |
09:48:45 | FromDiscord | <Rika> Ah true I forgot c cache |
09:48:48 | FromDiscord | <retkid> if not then |
09:48:49 | FromDiscord | <Elegantbeef> It's like 30s on hotpath heavy code |
09:48:57 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3MeN |
09:49:00 | FromDiscord | <retkid> (edit) |
09:49:02 | FromDiscord | <retkid> these are also literals |
09:49:05 | FromDiscord | <retkid> but its not in quit |
09:49:22 | FromDiscord | <Rika> Seems fine too |
09:49:23 | FromDiscord | <Elegantbeef> Like i said the easiest thing is to put an echo statement inside that line in parser.nim then rerun the koch command |
09:49:32 | FromDiscord | <retkid> ah yea |
09:49:55 | FromDiscord | <Elegantbeef> It'll barf to your stdout but the last line before the stack trace will be what you need to know |
09:50:52 | FromDiscord | <Elegantbeef> All i can say is i think it's attempting to get a token from a strlit, but I dont know the lexer/parser well |
09:51:14 | FromDiscord | <Elegantbeef> Actually it might be a symbol after the strlit |
09:51:45 | FromDiscord | <Rika> In reply to @NimEventer "New thread by Argl:": Beef do you think this is possible? I’ve been thinking about it for a while and I’ve concluded it isn’t easy with a macro, and that the original syntax is wholly impossible |
09:51:55 | FromDiscord | <Rika> Given the wanted features |
09:52:40 | FromDiscord | <retkid> haha |
09:52:46 | FromDiscord | <retkid> as it compiles its barfing it out |
09:53:16 | FromDiscord | <retkid> so strange how compilers are like dogs chasing their own tails |
09:54:39 | FromDiscord | <Elegantbeef> There you go rika |
09:54:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MeO |
09:54:51 | FromDiscord | <Rika> With the features, that is easy |
09:54:53 | FromDiscord | <Elegantbeef> \export `.` of course\` |
09:55:00 | FromDiscord | <Rika> He also wants aliasing and explicit optional |
09:56:25 | FromDiscord | <Elegantbeef> Nim allows importing symbols with a different prefix |
09:56:44 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3MeP |
09:56:51 | FromDiscord | <retkid> now i dont know if i messed with something causing a differentt issue |
09:57:09 | FromDiscord | <Elegantbeef> `import x as y` is valid so i dont know |
09:57:26 | FromDiscord | <Elegantbeef> `Error: cannot open '../../dev/youtube-filehosting/controller.nimc'` |
09:57:35 | FromDiscord | <retkid> ha |
09:57:46 | FromDiscord | <retkid> my ctrl key is broke |
09:57:48 | FromDiscord | <retkid> it happens |
09:57:55 | FromDiscord | <retkid> alright |
09:57:57 | FromDiscord | <retkid> here we are |
09:58:08 | FromDiscord | <Elegantbeef> I dont know what the person wants is not Nim code |
09:58:11 | FromDiscord | <Elegantbeef> They want C++ code in Nim |
09:58:35 | FromDiscord | <Rika> In reply to @Elegantbeef "Nim allows importing symbols": Well yeah but I think he wants not-file-bound namespaces like in C++ |
09:58:47 | FromDiscord | <retkid> the last string sent into the lexxxer will surprise you |
09:58:47 | FromDiscord | <Rika> I know yeah |
09:58:48 | FromDiscord | <Elegantbeef> I mean it's technically possible with the macrocache |
09:58:50 | FromDiscord | <Rika> It’s just not possible |
09:58:55 | FromDiscord | <Rika> Well |
09:58:58 | FromDiscord | <Rika> I guess? |
09:59:01 | FromDiscord | <Rika> But that’s a lot of work lmfao |
09:59:02 | FromDiscord | <retkid> thats it |
09:59:06 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3MeR |
09:59:09 | FromDiscord | <Elegantbeef> Idneed |
09:59:15 | FromDiscord | <retkid> (edit) "https://play.nim-lang.org/#ix=3MeR" => "https://play.nim-lang.org/#ix=3MeS" |
09:59:17 | FromDiscord | <Elegantbeef> You no longer use the normal nim import system |
09:59:19 | FromDiscord | <retkid> (edit) |
09:59:23 | FromDiscord | <retkid> (edit) |
09:59:36 | FromDiscord | <retkid> the last character is non printable |
09:59:36 | FromDiscord | <Rika> I keep on forgetting the almighty macro cache exists nowadays |
09:59:38 | FromDiscord | <Rika> Hahaha |
09:59:45 | FromDiscord | <retkid> or \n or something idk |
10:00:07 | FromDiscord | <Elegantbeef> well you can do `.toHex` but i think that's the problem |
10:01:02 | FromDiscord | <Elegantbeef> Seems like rika was right |
10:01:11 | FromDiscord | <retkid> what was Rika's guess |
10:01:13 | FromDiscord | <Elegantbeef> that's a first |
10:01:13 | FromDiscord | <retkid> an escape? |
10:01:20 | FromDiscord | <Elegantbeef> A character causing the issue |
10:01:44 | FromDiscord | <retkid> how now i wish i did expr |
10:02:57 | FromDiscord | <Elegantbeef> Anyway there you go you're on the path to becoming a compiler dev now |
10:05:44 | FromDiscord | <retkid> now heres the question bef |
10:05:48 | FromDiscord | <retkid> everything you know about me |
10:05:56 | FromDiscord | <retkid> would you trust me to make a good well thought out PR |
10:06:05 | FromDiscord | <retkid> i would not |
10:06:18 | FromDiscord | <Elegantbeef> Luckily there are multiple other people working on this project |
10:09:01 | FromDiscord | <Elegantbeef> Though it's still odd a str lit causes this, but seems it increments to eternity |
10:11:31 | FromDiscord | <Isofruit> In terms of stability, how stable are concepts? LIke, still a lot of kinks to figure out, just some edgecases, basically ready for the next nim version? |
10:12:02 | FromDiscord | <Elegantbeef> I mean i use them a lot i know there are issues with them but they're very usable |
10:14:10 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:14:59 | FromDiscord | <Elegantbeef> The main issue i think is that Araq doesnt like how cryptic they used to appear |
10:15:31 | FromDiscord | <Elegantbeef> The new concepts are nicer but are also more limited |
10:15:56 | FromDiscord | <Elegantbeef> I personally go for concepts whenever i touch anything that's not truely generic and not constrainable on types |
10:17:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Mf3 |
10:18:41 | FromDiscord | <Elegantbeef> Isofruit asked a question and got nothing but noise |
10:42:20 | FromDiscord | <retkid> so |
10:42:27 | FromDiscord | <retkid> i figured out what it was i think |
10:42:40 | FromDiscord | <retkid> this is the stupidest error I've ever found |
10:42:58 | FromDiscord | <retkid> so the last line looked blank |
10:43:03 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
10:43:10 | FromDiscord | <retkid> (edit) |
10:43:19 | FromDiscord | <retkid> however it was over 10 thousand spaces |
10:43:35 | FromDiscord | <retkid> i somehow just held the spacebar while dazing off at 4 am |
10:44:47 | FromDiscord | <retkid> @Rika idk if you were right or not |
10:49:14 | FromDiscord | <enthus1ast> Haha↵(@retkid) |
10:49:49 | FromDiscord | <enthus1ast> Can recommend the vscode plugin that removes trailing whitespaces on save |
10:50:28 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/931862893786460230/unknown.png |
10:50:33 | FromDiscord | <retkid> this shall never happen again |
10:51:00 | FromDiscord | <enthus1ast> Ah its build in now\: https://stackoverflow.com/questions/30884131/remove-trailing-spaces-automatically-or-with-a-shortcut |
10:51:42 | * | Guest44 joined #nim |
10:51:56 | * | Guest44 quit (Client Quit) |
10:52:27 | FromDiscord | <Rika> Holy shit lmfao |
10:52:57 | FromDiscord | <retkid> In reply to @enthus1ast "Ah its build in": i still use bracket colorizor |
10:53:09 | FromDiscord | <retkid> cant stop me |
10:56:20 | FromDiscord | <Isofruit> In reply to @Elegantbeef "*Isofruit asked a question": I'm curious how they'll end up looking when finalized |
10:56:58 | FromDiscord | <Isofruit> On an unrelated note, man I have no idea which code Django is wrapping when encrypting their stuff but it appears to be a pretty well optimized library |
11:06:29 | FromDiscord | <Isofruit> O.O↵I take that back, for some reason I expected nimcrypto while compiled in debugmode to beat the performance of django which likely wraps a compiled C library somewhere. Things look a bit different when I stop handicapping nimcrypto and build with -d:release |
11:08:30 | FromDiscord | <Isofruit> Crazily enough, the whole thing is still somewhat faster in Django (170ms - 200ms in Django vs. 260ms-290ms in Nim with nimcrypto) but not by enough that I'm too worried |
11:13:28 | * | dv2 joined #nim |
11:22:30 | FromDiscord | <Rika> Crypto libraries are pretty mature and well optimised |
11:28:24 | FromDiscord | <hotdog> In reply to @Isofruit "Crazily enough, the whole": Interesting |
11:28:29 | FromDiscord | <hotdog> How are you testing this? |
11:30:52 | * | jjido joined #nim |
11:32:30 | FromDiscord | <Isofruit> sent a long message, see https://paste.rs/WfO |
11:33:17 | FromDiscord | <Isofruit> That's not going to tell me what my timing on my HTTP Server (since that's a potato and my laptop, while old and crappy, is still faster than that) will be in the end, but it gives me an indicator on how fast they are in relation to each other. |
11:33:29 | FromDiscord | <Isofruit> (edit) "an" => "a rough" |
11:34:43 | FromDiscord | <Isofruit> (edit) "HTTP Server" => "actual server" |
11:37:29 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Mfi |
11:38:15 | FromDiscord | <Isofruit> (edit) "https://play.nim-lang.org/#ix=3Mfi" => "https://paste.rs/bmt" |
11:38:40 | FromDiscord | <Isofruit> So all I can assume that whatever library Django is wrapping is pretty darn good |
11:38:49 | FromDiscord | <Isofruit> (edit) "So all I can assume ... that" added "is" |
11:39:42 | FromDiscord | <Isofruit> (edit) "good" => "good. Since by all means, it's handicapped by everything else this language does, the encryption bit is, I imagine, the only fast part of that API endpoint." |
11:43:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:47:37 | * | neurocyte091709 quit (Ping timeout: 256 seconds) |
11:50:26 | * | neurocyte091709 joined #nim |
12:00:15 | FromDiscord | <hotdog> @Isofruit cool, I think you are right. I’m interested to see how you get on as I’ve also used Django for backends a lot |
12:02:59 | FromDiscord | <Isofruit> The tooling obviously isn't as fleshed out as in Django, but some of the stuff is a dream. I assume you've used Django-REST-Framework at one point? Literally trivial if you also use jsony, you can skip the entire step of setting up serializers, you just directly serialize/deserialize into object types. |
12:03:45 | FromDiscord | <Isofruit> And setting up the models if you use norm + elegantBeef's constructor project is pretty close to Django's model-convenience |
12:03:59 | FromDiscord | <hotdog> In reply to @Isofruit "The tooling obviously isn't": Yeah I use Django pretty much exclusively as just a combo of Django-orm + DRF + Django-admin |
12:05:32 | FromDiscord | <Isofruit> In reply to @hotdog "Yeah I use Django": Once my PR on norm gets through and its next version comes out, norm will also have some helper procs to fetch many-to-one relationships from the model that doesn't have the foreign-key field, as well as many-to-many relationships. Every many to many fetch is still one query though, but at least it tells you at compile time if you're doing sth wrong |
12:05:42 | FromDiscord | <Isofruit> (edit) "doing sth" => "using these helper procs" |
12:06:35 | FromDiscord | <Isofruit> (edit) "though," => "though (so if you want to fetch many-to-many of 2 different entries, that's 2 db queries)," |
12:07:18 | FromDiscord | <Isofruit> But Django admin will be a tough one to say goodbye to, tough enough I might feel tempted to see if I'm competent enough to write a PR for it |
12:07:25 | FromDiscord | <Isofruit> Or see if there's a plugin somewhere or sth |
12:08:21 | FromDiscord | <Isofruit> More likely the latter rather than the former because django admin recreation is likely craptons of work |
12:08:58 | * | neurocyte091709 quit (Ping timeout: 250 seconds) |
12:11:01 | * | neurocyte091709 joined #nim |
12:12:33 | FromDiscord | <hotdog> In reply to @Isofruit "Once my PR on": I’ve been following your PR on GitHub 😊 it’s good to see Norm coming along |
12:12:45 | FromDiscord | <hotdog> I haven’t had time to play with it yet but hopefully soon |
12:13:13 | FromDiscord | <hotdog> In reply to @Isofruit "More likely the latter": Yeah this is a tricky one. One of the main things keeping me stuck on Django |
12:26:29 | FromDiscord | <Rika> Isn’t hashing one of those things easily vectorisable, I forgot |
12:27:56 | FromDiscord | <Isofruit> I'll plead the fifth on that one, I was barely competent enough to comprehend how to use nimcrypto to recreate django's encryption, my knowledge does not go that deeply |
12:29:05 | FromDiscord | <Rika> We’re entering “advanced optimisation” levels, I wouldn’t expect most people to know, even I do not know well |
12:29:40 | FromDiscord | <Isofruit> Good to know that this is at least actually hard for most people 😄 |
12:32:50 | FromDiscord | <Rika> It’s the kinda thing you usually need to read a book or take a proper class on I’m led to believe |
12:48:31 | FromDiscord | <ajusa> In reply to @Isofruit "Once my PR on": I'm looking forward to this PR |
12:53:59 | * | Vladar joined #nim |
12:54:38 | FromDiscord | <Isofruit> In reply to @ajusa "I'm looking forward to": Thanks! I'm honestly fairly excited to see what the final version of that PR will look like, since chances are there are a decent amount of bits and bobs to improve that I may have overlooked |
13:02:54 | FromDiscord | <ajusa> I'm just excited to have Norm be more powerful, so that it can realistically compete with the Python ecosystem. I plan to combine that with my form library to build web apps |
13:11:10 | * | jjido joined #nim |
13:17:56 | adigitoleo | how to get bounds of a slice? tried slice[0] and slice.low but no luck |
13:21:38 | adigitoleo | nvm just have to toSeq first |
13:25:27 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:58:16 | FromDiscord | <haxscramper> .a and .b |
13:58:45 | FromDiscord | <haxscramper> Slice is an object, HSlice, defined in system.nim |
14:12:29 | FromDiscord | <auxym> how do I create an UncheckedArray (of 6 `byte`s) on the stack (ie without casting from `alloc`)? Can I (or should I) cast a nim array? |
14:14:38 | * | neurocyte091709 quit (Ping timeout: 250 seconds) |
14:15:16 | FromDiscord | <auxym> specifically, to call a C function that takes `uint8_t buf[6]` as an argument |
14:17:16 | adigitoleo | haxscramper: thanks |
14:19:21 | * | neurocyte091709 joined #nim |
14:19:38 | FromDiscord | <haxscramper> In reply to @auxym "specifically, to call a": For this one you can start with taking `addr` of an `array[8, uint8]` |
14:20:23 | FromDiscord | <haxscramper> IIRC `UnchekedArray` does not really exist without `ptr` - it is just a wrapper type around C's pointer-can-actually-be-an-array-hack |
14:20:51 | FromDiscord | <haxscramper> So in general, you have to take an address of some data and cast it to `ptr UncheckedArray[T]` |
14:20:54 | FromDiscord | <auxym> ok! just wasn't sure if nim arrays had the same memory layout as a plain c array |
14:22:26 | FromDiscord | <yallxe> how do I convert string to cstring? i've tried doing `cast[cstring](...)` but the output was "". |
14:41:38 | * | arkurious joined #nim |
14:43:11 | FromDiscord | <yallxe> In reply to @yallxe "how do I convert": tried to figure out wtf is going on and actually, if I pass `var string` to `cast[cstring]()`, the output will `""` |
14:43:20 | FromDiscord | <yallxe> but why |
14:50:07 | FromDiscord | <auxym> I'm not sure, but nim strings are quite different internally from raw strings, which are a null-terminated array of chars |
14:51:50 | FromDiscord | <yallxe> In reply to @auxym "I'm not sure, but": yes, i know |
14:52:00 | FromDiscord | <auxym> See this maybe? https://nim-lang.org/docs/system.html#allocCStringArray%2CopenArray%5Bstring%5D |
14:52:23 | FromDiscord | <yallxe> but the issue that `var string` is not converting to `cstring` using cast |
14:52:34 | FromDiscord | <yallxe> while the `let string` or `const string` does |
14:53:20 | FromDiscord | <yallxe> In reply to @auxym "See this maybe? https://nim-lang.org/docs/system.ht": not sure if this is what i need |
14:54:00 | FromDiscord | <yallxe> probably not |
14:55:44 | FromDiscord | <auxym> probably not indeed. Not sure if there's anything built in for what you want or if you'll have to use `copyMem` |
14:58:13 | FromDiscord | <yallxe> In reply to @yallxe "while the `let string`": correction, const string only does. |
15:02:21 | FromDiscord | <Bloss> sent a code paste, see https://paste.rs/Uxf |
15:03:07 | FromDiscord | <haxscramper> you can do this, partially, having two overloads with different names is possible |
15:03:46 | FromDiscord | <haxscramper> so, as usual - "you can probably write a macro for that" |
15:18:21 | * | Vladar quit (Quit: Leaving) |
15:49:30 | * | krux02 joined #nim |
16:04:08 | * | adigitoleo quit (Ping timeout: 260 seconds) |
16:12:18 | FromDiscord | <whisperdev> How does one build an app for iOS or Android with Nim? |
16:12:46 | FromDiscord | <whisperdev> Maybe it would be better for me to go with something mainstream. I just need a simple form with authentication / user management and upload file functionality |
16:13:56 | * | adigitoleo joined #nim |
16:28:11 | * | adigitoleo quit (Ping timeout: 250 seconds) |
16:32:33 | * | adigitoleo joined #nim |
16:56:42 | * | adigitoleo quit (Remote host closed the connection) |
16:57:25 | * | adigitoleo joined #nim |
17:02:25 | * | adigitoleo quit (Remote host closed the connection) |
17:03:08 | * | adigitoleo joined #nim |
17:49:41 | FromDiscord | <demotomohiro> In reply to @whisperdev "How does one build": Nim forum post related to android app: |
17:49:42 | FromDiscord | <demotomohiro> https://forum.nim-lang.org/t/8491 |
17:57:53 | FromDiscord | <ajusa> @whisperdev see https://github.com/iffy/wiish for iOS and Android, haven't tested it myself though |
17:58:51 | FromDiscord | <ajusa> but if you want a tested, mature way to write an iOS app I can't really recommend Nim unless you're willing to spend lots of time |
18:25:39 | FromDiscord | <Tex> What is the best way to profile for bottlenecks in a nim program? Nimprof seems pretty basic compared to something like valgrind. |
18:28:40 | * | noeontheend joined #nim |
18:31:11 | FromDiscord | <treeform> In reply to @Tex "What is the best": I made this but its also pretty basic: https://github.com/treeform/hottie |
18:31:16 | FromDiscord | <treeform> Enough for my use case though. |
18:31:51 | FromDiscord | <treeform> I also use Intel vTune and AMD μProf. |
18:32:52 | FromDiscord | <treeform> Also I use approach where I factor out the slow bits and use dedicated bench_ files with https://github.com/treeform/benchy |
18:33:15 | FromDiscord | <treeform> Kind of like performance unit tests. |
18:35:49 | FromDiscord | <Tex> Anything open source that's jus tlike Intel vTune or AMD uProf? I've heard of dr memory. |
18:35:57 | FromDiscord | <Tex> (edit) "jus tlike" => "just like" |
18:36:13 | FromDiscord | <treeform> I tried open source is it was not good. Don't recommend. |
18:36:42 | FromDiscord | <treeform> Both Intel vTune or AMD uProf are free and only target the chipset. |
18:37:15 | FromDiscord | <Tex> I don't understand what you're saying with you tried open source is it was not good. Nimlang itself is free software under the MIT license. Are you referring to a specfic program? |
18:37:16 | FromDiscord | <treeform> But you need to signup and create account. |
18:37:42 | FromDiscord | <treeform> I am referring to open source perf tiles like Intel vTune or AMD uProf. |
18:37:59 | FromDiscord | <treeform> There just isn't a clear good one. |
18:38:24 | FromDiscord | <treeform> That's why I made my own, after using them. |
18:38:36 | FromDiscord | <treeform> (edit) "tiles" => "tools" |
18:39:22 | FromDiscord | <Tex> Thanks for the info treeform. I'll have to mix and match some utilties should I come across any issues. |
18:40:00 | FromDiscord | <treeform> Closet "Ok" open source one was http://lukestackwalker.sourceforge.net/ |
18:40:07 | FromDiscord | <treeform> great name pun! |
18:40:18 | FromDiscord | <treeform> But it kind of sux. |
18:40:43 | FromDiscord | <Tex> I would definitely vouch for valgrind, but it's linux only and I'm currently on my windows machine. |
18:40:55 | FromDiscord | <treeform> Yeah I mainly do Windows/Mac. |
18:41:13 | FromDiscord | <Tex> If only valgrind didn't make extensive use of linux syscalls. |
18:41:25 | FromDiscord | <treeform> yeah no valgrind for me |
18:41:48 | FromDiscord | <treeform> I think I have my needs covered with `hottie` + `benchy` |
18:41:52 | FromDiscord | <demotomohiro> gprof doesn't work with Nim? |
18:42:30 | FromDiscord | <treeform> I think when I tried gprof I could not get it to work. |
18:42:35 | FromDiscord | <treeform> On windows. |
18:46:45 | FromDiscord | <demotomohiro> When I run `nim c --passC:-pg -d:danger test.nim`, I got many `undefined reference to `fentry'`. |
18:49:33 | FromDiscord | <gnu+linux user> seems this that words for if and when doesnt for case: |
18:49:52 | FromDiscord | <gnu+linux user> sent a code paste, see https://play.nim-lang.org/#ix=3Mi7 |
18:50:34 | FromDiscord | <gnu+linux user> sent a code paste, see https://play.nim-lang.org/#ix=3Mi8 |
18:53:59 | FromDiscord | <demotomohiro> `nim c --passC:-pg --passL:-pg -d:danger test.nim` compiled without error but `gprof test gmon.out` shows empty result. |
19:02:07 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Mif |
19:05:36 | FromDiscord | <mratsim> In reply to @Tex "What is the best": Intel Vtune or Apple Instrument or perf: https://github.com/status-im/nim-taskpools/issues/5↵and https://forum.nim-lang.org/t/8802 |
19:55:40 | * | Gustavo6046 joined #nim |
20:00:01 | * | vicfred joined #nim |
20:42:23 | * | ad-absurdum joined #nim |
20:49:56 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3MiX |
20:50:09 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3MiX" => "https://play.nim-lang.org/#ix=3MiY" |
21:22:23 | FromDiscord | <Isofruit> Does a Data object always contain another data object? |
21:23:07 | FromDiscord | <Isofruit> Like, somewhere that thing must stop, when? |
21:23:20 | FromDiscord | <haxscramper> `ref object` |
21:23:23 | FromDiscord | <haxscramper> `Data = ref object` |
21:23:40 | FromDiscord | <Patitotective> its for my parser: when there are nested sequences i need to save the parent to retake it after the nested sequence ends |
21:23:43 | FromDiscord | <haxscramper> Or you can get smarter with DOD etc., but that depends on what do you use exactly |
21:24:03 | FromDiscord | <haxscramper> In reply to @Patitotective "its for my parser:": so it is an AST basically? |
21:24:08 | FromDiscord | <haxscramper> WIth "up" pointer? |
21:24:21 | FromDiscord | <Patitotective> In reply to @haxscramper "so it is an": _npeg_, or idk what do you mean |
21:24:28 | FromDiscord | <mratsim> In reply to @Patitotective "its for my parser:": make it a ref object |
21:24:32 | FromDiscord | <Patitotective> In reply to @Isofruit "Like, somewhere that thing": the first object does not have a parent |
21:24:46 | FromDiscord | <Isofruit> Then you should express that with Option[Data] |
21:24:55 | FromDiscord | <mratsim> no a ref |
21:24:57 | FromDiscord | <Isofruit> (Imo, not too sure hwat you're trying to do) |
21:24:58 | FromDiscord | <haxscramper> it would have the same illegal recursion error |
21:25:20 | FromDiscord | <haxscramper> make it a reference, because it looks like you can have cycles |
21:25:27 | FromDiscord | <mratsim> you have a tree here, with child keeping a reference to their parent, if it exists. |
21:26:09 | FromDiscord | <mratsim> you can use Option[Data] if Data is a ref object, but it doesn't solve the underlying problem |
21:26:23 | FromDiscord | <mratsim> which is choosing between reference and value types. |
21:26:23 | FromDiscord | <Patitotective> what is option? |
21:26:31 | FromDiscord | <haxscramper> `std/options.Option` |
21:26:34 | FromDiscord | <Isofruit> Option is an alternative representation of nil |
21:26:45 | FromDiscord | <Isofruit> Where you can express that a value might be there or not instead of using nil |
21:26:59 | FromDiscord | <Patitotective> ooh, thats cool |
21:27:04 | FromDiscord | <haxscramper> close but `Option` also allows to do this for non-ref objects |
21:27:13 | FromDiscord | <haxscramper> whereas `nil` requires `ref` or `ptr` data |
21:27:22 | FromDiscord | <haxscramper> but idea is the same - represent optionality |
21:27:35 | FromDiscord | <Isofruit> Yeah, effectively you absolutely positively never want to have to use nil |
21:27:51 | FromDiscord | <Isofruit> Because you can never know when a value is supposed to be able to be nil or not |
21:28:12 | FromDiscord | <Isofruit> With Option you express that "does not exist" is a possibility right then and there, explicitly. |
21:28:31 | FromDiscord | <Isofruit> And force yourself (and others using your code) to at east acknowledge that nil can happen. |
21:28:47 | FromDiscord | <Patitotective> In reply to @haxscramper "`std/options.Option`": that looks no nimmy, will use `std/options` only |
21:29:06 | FromDiscord | <Isofruit> I'm actually not sure where options come from, functional programming language stuff? |
21:29:33 | FromDiscord | <haxscramper> yes |
21:29:38 | FromDiscord | <haxscramper> Option/Either/Result |
21:29:54 | FromDiscord | <yallxe> how do I get the full windows `%appdata%` path? i tried `expandFilename("%appdata%")` but it does not return what i need |
21:30:07 | FromDiscord | <haxscramper> `Option[T]`, `Either[A, B]` and `Result[Err, Ok]` |
21:30:08 | FromDiscord | <yallxe> expandFilename uses current directory |
21:30:14 | FromDiscord | <haxscramper> stdlib only has `Option` |
21:30:25 | FromDiscord | <Isofruit> I was 2 seconds away from being surprised we have Result |
21:30:31 | FromDiscord | <Isofruit> (edit) "being" => "writing that I am" |
21:32:08 | FromDiscord | <Patitotective> Thank you all guys 🙃 |
21:32:59 | FromDiscord | <Isofruit> In reply to @yallxe "expandFilename uses current directory": Sadly I haven't written a single line of code for windows in ages. But isn't appdata an environmental variable? If that's the case, shouldn't it possible to access it as such? |
21:33:36 | FromDiscord | <yallxe> maybe there is some better solution |
21:33:49 | FromDiscord | <yallxe> then getting it throught env vars |
21:33:55 | FromDiscord | <yallxe> (edit) "then" => "thnn" |
21:33:58 | FromDiscord | <yallxe> (edit) "thnn" => "than" |
21:34:28 | FromDiscord | <Isofruit> Fair, but at the very least it provides a base solution which might not be nice but at least means you aren't completely stuck, which is a good first starting point 😄 |
21:34:32 | FromDiscord | <yallxe> well there is getHomeDir() |
21:34:54 | FromDiscord | <yallxe> which will return smth like C:\Users\yallxe\ |
21:35:28 | FromDiscord | <Isofruit> There's also https://nim-lang.org/docs/os.html#getCacheDir |
21:35:43 | FromDiscord | <Isofruit> Which gives you LOCALAPPDATA |
21:37:04 | FromDiscord | <Isofruit> Also https://nim-lang.org/docs/os.html#getAppDir, but that gives you the directory of the executable, not the appdata environmental variable |
21:37:53 | FromDiscord | <Isofruit> And that's all I could find in the os lib, which is the only place where I'd assume this type of proc to be |
21:38:59 | FromDiscord | <yallxe> In reply to @Isofruit "Which gives you LOCALAPPDATA": oh, this one will be great |
21:39:01 | FromDiscord | <yallxe> thanks |
21:39:22 | FromDiscord | <yallxe> i was thinking that it is path to temp or smth |
21:41:50 | FromDiscord | <Isofruit> shrugs, CTRL+F is a powerful tool 😄 |
21:50:17 | FromDiscord | <C7c3r0> hello, can someone guide me on how to import libraries used in python such as `import json` or `import shutil` ?↵I've been googling since yesterday but can't find anything relevant. |
21:50:18 | FromDiscord | <C7c3r0> thank you! |
21:51:01 | FromDiscord | <Isofruit> You're trying to use python libraries in nim code? |
21:51:03 | FromDiscord | <yallxe> In reply to @C7c3r0 "hello, can someone guide": wdym? |
21:51:24 | FromDiscord | <C7c3r0> I am trying to port a python program to nim |
21:51:33 | FromDiscord | <yallxe> In reply to @C7c3r0 "I am trying to": 👀 |
21:51:35 | FromDiscord | <yallxe> but |
21:51:36 | FromDiscord | <yallxe> how |
21:51:49 | FromDiscord | <yallxe> are you literally using the whole python interpreter in nim |
21:51:59 | FromDiscord | <Isofruit> And to do so you want to access python libs and compile them into your nim binary? |
21:52:30 | FromDiscord | <C7c3r0> precisely, I have found the opposite for importing nim libraries to python, but can't find the opposite 😦 |
21:52:41 | FromDiscord | <yallxe> i dont think there is the opposite |
21:52:49 | FromDiscord | <yallxe> well you can import the whole interpreter |
21:52:54 | FromDiscord | <C7c3r0> me too, thus I am asking the community. |
21:52:57 | FromDiscord | <yallxe> like python3.x.dll or smth |
21:53:21 | FromDiscord | <Isofruit> The reason python can wrap nim is because you can turn nim into a binary and call that from python. You can't really compile python in a similar manner |
21:53:28 | FromDiscord | <Isofruit> Well, you can |
21:53:30 | FromDiscord | <Isofruit> Sort of |
21:53:37 | FromDiscord | <Isofruit> But that's not generally what you do in pytho |
21:53:39 | FromDiscord | <Isofruit> (edit) "pytho" => "python" |
21:53:41 | FromDiscord | <C7c3r0> if I code it, which is extensive work as it is.... |
21:54:04 | FromDiscord | <yallxe> are you from windows? |
21:54:05 | FromDiscord | <yallxe> or linux |
21:54:09 | FromDiscord | <C7c3r0> linux |
21:54:13 | FromDiscord | <yallxe> shit |
21:54:18 | FromDiscord | <C7c3r0> I know |
21:54:25 | FromDiscord | <C7c3r0> cause you mentioned .dll |
21:54:46 | FromDiscord | <yallxe> check it out https://github.com/call-042PE/PyInjector |
21:54:53 | FromDiscord | <yallxe> it is not what you need exactly |
21:55:11 | FromDiscord | <yallxe> but it is like the external injection of python into python process |
21:55:24 | FromDiscord | <yallxe> i dont know how to do this on linux |
21:55:28 | FromDiscord | <yallxe> but maybe you know |
21:56:03 | FromDiscord | <Isofruit> Curiosity quesiton, what do you have to achieve from wrapping python code that executes as python code in nim?↵Is this a piece of a larger project that is written in nim and re-coding that particular section would be too much of a pain in the keister? |
21:56:10 | FromDiscord | <Isofruit> (edit) "have" => "wish" |
21:57:02 | FromDiscord | <yallxe> In reply to @yallxe "check it out https://github.com/call-042PE/PyInject": what it actually does it takes python's dll from process and executing python code through it's functions |
21:57:12 | FromDiscord | <C7c3r0> it is for my understanding of Nim and it's objects.↵It is from an older project and will help me create better rapture with the language itself. |
21:57:36 | FromDiscord | <Isofruit> Ahhh it's something for you to get used to nim, check |
21:58:33 | FromDiscord | <C7c3r0> some `imports` I'm using are not present in Nim, and it is really a versatile language from what I read yesterday.↵I was looking to go for `Julia-Lang` but eventually got my eyes here. |
21:58:35 | FromDiscord | <yallxe> well i have an idea how to execute python code in nim |
21:58:36 | FromDiscord | <yallxe> but on windows |
21:59:24 | FromDiscord | <C7c3r0> i really need to make that port for all OS.↵If C is prevalent in an OS Nim will compile and execute as I've come to understand. |
21:59:49 | FromDiscord | <Isofruit> Pretty much, the compilation step goes pretty much nim --> C --> binary |
22:00:18 | FromDiscord | <Isofruit> (if you want binaries, you can of course also compile to JS and other stuff, there's tons of options) |
22:01:10 | FromDiscord | <C7c3r0> C# or CPP? |
22:01:28 | FromDiscord | <Isofruit> The mother of em all, just pure C as far as I'm aware |
22:02:20 | FromDiscord | <Elegantbeef> C is a rather good language for a IR since there are so many devices with either a C/C++ compiler |
22:02:40 | FromDiscord | <Isofruit> By default it uses the C compiler that your OS uses by default, I was taught pretty much the same information on a convo in the offtopic channel not too long ago |
22:02:41 | FromDiscord | <Isofruit> one sec |
22:02:45 | FromDiscord | <Elegantbeef> But there is also `nlvm` which uses llvm as a backend |
22:03:35 | FromDiscord | <Isofruit> https://discord.com/channels/371759389889003530/371759607934353448/931284029939007549↵You can start reading from there and read your way down a lot of the comments from leorize and Yardanico, they are a lot more knowledgeable about this stuff than I |
22:03:47 | FromDiscord | <C7c3r0> Thank you Isofruit. |
22:05:20 | FromDiscord | <Isofruit> Glad to share what I've been taught, though the thanks belongs more to Yardanico and leorize |
22:05:36 | FromDiscord | <leorize> are you looking for this? https://github.com/yglukhov/nimpy↵(@C7c3r0) |
22:06:31 | FromDiscord | <C7c3r0> GOD yas! |
22:06:48 | FromDiscord | <Isofruit> sports commentator voice↵And out of left field comes leorize, and he comes with a solution! |
22:09:14 | FromDiscord | <pmunch> Note, if you're porting a Python library to Nim you should probably use the equivalent Nim modules instead of delegating to Python |
22:11:16 | FromDiscord | <C7c3r0> these bots are awesome! |
22:11:28 | FromDiscord | <Elegantbeef> Quite possibly not bots |
22:11:38 | FromDiscord | <Isofruit> Shush beef, accept your bot life |
22:11:44 | FromDiscord | <Elegantbeef> The jury is still out though i hear pmunch occasionally "beep boop" |
22:11:46 | FromDiscord | <C7c3r0> is this AI? |
22:11:55 | FromDiscord | <C7c3r0> is this convergence ? |
22:11:55 | FromDiscord | <Isofruit> Nah, they're using a different client |
22:12:01 | FromDiscord | <C7c3r0> ❤️ |
22:12:03 | FromDiscord | <Isofruit> matrix IIRC |
22:12:10 | FromDiscord | <vindaar> @C7c3r0\: as you mentioned julia earlier, there's also https://github.com/Clonkk/nimjl |
22:12:18 | FromDiscord | <Elegantbeef> It's emergent intelligence, 4 billion years ago life started and over time brains developed |
22:12:34 | FromDiscord | <Elegantbeef> Eventually those brains decided to use matrix/irc instead of discord |
22:12:44 | FromDiscord | <vindaar> no, I'm an AGI of course |
22:13:05 | FromDiscord | <Isofruit> y'all just GPT3 on a couple ego trips |
22:14:46 | FromDiscord | <Elegantbeef> You know it |
22:14:55 | FromDiscord | <Elegantbeef> GPT3 constructor comes out tomorrow 😛 |
22:16:43 | FromDiscord | <Isofruit> Sidenote, constructor did not yet blow up in my face even though I've thrown it at like... 30 different models or sth, am very satisfied, I managed to delete at least 200-300 lines of code thanks to it |
22:17:54 | FromDiscord | <Isofruit> 4.5/5, full rating if it also manages to cook breakfast for me |
22:21:43 | FromDiscord | <Isofruit> Unrelated sidenote, because I'm wondering whether I should just have these warnings suppressed or not |
22:22:41 | FromDiscord | <Isofruit> I've got procs that delete/insert/update entries in a database using norm. The procs norm provides are decidedly not gc-safe |
22:23:39 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Mjj |
22:24:04 | FromDiscord | <Isofruit> What I get in return is repeatedly the compiler warning:↵`'createEntry' is not GC-safe as it calls 'insert' [GcUnsafe2]` |
22:24:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Mjk |
22:24:55 | FromDiscord | <Elegantbeef> But there is the question of "why would you lie" 😛 |
22:26:17 | FromDiscord | <Elegantbeef> Guess it depends on which gc you want to support |
22:26:23 | FromDiscord | <leorize> one of the few case I wished ormin works \:p |
22:26:38 | FromDiscord | <Isofruit> I was less wondering how to shut the compiler up and more whether the compiler's warning is like an old grandmother telling me to put a second jacket over the first because it's cold outside at 6°C, or whether the compiler right now is telling me I'm 5 cm away from falling down the abyss |
22:26:56 | FromDiscord | <Elegantbeef> It's more about threading + GV |
22:27:00 | FromDiscord | <Elegantbeef> ● GC \ |
22:27:16 | FromDiscord | <leorize> what does generic have to do with gcsafe? |
22:27:25 | FromDiscord | <leorize> I suppose you are calling this stuff in async procs? |
22:27:57 | FromDiscord | <Isofruit> I recalled that if I didn't have them here I'd have them all over my individual repositories (which do barely more than call procs of the generic repository, but with explicit types) |
22:28:16 | FromDiscord | <Isofruit> (edit) "I recalled that if I didn't have them here I'd have them ... all" added "(the warnings)" |
22:28:20 | FromDiscord | <Isofruit> let me see what happens if I remove them now |
22:29:05 | FromDiscord | <Isofruit> Never mind, my stuff straight up no longer compiles if I remove the "gcsafe" pragma from my generic delete proc |
22:29:32 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Mjl |
22:30:06 | FromDiscord | <Elegantbeef> Well `getDatabaseConnection` is a sure fire way of being gc unsafe 😀 |
22:30:12 | FromDiscord | <Isofruit> leorize: Pretty much |
22:31:02 | FromDiscord | <Isofruit> Would it make things worse if I revealed I haven't yet implemented connection pooling, so "getDatabaseConnection" creates a new database connection to my sqlite file all the time? |
22:31:30 | FromDiscord | <leorize> looks like it uses the exact same connection, hence gcsafe warnings |
22:32:11 | FromDiscord | <Elegantbeef> Not really, the issue is that `getDatabaseConnection()` i assume uses GC'd memory which means it's unsafe |
22:32:19 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3Mjn |
22:32:25 | FromDiscord | <leorize> obviously the way out is to use cps which doesn't care about gcsafe /s |
22:32:41 | FromDiscord | <leorize> oh then yea that will open a new database everytime↵(@Isofruit) |
22:32:47 | * | vicfred quit (Quit: Leaving) |
22:32:48 | FromDiscord | <leorize> your issue is that you are accessing a global |
22:33:32 | FromDiscord | <Isofruit> I eventually wanted to move over to connection pools since I recall that being a standard implemented in every web framework I ever used |
22:33:57 | FromDiscord | <Isofruit> Just didn't get around to that yet because busy implementing other stuff |
22:35:18 | FromDiscord | <Isofruit> In reply to @leorize "oh then yea that": So the gcsafe warnings are the compiler not knowing I have a very silly implementation there? |
22:35:54 | FromDiscord | <Elegantbeef> Yea using that global GC'd memory is always going to be an issue |
22:36:21 | FromDiscord | <Elegantbeef> The GC warnings are basically saying "This is not thread safe" |
22:36:46 | FromDiscord | <Elegantbeef> If you arent multi threading you can use the cast above to hide the errors, which is fine on Orc/Arc |
22:37:10 | FromDiscord | <Elegantbeef> If you are using refc + multithreading you'd have to properly share the variable across the threads |
22:37:16 | FromDiscord | <Isofruit> Nah, I likely am not multi threading but this is also for learning purposes, so doing it the "right" way there is the way to go for me |
22:37:43 | FromDiscord | <Isofruit> Wait, wouldn't a connection pool address exactly that issue? |
22:37:47 | FromDiscord | <leorize> it's a stupid warning, you don't have to care too much about it \:p |
22:38:01 | FromDiscord | <Elegantbeef> A connection pool would be global GC'd memory still |
22:38:06 | FromDiscord | <Elegantbeef> It's the same issue just more sophisticated |
22:38:44 | FromDiscord | <Elegantbeef> Comically in the compiler there is a note of "Hey if it's gcsafe it's threadsafe" which tells you everything you need to know about gcsafe 😛 |
22:39:21 | FromDiscord | <Elegantbeef> Nim's async doesnt use a second thread afaik so you dont need to worry about threadsafe afaiik |
22:39:22 | FromDiscord | <Isofruit> Ohh, so effectively it's saying "you're giving this memory back, but I can't guarantee that this memory will be allocated by your program the entire time you're using it" ? |
22:39:51 | FromDiscord | <Isofruit> (edit) "giving" => "passing" | "back," => "location from the proc to your caller," |
22:40:06 | FromDiscord | <Isofruit> (edit) "time you're using it"" => "runtime of your program"" |
22:40:29 | FromDiscord | <Elegantbeef> Eh i dont get gc unsafe procs much, generally just ignore them unless i'm multi threading |
22:40:36 | FromDiscord | <Isofruit> In reply to @leorize "it's a stupid warning,": It spams across my terminal every compilation! It annoys me! |
22:41:02 | FromDiscord | <Isofruit> ~~Literally the only reason I actually remove unused imports~~ |
22:41:04 | FromDiscord | <Elegantbeef> Like i said you can {.cast(gcsafe).}\:\` |
22:41:50 | FromDiscord | <Isofruit> Yeh but that circumvents my chance to actually learn a bit more what's going on there and how I'd solve it if I wanted to multithread |
22:42:05 | FromDiscord | <Elegantbeef> I mean depending on your GC that's a multithread solution |
22:42:47 | FromDiscord | <Isofruit> gcsafe just states that it isn't safe for all gcs, but is for some? |
22:43:07 | FromDiscord | <Elegantbeef> Well Orc/Arc have a shared heap |
22:43:23 | FromDiscord | <Elegantbeef> So as long as you know the variable isnt going to get collected it's gcsafe |
22:44:03 | FromDiscord | <Elegantbeef> The one solution you could do is pass a data base connection down i think, but i dont know i generally ignore gcsafe warnings unless i'm doing thread stuff |
22:45:19 | FromDiscord | <leorize> atm gcsafe is more noise than helpful, unfortunately |
22:45:43 | arkanoid | how can I call a function on a result of collect without storing it first in a variable? |
22:46:09 | arkanoid | (collect(newSeq): for x in y: x).len doesn't work |
22:46:12 | FromDiscord | <Isofruit> have the procs first parameter be seq[whatever you were collecting] ? |
22:47:33 | FromDiscord | <leorize> https://play.nim-lang.org/#ix=3Mjr |
22:47:56 | FromDiscord | <leorize> if you need more than one parameter, you have to store it in a variable |
22:49:20 | arkanoid | what is happening here? using len as a block? |
22:51:23 | FromDiscord | <Isofruit> In reply to @Elegantbeef "So as long as": I think I'm still getting stuck on where the compiler thinks this might be dangerous.↵regardless of the way I'm reference counting, the `DbConn` variable always has a reference in the one proc that it is called in. ↵Is the danger here that I might have 2 DbConns to the same database and the compiler is warning me "if both of these are firing a delete I don't know what'll happen" ? |
22:51:38 | FromDiscord | <Isofruit> (edit) "In reply to @Elegantbeef "So as long as": I think I'm still getting stuck on where the compiler thinks this might be dangerous.↵regardless of the way I'm reference counting, the `DbConn` variable always has a reference in the one proc that it is called in. ↵Is the danger here that I might have 2 DbConns to the same database and the compiler is warning me "if both of these are firing a delete ... I" added "in parallel" |
22:51:51 | FromDiscord | <leorize> it's the expression-block syntax |
22:51:59 | FromDiscord | <leorize> typically used with templates/macros |
22:52:07 | FromDiscord | <leorize> but it works with anything |
22:53:40 | FromDiscord | <leorize> I think the fault lies in your applicationSettings, which I imagine is a ref↵(@Isofruit) |
22:54:10 | FromDiscord | <Isofruit> > const database = "db.sqlite3" |
22:55:24 | arkanoid | So the "block" keyword is used only when assigning variables? Can I use that syntax with any 1 arg function? Sweet |
22:55:48 | FromDiscord | <leorize> you can use that syntax for the last parameter of any function |
22:56:05 | FromDiscord | <leorize> not necessarily 1 arg, similar to templates/macros |
22:56:26 | arkanoid | last? ok, just like body |
22:56:30 | arkanoid | got it |
22:56:49 | arkanoid | not sure if idiomatic, but I like this with collect |
22:57:36 | FromDiscord | <leorize> idiomatic enough \:p I abuse this syntax all the time when writing macros |
22:58:17 | FromDiscord | <Isofruit> So the string is heap allocated and thus a reference type. I think my lack of knowledge with closer-to-the-metal languages is showing here, I'm failing to bring that logic chain to the conclusion "and that's why it's potentially problematic under some multithreadng-circumstances" |
22:58:17 | FromDiscord | <leorize> the danger is that accessing the same `ref` in two threads is not safe and is undefined behavior↵(@Isofruit) |
22:58:32 | FromDiscord | <Isofruit> But it's a const and thus read only, wouldn't the compiler know that? |
22:58:35 | FromDiscord | <leorize> this warning strictly act on `ref` |
22:58:51 | FromDiscord | <leorize> if it doesn't have `ref` in its definition, it doesn't count |
22:59:19 | FromDiscord | <leorize> string is a value type in nim, don't worry |
23:00:15 | arkanoid | I'm quite sad that there's no GUI lib/binding for nim on to the same level used for professional looking programs. I've just messed up with nimx and nimqml, but both lacks what the industry expects. Wnim is windows only, maybe I try gintro |
23:00:40 | FromDiscord | <leorize> gintro is great for linux, not so much on windows, though |
23:01:12 | arkanoid | qt was my best bet, but there's not enough love for it within nim community |
23:02:01 | FromDiscord | <Isofruit> Weren't gtk and Qt very wrappable? |
23:02:13 | FromDiscord | <leorize> qt is the opposite of wrappable \:p |
23:02:38 | arkanoid | not sure how other large libraries are doint it |
23:02:50 | arkanoid | *large languages/communities |
23:02:57 | arkanoid | rust/go/etc |
23:02:58 | FromDiscord | <Isofruit> My frontend coding consists of HTML CSS and JS, I know of gtk and qt, haven't worked with them (yet) |
23:03:54 | arkanoid | Isofruit, but do you do also desktop application? I'm struggling in findind the sweet spot to keep using nim instead of python for a kinda data-analysis desktop app |
23:04:44 | FromDiscord | <leorize> they all have specially created generators to wrap those apis |
23:05:06 | FromDiscord | <Isofruit> I do not dare call anything related to HTML CSS and JS as desktop application, even though I think I strictly speaking could. As such, I've done mostly CLI stuff on desktop when it wasn't a server |
23:05:21 | FromDiscord | <Isofruit> (edit) "a server" => "web stuff" |
23:05:57 | FromDiscord | <leorize> qt qml is usable in nim iirc |
23:06:23 | arkanoid | yeah but I have to present lot's of tables and also maps, so while doing electron-like desktop app is feasible, I wantes to stick with real native stuff for performance |
23:06:40 | FromDiscord | <leorize> https://github.com/status-im/status-desktop \<- this is an app using qml in nim |
23:07:36 | arkanoid | leorize, yeah, I'm using it right, here's my toy project https://github.com/arkanoid87/nimmap |
23:07:51 | arkanoid | is status-desktop using nimqml? |
23:08:35 | FromDiscord | <Isofruit> I assume so https://media.discordapp.net/attachments/371759389889003532/932048650643857408/Screenshot_from_2022-01-16_00-08-21.png |
23:08:39 | arkanoid | point is that nimqml is one-man project, also is composed of 2 libraries: dotherside (cpp -> c), and nimqml (c -> nim) |
23:09:08 | FromDiscord | <Isofruit> Oh you were asking nimqml the lib, not just qml |
23:09:10 | FromDiscord | <Isofruit> Nevermind my post |
23:09:43 | FromDiscord | <leorize> they use their own fork\: https://github.com/status-im/nimqml |
23:09:44 | arkanoid | well, they apparently do use NimQml |
23:10:04 | arkanoid | This branch is 56 commits ahead, 8 commits behind filcuc:master. Interesting |
23:11:29 | arkanoid | thanks, this is very interesting. I'm testing nimqml right now but the memory model is not documented, and I'm experiencing leaks |
23:11:42 | arkanoid | I have to find out what's the proper use pattern |
23:12:53 | arkanoid | thanks leorize for nimqml by status link, I was not aware of it, this boost my confidence |
23:15:22 | FromDiscord | <Isofruit> sent a long message, see http://ix.io/3Mjy |
23:15:57 | FromDiscord | <Isofruit> (edit) "http://ix.io/3Mjy" => "http://ix.io/3Mjz" |
23:15:59 | FromDiscord | <leorize> uh... no |
23:16:05 | FromDiscord | <leorize> your bug have nothing to do with that string |
23:16:13 | FromDiscord | <leorize> I thought applicationSettings was a ref |
23:16:14 | FromDiscord | <Isofruit> (edit) "http://ix.io/3Mjz" => "http://ix.io/3MjA" |
23:16:22 | FromDiscord | <leorize> but since it's a const, it's not the issue here |
23:17:26 | FromDiscord | <Isofruit> Ahhhh okay, resetting mind and contemplating where else that potential issue might be. And chances are it's not as the warning says something with insert? |
23:17:42 | arkanoid | hooray, I've just found that status is dealing with the same object creation/delete of nimqml I was figuring out. Good news! |
23:18:02 | FromDiscord | <Isofruit> As the warning goes "since insert/delete/updatre isn't gc-safe, your proc can't be gc-safe either" |
23:18:07 | FromDiscord | <Isofruit> (edit) "insert/delete/updatre" => "insert/delete/update" |
23:18:21 | FromDiscord | <leorize> I guess you found your issue \:p |
23:18:24 | FromDiscord | <ajusa> Anyone know if beef's constructor works with default values?↵`proc initField(label = "", default = "", widget = defaultInput): Field {.constr.} = discard` gives me a segfault, though the manual version where I set each field works fine. |
23:18:29 | FromDiscord | <leorize> it's in those insert/delete/etc. |
23:18:43 | FromDiscord | <leorize> not sure what is used in there but if the compiler said so it must be due to that |
23:19:18 | FromDiscord | <leorize> summon the man is the best way \:P [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)↵(@ajusa) |
23:20:42 | FromDiscord | <Isofruit> as someone who also uses beefs constructor, I'm not sure I see your goal, why not use the "newField" proc the call of "implDefaults(Field)" will have created for you? |
23:20:56 | FromDiscord | <Elegantbeef> It should work with defaults |
23:21:01 | FromDiscord | <Elegantbeef> If it doesnt it needs fixed |
23:21:02 | FromDiscord | <Isofruit> (I'll just go ahead and assume you use constructor/defaults) |
23:21:20 | FromDiscord | <ajusa> I don't use constructor/defaults, do I need to for this behavior? |
23:22:15 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3MjB |
23:22:42 | arkanoid | I find object + plain initObject + plain list of getters quite boring to setup (like here https://github.com/status-im/status-desktop/blob/8dace226c549a1e5a357c6c99f51a7b52e226b13/src/app/modules/startup/onboarding/item.nim) do you know if there's an existing widely used macro to handle this? |
23:23:12 | FromDiscord | <leorize> constructor solve one part of it |
23:23:26 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3MjC |
23:25:08 | FromDiscord | <ajusa> Should I open an issue, or did I misunderstand what you meant when you said "It should work with defaults"? |
23:26:23 | FromDiscord | <Elegantbeef> open an issue that should work |
23:27:53 | * | jjido joined #nim |
23:28:22 | FromDiscord | <Elegantbeef> Lol whoops my recent constructor repo has a `echo result.repr` mybad 😀 |
23:29:41 | FromDiscord | <Isofruit> In reply to @arkanoid "I find object +": https://github.com/beef331/constructor if you're searching for the way to get init functions built for you |
23:30:14 | FromDiscord | <ajusa> opened the issue, sorry for lack of MWE. hopefully it's just a simple fix though |
23:33:57 | FromDiscord | <Elegantbeef> What nim version are you on? |
23:34:13 | FromDiscord | <ajusa> 1.6.0 |
23:34:50 | FromDiscord | <Elegantbeef> I dont get the segfault but i do get a bug |
23:35:49 | FromDiscord | <ajusa> the segfault happens in my own code when it tries accessing and using one of the fields, I assume it's being set to nil |
23:35:56 | FromDiscord | <Elegantbeef> Yea it is |
23:36:04 | FromDiscord | <Elegantbeef> I dont think i handled exported fields |
23:36:28 | FromDiscord | <Elegantbeef> Yea that's iit |
23:37:01 | FromDiscord | <Elegantbeef> I was a dumb dumb |
23:37:31 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3MjH |
23:38:17 | FromDiscord | <Isofruit> (edit) "https://play.nim-lang.org/#ix=3MjH" => "https://play.nim-lang.org/#ix=3MjI" |
23:38:19 | FromDiscord | <Elegantbeef> @ajusa\: `1.0.1` is your golden goose |
23:39:01 | FromDiscord | <ajusa> works! thanks you so much 😄 |
23:39:51 | FromDiscord | <Elegantbeef> No problem |
23:45:36 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3MjN |
23:46:00 | FromDiscord | <Isofruit> I tend to have types with a lot more fields 😛 |
23:46:19 | FromDiscord | <Elegantbeef> And now with `1.0.2` you can just do `proc initField(label = "", default = "", widget = defaultInput): Field {.constr.}` |
23:46:29 | FromDiscord | <Elegantbeef> We can abuse forward declare syntax to make that work! |
23:46:56 | FromDiscord | <ajusa> so you got rid of the discard + =? neato, guess I'm updating |
23:48:14 | FromDiscord | <Isofruit> Issues to tackle tomorrow maybe:↵file upload↵basic signal system↵image-conversion signal |
23:49:22 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3MjP |
23:49:56 | FromDiscord | <Isofruit> ... that counts as abuse? |
23:50:04 | FromDiscord | <ajusa> 141 char line vs two lines, the hardest choices require the strongest wills |
23:50:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3MjQ |
23:51:13 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3MjR |
23:51:49 | FromDiscord | <Elegantbeef> ah sorry should be named `opts` |
23:51:49 | FromDiscord | <Elegantbeef> or something other than the field name |
23:52:32 | FromDiscord | <Elegantbeef> Well i'm off to get some food, so dont abuse constr too much 😛 |
23:52:53 | FromDiscord | <ajusa> ah gotcha, that works. have a nice meal! |
23:59:25 | FromDiscord | <C7c3r0> hi again, I see that I can declare floats in NIM, but I don't see any reference as to how doubles are declared |