00:01:01 | * | kapil____ quit (Quit: Connection closed for inactivity) |
00:02:18 | * | demond joined #nim |
00:02:30 | * | demond left #nim ("++++++") |
01:03:44 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
02:07:08 | * | Cthalupa quit (Ping timeout: 245 seconds) |
02:08:04 | * | Cthalupa joined #nim |
02:25:01 | * | plushie quit (Quit: plushie) |
03:00:08 | * | banc quit (Quit: Bye) |
03:03:39 | FromGitter | <m4d3bug> anyone knows how to install the local nimble's packeage and check the version of it? |
03:09:44 | * | abm quit (Ping timeout: 268 seconds) |
03:16:25 | * | banc joined #nim |
03:28:30 | * | Cthalupa quit (Ping timeout: 250 seconds) |
03:30:12 | * | Cthalupa joined #nim |
04:14:56 | * | kapil____ joined #nim |
04:40:14 | shashlick | You just run nimble install in the folder with the nimble file |
04:40:36 | shashlick | Check version in the nimble file or with nimble path pkgname |
05:39:37 | * | craigger_ quit (Quit: bye) |
05:42:17 | * | craigger joined #nim |
05:57:12 | * | azuri5 joined #nim |
06:09:26 | * | nsf joined #nim |
06:33:53 | * | kapil____ quit (Quit: Connection closed for inactivity) |
06:40:50 | * | Cthalupa quit (Ping timeout: 272 seconds) |
06:42:00 | * | Cthalupa joined #nim |
07:09:00 | * | Cthalupa quit (Ping timeout: 268 seconds) |
07:11:05 | * | Cthalupa joined #nim |
07:15:30 | * | azuri5 quit (Quit: azuri5) |
07:47:39 | * | azuri5 joined #nim |
08:04:16 | FromGitter | <zacharycarter> shashlick: I tried nimterop - https://gist.github.com/zacharycarter/1e28d218df3000e712e1888eb2a2a4bc |
08:04:23 | FromGitter | <zacharycarter> but it is throwing errors |
08:09:37 | * | azuri5 quit (Quit: azuri5) |
08:13:20 | shashlick | first blood |
08:15:24 | shashlick | I presume you are using https://github.com/floooh/sokol/blob/master/sokol_app.h |
08:23:07 | shashlick | you shouldn't define SOKOL_IMPL since you really only want to pull in the procs and structs/enums |
08:23:44 | shashlick | of course nimterop doesn't recognize anything even without that |
08:26:32 | * | xet7 quit (Ping timeout: 244 seconds) |
08:44:03 | FromGitter | <zacharycarter> yeah |
08:44:11 | FromGitter | <zacharycarter> hmm - I think first I need to get this working without nimterop |
08:44:17 | FromGitter | <zacharycarter> which I'm struggling through now... |
08:44:35 | * | azuri5 joined #nim |
08:44:44 | FromGitter | <zacharycarter> stupid clang is giving me a huge headache... |
08:46:10 | FromGitter | <zacharycarter> `nim c --nimcache:. --noMain --noLinking --header:rvb.h rvb.nim` |
08:46:17 | FromGitter | <zacharycarter> `clang -I/Users/zachcarter/.choosenim/toolchains/nim-0.19.0/lib –framework Foundation -fobjc-arc *.c` |
08:46:24 | FromGitter | <zacharycarter> ```clang: error: no such file or directory: 'Foundation'`````` |
08:46:26 | FromGitter | <zacharycarter> wtf..... |
08:49:50 | shashlick | minor grammar limitations - will fix in nimterop |
08:53:38 | FromGitter | <zacharycarter> I think I'm getting somewhere |
09:06:07 | * | azuri5 quit (Quit: azuri5) |
09:10:03 | FromGitter | <zacharycarter> okay - I almost got sokol_app working (I think) - but I'm encountering something strange |
09:10:28 | FromGitter | <zacharycarter> I have this Nim proc signature - `proc entry(argc: cint; argv: UncheckedArray[cstring]): sapp_desc {. ⏎ exportc.} = discard` |
09:10:53 | FromGitter | <zacharycarter> I don't understand why - but the C code it's generating is - `N_NIMCALL(void, entry)(int argc, tyArray_z9ac6Ez5VSEHe9bC2NMwuc7Q argv, tyObject_sapp_desc_koj3ul75m4z2W3jZTshMHw* Result);` |
09:11:03 | FromGitter | <zacharycarter> the return type is becoming a parameter |
09:16:26 | FromGitter | <zacharycarter> I guess that's just how it works and I've never tried calling Nim from C before? |
09:20:06 | * | stefanos82 joined #nim |
09:23:42 | leorize | zacharycarter: you should look into the `N_NIMCALL()` macro |
09:24:03 | leorize | oh, it does become a parameter here |
09:24:07 | leorize | no idea why |
09:32:45 | FromGitter | <zacharycarter> I think the solution to all of this is just to port sokol to Nim |
09:32:47 | FromGitter | <zacharycarter> :P |
09:32:59 | FromGitter | <zacharycarter> or at least sokol_app |
09:33:03 | FromGitter | <zacharycarter> that's all I'm after atm anyway |
09:39:38 | * | xet7 joined #nim |
09:45:54 | * | azuri5 joined #nim |
09:56:49 | * | azuri5 quit (Ping timeout: 250 seconds) |
10:04:16 | * | dorelix quit (Remote host closed the connection) |
10:31:16 | * | krux02 joined #nim |
10:34:11 | * | Trustable joined #nim |
10:53:33 | FromDiscord_ | <exelotl> I hadn't heard of sokol before, it looks very nice :D |
11:06:59 | * | krux02 quit (Remote host closed the connection) |
11:07:27 | * | wildlander quit (Quit: Konversation terminated!) |
11:42:50 | * | stefanos82 quit (Remote host closed the connection) |
11:47:38 | * | Trustable quit (Remote host closed the connection) |
12:07:11 | * | NimBot joined #nim |
12:31:04 | FromGitter | <zacharycarter> exeltol: may want to check out oryol as well |
12:45:45 | FromGitter | <zacharycarter> anyone know why nimpretty - when formatting on save in VSCode is adding a line of whitespace every time I save? |
12:56:42 | FromGitter | <zacharycarter> I'm finding it difficult to exactly understand what nimpretty does |
13:03:04 | * | narimiran joined #nim |
13:05:09 | FromGitter | <zacharycarter> seems to line everything up to wherever the first line is indented - which isn't want I want |
13:11:20 | FromGitter | <gogolxdong> windows build failed Error: cannot open 'C:\Nim\tools\vccenv\vccexe.nim' |
13:18:07 | * | steshaw quit (Quit: Connection closed for inactivity) |
13:41:55 | * | kapil____ joined #nim |
13:48:16 | FromGitter | <gogolxdong> ./koch.exe tools |
13:51:54 | * | krux02 joined #nim |
13:52:41 | FromGitter | <gogolxdong> ah, remove the old ./kock.exe and build from csource works. |
13:55:00 | * | Vladar joined #nim |
13:57:03 | * | azuri5 joined #nim |
14:00:55 | * | wildlander joined #nim |
14:07:42 | * | whaletechno joined #nim |
14:58:02 | * | Vladar quit (Remote host closed the connection) |
14:58:32 | FromGitter | <Varriount> @zacharycarter Interesting... Do you have screenshots? |
14:58:34 | * | Tyresc joined #nim |
15:23:02 | * | azuri5 quit (Quit: azuri5) |
15:26:08 | * | filcuc joined #nim |
15:27:41 | filcuc | is correct that nimsuggest doesn't give any suggestion to files that are not "imported" from the project file |
15:27:42 | filcuc | ? |
15:29:03 | filcuc | with this behaviour it seems like that the only option for an IDE is to launch an instance for each .nim file |
15:29:08 | filcuc | correct? |
15:29:21 | * | azuri5 joined #nim |
15:29:36 | leorize | it should be able to provide suggestion for any .nim file |
15:29:48 | leorize | if not then it's a bug I believe |
15:30:06 | leorize | nimsuggest is meant to be run once per project |
15:35:07 | filcuc | leorize: it seems to work only for nim files somehow connected to the project file |
15:35:49 | filcuc | leorize: checking what vscode plugin does confirm me |
15:35:57 | filcuc | leorize: it spawns a nimsuggest instance for nim file |
15:37:25 | filcuc | leorize: same the emacs plugin |
15:37:46 | filcuc | (and now i'm working on integrating nimsuggest to qtcreator) |
15:38:01 | filcuc | https://codereview.qt-project.org/#/c/248612/ |
15:39:02 | * | azuri5 quit (Quit: azuri5) |
15:42:42 | * | azuri5 joined #nim |
15:44:09 | * | xet7_ joined #nim |
15:46:35 | * | Sembei joined #nim |
15:46:46 | * | Pisuke quit (Ping timeout: 272 seconds) |
15:48:16 | * | xet7_ quit (Client Quit) |
15:49:04 | * | xet7 quit (Quit: Leaving) |
15:54:01 | * | xet7 joined #nim |
16:10:28 | * | abm joined #nim |
16:15:27 | * | abm quit (Quit: Leaving) |
16:20:30 | dom96 | filcuc: AFAIK you can just make requests on files that are not a part of your project and nimsuggest will automagically parse it |
16:20:52 | dom96 | If VS Code and Emacs are creating a separate instance of nimsuggest for each file then that is pretty bad |
16:31:40 | filcuc | dom96: it works only if the given file is referenced from the "project" file |
16:31:46 | filcuc | dom96: at least that's what i see |
16:32:12 | filcuc | dom96: i do understand that from emacs POV there's no concept of project so for emacs this behaviour is fine |
16:32:42 | filcuc | dom96: but for vscode no. And i think that the author worked around this issue by simply creating multiple instances of nimsuggests |
16:33:16 | dom96 | It's not about the editor though. Nim has a concept of a project in this case |
16:34:11 | dom96 | or rather I should say it has a concept of a "project file" |
16:34:57 | filcuc | dom96: yes and basically from an editor POV it maps to the concept of "target" |
16:35:24 | filcuc | dom96: for example an editor could build multiple targets |
16:35:47 | filcuc | dom96: so the completion should match the build flags for the given target |
16:36:07 | filcuc | dom96: that said without going offtopic that's what i see |
16:36:29 | dom96 | yes. It isn't always possible to determine the project file AFAIK |
16:36:47 | dom96 | But that's how Araq built nimsuggest, so we need to discuss this with him |
16:37:21 | filcuc | dom96: yes..and it could be *fine*. The problem comes if you want to integrate nimble |
16:37:37 | dom96 | oh? How so? |
16:37:52 | filcuc | dom96: because imho each nimble task should map to a "target" |
16:38:09 | filcuc | dom96: but how can i determine the project file for the given nimble task? |
16:39:44 | filcuc | dom96: (well one could argue that mapping a nimble task to a "target" could be wrong) |
16:40:12 | dom96 | Sadly nimble tasks are too abstract |
16:40:19 | filcuc | dom96: correct |
16:40:52 | filcuc | dom96: probably for IDE POV we could create simple tasks (executable, library etc) |
16:41:10 | filcuc | dom96: but i'm biased by my knowledge of CMake |
16:42:51 | * | azuri5 quit (Ping timeout: 250 seconds) |
16:43:00 | filcuc | dom96: i plan to finish the integration of nimsuggest in qtcreator during these holydays |
16:43:07 | filcuc | dom96: at least a very simple integration |
16:45:59 | dom96 | Well, I think this is only a problem when you want to get this "project file" |
16:46:04 | dom96 | for a specific target |
16:46:16 | dom96 | an IDE can easily get the task list and allow you to execute specific tasks |
16:49:35 | * | kapil____ quit (Quit: Connection closed for inactivity) |
16:51:44 | filcuc | dom96: yes but you want also autocompletion (so you need to have project file for each task) |
16:53:11 | dom96 | I would say it's about time nimsuggest can take a project /directory/ and parse all the .nim files instead of relying on this "project file" concept |
16:58:32 | filcuc | dom96: well :D in this case problem solved |
17:03:28 | * | narimiran quit (Remote host closed the connection) |
17:05:08 | * | Vladar joined #nim |
17:05:16 | * | narimiran joined #nim |
17:15:42 | dom96 | We'll need to convince Araq of that :) |
17:18:30 | filcuc | dom96: well seems reasonable :) otherwise we (IDE devs) will have to find a way to emulate that behaviour |
17:19:44 | filcuc | dom96: honestly i'm very close to start creating a basic Nim parser for having full control of suggestions and ide integrations |
17:20:38 | filcuc | for sure less correct but at least on my full control |
17:20:50 | dom96 | I planned to create a Language Server Protocol client that combines a simple "look for `proc searchTerm`" with nimsuggest |
17:21:14 | dom96 | because it is so damn frustrating to see nimsuggest failing to find a proc that is literally in the same file... |
17:21:26 | dom96 | (I've seen that with other languages too to be fair) |
17:22:30 | dom96 | I really wish I had the time to work on it, or that people who have taken it upon themselves to create an LSP Nim client followed my plan ;P |
17:22:55 | filcuc | LSP? |
17:25:03 | filcuc | ah ok now got it |
17:30:05 | FromGitter | <alehander42> well, people have free will .. :D |
17:34:38 | FromGitter | <arnetheduck> filcuc the own-parser for tooling idea has crossed my mind as well - I started looking at what it would take to make the lexer freestanding and it's not too hard actually - then one could create tools on top of that which could be more or less flexible. `clang-format` takes a similar approach.. currently, the way the tools are organised is very hard to understand and above all, very hard to customize, because |
17:34:38 | FromGitter | ... they're so tightly mixed with the compiler itself |
17:35:21 | FromGitter | <arnetheduck> ping me if you ever get anywhere with that idea :) |
17:35:45 | filcuc | ok |
17:36:01 | filcuc | arnetheduck: do you have language requirements? |
17:36:09 | filcuc | python, nim, c++? |
17:36:37 | * | krux02 quit (Remote host closed the connection) |
17:36:40 | FromGitter | <arnetheduck> @filcuc my preference would be nim, so the environment is self-contained, to the greatest extent possible |
17:36:44 | filcuc | probably i could start it in nim and expose some kind of c-interface for using it in qtcreator (c++) |
17:36:56 | filcuc | ok |
17:44:21 | * | minus joined #nim |
17:44:35 | FromGitter | <arnetheduck> speaking of exposing nim to c/c++ - does anyone know of any examples of where that's done? ie where nim code is used as a library in some bigger application |
17:46:58 | * | narimiran quit (Remote host closed the connection) |
17:47:47 | * | narimiran joined #nim |
17:48:13 | filcuc | arnetheduck i think that not trivial..or at least care must be taken in order to initiale the nim garbage collector |
17:48:30 | filcuc | arnetheduck probably the safest approach is to use some sort ipc |
17:48:37 | * | kapil____ joined #nim |
17:50:35 | minus | okay, who's jinglepinging nim ads there |
17:57:51 | FromGitter | <arnetheduck> filcuc, yeah, that's my concern also - though technically, the gc only acts on memory that's been allocated through nim.. one issue would be initializing the stack bottom. one way to make it work could actually be to use boehm - it should be guaranteed safe for the whole application, though I suspect you might run into nim issues given it's not tested that much |
18:01:08 | filcuc | arnetheduck i think that threading is the main problem |
18:01:41 | filcuc | arnetheduck so you will have to register somehow the threads |
18:24:15 | * | smitop joined #nim |
18:24:38 | smitop | What is the difference between the db_sqlite lib and the sqlite3 lib? |
18:27:15 | dom96 | sqlite3 is a thin wrapper over the C library, db_sqlite is a high-level module on top of that |
18:35:53 | * | filcuc quit (Ping timeout: 245 seconds) |
18:58:06 | Araq | Boehm is super stable IME, no known Nim specific problems |
18:58:20 | Araq | I never found a binary for Windows though |
18:58:32 | Araq | it's also part of the test suite |
19:03:34 | dom96 | Araq: Can we get nimsuggest to accept a project directory instead of a project file? |
19:04:02 | Araq | it already does that, pass it a directory and it figures out the main Nim file |
19:04:21 | Araq | disclaimer: This feature isn't tested much... |
19:10:19 | dom96 | oh great. Then you should document this better :P |
19:10:27 | dom96 | filcuc: ^^^ |
19:15:47 | FromGitter | <arnetheduck> Araq, the test suite tells you what works, not what is broken :) |
19:18:19 | Araq | speaking of which ... https://digitalcommons.lsu.edu/cgi/viewcontent.cgi?article=1572&context=gradschool_dissertations |
19:18:33 | Araq | new GC algorithm, completely "local" |
19:18:57 | Araq | breakthrough in GC technology IMHO, unfortunately hard to understand and implement |
19:19:30 | Araq | but maybe we find a superhero who implements it for us |
19:20:29 | Araq | it might also be buggy, in the past these "correctness proofs" were astonishingly bad |
19:22:01 | * | zachk joined #nim |
19:41:24 | * | filcuc joined #nim |
19:56:46 | FromDiscord_ | <PusiteGA> hi anyone knows if there is some board that can run https://github.com/CMU-Perceptual-Computing-Lab/openpose at at least 10fps , this sounded nice but chines dude told me 6mb limit on data files |
19:56:47 | FromDiscord_ | <PusiteGA> https://www.indiegogo.com/projects/sipeed-maix-the-world-first-risc-v-64-ai-module#/ |
19:57:48 | FromDiscord_ | <PusiteGA> i have a greate uber idea, if there is some board like rpi3 that can run this live , litteraly i think evry 3rd family in USA would buy my idea if its under 100$ |
20:15:58 | Zevv | wow, multithreaded GC |
20:16:06 | * | OrganicAnywhere joined #nim |
20:17:53 | Zevv | "three counters and a pointer are required for each object" |
20:20:46 | Araq | yep, it's pretty expensive though you can store this info in 2 words if you do it right |
20:28:40 | * | Vladar quit (Remote host closed the connection) |
20:35:26 | FromGitter | <unreadable> why isn't the class macro in the stdlib? |
20:35:29 | FromGitter | <unreadable> https://nim-by-example.github.io/macros/ |
20:35:32 | FromGitter | <unreadable> as seen there |
20:41:03 | * | minus left #nim ("WeeChat 2.3") |
20:50:53 | dom96 | unreadable: mainly because when you use Nim enough you no longer miss this syntax |
20:53:54 | * | masterdonx quit (Quit: ZNC - http://znc.in) |
20:54:32 | * | masterdonx joined #nim |
20:54:40 | FromGitter | <unreadable> or maybe procedural over oop ;P |
21:00:45 | * | endragor joined #nim |
21:03:54 | * | smitop quit (Quit: Connection closed for inactivity) |
21:21:11 | * | ee7[m] joined #nim |
21:27:10 | FromGitter | <zacharycarter> @Varriount - I don't but I also turned off format on save and problem is solved :) |
21:28:42 | OrganicAnywhere | Is this <https://nim-lang.org/docs/gc.html> correct and currently implemented? |
21:29:32 | OrganicAnywhere | (not including the --gc:v2 part, of course) |
21:30:11 | Araq | yes |
21:43:24 | * | smitop joined #nim |
21:47:09 | * | minos joined #nim |
21:47:56 | minos | Hello. How can I check if an OrderedTable has been initialized? If I try to iterate when not initialized I get an IndexError |
21:50:11 | Zevv | The data seq is not exported, so I can not check if this is empty |
21:50:18 | Zevv | so not sure |
21:50:28 | * | narimiran quit (Ping timeout: 245 seconds) |
21:51:26 | FromGitter | <zacharycarter> it'd be nil otherwise I think |
21:51:41 | FromGitter | <zacharycarter> since it's a ref object |
21:51:53 | FromGitter | <zacharycarter> so a `!= nil` check against the table object should work |
21:52:29 | minos | thats the OrderedTableRef, right? |
21:52:53 | FromGitter | <zacharycarter> yes |
21:52:55 | FromGitter | <zacharycarter> well |
21:53:23 | FromGitter | <zacharycarter> yeah - sorry it is |
21:53:34 | smitop | Is it safe to use the marshal module to load untrusted data? |
21:54:38 | FromGitter | <zacharycarter> is it safe to use any module to load untrusted data :P |
21:54:39 | minos | zacharycarter, ok I could switch to a ref and use nil check indeed. although I feel a proc for checking if a table is initialized would come in handy |
21:55:38 | FromGitter | <zacharycarter> minos: you could create a RFC suggesting so, or maybe ask again when more core devs are on, orrrr start a forum post |
21:55:42 | FromGitter | <zacharycarter> all viable options I think |
21:55:58 | FromGitter | <zacharycarter> smitop: I wasn't trying to be rude, but I'm not sure what safety measures you're looking for |
21:56:16 | FromGitter | <zacharycarter> what do you need the marshal module for? |
21:56:33 | Araq | most collections should follow the "starts as empty" rule |
21:56:46 | Araq | but since that rule is new, only seqs and strings obey |
21:57:02 | Araq | but hey, how hard is it to init your collections. |
21:57:25 | FromGitter | <zacharycarter> Araq - it's funny |
21:57:41 | FromGitter | <zacharycarter> today I was writing some Nim code for a game engine subsystem |
21:57:57 | FromGitter | <zacharycarter> and I started adding isInitialized properties too the context objects for my subsystems |
21:58:12 | FromGitter | <zacharycarter> well - at firs they were just global variables inside modules |
21:58:42 | FromGitter | <zacharycarter> and then it just led to a ton of boilerplate / ugliness in regards to checking them when initialize was called or another procedure was called which depending on state being initialized |
21:59:01 | FromGitter | <zacharycarter> and I ended up just tearing it all out... |
21:59:14 | FromGitter | <zacharycarter> sometimes I feel like people want their hands held a bit too much |
21:59:44 | FromGitter | <zacharycarter> but I guess this is why people don't like programming in C anymore as well |
21:59:53 | Araq | I planned a "game programming in Nim" video just for you |
22:00:14 | FromGitter | <zacharycarter> well - I'm back to just using Nim and ditching C++ |
22:00:26 | FromGitter | <zacharycarter> I think the whole - "getting things done" argument works both ways with Nim |
22:00:44 | FromGitter | <zacharycarter> and tbh - I haven't run into actual limitations, with half the reasons I point to, for not using Nim |
22:00:54 | FromGitter | <zacharycarter> I've never hit a performance wall where I've needed parallelism |
22:01:07 | FromGitter | <zacharycarter> and I've never felt that compile times have been so bad that I need not code reloading |
22:01:22 | Araq | parallelism in Nim is not hard, but you need to plan for it from the beginning |
22:01:58 | Araq | and avoid the GC. Which isn't really as tedious to do as people imagine it to be, but the libs are lacking to do that |
22:02:49 | FromGitter | <zacharycarter> I think even more than the libs lacking to make working without the gc more ergonomic, is a large(ish) programming demonstrating such a pattern |
22:03:02 | * | minos quit (Quit: Lost terminal) |
22:03:08 | FromGitter | <zacharycarter> most forum threads I read about memory management outside of the traditional GC end up being black holes |
22:03:17 | OrganicAnywhere | Will language and/or the standard library be GC-independent for v1.0? |
22:04:02 | FromGitter | <zacharycarter> I've changed my tactics up re: my game / engine project in 2 ways |
22:04:11 | FromGitter | <zacharycarter> 1) I'm writing a game now along with the engine, side by side |
22:04:26 | FromGitter | <zacharycarter> 2) I'm not going to worry about advanced topics like parallelism until I need to |
22:04:31 | Araq | OrganicAnywhere: we don't know. The terminology is also all bad, requires an update |
22:04:51 | OrganicAnywhere | Terminology? |
22:04:59 | OrganicAnywhere | You mean the term "garbage collector"? |
22:05:03 | OrganicAnywhere | Or something else? |
22:05:43 | Araq | GC is not a good term, it can mean "automatic memory management" (which C++, Rust, ... do have) |
22:05:57 | Araq | or it can mean "tracing" |
22:07:42 | FromGitter | <zacharycarter> I'm also writing a proper 3d rendering pipeline this time |
22:07:57 | FromGitter | <zacharycarter> a minimal one, and then a PBR one - that's what I'm working on now |
22:08:24 | OrganicAnywhere | Araq: this? <https://en.wikipedia.org/wiki/Tracing_garbage_collection> |
22:08:27 | FromGitter | <zacharycarter> and my main focus on this engine is going to be strategy games - I want to start out with some type of historical one - I haven't decided b/w the American Civil War vs another one yet |
22:08:49 | OrganicAnywhere | Wait, no. |
22:09:08 | FromGitter | <arnetheduck> https://github.com/nim-lang/Nim/issues/7832#issuecomment-447828943 is a fun side effect of forgot-to-init + seqs becoming not-nil :) |
22:09:15 | FromGitter | <zacharycarter> OrganicAnywhere: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.151.2018&rep=rep1&type=pdf |
22:09:54 | FromGitter | <zacharycarter> I view initTable like calling newTable |
22:10:02 | FromGitter | <zacharycarter> it's not like you have to call newTable and then initTable |
22:10:08 | FromGitter | <zacharycarter> that would be turrible |
22:10:18 | FromGitter | <zacharycarter> only having to call one though - IMO - isn't bad at all |
22:10:39 | FromGitter | <zacharycarter> although I think it'd be nice if Table followed the pattern of everything else - and used `newTable` instead of `initTable` |
22:11:43 | FromGitter | <zacharycarter> OrganicAnywhere: there are probably better sources for finding info on Nim's GC algorithm |
22:11:50 | FromGitter | <arnetheduck> well, in C++ you just `map<a, b>()` and you're done - no need to call anything at all |
22:11:52 | FromGitter | <zacharycarter> but that's A white paper on the algo it uses |
22:12:01 | FromGitter | <zacharycarter> well that's because C++ has constructors |
22:12:19 | FromGitter | <zacharycarter> Nim forces the programmer to write their own - and the style in which their written is not enforced |
22:12:52 | FromGitter | <arnetheduck> well, that's a developer experience feature that makes the language easier to use.. it's utterly meaningless to have a table on which initTable has not been called |
22:13:01 | FromGitter | <zacharycarter> but I view having to call - `map<a, b>()` - very much like having to call `initTableA,B ()` |
22:13:13 | * | endragor quit (Remote host closed the connection) |
22:13:42 | FromGitter | <zacharycarter> I guess it's as meaningless as having a `Map[A,B]` variable that you haven't assigned `map<a, b>()` to yet - no? |
22:13:48 | FromGitter | <zacharycarter> in C++ |
22:14:08 | FromGitter | <arnetheduck> well, let me rephrase that - you don't have to call it - the compiler does it for you so that the `map` never ever has an "invalid state" in which it behaves weirdly |
22:14:23 | FromGitter | <zacharycarter> I see |
22:14:53 | FromGitter | <zacharycarter> it seems to me though that this is somewhat unavoidable - isn't it? |
22:14:57 | FromGitter | <arnetheduck> once you've declared a `map<a,b> myvar;`, that's it. you can use it and never worry. |
22:14:57 | FromGitter | <zacharycarter> in Nim I mean |
22:15:15 | * | steshaw joined #nim |
22:15:28 | FromGitter | <zacharycarter> based on the overall design of collections |
22:15:49 | Araq | var a, b: Table |
22:15:52 | Araq | if cond: |
22:15:53 | FromGitter | <arnetheduck> in current nim, sort of.. the map implementation could have an `initialized` field that gets checked for every mutating access - then it wouldn't fail like that (and you wouldn't need a constructor) |
22:16:01 | Araq | a = f(); b = g() |
22:16:04 | Araq | else: |
22:16:12 | Araq | a = h(); b = k() |
22:16:55 | Araq | ^ implicit init of a, b is not universally a good thing, depending on the costs of the initializations |
22:17:20 | Araq | it's much better to do control flow checking instead, IMO. |
22:17:27 | FromGitter | <arnetheduck> basically - `Table` could be rewritten so that the "uninitialized" state would never be visible to the end user - a bit like the strings and seqs still are nil, but there's `if seq == nil: do this` injected everywhere |
22:18:01 | Araq | that's true, there are multiple valid designs here |
22:18:37 | Araq | I personally want 'var x: T' to mean 'of type T, not inited, check it's inited before use' |
22:18:44 | FromGitter | <arnetheduck> Araq, that's just bad code that's asking for trouble... ie `let (a, b) = if cond: (f(), g()) else: ...` |
22:19:15 | Araq | arnetheduck: your syntax doesn't work in all cases |
22:20:21 | Araq | anyhow IMO 'var x: T' shouldn't mean 'var x = default(T)' because the explicit variant is not harder to write |
22:21:17 | Araq | I need to update my RFC. Figured out how to solve the cases that the people brought up |
22:22:18 | FromGitter | <zacharycarter> so if I don't want to use the GC |
22:22:37 | FromGitter | <zacharycarter> what allocation / freeing procs should I be using? |
22:23:49 | Araq | you use fixed size arrays like in 1970 |
22:23:57 | FromGitter | <arnetheduck> well... Araq, if you can prove with control flow checking that your variable is never used ininitialized, it means effectively that my syntax covers all the cases.. |
22:24:09 | FromGitter | <zacharycarter> intersting |
22:24:20 | FromGitter | <zacharycarter> I think you said that a few weeks ago - I need to study this |
22:24:22 | Araq | I know you don't want to do that but you'll be surprised how far it gets you in game development |
22:25:06 | FromGitter | <zacharycarter> erm - it's not that I DON'T want to do it |
22:25:32 | Araq | oh and you can use all of Nim's stdlib if you run these parts in its own thread |
22:25:52 | Araq | the GC is thread local after all |
22:26:03 | FromGitter | <zacharycarter> it's that I wasn't alive in the 1970s and I did't start programming until 2008 and I'm not sure I've encountered the pattern before at least encountered and recognized that I've encountered it |
22:26:20 | Araq | XD |
22:26:42 | shashlick | Araq what's the most efficient way to share stuff between threads in Nim? Channels? |
22:26:59 | FromGitter | <zacharycarter> Channels are not the most efficient |
22:27:02 | FromGitter | <zacharycarter> they're the easiest |
22:28:02 | FromGitter | <arnetheduck> btw, Araq.. the lexer currently streams in the source code.. is that a.. requirement? one of the things that crossed my mind was that with an `mmap`:ed buffer, the lexer could just return indices and you wouldn't have to allocate so many small strings |
22:28:07 | Araq | shashlick: channels are for when you don't want to share stuff |
22:28:23 | shashlick | True |
22:28:46 | shashlick | So using locks then? |
22:28:51 | FromGitter | <arnetheduck> shashlick, efficient, how? in terms of man-hourse spent hunting down bugs? |
22:29:31 | FromGitter | <zacharycarter> locks won't be enough - you need to use the shared heap |
22:29:33 | FromGitter | <zacharycarter> if you want to share |
22:29:54 | Araq | arnetheduck: we don't allocate many small strings afaik, we need to create the PIdents but they are shared |
22:29:54 | FromGitter | <zacharycarter> and then use synchronization primitives - locks / conds or atomics |
22:29:56 | shashlick | Performance wise |
22:30:22 | FromGitter | <zacharycarter> shashlick - this project has a job system that uses a lock-free work stealing queue |
22:30:30 | shashlick | So we don't have a library that makes this relatively clean? |
22:30:45 | FromGitter | <zacharycarter> https://github.com/sheosi/tart |
22:30:56 | FromGitter | <zacharycarter> it's not possible to make clean - because you' need to use unsafe Nim |
22:31:05 | FromGitter | <zacharycarter> and the community views unsafe Nim as unclean |
22:31:13 | FromGitter | <zacharycarter> thus - channels |
22:31:28 | FromGitter | <zacharycarter> at least that's my naive perspective on things |
22:31:40 | shashlick | Well if it is abstracted and well tested, why not |
22:31:55 | FromGitter | <zacharycarter> because you need unsafe pointers to memory allocated on the shared heap |
22:32:06 | FromGitter | <zacharycarter> so people are going to see ptr and pointer - and like Araq said, they're going to need to work with fixed size arrays |
22:32:40 | FromGitter | <zacharycarter> it's not that it's not doable - it's that it's not Nim that people are used to writing and it's also stuff that tends to have very little example code out there on github / the forum |
22:32:57 | FromGitter | <zacharycarter> at least people that primarily write in Nim |
22:33:22 | FromGitter | <zacharycarter> I have a feeling if you're used to programming in C - these are not new concepts to you |
22:33:30 | shashlick | Well getting good at multi threading is getting more and more crucial |
22:33:36 | FromGitter | <zacharycarter> but to someone coming from Python - and unsafe pointer is like devil magic |
22:33:51 | Araq | I'd argue that it's forgotten knowledge for C programmers too |
22:33:55 | FromGitter | <arnetheduck> Araq, well, the use of ropes in the compiler is one of those things that could probably be improved - ie they're generally slow compared to better buffer management due to how they wreck cache and all that.. with mmap on the source side and a big output buffer that doesn't get reallocated on the c side, you could probably gain a good few % |
22:34:20 | Araq | yeah but that's the shitty codegen, not the lexer |
22:34:23 | FromGitter | <zacharycarter> Nim's GC doesn't make multi-threading easier - but multithreading isn't necessarily easy in any language |
22:34:28 | shashlick | Having a nice abstraction that hides the unsafe stuff will make these capabilities more accessible to the community |
22:34:37 | FromGitter | <arnetheduck> well, it starts at the lexer, because that's where the ropes get created |
22:34:44 | FromGitter | <zacharycarter> you're always going to have a need to manage synchronization |
22:34:53 | Araq | no, the lexer doesn't create ropes. |
22:34:57 | FromGitter | <zacharycarter> but Nim you have to worry about where data is allocated in memory as well |
22:35:07 | FromGitter | <zacharycarter> shashlick: I'm not sure the unsafe stuff can be hidden |
22:35:11 | FromGitter | <zacharycarter> but I'm not 100% positive either |
22:35:13 | Araq | I didn't say "use pointers". |
22:35:17 | FromGitter | <arnetheduck> no? then I misread it somewhere.. |
22:35:25 | Araq | I said "use fixed size arrays". |
22:35:48 | FromGitter | <arnetheduck> but the ast holds ropes all over the place that could be replaced by indices into a big source buffer |
22:35:54 | Araq | they are not "unsafe" in Nim, on the contrary they are the most safe construct. |
22:36:11 | FromGitter | <arnetheduck> but that of course would kill the ability to stream in the source |
22:36:24 | FromGitter | <zacharycarter> okay - well I don't understand enough about how to use unsafe arrays to comment on this further then - I'm must speaking to my experience in the matter, which is limited |
22:36:47 | Araq | aliasing problems mitigated, cannot OOM, no "use after free", no reallocations |
22:37:19 | Araq | no double free, easy to parallelize |
22:38:18 | FromGitter | <zacharycarter> so is this just like creating an array like - `var gameObjects: Array[1000, GameObject]` |
22:38:44 | FromGitter | <zacharycarter> and `GameObject` is a non-ref object? |
22:39:29 | Araq | yup. |
22:40:39 | Araq | arnetheduck: the streaming is fine and I remain unconvinced about mmap. |
22:41:25 | Araq | yeah I know it often wins in benchmarks but maybe I want the compiler to use less memory and have it run on 32bit systems. Why waste precious address space |
22:45:38 | * | xet7 quit (Remote host closed the connection) |
22:45:59 | * | zachk quit (Read error: Connection reset by peer) |
22:46:28 | FromGitter | <arnetheduck> well, that's what I'm asking, basically... and you should end up with at least comparable memory usage given that you have much less book-keeping to do.. excepting those pathological cases with giant comments of course. |
22:51:03 | Araq | I doubt it works out well. assuming identifiers are most important you keep a slice (a, b) to 'foo' in your mmap'ed buffer. now if 'foo' is used again in the source code and you use a different slice (c, d) you reduce the value of your caches |
22:51:20 | Araq | if you use the old (a, b) you need to find the old one somehow |
22:51:36 | Araq | usually with a hash table |
22:52:17 | * | zachk joined #nim |
22:52:41 | Araq | and then it's just a variant of our PIdent stuff |
22:53:24 | Araq | and that's all guesswork, before we do anything, we could measure/profile the compiler... |
22:53:41 | Araq | I never saw the lexer or the parser on the critical path |
22:53:53 | Araq | it's all lost in semcheck and stupid rope handling |
22:55:24 | shashlick | so i've been wanting to use nims as the scripting language for the text editor i'm working on |
22:55:27 | FromGitter | <arnetheduck> well, I actually did a branch that just changed rope to string, which kind of worked, but added a 50% bonus extra time to compilation - would need to make a few adjustments here and there |
22:55:50 | shashlick | i cannot think of a way to interact with the nims process without stdin/out - any ideas? |
22:55:51 | Araq | it's called "RAM", but it isn't. mmap says "look, even more things are now RAM". that doesn't convince me. |
22:56:04 | shashlick | i'm not keen on pulling in the compiler into the editor like nimble though |
22:56:07 | Araq | shashlick: the compiler API shows how to do that |
22:56:24 | Araq | you extend the API, some calls call into your native Nim code |
22:56:27 | * | nsf quit (Quit: WeeChat 2.3) |
22:56:29 | FromGitter | <arnetheduck> (before a non-rope solution would fly) |
22:56:59 | shashlick | i was able to get a minimal nim distro with nim.exe, lib\system and a few other files so have enough to run a good amount of stuff in 2mb |
22:57:30 | shashlick | but once i spawn a nim e script.nims, i have limited ways for it to interact with the editor |
22:57:37 | Araq | shashlick: NimEdit uses Nimscript |
22:58:01 | Araq | and as shitty as it may be, it shows how things can be done, it compiles with devel |
22:58:06 | shashlick | does it pull in the compiler? |
22:58:27 | Araq | yes, the parts that Nimscript need (which is much of it) |
22:58:52 | shashlick | i see, i'm trying to avoid that, just like the idea to remove compiler from nimble |
22:58:56 | Araq | arnetheduck: tried to only change ccgcalls to use strings? |
22:59:19 | shashlick | any way besides stdin/out to interact with the nimscript process? |
22:59:38 | FromGitter | <arnetheduck> @Araq I changed so `type Rope = string` |
22:59:40 | shashlick | can i use sockets or ipc or something to that order? |
22:59:46 | FromGitter | <zacharycarter> shashlick: https://github.com/capocasa/scnim - is a project that apparently avoids using Nim's GC |
22:59:49 | shashlick | in the vm |
22:59:53 | FromGitter | <zacharycarter> at least in some capacity |
23:00:11 | Araq | shashlick: well you have to pick your poison |
23:00:44 | Araq | any IPC mechanism could work but they are all equally terrible |
23:01:17 | shashlick | but can I do that in nimscript - in the vm |
23:03:55 | Araq | zacharycarter: also kudos for developing a game and engine at the same time though I'd argue you should only program your game. then you write another one, reusing the code worth reusing |
23:04:04 | Araq | and then you can extract an "engine" out of it. |
23:06:44 | Araq | shashlick: you can extend the VM but the default VM is weak in supporting these mechanisms by design |
23:07:06 | Araq | as I don't want my compiler to open socket connections |
23:07:24 | FromGitter | <zacharycarter> Araq: thank you and true - but I've done this at this point enough with Nim and built enough shoddy " game engines" that I tend to have an okay understanding of what needs to stay in "game land" vs "engine land" |
23:08:09 | FromGitter | <zacharycarter> zengine I think did this well - but the rendering pipeline in zengine was very weak and I've learned quite a bit about how to build a rendering pipeline since then |
23:08:33 | FromGitter | <zacharycarter> also - I'm starting to understand (I think) about what you're getting at with fixed-size arrays |
23:09:38 | shashlick | Araq: understandable |
23:10:15 | Araq | who brought up http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.151.2018&rep=rep1&type=pdf ? it's excellent |
23:11:54 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c240aba5064a51f837ee086] |
23:12:05 | Araq | OrganicAnywhere: the wikipedia link is on point |
23:12:09 | FromGitter | <zacharycarter> doesn't touch the GC at all as far as I can tell |
23:12:31 | FromGitter | <zacharycarter> Araq: I did - but all I did was google deferred reference counting with cycle detection |
23:12:43 | FromGitter | <zacharycarter> and it was the first link (or one of the first few) :P |
23:13:58 | FromGitter | <arnetheduck> Araq, you should maintain an awesome-memory-management-papers list in the doc folder ;) |
23:14:46 | FromGitter | <zacharycarter> IMO Nim is a great avenue to learning about ^ if you're learning programming top-down |
23:14:53 | Araq | well I thought I read them all. but it turns out, new algorithms are still being found |
23:15:23 | FromGitter | <zacharycarter> I tried learning C in HS and wasn't ready for it at the time |
23:15:38 | FromGitter | <zacharycarter> and then when I started programming for a job, it was VB.NET then C# then Java |
23:16:00 | FromGitter | <zacharycarter> but I wasn't getting exposed to any memory management concepts |
23:16:28 | FromGitter | <zacharycarter> Nim really helped (me anyway) bridge that gap and allow me to work in both "worlds" |
23:17:14 | FromGitter | <zacharycarter> I could have probably done something similar with Go - but Go is not fun to program in |
23:17:34 | FromGitter | <zacharycarter> or by writing my own GC in C once I understood more of C |
23:17:58 | FromGitter | <zacharycarter> I think Nim was a softer landing spot though |
23:21:25 | Araq | thanks. What I find remarkable is that Pascal originally offered 'new' but no 'free' and no GC. |
23:22:19 | dom96 | websockets are broken :( |
23:23:31 | Araq | and I used to think "that's broken". And now I think, "that works". ;-) |
23:23:41 | Araq | dom96: how so? |
23:23:57 | FromGitter | <zacharycarter> heh |
23:24:06 | dom96 | I've recompiled snake's server and it fails now |
23:25:29 | * | filcuc quit (Quit: Konversation terminated!) |
23:29:16 | dom96 | Guessing there are regressions on the client side too |
23:32:26 | dom96 | Anyone know if there is a way to tell VS Code to ignore all errors in a file? |
23:32:30 | FromGitter | <zetashift> @shashlick I've been faring really well with your choosenim x64 version thanks, no big things except those dll's for no |
23:32:34 | dom96 | I hate seeing red everywhere for include files |
23:45:05 | shashlick | @zetashift: thanks buddy - i need to get those changes through dom96 - am in the middle of several other projects so that's been tabled |
23:45:38 | shashlick | and main headache is recreating the test setup i had |
23:46:26 | ee7[m] | I should do what timotheecour says here, right? https://github.com/nim-lang/Nim/pull/10099 |
23:46:29 | ee7[m] | Is that the best practice? |
23:46:57 | ee7[m] | I was assuming the commits could just be squashed if desired. |
23:49:30 | dom96 | There isn't really a best practice here |
23:49:52 | dom96 | GitHub is annoyingly bad at allowing to specify that another PR is a dependency of your PR |
23:50:29 | ee7[m] | Your best practice is "use phabricator"? :) |
23:51:12 | Araq | I have no idea how that ever passed my review process |
23:51:26 | Araq | int(n/2) ? makes no sense |
23:52:18 | FromGitter | <zetashift> @shashlick yea just reporting after a fair bit of usage |
23:53:11 | dom96 | ee7[m]: yep :P |
23:53:25 | Araq | ee7[m]: I press "squash" |
23:54:50 | ee7[m] | :) |
23:59:36 | shashlick | @zetashift: thanks again, i'll ping you once i get that cleaned up so that we can get it through |