00:03:24 | * | clyybber quit (Quit: WeeChat 2.7) |
00:15:19 | * | Hideki joined #nim |
00:15:43 | * | Hideki is now known as Guest13999 |
00:20:32 | * | gour_ quit (Remote host closed the connection) |
00:26:43 | FromDiscord | <speckledlemon> Is it expected that the contents of `result` are immutable? |
00:27:13 | FromDiscord | <speckledlemon> Say, if I've done `result = deepCopy(mylist)` where `mylist` is a sequence of tuples |
00:28:41 | * | endragor joined #nim |
00:29:47 | * | gangstacat quit (Quit: ฤis!) |
00:35:52 | * | pbb joined #nim |
00:44:03 | shashlick | you can write to result multiple times |
00:45:46 | FromDiscord | <speckledlemon> Sorry, it was a result of doing `for b in result: ...` and attempting to modify `b`, so I misunderstood the issue |
00:46:23 | shashlick | no problem |
00:52:58 | * | Guest13999 quit (Remote host closed the connection) |
00:58:51 | FromDiscord | <slymilano> Is this the official nim package repository? https://nimble.directory/ |
00:59:07 | FromGitter | <bung87> sure |
01:05:41 | * | gangstacat joined #nim |
01:07:43 | * | leorize quit (Ping timeout: 240 seconds) |
01:09:17 | * | leorize joined #nim |
01:17:24 | * | Jjp137 quit (Quit: Leaving) |
01:17:33 | * | Jjp137 joined #nim |
01:30:53 | zedeus | @speckledlemon: you should be able to do `for b in result.mitems:` |
01:36:01 | * | endragor quit (Remote host closed the connection) |
01:45:45 | * | silvernode joined #nim |
01:46:50 | * | hexeratops quit (Quit: Leaving) |
01:56:33 | * | exelotl quit (Ping timeout: 245 seconds) |
02:31:40 | * | endragor joined #nim |
02:31:50 | leorize | disruptek: that plugin is totally out of nim.nvim scope |
02:32:44 | leorize | there should be plenty of coverage tool for vim though |
02:32:52 | leorize | I could help with adding nim support to them |
02:34:01 | * | moduledge joined #nim |
02:36:50 | * | endragor quit (Ping timeout: 258 seconds) |
02:39:26 | moduledge | Hi folks, I started using nim today (and enjoying it!) and I was wondering is there a way to collect iterators into a list? |
02:40:30 | zedeus | moduledge: Welcome :) I think you mean this https://nim-lang.github.io/Nim/sequtils.html#toSeq.t%2Cuntyped |
02:42:16 | moduledge | zedeus: perfect, yes. Thank you. |
02:42:44 | disruptek | leorize: first i have to make coco work. |
02:42:57 | disruptek | couldn't find anything for vim. |
02:44:36 | leorize | https://github.com/ruanyl/coverage.vim |
02:45:32 | disruptek | coco produces lcov output. |
02:46:40 | FromDiscord | <speckledlemon> Dโoh thank you zedeus |
02:47:02 | disruptek | i mean, i guess i don't care what it is as long as it works against nim code. ๐คท |
02:48:21 | leorize | https://github.com/google/vim-coverage |
02:49:31 | disruptek | neither that or maktaba tell me anything useful. |
02:49:40 | disruptek | i'm too old for this shit. |
02:49:52 | leorize | looks like it only supports python coverage tools |
02:50:24 | disruptek | it creeps up on you. |
02:50:32 | leorize | haizz, guess someone would have to invent a plugin |
02:50:48 | disruptek | one day someone says something and you realize you're just an old moron. |
02:54:35 | disruptek | !repo vim gcov |
02:54:37 | disbot | https://github.com/m42e/vim-gcov-marker -- 9vim-gcov-marker: 11A Simple way to display gcov coverate within vim 15 7โญ 5๐ด 7& 7 more... |
02:54:44 | disruptek | whaddya know |
02:55:03 | disruptek | !repo vim lcov |
02:55:04 | disbot | https://github.com/umaumax/vim-lcov -- 9vim-lcov: 11 15 0โญ 0๐ด & 2 more... |
02:55:06 | leorize | there's a vim plugin for most things :P |
02:59:07 | * | mal`` quit (Quit: Leaving) |
03:02:27 | disruptek | oh it's too dumb. |
03:18:03 | * | mal`` joined #nim |
03:26:16 | disruptek | the compiler adds generated_not_to_break_here lines which blow up the coverage analysis. |
04:02:30 | * | seerix joined #nim |
04:11:48 | * | endragor joined #nim |
04:17:43 | * | endragor quit (Ping timeout: 265 seconds) |
04:23:00 | * | chemist69 quit (Ping timeout: 248 seconds) |
04:25:10 | * | chemist69 joined #nim |
04:36:28 | * | endragor joined #nim |
05:11:55 | * | NimBot joined #nim |
05:38:49 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:38:59 | * | njoseph joined #nim |
05:50:14 | * | silvernode quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
06:13:13 | * | sagax joined #nim |
06:23:22 | * | gour joined #nim |
06:24:29 | * | nsf joined #nim |
07:06:46 | * | solitudesf joined #nim |
07:06:57 | * | leorize quit (Quit: WeeChat 2.6) |
07:11:04 | FromGitter | <sheerluck> ((https://i.imgur.com/bOLlfSI.png)) |
07:11:38 | FromGitter | <sheerluck> I'm happy |
07:41:48 | FromGitter | <xmonader> @Willyboar xmonader has some real neck problems :( so you will have to bare with me :D |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:05:04 | * | gmpreussner joined #nim |
08:57:05 | * | cyraxjoe quit (Ping timeout: 265 seconds) |
08:57:16 | * | cyraxjoe joined #nim |
09:03:57 | * | dddddd quit (Ping timeout: 260 seconds) |
09:05:11 | FromDiscord | <KcVinu> Hi all, |
09:06:50 | FromDiscord | <KcVinu> I know how to use a seq inside a type. But i dont know how to use a table inside a type. I woud like to know the two steps of (1) Declaration, (2) Initialization. |
09:07:09 | FromDiscord | <Milerius> Just to be sure, when you import a C++ Container such as std::vector or std::map, and try to store a Nim Type inside, the garbage collector will not add a ref counting on it alright ? |
09:08:00 | * | onionhammer quit (Ping timeout: 265 seconds) |
09:09:07 | FromDiscord | <KcVinu> seq - |
09:09:08 | FromDiscord | <KcVinu> simpleSeq* : seq[typeName] # declaration |
09:09:08 | FromDiscord | <KcVinu> result.simpleSeq = newSeq[typeName] # Initialization |
09:09:08 | FromDiscord | <KcVinu> So what is the procedures in table |
09:09:54 | * | onionhammer joined #nim |
09:17:44 | * | Trustable joined #nim |
09:21:32 | * | Vladar joined #nim |
09:23:29 | * | tane joined #nim |
09:30:19 | solitudesf | https://nim-lang.org/docs/tables.html |
09:30:24 | lqdev[m] | @KcVinu you don't have to initialize seqs and Tables, that's done implicitly |
09:30:26 | FromDiscord | <Rika> yeah |
09:30:41 | FromDiscord | <Rika> just `a: Table[T]` |
09:30:48 | FromDiscord | <Rika> or `a = newTable[T]()` |
09:31:07 | FromDiscord | <Rika> (initTable, not new) |
09:31:09 | FromDiscord | <Rika> sorry |
09:32:02 | * | livcd joined #nim |
09:32:31 | lqdev[m] | @Milerius if it's a seq, string, or a ref type, you need to call GC_ref on it before passing it to C/C++. when your C type is destroyed, call GC_unref on all its seq/string/ref elements. other types are fine to pass to C without any special calls |
09:33:48 | FromDiscord | <Milerius> @lqDev i pass a JsonNode |
09:33:57 | FromDiscord | <Milerius> and it's seem's destroyed by the GC sometimes |
09:34:00 | lqdev[m] | JsonNode is ref afaik |
09:34:04 | FromDiscord | <Milerius> to i have an invalid object in my C++ map |
09:34:06 | FromDiscord | <Milerius> Ok |
09:34:13 | FromDiscord | <Milerius> I have another question if you mind |
09:34:16 | lqdev[m] | so call GC_ref on it before you pass it to your map |
09:34:19 | lqdev[m] | go on |
09:34:33 | FromDiscord | <Milerius> Switching to: --gc:markAndSweep i have no crash anymore |
09:34:39 | FromDiscord | <Milerius> passing the type to the map |
09:34:43 | FromDiscord | <Milerius> How it's work ? |
09:36:02 | lqdev[m] | no clue. I only have experience with the default GC, but from my experience with mark and sweep GCs that's probably to be expected |
09:36:06 | FromDiscord | <mratsim> When you realize that once again Apple breaks all convention :/ |
09:36:08 | FromDiscord | <mratsim> > The Mac OS X alloca() implementation frees the allocated memory not upon the function's return but during a subsequent invocation of the function. |
09:36:48 | lqdev[m] | @mratsim that's not POSIX, isn't it? |
09:37:01 | * | Vladar quit (Quit: Leaving) |
09:37:07 | FromDiscord | <Milerius> @lqdev yeah but the fact is that with MarkAndSweep it's seem's not crashing anymore |
09:37:35 | FromDiscord | <mratsim> I don't know, but I'm happy I only have to deal with low-level routines that are somewhat standardized, I wouldn't want to deal with GUI API like Cocoa, GDI, or Xorg |
09:38:04 | lqdev[m] | @Milerius yes, because the strategy of mark and sweep GCs is entirely different from the default GC. they don't use a refcount |
09:38:12 | FromDiscord | <mratsim> and pthread_barrier are Posix standard, and are not optional anymore since 2008 and Apple doesn't have them so I had to roll my own barriers |
09:38:41 | FromDiscord | <mratsim> pretty sure the GC is collecting your jsonNode while it's stored in C++ |
09:38:48 | lqdev[m] | @Milerius read more here http://craftinginterpreters.com/garbage-collection.html if you're interested, I found that helpful |
09:38:59 | lqdev[m] | @mratsim yeah it is, but not on markAndSweep |
09:39:16 | FromDiscord | <mratsim> because mark and sweep checks live object not refcount |
09:39:27 | FromDiscord | <Milerius> @lqdev yeah that's why i use mark and sweep |
09:39:38 | FromDiscord | <Milerius> Yeah it's what is happening @mratsim |
09:39:39 | FromDiscord | <mratsim> it has more throughput anyway |
09:39:47 | FromDiscord | <Milerius> Using gc ref seem's to do the job too |
09:39:53 | FromDiscord | <Milerius> Should i use the default gc with gc ref/unref |
09:39:59 | FromDiscord | <Milerius> or use another gc |
09:40:01 | FromDiscord | <Milerius> idk yet |
09:40:37 | FromDiscord | <mratsim> mark-and-sweep can introduce GC pauses (same strategy as java) |
09:40:51 | FromDiscord | <mratsim> but it doesn't matter if you are not doing games or real-time audio/video |
09:40:58 | lqdev[m] | I'd stick with the default, but it really depends on your use case |
09:41:21 | FromDiscord | <mratsim> otherwise gc:boehm is in general the best GC |
09:41:37 | FromDiscord | <mratsim> until Araq delivers its gc:arc or gc:orc |
09:41:40 | FromDiscord | <Milerius> Yeah but i need to use a library for it ? |
09:41:45 | FromDiscord | <Milerius> i tried |
09:41:46 | FromDiscord | <mratsim> it's shipped by default |
09:41:51 | FromDiscord | <Milerius> but he try to load a dylib |
09:41:55 | FromDiscord | <Milerius> hmm not for me |
09:41:55 | FromDiscord | <mratsim> ah maybe only on windows |
09:42:17 | FromDiscord | <mratsim> https://formulae.brew.sh/formula/bdw-gc |
09:42:22 | FromDiscord | <mratsim> for mac |
09:42:24 | FromDiscord | <Milerius> Ok with GC_ref when inserting, and GC_Unref when destroying seem's to work ! |
09:43:01 | FromDiscord | <Milerius> I'm trying it. thank's for the suggestion my friend. |
09:43:04 | FromDiscord | <Milerius> I Appreciate it. |
09:43:26 | FromDiscord | <Milerius> What is the equivalent for linux ? |
09:43:29 | * | sealmove joined #nim |
09:43:48 | lqdev[m] | it's platform agnostic |
09:43:54 | lqdev[m] | ah |
09:44:09 | lqdev[m] | it's just libgc |
09:44:21 | lqdev[m] | pacman -S libgc |
09:44:31 | lqdev[m] | or your distro's equivalent |
09:44:35 | FromDiscord | <Milerius> Ok great |
09:44:43 | FromDiscord | <Milerius> Why this GC is superior for you @mratsim |
09:44:46 | FromDiscord | <Milerius> Compared to the default one |
09:44:59 | FromDiscord | <mratsim> it's not for me, it's @Araq benches |
09:45:08 | FromDiscord | <mratsim> it's the only multithreaded GC first-of-all |
09:45:15 | FromDiscord | <mratsim> and it has high throughput |
09:45:19 | FromDiscord | <Milerius> ๐ฎ |
09:45:23 | FromDiscord | <Milerius> I need to use this one so. |
09:45:25 | FromDiscord | <Milerius> Thanks |
09:45:50 | FromDiscord | <mratsim> if you have a master thread which is always alive and is the only one that reclaim memory, no you don't |
09:46:48 | FromDiscord | <Milerius> No i have multiple thread that do lot of tasks |
09:46:56 | FromDiscord | <Milerius> Writting in concurrent registry |
09:47:00 | FromDiscord | <Milerius> Main thread only read |
09:47:23 | FromDiscord | <Milerius> I have like 2-3 thread that write into different `folly::concurrent_hash_map` |
09:47:31 | FromDiscord | <Milerius> And the main thread (GUI) read into this registry |
09:48:46 | FromDiscord | <mratsim> nim default GC is thread-local, you will have one GC per thread |
09:49:02 | FromDiscord | <mratsim> as long as what is allocated in a thread is freed in that thread it will work OK |
09:49:19 | FromDiscord | <mratsim> the issue is when you allocated a JsonNode in a thread, and free it in another |
09:49:53 | FromDiscord | <mratsim> if it works now, you are probably not in that case |
09:50:45 | FromDiscord | <Milerius> Idk yet, for the moment i don't get so much trouble, but if i get some trouble, i will maybe stick with the default one + GC_ref/unref |
09:50:53 | FromDiscord | <Milerius> otherwise let's stay with bohem atm and let's see |
09:51:35 | FromDiscord | <mratsim> sounds good |
09:54:02 | * | zyklon joined #nim |
09:54:58 | * | uvegbot quit (Ping timeout: 260 seconds) |
10:02:02 | * | uvegbot joined #nim |
10:02:02 | * | zyklon quit (Read error: Connection reset by peer) |
10:06:08 | FromDiscord | <has1> Hi, i am getting an error when trying to install nim |
10:06:10 | FromDiscord | <has1> https://pastebin.com/iRjjQCbQ |
10:06:24 | * | nsf quit (Quit: WeeChat 2.6) |
10:06:55 | FromDiscord | <has1> I am using the command from the website ```curl https://nim-lang.org/choosenim/init.sh -sSf | sh``` |
10:09:33 | Araq | has1: fix your GCC installation |
10:13:54 | FromDiscord | <has1> its a fresh install |
10:13:58 | FromDiscord | <has1> what am i supposed to fix? |
10:14:25 | FromDiscord | <has1> gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 |
10:15:01 | * | Hideki joined #nim |
10:15:24 | * | Hideki is now known as Guest32352 |
10:18:12 | Araq | install build-essentials, dunno |
10:18:29 | Araq | looks like Clyybber solved it |
10:19:52 | Araq | and all we need is an 'isolate' construct |
10:21:06 | FromDiscord | <has1> @araq ah yes, that is what the issue is, you have to install "build-essential" |
10:21:26 | FromDiscord | <has1> Is this supposed to not work correctly on a fresh linux installation? |
10:23:37 | FromDiscord | <mratsim> build-essentials is needed for any C/C++ dev |
10:23:42 | FromDiscord | <mratsim> no GCC otherwise |
10:23:45 | FromDiscord | <has1> If you don't care about making nim work on a fresh linux install, then how about at least showing a meaningful error message, OR documenting the dependency on build-essential on https://github.com/dom96/choosenim#choosenim |
10:24:28 | Araq | there is no "fresh linux install", Linux is a plethora of different distributions, all doing things slightly differently |
10:24:32 | FromDiscord | <has1> @mratsim my go code (which uses cgo which uses C) works fine with just gcc |
10:25:00 | FromDiscord | <has1> I am using linux mint here, which uses ubuntu |
10:25:13 | Araq | build-essential is not "Linux", it's Ubuntu specific, maybe Debian |
10:25:21 | FromDiscord | <mratsim> yes debian |
10:25:39 | FromDiscord | <has1> so you dont care if it doesnt work out of the box for ubuntu users? |
10:25:50 | FromDiscord | <mratsim> well without build-essentials you don't have make |
10:25:57 | FromDiscord | <mratsim> feel free to PR that in |
10:26:47 | dom96 | has1: As the author of choosenim I do care, make an issue |
10:26:54 | FromDiscord | <mratsim> but if we don't use the distribution, or if every single debian/Ubuntu devs so far had build-essentials installed, you can't expect us to know about that dependency |
10:27:00 | FromDiscord | <has1> If my first experience with something is this shaky, and the makers of the project don't even care if this thing works on ubuntu, then I dont have a lot of confidence in the project |
10:27:17 | FromDiscord | <mratsim> All our CI is done on Ubuntu |
10:27:24 | FromDiscord | <has1> it could at least be documented on the github page |
10:27:31 | Araq | I don't have confidence in your judgement either fwiw |
10:27:34 | FromDiscord | <has1> that you might need build-essential, as a minimum |
10:27:38 | FromDiscord | <mratsim> well someone has to do that PR, you could be that someone |
10:28:07 | Araq | Linux is all about a "shaky" experience. |
10:29:01 | FromDiscord | <has1> So you are telling me no one tested this on a fresh ubuntu (debian?) installation? Or that I am the first one to point this out? |
10:29:17 | FromDiscord | <has1> It seems like it was a known issue, because one person pointed out build-essential |
10:29:23 | FromDiscord | <mratsim> I'm telling you that all Ubuntu devs are installing build-essentials first thing |
10:29:25 | Araq | I'm telling you it worked for hundreds of people before you |
10:29:48 | FromDiscord | <has1> Either way, I dont like this experience and It doesn't give me any confidence in nim, I'll stick to Go for now, thanks though |
10:29:54 | Araq | and you're using the wrong OS anyway when you do care about "it just works" |
10:30:12 | FromDiscord | <mratsim> TBH, Go install instructions are really bad on Windows |
10:30:34 | FromDiscord | <mratsim> they just hand-wavy tell people to update their environment variable |
10:30:39 | FromDiscord | <has1> go has always worked right from the start for me |
10:31:09 | FromDiscord | <has1> they give you easy to use instructions, and even tell you which command to add to your .profile or .bashrc file |
10:31:16 | FromDiscord | <mratsim> install it on windows |
10:31:27 | dom96 | has1: can you please report this on choosenim's github? I want to see if we can detect the lack of this dependency and provide a better error message. Choosenim is all about making Nim installation as easy as possible. |
10:31:35 | FromDiscord | <has1> i did many times, its even easier on windows with the installer |
10:31:39 | FromDiscord | <mratsim> we have a mixed Go + Nim codebase at work and we are removing go because it's a pain for Windows users |
10:31:48 | FromDiscord | <mratsim> anyway |
10:32:24 | FromDiscord | <mratsim> The Nim community is small and is also mostly DIY currently. We try our best but if people don't raise issue we can't know about them |
10:32:54 | FromDiscord | <mratsim> so, PR or raise the issue in choosenim |
10:32:57 | FromDiscord | <Milerius> @has1 Just letting you know that GO on windows embed a gcc... |
10:33:03 | FromDiscord | <Milerius> That's why it's work out of the box |
10:33:15 | Araq | we do the same btw. on windows |
10:33:23 | FromDiscord | <has1> but the problem is not gcc here |
10:33:25 | Araq | we can't ship GCC for Linux |
10:33:33 | FromDiscord | <has1> i had gcc installed |
10:33:33 | FromDiscord | <mratsim> there is finish.exe that updates the env variable which go doesn't |
10:33:44 | Araq | the problem is GCC. it lacks crucial header files and you blame us for it |
10:34:00 | FromDiscord | <has1> @mratsim you tell me about updating env variables, but choosenim tells me this |
10:34:03 | FromDiscord | <has1> ``` |
10:34:03 | FromDiscord | <has1> choosenim-init: ChooseNim installed in /home/user/.nimble/bin |
10:34:04 | FromDiscord | <has1> choosenim-init: You must now ensure that the Nimble bin dir is in your PATH. |
10:34:04 | FromDiscord | <has1> choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file. |
10:34:04 | FromDiscord | <has1> choosenim-init: export PATH=/home/user/.nimble/bin:$PATH |
10:34:05 | FromDiscord | <has1> ``` |
10:34:09 | FromDiscord | <Milerius> on Ubuntu on cannot dev without build essentials |
10:34:13 | FromDiscord | <has1> isn't tat the exact same thing? |
10:34:22 | FromDiscord | <Milerius> on Ubuntu you cannot dev without build essentials |
10:34:30 | FromDiscord | <mratsim> nop it's not, did you ever try updating env variable on windows? |
10:34:59 | FromDiscord | <has1> Did YOU ever try to update env vars on windows 10? |
10:35:05 | FromDiscord | <mratsim> I did |
10:35:08 | FromDiscord | <has1> Because i did this like 3 weeks ago and it is super easy |
10:35:10 | dom96 | has1: will you submit this issue or should I just do it myself? |
10:35:19 | FromDiscord | <has1> you click on new and add the env var or even browse for a path |
10:35:29 | FromDiscord | <has1> @dom96 feel free |
10:38:14 | Araq | I would report a Ubuntu bug instead. if you have GCC but not a C environment setup how is it our fault |
10:42:18 | Araq | so what should choosenim now do? parse GCC's error messages about missing header files? specific code paths for Debian based distros? |
10:46:26 | Araq | apt-get install nim |
10:47:38 | lqdev[m] | @has1 click? no thanks. I always just open cmd and use `setx`, because I'm not a caveman to have to click through some shitty GUIs. |
10:48:35 | stefantalpalaru | "the problem is GCC. it lacks crucial header files and you blame us for it" - "limits.h" comes from the linux-headers package, not the GCC one. |
10:50:01 | FromGitter | <mratsim> AFAIK linux headers are in by default on ubuntu |
10:50:05 | FromGitter | <mratsim> or supposed to |
10:50:06 | stefantalpalaru | Now you know why people use "configure" scripts in particular and configuration steps in general. You want to check the environment before trying to build the package. |
10:50:16 | FromGitter | <mratsim> I checked before trying to use futex yesterday |
10:51:48 | stefantalpalaru | Don't you need to select a "development" bundle during installation? |
10:52:37 | lqdev[m] | I hate it when people complain about some issue and don't even give a single damn to try and report it properly on GitHub. |
10:52:43 | lqdev[m] | I'm sure everybody does. |
10:52:54 | FromGitter | <mratsim> yep, did it yesterday with glibc |
10:53:01 | stefantalpalaru | Someone says they're installed by default on Ubuntu 14.04: https://askubuntu.com/questions/464659/are-linux-headers-installed-by-default-how-to-check-if-theyre-installed |
10:53:07 | FromGitter | <mratsim> I don't want to deal with their tracker |
10:55:10 | * | Zevv quit (Ping timeout: 258 seconds) |
10:58:52 | FromGitter | <bung87> how to port this `#define CFSTR(cStr)` it use Macro in occ |
11:00:42 | FromGitter | <mratsim> proc cfstr(x: cstring) {.importc:"CFSTR", header:"foo.h".} |
11:00:50 | FromGitter | <mratsim> macro are not special |
11:05:08 | FromGitter | <bung87> when x is const string ? how to declare that |
11:06:11 | * | moduledge quit (Quit: Konversation terminated!) |
11:06:53 | stefantalpalaru | You don't. That information is lost in translation. |
11:11:32 | Araq | stefantalpalaru, limits.h is part of Ansi C afaik |
11:11:55 | Araq | so what I said was 100% correct, you have a C compiler but without a C environment |
11:12:33 | FromGitter | <bung87> ok, port occ more harder than c |
11:12:47 | lqdev[m] | that's ubuntu for you. so good yet so horrible |
11:13:17 | * | Guest32352 quit (Remote host closed the connection) |
11:14:04 | * | Hideki joined #nim |
11:14:12 | FromGitter | <bung87> I just like mac retina screen and touchpad, and also I need photoshop |
11:14:28 | * | Hideki is now known as Guest70774 |
11:14:31 | dom96 | Araq, no need to parse the compiler errors, we might be able to look up whether the headers exist |
11:14:41 | Araq | ha ha ha ha ha |
11:14:53 | FromGitter | <bung87> If Iโm pure backend programer , I โll choose linux. |
11:18:42 | * | Guest70774 quit (Ping timeout: 260 seconds) |
11:21:08 | FromGitter | <mratsim> btw still no choosenim on 64-bit windows :/ |
11:21:43 | dom96 | good thing 64 bit windows can run 32bit apps :) |
11:22:21 | FromGitter | <mratsim> good luck addressing over 4GB of RAM with 32-bit |
11:23:12 | dom96 | btw it seems that 64 bit Nim will be installed if 64 bit gcc is detected: https://github.com/dom96/choosenim/issues/128#issuecomment-514338375 |
11:23:14 | disbot | โฅ proposal: on 64-bit Windows, download 64-bit MinGW & Nim |
11:23:22 | * | Hideki joined #nim |
11:23:45 | * | Hideki is now known as Guest55445 |
11:29:13 | * | clyybber joined #nim |
11:30:44 | * | nsf joined #nim |
11:36:11 | clyybber | Araq: Sup, do we change the refcount on every ref assignment or do we already optimize something? |
11:39:48 | FromGitter | <bung87> how to write compiler params when I use apple CoreFoundation IOKit |
11:49:45 | FromGitter | <bung87> `{.passL: "-framework CoreFoundation -framework IOKit".}` ? |
11:52:37 | FromGitter | <bung87> ok I โve done my task |
11:58:47 | * | ecker joined #nim |
12:01:10 | ecker | I have a problem to load a library which I installed with nible: |
12:01:26 | ecker | nimble install nimPDF |
12:02:07 | ecker | demo.nim(10, 32) Error: cannot open file: nimPDF |
12:02:17 | ecker | ??? |
12:03:14 | dom96 | there is no nimPDF.nim file in that package |
12:03:17 | dom96 | guess that demo is broken |
12:03:27 | zedeus | damn my project is on the front page of hackernews |
12:03:45 | dom96 | zedeus, I upvoted, nice :) |
12:03:47 | clyybber | nitter right? |
12:03:50 | zedeus | yea |
12:03:53 | clyybber | nice! |
12:06:38 | ecker | Thanks for replying. There is a nimPDF: ~/.nimble/pkgs/nimPDF-0.4.2/nimPDF/nimPDF.nim |
12:09:35 | * | Kaivo quit (Quit: WeeChat 2.6) |
12:10:32 | solitudesf | you should import it as nimPDF/nimPDF |
12:15:45 | dom96 | the package should be changed to move that file outside that directory |
12:20:44 | ecker | Moving it outside helps. |
12:22:00 | ecker | however nim complains about subpackages now: .nimble/pkgs/nimPDF-0.4.2/nimPDF.nim(10, 8) Error: cannot open file: image |
12:22:46 | dom96 | yeah, these would need to be changed to nimPDF/image |
12:26:01 | Araq | clyybber, here is my line of thinking, probably you already know this and tried to explain it to me |
12:26:48 | Araq | we can have a 'recover' block in Nim like Pony has (except maybe we will call it 'isolate' or something better) |
12:28:08 | ecker | This looks good so far ... |
12:28:29 | * | hed0n1st joined #nim |
12:28:32 | * | hed0n1st quit (Remote host closed the connection) |
12:28:37 | Araq | the type of 'recover block' is 'owned ref', only 'owned ref' can be passed to a thread/channel |
12:29:05 | Araq | 'owned ref' can also be used elsewhere and it enforces moves just like in the B/D design |
12:30:12 | Araq | so if you have a singly linked list with 'owned refs' inside, you can pass head/rest to different threads |
12:30:50 | Araq | if you don't then 'recover' is also unlikely to help you |
12:31:07 | Araq | but that's ok, lists etc need to be prepared for threading |
12:33:49 | clyybber | ,Exactly |
12:34:00 | Araq | this means we lack B/D's "dangling ref" error state since we use refcounting, we can keep the refcounting thread local since we "move" stuff to threads and it's memory safe |
12:34:16 | clyybber | Yes |
12:36:30 | clyybber | I'm currently investigating wether this recover block can be made implicit. So rather than have a block we trace the orgins of `someRef` in `let b = own someRef`. |
12:36:43 | clyybber | And during that I have stumbled upon a few insights |
12:37:18 | clyybber | Inside a recover block there does not need to be refcounting |
12:37:45 | clyybber | And I'm talking about unowned refs |
12:38:02 | Araq | sounds wrong to me |
12:39:47 | clyybber | think about it. As long as you don't let the refs inside of that block escape (which you cant with a recover block) the result of that block is an owned ref. Since they can't escape the block they need not be refcounted |
12:40:01 | clyybber | The one ref that survives will be taken ownership off in the resulting owned ref |
12:40:43 | clyybber | So all other ones except of that one can be destroyed |
12:41:39 | Araq | var x = foo(); if complexCondition: x = bar() |
12:41:55 | Araq | ^ better destroy the old x in the 2nd assignment |
12:42:16 | Araq | yes, you can avoid the RC ops but the basic machinery can't be avoided |
12:43:22 | clyybber | Yeah |
12:43:35 | clyybber | But eliding RC ops seems really useful |
12:45:03 | clyybber | This insight can be extended as follows: Only ref assignments from or to fields of outer vars, outer vars, or globals need to do RC ops |
12:45:40 | clyybber | where outer vars are outside of the scope that an unowned ref is introduced in |
12:46:47 | clyybber | Now the tricky part is constructing some flow based rules out of that insight, so that we don't have to `block:` everythign |
12:47:00 | * | ecker quit (Quit: Leaving) |
12:49:43 | Araq | we also elide rc ops via 'sink' and 'lent' |
12:50:22 | clyybber | Yeah, combining all these elision methods, I think we can get the RC ops overhead really low |
12:50:56 | clyybber | And that way cycle checking also gets rarer |
12:51:25 | Araq | cycle checking lost |
12:51:43 | Araq | it is buggy and **slow** |
12:52:23 | Araq | the only way to make it not slow is via delaying the cycle checking |
12:52:33 | clyybber | Or via not doing rc ops? |
12:52:43 | Araq | and then you enter non-predictable MM |
12:52:53 | Araq | which is what we want to get away from |
12:54:15 | FromGitter | <Willyboar> @xmonader don't worry just joking |
12:54:23 | Araq | doing it via RC ops is ok but the condition rc > 1 is not good enough |
12:54:39 | Araq | it triggers too often |
12:54:59 | Araq | Python uses a generational algorithm |
12:55:25 | clyybber | Yeah, though I think with the above approach we can get it at least a bit lower. Since none of the unowned refs in a rcover block/data flow need to be cycle checked |
12:55:42 | clyybber | And then maybe we stumble upon another bunch of optimizations |
12:56:53 | Araq | but systems programming is not about "optimizations we hope work out and affect O(n) behaviour" |
12:57:46 | clyybber | Sure |
12:57:47 | Araq | the critical part here is the algorithmic complexity that is affected |
12:58:23 | Araq | once the cycle collector doesn't cause crashes anymore, we can give programmers a 'markAsCyclic' proc they need to call for cycle collection |
12:58:32 | Araq | then the cost is exposed |
13:01:25 | * | fireglow quit (Remote host closed the connection) |
13:03:13 | Araq | btw what Pony is doing with 'recover' is comparable to "ballon types" |
13:03:44 | FromDiscord | <slymilano> Hey guys, I'm having issues trying to import my module in src/crawlers/foobar.nim, I have a function exported with `*` but I don't know what the call is. I've tried: |
13:03:44 | FromDiscord | <slymilano> |
13:03:44 | FromDiscord | <slymilano> ``` |
13:03:44 | FromDiscord | <slymilano> import src/rawlers/foobar |
13:03:44 | FromDiscord | <slymilano> import foobar |
13:03:45 | FromDiscord | <slymilano> ``` |
13:03:47 | FromDiscord | <slymilano> |
13:03:47 | FromDiscord | <slymilano> Both don't seem to work. |
13:04:17 | * | chemist69 quit (Ping timeout: 260 seconds) |
13:04:47 | FromDiscord | <slymilano> The module docs don't mention anything about file names. |
13:04:48 | FromDiscord | <slymilano> https://nim-lang.org/docs/tut1.html#modules |
13:05:16 | Araq | maybe write 'src/crawlers' instead of 'src/rawlers' |
13:05:41 | FromGitter | <Willyboar> @zedeus do you have a link to upvote it? |
13:06:02 | * | chemist69 joined #nim |
13:06:32 | dom96 | slymilano: is this a Nimble package? or where is it in relation to the module that tries to import it? |
13:06:47 | FromDiscord | <slymilano> A nimble, binary. Here's a screenshot: |
13:06:54 | FromGitter | <Willyboar> never mind i found it |
13:07:01 | FromDiscord | <slymilano> |
13:07:01 | FromDiscord | <slymilano> https://cdn.discordapp.com/attachments/371759389889003532/657932029941514261/unknown.png |
13:07:22 | FromDiscord | <slymilano> |
13:07:22 | FromDiscord | <slymilano> https://cdn.discordapp.com/attachments/371759389889003532/657932111726247956/unknown.png |
13:07:26 | dom96 | remove the `src/` |
13:07:28 | FromDiscord | <Rika> remove src |
13:07:41 | FromDiscord | <Rika> darn, late by a few milliseconds |
13:07:55 | zedeus | Willyboar: sure, https://news.ycombinator.com/item?id=21849744 |
13:07:58 | FromDiscord | <slymilano> Nice, that worked, I guess src is the root path. |
13:08:06 | FromDiscord | <slymilano> ty guys |
13:08:11 | FromDiscord | <Rika> well it is since the file is in src |
13:08:25 | FromGitter | <Willyboar> i found it. Drop me a message if you want to hunt it in producthunt |
13:10:59 | dom96 | slymilano: imagine your current work directory is `./src`, you wouldn't type in `cat ./src/crawlers/foobar` to read the file |
13:11:38 | FromDiscord | <slymilano> ๐ |
13:12:29 | FromDiscord | <slymilano> Before I go down this last problem is there a simple way to convert a seq[Object] to json in jester? |
13:13:32 | Araq | clyybber, oh look, somebody is using JSON ;-) |
13:13:41 | dom96 | slymilano: %yourVar |
13:14:05 | dom96 | !eval import json; echo(%(@["hello", "world"])) |
13:14:09 | NimBot | ["hello","world"] |
13:14:48 | Araq | clyybber, anyway, I think what we need to figure out is how 'recover' deals with parameters |
13:15:09 | Araq | or more generally, what outside of its scope is allowed to be accessed |
13:19:35 | clyybber | on it |
13:20:19 | Araq | sink parameters should be allowed but not for refs... |
13:20:28 | clyybber | in pony its sendable types, aka owned refs (not their fields), immutable refs (don't have them), and tags |
13:20:52 | FromGitter | <Willyboar> This pony worths? |
13:20:53 | Araq | 'owned refs' are allowed though |
13:21:01 | clyybber | To access the fields of owned refs we must unown them though |
13:21:14 | clyybber | And unowning is comsuming the owned ref in pony |
13:21:28 | Araq | yeah it's nasty |
13:22:12 | FromDiscord | <slymilano> In Ruby/Elixir/JS if I add a package, it modifies my packages.json, gemfile or mix.exs file. In nim when I run `nimble install jester` it doesn't really change any file in my project source, just adds the package itself to `~/.nimble/pkgs` - `/Users/sergiotapia/Work/nim/torrentinim/src/torrentinim.nim(4, 8) Error: cannot open file: jester` do I need to manually add requires "jester" every time I add a package or is something wrong with m |
13:23:17 | Araq | slymilano: you modify your .nimble file and run 'nimble install', nimble doesn't write into your .nimble file |
13:23:18 | clyybber | In a way that recover block is similar to `unowned outlives owned` analysis |
13:23:35 | FromGitter | <Willyboar> Yes you need to add it yourself |
13:24:17 | FromDiscord | <slymilano> thanks, I finished my very first Nim app! |
13:24:37 | FromDiscord | <slymilano> everything I dreamed, so lean and liberating ๐ |
13:24:45 | FromGitter | <Willyboar> but in ruby you need to add it yourself |
13:24:48 | Araq | it's a bit confusing I guess but 'nimble install' and 'nimble install project' are very different things |
13:25:19 | Araq | 'nimble install foo' is not concerned about your current directory or its nimble package inside it |
13:25:46 | Araq | and 'nimble install' is all about your CWD |
13:26:21 | dom96 | Here is the best workflow: add dependency into your .nimble file, run nimble build which will install the dependencies for you |
13:26:38 | dom96 | no point in installing your package every time |
13:26:53 | Araq | oh ok |
13:27:17 | Araq | at least what I wrote wasn't wrong, right dom96 ? |
13:27:42 | dom96 | sure, but if I'm developing a package I wouldn't really be using `nimble install` |
13:27:55 | Araq | true |
13:28:23 | dom96 | i'm curious how Ruby/Elixir/JS package managers handle this |
13:28:55 | Araq | I suppose 'install' means different things over there |
13:29:00 | FromGitter | <Willyboar> well in ruby its pretty much the same |
13:31:21 | FromGitter | <Willyboar> you have Gemfile add dependencies and install it with ``` bundle install ``` |
13:32:12 | dom96 | yeah, when I was implementing this functionality in Nimble that is how most (if not all) package managers worked |
13:33:25 | clyybber | Araq: Ok, I think i got it: |
13:33:51 | FromGitter | <bung87> many pm just install the deps |
13:33:53 | clyybber | `let b = own someUnownedRef` |
13:34:14 | FromGitter | <Willyboar> the only difference is that ruby has gemspec for libraries |
13:34:22 | clyybber | Here we must analyse the "life" of someUnownedRef since its construction |
13:34:25 | FromGitter | <bung87> unless you usng `install .` |
13:34:44 | dom96 | Willyboar: what is that? lock file? |
13:35:00 | FromGitter | <bung87> lock file |
13:35:26 | clyybber | the constraint for `own` to work is: No other ref that has been in contact with `someUnownedRef` may be used after the `own` expression. |
13:36:18 | FromGitter | <bung87> and package describe file also has namescope, dev or prod test ..etc |
13:36:45 | FromGitter | <Willyboar> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dfe1fedcf771f77080707f5] |
13:37:10 | clyybber | for two refs a, b to be potentially "in contact" during some operation means: the operation could make some part of a alias b or the other way around |
13:37:20 | FromGitter | <bung87> while python package just using `setup.py` and not allow install from foreign resources |
13:37:43 | clyybber | meaning no `a.field = b` and no `a = b` or the reverse are allowed |
13:38:29 | FromGitter | <bung87> @Willyboar thatโs the spec file for lib, not for project |
13:38:57 | FromGitter | <Willyboar> Yes i know it. |
13:39:01 | clyybber | Araq: And that is basically outliving analysis :) |
13:39:38 | Araq | clyybber, alternatively we know proc f(args): ref T {.noSideEffect.} produces a unique location when 'ref T' cannot be an alias into 'args' |
13:40:08 | Araq | and we happen to have alias analysis |
13:40:23 | clyybber | Yeah, its slowly all coming together |
13:40:27 | Araq | but it's rather hard to explain |
13:40:38 | Araq | and also fragile when you have inheritance |
13:43:09 | Araq | it's still quirky though. we seek to enforce uniqueness, so we have 'owned ref' but then we allow aliasing it via plain refs. |
13:43:40 | clyybber | Thats why in pony `unown` consumes |
13:43:46 | clyybber | So that owned is always unique |
13:44:16 | Araq | that aliasing was introduced to be able to describe trees and lists but with refcounting these are covered by plain refs too |
13:44:23 | FromGitter | <Willyboar> @bung87, @dom96 i think ruby's system is the best. |
13:45:29 | * | akitoshi joined #nim |
13:47:20 | FromGitter | <bung87> yeah, ruby ecosystem save much time for developers |
13:48:24 | FromGitter | <Willyboar> also i insist that nim needs package hosting |
13:49:05 | * | Trustable quit (Remote host closed the connection) |
13:49:14 | clyybber | Araq: The great thing is though, that all these refs that can be used inside a recover block/have the aforementioned properties do not be refcounted. And that aliasing doesn't hurt us, as long as in the end its still an unaliased owned ref |
13:50:01 | FromGitter | <bung87> for enterprise wide using , Iโll give + 1 |
13:50:55 | clyybber | Furthermore if an owned ref created via `own` is destroyed in this same scope, (so not sinked) the alias refs can live until shortly before the owned refs destruction |
13:51:10 | FromGitter | <bung87> I wonder why developers remove their packages from registry , but they did do that kind of thing. |
13:53:18 | dom96 | Willyboar: I agree completely that we need package hosting |
13:53:27 | dom96 | someone just needs to implement it |
13:53:45 | FromGitter | <Willyboar> This is the hard part |
13:53:50 | dom96 | Sadly I doubt that will be me at this point |
13:54:46 | clyybber | Araq: And these alias refs are the same as {.cursor.} refs |
13:56:16 | clyybber | Making those safe follows the same principle: Make sure that they are not aliased further beyond their lifetime |
13:56:48 | clyybber | Aliases of those alias/cursor refs are themselves alias/cursor refs which follow the same rules |
13:57:03 | Araq | clyybber, we have a problem though ;-), worse is better. |
13:57:43 | FromGitter | <Willyboar> dom96 but i think that this cant be made by one person |
13:57:44 | Araq | sum(outgoingLinks)+1 = sum(refcounts) # no outside pointer to the subgraph, safe to pass to a different thread via move |
13:58:08 | Araq | it's almost the same as cycle detection |
13:58:09 | dom96 | Willyboar: it can, if that person works full-time :) |
13:58:38 | Araq | detect it at runtime before passing the ref to a channel, done |
13:59:44 | clyybber | you mean detect that sum(outgoingLinks) == 0? |
14:00:03 | clyybber | Sure, thats can also be done for the `own` mechanism |
14:00:16 | Araq | I mean we ensure no other roots beyond 'x' that is passed to the channel exist |
14:00:18 | FromGitter | <Willyboar> Well then maybe yes |
14:00:24 | clyybber | Araq: Yeah |
14:00:53 | Araq | and since this happens *before* the concurrency is involved it's a rather deterministic test |
14:01:07 | Araq | so you can disable it in release mode (*cough*) |
14:01:11 | clyybber | And additionally we can do the compile time analusis I outlined |
14:01:32 | Araq | yeah but it's optional and maybe once we have Z3 integration it becomes easier |
14:01:41 | clyybber | I wouldn't be on it |
14:02:07 | clyybber | Also its probably a lotta fun writing such an analusis thing :D |
14:02:22 | clyybber | But yeah, this is optional |
14:02:25 | Araq | me neither but we also need to focus on the important things. for example, we do know that 'nil' is bug prone |
14:03:31 | clyybber | Also this compile time analysis will improve performance since it allows us to elide the RC ops |
14:04:22 | FromGitter | <Willyboar> dom96 can we open an RFC for this? |
14:04:29 | Araq | we don't know if "uh, after dozens of tests ensuring uniqueness we still had race conditions in production" will be common |
14:04:40 | dom96 | Willyboar: sure, but I think something already exists for it |
14:05:15 | clyybber | Araq: Sure, since it can be optional we are free to experiment though |
14:05:24 | Araq | topology is usually a rather stable property, unlike array indexing or 'nil' |
14:06:16 | clyybber | Btw, the alias refs/cursor refs I mentioned. As arguments to functions they are the opposite of sinked/owned |
14:06:21 | clyybber | They are `lent` |
14:06:34 | clyybber | This is just too symmetrical to not be sound :p |
14:06:42 | clyybber | Normal refs: normal args |
14:06:47 | FromGitter | <bung87> (https://files.gitter.im/nim-lang/Nim/fxt0/Screenshot-2019-12-21-at-10.06.38-PM.png) |
14:06:50 | clyybber | Owned refs: Sinked/owned args |
14:06:57 | clyybber | Alias refs: Lent args |
14:07:15 | FromGitter | <bung87> does https://nimble.directory/ provider such kind of info? |
14:08:49 | FromGitter | <bung87> Iโm wodering how many new packages published this year |
14:09:30 | * | Guest55445 quit (Remote host closed the connection) |
14:09:43 | FromGitter | <bung87> seems its growing larger , Iโve seen lot new packages |
14:09:55 | Araq | bung87: growth is slow but accelerating, I think |
14:10:04 | lqdev[m] | you can look through nim-lang/packages's commit history and find the first commit in 2019 |
14:10:12 | lqdev[m] | and then work from here |
14:10:52 | FromGitter | <bung87> ah,yeah , right it publish through modify a json |
14:11:33 | FromGitter | <bung87> @Araq I have kind of that feeling. |
14:11:33 | FromGitter | <Willyboar> I think i have seen an article in reddit with such stats. |
14:11:56 | FromGitter | <Willyboar> Nimble directory can't provide such stats i think because uses github API |
14:12:14 | * | ng0 joined #nim |
14:12:26 | livcd | is there a source for nimble.directory ? |
14:12:43 | lqdev[m] | !repo nimble-package-directory |
14:12:44 | disbot | no results ๐ข |
14:12:59 | Araq | ask federico3 |
14:13:10 | FromGitter | <Willyboar> https://github.com/FedericoCeratto/nim-package-directory |
14:13:46 | Araq | clyybber, so ... still no idea how to design the new threading API :-( |
14:14:30 | FromGitter | <Willyboar> https://www.reddit.com/r/nim/comments/dyeklg/nimble_goes_up_to_11_hundred/ |
14:14:32 | clyybber | Araq: Leave it to mratsim :p |
14:14:39 | FromGitter | <Willyboar> this is the article with growth stats |
14:14:40 | * | ng0 quit (Client Quit) |
14:14:41 | livcd | cool. |
14:14:47 | lqdev[m] | yeah, that was the repo |
14:14:53 | lqdev[m] | nim-package-directory |
14:14:53 | Araq | clyybber, I asked him yesterday |
14:14:56 | * | ng0 joined #nim |
14:15:29 | Araq | and he doesn't know, his stuff is quite specialized and at the same time avoiding Nim's ref/string/seq altogether (yay..) |
14:15:52 | FromGitter | <bung87> I can look github insights by in 1 month period, 25 merged |
14:16:09 | * | ng0 quit (Client Quit) |
14:16:17 | FromGitter | <Willyboar> yes now is 1125 |
14:16:23 | * | ng0 joined #nim |
14:16:23 | * | ng0 quit (Changing host) |
14:16:23 | * | ng0 joined #nim |
14:16:25 | FromGitter | <Willyboar> in the article was 1100 |
14:16:26 | clyybber | Araq: String and seq should pose no problem I think, since they can just be copied |
14:16:29 | FromGitter | <Willyboar> a month ago |
14:16:39 | FromGitter | <timotheecour> hi @araq for your comment https://github.com/nim-lang/Nim/pull/12907 โ โ > Wrap it in: when (NimMajor, NimMinor) >= (1, 1) please. โ โ Iโm assuming u meant `{.since: (1, 1).}`, correct? [https://gitter.im/nim-lang/Nim?at=5dfe29478dfce538b5e552eb] |
14:16:41 | disbot | โฅ lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y |
14:16:51 | FromGitter | <bung87> sounds cool! |
14:17:00 | Araq | timotheecour: there is no difference |
14:17:16 | Araq | but yes, .since is better if it works for it |
14:17:19 | FromGitter | <Willyboar> almost 1 new pack/day |
14:17:34 | clyybber | timotheecour: I think that change is a bad idea. |
14:17:44 | Araq | clyybber, yeah but we can also enforce 'move's |
14:18:13 | Araq | we want to enforce moves |
14:18:56 | Araq | or maybe not for consistency with slices which cannot be moved |
14:20:14 | Araq | I think I'll simply copy C++'s API |
14:21:23 | FromGitter | <timotheecour> @clyybber, feel free to open another PR for your `lenVarargs` alternative so we can discuss your version there; but I donโt think itโs as easy as you think as it will break existing code, in particular patterns based on alias via `varargs[untyped]` |
14:21:45 | Araq | I tried to make it work without the hack yesterday |
14:21:56 | Araq | but it's annoying |
14:22:09 | Araq | which is why your PR wins ;-) |
14:23:10 | * | fireglow joined #nim |
14:23:44 | clyybber | Well, relying on a being equivalent to a[0] is simply broken |
14:23:58 | clyybber | But sure I'll try it |
14:25:37 | clyybber | Its also violating the spec |
14:25:55 | clyybber | Since varargs is an array, and not a comma seperated list |
14:26:15 | clyybber | And its easy enough to construct an nkCall node out of such an array without magic |
14:26:49 | clyybber | The only thing that needs fixed is disallowing `someProc(someVarargsUntypedParam)` |
14:27:00 | FromGitter | <timotheecour> clybber, varargs[untyped] is treated specially in the spec; eg no implicit array unlike varargs[T] |
14:27:14 | clyybber | Yes, but it should not be IMO |
14:28:03 | FromGitter | <timotheecour> itโs how templates work and existing code relies on that, for better or for worse, and is the only thing to write generic alias; if you want to improve that, lobby to araq to greenlight https://github.com/nim-lang/Nim/pull/11992 |
14:28:05 | disbot | โฅ every symbol becomes 1st class; defines 0-cost lambda and aliases; inline iterators/templates/etc can be passed to any routine ; snippet at 12https://play.nim-lang.org/#ix=250A |
14:29:11 | clyybber | timotheecour: Hear me out. It is not the only way if you have a helper macro that constructs such calls |
14:29:48 | clyybber | Then it should be possible like this: `callWithArgs(theProcToAlias, args)` |
14:30:12 | clyybber | That helper is also useful for other stuff |
14:30:20 | clyybber | as args does not have to be varargs |
14:30:25 | FromGitter | <deech> Is it possible to have a nimble project with multiple executables and libraries? |
14:31:08 | clyybber | timotheecour: I'm gonna write a PR so please bear with me :) |
14:32:56 | FromGitter | <timotheecour> your version would require importing `macros.nim`, which was explicitly what i was trying to avoid in that PR, see PR description |
14:33:48 | clyybber | timotheecour: It would not. It can be put in system.nim just like your lenVarargs macro |
14:33:51 | dom96 | deech: yes, although the answer need more nuance depending on what you mean by "nimble project". You can multiple nimble packages inside a single git repo, but while a single nimble package can build multiple executables it is always just one library. |
14:33:54 | clyybber | Not sure if its a good idea though :p |
14:34:00 | dom96 | *you can have |
14:34:52 | FromGitter | <timotheecour> @Clyybber how would you define `myecho` (see tests/system/tlenvarargs.nim from that PR) without macros.nim? |
14:37:59 | FromGitter | <timotheecour> more generally, with the new template rules you have in mind, how would you define generic alias without macros.nim, ie whatโd be your replacement for: โ โ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dfe2e47c5a23938b45a3725] |
14:40:04 | clyybber | timotheecour: Replacing the last 4 lines of myecho with: callWithArgs(echo, concat(loc, args)) |
14:40:17 | clyybber | where concat is array concatentation |
14:40:29 | clyybber | I wrote it that way so I do not spam IRC :p |
14:41:49 | FromGitter | <Clyybber> @timotheecour You would write: โ โ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dfe2f2d44e1fb33f604db0e] |
14:42:04 | FromGitter | <Clyybber> That isn't so bad is it :) ? |
14:42:31 | FromGitter | <timotheecour> so callWithArgs has to be magic, correct? |
14:43:20 | FromGitter | <Clyybber> Nope |
14:43:54 | FromGitter | <timotheecour> then it has to import macros.nim, which is what i was avoiding in the 1st place. |
14:44:23 | FromGitter | <Clyybber> @timotheecour No you did not avoid that. Your `lenVarargs` is a macro too :P |
14:44:49 | FromGitter | <timotheecour> itโs a macro but doesnโt require macros.nim |
14:44:49 | FromGitter | <Clyybber> `callWithArgs` is a macro too, but not a magic one |
14:46:13 | FromGitter | <Clyybber> And what exactly is the benefit of not requiring macros.nim? |
14:46:24 | FromGitter | <Clyybber> Nim should rely more on macros and less on magic IMO |
14:46:33 | FromGitter | <deech> @dom96 That makes sense, is it possible to publish a single Nimble project that contains multiple sub-projects? |
14:47:00 | dom96 | deech: you need to publish each individually |
14:47:08 | FromGitter | <deech> I see, thanks. |
14:47:12 | dom96 | each .nimble file needs its own URL |
14:47:28 | dom96 | search for `subdir` (IIRC) in the packages.json file to see how it's done |
14:47:31 | FromGitter | <timotheecour> as stated in PR description, the goal was allowing defining things like alias (including a more debug-freindly myecho, see PR, in low-level code, where macros.nim would cause circular imports |
14:48:24 | FromGitter | <Clyybber> How can macros.nim cause circular imports? |
14:48:37 | FromGitter | <Clyybber> For that to happen macros.nim must import something itself no? |
14:49:44 | FromGitter | <deech> @dom96 I see, well if that's how it is then not much can be done about it now but as the ecosystem grows without a way to publish a family of projects under a single root Nimble will run into namespacing issues similar to domains. |
14:49:56 | FromGitter | <timotheecour> ya, it imports system.nim which itself imports and includes a bunch of files |
14:51:20 | dom96 | deech: not sure I understand what you mean, what namespacing issues do you foresee? |
14:51:56 | FromGitter | <Clyybber> @timotheecour A user is not supposed to mess with system.nim โ If you debug system.nim already, I think you can be bothered to simply use echo(loc) instead of some sugary alias |
14:54:43 | FromGitter | <deech> @dom96 As an example two people write bindings to the bits of 'libgit' they need for their own project, the bindings are split out into a subproject to keep things organized. When it comes time to publish they'll stomp over each other if they've both called their bindings 'nim-libgit'. |
14:55:34 | disruptek | deech: you can just use urls. |
14:55:59 | dom96 | deech: yes, that is a problem, but I believe most package managers have it. |
14:56:17 | dom96 | Happy to hear suggestions on how to solve it for us |
14:56:44 | FromGitter | <deech> @dom96 Not sure I only just learned about the limitation just now. :) |
14:56:56 | disruptek | also, local dependencies are well-supported now. |
14:57:07 | FromGitter | <deech> The Haskell package manager now allows multiple libs + exes per project. |
14:57:27 | disruptek | have you looked at nimph? |
14:57:38 | dom96 | I mean, technically you can have multiple libs in Nim as well. |
14:57:46 | dom96 | They just all have to be under the package's namespace :) |
14:58:10 | FromGitter | <deech> True |
14:58:32 | dom96 | and AFAIK no two packages with the same name can be published on hackage |
14:58:56 | FromGitter | <deech> That is also true |
14:59:12 | FromGitter | <deech> How do you have multiple libs in the same project? Different build tasks? |
14:59:45 | dom96 | myPkg/{library1,library2} |
15:00:01 | dom96 | Not sure how build tasks relate to this |
15:01:21 | FromGitter | <deech> And is there a way of specifying dependencies? Like, library3 depends on library1 and library2, so if library3 changes rebuild everything? |
15:02:21 | dom96 | library3 would just depend on myPkg |
15:02:51 | dom96 | does Haskell allow you to depend on a package's sub-library nowadays? |
15:03:02 | FromGitter | <deech> I meant in this situation myPkg/{library1,library2,library3} |
15:03:11 | federico3 | lqdev: linked in the pkg directory footer |
15:03:12 | FromGitter | <deech> Yes, that's a feature as of Cabal 3. |
15:03:38 | * | ng0_ joined #nim |
15:03:43 | dom96 | I don't get why this would be necessary, a package is a package. All libraries within it are always at the same version: the package's version. |
15:04:23 | * | ng0_ quit (Client Quit) |
15:04:43 | * | ng0_ joined #nim |
15:06:00 | * | ng0 quit (Disconnected by services) |
15:06:31 | * | ng0_ quit (Client Quit) |
15:06:45 | * | ng0 joined #nim |
15:06:45 | * | ng0 quit (Changing host) |
15:06:45 | * | ng0 joined #nim |
15:10:17 | * | chemist69 quit (Ping timeout: 260 seconds) |
15:10:26 | FromGitter | <deech> Switching subjects, is there a way to statically introspect on all 'proc's that would match some concrete type 'Foo', eg. given `proc f(foo: Foo ..) ... , proc g(foo: Foo ...), proc h[T](t: T, ...):` invoking it would return `NimNode`s for `f`, `g` but not `h`? |
15:11:17 | * | chemist69 joined #nim |
15:16:15 | * | sealmove quit (Quit: WeeChat 2.6) |
15:17:02 | * | krux02 joined #nim |
15:21:22 | clyybber | krux02: Hey, I'd like your opinion on #12907 |
15:21:24 | disbot | https://github.com/nim-lang/Nim/pull/12907 -- 3lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y |
15:22:04 | krux02 | ok |
15:22:26 | clyybber | I think its better to introduce a helper macro callWithArgs(fun, args) and fix len to work on varargs[untyped] |
15:27:58 | Araq | deech: not sure what exactly you mean but procs are inside modules and there is no time when we know all the modules/procs |
15:28:22 | Araq | or at least we don't tell you when we're in the "linking" step |
15:42:41 | FromGitter | <deech> Araq: I understand that overloading is open world, I meant whatever is in scope at the time of the call. |
15:45:18 | disruptek | deech: i think there is a way to query dispatch, which is i think what you're asking. but that's about all i can offer. |
15:45:40 | FromGitter | <deech> Yes that's what I want. |
15:46:07 | disruptek | i think lqdev might be the person to talk to, as he had a similar problem iirc. |
15:46:31 | disruptek | or check out his euwren project to see if there's a solution inside. |
15:46:35 | disruptek | !repo euwren |
15:46:37 | disbot | https://github.com/liquid600pgm/euwren -- 9euwren: 11High-level Wren wrapper for Nim 15 12โญ 0๐ด |
15:47:12 | FromGitter | <deech> Nice, thanks! |
15:48:06 | disruptek | i hope it helps and i'm sorry i don't have a better lead. ๐ |
15:48:34 | krux02 | clyybber: well looked into #12907 and I see that it is about `varargs`. |
15:48:34 | disruptek | also check out nimph for your packaging issues. i think it solves your concerns. |
15:48:36 | disbot | https://github.com/nim-lang/Nim/pull/12907 -- 3lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y |
15:48:55 | krux02 | I started to write my opinion about it, but I realized it doesn't work out. |
15:49:25 | krux02 | My true opinion about `varargs` is, `varargs` is broken, and it can't be fixed. Just don't use it. |
15:50:05 | krux02 | clyybber, https://github.com/nim-lang/Nim/issues/10975 |
15:50:08 | disbot | โฅ Self Conflicting Logic in varargs Parameter Passing ; snippet at 12https://play.nim-lang.org/#ix=2510 |
15:50:51 | disruptek | right, it's broken. |
15:52:18 | krux02 | clyybber: But I agree that we should have a ``callWithArgs``. Something to unroll varargs properly. |
15:52:32 | krux02 | It doesn't need to be ``callWithArgs``. |
15:53:48 | clyybber | Yeah, I don't care about the name |
15:53:58 | krux02 | It should be a language feature, and forwarding varargs to another function without explicitly unrolling them via ``callWithArgs`` or the unroll operator should be a compilation error. |
15:54:23 | clyybber | Exactly! |
15:55:19 | * | akitoshi quit (Quit: Connection closed for inactivity) |
15:55:20 | krux02 | There is a macros.unpackVarargs |
15:55:23 | krux02 | but that doesn't work |
15:55:41 | krux02 | because it relies on the broken varargs passing |
15:56:44 | krux02 | I don't know when and if this will be implemented in Nim. |
15:57:06 | * | Vladar joined #nim |
15:57:24 | krux02 | I am not hired anymore to work for Nim. And I currently don't have a job that uses Nim. |
15:59:21 | * | Zevv joined #nim |
15:59:39 | clyybber | Oh, I wasn't aware. Thank you for your help though, in this case macros.unpackVarargs was the solution to what timotheecour actually wanted |
16:03:05 | krux02 | I don't think so. |
16:03:39 | krux02 | He wanted the length of a `varargs` that is passed down to a template |
16:03:54 | krux02 | but a template doesn't really have a varargs construct like a proc. |
16:04:17 | krux02 | for procs a varargs is converted into a sequence like object. In templates this is not the case |
16:04:33 | krux02 | in templates varargs can be forwarded as arguments to other procs. |
16:04:49 | krux02 | It is just that this forwarding is wonky and ill specified. |
16:05:06 | krux02 | I go into further details in the issue that I posted. |
16:05:38 | krux02 | but even if you have this proper varargs forwards in templates, it doesn't tell you the number of arguments that you have in a template. |
16:05:43 | clyybber | I wanted that length for the purpose of creating aliases though |
16:05:50 | clyybber | And for that unpackVarargs works fine |
16:05:55 | clyybber | I tested it with his testcase |
16:06:21 | clyybber | Now I'll try to fix the weird behaviour of len |
16:06:43 | krux02 | well the example `len(a)` where `a` is the argument. |
16:06:49 | krux02 | arguments |
16:06:51 | clyybber | s/I/he |
16:07:07 | krux02 | the behavior is correct |
16:07:28 | krux02 | `len(a)` is the way how you forwards arguments to a function |
16:07:34 | krux02 | in this case it is just one argument |
16:07:39 | krux02 | and the length of that argument is 4 |
16:07:48 | clyybber | But that is broken |
16:07:50 | krux02 | that is correct in it's current ill specified behaivor. |
16:07:55 | clyybber | it is rarely useful |
16:08:11 | krux02 | but that is the only way you can forward arguments. |
16:08:19 | krux02 | there is no unroll operator. |
16:08:25 | clyybber | No, you can use unpackVarargs |
16:08:40 | krux02 | How do you think `unpackVarargs` gets it's arguments? |
16:08:48 | clyybber | I know, but it works :) |
16:08:50 | * | nsf quit (Quit: WeeChat 2.6) |
16:09:03 | clyybber | krux02: Umm, but it iterates through it |
16:09:19 | clyybber | result.add args[i] |
16:09:21 | clyybber | this is fine |
16:09:25 | krux02 | in `unpackVarargs` you have a macro. |
16:09:38 | krux02 | a macro is different that a proc or a template. |
16:10:00 | krux02 | you have the ast that you can iterate through. |
16:10:01 | clyybber | yeah, but forwarding varargs to procs that don't accept varargs is a bad idea |
16:10:18 | clyybber | and should not work without unpackVarargs IMO |
16:10:29 | krux02 | there is len, items, node[i], that implements the seq like concept |
16:10:33 | krux02 | but it isn't a seq |
16:10:43 | krux02 | in procs it is a seq |
16:11:12 | clyybber | yes, and I'm arguing that it should be an array/seq/openarray in templates too |
16:11:18 | krux02 | only in templates you are in this weird hybrid land where don't know if you have a compile time list of arguments or a runtime list of arguments. |
16:12:20 | krux02 | No I don't think it should be a array/seq/openarray in templates, too. It should be an argument list that can be used only when explicitly paired with the unroll operator of arguments. |
16:12:25 | krux02 | This is how it works in C++ |
16:12:32 | krux02 | (variadic templates) |
16:12:37 | krux02 | it is well specified. |
16:12:53 | krux02 | you would only need to copy that behaviour. |
16:12:54 | clyybber | krux02: Thats equivalent to what I am saying |
16:13:09 | krux02 | not sure |
16:13:46 | krux02 | when you have an arr/seq/openarray that is not something that you can unroll as individual arguments anymore. |
16:14:16 | clyybber | you can, using unpackVarargs |
16:14:25 | clyybber | or in general a loop |
16:14:29 | krux02 | no you can't |
16:14:55 | clyybber | in a macro I can |
16:15:20 | krux02 | because if you have a real array/seq/openarray in templates, this array/seq/openarray will be a single argument to `unpackVarargs`, and you won't be able to iterate anything in `unpackVarargs` anymore. |
16:16:08 | clyybber | but varargs expands arrays? |
16:16:15 | clyybber | Or is that where the issue lies? |
16:16:22 | clyybber | s/lies/is |
16:16:44 | krux02 | varargs is the issue. |
16:16:57 | krux02 | The problem is `varargs` isn't very specific. |
16:17:10 | krux02 | varargs in templates, varargs in procs, varargs in macros |
16:17:13 | krux02 | that is specifc |
16:17:51 | krux02 | those are three fundamentally different things that look the same and are all called `varargs`, but when you mention a problem, you should specify which one of them has the problem. |
16:18:52 | krux02 | in `proc foo(args: varargs[int])`, args is a container of `int`. |
16:19:26 | krux02 | in `macro foo(args: varargs[int])`, `args` is a NimNode, where each child has the type `int`. |
16:19:56 | krux02 | in `template foo(args: varargs[int])`, `args` is a, yea don't know, make it whatever works. |
16:20:01 | krux02 | and that is the problem |
16:20:39 | krux02 | the behavior of template varargs is not only unspecified, the implementation also has self conflicting logic. |
16:22:10 | clyybber | krux02: For the problem that timothee is trying to solve though it all works out: http://ix.io/251f/nim |
16:22:24 | clyybber | This varargs in all 3 forms |
16:24:22 | krux02 | yea might be |
16:27:21 | krux02 | but do you see the structural problem with varargs. |
16:27:23 | * | chemist69 quit (Ping timeout: 245 seconds) |
16:27:44 | clyybber | yes |
16:27:54 | clyybber | And I want to fix it |
16:28:40 | FromGitter | <Clyybber> @timotheecour http://ix.io/251f/nim your task can be solved without lenVarargs |
16:28:46 | FromGitter | <Clyybber> Though arguably with an macro import |
16:31:15 | * | chemist69 joined #nim |
16:31:17 | clyybber | krux02: Its relatively easy to fix though, simply make varargs[T] behave like an array param in a template. This won't cause problems, since when you pass it to a varargs proc or macro it will be expanded |
16:31:32 | clyybber | at least easy to fix conceptually :D |
16:32:08 | krux02 | clyybber: sorry that won't work |
16:32:12 | krux02 | look into my issue |
16:33:34 | krux02 | template indirectCall(args: varargs[untyped]) = foo(args) ; proc foo(arg1, arg2, arg3: int) = discard ; indirectCall(1,2,3) |
16:33:44 | krux02 | that one should work as well |
16:34:06 | krux02 | even though I would enforce a `unrollVarargs`. |
16:35:38 | clyybber | it is still better than the status quo. And yeah, one can just use `unrollVarargs` which will continue to work |
16:36:02 | clyybber | afaict your issue is related to the varargs auto conversion |
16:36:06 | krux02 | you know why I don't like `unrollVarargs`? |
16:36:24 | krux02 | yea I already said it. |
16:36:37 | clyybber | yeah |
16:36:39 | krux02 | It realies on this weird `varargs` logic |
16:36:51 | clyybber | but that logic is not weird IMO |
16:37:01 | clyybber | unrolling an array is fine |
16:37:06 | clyybber | where it gets tricky is with conversions |
16:40:27 | * | Trustable joined #nim |
16:42:31 | disruptek | it's a concept that got bodged to fit different uses and so building on it is unsafe. unrollVarargs is as fine as anything that came before, but krux02 is right -- we need something more consistent. |
16:45:39 | * | chemist69 quit (Ping timeout: 260 seconds) |
16:46:48 | * | Trustable quit (Ping timeout: 260 seconds) |
16:47:22 | krux02 | OpenArray is so much better than varargs. |
16:47:29 | * | chemist69 joined #nim |
16:47:51 | * | tane quit (Ping timeout: 265 seconds) |
16:49:20 | disruptek | hearts and minds, people; hearts and minds! |
16:52:05 | krux02 | Well, I have to go now. |
16:52:07 | krux02 | bye |
16:52:16 | disruptek | cya krux02 |
16:52:21 | * | krux02 quit (Remote host closed the connection) |
16:52:51 | * | Trustable joined #nim |
16:52:53 | disruptek | today we implement `nimph roll`. |
16:53:07 | disruptek | i'm thinking you use it like this: |
16:53:23 | disruptek | nimph roll "npeg > 0.21.3" |
16:53:33 | disruptek | or nimph roll "npeg == 0.21.3" |
16:53:51 | disruptek | the same syntax as for nimble's `requires` statement. |
16:54:06 | disruptek | except that we also support ^ ~ and *. |
16:54:13 | clyybber | bye |
16:54:30 | clyybber | oh, already gone |
16:54:32 | clyybber | heh |
16:55:24 | disruptek | maybe we should just merge it with clone. |
16:55:32 | clyybber | disruptek: And nimph upgrade would just be: nimph roll "pkg > $curr" ? |
16:56:19 | disruptek | maybe? |
16:56:44 | disruptek | upgrade and downgrade are implemented via roll() right now. |
16:57:11 | disruptek | roll itself would be impl with rollTowards(requirement). |
16:57:48 | FromGitter | <deech> Aside from interop what problems does `varargs` solve that can't be addressed with a `seq`? |
16:58:06 | disruptek | auto-conversion. |
16:58:51 | FromGitter | <deech> Can also map over a seq, no? |
16:59:20 | disruptek | yeah, but varargs lets you pass arguments of disparate type which are all converted using the converter you specify. |
16:59:45 | disruptek | have you ever had seqs with two different types? |
16:59:58 | disruptek | that would make you biseqsual. |
17:00:00 | FromGitter | <deech> Ah yeah, that is convenient. |
17:00:31 | FromGitter | <deech> I think hlists are maybe possible in Nim with concepts but not sure. |
17:00:43 | clyybber | nope |
17:00:55 | clyybber | I don't think so |
17:01:00 | clyybber | maybe with case objects |
17:02:15 | disruptek | should `nimph path` operate on projects that we have paths to but aren't in your dependencies? as a fall-back? |
17:02:34 | * | tane joined #nim |
17:02:52 | clyybber | what does nimph path do? |
17:03:08 | disruptek | you pass it an import name and it yields a directory. |
17:03:12 | disruptek | or n import names. |
17:03:35 | disruptek | i use it to have a shell alias `goto` so i can `goto npeg` and end up in my npeg dep's repository. |
17:03:52 | clyybber | then I say yeah it should |
17:04:07 | disruptek | so whatever it can find, even if it's not a dep. |
17:05:13 | clyybber | yeah |
17:05:23 | clyybber | or make it an option |
17:05:27 | clyybber | nimph path -a |
17:05:47 | disruptek | i'm trying to avoid options, or indeed any configuration. |
17:06:20 | disruptek | easier to use, easier to document, easier to understand. easy to make expectation match reality. |
17:07:44 | disruptek | upgrade means "pick the maximally acceptable version", and downgrade means the opposite. |
17:07:56 | disruptek | it won't upgrade outside of your requirements. |
17:08:47 | FromDiscord | <slymilano> To the Nitter author: I'm curious what kind of memory usage you see now that its been on HN frontpage and people are using it. |
17:09:32 | clyybber | zedeus is the one to ask |
17:10:38 | clyybber | disruptek: I understand avoiding configuration, but avoiding options I do not :p |
17:11:05 | FromDiscord | <slymilano> @zedeus When you get a chance ๐ very happy to see Nim gaining some high-profile end user projects. Nim needs some killer apps, put it on the map, |
17:11:24 | clyybber | but yeah, if you don't want that option I'd say go for everything in the path |
17:11:56 | zedeus | slymilano: 310 MB but I think there's a tiny memory leak somewhere |
17:12:13 | FromGitter | <bung87> can I declare a type all field is public ? |
17:12:20 | FromDiscord | <slymilano> Thanks Zedeus |
17:12:38 | * | dddddd joined #nim |
17:12:52 | clyybber | bung87: No you gotta use * on every field |
17:12:54 | disruptek | clyybber: i'm in favor of options but the default should be the most useful. |
17:13:15 | clyybber | yeah, I agree. Then I'd say make it search everything |
17:13:20 | clyybber | And leave out the option |
17:13:20 | disruptek | maybe --strict will reject non-deps, for example. |
17:13:31 | clyybber | Yeah, that would work too |
17:13:48 | FromGitter | <bung87> too many, since the struct is not write by myself. |
17:14:22 | FromGitter | <bung87> if it required Iโll use regex replace |
17:14:45 | clyybber | bung87: Yeah regex is the way to go then |
17:14:54 | clyybber | bung87: Curious, was it machine written? |
17:17:33 | * | clyybber quit (Quit: WeeChat 2.7) |
17:17:55 | * | clyybber joined #nim |
17:18:53 | FromGitter | <bung87> no, write by other ones, guess I will try to write a transpiler when this finished |
17:22:27 | * | clyybber quit (Client Quit) |
17:24:08 | Zevv | bung87: how is npeg doing for you, is it of any use? |
17:26:51 | FromGitter | <bung87> I think it works well, I am trying to make it handle two syntax of templates, but fails |
17:28:52 | FromGitter | <bung87> then I think I will define two proc handle this, I have problem to make it handle elm syntax, since I never write such program before |
17:32:06 | FromGitter | <bung87> guess it will be simple than the example you provide me, itโs functional ,I can handle every element individually ,right |
17:32:56 | Zevv | sure, good to hear. |
17:33:19 | Zevv | parsing all of elm is probably some work, but it is ratively compact for a programming language I guess |
17:36:50 | FromGitter | <bung87> I just thought someday I can use it in web framework , and provide functions in template. like jsx does |
17:36:52 | * | nsf joined #nim |
17:42:31 | * | Trustable quit (Quit: Leaving) |
17:45:16 | FromDiscord | <Rika> does the `threadpool` use green threads? if not, what does? |
17:59:44 | * | endragor quit (Remote host closed the connection) |
18:04:32 | disruptek | the closest thing to green threads is async. |
18:04:56 | disruptek | the coro module is essentially deprecated. |
18:08:22 | Zevv | ;( |
18:08:54 | disruptek | when you `nimph roll "npeg > 0.20.0"` you want it to obey your requirements, right? dependencies, etc. |
18:09:54 | FromGitter | <nixfreakz_twitter> Is nim compiled to ansii C code? So disassemble code should look the same ? |
18:11:35 | disruptek | there are myriad ways to compile c just as there are myriad ways to write c that compiles to identical pieces of asm. |
18:11:44 | * | MarquisdeFalbala joined #nim |
18:11:50 | disruptek | nim compiles to c. |
18:15:36 | FromDiscord | <Milerius> Hello, i have an infinite loop when i'm compiling, i tried with verbosity to type manually the compilation line, and it's compiling in 1 second, why nim compiler is stuck ? it's really strange |
18:16:40 | FromDiscord | <Rika> disruptek, oof; i am really stupid as i still cannot understand the meaning of most async keywords |
18:16:55 | disruptek | i can help you with that. |
18:16:58 | FromDiscord | <Rika> Milerius, do you have code |
18:17:31 | disruptek | async is easy if you just keep in mind that an async proc is essentially an iterator. |
18:18:01 | FromDiscord | <Milerius> yeah one second ! |
18:21:24 | FromDiscord | <Milerius> Ah it's compiling now, i just cleaned the cache, and now it's working :p |
18:21:29 | FromDiscord | <Milerius> but sometimes the compiler is stuck |
18:21:54 | FromDiscord | <Milerius> Even if there is an error from clang compiler, it's seem's not catched by nim compiler and there is an infinite loop |
18:26:10 | FromDiscord | <slymilano> Does `strutils.replace` do a replace in place, or return a modified string? |
18:26:33 | FromDiscord | <Rika> check the docs |
18:26:51 | FromDiscord | <slymilano> Doesn't explicitly say https://nim-lang.org/docs/strutils.html#replace%2Cstring%2Cchar%2Cchar |
18:28:07 | solitudesf | it returns a string and doesn't have a `var` parameter. pretty explicit. |
18:35:44 | FromDiscord | <slymilano> I don't need it yet thankfully, but it seems SSL support for the stdlib is not a thing yet? Is there a PR I can follow for updates in the future? |
18:35:59 | disruptek | ssl support is a thing. |
18:36:12 | FromDiscord | <Milerius> do we have a tutorial how to debug nim code with gdb ? |
18:36:40 | solitudesf | https://www.youtube.com/watch?v=DmYOPkI_LzU |
18:36:49 | FromDiscord | <Milerius> thanks |
18:39:42 | * | clyybber joined #nim |
18:41:28 | * | clyybber quit (Client Quit) |
18:42:14 | * | endragor joined #nim |
18:45:52 | * | solitudesf quit (Quit: Leaving) |
18:46:22 | * | solitudesf joined #nim |
18:46:26 | * | endragor quit (Ping timeout: 240 seconds) |
18:51:03 | FromGitter | <atemerev> Hi all โ just wanted to ask, where I could find an example of writing something to memory mapped file via memfiles? Or, more generally, writing stuff to memory buffers? |
18:54:47 | disruptek | zevv is a big fan of memfiles. |
18:54:56 | disruptek | !repo npeg |
18:54:58 | disbot | https://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 72โญ 4๐ด |
18:55:09 | disruptek | maybe he has a smaller example use. |
18:55:37 | FromGitter | <atemerev> Thanks! |
18:57:17 | * | silvernode joined #nim |
18:58:23 | disruptek | let us know if you find a better source. ๐ |
18:58:52 | silvernode | Top of the afternoon everyone! |
18:59:08 | disruptek | hi ho silvernode |
18:59:39 | FromGitter | <Willyboar> :) |
18:59:51 | * | clyybber joined #nim |
19:00:54 | clyybber | Araq: Currently in the process of writing down a spec, but I think alias refs are the missing part of the owned ref model. |
19:01:03 | silvernode | disruptek: Hey buddy, nice to see you. |
19:01:50 | silvernode | clyybber: I see you are also in the voidlinux IRC too. |
19:01:54 | disruptek | where else would i be? ๐ |
19:03:46 | shashlick | anyone have any ideas on #12939 |
19:03:49 | disbot | https://github.com/nim-lang/Nim/issues/12939 -- 3stdout cannot be reassigned on some systems ; snippet at 12https://play.nim-lang.org/#ix=253B |
19:07:04 | clyybber | silvernode: Yep |
19:10:04 | clyybber | shashlick: Why do you need to? |
19:11:11 | * | seerix quit (Quit: Leaving) |
19:11:21 | * | seerix joined #nim |
19:11:40 | clyybber | shashlick: I mean: Why do you need to reassign stdout.. |
19:12:31 | shashlick | I want to redirect all echos to a file |
19:12:39 | shashlick | and then later, restore back to stdout |
19:12:53 | shashlick | reopen() allows to set stdout to a file, but you cannot restore it back then |
19:13:41 | clyybber | hmm |
19:14:01 | clyybber | I don't think you can do that |
19:14:21 | clyybber | bbl |
19:14:22 | * | clyybber quit (Quit: WeeChat 2.7) |
19:14:46 | shashlick | you can in python and it does work in Nim on other OS |
19:15:35 | FromDiscord | <Rika> i dont see why you shouldnt be able to do this |
19:17:39 | FromGitter | <nixfreakz_twitter> I aplologize |
19:18:11 | FromGitter | <nixfreakz_twitter> I |
19:18:22 | FromDiscord | <Rika> ?? |
19:20:09 | FromGitter | <nixfreakz_twitter> I apologize if this is a dupe but is the disassembled code using GDB or another debugger going to be the same as other C code? |
19:22:40 | * | mjsir911 joined #nim |
19:23:58 | disruptek | there are myriad ways to compile c just as there are myriad ways to write c that compiles to identical pieces of asm. |
19:24:08 | disruptek | nim (still) compiles to c. |
19:24:41 | FromGitter | <nixfreakz_twitter> Ok very good thanks |
19:29:06 | disruptek | `nimph roll` is now a thing: https://github.com/disruptek/nimph#roll |
19:30:43 | FromGitter | <bung87> @atemerev https://nim-lang.org/docs/memfiles.html#%24%2CMemSlice you have std memfiles |
19:32:37 | shashlick | how do you check for nim check mode? |
19:34:03 | * | muffindrake joined #nim |
19:34:31 | shashlick | `if defined(nimsuggest) or c.config.cmd == cmdCheck` |
19:34:48 | shashlick | that's what the compiler does - i can do a when defined(nimsuggest) but how do I check for cmdCheck |
19:35:01 | shashlick | there should be some way to do this in a when statement in user code |
19:35:11 | disruptek | is that wise? |
19:37:15 | disruptek | i'm not sure i want a programmer forcing me not to check. |
19:37:16 | shashlick | well, how else can I fix the nimterop issue where gorge/writeFile doesn't work in nimsuggest/check modes? |
19:37:30 | shashlick | if i cannot detect the case |
19:37:52 | disruptek | it sounds like you have a solution for the nimsuggest case. |
19:38:06 | shashlick | am trying |
19:38:30 | disruptek | i'm not sure it's the compiler's job to provide a solution to every problem, especially at the expense of other programmers. |
19:38:47 | disruptek | scratch that. i /am/ sure it's /not/ ๐ |
19:39:10 | FromGitter | <mratsim> I have the same problem with nimdoc :/ |
19:39:25 | disruptek | there's a nimdoc when, iirc. |
19:39:29 | disruptek | but, yes, it's broken with nesm. |
19:39:32 | disruptek | sucks. |
19:39:41 | FromGitter | <mratsim> you have to add when defined(nimdoc) everywhere on optional stuff |
19:39:44 | shashlick | well then i can fix nimsuggest, nim check can take a hike eh |
19:40:19 | disruptek | i mean, nim check seems useless if it doesn't reflect real compilation inputs. |
19:43:08 | muffindrake | I'm a bit skeptical about the garbage collector statistics that seem to be displayed on the nim website. Is there more data I can look at? |
19:43:40 | disruptek | where are these shady stats? |
19:43:51 | FromGitter | <mratsim> here I guess |
19:43:52 | FromGitter | <mratsim> https://nim-lang.org/features.html |
19:44:10 | FromGitter | <mratsim> Nim default garbage collector is based on TLSF which was designed for soft real-tim system |
19:44:54 | FromGitter | <mratsim> See: http://www.gii.upv.es/tlsf/ for papers |
19:46:16 | FromGitter | <mratsim> More exactly: http://www.gii.upv.es/tlsf/files/papers/tlsf_desc.pdf |
19:47:06 | muffindrake | Thank you. |
19:47:49 | FromGitter | <mratsim> Note that it will be replaced by a new default garbage collector in 2020 which has even better characteristics |
19:48:32 | FromGitter | <mratsim> also while the default GC has good latency, it's still deferred reference counting and if stop-the-world is acceptable, you can use a mark-and-sweep GC like java which has better throughput |
19:49:02 | FromGitter | <mratsim> you can also use the Boehm GC which is currently the ighest performing GC in Nim (besides doing manual memory management) |
19:49:26 | FromGitter | <mratsim> *or using destructors |
19:50:15 | disruptek | nim doesn't lack for options; it lacks for bad options. ๐ |
19:51:15 | * | nsf quit (Quit: WeeChat 2.6) |
19:51:40 | muffindrake | Heh, that paper has what appears to be pseudocode, but it's actually Ada code |
19:52:01 | FromGitter | <mratsim> See destructors description: https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst โ โ The new GC RFC arc/orc that is under heavy development at the moment and can be tested: https://github.com/nim-lang/RFCs/issues/177 โ โ And the future a long time from now: https://github.com/nim-lang/RFCs/issues/144 [https://gitter.im/nim-lang/Nim?at=5dfe77e049314a1d45b97c7a] |
19:52:02 | disbot | โฅ Proposal to add 'owned' refs to Nim ; snippet at 12https://play.nim-lang.org/#ix=24U9 |
19:52:52 | * | mkuentz joined #nim |
19:53:48 | FromGitter | <mratsim> impl of TLSF in Nim is here: https://github.com/nim-lang/Nim/blob/fd85a5ae054ece9a1954428b135b1da00e410229/lib/system/alloc.nim#L168 |
19:54:25 | * | silvernode quit (Ping timeout: 265 seconds) |
19:54:28 | FromGitter | <mratsim> and the GC that sits on top is deferred ref counting: https://github.com/nim-lang/Nim/blob/fd85a5ae054ece9a1954428b135b1da00e410229/lib/system/gc.nim |
19:56:40 | disruptek | $ nimph outdated |
19:56:45 | disruptek | would upgrade nimterop from 0.3.6 to v0.4.2 |
19:56:52 | disruptek | shashlick: you been busy, son! |
19:58:20 | shashlick | lots of fixes, some new features |
19:58:44 | disruptek | i see the char defs. |
19:59:10 | shashlick | likes? |
20:00:35 | disruptek | yes much likes yes |
20:00:45 | FromDiscord | <treeform> Can nimph read nimble configs? |
20:00:49 | disruptek | sure. |
20:01:43 | disruptek | tagging is good, right shashlick? |
20:01:55 | disruptek | feels good, doesn't it? |
20:02:06 | shashlick | i'm cool with patch, but still struggling with minor |
20:02:22 | shashlick | i made 4 new features in 0.4.0, couldn't do just one |
20:02:26 | shashlick | ๐ |
20:02:28 | disruptek | heh |
20:03:33 | disruptek | i need feedback on what to impl next. |
20:04:33 | FromDiscord | <treeform> How does nimph deal diamonds in the dependance graph? |
20:05:26 | disruptek | it uses requirements as a chain of filters against input of a list of releases. |
20:05:29 | * | Vladar quit (Quit: Leaving) |
20:05:35 | disruptek | anything that makes it through is acceptable. |
20:06:00 | FromDiscord | <treeform> https://www.well-typed.com/blog/2008/04/the-dreaded-diamond-dependency-problem/ |
20:06:10 | FromDiscord | <treeform> Will it just error out? |
20:06:52 | disruptek | so, i have this idea that i can solve that but only with the help of the programmer. |
20:07:01 | disruptek | it will error out. |
20:07:03 | disruptek | today. |
20:07:46 | FromGitter | <mratsim> lock files are supposed to solve diamonds |
20:07:58 | disruptek | well, they don't help in our flat-import world. |
20:08:27 | disruptek | the problem is that we cannot hide D1.1 from B because we cannot control a path scope per module. |
20:08:41 | disruptek | if we fix that, we can do anything you want. |
20:08:48 | disruptek | (we can only control scope per app) |
20:08:49 | FromDiscord | <treeform> I see |
20:09:27 | disruptek | lockfiles work well in nimph but they aren't all that useful. |
20:11:03 | FromDiscord | <treeform> Does nimph need the huge json file to function? |
20:11:08 | disruptek | nah. |
20:11:35 | FromDiscord | <treeform> Can it work with just git urls? |
20:11:50 | disruptek | yes. |
20:17:51 | muffindrake | Are named parameters in nim? |
20:17:57 | disruptek | yes. |
20:18:42 | disruptek | any parameter may be dispatched by name, actually; not just parameters with default values. |
20:19:00 | * | NimBot joined #nim |
20:26:57 | * | clyybber joined #nim |
20:28:31 | * | mkuentz left #nim ("Killed buffer") |
20:29:42 | enthus1ast | in karax: how can i call js functions on elements, lets say i do `document.getElementById("player")` player is html audio tag. How can i call `.load()` or `.play()` on it? |
20:30:43 | Zevv | sealmove: well, now you've done it. I was hoping that idea would just go away if I didn't spend any time thinking about it |
20:33:38 | clyybber | Zevv: What idea? |
20:35:12 | Zevv | making npeg parse openarray[WhateverYouWant] instead of only strings |
20:35:25 | Zevv | where WhateverYouWant is typically a lexed token stream |
20:35:52 | Zevv | so I just felt brave enough to go genericize all kinds of guts inside npeg, and now my C compiler starts vomiting on the carpet |
20:36:18 | Zevv | like http://ix.io/2543 |
20:37:42 | mjsir911 | is there an equivalent in nim to `if __name__ == '__main__'` in python? I want to do different things if imported or if the file is what is compiled |
20:38:02 | disruptek | if isMainModule: |
20:38:08 | disruptek | er, when isMainModule: |
20:38:14 | mjsir911 | thanks! that's exactly what I'm looking for |
20:38:28 | mjsir911 | yeah, I figured it should be a `when`. just hard to find words to ctrl+f for :P |
20:38:39 | disruptek | yeah, i hear ya. |
20:41:21 | * | watzon[m] joined #nim |
20:45:32 | Zevv | My problem seems that I can't genericize to an openArray like this: https://play.nim-lang.org/#ix=2547 |
20:46:10 | * | endragor joined #nim |
20:49:42 | FromGitter | <mratsim> Another one falls victim to macro + generics |
20:51:17 | Zevv | I've hit a lot of nasty spots when building NPeg. Stuff now works fine, but every time I try to touch something in these areas I get covered in stink. |
20:51:27 | * | endragor quit (Ping timeout: 265 seconds) |
20:51:54 | Zevv | I need some serious help one day from people who understand what they're doing and refactor that |
20:54:38 | FromGitter | <mratsim> Those are my journal logs of me fighting against generics: https://github.com/nim-lang/RFCs/issues/44, https://github.com/nim-lang/Nim/issues/8677 |
20:54:38 | disbot | โฅ [Meta] Generics/Static early symbol resolution |
20:55:07 | FromGitter | <mratsim> Those are the only reason I understand what I mostly can do. Lost so much time on those |
20:56:55 | * | endragor joined #nim |
20:59:12 | FromGitter | <mratsim> So it took me 1 hour to add windows support to Weave and 8 hours of fighting Azure pipeline |
21:00:00 | Zevv | also fun. But you managed! \o/ |
21:04:13 | solitudesf | disruptek, im still getting LineTooLong hint, what the heck |
21:04:27 | disruptek | can you gimme a config file i can use to repro? |
21:04:44 | solitudesf | its nimes package |
21:04:59 | disruptek | def-/nimes? |
21:05:02 | solitudesf | ye |
21:05:23 | disruptek | i don't get a message. |
21:05:27 | disruptek | which nimph? |
21:05:35 | solitudesf | freshly built |
21:06:55 | disruptek | so i have a 177 character line but i'm not getting any error messages from nimph. |
21:07:19 | disruptek | you get it with `nimph nurse`? |
21:07:25 | solitudesf | i get it with `nimph` |
21:07:51 | disruptek | same thing. just disambiguating. so i guess there's something else at play somewhere. some other nim.cfg in use? |
21:11:33 | solitudesf | whatever, im too exhausted to investigate this. if no one else reproduces this, we'll write that off as me developing schizophrenia |
21:11:53 | disruptek | nah, it's clearly not you. |
21:12:17 | disruptek | you're running nimph in a project that requires nimes or you're running it in nimes itself? |
21:12:54 | solitudesf | im running it in project not related to nimes in any way |
21:13:17 | disruptek | i don't even get a message when building nimes. |
21:13:59 | disruptek | maybe i have this disabled somewhere else. |
21:15:01 | disruptek | ahh, that hint is disabled in stock Nim compiler config. |
21:15:07 | disruptek | so you must be re-enabling it somewhere. |
21:15:32 | disruptek | if you build nimph with -d:debug it will turn the config hints back on and you can see which configs it is evaluating. |
21:15:52 | disruptek | if you care. ๐ |
21:16:15 | solitudesf | my nim tree is clean and i commented out every potentially offending line in my config |
21:17:10 | disruptek | it's line 16 on 1.0.4. config/nim.cfg. |
21:18:19 | disruptek | hmm, we could dump the config options with a debug flag if you want. i'm not sure how interested you are in fixing it. |
21:19:18 | disruptek | i mean, after we load the config we could investigate it. we could also diff it against a load without parent configs, though that'd probably be kinda useless in practice. |
21:32:55 | * | MarquisdeFalbala quit (Remote host closed the connection) |
21:41:01 | * | clyybber quit (Quit: WeeChat 2.7) |
21:50:18 | FromGitter | <deech> @mratsim What Nim is trying to do with macros and types is quite difficult to get right, the Typed Racket people constantly publish this even today. |
21:51:05 | FromGitter | <mratsim> Yeah I know, it doesn't make it less painful though ;) |
21:52:51 | FromGitter | <deech> I guess what I'm getting at is that maybe some kinds of macro definitions should be artificially restricted. |
21:57:04 | * | voltist joined #nim |
22:05:52 | * | _roci joined #nim |
22:07:01 | * | _roci left #nim (#nim) |
22:10:21 | * | gour quit (Remote host closed the connection) |
22:14:20 | * | clyybber joined #nim |
22:31:28 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
22:32:32 | FromGitter | <deech> Any chance someone's working on https://github.com/nim-lang/Nim/issues/12188? It seems quite tricky and happens because of a optimization https://github.com/nim-lang/Nim/blob/devel/compiler/semexprs.nim#L875. Unfortunately removing that optimization breaks a lot of existing Nim programs. |
22:32:34 | disbot | โฅ Compile time arguments evaluate too early causing unwanted side effects ; snippet at 12https://play.nim-lang.org/#ix=2553 |
22:33:33 | * | qwertfisch joined #nim |
22:44:04 | clyybber | deech: I don't think anybodys working on it atm. It seems tricky |
22:44:45 | disruptek | doesn't sound like optimization is the right word. |
22:44:56 | clyybber | deech: But I'm not even sure its a bug |
22:45:08 | * | solitudesf quit (Ping timeout: 268 seconds) |
22:45:17 | FromDiscord | <Xydium> Is there a library function for a full recursive AST iterator? I can only find the items function |
22:50:11 | * | tane quit (Quit: Leaving) |
22:55:12 | * | chemist69 quit (Ping timeout: 260 seconds) |
22:55:36 | * | chemist69 joined #nim |
23:02:22 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
23:02:49 | * | qwertfisch joined #nim |
23:04:22 | FromGitter | <deech> disruptek: https://github.com/nim-lang/Nim/blob/devel/compiler/semexprs.nim#L753 |
23:05:00 | disruptek | yes, but the thing about optimizations is that you can remove them. |
23:05:24 | FromGitter | <deech> I get it. |
23:05:37 | disruptek | ๐ |
23:10:54 | * | sealmove joined #nim |
23:12:16 | FromGitter | <mratsim> @Xydium I think you almost always need to write your own |
23:13:16 | FromGitter | <mratsim> this is an example to only work on identifiers and symbol: https://github.com/nim-lang/Nim/blob/devel/lib/pure/sugar.nim#L148-L161 |
23:13:32 | FromGitter | <mratsim> customize the inspect function to the node you need to process |
23:16:40 | FromDiscord | <Xydium> That might work, I'm just trying to find every identifier and replace it with an array access |
23:17:12 | FromDiscord | <Xydium> Its a macro for building a CSP graph, so constraints use named variables but get converted to vararg procs |
23:25:24 | FromGitter | <Varriount> Xydium: Why not just use a template? |
23:28:48 | FromDiscord | <Xydium> Didn't think templates were that expressive |
23:30:24 | FromGitter | <Varriount> Xydium: I mean, does array access get calculated using the identifier name, or something? |
23:31:07 | FromGitter | <Varriount> Like, `ident3through6` -> `arrayVar[3][6]` |
23:31:29 | FromGitter | <Varriount> Or is it more a substitution, `ident` -> `arrayvar[3]` |
23:33:22 | FromDiscord | <Xydium> https://pastebin.com/DxeWUYSf |
23:33:50 | FromDiscord | <Xydium> I need to search the AST for which variables in the graph were used, and they are indexed by order of first appearance in the AST |
23:34:10 | FromDiscord | <Xydium> This way I can traverse once, as opposed to, alphabetically order |
23:34:20 | FromDiscord | <Xydium> Find identifier and substitute all at once |
23:35:00 | FromDiscord | <Xydium> But it's only the identifiers which denote variables defined in the graph |
23:40:33 | FromGitter | <Varriount> Xydium: What is "v" on line 20? |
23:40:51 | FromDiscord | <Xydium> Typo, should be x, the vararg array |
23:42:54 | FromGitter | <Varriount> So the crux of your problem is that you need to turn `Y == X * X` into `v[0] == v[1] * v[1]` |
23:43:27 | FromDiscord | <Xydium> basically |
23:43:43 | FromDiscord | <Xydium> For any number of variables per constraint |
23:44:02 | FromDiscord | <Xydium> And any constraint format, whether infix, prefix, function call, etc |
23:44:39 | FromGitter | <Varriount> Hrm, I wish @mratsim were around. He's better at scientific programming. |
23:44:40 | FromDiscord | <Xydium> `Y >= X + 10 or Y >= Z + 5` is a valid constraint, as is `AllDifferent(X, Y, Z)` |
23:45:06 | FromGitter | <Varriount> Xydium: I can't say for certain whether you could just use a template. |
23:45:37 | FromDiscord | <Xydium> Macros will definitely work, it's just the code to traverse the tree and make substitutions will be messy |
23:45:59 | FromGitter | <Varriount> But keep in mind that macros can define templates. A macro could generate `template X(): untyped = v[1]` |
23:46:50 | FromGitter | <Varriount> Thus, a macro could create a function or set of expressions that generate the templates, then "paste" in the constraint body. |
23:47:28 | FromDiscord | <Xydium> Probably equally complicated though |
23:48:34 | FromGitter | <Varriount> I don't know. The big problem with templates is that you might run into overloading wierdness. |
23:48:56 | FromDiscord | <Xydium> Oh I just realized, there's no way to check whether an identifier names a variable in the graph |
23:49:17 | FromDiscord | <Xydium> Macros are compile-time, the variables don't exist until runtime |
23:49:35 | FromDiscord | <Xydium> I'd need to combine the `define` and `constrain` macros into one |
23:50:13 | FromDiscord | <Xydium> So I have to blindly replace identifiers, or incur the cost of typing some prefix for graph variables |
23:50:27 | FromGitter | <Varriount> If the variables don't exist until runtime, wouldn't you have to store them in a map? |
23:50:51 | * | clyybber quit (Quit: WeeChat 2.7) |
23:51:33 | FromDiscord | <Xydium> https://pastebin.com/R99Gsviq |
23:51:53 | FromDiscord | <Xydium> I'd need to keep a list of the variable names belonging to the graph, and only replace those identifiers in the AST |
23:52:20 | FromDiscord | <mratsim> This might help: traverse JIT assembler statement to searh for clobbered registers: https://github.com/numforge/laser/blob/f4226c4602d7c9bf920438be15ab13e1e124bb97/laser/photon_jit/photon_types.nim#L101-L120 |
23:52:45 | FromDiscord | <mratsim> computation graph generated at compile time: https://github.com/mratsim/compute-graph-optim |
23:53:07 | FromDiscord | <mratsim> the experimentation are order from simple to complex |
23:53:52 | FromDiscord | <mratsim> in the end I now have a compiler implemented as macros, it's still simple as it's in its infancy but you should probably start with my experimentations: https://github.com/numforge/laser/tree/f4226c4602d7c9bf920438be15ab13e1e124bb97/laser/lux_compiler |
23:55:10 | FromDiscord | <Xydium> Thanks for the references, was struggling to find in-the-field examples of macro usage online |
23:55:21 | * | silvernode joined #nim |