<< 30-04-2019 >>

00:07:53*[rg] quit (Quit: Leaving)
00:28:31*lritter quit (Ping timeout: 246 seconds)
00:37:25*rnrwashere joined #nim
00:38:26*dsrw joined #nim
01:11:42*vlad1777d quit (Ping timeout: 245 seconds)
01:34:52*mosORadi joined #nim
01:37:15*dsrw quit (Ping timeout: 256 seconds)
01:55:37*jasper joined #nim
02:00:17*banc quit (Quit: Bye)
02:11:04FromGitter<kaushalmodi> today I come across an interesting cpp->Nim problem
02:11:46FromGitter<kaushalmodi> what would be the Nim type matching this in cpp? ⏎ ⏎ ```struct fooList ⏎ { ⏎ std::list<foo> fList; ⏎ };``` [https://gitter.im/nim-lang/Nim?at=5cc7aee28446a6023e9c659b]
02:14:13FromGitter<kaushalmodi> would it be `DoublyLinkedNodeObj[foo]`?
02:14:22FromGitter<genotrance> see how std::vector is imported here - https://forum.nim-lang.org/t/3401
02:16:49FromGitter<kaushalmodi> hmm, so `type List {.importcpp: "std::list", header: "<list>".} [T] = object`? I'll give that a try
02:18:37FromGitter<kaushalmodi> but then the question is, how would I get 0th, 1st, etc. element of that list?
02:18:55FromGitter<kaushalmodi> In any case, let me first get through the first hurdle, thanks!
02:20:04shashlickyou could wrap the corresponding list methods
02:21:18*banc joined #nim
02:28:24FromGitter<kaushalmodi> phew, turns out I might not need to go down that mess
02:29:00FromGitter<kaushalmodi> I was dealing with returning pointer to a struct from cpp, but that struct was returned from an std::list list
02:29:23FromGitter<kaushalmodi> that struct contained 4 structs each returned from an std::list reference
02:30:11FromGitter<kaushalmodi> turns out I needed to manually copy each of those nested structs to the final struct whose pointer I was returning
02:30:16FromGitter<kaushalmodi> (hope that makes sense)
02:42:18*jasper quit (Quit: Page closed)
03:06:30*arecaceae quit (Remote host closed the connection)
03:06:34FromGitter<jrfondren> tfw used `nimble check` instead of `nim check` and thought you'd finally gotten the syntax right
03:06:48*arecaceae joined #nim
03:11:43*[rg] joined #nim
03:20:36*Hexeratops quit (Remote host closed the connection)
03:44:22*mosORadi quit (Quit: Connection closed for inactivity)
03:44:58*[rg] quit (Quit: Leaving)
04:11:22FromGitter<jrfondren> in Nim's own tests, is there a way to test more than the first line of a multi-line error message?
04:14:52FromGitter<jrfondren> looks like no way yet.
04:28:56*[rg] joined #nim
04:29:22*nsf joined #nim
04:34:34*dddddd quit (Remote host closed the connection)
04:49:38*lestus joined #nim
04:55:52*lestus quit (Quit: leaving)
05:07:12*narimiran joined #nim
05:15:24FromGitter<gogolxdong> How to statically link on windows?
05:15:34*krux02 joined #nim
05:20:08*[rg] quit (Quit: Leaving)
05:29:21*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:57:59*absolutejam3 joined #nim
05:59:38*absolutejam2 quit (Ping timeout: 258 seconds)
06:02:38*solitudesf- joined #nim
06:13:44*PMunch joined #nim
06:16:46*jjido joined #nim
06:25:10*jasper joined #nim
06:25:17*absolutejam3 quit (Ping timeout: 268 seconds)
06:36:17*mal``` quit (Quit: Leaving)
06:39:16PMunchdom96, you didn't update play.nim-lang.org yesterday?
06:41:27*zyklon quit (Ping timeout: 240 seconds)
06:44:40*rnrwashere quit (Remote host closed the connection)
06:47:20*mal`` joined #nim
06:56:51*jasper quit (Ping timeout: 256 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:02:12*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:05:03*gmpreussner joined #nim
08:06:41*a_b_m joined #nim
08:09:53FromGitter<mratsim> @kaushalmodi This is how I wrap cpp standard containers/pointers: https://github.com/numforge/agent-smith/blob/master/third_party/std_cpp.nim
08:12:49FromGitter<alehander42> hello
08:18:20*floppydh joined #nim
08:19:21dom96PMunch, done
08:19:32dom96Dark mode huh :O https://play.nim-lang.org
08:19:56FromGitter<mratsim> blank page
08:20:01narimiranworks for me
08:20:05FromGitter<mratsim> ah works now
08:20:59PMunchYeah I tried to theme it after the website
08:22:31PMunchhttps://play.nim-lang.org/index.html?ix=1HD5 <- you can also do this now
08:23:23narimiranPMunch: very nice job there!!
08:25:50PMunchnarimiran, thanks :) It's based on my "A tour of Nim" project where the screen would be split in two, the left with explanations and the right with what you see on the play page now.
08:26:00PMunchHopefully I'll have time to write that soon as well
08:26:11PMunchThe content I mean, the system should work pretty well
08:30:22ZevvPMunch: the spinner button keeps spinning for me after a submit
08:30:48narimiranworks for me :)
08:32:56PMunchZevv, what do you mean after submit? It's meant to spin until you get your results back
08:33:22ZevvI think I got some old stuf in cache; first it was a white page with green submit button, but now its Nim styled and its ok
08:33:47PMunchAh yes, that's the old playground
08:33:58PMunchIt didn't work any longer
08:34:00PMunchHence the new one
08:34:03narimiranPMunch: "a tour of nim" sounds very good and useful! if you want outside help with the content - i'm willing to help
08:34:08ZevvIt survices a thousand forks now anyway, good work!
08:34:23PMunchZevv, yeah it should be a bit more robust against stuff like that
08:34:30narimiranPMunch: you don't need to explain to Zevv that the old one didn't work — he's the one who broke it :D :D
08:34:35PMunchBut I'm sure you could still take it down if you wanted to :P
08:34:43ZevvPMunch: trying
08:35:16FromGitter<alehander42> good work pmunch
08:35:20PMunchnarimiran, feel free :) I've only written a short introduction and some words on types
08:35:26PMunchalehander42, thanks :)
08:36:52PMunchZevv, I can see your attempts spikng the CPU usage :P
08:38:47livcdis the share to ix working?
08:39:53*dddddd joined #nim
08:40:32PMunchShould work
08:40:43PMunchBoth sharing to, and fetching from should work
08:41:07livcdit's okay now :)
08:43:11PMunchMight've been Zevv hogging the CPU time :P
08:43:25ZevvPMunch: it's not trivial to kill anymore
08:43:33PMunchYay :)
08:43:46livcdI think sharing should be done on nim-lang and not ix.io
08:43:56ZevvCan I offer opinions?
08:44:24PMunchSure :)
08:44:26ZevvWould be nice to be able to resize the editor/output areas
08:44:37PMunchlivcd, write me a paste-service and I'll switch it :)
08:44:44ZevvAnd - a bit harder - would be cool to have output 'live', so instead of waiting you could see the compilation and output happen
08:44:59PMunchZevv, yeah I thought about the resize thing
08:45:03Zevvnot sure if that is feasible
08:45:12Zevvbut anyway, great to see its back up!
08:45:14Zevv!eval echo 42
08:45:17NimBot42
08:45:17PMunchHmm, it would mean it would have to stream the content between them
08:45:22Zevv\o/ Bot is back!~
08:45:29PMunchEy nice!
08:45:36Zevv!eval import posix; while true discard fork()
08:45:38NimBotCompile failed: in.nim(1, 33) Error: expected: ':', but got: 'keyword discard'
08:45:43PMunch!eval echo "/me celebrates"
08:45:44NimBot/me celebrates
08:45:49PMunchAww.
08:46:02FromGitter<alehander42> wow hm
08:46:10FromGitter<alehander42> nice , i also like the tour nim idea
08:47:02livcdPMunch: I just think it should be served from nim-lang regardless of what paste-service backend is used :)
08:48:33narimiran!eval echo "Zevv please stop, you're hurting me"
08:48:35NimBotZevv please stop, you're hurting me
08:49:44Zevvit's supposed to hurt :)
08:49:49Zevvwhat doesn't kill you...
08:50:11FromGitter<alehander42> hmm i should test it more often
08:50:18FromGitter<alehander42> do you run it in a container? or just on a vps
08:50:57FromGitter<alehander42> is it easier to limit attack surface on docker containers running custom code?
08:51:12FromGitter<alehander42> e.g. limitting syscalls/network interface
08:52:10dom96Streaming output would indeed be nice
08:52:29dom96other features: ability to choose different Nim versions, some nimble package installed by default
08:53:52PMunchalehander42, the server runs on a VPS, but every snippet of code is run it it's own docker container with limits on RAM and CPU time
08:54:08PMunchAnd no network
08:54:47PMunchdom96, yeah I thought about different Nim versions, but that requires me to create different docker base containers for each version
08:55:07PMunchNot a huge issue, just some more work
08:55:54PMunchAnd the nimble packages thing is something I've thought about as well, but that would also require some work to update the base container at an interval with fresh packages
08:56:24FromGitter<mratsim> or just update packages at every month
08:58:28FromGitter<alehander42> not really, he has to have them directly in the image
08:58:45FromGitter<alehander42> you cant really run "init" code if you recreate it for every input
08:59:16FromGitter<alehander42> isn't it possible to reuse the same container for more inputs? or is it just for privacy (if somebody outputted a passwoerd etc)
08:59:36rayman22201Congrats on the new playground PMunch ! It's very nice 😊. /Me sneaks away back to my holiday now
09:00:09PMunchrayman22201, thanks :)
09:01:10PMunchmratsim, yeah what I meant is that I need to do some work on writing a script that will recreate the base docker image every once in a while to install the Nim packages
09:03:02*stefanos82 joined #nim
09:03:08PMunchalehander42, it would be possible to reuse the containers, but it's easier to just purge them for every run
09:03:18FromGitter<alehander42> isn't is slow
09:03:23FromGitter<alehander42> btw where is queues.nim now?
09:03:28FromGitter<alehander42> it seems it breaks nimyaml for me
09:03:37FromGitter<alehander42> is it in the old stdlib modules repo
09:03:39PMunchIt's guaranteed to not have some wonky state, and it gives some privacy
09:03:56ZevvPMunch: something is odd, sometimes I see compilation output, sometimes not. sometimes I see stdout, sometimes not
09:03:59PMunchWell see for yourself, it's definitely slower than it needs to be, but it's not that bad
09:04:04Zevva reload changes behaviour
09:04:24FromGitter<alehander42> it's not there hm
09:04:29PMunchZevv, try hitting the "Showing: <output|debug>" button
09:04:35PMunchIt toggles between them
09:04:35Zevvowwww
09:04:38Zevv:)
09:04:56PMunchIf output is empty it will automatically show debug, assuming you have a compilation error
09:05:09FromGitter<mratsim> Now I want show C code and assembly :p
09:05:45narimiran@mratsim godbolt is that way ----> :P
09:05:51PMunchI could've improved that by sending the actual return code from the compiler, maybe I'll do that in the future
09:06:08FromGitter<mratsim> Rust does @narimiran, and no Nim support in godbolt
09:06:51narimiranyeah, i know there's no nim support in godbolt, but we should work on adding it. see: https://github.com/mattgodbolt/compiler-explorer/issues/206
09:09:29FromGitter<mratsim> so is 0.20 today? :p
09:09:55livcdwhen is 1.0 ?
09:10:02FromGitter<alehander42> narimiran, isn't NimYAML tested in the 3rd party package CI test?
09:10:36narimiranalehander it is
09:11:46FromGitter<alehander42> hm because it seems it uses queues.nim which is removed on devel
09:12:14FromGitter<alehander42> huh, it seems fixed
09:12:37FromGitter<alehander42> i am not sure why nimble install this
09:13:21*slugm joined #nim
09:14:47FromGitter<alehander42> ohh my bad sorry, have to #head
09:19:23*kapil____ joined #nim
09:35:27*vlad1777d joined #nim
09:46:28narimirannew plotting lib has been added to nimble: https://github.com/ruivieira/matplotnim ; and here are some examples: https://github.com/ruivieira/matplotnim/blob/master/docs/README.md
09:48:06*Vladar joined #nim
09:50:47*a_b_m quit (Ping timeout: 258 seconds)
09:54:54FromGitter<mratsim> now we just need a Jupyter kernel using hot-code reloading :p
09:56:54FromGitter<arnetheduck> for playgrounds, if there were something like repro builds, it would be very easy to have multiple versions running and the user could choose which env to run, instead of running a random version of packages and then wonder why people get frustrated over things suddenly not working
09:58:54*slugm_ joined #nim
09:59:32*slugm quit (Read error: Connection reset by peer)
10:00:35narimiran@arnetheduck i've seen your message last week (haven't responded anything, sorry) and your wish is granted: https://github.com/nim-lang/Nim/pull/8010 is backported to v0.19 branch :)
10:05:09FromGitter<arnetheduck> oh, fantastic @narimaran - what's the ETA for a release? planning use that thing for `nim-result` to raise a better error which is nice, because then one can write an exception-free API and let the user of the API easily convert that to a raising API instead.. in fact, it could be done automagically, so that both exception and non-exception variants are made available - this would be pretty nice for the std lib
10:05:09FromGitter... (what C++ is moving towards, for example with its new file apis and `error_code`) or any other similar low-level infrastructure type of code
10:07:46narimiranETA: May 2019 ;)
10:20:52FromGitter<kaushalmodi> @mratsim thanks. I've saved that for reference. I'll first need to learn std::list.
10:21:10*lritter joined #nim
10:25:57Araqnarimiran, don't we want to release it today?
10:26:41Araqarnetheduck: I still think -d:nimQuirky is a better way forward for the stdlib
10:27:30Araqin fact, I still love its design. All it needs is some protection for IO ops which we could inject automatically
10:27:34narimiranAraq: don't you know all the horror stories about releasing things before holidays? ;) it can wait until next week, there's no rush, and you'll have a more relaxing time this week
10:28:05Araqnarimiran, it will be an excuse to be online during my holidays :P
10:28:21FromGitter<alehander42> what holidays do you have in beginnign of may
10:28:22FromGitter<alehander42> :O
10:28:31narimiranlabor day
10:29:54FromGitter<mratsim> (https://files.gitter.im/nim-lang/Nim/8XwM/DeepinScreenshot_select-area_20190430122121.png)
10:30:02FromGitter<mratsim> ^ here is your excuse to be online :P
10:30:22narimiran@mratsim don't encourage him!! :D
10:30:27FromGitter<mratsim> I tagged the arithmetic test failure bug as high priority, hope you don't mind.
10:31:56FromGitter<mratsim> it's actually a VM bug on shifting int32, int64 and uint64 which doesn't match runtime shift.
10:33:07Araqyeah labor day, I have to burn cars and fight for my right to kill more fetuses
10:33:25FromGitter<mratsim> I have yellow vests for sale ;)
10:34:46Araqmratsim: that bug is krux02's job, I think
10:35:12Araq!eval echo "I gotta test this"
10:35:14NimBotI gotta test this
10:35:23Araqyay
10:37:16FromGitter<arnetheduck> Araq they're mutually compatible, as far as approaches go (same reasoning - easy to convert one to the other when building basic components).. quirky means basically "safe unless known unsafe", which sounds a bit risky for low-level stuff - also unclear how it carries over with thread/task/async programming.. take the async transformations, they're pretty ridiculous from a low-level point of view - exceptions are
10:37:16FromGitter... caught, saved as a value then reraised in the new context, adding lots of costs to happy/unhappy cases alike (regardless of c++ vs c exception impl)
10:38:03Araq80% of the async tests worked with -d:nimQuirky out of the box
10:38:25Araqthe others required a one line change so that some otherwise endless loops are left
10:39:08Araqof course the "uneasy" feeling remains.
10:39:15narimiran!eval import sequtils, strutils; echo @[103, 114, 101, 97, 116, 32, 106, 111, 98, 32, 80, 77, 117, 110, 99, 104, 33].mapIt(chr(it)).join
10:39:18NimBotgreat job PMunch!
10:39:21Araqbut so far it's been proven to only be a feeling.
10:40:09PMunchHaha, thanks NimBot/narimiran
10:40:36Araqand in theory it also works out, the state on the heap is relatively unimportant, what matters is what the IO operations do
10:42:36Araqcan also give you some math to justify it :P
10:47:16*ibutra joined #nim
10:50:53pwntus!eval echo "\o/"
10:50:54NimBotCompile failed: in.nim(1, 8) Error: invalid character constant
10:51:09narimiranpwntus: use `\\` ;)
10:51:14Araq!eval echo r"\o/"
10:51:16NimBot\o/
10:51:26pwntus!eval echo "\\o/"
10:51:27NimBot\o/
10:51:33pwntus\o/
10:51:44PMunch\o/
10:55:57FromGitter<arnetheduck> Araq well, it's a fun and attractive thought, granted, though I wouldn't discard heap completely in a language that so heavily relies on mutability.. trivial case: ⏎ ⏎ ```read(dbdata) ⏎ db.synced = true``` ⏎ ⏎ obviously you can't ignore this side effect.. when you say that side effects are not "undone" by exception handling in the tests, it's largely because of how shoddy exception handling in the std
10:55:57FromGitter... lib is - there are countless examples of leaked handles and invalid states, but since most nim programs are small and run isolated (specially the test suite programs!), it doesn't become an problem. for example, the nim compiler, if it leaks some file handles or sets some state, it'll result in a bug, true (specially when try ... [https://gitter.im/nim-lang/Nim?at=5cc829bd3d78aa6c03bddfc5]
10:58:13Araqthat's not what my analysis has shown
10:58:49Araqit worked out because the socket/file operations are already protected by some kind of 'if not ok(f)' check internally, OS side
11:01:17FromGitter<arnetheduck> yeah, so in the above case, basically you have an operation then a functionally dependent side effect - that might be a log line writing to disk that it's fine, or a database write to the journal (different file) that the prev operation was ok. all you've said is that it works in "simple" cases, but I'd be curious about corner cases more.
11:02:17Araqwell that's a judgement about our async test suite
11:02:42Araqand I have no opinion about its quality :-)
11:06:04Araqand the elephant in the room is still "just what is wrong with traditional exceptions anyway". There has been no convincing analysis done on the problem. With exceptions you often die too early when you could have re-tried. Ok, that's maybe 5 places in 1_000_000 lines. That doesn't justify to bloat your 1 millon lines of code by a factor of 2.
11:06:35Araqof course, these numbers are made up. But we don't have any.
11:07:50*slugm_ quit (Ping timeout: 246 seconds)
11:08:00Araqand 'do; undo' is wrong code in most languages, even in those that lack exceptions. Maybe the 'undo' is better done in an atexit handler too.
11:09:53*slugm joined #nim
11:11:10Araqspeaking of which
11:11:17Araqtestament now says 'Could not load , ignoring'
11:11:24Araqbecause you got the try..except wrong
11:12:48FromGitter<arnetheduck> oh :/ let me take a look, I've got another patch coming that moves that skip loader elsewhere, it should apply to those hardcoded gc et al tests as well
11:15:07Araqin fact. If I got the "skip filename" wrong, why continue with a warning?
11:15:19dom96So, who can implement a BrainFuck interpreter using !eval? You've got about 500 characters to work with ;)
11:15:39Araqwhy not die instead? maybe the next time I'll learn to spell the filename correctly
11:19:58Araqand I've said it before, I will do so again, http://joeduffyblog.com/2016/02/07/the-error-model/ argues *for* exceptions, without noticing.
11:20:13Araq"For the rest? Yes, you guessed it: abandonment. Nice and simple.
11:20:13AraqIt was surprising how much of this we got away with. I attribute most of this to the isolation model. In fact, we could intentionally let a process suffer OOM, and ensuing abandonment, as a result of resource management policy, and still remain confident that stability and recovery were built in to the overall architecture."
11:20:24Araqthat describes a try-except block.
11:20:52Araq"abandonment" describes a raise statement.
11:20:53dom96Does anyone know what happens in C# or other languages with async IO when you write to a socket that is never read?
11:21:18dom96I recently discovered that this is what was causing my game to leak memory
11:22:02dom96This could potentially be a cause of many leaks
11:25:15FromGitter<kaushalmodi> !eval echo NimVersion
11:25:17NimBot0.19.4
11:25:52FromGitter<kaushalmodi> PMunch: we need a "!devil" that runs Nim devel :D
11:26:05FromGitter<kaushalmodi> Now that we have nightly devel builds
11:26:42dom96PRs welcome https://github.com/nim-lang/nimbot :)
11:32:59FromGitter<mratsim> @dom96: here are a couple of Brainfuck interpreters: https://github.com/mratsim/jitterland
11:34:31FromGitter<mratsim> 500 characters is a bit short though :p
11:34:34shashlickArm builds are official - https://github.com/nim-lang/nightlies/releases
11:35:26FromGitter<mratsim> @shashlick, I've edited the title of your issue: https://github.com/nim-lang/Nim/issues/11138 ⏎ ARM is fine, it's the tests that are wrong :/
11:35:40PMunchkaushalmodi, yeah I need to do some work on getting the different Nim versions set up
11:36:25dom96mratsim: perl can do it in 120 chars https://codegolf.stackexchange.com/questions/84/interpret-brainf :P
11:36:32shashlickThanks @mratsim
11:36:34dom96Python in 255
11:36:39dom96Definitely doable
11:37:25dom96if nobody does it I will do it at home :P
11:37:27FromGitter<mratsim> Enjoy codegolfing :P
11:37:44shashlick@dom96 - looks like @andreaferretti found the first bug in the nocompiler PR
11:37:59dom96shashlick: great :)
11:38:05PMunchHmm, if I keep a docker instance running in the background ready to accept a file I could probably speed up the compilation
11:38:06shashlickI'll take a look in a couple hours
11:38:28PMunchInstead of having to spin one up when I need it
11:49:21*Perkol joined #nim
11:49:34Araqshashlick, https://github.com/nim-lang/nimble/pull/635 seen this?
11:50:06Araqplease fix it asap. it's a bit embarrassing we didn't test andreaferretti's packages
11:50:22Perkolhttps://github.com/genotrance/nimmonocypher/blob/master/tests/tnimmonocypher.nim So ho do I for i in hash: hashout &= i.toHex() but in reverse?
11:50:59PerkolI mean convert hexstring to byte array?
11:51:09Araqfor j in countdown(hash.len-1, 0): hashout &= hash[j]
11:51:21Araqbbl
11:52:24FromGitter<mratsim> @Perkol, use byteutils: https://github.com/status-im/nim-byteutils/blob/master/byteutils.nim#L43-L90
11:55:49shashlickWill do Araq
11:58:36PMunchdom96, are there any statistics on which packages that are most popular?
11:59:20dom96Just github stargazers
11:59:26PMunchAh
11:59:28PMunchHmm
11:59:50*Snircle joined #nim
12:03:28PerkolThanks
12:03:37Zevvnimble should automatically star a package when installing :)
12:05:32PMunchZevv, that would require it to have access to your GitHub account
12:07:41Zevvof course, but who cares, this is 2019. everything has access to all my stuff, hooraay
12:09:05FromGitter<mratsim> We need to store install count in the blockchain :D
12:10:21Zevvoh can we please please, here have my private key!
12:10:28PMunchOooh, according to nimble there are 950 packages
12:10:30Zevvnah that doesnt make sense, nevermind
12:10:33PMunchAlmost 1000
12:10:59*Zevv prepares a bogus package to submit the moment the counter reaches 999
12:11:05narimiranhave in mind that there are packages which were not added to packages.json
12:11:22PMunchOh yes, of course
12:11:48PMunchI was just looking at the possibility of installing all the packages
12:11:49FromGitter<mratsim> I assume that those are not ready for prime-time
12:12:04Zevvhow many of those still work with 0.19.4
12:12:06FromGitter<mratsim> docker explodes :p
12:13:38PMunchZevv, only one way to find out!
12:13:41narimiranPMunch: maybe you can filter them to have only packages with >= 5 github stars? should be low enough, while filtering out the packages no one even knows about
12:14:04PMunchWell, that sounds like work..
12:14:09narimiran:)
12:14:21narimiranZevv: i expect to see lots of nil strings and seqs
12:14:39PMunchnimble list | sed -n 's/^\([^ ]*\):$/\1/p' | xargs nimble install -y
12:14:45PMunchSomething like that would install all of them
12:15:02PMunch(don't actually know how to use xargs, but it's something like that)
12:15:59livcdand for winim you spawn a windows vm ? :D
12:16:07Zevvand then what?You have a ton of files in your .nimble dir
12:22:02livcddom96: i opened that SO and love how readable ruby is
12:27:22*slugm_ joined #nim
12:27:39*slugm quit (Read error: Connection reset by peer)
12:29:22*Perkol quit (Quit: Leaving)
12:34:47dom96PMunch: checking stargazers should be relatively trivial
12:34:53dom96you might need a GH API key though
12:35:18dom96check out how my relnotes thing works
12:40:38federico3PMunch: many of the packages are effectively abandoned tho :(
12:45:00PMunchTrue
12:45:09PMunchI'm trying to install all the packages in a docker container now
12:45:25PMunchPartially to see how many of them actually install, and partially to see how big the image will become
12:46:26PMunchAnd yeah, many of them wouldn't really make much sense (like Gtk, Wx, winim, networking stuff, etc.) but it might be nice
12:47:08federico3PMunch: try to build docs as well :)
12:47:22PMunchCould be a nice way to show off new packages as well, share a link to the playground with a snippet that will show how it works
12:48:08federico3PMunch: nimble.directory is already trying to build docs. Adding a link to the playground would be nice
12:49:57PMunchOoh, that would be nice
12:50:16FromGitter<arnetheduck> > why not die instead? maybe the next time I'll learn to spell the filename correctly ⏎ ⏎ @Araq I dunno, it felt like a lenient approach made sense - it's not the end of the world if it doesn't load, so why be obnoxious? makes it slightly easier to write generic instructions that work regardless if the file is there or not.. but I can make a hard error out of it, no strong opinion
12:51:59FromGitter<arnetheduck> > "abandonment" describes a raise statement. ⏎ ⏎ no, "abandonment" describes a situation where you've burned the bridge to go back (partially), and the only option you have is to start over.. you don't want that to happen with a bank transfer between two accounts, ideally
12:55:15FromGitter<kaushalmodi> I made something .. does something like this already exist? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc845b36a84d76ed81eda06]
12:57:04FromGitter<kaushalmodi> I mean, does this have a place in stdlib; if so, where?
13:01:58*slugm_ quit (Ping timeout: 250 seconds)
13:03:20FromGitter<kaushalmodi> The same, with TOML inspiration: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc847985b3f941aa5b92f13]
13:03:37narimiran@kaushalmodi: system/dollars?
13:04:14FromGitter<kaushalmodi> ok, let me find some time to figure out a PR, else I'll ask someone to please integrate this
13:05:12*stefanos82 quit (Ping timeout: 258 seconds)
13:07:16*slugm joined #nim
13:13:14*slugm quit (Ping timeout: 250 seconds)
13:21:39FromGitter<liquid600pgm> I'm trying to find a way to compile a C library statically with my program without having to include it in my source code (its source is hosted on GitHub), is there any way I can do this?
13:22:03shashlickuse nimterop
13:22:28FromGitter<liquid600pgm> sounds like an idea
13:22:36shashlickuse gitPull - https://nimterop.github.io/nimterop/git.html
13:22:41FromGitter<liquid600pgm> ikr,
13:22:46federico3why?
13:22:48PMunchHmm, genotrace, nimgen doesn't seem to build on 0.19.4
13:23:01FromGitter<liquid600pgm> I already read the tsoloud.nim test and understand how that works
13:23:18FromGitter<liquid600pgm> then I just replace `{.compile.}` pragmas with cCompile?
13:23:48shashlickwell, wrapping is up to you, i was just suggesting pulling from git during compile time which nimterop provides
13:23:51shashlickhttps://github.com/nimterop/nimterop/blob/master/nimterop/setup.nim
13:24:15FromGitter<liquid600pgm> alright, I'm gonna try that
13:25:01FromGitter<kaushalmodi> I am in need of a weird value mapping between 2 object types .. here's some pseudocode: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc84cad97dcb371d83c0985]
13:25:11shashlick@PMunch let me check
13:29:21FromGitter<kaushalmodi> I think the root programming problem I have is that if I get the "key" using `fieldPairs`, how to use that to do `obj[key] = something`.
13:30:05FromGitter<liquid600pgm> afaik there's no way to do this without the use of macros
13:30:23FromGitter<mratsim> @kaushalmodi I you can probably use identifier construction with inject + astToStr
13:30:53FromGitter<mratsim> give me 2 min
13:31:03FromGitter<kaushalmodi> ! ooh, thank you!
13:31:25*stefanos82 joined #nim
13:33:53PMunch218 packages didn't install: http://ix.io/1HE5
13:34:51Araqk, v in fairPairs: v = newValue # iirc 'v' is mutable :P
13:35:02Araqfor k, v in fieldPairs: v = newValue # iirc 'v' is mutable :P
13:35:49Araq> no, "abandonment" describes a situation where you've burned the bridge to go back (partially), and the only option you have is to start over
13:35:51PMunchThe image came out to 2.2G
13:36:02PMunchOver the standard Nim docker image that sits at around 1G
13:36:11Araqno, it's really 'raise'. some subsystem fails, the stack unwinds
13:36:16narimiranPMunch: ouch! i know some of those work on devel — one more reason to release v0.20 :)
13:36:43Araqthere is also some nice process isolation going on here, comparable to Erlang
13:37:01narimiranPMunch: how much trouble would it be for playground to use 0.19.9 until 0.20 is out?
13:37:04Araqbut the stack unwinds. and it's everywhere and your nice 'try' annotations are silent about it.
13:38:10PMunchnarimiran, not much trouble at all I think
13:38:55Araqin the end all these 'try' annotations are cargo cult, integer overflows DO NOT use this mechanism. because it doesn't "scale".
13:40:20FromGitter<mratsim> @kaushalmodi Is that normal that ObjB does not have a someBool field?
13:41:10*vlad1777d quit (Ping timeout: 258 seconds)
13:41:41PMunchOh wait.. The Nim docker images doesn't have a devel version..
13:41:47PMunchOnly stable releases..
13:41:51PMunchSo I'd have to make my own..
13:43:22FromGitter<kaushalmodi> @mratsim that was a typo
13:43:32FromGitter<kaushalmodi> I'll keep the key names the exact same between both obj types
13:43:56FromGitter<kaushalmodi> something like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc8511c990feb45182aff10]
13:45:03shashlick@PMunch - what issue are you seeing with nimgen
13:46:06FromGitter<mratsim> ```code paste, see link``` ⏎ ⏎ @lqdev was right, you need macro [https://gitter.im/nim-lang/Nim?at=5cc8519e97dcb371d83c2eb0]
13:46:32PMunchhttp://ix.io/1HEa
13:47:17Araqyou can sprinkle all your code with 'try' keywords or Rust's ?, it doesn't accomplish anything. >90% of the error handling is "pass it on", the rest is "I can handle it". that >90% is so overwhelming that you simply won't detect the other cases by checking for it mechanically. In the end programmers write 'try f(...)' where they wrote 'f(...)' before, no thinking involved. And thus no improvement.
13:47:28shashlick@PMunch - you just tried nimble install nimgen?
13:47:59PMunchhttp://ix.io/1HEb
13:48:07PMunchThat's with "nimble install -y --verbose nimgen"
13:48:32PMunchHmm, it looks like it's actually c2nim that fails..
13:49:04FromGitter<mratsim> keyAssign can be []= if you want
13:50:12shashlick@PMunch - uninstall compiler package
13:50:20shashlickit must be an old version
13:50:36shashlickthat's the problem with installing @#head - it is old as soon as head changes
13:52:13*slugm joined #nim
13:52:36FromGitter<liquid600pgm> shashlick: so, for some reason, I'm using `gitPull("https://github.com/glfw/glfw", BaseDir, "include/*\nsrc/*\n")` (`const BaseDir = nimteropBuildDir()/"glfw"`), but it doesn't pull any files. `~/.nimble/pkgs/nimterop-0.1.0/build/glfw` is an empty git repository, it seems
13:52:49PMunchWell, this is from just pulling the nimlang/nim docker images and trying to install all the packages..
13:53:08PMunchSomething must've explicitly asked for #head I guess
13:55:42PMunchHmm, both 0.19.4 and #head is installed: "compiler [0.19.4, #head]"
13:55:49shashlick@liquid600pgm - do you need to save it to ~/.nimble or only need it for building?
13:56:17FromGitter<liquid600pgm> I need it for building
13:56:36shashlickproblem is that nimble does not install anything that is generated/downloaded in before install
13:57:03shashlickso while I can use the tree-sitter source to build the nimterop binary toast, it doesn't get copied to ~/.nimble
13:57:29shashlickdo you have a bin = xyz in your nimble file?
13:57:33shashlickthat is using glfw
13:57:47FromGitter<liquid600pgm> no, my project is a library
13:57:52*slugm_ joined #nim
13:58:06FromGitter<liquid600pgm> I'm testing it through (surprise, surprise) unit tests
13:58:18shashlickthere you go - that's been my ongoing battle with nimble
13:58:40FromGitter<liquid600pgm> so, what can I do?
13:58:58FromGitter<liquid600pgm> your soloud test works
13:59:04shashlickhttps://github.com/nim-lang/nimble/issues/549
13:59:14shashlickwell, you will have to download the sources in your test instead
13:59:24shashlickbut then any consumers of your libs will have to do it during their build
13:59:42FromGitter<kaushalmodi> @mratsim Thanks a bunch!
13:59:47FromGitter<liquid600pgm> so I guess I'm doomed?
13:59:54shashlickwell, think this way
14:00:08shashlickwhy do you need glfw downloaded into ~/.nimble?
14:00:16shashlickit only needs to be pulled at compile time right
14:00:30shashlicknot at package install time
14:00:31FromGitter<liquid600pgm> yes, but I don't want to keep it in my own source code
14:00:35*slugm quit (Ping timeout: 255 seconds)
14:01:05shashlickyou don't have to - you only keep the gitPull in your source code
14:01:23shashlickwhen you import your source, it will do the pull at compile time of either your test or your consumer
14:01:57FromGitter<liquid600pgm> that's exactly what I'm doing, the problem is, no files are pulled
14:02:06shashlickok can you share what you have?
14:02:12FromGitter<liquid600pgm> sure
14:02:16FromGitter<arnetheduck> @liquid600pgm https://github.com/arnetheduck/nim-sqlite3-abi is an example using nimterop without forcing everyone to install nimterop and suffering from the random version issue `nimble install` and friends give you
14:03:46FromGitter<liquid600pgm> shashlick: take a look https://github.com/liquid600pgm/rapid/blob/master/src/rapid/lib/glfw/glfw.nim
14:04:24shashlick@arnetheduck - he wants to pull from git, not about wrapping at this point
14:04:47FromGitter<liquid600pgm> @arnetheduck that's what I'm trying to avoid: including GLFW's source code in my own source code
14:05:20FromGitter<liquid600pgm> it's a problem for versioning, because when GLFW gets an update I have to update my lib too. Every. Single. Time.
14:05:21FromGitter<arnetheduck> yeah, I'd use a submodule then to get the versioning right
14:05:24shashlick@liquid600pgm - he is caching the wrapper output as well
14:06:04FromGitter<arnetheduck> then automate the running of nimterop with travis or whatever, so there are no manual steps involved, and still having everyone enjoy not having to install treesitter etc
14:06:04shashlick@liquid600pgm - use a git commit or tag in gitPull - that way you don't pull head but the exact version you want
14:06:18FromGitter<liquid600pgm> can I use a branch?
14:06:35shashlickyes i think i implemented that - let me check
14:07:46shashlicknot clear and i don't remember but worth trying with checkout = xyz
14:08:43FromGitter<liquid600pgm> nope, files still aren't getting pulled
14:11:09shashlickwhere are you importing glfw.nim
14:11:42FromGitter<liquid600pgm> here https://github.com/liquid600pgm/rapid/blob/master/src/rapid/gfx/window.nim
14:12:32shashlicknote that nimteropBuildDir() is relative to paths.nim - you want your own relative path
14:13:36FromGitter<liquid600pgm> you mean, I should pull to the directory where glfw.nim lives instead?
14:14:04shashlickwell, check if the nimterop build dir has stuff getting pulled there
14:14:12FromGitter<liquid600pgm> nope, already checked
14:14:16shashlick~/.nimble/pkgs/nimterop-0.1.0/build perhaps
14:14:35FromGitter<liquid600pgm> correct, but the only directory present in build/glfw is .git
14:16:13FromGitter<liquid600pgm> seems it's an empty git repo
14:16:42shashlickis there anything in .git/info/sparse-checkout
14:17:13FromGitter<liquid600pgm> that file doesn't exist, the .git/info directory only contains a file called exclude
14:18:02shashlickokay, presume you have the latest nimterop
14:18:43FromGitter<liquid600pgm> should be the latest, I updated yesterday
14:18:55FromGitter<liquid600pgm> yeah, that's the latest
14:19:12shashlickokay i'm trying locally
14:19:20FromGitter<liquid600pgm> or at least, I think so, updated again and still doesn't compile
14:22:44shashlickokay i just tried locally (nim c window.nim and nim c glfw.nim) and stuff gets pulled
14:22:53shashlicki'm on windows - what are you testing on
14:22:56shashlickalso version of git
14:24:07FromGitter<liquid600pgm> I'm on Fedora 29, git 2.20.1
14:24:34*Trustable joined #nim
14:25:50shashlickokay i'm on older git
14:25:57shashlicktried on ubuntu as well and it pulled fine
14:26:33shashlickhow are you testing this? did you try nim c window.nim directly to see what happens
14:27:31FromGitter<liquid600pgm> `nim c -r tests/t_window`
14:28:02FromGitter<liquid600pgm> `nim c src/rapid/gfx/window` doesn't work, too
14:29:29shashlickdelete that glfw source directory first
14:29:35shashlickonce the dir is in place, it won't pull again
14:29:44shashlickit will only reset
14:31:27FromGitter<liquid600pgm> works fine now! thanks a lot!
14:31:51shashlickokay maybe you pulled once and it never tried again cause something was wrong then
14:32:22shashlicki'll suggest using another build directory
14:32:28shashlickand of course, using a commit/branch
14:32:37shashlicki know i tested branch so it should work
14:32:49FromGitter<liquid600pgm> aah that's probably the case, I was creating a nimterop glfw wrapper some time ago and forgot about it
14:32:57FromGitter<liquid600pgm> branches work fine, just tested
14:33:05shashlickawesome
14:34:22*PMunch quit (Remote host closed the connection)
14:37:49*ibutra quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:40:45FromGitter<liquid600pgm> nimterop seems to fail with -d:mingw, by the way
14:40:58FromGitter<liquid600pgm> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc85e7a1cd0b8307d9bce32]
14:41:45*ibutra joined #nim
14:49:16shashlickyou still on fedora?
14:50:28shashlick-d:mingw sets os to windows, which now lets when defined(windows) to pass
14:50:58shashlickhow do you distinguish between target os and os being run on? cc @Araq
14:55:12Araqshashlick: hostOS vs buildOS
14:55:39AraqbuildOS is only available for nimscript
14:56:38Araqhttps://ci.appveyor.com/project/dom96/nim/builds/24202045/job/i0jqf79hddbjhi2x/tests
14:56:48Araqis that my branch or the new Nimble?
14:57:53shashlickprobably new nimble - figured out the bug breaking patty
14:57:57shashlickbut need your help to fix
14:58:27Araqok shoot
14:58:27*ibutra quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:58:33shashlickhttps://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptapi.nim#L70
14:58:46shashlickpatty is using `--path: "."`
14:58:57Araqok
14:59:00shashlickwhich results in a json of `"".""`
14:59:12Araqjson?
14:59:27shashlickwell, I need to convey the switch back to nimble
14:59:46shashlickso it is taking "." and running astToStr() on it which gives me "".""
15:00:05shashlickbasically if val is a string, i need to use it as is and not use astToStr()
15:00:35shashlickhow do i check in the template?
15:00:40Araqhmm you're too quick
15:01:06Araqso ... Nim processes --path: ".", right?
15:01:57shashlickyes - that calls the `--`() proc which i got from nimscript - https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptapi.nim#L70
15:02:53AraqI know how `--` works, I wrote it.
15:03:14Araqbut I don't understand why it now involves json
15:03:47shashlickhttps://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptapi.nim#L116
15:04:03shashlickremember nim e needs to communicate back to the nimble process
15:04:08shashlickonly way is stdout or to write to a file
15:04:35shashlicksince stdout is already being used to communicate general output, we now write to an out file
15:04:38shashlickformat is json
15:04:51Araqok
15:05:00shashlicksince json module doesn't work in nimscript yet, i am printing it out manually
15:05:05Araqin the compiler, there is this hack:
15:05:08Araqproc processCfgPath(conf: ConfigRef; path: string, info: TLineInfo): AbsoluteDir =
15:05:08Araq let path = if path.len > 0 and path[0] == '"': strutils.unescape(path)
15:05:08Araq else: path
15:05:23Araqso astToStr(".") never did the right thing
15:05:34Araqand '--' has been misused
15:05:45Araqor '--' misdesigned
15:06:01Araqthis hack only exists for Nimscript's -- template
15:06:22AraqI think you need the same hack in your processing pipeline :P
15:07:07Araqin addition to that we could deprecate '--', people don't understand it
15:07:42shashlickwell -- works fine if you don't use quotes
15:07:53Araqbut the first thing you need to do is to see if switch("path", ".") in patty.nimble fixes the problem
15:07:55shashlickso if patty changed to --path: . it will work
15:08:09Araq--path: . is not valid Nim(script)
15:08:12shashlickyes - if i comment it out, it works fine
15:09:30Araq cbconf switch:
15:09:30Araq processSwitch(a.getString 0, a.getString 1, passPP, module.info, conf)
15:09:43Araqwe can also do the 'unescape' here
15:10:02Araqthen the wrong path doesn't enter Nim's data structures and we render it back to json or whatever correctly
15:10:27Araqbut then Nimble only works with the latest Nim devel :P
15:11:02*rayman22201 quit (Quit: Connection closed for inactivity)
15:12:01shashlickswitch("path", ".") also works
15:12:25Araqok. so it's the 'unescape' feature
15:12:29Araqthat you need to replicate
15:12:59shashlickor poor man's fix is to unquote in --
15:13:48*rayman22201 joined #nim
15:13:59shashlickthis doesn't go into nimscript at all - i am overriding switch in nimscriptapi since i need to know the name/val
15:14:10shashlickso that i can communicate it to nimble who will then use it in the next call
15:14:21shashlicknimscript never sees these switches
15:16:52shashlickcan you check the type of an untyped param in a template?
15:25:29*rnrwashere joined #nim
15:26:49FromGitter<mratsim> no
15:27:11FromGitter<mratsim> well, you can do type(myUntypedParam) if that's what you mean
15:30:03*rnrwashere quit (Ping timeout: 264 seconds)
15:35:07shashlickAraq: are you okay with just removing the leading and trailing quote if they exist
15:35:49AraqI think that would be wrong for \ vs \\
15:36:04Araqwhat's wrong with 'unescape'?
15:37:25shashlickwell unescape removes leading \
15:38:17shashlickbasically i need to astToStr(val).strip(chars={'"', ' '}).escape()
15:38:32Araqwhy?
15:38:38shashlickso when it is written to json file, it is correct
15:38:46Araqwhy do you need to do something differently than what the Nim compiler itself does
15:39:20Araqyour goal is to be bug compatible with Nim, hence you should use what Nim uses
15:39:28shashlicki am looking at unescape as defined in strutils
15:39:36Araqyes
15:40:52AraqI think you're overthinking this. ;-) Use exactly the compiler's logic to get it compatible to 100%
15:41:30Araqit doesn't matter if the compiler got it wrong, that would be a different issue
15:59:32*rnrwashere joined #nim
16:21:41*xet7 joined #nim
16:23:19*rnrwashere quit (Remote host closed the connection)
16:30:05*floppydh quit (Quit: WeeChat 2.4)
16:32:00*MyMind joined #nim
16:32:17*Sembei quit (Ping timeout: 246 seconds)
16:34:31*slugm_ quit (Read error: Connection reset by peer)
16:34:51*slugm_ joined #nim
16:38:34FromDiscord_<treeform> Araq, how is the new non-gc going?
16:40:32*zyklon joined #nim
16:46:11*slugm joined #nim
16:46:32JappleAckwhat is "new non-gc"?
16:47:07*slugm_ quit (Ping timeout: 246 seconds)
16:48:48*Trustable quit (Remote host closed the connection)
16:49:45FromGitter<jrfondren> --newruntime in devel. related: https://nim-lang.org/araq/ownedrefs.html
16:51:27JappleAckso we would be able to avoid using garbage collector?
16:52:00JappleAckwhen objects in heap will be freed?
16:52:37JappleAcki'm going to read that topic anyway, the answer is probably there)
16:55:38JappleAckhave someone considered bridging #nim with gitter via matrix? it would get us virtual users instead of one bot which just adds <nickname> to a message? so it would be easier to mention someone
17:02:13FromGitter<dom96> Yes. We have, but the latency/reliability of matrix is poor
17:03:21shashlick@dom96 - i've fixed several issues in nocompiler, will you be able to review?
17:03:47*rnrwashere joined #nim
17:04:57*rnrwashere quit (Remote host closed the connection)
17:05:03*rnrwashere joined #nim
17:05:08*thomasross quit (Remote host closed the connection)
17:05:26Araqlib/pure/collections/tables.nim(277, 42) Error: '=' is not available for type <owned Node>; requires a copy because it's not the last read of 'n[i].val'
17:05:38Araq:-) the compiler is entirely correct
17:06:26*thomasross joined #nim
17:07:14shashlickAraq: I've fixed issues raised in nimx, loopfusion and patty
17:07:33*rnrwashere quit (Remote host closed the connection)
17:07:37shashlickwill push shortly, once CI passes, please review and merge if possible
17:07:44Araqyou bet.
17:07:51shashlicki've added additional test cases to nimble to cover these issues
17:08:15*thomasross quit (Max SendQ exceeded)
17:08:41*thomasross joined #nim
17:09:06*rnrwashere joined #nim
17:10:44*thomasross quit (Max SendQ exceeded)
17:11:10*thomasross joined #nim
17:18:13*kapil____ quit (Quit: Connection closed for inactivity)
17:18:18Araqtreeform: I'm tinkering with Nim's std collections and 'owned ref'
17:18:31Araqbut it all seems to work out so far, no major obstacle
17:22:17shashlickMy nimble history is completely messed up in git, wonder why it happens
17:22:44shashlickDiffs have many older commits showing up
17:23:04shashlickBut actual changes are just what I've made in one
17:25:25*rnrwashere quit (Remote host closed the connection)
17:40:58*Jesin quit (Quit: Leaving)
17:41:08*rayman22201 quit (Quit: Connection closed for inactivity)
17:43:46shashlick@Araq, @dom96 - https://github.com/nim-lang/nimble/pull/642
17:49:54*NimBot joined #nim
17:51:40Araqshashlick: fine with me but dom96 dislikes when I merge things :P
17:53:57*Jesin joined #nim
17:54:21*absolutejam3 joined #nim
17:55:13shashlickokay will have to wait then
17:56:01Araqsux, it also affects my branch and Nim devel
17:56:09shashlickimpressing @dom96 is frustrating since it takes a long time, doesn't help we are in different time zones
17:56:28shashlickby the way, your suggestion to work on nimsuggest threw me in the deep end in compiler world
18:00:18*rnrwashere joined #nim
18:00:20shashlick@Araq - considering I don't know the compiler at all, do you think the fix for https://github.com/nim-lang/nimsuggest/issues/105 is that this line https://github.com/nim-lang/Nim/blob/devel/compiler/importer.nim#L95 needs to be tabbed right by 1?
18:01:01Araqha
18:01:08Araqpossible! :-)
18:01:44Araqeven likely. Nice one.
18:02:38shashlicki've not used nimsuggest at all, nor do i know any of the compiler code
18:03:03shashlickconsidering most of nimsuggest is mingled with the compiler, i feel I should look at other stuff
18:05:04*rnrwashere quit (Ping timeout: 276 seconds)
18:07:32Araqwell nimble needs to have "workspaces" and needs to do 'git clone' like nawabs does it
18:09:42shashlickcan you give a 2 min crash course on nimsuggest - how code is organized high level, best way to debug
18:09:55shashlickdebugger:native gave me that crash very easily but fixing is another matter
18:10:03shashlickhow do I test that i fixed it correctly, etc.
18:10:12*bobby joined #nim
18:10:24shashlickstaying in when defined(nimsugest) is comforting
18:12:53Araqhmm
18:13:14Araqmost of the logic is in compiler/suggest.nim
18:13:32Araqother things are done with 'when defined(nimsuggest)' as you noticed
18:13:47Araqmost problems are simply 'nim check' bugs
18:14:16Araqwhere a previous error means some invariant is violated and so the compiler tries to continue to run and then fails
18:14:57Araqthese are usually easy to fix, some missing 'nil' check :P
18:16:23shashlickso this importer fix impacts compiler in general?
18:19:34shashlickcause nim check works fine on the same file, but nimsuggest crashes
18:19:51Araqno, suggestSym() doesn't do anything outside of the nimsuggest binary
18:20:26*thomasross quit (Remote host closed the connection)
18:20:53*thomasross joined #nim
18:23:58shashlickgood point
18:29:13shashlickokay i think this is a fix
18:29:18Araqyay, everything is green and the spec finally makes sense
18:31:02*Trustable joined #nim
18:33:59*Snircle quit (Read error: Connection reset by peer)
18:34:59*Snircle joined #nim
18:37:25shashlickhow come #nim is so quiet nowadays? does everyone chat elsewhere?
18:40:18*zyklon quit (Quit: Konversation terminated!)
18:40:31*zyklon joined #nim
18:42:13FromGitter<jrfondren> I don't know of any other place.
18:43:55narimiranshashlick: there is some discussion on Telegram, but signal-to-noise ratio is much lower than here.
18:44:14*rnrwashere joined #nim
18:44:41shashlickI'm there too 😄
18:48:38*rnrwashere quit (Ping timeout: 250 seconds)
18:50:38*rnrwashere joined #nim
18:52:32FromGitter<mratsim> It's spring, people are out :p
18:52:55*jjido joined #nim
18:54:52*rnrwashere quit (Ping timeout: 246 seconds)
18:55:07shashlickthat's the second time i've gotten a subtle hint to get out more 😛
19:00:59disruptekaren't we testing ~70 nimble packages with the compiler? why not just make those available in the playground image and build that image with the nightlies?
19:02:39dom96shashlick, Impressing me heh? :)
19:04:13*absolutejam3 quit (Ping timeout: 245 seconds)
19:04:31shashlickno kidding - you have high standards, which is awesome but is time consuming
19:05:32shashlicki keep re-architecting as I go but that's with my own code so I understand you are concerned with long term maintenance
19:09:34*Jesin quit (Quit: Leaving)
19:10:38dom96shashlick, Why do you need to `try` a unescape followed by an escape?
19:10:52dom96I don't consider these to be high standards to be honest
19:12:01Araqdom96: take over if you're unhappy, this is important
19:12:37dom96Araq, how is it? It's a devel version of Nimble
19:12:44dom96Breakage is expected
19:12:52Araqit makes my branch red
19:13:01*Jesin joined #nim
19:13:24Araqand devel too if we were to rebuild it
19:13:47dom96...
19:14:07*rnrwashere joined #nim
19:14:14shashlickso the string being unescaped could have quotes if you have --path: "."
19:14:26shashlickmost people don't put quotes, so you could have --define: abc
19:14:37shashlickin both cases, i need to create a valid json to pass back to nimble
19:14:51shashlickunescape raises an exception if there aren't quotes
19:14:55shashlickso that's why i have the try
19:15:08shashlickand the escape after that is so that quotes are always added back and special chars are escaped
19:15:14shashlickso that i can create valid json
19:15:28shashlicki added a few test cases for that
19:16:33shashlickmind both "." and abc are processed with astToStr() in the -- template so no clean way to get the actual string
19:16:49dom96also, please don't put things that aren't required for the "hot fix". I'm assuming these caching changes are unrelated
19:17:25shashlickwell, it is also a fix cause it wouldn't update nimscriptapi.nim if it changed
19:17:36Araqshashlick: you can use 'if s.startsWith("\""): unescape(s)'
19:17:52Araqwhich is what the compiler does, I gave you a snippet for a reason
19:17:57*jasper_ joined #nim
19:18:22*rnrwashere quit (Ping timeout: 245 seconds)
19:18:39*absolutejam3 joined #nim
19:18:50dom96Yeah, please change to what Araq suggested
19:19:23*Snircle quit (Read error: Connection reset by peer)
19:19:47*Snircle joined #nim
19:19:55dom96This is why encoding this as JSON would have been better instead of using ini
19:20:09dom96I wonder whether there is more bugs possible in printSeqIfLen
19:20:15Araqdom96: no, it's unrelated, see the logs
19:20:27Araqit needs to be "bug compatible" with the compiler
19:21:13shashlickthere's 25 ways this code can be written
19:21:36dom96I'm slightly worried about all this caching too.
19:21:48Araqthe caching is awesome
19:21:53AraqI like it
19:24:27shashlickif there's only one true way to write code then contributions will take forever - this one line change means at least an hour of time coding, testing, waiting for CI and then waiting for reviews
19:24:39dom96Of course, it's necessary. I just wish the code was clearer about what is cached where
19:25:18Araqshashlick: yeah I feel your pain. we need to find a better way to work together
19:25:36dom96I'm happy to merge this with that change
19:25:41dom96I don't think a re-test is necessary
19:26:00dom96(well, you can do a quick test which shouldn't take you longer than 10 minutes)
19:32:17*rnrwashere joined #nim
19:32:29*nsf quit (Quit: WeeChat 2.4)
19:34:13FromGitter<liquid600pgm> shashlick: is there an alternative to gitPull which can download from *any* website you choose?
19:35:32shashlickthere's a downloadUrl()
19:35:39*clyybber joined #nim
19:37:22*rnrwashere quit (Ping timeout: 276 seconds)
19:37:55shashlickin retrospect, there's also nimgrab which you can use with staticExec
19:38:41Araqyay, nimgrab
19:38:46Araqforgot it exists :-)
19:44:02*theelous3_ joined #nim
19:44:35clyybber!eval static: echo
19:44:36NimBotCompile failed: in.nim(1, 9) Error: expression 'echo' is of type 'proc (x: varargs[typed]){.gcsafe, locks: 0.}' and has to be discarded; for a function call use ()
19:44:39clyybber!eval static: echo "yay"
19:44:41NimBotyay
19:44:52clyybbernice
19:48:44FromGitter<kaushalmodi> can someone help spot the issue with this piece of code?: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc8a69c3d78aa6c03c17e83]
19:49:22FromGitter<kaushalmodi> I am going bonkers staring that that piece of code as I cannot figure out why this code results in: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc8a6c2e416b8451909bcbd]
19:49:57FromGitter<kaushalmodi> why would that result get any other value than bitOne and bitZero?
19:58:03dom96shashlick, feel free to ping me when you update your PRs when we're in contact like this
19:58:41dom96otherwise it's likely I'll miss it :)
20:00:10disruptekthe problem with logging.log method tainting .raises. with Exception despite never running... well, it's still a thing.
20:00:58*slugm quit (Remote host closed the connection)
20:01:21*slugm joined #nim
20:03:17shashlick@dom96 - ya i was waiting for CI to pass on the PR
20:03:38shashlickguess you could have reviewed it before that with the new merge on pass feature
20:06:26dom96That's not a GitHub feature, is it?
20:14:46shashlickyep - in a PR, if checks are running, you can click merge and state it can be auto merged once all checks pass
20:14:51shashlicknot able to find a screenshot
20:15:31shashlickhere's gitlab's implementation - https://about.gitlab.com/2015/12/22/gitlab-8-3-released/
20:16:39shashlickAraq: what is tyProxy and can it have any sons
20:16:55Araqkaushalmodi: https://github.com/nim-lang/Nim/issues/11049 this one?
20:16:57disruptek!eval "".parseInt()
20:16:58NimBotCompile failed: in.nim(1, 3) Error: attempting to call undeclared routine: 'parseInt'
20:17:01dom96AFAIK GitHub doesn't support this
20:17:22disruptek!eval import strutils; "".parseInt()
20:17:24NimBotCompile failed: in.nim(1, 20) Error: expression 'parseInt("")' is of type 'int' and has to be discarded
20:17:34disruptek!eval import strutils; discard "".parseInt()
20:17:37NimBot<no output>
20:17:48disruptek!eval import strutils; echo $("".parseInt())
20:17:51shashlickAraq: crash here since t.kind = tyProxy but it has no sons https://github.com/nim-lang/Nim/blob/devel/compiler/types.nim#L126
20:17:51NimBot<no output>
20:18:24Araqshashlick: tyProxy is tyError, it doesn't have sons
20:18:33dom96!eval echo("Am I broken?")
20:18:35NimBotAm I broken?
20:18:44*rockcavera quit (Ping timeout: 246 seconds)
20:19:00dom96!eval import strutils; echo "Result:", $("".parseInt())
20:19:02NimBot<no output>
20:19:09dom96strange
20:19:35shashlickAraq: so what should elemType() return for t.kind = tyProxy
20:19:49Araqshashlick: result = t
20:19:52dom96oh, because it's crashing and writing to stderr
20:19:56dom96PMunch ^^
20:20:46dom96PMunch: You're not using Karax? :'(
20:23:01disruptek!eval import strutils; echo "should be dollaring args in any event", "".parseInt()
20:23:04NimBot<no output>
20:25:58*narimiran quit (Ping timeout: 258 seconds)
20:27:15FromGitter<kaushalmodi> Araq: I am not using streams
20:31:20AraqFile might have the same problem
20:32:34shashlickAraq: am looking at https://github.com/nim-lang/nimsuggest/issues/101
20:33:26shashlickchanged https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L1338 to
20:33:33shashlickproc lastSon*(n: PType): PType = result = if n.sons.len != 0: n.sons[^1] else: n
20:33:48shashlicksince just fixing elemType() wasn't sufficient, failed elsewhere
20:33:58shashlickbut now it's gone to lunch
20:34:08FromGitter<kaushalmodi> Araq: I am not not use File either .. just setting 3-level nested struct/object element with the output of that boolToBit proc
20:34:23FromGitter<kaushalmodi> .. and I cannot reproduce that issue in a standalong file
20:34:29FromGitter<kaushalmodi> *standalone
20:35:08shashlickokay, in release mode, it crashed again elsewhere, will have to try debug mode
20:35:39shashlickruns for a looong time though
20:38:20*MyMind quit (Quit: WeeChat 2.4)
20:39:50*gangstacat quit (Ping timeout: 258 seconds)
20:39:52*slugm quit (Ping timeout: 246 seconds)
20:41:24shashlickis that fix correct though?
20:42:28Araqshashlick: I would add an 'of' case, of tyError: result = t
20:42:46*gangstacat joined #nim
20:44:13shashlickokay but then it fails elsewhere for the same proc
20:44:41Araqpossible, so it needs more fixes
20:44:59shashlickso you don't want to fix lastSon itself
20:45:03shashlickchange rather
20:45:17Araqof course not
20:45:35shashlickhttps://github.com/nim-lang/Nim/blob/devel/compiler/semtypes.nim#L1043
20:45:38shashlickit fails there
20:48:12*Trustable quit (Remote host closed the connection)
20:48:53Araqif body.kind == tyForward: -->
20:49:09Araqif body.kind in {tyError, tyForward}:
20:53:17*rockcavera joined #nim
21:08:47shashlickAraq: next crash here - https://github.com/nim-lang/Nim/blob/devel/compiler/semtypinst.nim#L68
21:10:26FromDiscord_<kodkuce> hows progress on new runtime?
21:12:50Araqkodkuce: very good, just today I got the stdlib table collections to work with it
21:13:53*absolutejam3 quit (Ping timeout: 258 seconds)
21:14:14Araqif t.kind in {tyStatic, tyGenericParam} + tyTypeClasses:
21:14:28Araqshashlick: ^ {tyStatic, tyError, ...}
21:14:31FromDiscord_<kodkuce> nice , am wokring atm on some python stuff, but plan in future to try to make a gameserver with nim, preferbably multythreaded with shared memory
21:14:31Araqyou get the idea
21:16:33shashlicknot sure how helpful this is 😄
21:20:15*absolutejam3 joined #nim
21:23:29shashlickAraq: yet another, don't see the idea - https://github.com/nim-lang/Nim/blob/devel/compiler/semtypinst.nim#L366
21:24:01FromGitter<jrfondren> @kaushalmodi that code doesn't have that output. since not even lying to boolToBit about the type of the data passed to it can result in that argument, I think boolToBit probably isn't what your real code is doing either.
21:24:51Araqshashlick: this one is different
21:25:12FromGitter<jrfondren> and also there's the "(invalid data!)". at least provide the actual code for boolToBit itself.
21:25:30Araqbody.kind == tyGenericBody should be true
21:25:43Araqand a "generic body" always has a son
21:26:21Araqso you need to output 'echo body.id'
21:26:29Araqand then modify ast.newType
21:26:37dom96It seems Rust is having some trouble avoiding parenthesis around (await foobar)
21:26:39Araqand track where the type of this ID is produced
21:27:32Araqshashlick: but you don't have to fix everything, these changes already would make good PR
21:27:33shashlickno, somehow tyProxy got through - makes no sense
21:27:44shashlicki print body.kind before that line
21:27:53Araqah. strange
21:30:42shashlickdo we need to return on line 302
21:30:57*clyybber quit (Quit: WeeChat 2.4)
21:31:24Araqshashlick: for tyError yes, but not in general
21:31:33shashlickokay
21:34:17*Vladar quit (Remote host closed the connection)
21:36:00shashlickthen crashes at the caller
21:36:21shashlickhttps://github.com/nim-lang/Nim/blob/devel/compiler/semtypinst.nim#L491
21:36:59shashlickcannot just return, or need to handle at caller
21:37:57FromGitter<kaushalmodi> @jrfondren about the boolToBit, it *is* the proc being used.
21:38:07FromGitter<kaushalmodi> You can see that the echo statement matches
21:38:19FromGitter<jrfondren> I can see that the echo statement does not match, because there's extra text in your output.
21:38:27FromGitter<kaushalmodi> The input is true, but the result is random each time
21:38:54FromGitter<kaushalmodi> It does .. what am I missing?
21:39:08FromGitter<jrfondren> "(invalid data!)"
21:39:24*[rg] joined #nim
21:39:34FromGitter<kaushalmodi> That's $ of enum
21:39:41FromGitter<jrfondren> ah indeed.
21:40:27FromGitter<kaushalmodi> I'm explicitly setting enum bitZero and bitOne, but somehow it gets set to something arbitrary
21:40:39FromGitter<jrfondren> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cc8c0d75b3f941aa5bcc95c]
21:41:09FromGitter<kaushalmodi> And I cannot reproduce this in a standalone test
21:42:01FromGitter<kaushalmodi> In the actual code that I cannot share, I am setting an element in a nested `var` object `a.b.c = boolToBit.. `
21:42:26FromGitter<kaushalmodi> But nothing else is modifying that var other than that boolToBit
21:42:57*lritter quit (Ping timeout: 245 seconds)
21:43:31FromGitter<jrfondren> look for boolToBit in your cached .c code
21:43:38FromGitter<kaushalmodi> If I directly do a.b.c = bitZero, that value *sticks*. But assigning via that boolToBit doesn't
21:43:40FromGitter<kaushalmodi> Very odd
21:44:42FromGitter<jrfondren> https://gist.github.com/jrfondren/b6880682527925d0fc4743d911c80166 is what I get with just your example, which is pretty clear.
21:47:07FromGitter<kaushalmodi> Ok will do once at computer
21:54:13*absolutejam3 quit (Ping timeout: 245 seconds)
21:57:58*solitudesf- quit (Ping timeout: 258 seconds)
22:01:45*vlad1777d joined #nim
22:20:21*mosORadi joined #nim
22:25:08*krux02 quit (Remote host closed the connection)
22:33:41*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:49:38JappleAckplease clarify me, is this feature https://nim-lang.org/araq/ownedrefs.html already implemented?
22:51:20Araqyeah but it's still vaporware
22:52:07JappleAckAraq: is it in some dev-branch or something?
22:54:26Araqit's in Nim devel, use the --newruntime switch
22:57:56JappleAckAraq: thanks
23:05:56*[rg] quit (Quit: Leaving)
23:20:26*rnrwashere joined #nim
23:22:45*rnrwashere quit (Remote host closed the connection)
23:24:25*rnrwashere joined #nim
23:27:30FromDiscord_<exelotl> did you find a solution for the s = s thing that came up the other day?
23:40:27*jasper_ quit (Quit: Page closed)
23:51:53*stefanos82 quit (Remote host closed the connection)