<< 21-12-2019 >>

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:43FromDiscord<speckledlemon> Is it expected that the contents of `result` are immutable?
00:27:13FromDiscord<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:03shashlickyou can write to result multiple times
00:45:46FromDiscord<speckledlemon> Sorry, it was a result of doing `for b in result: ...` and attempting to modify `b`, so I misunderstood the issue
00:46:23shashlickno problem
00:52:58*Guest13999 quit (Remote host closed the connection)
00:58:51FromDiscord<slymilano> Is this the official nim package repository? https://nimble.directory/
00:59:07FromGitter<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:53zedeus@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:50leorizedisruptek: that plugin is totally out of nim.nvim scope
02:32:44leorizethere should be plenty of coverage tool for vim though
02:32:52leorizeI 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:26moduledgeHi 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:30zedeusmoduledge: Welcome :) I think you mean this https://nim-lang.github.io/Nim/sequtils.html#toSeq.t%2Cuntyped
02:42:16moduledgezedeus: perfect, yes. Thank you.
02:42:44disruptekleorize: first i have to make coco work.
02:42:57disruptekcouldn't find anything for vim.
02:44:36leorizehttps://github.com/ruanyl/coverage.vim
02:45:32disruptekcoco produces lcov output.
02:46:40FromDiscord<speckledlemon> Dโ€™oh thank you zedeus
02:47:02disrupteki mean, i guess i don't care what it is as long as it works against nim code. ๐Ÿคท
02:48:21leorizehttps://github.com/google/vim-coverage
02:49:31disruptekneither that or maktaba tell me anything useful.
02:49:40disrupteki'm too old for this shit.
02:49:52leorizelooks like it only supports python coverage tools
02:50:24disruptekit creeps up on you.
02:50:32leorizehaizz, guess someone would have to invent a plugin
02:50:48disruptekone day someone says something and you realize you're just an old moron.
02:54:35disruptek!repo vim gcov
02:54:37disbothttps://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:44disruptekwhaddya know
02:55:03disruptek!repo vim lcov
02:55:04disbothttps://github.com/umaumax/vim-lcov -- 9vim-lcov: 11 15 0โญ 0๐Ÿด & 2 more...
02:55:06leorizethere's a vim plugin for most things :P
02:59:07*mal`` quit (Quit: Leaving)
03:02:27disruptekoh it's too dumb.
03:18:03*mal`` joined #nim
03:26:16disruptekthe 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:04FromGitter<sheerluck> ((https://i.imgur.com/bOLlfSI.png))
07:11:38FromGitter<sheerluck> I'm happy
07:41:48FromGitter<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:11FromDiscord<KcVinu> Hi all,
09:06:50FromDiscord<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:09FromDiscord<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:07FromDiscord<KcVinu> seq -
09:09:08FromDiscord<KcVinu> simpleSeq* : seq[typeName] # declaration
09:09:08FromDiscord<KcVinu> result.simpleSeq = newSeq[typeName] # Initialization
09:09:08FromDiscord<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:19solitudesfhttps://nim-lang.org/docs/tables.html
09:30:24lqdev[m]@KcVinu you don't have to initialize seqs and Tables, that's done implicitly
09:30:26FromDiscord<Rika> yeah
09:30:41FromDiscord<Rika> just `a: Table[T]`
09:30:48FromDiscord<Rika> or `a = newTable[T]()`
09:31:07FromDiscord<Rika> (initTable, not new)
09:31:09FromDiscord<Rika> sorry
09:32:02*livcd joined #nim
09:32:31lqdev[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:48FromDiscord<Milerius> @lqDev i pass a JsonNode
09:33:57FromDiscord<Milerius> and it's seem's destroyed by the GC sometimes
09:34:00lqdev[m]JsonNode is ref afaik
09:34:04FromDiscord<Milerius> to i have an invalid object in my C++ map
09:34:06FromDiscord<Milerius> Ok
09:34:13FromDiscord<Milerius> I have another question if you mind
09:34:16lqdev[m]so call GC_ref on it before you pass it to your map
09:34:19lqdev[m]go on
09:34:33FromDiscord<Milerius> Switching to: --gc:markAndSweep i have no crash anymore
09:34:39FromDiscord<Milerius> passing the type to the map
09:34:43FromDiscord<Milerius> How it's work ?
09:36:02lqdev[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:06FromDiscord<mratsim> When you realize that once again Apple breaks all convention :/
09:36:08FromDiscord<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:48lqdev[m]@mratsim that's not POSIX, isn't it?
09:37:01*Vladar quit (Quit: Leaving)
09:37:07FromDiscord<Milerius> @lqdev yeah but the fact is that with MarkAndSweep it's seem's not crashing anymore
09:37:35FromDiscord<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:04lqdev[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:12FromDiscord<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:41FromDiscord<mratsim> pretty sure the GC is collecting your jsonNode while it's stored in C++
09:38:48lqdev[m]@Milerius read more here http://craftinginterpreters.com/garbage-collection.html if you're interested, I found that helpful
09:38:59lqdev[m]@mratsim yeah it is, but not on markAndSweep
09:39:16FromDiscord<mratsim> because mark and sweep checks live object not refcount
09:39:27FromDiscord<Milerius> @lqdev yeah that's why i use mark and sweep
09:39:38FromDiscord<Milerius> Yeah it's what is happening @mratsim
09:39:39FromDiscord<mratsim> it has more throughput anyway
09:39:47FromDiscord<Milerius> Using gc ref seem's to do the job too
09:39:53FromDiscord<Milerius> Should i use the default gc with gc ref/unref
09:39:59FromDiscord<Milerius> or use another gc
09:40:01FromDiscord<Milerius> idk yet
09:40:37FromDiscord<mratsim> mark-and-sweep can introduce GC pauses (same strategy as java)
09:40:51FromDiscord<mratsim> but it doesn't matter if you are not doing games or real-time audio/video
09:40:58lqdev[m]I'd stick with the default, but it really depends on your use case
09:41:21FromDiscord<mratsim> otherwise gc:boehm is in general the best GC
09:41:37FromDiscord<mratsim> until Araq delivers its gc:arc or gc:orc
09:41:40FromDiscord<Milerius> Yeah but i need to use a library for it ?
09:41:45FromDiscord<Milerius> i tried
09:41:46FromDiscord<mratsim> it's shipped by default
09:41:51FromDiscord<Milerius> but he try to load a dylib
09:41:55FromDiscord<Milerius> hmm not for me
09:41:55FromDiscord<mratsim> ah maybe only on windows
09:42:17FromDiscord<mratsim> https://formulae.brew.sh/formula/bdw-gc
09:42:22FromDiscord<mratsim> for mac
09:42:24FromDiscord<Milerius> Ok with GC_ref when inserting, and GC_Unref when destroying seem's to work !
09:43:01FromDiscord<Milerius> I'm trying it. thank's for the suggestion my friend.
09:43:04FromDiscord<Milerius> I Appreciate it.
09:43:26FromDiscord<Milerius> What is the equivalent for linux ?
09:43:29*sealmove joined #nim
09:43:48lqdev[m]it's platform agnostic
09:43:54lqdev[m]ah
09:44:09lqdev[m]it's just libgc
09:44:21lqdev[m]pacman -S libgc
09:44:31lqdev[m]or your distro's equivalent
09:44:35FromDiscord<Milerius> Ok great
09:44:43FromDiscord<Milerius> Why this GC is superior for you @mratsim
09:44:46FromDiscord<Milerius> Compared to the default one
09:44:59FromDiscord<mratsim> it's not for me, it's @Araq benches
09:45:08FromDiscord<mratsim> it's the only multithreaded GC first-of-all
09:45:15FromDiscord<mratsim> and it has high throughput
09:45:19FromDiscord<Milerius> ๐Ÿ˜ฎ
09:45:23FromDiscord<Milerius> I need to use this one so.
09:45:25FromDiscord<Milerius> Thanks
09:45:50FromDiscord<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:48FromDiscord<Milerius> No i have multiple thread that do lot of tasks
09:46:56FromDiscord<Milerius> Writting in concurrent registry
09:47:00FromDiscord<Milerius> Main thread only read
09:47:23FromDiscord<Milerius> I have like 2-3 thread that write into different `folly::concurrent_hash_map`
09:47:31FromDiscord<Milerius> And the main thread (GUI) read into this registry
09:48:46FromDiscord<mratsim> nim default GC is thread-local, you will have one GC per thread
09:49:02FromDiscord<mratsim> as long as what is allocated in a thread is freed in that thread it will work OK
09:49:19FromDiscord<mratsim> the issue is when you allocated a JsonNode in a thread, and free it in another
09:49:53FromDiscord<mratsim> if it works now, you are probably not in that case
09:50:45FromDiscord<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:53FromDiscord<Milerius> otherwise let's stay with bohem atm and let's see
09:51:35FromDiscord<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:08FromDiscord<has1> Hi, i am getting an error when trying to install nim
10:06:10FromDiscord<has1> https://pastebin.com/iRjjQCbQ
10:06:24*nsf quit (Quit: WeeChat 2.6)
10:06:55FromDiscord<has1> I am using the command from the website ```curl https://nim-lang.org/choosenim/init.sh -sSf | sh```
10:09:33Araqhas1: fix your GCC installation
10:13:54FromDiscord<has1> its a fresh install
10:13:58FromDiscord<has1> what am i supposed to fix?
10:14:25FromDiscord<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:12Araqinstall build-essentials, dunno
10:18:29Araqlooks like Clyybber solved it
10:19:52Araqand all we need is an 'isolate' construct
10:21:06FromDiscord<has1> @araq ah yes, that is what the issue is, you have to install "build-essential"
10:21:26FromDiscord<has1> Is this supposed to not work correctly on a fresh linux installation?
10:23:37FromDiscord<mratsim> build-essentials is needed for any C/C++ dev
10:23:42FromDiscord<mratsim> no GCC otherwise
10:23:45FromDiscord<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:28Araqthere is no "fresh linux install", Linux is a plethora of different distributions, all doing things slightly differently
10:24:32FromDiscord<has1> @mratsim my go code (which uses cgo which uses C) works fine with just gcc
10:25:00FromDiscord<has1> I am using linux mint here, which uses ubuntu
10:25:13Araqbuild-essential is not "Linux", it's Ubuntu specific, maybe Debian
10:25:21FromDiscord<mratsim> yes debian
10:25:39FromDiscord<has1> so you dont care if it doesnt work out of the box for ubuntu users?
10:25:50FromDiscord<mratsim> well without build-essentials you don't have make
10:25:57FromDiscord<mratsim> feel free to PR that in
10:26:47dom96has1: As the author of choosenim I do care, make an issue
10:26:54FromDiscord<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:00FromDiscord<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:17FromDiscord<mratsim> All our CI is done on Ubuntu
10:27:24FromDiscord<has1> it could at least be documented on the github page
10:27:31AraqI don't have confidence in your judgement either fwiw
10:27:34FromDiscord<has1> that you might need build-essential, as a minimum
10:27:38FromDiscord<mratsim> well someone has to do that PR, you could be that someone
10:28:07AraqLinux is all about a "shaky" experience.
10:29:01FromDiscord<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:17FromDiscord<has1> It seems like it was a known issue, because one person pointed out build-essential
10:29:23FromDiscord<mratsim> I'm telling you that all Ubuntu devs are installing build-essentials first thing
10:29:25AraqI'm telling you it worked for hundreds of people before you
10:29:48FromDiscord<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:54Araqand you're using the wrong OS anyway when you do care about "it just works"
10:30:12FromDiscord<mratsim> TBH, Go install instructions are really bad on Windows
10:30:34FromDiscord<mratsim> they just hand-wavy tell people to update their environment variable
10:30:39FromDiscord<has1> go has always worked right from the start for me
10:31:09FromDiscord<has1> they give you easy to use instructions, and even tell you which command to add to your .profile or .bashrc file
10:31:16FromDiscord<mratsim> install it on windows
10:31:27dom96has1: 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:35FromDiscord<has1> i did many times, its even easier on windows with the installer
10:31:39FromDiscord<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:48FromDiscord<mratsim> anyway
10:32:24FromDiscord<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:54FromDiscord<mratsim> so, PR or raise the issue in choosenim
10:32:57FromDiscord<Milerius> @has1 Just letting you know that GO on windows embed a gcc...
10:33:03FromDiscord<Milerius> That's why it's work out of the box
10:33:15Araqwe do the same btw. on windows
10:33:23FromDiscord<has1> but the problem is not gcc here
10:33:25Araqwe can't ship GCC for Linux
10:33:33FromDiscord<has1> i had gcc installed
10:33:33FromDiscord<mratsim> there is finish.exe that updates the env variable which go doesn't
10:33:44Araqthe problem is GCC. it lacks crucial header files and you blame us for it
10:34:00FromDiscord<has1> @mratsim you tell me about updating env variables, but choosenim tells me this
10:34:03FromDiscord<has1> ```
10:34:03FromDiscord<has1> choosenim-init: ChooseNim installed in /home/user/.nimble/bin
10:34:04FromDiscord<has1> choosenim-init: You must now ensure that the Nimble bin dir is in your PATH.
10:34:04FromDiscord<has1> choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file.
10:34:04FromDiscord<has1> choosenim-init: export PATH=/home/user/.nimble/bin:$PATH
10:34:05FromDiscord<has1> ```
10:34:09FromDiscord<Milerius> on Ubuntu on cannot dev without build essentials
10:34:13FromDiscord<has1> isn't tat the exact same thing?
10:34:22FromDiscord<Milerius> on Ubuntu you cannot dev without build essentials
10:34:30FromDiscord<mratsim> nop it's not, did you ever try updating env variable on windows?
10:34:59FromDiscord<has1> Did YOU ever try to update env vars on windows 10?
10:35:05FromDiscord<mratsim> I did
10:35:08FromDiscord<has1> Because i did this like 3 weeks ago and it is super easy
10:35:10dom96has1: will you submit this issue or should I just do it myself?
10:35:19FromDiscord<has1> you click on new and add the env var or even browse for a path
10:35:29FromDiscord<has1> @dom96 feel free
10:38:14AraqI would report a Ubuntu bug instead. if you have GCC but not a C environment setup how is it our fault
10:42:18Araqso what should choosenim now do? parse GCC's error messages about missing header files? specific code paths for Debian based distros?
10:46:26Araqapt-get install nim
10:47:38lqdev[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:35stefantalpalaru"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:01FromGitter<mratsim> AFAIK linux headers are in by default on ubuntu
10:50:05FromGitter<mratsim> or supposed to
10:50:06stefantalpalaruNow 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:16FromGitter<mratsim> I checked before trying to use futex yesterday
10:51:48stefantalpalaruDon't you need to select a "development" bundle during installation?
10:52:37lqdev[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:43lqdev[m]I'm sure everybody does.
10:52:54FromGitter<mratsim> yep, did it yesterday with glibc
10:53:01stefantalpalaruSomeone 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:07FromGitter<mratsim> I don't want to deal with their tracker
10:55:10*Zevv quit (Ping timeout: 258 seconds)
10:58:52FromGitter<bung87> how to port this `#define CFSTR(cStr)` it use Macro in occ
11:00:42FromGitter<mratsim> proc cfstr(x: cstring) {.importc:"CFSTR", header:"foo.h".}
11:00:50FromGitter<mratsim> macro are not special
11:05:08FromGitter<bung87> when x is const string ? how to declare that
11:06:11*moduledge quit (Quit: Konversation terminated!)
11:06:53stefantalpalaruYou don't. That information is lost in translation.
11:11:32Araqstefantalpalaru, limits.h is part of Ansi C afaik
11:11:55Araqso what I said was 100% correct, you have a C compiler but without a C environment
11:12:33FromGitter<bung87> ok, port occ more harder than c
11:12:47lqdev[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:12FromGitter<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:31dom96Araq, no need to parse the compiler errors, we might be able to look up whether the headers exist
11:14:41Araqha ha ha ha ha
11:14:53FromGitter<bung87> If Iโ€™m pure backend programer , I โ€˜ll choose linux.
11:18:42*Guest70774 quit (Ping timeout: 260 seconds)
11:21:08FromGitter<mratsim> btw still no choosenim on 64-bit windows :/
11:21:43dom96good thing 64 bit windows can run 32bit apps :)
11:22:21FromGitter<mratsim> good luck addressing over 4GB of RAM with 32-bit
11:23:12dom96btw 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:14disbotโžฅ 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:11clyybberAraq: Sup, do we change the refcount on every ref assignment or do we already optimize something?
11:39:48FromGitter<bung87> how to write compiler params when I use apple CoreFoundation IOKit
11:49:45FromGitter<bung87> `{.passL: "-framework CoreFoundation -framework IOKit".}` ?
11:52:37FromGitter<bung87> ok I โ€˜ve done my task
11:58:47*ecker joined #nim
12:01:10eckerI have a problem to load a library which I installed with nible:
12:01:26eckernimble install nimPDF
12:02:07eckerdemo.nim(10, 32) Error: cannot open file: nimPDF
12:02:17ecker???
12:03:14dom96there is no nimPDF.nim file in that package
12:03:17dom96guess that demo is broken
12:03:27zedeusdamn my project is on the front page of hackernews
12:03:45dom96zedeus, I upvoted, nice :)
12:03:47clyybbernitter right?
12:03:50zedeusyea
12:03:53clyybbernice!
12:06:38eckerThanks 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:32solitudesfyou should import it as nimPDF/nimPDF
12:15:45dom96the package should be changed to move that file outside that directory
12:20:44eckerMoving it outside helps.
12:22:00eckerhowever nim complains about subpackages now: .nimble/pkgs/nimPDF-0.4.2/nimPDF.nim(10, 8) Error: cannot open file: image
12:22:46dom96yeah, these would need to be changed to nimPDF/image
12:26:01Araqclyybber, here is my line of thinking, probably you already know this and tried to explain it to me
12:26:48Araqwe can have a 'recover' block in Nim like Pony has (except maybe we will call it 'isolate' or something better)
12:28:08eckerThis looks good so far ...
12:28:29*hed0n1st joined #nim
12:28:32*hed0n1st quit (Remote host closed the connection)
12:28:37Araqthe type of 'recover block' is 'owned ref', only 'owned ref' can be passed to a thread/channel
12:29:05Araq'owned ref' can also be used elsewhere and it enforces moves just like in the B/D design
12:30:12Araqso if you have a singly linked list with 'owned refs' inside, you can pass head/rest to different threads
12:30:50Araqif you don't then 'recover' is also unlikely to help you
12:31:07Araqbut that's ok, lists etc need to be prepared for threading
12:33:49clyybber,Exactly
12:34:00Araqthis 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:16clyybberYes
12:36:30clyybberI'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:43clyybberAnd during that I have stumbled upon a few insights
12:37:18clyybberInside a recover block there does not need to be refcounting
12:37:45clyybberAnd I'm talking about unowned refs
12:38:02Araqsounds wrong to me
12:39:47clyybberthink 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:01clyybberThe one ref that survives will be taken ownership off in the resulting owned ref
12:40:43clyybberSo all other ones except of that one can be destroyed
12:41:39Araqvar x = foo(); if complexCondition: x = bar()
12:41:55Araq^ better destroy the old x in the 2nd assignment
12:42:16Araqyes, you can avoid the RC ops but the basic machinery can't be avoided
12:43:22clyybberYeah
12:43:35clyybberBut eliding RC ops seems really useful
12:45:03clyybberThis 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:40clyybberwhere outer vars are outside of the scope that an unowned ref is introduced in
12:46:47clyybberNow 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:43Araqwe also elide rc ops via 'sink' and 'lent'
12:50:22clyybberYeah, combining all these elision methods, I think we can get the RC ops overhead really low
12:50:56clyybberAnd that way cycle checking also gets rarer
12:51:25Araqcycle checking lost
12:51:43Araqit is buggy and **slow**
12:52:23Araqthe only way to make it not slow is via delaying the cycle checking
12:52:33clyybberOr via not doing rc ops?
12:52:43Araqand then you enter non-predictable MM
12:52:53Araqwhich is what we want to get away from
12:54:15FromGitter<Willyboar> @xmonader don't worry just joking
12:54:23Araqdoing it via RC ops is ok but the condition rc > 1 is not good enough
12:54:39Araqit triggers too often
12:54:59AraqPython uses a generational algorithm
12:55:25clyybberYeah, 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:42clyybberAnd then maybe we stumble upon another bunch of optimizations
12:56:53Araqbut systems programming is not about "optimizations we hope work out and affect O(n) behaviour"
12:57:46clyybberSure
12:57:47Araqthe critical part here is the algorithmic complexity that is affected
12:58:23Araqonce the cycle collector doesn't cause crashes anymore, we can give programmers a 'markAsCyclic' proc they need to call for cycle collection
12:58:32Araqthen the cost is exposed
13:01:25*fireglow quit (Remote host closed the connection)
13:03:13Araqbtw what Pony is doing with 'recover' is comparable to "ballon types"
13:03:44FromDiscord<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:44FromDiscord<slymilano>
13:03:44FromDiscord<slymilano> ```
13:03:44FromDiscord<slymilano> import src/rawlers/foobar
13:03:44FromDiscord<slymilano> import foobar
13:03:45FromDiscord<slymilano> ```
13:03:47FromDiscord<slymilano>
13:03:47FromDiscord<slymilano> Both don't seem to work.
13:04:17*chemist69 quit (Ping timeout: 260 seconds)
13:04:47FromDiscord<slymilano> The module docs don't mention anything about file names.
13:04:48FromDiscord<slymilano> https://nim-lang.org/docs/tut1.html#modules
13:05:16Araqmaybe write 'src/crawlers' instead of 'src/rawlers'
13:05:41FromGitter<Willyboar> @zedeus do you have a link to upvote it?
13:06:02*chemist69 joined #nim
13:06:32dom96slymilano: is this a Nimble package? or where is it in relation to the module that tries to import it?
13:06:47FromDiscord<slymilano> A nimble, binary. Here's a screenshot:
13:06:54FromGitter<Willyboar> never mind i found it
13:07:01FromDiscord<slymilano>
13:07:01FromDiscord<slymilano> https://cdn.discordapp.com/attachments/371759389889003532/657932029941514261/unknown.png
13:07:22FromDiscord<slymilano>
13:07:22FromDiscord<slymilano> https://cdn.discordapp.com/attachments/371759389889003532/657932111726247956/unknown.png
13:07:26dom96remove the `src/`
13:07:28FromDiscord<Rika> remove src
13:07:41FromDiscord<Rika> darn, late by a few milliseconds
13:07:55zedeusWillyboar: sure, https://news.ycombinator.com/item?id=21849744
13:07:58FromDiscord<slymilano> Nice, that worked, I guess src is the root path.
13:08:06FromDiscord<slymilano> ty guys
13:08:11FromDiscord<Rika> well it is since the file is in src
13:08:25FromGitter<Willyboar> i found it. Drop me a message if you want to hunt it in producthunt
13:10:59dom96slymilano: imagine your current work directory is `./src`, you wouldn't type in `cat ./src/crawlers/foobar` to read the file
13:11:38FromDiscord<slymilano> ๐Ÿ‘
13:12:29FromDiscord<slymilano> Before I go down this last problem is there a simple way to convert a seq[Object] to json in jester?
13:13:32Araqclyybber, oh look, somebody is using JSON ;-)
13:13:41dom96slymilano: %yourVar
13:14:05dom96!eval import json; echo(%(@["hello", "world"]))
13:14:09NimBot["hello","world"]
13:14:48Araqclyybber, anyway, I think what we need to figure out is how 'recover' deals with parameters
13:15:09Araqor more generally, what outside of its scope is allowed to be accessed
13:19:35clyybberon it
13:20:19Araqsink parameters should be allowed but not for refs...
13:20:28clyybberin pony its sendable types, aka owned refs (not their fields), immutable refs (don't have them), and tags
13:20:52FromGitter<Willyboar> This pony worths?
13:20:53Araq'owned refs' are allowed though
13:21:01clyybberTo access the fields of owned refs we must unown them though
13:21:14clyybberAnd unowning is comsuming the owned ref in pony
13:21:28Araqyeah it's nasty
13:22:12FromDiscord<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:17Araqslymilano: you modify your .nimble file and run 'nimble install', nimble doesn't write into your .nimble file
13:23:18clyybberIn a way that recover block is similar to `unowned outlives owned` analysis
13:23:35FromGitter<Willyboar> Yes you need to add it yourself
13:24:17FromDiscord<slymilano> thanks, I finished my very first Nim app!
13:24:37FromDiscord<slymilano> everything I dreamed, so lean and liberating ๐Ÿ˜„
13:24:45FromGitter<Willyboar> but in ruby you need to add it yourself
13:24:48Araqit's a bit confusing I guess but 'nimble install' and 'nimble install project' are very different things
13:25:19Araq'nimble install foo' is not concerned about your current directory or its nimble package inside it
13:25:46Araqand 'nimble install' is all about your CWD
13:26:21dom96Here is the best workflow: add dependency into your .nimble file, run nimble build which will install the dependencies for you
13:26:38dom96no point in installing your package every time
13:26:53Araqoh ok
13:27:17Araqat least what I wrote wasn't wrong, right dom96 ?
13:27:42dom96sure, but if I'm developing a package I wouldn't really be using `nimble install`
13:27:55Araqtrue
13:28:23dom96i'm curious how Ruby/Elixir/JS package managers handle this
13:28:55AraqI suppose 'install' means different things over there
13:29:00FromGitter<Willyboar> well in ruby its pretty much the same
13:31:21FromGitter<Willyboar> you have Gemfile add dependencies and install it with ``` bundle install ```
13:32:12dom96yeah, when I was implementing this functionality in Nimble that is how most (if not all) package managers worked
13:33:25clyybberAraq: Ok, I think i got it:
13:33:51FromGitter<bung87> many pm just install the deps
13:33:53clyybber`let b = own someUnownedRef`
13:34:14FromGitter<Willyboar> the only difference is that ruby has gemspec for libraries
13:34:22clyybberHere we must analyse the "life" of someUnownedRef since its construction
13:34:25FromGitter<bung87> unless you usng `install .`
13:34:44dom96Willyboar: what is that? lock file?
13:35:00FromGitter<bung87> lock file
13:35:26clyybberthe 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:18FromGitter<bung87> and package describe file also has namescope, dev or prod test ..etc
13:36:45FromGitter<Willyboar> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dfe1fedcf771f77080707f5]
13:37:10clyybberfor 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:20FromGitter<bung87> while python package just using `setup.py` and not allow install from foreign resources
13:37:43clyybbermeaning no `a.field = b` and no `a = b` or the reverse are allowed
13:38:29FromGitter<bung87> @Willyboar thatโ€™s the spec file for lib, not for project
13:38:57FromGitter<Willyboar> Yes i know it.
13:39:01clyybberAraq: And that is basically outliving analysis :)
13:39:38Araqclyybber, alternatively we know proc f(args): ref T {.noSideEffect.} produces a unique location when 'ref T' cannot be an alias into 'args'
13:40:08Araqand we happen to have alias analysis
13:40:23clyybberYeah, its slowly all coming together
13:40:27Araqbut it's rather hard to explain
13:40:38Araqand also fragile when you have inheritance
13:43:09Araqit'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:40clyybberThats why in pony `unown` consumes
13:43:46clyybberSo that owned is always unique
13:44:16Araqthat aliasing was introduced to be able to describe trees and lists but with refcounting these are covered by plain refs too
13:44:23FromGitter<Willyboar> @bung87, @dom96 i think ruby's system is the best.
13:45:29*akitoshi joined #nim
13:47:20FromGitter<bung87> yeah, ruby ecosystem save much time for developers
13:48:24FromGitter<Willyboar> also i insist that nim needs package hosting
13:49:05*Trustable quit (Remote host closed the connection)
13:49:14clyybberAraq: 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:01FromGitter<bung87> for enterprise wide using , Iโ€™ll give + 1
13:50:55clyybberFurthermore 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:10FromGitter<bung87> I wonder why developers remove their packages from registry , but they did do that kind of thing.
13:53:18dom96Willyboar: I agree completely that we need package hosting
13:53:27dom96someone just needs to implement it
13:53:45FromGitter<Willyboar> This is the hard part
13:53:50dom96Sadly I doubt that will be me at this point
13:54:46clyybberAraq: And these alias refs are the same as {.cursor.} refs
13:56:16clyybberMaking those safe follows the same principle: Make sure that they are not aliased further beyond their lifetime
13:56:48clyybberAliases of those alias/cursor refs are themselves alias/cursor refs which follow the same rules
13:57:03Araqclyybber, we have a problem though ;-), worse is better.
13:57:43FromGitter<Willyboar> dom96 but i think that this cant be made by one person
13:57:44Araq sum(outgoingLinks)+1 = sum(refcounts) # no outside pointer to the subgraph, safe to pass to a different thread via move
13:58:08Araqit's almost the same as cycle detection
13:58:09dom96Willyboar: it can, if that person works full-time :)
13:58:38Araqdetect it at runtime before passing the ref to a channel, done
13:59:44clyybberyou mean detect that sum(outgoingLinks) == 0?
14:00:03clyybberSure, thats can also be done for the `own` mechanism
14:00:16AraqI mean we ensure no other roots beyond 'x' that is passed to the channel exist
14:00:18FromGitter<Willyboar> Well then maybe yes
14:00:24clyybberAraq: Yeah
14:00:53Araqand since this happens *before* the concurrency is involved it's a rather deterministic test
14:01:07Araqso you can disable it in release mode (*cough*)
14:01:11clyybberAnd additionally we can do the compile time analusis I outlined
14:01:32Araqyeah but it's optional and maybe once we have Z3 integration it becomes easier
14:01:41clyybberI wouldn't be on it
14:02:07clyybberAlso its probably a lotta fun writing such an analusis thing :D
14:02:22clyybberBut yeah, this is optional
14:02:25Araqme neither but we also need to focus on the important things. for example, we do know that 'nil' is bug prone
14:03:31clyybberAlso this compile time analysis will improve performance since it allows us to elide the RC ops
14:04:22FromGitter<Willyboar> dom96 can we open an RFC for this?
14:04:29Araqwe don't know if "uh, after dozens of tests ensuring uniqueness we still had race conditions in production" will be common
14:04:40dom96Willyboar: sure, but I think something already exists for it
14:05:15clyybberAraq: Sure, since it can be optional we are free to experiment though
14:05:24Araqtopology is usually a rather stable property, unlike array indexing or 'nil'
14:06:16clyybberBtw, the alias refs/cursor refs I mentioned. As arguments to functions they are the opposite of sinked/owned
14:06:21clyybberThey are `lent`
14:06:34clyybberThis is just too symmetrical to not be sound :p
14:06:42clyybberNormal refs: normal args
14:06:47FromGitter<bung87> (https://files.gitter.im/nim-lang/Nim/fxt0/Screenshot-2019-12-21-at-10.06.38-PM.png)
14:06:50clyybberOwned refs: Sinked/owned args
14:06:57clyybberAlias refs: Lent args
14:07:15FromGitter<bung87> does https://nimble.directory/ provider such kind of info?
14:08:49FromGitter<bung87> Iโ€™m wodering how many new packages published this year
14:09:30*Guest55445 quit (Remote host closed the connection)
14:09:43FromGitter<bung87> seems its growing larger , Iโ€™ve seen lot new packages
14:09:55Araqbung87: growth is slow but accelerating, I think
14:10:04lqdev[m]you can look through nim-lang/packages's commit history and find the first commit in 2019
14:10:12lqdev[m]and then work from here
14:10:52FromGitter<bung87> ah,yeah , right it publish through modify a json
14:11:33FromGitter<bung87> @Araq I have kind of that feeling.
14:11:33FromGitter<Willyboar> I think i have seen an article in reddit with such stats.
14:11:56FromGitter<Willyboar> Nimble directory can't provide such stats i think because uses github API
14:12:14*ng0 joined #nim
14:12:26livcdis there a source for nimble.directory ?
14:12:43lqdev[m]!repo nimble-package-directory
14:12:44disbotno results ๐Ÿ˜ข
14:12:59Araqask federico3
14:13:10FromGitter<Willyboar> https://github.com/FedericoCeratto/nim-package-directory
14:13:46Araqclyybber, so ... still no idea how to design the new threading API :-(
14:14:30FromGitter<Willyboar> https://www.reddit.com/r/nim/comments/dyeklg/nimble_goes_up_to_11_hundred/
14:14:32clyybberAraq: Leave it to mratsim :p
14:14:39FromGitter<Willyboar> this is the article with growth stats
14:14:40*ng0 quit (Client Quit)
14:14:41livcdcool.
14:14:47lqdev[m]yeah, that was the repo
14:14:53lqdev[m]nim-package-directory
14:14:53Araqclyybber, I asked him yesterday
14:14:56*ng0 joined #nim
14:15:29Araqand he doesn't know, his stuff is quite specialized and at the same time avoiding Nim's ref/string/seq altogether (yay..)
14:15:52FromGitter<bung87> I can look github insights by in 1 month period, 25 merged
14:16:09*ng0 quit (Client Quit)
14:16:17FromGitter<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:25FromGitter<Willyboar> in the article was 1100
14:16:26clyybberAraq: String and seq should pose no problem I think, since they can just be copied
14:16:29FromGitter<Willyboar> a month ago
14:16:39FromGitter<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:41disbotโžฅ lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y
14:16:51FromGitter<bung87> sounds cool!
14:17:00Araqtimotheecour: there is no difference
14:17:16Araqbut yes, .since is better if it works for it
14:17:19FromGitter<Willyboar> almost 1 new pack/day
14:17:34clyybbertimotheecour: I think that change is a bad idea.
14:17:44Araqclyybber, yeah but we can also enforce 'move's
14:18:13Araqwe want to enforce moves
14:18:56Araqor maybe not for consistency with slices which cannot be moved
14:20:14AraqI think I'll simply copy C++'s API
14:21:23FromGitter<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:45AraqI tried to make it work without the hack yesterday
14:21:56Araqbut it's annoying
14:22:09Araqwhich is why your PR wins ;-)
14:23:10*fireglow joined #nim
14:23:44clyybberWell, relying on a being equivalent to a[0] is simply broken
14:23:58clyybberBut sure I'll try it
14:25:37clyybberIts also violating the spec
14:25:55clyybberSince varargs is an array, and not a comma seperated list
14:26:15clyybberAnd its easy enough to construct an nkCall node out of such an array without magic
14:26:49clyybberThe only thing that needs fixed is disallowing `someProc(someVarargsUntypedParam)`
14:27:00FromGitter<timotheecour> clybber, varargs[untyped] is treated specially in the spec; eg no implicit array unlike varargs[T]
14:27:14clyybberYes, but it should not be IMO
14:28:03FromGitter<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:05disbotโžฅ 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:11clyybbertimotheecour: Hear me out. It is not the only way if you have a helper macro that constructs such calls
14:29:48clyybberThen it should be possible like this: `callWithArgs(theProcToAlias, args)`
14:30:12clyybberThat helper is also useful for other stuff
14:30:20clyybberas args does not have to be varargs
14:30:25FromGitter<deech> Is it possible to have a nimble project with multiple executables and libraries?
14:31:08clyybbertimotheecour: I'm gonna write a PR so please bear with me :)
14:32:56FromGitter<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:48clyybbertimotheecour: It would not. It can be put in system.nim just like your lenVarargs macro
14:33:51dom96deech: 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:54clyybberNot sure if its a good idea though :p
14:34:00dom96*you can have
14:34:52FromGitter<timotheecour> @Clyybber how would you define `myecho` (see tests/system/tlenvarargs.nim from that PR) without macros.nim?
14:37:59FromGitter<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:04clyybbertimotheecour: Replacing the last 4 lines of myecho with: callWithArgs(echo, concat(loc, args))
14:40:17clyybberwhere concat is array concatentation
14:40:29clyybberI wrote it that way so I do not spam IRC :p
14:41:49FromGitter<Clyybber> @timotheecour You would write: โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dfe2f2d44e1fb33f604db0e]
14:42:04FromGitter<Clyybber> That isn't so bad is it :) ?
14:42:31FromGitter<timotheecour> so callWithArgs has to be magic, correct?
14:43:20FromGitter<Clyybber> Nope
14:43:54FromGitter<timotheecour> then it has to import macros.nim, which is what i was avoiding in the 1st place.
14:44:23FromGitter<Clyybber> @timotheecour No you did not avoid that. Your `lenVarargs` is a macro too :P
14:44:49FromGitter<timotheecour> itโ€™s a macro but doesnโ€™t require macros.nim
14:44:49FromGitter<Clyybber> `callWithArgs` is a macro too, but not a magic one
14:46:13FromGitter<Clyybber> And what exactly is the benefit of not requiring macros.nim?
14:46:24FromGitter<Clyybber> Nim should rely more on macros and less on magic IMO
14:46:33FromGitter<deech> @dom96 That makes sense, is it possible to publish a single Nimble project that contains multiple sub-projects?
14:47:00dom96deech: you need to publish each individually
14:47:08FromGitter<deech> I see, thanks.
14:47:12dom96each .nimble file needs its own URL
14:47:28dom96search for `subdir` (IIRC) in the packages.json file to see how it's done
14:47:31FromGitter<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:24FromGitter<Clyybber> How can macros.nim cause circular imports?
14:48:37FromGitter<Clyybber> For that to happen macros.nim must import something itself no?
14:49:44FromGitter<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:56FromGitter<timotheecour> ya, it imports system.nim which itself imports and includes a bunch of files
14:51:20dom96deech: not sure I understand what you mean, what namespacing issues do you foresee?
14:51:56FromGitter<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:43FromGitter<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:34disruptekdeech: you can just use urls.
14:55:59dom96deech: yes, that is a problem, but I believe most package managers have it.
14:56:17dom96Happy to hear suggestions on how to solve it for us
14:56:44FromGitter<deech> @dom96 Not sure I only just learned about the limitation just now. :)
14:56:56disruptekalso, local dependencies are well-supported now.
14:57:07FromGitter<deech> The Haskell package manager now allows multiple libs + exes per project.
14:57:27disruptekhave you looked at nimph?
14:57:38dom96I mean, technically you can have multiple libs in Nim as well.
14:57:46dom96They just all have to be under the package's namespace :)
14:58:10FromGitter<deech> True
14:58:32dom96and AFAIK no two packages with the same name can be published on hackage
14:58:56FromGitter<deech> That is also true
14:59:12FromGitter<deech> How do you have multiple libs in the same project? Different build tasks?
14:59:45dom96myPkg/{library1,library2}
15:00:01dom96Not sure how build tasks relate to this
15:01:21FromGitter<deech> And is there a way of specifying dependencies? Like, library3 depends on library1 and library2, so if library3 changes rebuild everything?
15:02:21dom96library3 would just depend on myPkg
15:02:51dom96does Haskell allow you to depend on a package's sub-library nowadays?
15:03:02FromGitter<deech> I meant in this situation myPkg/{library1,library2,library3}
15:03:11federico3lqdev: linked in the pkg directory footer
15:03:12FromGitter<deech> Yes, that's a feature as of Cabal 3.
15:03:38*ng0_ joined #nim
15:03:43dom96I 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:26FromGitter<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:22clyybberkrux02: Hey, I'd like your opinion on #12907
15:21:24disbothttps://github.com/nim-lang/Nim/pull/12907 -- 3lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y
15:22:04krux02ok
15:22:26clyybberI think its better to introduce a helper macro callWithArgs(fun, args) and fix len to work on varargs[untyped]
15:27:58Araqdeech: 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:22Araqor at least we don't tell you when we're in the "linking" step
15:42:41FromGitter<deech> Araq: I understand that overloading is open world, I meant whatever is in scope at the time of the call.
15:45:18disruptekdeech: 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:40FromGitter<deech> Yes that's what I want.
15:46:07disrupteki think lqdev might be the person to talk to, as he had a similar problem iirc.
15:46:31disruptekor check out his euwren project to see if there's a solution inside.
15:46:35disruptek!repo euwren
15:46:37disbothttps://github.com/liquid600pgm/euwren -- 9euwren: 11High-level Wren wrapper for Nim 15 12โญ 0๐Ÿด
15:47:12FromGitter<deech> Nice, thanks!
15:48:06disrupteki hope it helps and i'm sorry i don't have a better lead. ๐Ÿ˜‰
15:48:34krux02clyybber: well looked into #12907 and I see that it is about `varargs`.
15:48:34disruptekalso check out nimph for your packaging issues. i think it solves your concerns.
15:48:36disbothttps://github.com/nim-lang/Nim/pull/12907 -- 3lenVarargs: number of varargs elements ; snippet at 12https://play.nim-lang.org/#ix=250y
15:48:55krux02I started to write my opinion about it, but I realized it doesn't work out.
15:49:25krux02My true opinion about `varargs` is, `varargs` is broken, and it can't be fixed. Just don't use it.
15:50:05krux02clyybber, https://github.com/nim-lang/Nim/issues/10975
15:50:08disbotโžฅ Self Conflicting Logic in varargs Parameter Passing ; snippet at 12https://play.nim-lang.org/#ix=2510
15:50:51disruptekright, it's broken.
15:52:18krux02clyybber: But I agree that we should have a ``callWithArgs``. Something to unroll varargs properly.
15:52:32krux02It doesn't need to be ``callWithArgs``.
15:53:48clyybberYeah, I don't care about the name
15:53:58krux02It 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:23clyybberExactly!
15:55:19*akitoshi quit (Quit: Connection closed for inactivity)
15:55:20krux02There is a macros.unpackVarargs
15:55:23krux02but that doesn't work
15:55:41krux02because it relies on the broken varargs passing
15:56:44krux02I don't know when and if this will be implemented in Nim.
15:57:06*Vladar joined #nim
15:57:24krux02I 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:39clyybberOh, 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:05krux02I don't think so.
16:03:39krux02He wanted the length of a `varargs` that is passed down to a template
16:03:54krux02but a template doesn't really have a varargs construct like a proc.
16:04:17krux02for procs a varargs is converted into a sequence like object. In templates this is not the case
16:04:33krux02in templates varargs can be forwarded as arguments to other procs.
16:04:49krux02It is just that this forwarding is wonky and ill specified.
16:05:06krux02I go into further details in the issue that I posted.
16:05:38krux02but 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:43clyybberI wanted that length for the purpose of creating aliases though
16:05:50clyybberAnd for that unpackVarargs works fine
16:05:55clyybberI tested it with his testcase
16:06:21clyybberNow I'll try to fix the weird behaviour of len
16:06:43krux02well the example `len(a)` where `a` is the argument.
16:06:49krux02arguments
16:06:51clyybbers/I/he
16:07:07krux02the behavior is correct
16:07:28krux02`len(a)` is the way how you forwards arguments to a function
16:07:34krux02in this case it is just one argument
16:07:39krux02and the length of that argument is 4
16:07:48clyybberBut that is broken
16:07:50krux02that is correct in it's current ill specified behaivor.
16:07:55clyybberit is rarely useful
16:08:11krux02but that is the only way you can forward arguments.
16:08:19krux02there is no unroll operator.
16:08:25clyybberNo, you can use unpackVarargs
16:08:40krux02How do you think `unpackVarargs` gets it's arguments?
16:08:48clyybberI know, but it works :)
16:08:50*nsf quit (Quit: WeeChat 2.6)
16:09:03clyybberkrux02: Umm, but it iterates through it
16:09:19clyybberresult.add args[i]
16:09:21clyybberthis is fine
16:09:25krux02in `unpackVarargs` you have a macro.
16:09:38krux02a macro is different that a proc or a template.
16:10:00krux02you have the ast that you can iterate through.
16:10:01clyybberyeah, but forwarding varargs to procs that don't accept varargs is a bad idea
16:10:18clyybberand should not work without unpackVarargs IMO
16:10:29krux02there is len, items, node[i], that implements the seq like concept
16:10:33krux02but it isn't a seq
16:10:43krux02in procs it is a seq
16:11:12clyybberyes, and I'm arguing that it should be an array/seq/openarray in templates too
16:11:18krux02only 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:20krux02No 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:25krux02This is how it works in C++
16:12:32krux02(variadic templates)
16:12:37krux02it is well specified.
16:12:53krux02you would only need to copy that behaviour.
16:12:54clyybberkrux02: Thats equivalent to what I am saying
16:13:09krux02not sure
16:13:46krux02when you have an arr/seq/openarray that is not something that you can unroll as individual arguments anymore.
16:14:16clyybberyou can, using unpackVarargs
16:14:25clyybberor in general a loop
16:14:29krux02no you can't
16:14:55clyybberin a macro I can
16:15:20krux02because 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:08clyybberbut varargs expands arrays?
16:16:15clyybberOr is that where the issue lies?
16:16:22clyybbers/lies/is
16:16:44krux02varargs is the issue.
16:16:57krux02The problem is `varargs` isn't very specific.
16:17:10krux02varargs in templates, varargs in procs, varargs in macros
16:17:13krux02that is specifc
16:17:51krux02those 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:52krux02in `proc foo(args: varargs[int])`, args is a container of `int`.
16:19:26krux02in `macro foo(args: varargs[int])`, `args` is a NimNode, where each child has the type `int`.
16:19:56krux02in `template foo(args: varargs[int])`, `args` is a, yea don't know, make it whatever works.
16:20:01krux02and that is the problem
16:20:39krux02the behavior of template varargs is not only unspecified, the implementation also has self conflicting logic.
16:22:10clyybberkrux02: For the problem that timothee is trying to solve though it all works out: http://ix.io/251f/nim
16:22:24clyybberThis varargs in all 3 forms
16:24:22krux02yea might be
16:27:21krux02but do you see the structural problem with varargs.
16:27:23*chemist69 quit (Ping timeout: 245 seconds)
16:27:44clyybberyes
16:27:54clyybberAnd I want to fix it
16:28:40FromGitter<Clyybber> @timotheecour http://ix.io/251f/nim your task can be solved without lenVarargs
16:28:46FromGitter<Clyybber> Though arguably with an macro import
16:31:15*chemist69 joined #nim
16:31:17clyybberkrux02: 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:32clyybberat least easy to fix conceptually :D
16:32:08krux02clyybber: sorry that won't work
16:32:12krux02look into my issue
16:33:34krux02template indirectCall(args: varargs[untyped]) = foo(args) ; proc foo(arg1, arg2, arg3: int) = discard ; indirectCall(1,2,3)
16:33:44krux02that one should work as well
16:34:06krux02even though I would enforce a `unrollVarargs`.
16:35:38clyybberit is still better than the status quo. And yeah, one can just use `unrollVarargs` which will continue to work
16:36:02clyybberafaict your issue is related to the varargs auto conversion
16:36:06krux02you know why I don't like `unrollVarargs`?
16:36:24krux02yea I already said it.
16:36:37clyybberyeah
16:36:39krux02It realies on this weird `varargs` logic
16:36:51clyybberbut that logic is not weird IMO
16:37:01clyybberunrolling an array is fine
16:37:06clyybberwhere it gets tricky is with conversions
16:40:27*Trustable joined #nim
16:42:31disruptekit'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:22krux02OpenArray is so much better than varargs.
16:47:29*chemist69 joined #nim
16:47:51*tane quit (Ping timeout: 265 seconds)
16:49:20disruptekhearts and minds, people; hearts and minds!
16:52:05krux02Well, I have to go now.
16:52:07krux02bye
16:52:16disruptekcya krux02
16:52:21*krux02 quit (Remote host closed the connection)
16:52:51*Trustable joined #nim
16:52:53disruptektoday we implement `nimph roll`.
16:53:07disrupteki'm thinking you use it like this:
16:53:23disrupteknimph roll "npeg > 0.21.3"
16:53:33disruptekor nimph roll "npeg == 0.21.3"
16:53:51disruptekthe same syntax as for nimble's `requires` statement.
16:54:06disruptekexcept that we also support ^ ~ and *.
16:54:13clyybberbye
16:54:30clyybberoh, already gone
16:54:32clyybberheh
16:55:24disruptekmaybe we should just merge it with clone.
16:55:32clyybberdisruptek: And nimph upgrade would just be: nimph roll "pkg > $curr" ?
16:56:19disruptekmaybe?
16:56:44disruptekupgrade and downgrade are implemented via roll() right now.
16:57:11disruptekroll itself would be impl with rollTowards(requirement).
16:57:48FromGitter<deech> Aside from interop what problems does `varargs` solve that can't be addressed with a `seq`?
16:58:06disruptekauto-conversion.
16:58:51FromGitter<deech> Can also map over a seq, no?
16:59:20disruptekyeah, but varargs lets you pass arguments of disparate type which are all converted using the converter you specify.
16:59:45disruptekhave you ever had seqs with two different types?
16:59:58disruptekthat would make you biseqsual.
17:00:00FromGitter<deech> Ah yeah, that is convenient.
17:00:31FromGitter<deech> I think hlists are maybe possible in Nim with concepts but not sure.
17:00:43clyybbernope
17:00:55clyybberI don't think so
17:01:00clyybbermaybe with case objects
17:02:15disruptekshould `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:52clyybberwhat does nimph path do?
17:03:08disruptekyou pass it an import name and it yields a directory.
17:03:12disruptekor n import names.
17:03:35disrupteki use it to have a shell alias `goto` so i can `goto npeg` and end up in my npeg dep's repository.
17:03:52clyybberthen I say yeah it should
17:04:07disruptekso whatever it can find, even if it's not a dep.
17:05:13clyybberyeah
17:05:23clyybberor make it an option
17:05:27clyybbernimph path -a
17:05:47disrupteki'm trying to avoid options, or indeed any configuration.
17:06:20disruptekeasier to use, easier to document, easier to understand. easy to make expectation match reality.
17:07:44disruptekupgrade means "pick the maximally acceptable version", and downgrade means the opposite.
17:07:56disruptekit won't upgrade outside of your requirements.
17:08:47FromDiscord<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:32clyybberzedeus is the one to ask
17:10:38clyybberdisruptek: I understand avoiding configuration, but avoiding options I do not :p
17:11:05FromDiscord<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:24clyybberbut yeah, if you don't want that option I'd say go for everything in the path
17:11:56zedeusslymilano: 310 MB but I think there's a tiny memory leak somewhere
17:12:13FromGitter<bung87> can I declare a type all field is public ?
17:12:20FromDiscord<slymilano> Thanks Zedeus
17:12:38*dddddd joined #nim
17:12:52clyybberbung87: No you gotta use * on every field
17:12:54disruptekclyybber: i'm in favor of options but the default should be the most useful.
17:13:15clyybberyeah, I agree. Then I'd say make it search everything
17:13:20clyybberAnd leave out the option
17:13:20disruptekmaybe --strict will reject non-deps, for example.
17:13:31clyybberYeah, that would work too
17:13:48FromGitter<bung87> too many, since the struct is not write by myself.
17:14:22FromGitter<bung87> if it required Iโ€™ll use regex replace
17:14:45clyybberbung87: Yeah regex is the way to go then
17:14:54clyybberbung87: Curious, was it machine written?
17:17:33*clyybber quit (Quit: WeeChat 2.7)
17:17:55*clyybber joined #nim
17:18:53FromGitter<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:08Zevvbung87: how is npeg doing for you, is it of any use?
17:26:51FromGitter<bung87> I think it works well, I am trying to make it handle two syntax of templates, but fails
17:28:52FromGitter<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:06FromGitter<bung87> guess it will be simple than the example you provide me, itโ€™s functional ,I can handle every element individually ,right
17:32:56Zevvsure, good to hear.
17:33:19Zevvparsing all of elm is probably some work, but it is ratively compact for a programming language I guess
17:36:50FromGitter<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:16FromDiscord<Rika> does the `threadpool` use green threads? if not, what does?
17:59:44*endragor quit (Remote host closed the connection)
18:04:32disruptekthe closest thing to green threads is async.
18:04:56disruptekthe coro module is essentially deprecated.
18:08:22Zevv;(
18:08:54disruptekwhen you `nimph roll "npeg > 0.20.0"` you want it to obey your requirements, right? dependencies, etc.
18:09:54FromGitter<nixfreakz_twitter> Is nim compiled to ansii C code? So disassemble code should look the same ?
18:11:35disruptekthere 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:50disrupteknim compiles to c.
18:15:36FromDiscord<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:40FromDiscord<Rika> disruptek, oof; i am really stupid as i still cannot understand the meaning of most async keywords
18:16:55disrupteki can help you with that.
18:16:58FromDiscord<Rika> Milerius, do you have code
18:17:31disruptekasync is easy if you just keep in mind that an async proc is essentially an iterator.
18:18:01FromDiscord<Milerius> yeah one second !
18:21:24FromDiscord<Milerius> Ah it's compiling now, i just cleaned the cache, and now it's working :p
18:21:29FromDiscord<Milerius> but sometimes the compiler is stuck
18:21:54FromDiscord<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:10FromDiscord<slymilano> Does `strutils.replace` do a replace in place, or return a modified string?
18:26:33FromDiscord<Rika> check the docs
18:26:51FromDiscord<slymilano> Doesn't explicitly say https://nim-lang.org/docs/strutils.html#replace%2Cstring%2Cchar%2Cchar
18:28:07solitudesfit returns a string and doesn't have a `var` parameter. pretty explicit.
18:35:44FromDiscord<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:59disruptekssl support is a thing.
18:36:12FromDiscord<Milerius> do we have a tutorial how to debug nim code with gdb ?
18:36:40solitudesfhttps://www.youtube.com/watch?v=DmYOPkI_LzU
18:36:49FromDiscord<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:03FromGitter<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:47disruptekzevv is a big fan of memfiles.
18:54:56disruptek!repo npeg
18:54:58disbothttps://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 72โญ 4๐Ÿด
18:55:09disruptekmaybe he has a smaller example use.
18:55:37FromGitter<atemerev> Thanks!
18:57:17*silvernode joined #nim
18:58:23disrupteklet us know if you find a better source. ๐Ÿ˜‰
18:58:52silvernodeTop of the afternoon everyone!
18:59:08disruptekhi ho silvernode
18:59:39FromGitter<Willyboar> :)
18:59:51*clyybber joined #nim
19:00:54clyybberAraq: 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:03silvernodedisruptek: Hey buddy, nice to see you.
19:01:50silvernodeclyybber: I see you are also in the voidlinux IRC too.
19:01:54disruptekwhere else would i be? ๐Ÿ˜
19:03:46shashlickanyone have any ideas on #12939
19:03:49disbothttps://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:04clyybbersilvernode: Yep
19:10:04clyybbershashlick: Why do you need to?
19:11:11*seerix quit (Quit: Leaving)
19:11:21*seerix joined #nim
19:11:40clyybbershashlick: I mean: Why do you need to reassign stdout..
19:12:31shashlickI want to redirect all echos to a file
19:12:39shashlickand then later, restore back to stdout
19:12:53shashlickreopen() allows to set stdout to a file, but you cannot restore it back then
19:13:41clyybberhmm
19:14:01clyybberI don't think you can do that
19:14:21clyybberbbl
19:14:22*clyybber quit (Quit: WeeChat 2.7)
19:14:46shashlickyou can in python and it does work in Nim on other OS
19:15:35FromDiscord<Rika> i dont see why you shouldnt be able to do this
19:17:39FromGitter<nixfreakz_twitter> I aplologize
19:18:11FromGitter<nixfreakz_twitter> I
19:18:22FromDiscord<Rika> ??
19:20:09FromGitter<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:58disruptekthere are myriad ways to compile c just as there are myriad ways to write c that compiles to identical pieces of asm.
19:24:08disrupteknim (still) compiles to c.
19:24:41FromGitter<nixfreakz_twitter> Ok very good thanks
19:29:06disruptek`nimph roll` is now a thing: https://github.com/disruptek/nimph#roll
19:30:43FromGitter<bung87> @atemerev https://nim-lang.org/docs/memfiles.html#%24%2CMemSlice you have std memfiles
19:32:37shashlickhow do you check for nim check mode?
19:34:03*muffindrake joined #nim
19:34:31shashlick`if defined(nimsuggest) or c.config.cmd == cmdCheck`
19:34:48shashlickthat's what the compiler does - i can do a when defined(nimsuggest) but how do I check for cmdCheck
19:35:01shashlickthere should be some way to do this in a when statement in user code
19:35:11disruptekis that wise?
19:37:15disrupteki'm not sure i want a programmer forcing me not to check.
19:37:16shashlickwell, how else can I fix the nimterop issue where gorge/writeFile doesn't work in nimsuggest/check modes?
19:37:30shashlickif i cannot detect the case
19:37:52disruptekit sounds like you have a solution for the nimsuggest case.
19:38:06shashlickam trying
19:38:30disrupteki'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:47disruptekscratch that. i /am/ sure it's /not/ ๐Ÿ˜‰
19:39:10FromGitter<mratsim> I have the same problem with nimdoc :/
19:39:25disruptekthere's a nimdoc when, iirc.
19:39:29disruptekbut, yes, it's broken with nesm.
19:39:32disrupteksucks.
19:39:41FromGitter<mratsim> you have to add when defined(nimdoc) everywhere on optional stuff
19:39:44shashlickwell then i can fix nimsuggest, nim check can take a hike eh
19:40:19disrupteki mean, nim check seems useless if it doesn't reflect real compilation inputs.
19:43:08muffindrakeI'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:40disruptekwhere are these shady stats?
19:43:51FromGitter<mratsim> here I guess
19:43:52FromGitter<mratsim> https://nim-lang.org/features.html
19:44:10FromGitter<mratsim> Nim default garbage collector is based on TLSF which was designed for soft real-tim system
19:44:54FromGitter<mratsim> See: http://www.gii.upv.es/tlsf/ for papers
19:46:16FromGitter<mratsim> More exactly: http://www.gii.upv.es/tlsf/files/papers/tlsf_desc.pdf
19:47:06muffindrakeThank you.
19:47:49FromGitter<mratsim> Note that it will be replaced by a new default garbage collector in 2020 which has even better characteristics
19:48:32FromGitter<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:02FromGitter<mratsim> you can also use the Boehm GC which is currently the ighest performing GC in Nim (besides doing manual memory management)
19:49:26FromGitter<mratsim> *or using destructors
19:50:15disrupteknim doesn't lack for options; it lacks for bad options. ๐Ÿ™
19:51:15*nsf quit (Quit: WeeChat 2.6)
19:51:40muffindrakeHeh, that paper has what appears to be pseudocode, but it's actually Ada code
19:52:01FromGitter<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:02disbotโžฅ Proposal to add 'owned' refs to Nim ; snippet at 12https://play.nim-lang.org/#ix=24U9
19:52:52*mkuentz joined #nim
19:53:48FromGitter<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:28FromGitter<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:40disruptek$ nimph outdated
19:56:45disruptekwould upgrade nimterop from 0.3.6 to v0.4.2
19:56:52disruptekshashlick: you been busy, son!
19:58:20shashlicklots of fixes, some new features
19:58:44disrupteki see the char defs.
19:59:10shashlicklikes?
20:00:35disruptekyes much likes yes
20:00:45FromDiscord<treeform> Can nimph read nimble configs?
20:00:49disrupteksure.
20:01:43disruptektagging is good, right shashlick?
20:01:55disruptekfeels good, doesn't it?
20:02:06shashlicki'm cool with patch, but still struggling with minor
20:02:22shashlicki made 4 new features in 0.4.0, couldn't do just one
20:02:26shashlick๐Ÿ˜„
20:02:28disruptekheh
20:03:33disrupteki need feedback on what to impl next.
20:04:33FromDiscord<treeform> How does nimph deal diamonds in the dependance graph?
20:05:26disruptekit uses requirements as a chain of filters against input of a list of releases.
20:05:29*Vladar quit (Quit: Leaving)
20:05:35disruptekanything that makes it through is acceptable.
20:06:00FromDiscord<treeform> https://www.well-typed.com/blog/2008/04/the-dreaded-diamond-dependency-problem/
20:06:10FromDiscord<treeform> Will it just error out?
20:06:52disruptekso, i have this idea that i can solve that but only with the help of the programmer.
20:07:01disruptekit will error out.
20:07:03disruptektoday.
20:07:46FromGitter<mratsim> lock files are supposed to solve diamonds
20:07:58disruptekwell, they don't help in our flat-import world.
20:08:27disruptekthe problem is that we cannot hide D1.1 from B because we cannot control a path scope per module.
20:08:41disruptekif we fix that, we can do anything you want.
20:08:48disruptek(we can only control scope per app)
20:08:49FromDiscord<treeform> I see
20:09:27disrupteklockfiles work well in nimph but they aren't all that useful.
20:11:03FromDiscord<treeform> Does nimph need the huge json file to function?
20:11:08disrupteknah.
20:11:35FromDiscord<treeform> Can it work with just git urls?
20:11:50disruptekyes.
20:17:51muffindrakeAre named parameters in nim?
20:17:57disruptekyes.
20:18:42disruptekany 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:42enthus1astin 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:43Zevvsealmove: 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:38clyybberZevv: What idea?
20:35:12Zevvmaking npeg parse openarray[WhateverYouWant] instead of only strings
20:35:25Zevvwhere WhateverYouWant is typically a lexed token stream
20:35:52Zevvso 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:18Zevvlike http://ix.io/2543
20:37:42mjsir911is 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:02disruptekif isMainModule:
20:38:08disrupteker, when isMainModule:
20:38:14mjsir911thanks! that's exactly what I'm looking for
20:38:28mjsir911yeah, I figured it should be a `when`. just hard to find words to ctrl+f for :P
20:38:39disruptekyeah, i hear ya.
20:41:21*watzon[m] joined #nim
20:45:32ZevvMy 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:42FromGitter<mratsim> Another one falls victim to macro + generics
20:51:17ZevvI'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:54ZevvI need some serious help one day from people who understand what they're doing and refactor that
20:54:38FromGitter<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:38disbotโžฅ [Meta] Generics/Static early symbol resolution
20:55:07FromGitter<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:12FromGitter<mratsim> So it took me 1 hour to add windows support to Weave and 8 hours of fighting Azure pipeline
21:00:00Zevvalso fun. But you managed! \o/
21:04:13solitudesfdisruptek, im still getting LineTooLong hint, what the heck
21:04:27disruptekcan you gimme a config file i can use to repro?
21:04:44solitudesfits nimes package
21:04:59disruptekdef-/nimes?
21:05:02solitudesfye
21:05:23disrupteki don't get a message.
21:05:27disruptekwhich nimph?
21:05:35solitudesffreshly built
21:06:55disruptekso i have a 177 character line but i'm not getting any error messages from nimph.
21:07:19disruptekyou get it with `nimph nurse`?
21:07:25solitudesfi get it with `nimph`
21:07:51disrupteksame thing. just disambiguating. so i guess there's something else at play somewhere. some other nim.cfg in use?
21:11:33solitudesfwhatever, im too exhausted to investigate this. if no one else reproduces this, we'll write that off as me developing schizophrenia
21:11:53disrupteknah, it's clearly not you.
21:12:17disruptekyou're running nimph in a project that requires nimes or you're running it in nimes itself?
21:12:54solitudesfim running it in project not related to nimes in any way
21:13:17disrupteki don't even get a message when building nimes.
21:13:59disruptekmaybe i have this disabled somewhere else.
21:15:01disruptekahh, that hint is disabled in stock Nim compiler config.
21:15:07disruptekso you must be re-enabling it somewhere.
21:15:32disruptekif 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:52disruptekif you care. ๐Ÿ˜
21:16:15solitudesfmy nim tree is clean and i commented out every potentially offending line in my config
21:17:10disruptekit's line 16 on 1.0.4. config/nim.cfg.
21:18:19disruptekhmm, 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:18disrupteki 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:18FromGitter<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:05FromGitter<mratsim> Yeah I know, it doesn't make it less painful though ;)
21:52:51FromGitter<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:32FromGitter<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:34disbotโžฅ 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:04clyybberdeech: I don't think anybodys working on it atm. It seems tricky
22:44:45disruptekdoesn't sound like optimization is the right word.
22:44:56clyybberdeech: But I'm not even sure its a bug
22:45:08*solitudesf quit (Ping timeout: 268 seconds)
22:45:17FromDiscord<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:22FromGitter<deech> disruptek: https://github.com/nim-lang/Nim/blob/devel/compiler/semexprs.nim#L753
23:05:00disruptekyes, but the thing about optimizations is that you can remove them.
23:05:24FromGitter<deech> I get it.
23:05:37disruptek๐Ÿ˜
23:10:54*sealmove joined #nim
23:12:16FromGitter<mratsim> @Xydium I think you almost always need to write your own
23:13:16FromGitter<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:32FromGitter<mratsim> customize the inspect function to the node you need to process
23:16:40FromDiscord<Xydium> That might work, I'm just trying to find every identifier and replace it with an array access
23:17:12FromDiscord<Xydium> Its a macro for building a CSP graph, so constraints use named variables but get converted to vararg procs
23:25:24FromGitter<Varriount> Xydium: Why not just use a template?
23:28:48FromDiscord<Xydium> Didn't think templates were that expressive
23:30:24FromGitter<Varriount> Xydium: I mean, does array access get calculated using the identifier name, or something?
23:31:07FromGitter<Varriount> Like, `ident3through6` -> `arrayVar[3][6]`
23:31:29FromGitter<Varriount> Or is it more a substitution, `ident` -> `arrayvar[3]`
23:33:22FromDiscord<Xydium> https://pastebin.com/DxeWUYSf
23:33:50FromDiscord<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:10FromDiscord<Xydium> This way I can traverse once, as opposed to, alphabetically order
23:34:20FromDiscord<Xydium> Find identifier and substitute all at once
23:35:00FromDiscord<Xydium> But it's only the identifiers which denote variables defined in the graph
23:40:33FromGitter<Varriount> Xydium: What is "v" on line 20?
23:40:51FromDiscord<Xydium> Typo, should be x, the vararg array
23:42:54FromGitter<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:27FromDiscord<Xydium> basically
23:43:43FromDiscord<Xydium> For any number of variables per constraint
23:44:02FromDiscord<Xydium> And any constraint format, whether infix, prefix, function call, etc
23:44:39FromGitter<Varriount> Hrm, I wish @mratsim were around. He's better at scientific programming.
23:44:40FromDiscord<Xydium> `Y >= X + 10 or Y >= Z + 5` is a valid constraint, as is `AllDifferent(X, Y, Z)`
23:45:06FromGitter<Varriount> Xydium: I can't say for certain whether you could just use a template.
23:45:37FromDiscord<Xydium> Macros will definitely work, it's just the code to traverse the tree and make substitutions will be messy
23:45:59FromGitter<Varriount> But keep in mind that macros can define templates. A macro could generate `template X(): untyped = v[1]`
23:46:50FromGitter<Varriount> Thus, a macro could create a function or set of expressions that generate the templates, then "paste" in the constraint body.
23:47:28FromDiscord<Xydium> Probably equally complicated though
23:48:34FromGitter<Varriount> I don't know. The big problem with templates is that you might run into overloading wierdness.
23:48:56FromDiscord<Xydium> Oh I just realized, there's no way to check whether an identifier names a variable in the graph
23:49:17FromDiscord<Xydium> Macros are compile-time, the variables don't exist until runtime
23:49:35FromDiscord<Xydium> I'd need to combine the `define` and `constrain` macros into one
23:50:13FromDiscord<Xydium> So I have to blindly replace identifiers, or incur the cost of typing some prefix for graph variables
23:50:27FromGitter<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:33FromDiscord<Xydium> https://pastebin.com/R99Gsviq
23:51:53FromDiscord<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:20FromDiscord<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:45FromDiscord<mratsim> computation graph generated at compile time: https://github.com/mratsim/compute-graph-optim
23:53:07FromDiscord<mratsim> the experimentation are order from simple to complex
23:53:52FromDiscord<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:10FromDiscord<Xydium> Thanks for the references, was struggling to find in-the-field examples of macro usage online
23:55:21*silvernode joined #nim