<< 06-05-2019 >>

00:11:09noonienis here any reason http://vpaste.net/h5pmC results in: `Error: cannot evaluate at compile time: lastField`?
00:14:50noonienseems like this is the issue: https://github.com/nim-lang/Nim/issues/8758
00:22:27*cyberjpn joined #nim
00:33:52*cyberjpn quit (Ping timeout: 246 seconds)
00:34:39FromGitter<JasperJenkins> Make the static block into its own proc instead and call that in a static block. Generally keep ct and rt separated as much as possible. Something like this should work: http://ix.io/1Ia6/nim
00:39:52noonienyes, i ended up doing something like that, thanks!
00:40:18FromGitter<JasperJenkins> Or clean it up even more with a template: http://ix.io/1Iab/nim
00:42:26noonieni ended up doing something similar to this: https://github.com/nim-lang/Nim/issues/8758
00:42:36noonienoops, this: http://vpaste.net/gaEKv
00:53:14*cyberjpn joined #nim
00:54:52*theelous3 quit (Ping timeout: 268 seconds)
00:56:16*[rg] quit (Ping timeout: 246 seconds)
01:09:59*[rg] joined #nim
01:10:53*rnrwashere joined #nim
01:13:33*rnrwashere quit (Remote host closed the connection)
01:15:19*rnrwashere joined #nim
01:29:28shashlickhttp://ducktape.blot.im/choosing-a-language-for-bioinformatics
01:34:19*[rg] quit (Ping timeout: 248 seconds)
01:38:35*cornfeedhobo quit (Quit: ZNC - https://znc.in)
01:49:37*cornfeedhobo joined #nim
01:52:37*rnrwashere quit (Remote host closed the connection)
02:00:17*banc quit (Quit: Bye)
02:01:06*rnrwashere joined #nim
02:05:13*rnrwashere quit (Ping timeout: 246 seconds)
02:07:52*cyberjpn quit (Ping timeout: 250 seconds)
02:20:00*deech quit (Ping timeout: 250 seconds)
02:21:23*banc joined #nim
02:21:54*dddddd quit (Remote host closed the connection)
02:29:43*[rg] joined #nim
02:41:55*cyberjpn joined #nim
02:44:43*Hexeratops quit (Remote host closed the connection)
02:46:26cy1https://pastebin.com/KZSSHhcA identical code, identical syntax, the latter fails with Error: cannot use symbol of kind 'proc' as a 'field'
02:46:31cy1That's a bug, right?
02:47:27cy1oh I should say identical ASTs too
02:49:12leorizeI saw a similar bug sometimes ago
02:49:19leorizeyou can try to look in the issue tracker
02:52:47cy1https://github.com/nim-lang/Nim/issues/11091 maybe?
02:57:53cy1Too bad you can't transform lists in templates, like transforming each element into an "of" branch of a case statement or something.
03:06:13*rnrwashere joined #nim
03:12:22*rnrwashere quit (Remote host closed the connection)
04:11:13*cyberjpn quit (Ping timeout: 246 seconds)
04:15:28*rnrwashere joined #nim
04:19:39*rnrwashere quit (Ping timeout: 248 seconds)
04:20:13*rnrwashere joined #nim
04:21:53dvnhi - can anyone point to some projects which use https://github.com/nim-lang/ui ?
04:22:05dvns/some/any/g
04:23:03*nsf joined #nim
04:24:38*rnrwashere quit (Remote host closed the connection)
04:27:03*rnrwashere joined #nim
04:32:22*Intensitea joined #nim
04:34:50*Intensitea quit (Changing host)
04:34:50*Intensitea joined #nim
04:43:19*[rg] quit (Quit: Konversation terminated!)
05:10:44*narimiran joined #nim
05:22:40*leorize quit (Quit: WeeChat 2.3)
05:42:45Araqcy1, you can transform the list into a case statement via a macro
05:47:48Araqdvn, I used it here https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim but this is not yet alive
05:53:37cy1Araq: Yeah, that probably would reduce the amount I need to go digging into an AST I just quoted...
06:03:12*krux02 joined #nim
06:03:39*solitudesf joined #nim
06:09:39cy1I don't think you can make fragments of code in a macro though, like "case p.kind: makeOf(exp, flags): " etc. Have to make the whole case statement in the macro.
06:11:20Araqtrue
06:15:20*dddddd joined #nim
06:17:47*PMunch joined #nim
06:28:04*rnrwashere quit (Remote host closed the connection)
06:28:36cy1looks like nnkOfBranch can't use a macro returning a list, to accept multiple expressions...
06:28:50cy1if only there was some way to interpolate
06:31:29cy1It just keeps requiring more context around the interesting part, for the macro call to be valid syntax
06:31:51cy1can't make multiple expressions in an OfBranch, can't make an OfBranch, can't make a RecCase, can't make an ObjectTy, can't wrap an Asgn, so I have to go like statementlist[0][2][1][4][0].add(expr) or something
06:34:13Zevvcy1: If I understand you right: I do just that in npeg, take a look there. I have a list of IR, which gets expanded into a case wherea template gets expanded for each 'of'
06:34:53Zevv https://raw.githubusercontent.com/zevv/npeg/master/src/npeg/codegen.nim
06:35:13Zevvsee genCode macro on the bottom
06:37:43Zevv let call = nnkCall.newTree(ident($i.op & "Fn")) ... cases.add nnkOfBranch.newTree(newLit(n), call)
06:37:44cy1I'll take a look Zevv, thanks
06:38:06rockcaverais it possible to set a timeout to close an async socket?
06:40:48cy1what I'm dealing with is like "of A,B,C,D,...:" where the number of expressions varies depending on the expression passed, rather than always being one or two. Could just make a bunch of redundant "of A: etc of B: etc" branches I guess... either way it can only be approached at the topmost level of statement list, AFAICT.
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:53*gmpreussner joined #nim
07:10:51FromGitter<mratsim> @cy1 this might inspire you: https://www.phoronix.com/scan.php?page=news_item&px=GCC-9.1-Compiler-Released
07:17:56Araq"the option of dumping diagnostics/errors into JSON format" yay
07:18:36FromGitter<mratsim> argh it was the wrong paste
07:18:50FromGitter<mratsim> https://github.com/andreaferretti/patty
07:18:56FromGitter<mratsim> sorry :/
07:19:36FromGitter<mratsim> I'm curious about that though " Fortran support in GCC has also been improved with now handling asynchronous I/O and other features. "
07:20:27*solitudesf quit (Ping timeout: 248 seconds)
07:28:32*dddddd quit (Ping timeout: 250 seconds)
07:29:15*dddddd joined #nim
07:34:38FromGitter<mratsim> I think an async await tutorial is needed: https://forum.nim-lang.org/t/4824
07:34:46FromGitter<mratsim> and some recipes/cookbook
07:36:18narimiranyes it would be nice, but the last time i asked - nobody volunteered to write one ;)
07:41:17PMunchUgh, HTML is so infuriating to work with..
07:42:46FromGitter<jrfondren> I'll write that
07:43:53FromGitter<mratsim> @PMunch, last time Araq was infuriated at something, he wrote a PHP backend for Nim ;)
07:44:51*slugm joined #nim
07:45:18Araqno, I got paid for it
07:45:30Araqbut I did write Karax to generate HTML ;-)
07:46:16FromGitter<mratsim> btw 0.20 or 0.19.6?
07:48:26PMunchWell the problem isn't to generate HTML, the problem is to figure out what HTML to generate
07:48:29PMunchhttps://play.nim-lang.org/index.html?tour=https%3A%2F%2Fplay.nim-lang.org%2Ftour.html
07:48:59PMunch^ New tour feature
07:49:09AraqPMunch, ah but that's easy, a <div> nested in a <div> nested in a ...
07:49:26PMunchHaha, true, it's div's all the way down
07:49:36Araqmodern HTML is divs all the way down until you get to the CSS
07:49:48FromGitter<jrfondren> set padding-top to zero
07:50:13PMunchjrfondren, on what?
07:50:35FromGitter<jrfondren> oh I just assumed your problem was the vertical space above the "Welcome" line
07:50:51Araqand the 'C' in CSS is a design mistake and so you gotta hire a "web designer" that takes months for a UI I used to click together in Delphi single-handed in an afternoon
07:51:01PMunchThe issue I was having was that if the explanations section got too long, it would start scrolling, but the Next/Previous buttons would stay in the same spot
07:51:20FromGitter<jrfondren> oh yeah, that looks awful.
07:53:51PMunchjrfondren, yup. And the entire site completely falls apart on mobile :P
07:54:40FromGitter<jrfondren> probably easier just to put some clickable text in with the explanation. fixed positions are better if you want to repeatedly click them, but nobody should be doing that who's really taking the tour.
07:55:20narimiran@mratsim why not both? ;)
07:56:26FromGitter<mratsim> it was a question about the timeline as there was some talk about releasing last week
07:56:57FromGitter<mratsim> (not that I want to have a release right now)
07:57:02narimiran@mratsim 0.19.6 should come out this week. 0.20 will follow after that, hopefully when some more regressions are fixed
07:57:51FromGitter<mratsim> I really hope 0.20 would be a preview of 1.0, I'd really like to try custom allocators
08:03:25PMunchjrfonden, perhaps, but I wanted it to match the style of the editor on the right with buttons on the bottom
08:05:21PMunchHmm, cloudflare seems to cache the stylesheet for quite a while
08:05:24PMunchThat's annoying
08:08:23FromGitter<jrfondren> you should be able to put in a dev mode while you're working on it
08:08:44FromGitter<jrfondren> cloudflare has something like that, per site.
08:12:22*floppydh joined #nim
08:12:53ZevvHey jrfondren: I still can't believe the implausible situation with the bluehost server; you weren't pulling my leg, were you?
08:13:02FromGitter<jrfondren> nope, totally true
08:13:33Zevvwoha
08:13:45FromGitter<jrfondren> your last words were "solved, very well, good to see / good luck!"
08:14:19Zevvwell, it does make for a nice story for beer with engineers
08:16:43PMunchjrfonden, well I only have access to the server behind cloudflare. So I'd need to ask dom96 to make that change. But it should be fine now I think
08:16:51PMunchOnce the cache updates at least
08:17:04PMunchStill has the horrible floating buttons bar though
08:20:16Zevvjrfondren: anyway, I looked into the more efficient line reading into strings, but its not trivial. The string header and data are adjecent in memory, so you can't just poke the string pointer to point anywhere
08:20:52FromGitter<jrfondren> aye, that's what I was saying. it still might be reasonable to read directly into that buffer though.
08:21:31Zevvbut then there's always the extra copy from the FILE * buffer into the string buffer
08:22:18FromGitter<jrfondren> if you getline() or something, but since the C interface sucks you could just use the syscalls or the thin wrappers like fread.
08:24:19FromGitter<jrfondren> with npeg you could have two buffers, read into them alternately, and then you get at least one buffer's size of string for 'backtracking'
08:27:28*xet7 quit (Quit: Leaving)
08:28:44Zevvwhich might still not be enough - no easiy solution there
08:30:48FromGitter<jrfondren> it's an additional failure condition but the user can be responsible for it, by specifying the buffer size and using this interface. don't want that, readFile and pass the entire file as a string instead.
08:31:09FromGitter<jrfondren> the benefit is no copies at all except for captures.
08:34:06Zevvtrue
08:55:35Araqwhy not use lexbase for it
08:56:10Araqline-based parsing is a stupid thing to do anyway, it's completely arbitrary and most languages have tokens that can span multiple lines
09:27:03livcdPMunch: i like the design! good job
09:28:15Araqhttps://medium.com/@mattklein123/crash-early-and-crash-often-for-more-reliable-software-597738dd21c5
09:29:55PMunchlivcd, thanks :)
09:30:04PMunch(Assuming you were talking about the playground)
09:30:40*abm joined #nim
09:31:01livcdPMunch: yes
09:31:22PMunchDid you try the tour feature?
09:31:28PMunchAs in creating your own tour?
09:31:50livcdahh
09:31:53livcdnot that one
09:41:26*clyybber joined #nim
09:48:00*xet7 joined #nim
09:53:44*JappleAck quit (Quit: Closing object)
09:58:23*rnrwashere joined #nim
10:01:10*JappleAck joined #nim
10:02:38*rnrwashere quit (Ping timeout: 252 seconds)
10:16:44*lritter joined #nim
10:31:37FromGitter<alehander42> Araq, you can't just crash early in a lib
10:33:31dom96PMunch, why the change away from Karax for the playground?
10:34:05FromGitter<alehander42> cy1: https://github.com/krux02/ast-pattern-matching
10:34:16dom96for caching, just add ?time=123412412 into the CSS url
10:34:21FromGitter<alehander42> would be even better for macro usecase
10:43:47FromGitter<arnetheduck> Araq, lol, the mistake made at the beginning of all discussions about error handling is to call it error handling :) if you treat all errors as part of "normal" control flow (and don't consider them errors but just alternate equally important execution paths), you end up with what the article above is arguing for - no meaningless error handling and tight code that structurally enforces correctness
10:45:06noonienhello folks
10:48:00noonieni'm getting some really weird issues with imports, compiling fails depending on order of imports, some imports seem to work realy weirdly, but just sometimes. i'll try to make some test cases
10:48:39noonieni'm on the devel branch
10:52:44PMunchdom96, mostly just because I had toyed around with creating the tour of nim thing before I got involved with the playground
10:53:01PMunchSo it was easier for me to just copy that and make some tiny changes than to get the old UI up and running again
10:53:02dom96PMunch, it would be nice if you used Karax for that too ;)
10:53:15PMunchWell now they are merged
10:53:46noonienshould a module export everything it uses from other modules?
10:54:08PMunchAnd I guess I should redo the thing in Karax, if for nothing else to show off it's powers, but I wanted to get things up and running fast
10:54:43PMunchnoonien, depends. But mostly no
10:56:15noonienthis is the first example that seems to fail: https://gist.github.com/noonien/5c37a8ca49f05e4568d1fc6c14cf75e5
10:58:54Araqarnetheduck: putting '?' after function calls mindlessly is not "tight code"
10:58:56FromGitter<jrfondren> ok, that's just name resolution
10:59:42dom96Should be a simple merge, anyone? https://github.com/nim-lang/Nim/pull/11181
10:59:57FromGitter<jrfondren> it'd be better for Nim to complain about the ambiguity, I guess it can't do that over module boundaries
11:00:24*Vladar joined #nim
11:00:33FromGitter<alehander42> Araq, but how is `?` different than putting mindlessly stuff in `{.raises.}` annotations etc
11:00:35noonienthat makes sense, but, why would it be ambigous?
11:00:53FromGitter<alehander42> `?` is not noise, it's very useful as it tells me exactly if a call can raise or not in a context
11:01:15Araqwhat if all calls can raise? that's the reality in my compiler...
11:01:34Araqhow is it not noise then?
11:01:38FromGitter<alehander42> well it shouldn't be like this
11:01:56FromGitter<jrfondren> noonien: because Foo is a type constructor
11:01:58FromGitter<alehander42> i imagine a compiler should have a lot of "pure" functions which just process/transform stuff
11:02:10FromGitter<jrfondren> this works for example: `echo Foo([0.byte, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])`
11:02:27FromGitter<alehander42> but yeah, i guess one can say that an error state is often the result
11:02:33AraqI can imagine a lot too. I don't use Haskell for a reason though.
11:03:11dom96alehander42: the compiler can already tell you if a call raises or not
11:03:15FromGitter<jrfondren> you have two Foo()s and which wins is gettling settled by the order of your imports.
11:03:16dom96That's why we have the effect system
11:03:39noonienjrfondren, indeed, however, i don't pass an array to it, but an int, i've not experienced nim having these types of ambiguities before, it seems to have dealt with simple resolution based on argument types just fine
11:04:04FromGitter<alehander42> @dom96 yes, but i currently need to see this in the function def, not on the callsite
11:04:06FromGitter<jrfondren> aye. clearly, it's doing that well over module boundaries.
11:04:21FromGitter<alehander42> it doen't matter so much for me, was just saying that `?` in an alt error system also seemed ok to me
11:04:24dom96alehander42: You can see that too, in the doc gen for example
11:04:39FromGitter<alehander42> i am talking about callsite vs definitionsite
11:04:56FromGitter<alehander42> but yeah, one can also argue that good ide plugin should show this immediately inline
11:04:57FromGitter<jrfondren> maybe there's some specially troublesome about type constructors. After all there are tons of identically-named operators from different modules.
11:05:14dom96The way the effect system works is wonderful IMO
11:05:50dom96It's the best of both worlds. Want to write code quickly without caring about exceptions? Great, just don't use the raises pragma. Have some code which is critical and needs to not crash? Use the raises pragma
11:06:55FromGitter<jrfondren> yeah your exact same code with two procs (and one returning int vs. float, since Foo can't be returned) works fine.
11:07:07*xet7 quit (Ping timeout: 248 seconds)
11:07:25FromGitter<jrfondren> so: Nim is confused by type constructor/proc ambiguities over module boundaries.
11:07:34FromGitter<alehander42> btw @dom96 i wanted to ask you if you think async/await can simulate something like a nonblocking goroutine system: what i imagined was that if one has "nonblocking" effects and a pragma that lets you rewrite a function in a way that it does its io stuff in a new (light?) thread so it's not blocking as well, one can easily put that in the async event loop and use it in a similar way
11:07:54Araqyou are exception deniers. You don't put ? after every call in Rust that can die with OOM or with an overflow error.
11:08:01*Snircle joined #nim
11:08:06FromGitter<alehander42> the problem i see is that async/await didn't really work well with flowvars iirc
11:08:30FromGitter<alehander42> Araq, you can't just use overflow errors as an example against every possible error handling strategy :D
11:08:51FromGitter<alehander42> i can say "system A deals well with 95% of the classes of errors i care for" and still like it
11:09:07dom96alehander42: not sure exactly what you have in mind. If you want goroutines then you need to make sure that all blocking IO operations yield implicitly
11:09:14dom96With async await it's explicit
11:09:38dom96As far as FlowVars are concerned, we just need to spend some time integrating them with async
11:09:44FromGitter<arnetheduck> the fact that you're explicit helps you reason about the code such that there's less silly error handling and more useful error handling, on average.. you're encouraged to structure your code in such a way that there are fewer `?` overall.. then the compiler and language can help you reason about which situations can and cannot happen - the code is tight because by thinking about it you make explicit choices to add
11:09:44FromGitter... or remove the error handling and encode those choices (through type) so the compiler can be useful and help you maintain what you wrote in the face of change
11:10:11FromGitter<jrfondren> sounds like very questionable code tbh
11:10:43FromGitter<alehander42> @dom96 yes, but what i imagined was that `myasync` functions will rewrite IO calls to explicit awaitable alternatives which happen in another (light)thread, at least the last part is what i think go is doing(running them in diff threads)
11:11:35dom96alehander42: The Go light thread is pretty much an async proc
11:11:38*sz0 joined #nim
11:12:25dom96Chapter 6 of my book has a pretty good explanation IIRC
11:13:02Araqalehander42: The overflow error is an example for what happens when the errors a system can face are prevalent
11:13:45FromGitter<alehander42> @dom96 well afaik when go routines block, the go scheduler runs other goroutines in different threads from its pool
11:14:17FromGitter<alehander42> but there was another case, but i am not sure how it worked indeed, have to read more about it
11:14:42dom96yes, that's the additional bit that Go does automatically
11:15:02FromGitter<jrfondren> so, like Erlang, it's a model that requires elaborate runtime support.
11:16:03FromGitter<alehander42> so i imagined that i can do this as well: i can have wrappers around syscalls that invoke them in free threads and then yield immediately to the event loop and later finish the future after the thread
11:16:31FromGitter<alehander42> around io-annotated calls: see, i can use effects even here :P
11:16:53FromGitter<alehander42> io-/syscall annotated primitives? anyway
11:17:16FromGitter<jrfondren> I bet that Ada's model would be more suitable for Nim. I just don't know enough about it to support that :/
11:18:21FromGitter<arnetheduck> effects are completely useless for this btw as long as there are no boundaries enforcing limits on them. the high incidence of memory and resource leaks in the Nim std lib are a symptom and a direct outcome of the language allowing people to write code like that and not helping them discover where issues might arise
11:19:53FromGitter<alehander42> yeah i agree that this is also relevant: if one can freely decide to not use the effect system in the stdlib, effects become less useful to all Nim code that depends on it
11:20:42FromGitter<alehander42> @jrfondren yeah i am just playing with the idea: i am more interested in actor model, but even less sure how would it work effectively in Nim :P
11:21:18FromGitter<jrfondren> https://en.wikibooks.org/wiki/Ada_Style_Guide/Concurrency , ctrl-f rendezvouz. Whatever that word means is the key.
11:21:50*xet7 joined #nim
11:21:57Araqarnetheduck: there is no evidence for that. Likewise you could argue that 'discard f()' encourages to ignore errors since it's so easy to write and so we should write it as 'discard(([[f()]]))'
11:22:17dom96resource leaks are a symptom of not having stable destructors
11:22:20FromGitter<arnetheduck> like.. consider what the pain points of nim development are, over time - maintenance is high on the list, fixing and refixing and refixing stuff (lots of "make test suite green again" commits, many resource leaks etc)..
11:22:21FromGitter<alehander42> i wanted to ensure that a web framework can ease having low latency for its app: so i figured having each request in its own routine/actor should be easier as then their loop isn't filled with all the other async calls, but maybe i am completely wrong
11:22:32dom96(and not having a culture like Python where we write `with f as File...`)
11:23:25FromGitter<arnetheduck> no, discard f is excellent - it spells out that you've made an explicit choice to not consider the return value of a function and call it only for its side effects - that's all that's needed
11:23:30dom96arnetheduck: Also, I'm curious which memory leaks you are referring to
11:23:42Araq"make tests green" has nothing to do with resource leaks
11:24:15FromGitter<arnetheduck> dome96, grep for `close` in std lib and you'll find 10 file handle leaks, just like that, on silly stuff like parse error
11:24:43Araqthe leaks are bad and they are caused by 'do; undo'-like logic. Which is wrong in Go and Rust too with their abilities to 'panic'
11:25:18Araqit must be written like 'do; defer: undo' in every mainstream language out there.
11:25:42Araqyou can hide the 'defer' in a destructor of course, or you can write it as a 'finally'
11:25:49Araqor maybe as an 'atexit'
11:26:33dom96arnetheduck: I'm not asking about file handle leaks, I'm asking about memory leaks
11:26:54noonienwhat would be a solution to the import order problem?
11:27:03dom96I am aware that file handle leaks are very prominent, I've caused probably the majority of them :P
11:27:14FromGitter<jrfondren> noonien: don't overload type constructors with procs
11:27:15dom96noonien, what's the code?
11:27:15Araqyou cannot blame exceptions when 'do; undo' is also wrong code in the languages that "lack exceptions"
11:27:18FromGitter<arnetheduck> well, they *are there* and there's no language tool (for now) to help you find them or even know that they happen when you're writing the code. computed effects are way too far away when writing code for them to be useful, you don't *see* them.
11:27:41dom96arntheduck: so what do you suggest to fix them?
11:28:15nooniendom96: https://gist.github.com/noonien/5c37a8ca49f05e4568d1fc6c14cf75e5
11:28:32Araqthe problem is real but the analysis for their cause is simply *wrong*.
11:29:07FromGitter<jrfondren> noonien: for example, your exact code with the proc lower-cased works as expected
11:29:49noonieni understand, but i'm trying to understand if this is a bug, or expected behavior
11:29:52FromGitter<arnetheduck> well, when you know that parsing can fail by having the "error" - or really more accurately, the alternate control flow - explicit, you will also see that you need to do something about it. if the starting point of the code is "incorrect but convenient" and then you try to plug the leaks, it's fairly obvious what the outcome will be
11:29:56FromGitter<jrfondren> oh I think it's clearly a bug
11:30:22dom96noonien, yeah, what jrfondren said. What error do you get?
11:30:31dom96It's not clearly a bug
11:30:37dom96Depends what error message you get :)
11:31:01Araqon other words, the following mechanisms need to be banned aside from 'raise': 'die', 'quit', 'exit', 'panic', 'terminate' including using these mechanism for Out-of-memory and integer overflows
11:31:13noonien`a.nim(5, 9) Error: type mismatch: got <int literal(3)> but expected 'Foo = array[0..15, byte]'`
11:31:44noonienit's trying to convert, instead of calling the proc, depending on which order the modules are imported
11:31:53FromGitter<jrfondren> no, it's trying to call the type constructor instead of the proc
11:32:01FromGitter<arnetheduck> you can argue that writing incorrect and convenient code is a good tradeoff for many problems though - if you're writing a script, you don't need atexit or anything, just let the OS clean up after you.. that code however will never be useful in a larger context - it's a great tradeoff for scripts and similar situations
11:32:05noonienthe same identifier is both a type and a proc
11:32:10Araqthere is not a single system out that does that, so 'defer undo()' remains to be required and your analysis is at best woefully incomplete
11:32:16FromGitter<jrfondren> `echo Foo([0.byte, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])` is an example successful call with that code
11:32:39dom96noonien, the error message could be improved, but it's not that bad.
11:32:44nooniendepending on what order the modules are imported, the compiler decides that a call to that identifier is a type conversion of a proc call
11:32:59noonienjrfondren: i understand what the problem is, no need to repeat
11:33:00dom96oh, but if you change the order then it works
11:33:07FromGitter<jrfondren> the error message could be improved, but also this exact kind of type resolution works just fine when it's two procs instead of a proc and a type constructor
11:33:11dom96yeah, I'd say that's a bug
11:33:34noonienas i said, i'm trying to figure what the actual nim bug is, not the bug in my code
11:33:44FromGitter<arnetheduck> Araq, so what's better? we've already agreed that panic is likely not too bad as part of the mix :) that leaves the gray zone in between to deal with - that stuff that is not a big deal right now, but will in a month once you realize you've actually made something useful
11:34:02noonienone would think it's safe to assume that order of imports did not matter
11:34:23dom96noonien, indeed. That's a bug. Report it
11:34:50*abm quit (Quit: Leaving)
11:34:57noonienand since nim doesn't really have namespaces, this case should not error imho
11:35:08nooniendom96: will do
11:35:58dom96noonien, it should error, unless you disambiguate it
11:36:09dom96i.e. c.Foo vs. b.Foo
11:36:19noonientrue, but the error i gave should not be ambigous IMHO
11:36:26noonienthe code*
11:36:39FromGitter<jrfondren> in this exact case I'd still not expect an error since there's no error with two procs with these signatures.
11:36:53noonienexactly
11:38:28Araq> that code however will never be useful in a larger context
11:38:50Araqyou'd be surprised how many systems are little more than Bash scripts that are piped together
11:39:17FromGitter<alehander42> but why would you optimize your language for such kind of system
11:39:22Araqand in some way that's a poor man's Erlang with "fail early"
11:40:11FromGitter<alehander42> but the entire point of erlang's fail early is that it works because it happens in a runtime that autorestarts subsystems
11:40:19FromGitter<alehander42> it has nothing to do with a "global" fail early
11:40:39dom96noonien, jrfondren: Foo(3) is ambiguous. It's either a type conversion or a call to the `Foo` proc.
11:40:40FromGitter<alehander42> which was one of the good comments i read to that article imho
11:41:00FromGitter<arnetheduck> the academic field here is behavioral economics - creating nudges that cause (globally) desirable outcomes without being indivudally constraining
11:42:14nooniendom96: I agree, this can be solved by either resolving the type conversion as any other proc, or provide an error that doesn't depend on order of imports
11:42:31FromGitter<jrfondren> dom96, you have two interpretations and one of them would error out at compile-time with a type error, and the other's OK. When it's 13 different procs, like `contains` or `$` or `add`, Nim has no trouble picking the non-error case. When one of the options is a type constructor, you get this failure. Maybe it also matters that there are module boundaries.
11:42:34dom96noonien, yes, IMO it should be an error for both order of imports.
11:42:59FromGitter<alehander42> but i agree that in a language like nim, functions usually seem like a subsystem unit, so `raise`/`early error return` seems both like the analyzable fail-early equivalent: as they still let a function up the stack to decide what to do: run again, run something different etc
11:43:31dom96jrfondren: Yes, but the fact is that this goes against convention. Making it work could end up being more confusing. It's better to give an error and make it clear that there is a conflict, and hopefully encourage the person to not name their procedures with a capital first letter
11:43:41FromGitter<arnetheduck> while I'm focusing on solving the logic of my problem, I want the language to safely guide me and make good choices for me so that the code doesn't end up a leaking barrel and maintenance nightmare.. later, when I'm revisiting, I want the creative freedom to break with those safe and default choices when the situation demands it.. is that too much to ask? :)
11:43:54Araqyou cannot "nudge" me into handling the error "when it happens" simply because there is nothing to do but to propagate it upwards
11:44:03FromGitter<jrfondren> the convention's why the error's gone unnoticed :)
11:44:45dom96jrfondren: Yes. A lot of errors go unnoticed because people write code in very similar ways. That's just how things are.
11:44:47FromGitter<jrfondren> well, I can't argue either way on making it a deliberate error. In that case it's just an error message problem.
11:45:13FromGitter<arnetheduck> of course you can - you can turn your `string` into a `Regex`, and then from that point onwards parse errors are *guaranteed* not to happen
11:45:18dom96Which why new perspectives are so important for Nim, and also why newbies usually find bugs quickly :)
11:45:50dom96arnetheduck: Don't we do that already?
11:46:20noonieni've submitted an issue: https://github.com/nim-lang/Nim/issues/11187
11:46:29dom96By the way guys, if you are seeing memory leaks in your async/await programs, you may find this useful: https://github.com/nim-lang/Nim/pull/11181
11:47:14FromGitter<arnetheduck> dom96, well yes, except that you skip handling the parse error in between in the std lib, because while the "effect" system detects it, it doesn't let you, the programmer, know about it explicitly, and thus the trivial file handle leak happens
11:47:23dom96I've recently been bitten by async procs being stuck waiting forever, which led to them not being garbage collected. Seeing which futures are pending is a good way to find this.
11:48:43FromGitter<arnetheduck> the default in the language is to let you ignore this possibility, and lo and behold, in the real world you.. surprise surprise, ignore the possibility and leak.
11:48:47dom96arnetheduck: Oh, I think I agree with what Araq said here. You're getting the cause wrong. It's not the exception systems fault. It's that we don't have a clear and reliable way to state that a file handle should be closed.
11:49:06dom96I don't use `defer` because it is (was?) buggy in async procs
11:49:27dom96and because destructors are on the horizon. We just need to choose a convention and stick to it
11:49:53FromGitter<arnetheduck> defer would not help here - you would not remember to put defer there, because it's *easier* not to put it there
11:50:02*xet7 quit (Ping timeout: 245 seconds)
11:50:31FromGitter<arnetheduck> you can search for all the places in the std lib where defer is missing, for example, to patch the leaks
11:51:01clyybberarnetheduck: Then destructors are the solution, right?
11:51:48Araqarnetheduck: I don't like exceptions but if one is serious about gracefully handling e.g. out-of-memory than C++'s solution is unmatched so far by a wide margin. Yes, you need to write "exception safe" code. Yes, nobody can do it. But you know what? nobody gets 'if outOfMem: goto errorHandler' right either and at least with exceptions I don't bloat my logic by a factor of 2
11:51:49FromGitter<arnetheduck> destructors help deal with some of it, yes. but they're incompatible with GC's, effectively..
11:52:13*Vladar quit (Remote host closed the connection)
11:52:17dom96destructors are incompatible with GCs? How so?
11:52:42*Vladar joined #nim
11:52:58clyybberthey arent, but they are not deterministic, as such reliable, is what arnetheduck is probably trying to say
11:52:59FromGitter<arnetheduck> so when destructors come around, the std lib will either need to be retrofitted (a huge effort) or it will remain like uint support - out of tune with the language
11:54:00FromGitter<arnetheduck> well, destructors are about eager and deterministic resource management, while gc is about lazy and optimistic resource management.. can't have both at the same time.
11:54:06*vlad1777d_ joined #nim
11:54:31FromGitter<jrfondren> is there a way for an iterator to have some finalization code happen if the body of the iterator is left by exception?
11:54:58clyybberput everything in a try except?
11:55:13FromGitter<jrfondren> without the user having to do that
11:55:18dom96jrfondren: defer
11:55:24noonienarnetheduck: i diasagree, that's what arena allocators are for
11:55:27dom96(if it now works, which I'm unsure about)
11:55:39clyybberarnetheduck: It may be a huge effort, but if it fixes that problem, its what we gotta do
11:56:09dom96lazy and optimistic resource management is good enough (TM)
11:56:36dom96Maybe Araq's plan is to not enable destructors for GC'd objects, if so that would make me really disappointed
11:56:37noonienit's not exactly the same thing, obviously, but you can emulate almost any GC behavior with destructors imho
11:57:24FromGitter<jrfondren> ok yeah a defer in the iterator does it. interesting.
11:57:47dom96but yeah, GC allocs actually have a finalizer proc that you can set
11:58:11dom96And yeah, I understand, you may end up with a situation where things never get deallocated and thus the file handles don't get freed
11:58:36FromGitter<jrfondren> https://gist.github.com/jrfondren/aa3163e33ebe8a3d3fc4be01b8adcaf8
11:58:49clyybberdom96 You could argue thats the nature of GC's lazy behaviour, and thus expected.
11:59:06dom96Perhaps there is a pretty concrete example of this that's a huge showstopper. I do recall talk about abusing GC's finalizers for file handle closures, but that this was the problem.
11:59:53dom96jrfondren: huh, that's interesting that it catches it when it's inside the for loop
12:01:41noonienfor what it's worth, i like go's approach, not of panic handling, but not treating everything as an exception
12:01:59*xet7 joined #nim
12:02:43FromGitter<arnetheduck> clyybber well, the thing with a large std lib is that you need a large maintenance effort to deal with changes so that it remains relevant and up-to-date with the language.. let's see how long it takes before the `FTP` (!) client in there is updated to be destructor-friendly :)
12:06:02FromGitter<arnetheduck> @nooien arena allocators let you deal with memory in bulk - that seems orthogonal to eager vs lazy resource management..?
12:06:24clyybberarnetheduck: theres an ftp client in the stdlib?
12:06:38*deech joined #nim
12:06:44FromGitter<jrfondren> https://nim-lang.github.io/Nim/asyncftpclient.html
12:06:48clyybberarnetheduck: I might have underestimated the scope a bit, but it still has to be done I guess
12:07:22FromGitter<jrfondren> never trust a stdlib without an FTP client.
12:07:55*xet7 quit (Quit: Leaving)
12:10:08FromGitter<alehander42> now imagine 3rd party libs :D
12:10:39FromGitter<arnetheduck> clyybber, well, it has improved a lot :) there used to be two web servers in there, there's only one now :)
12:10:50noonienthe nim stdlib doesn't have proper uint support, but it does have FTP support?
12:12:25FromGitter<arnetheduck> gotta keep your priorities straight :) arguably, uint - not so useful on their own, whereas FTP!
12:12:43dom96What's not proper about Nim's uint support?
12:13:09FromGitter<alehander42> @arnetheduck i don't wanna burst the small-stdlib party on, but go also has http in stdlib and people love that
12:13:28FromGitter<alehander42> it's a complicated tradeoff
12:13:29noonienhehe, sorry, i was just joking, i'm pretty new to nim to comment on its stdlib
12:14:19FromGitter<jrfondren> I imagine what's meant here is that there're a lot more functions that work on int than that work on uint -- or int64, for example. So the solution is just writing uint versions of those procs and putting it in a module, similar to lenientops
12:14:43dom96indeed
12:14:44FromGitter<arnetheduck> @alehander42 3rd party libs have a much more natural maintenance cycle - the stuff that's still relevant gets updated, the rest remains available as published for legacy
12:15:10dom96FWIW a lot of the stuff in the stdlib is in there because Nimble become usable relatively late
12:15:29dom96If I did it again I wouldn't have put async in the stdlib
12:15:39FromGitter<arnetheduck> go also has google and its army of engineers maintaining it - of course it makes sense for them
12:15:49nooniendom96: why not?
12:16:06dom96Because it would be easier to evolve it outside the stdlib
12:16:10FromGitter<alehander42> @arnetheduck but that's the point: it's not a fundamental property of lang design, it depends on circumstances
12:16:19dom96and would allow others to write their own (possibly better) implementations
12:16:38noonienasync is a prettyimportant part of the language, i find it a horrific mistake that rust declares itself to be "fearlessly concurrent" while it doesn't provide anything in the stdlib to have actual concurrency, or hadn't for a long time
12:16:40FromGitter<alehander42> @dom96 on the other hand having multiple async/await with differennt quirks would suck more imo
12:16:45dom96On the other hand, it's bad to --- ^
12:16:49livcdhmm I am not getting code competion in Emacs
12:17:09dom96what alehander42 said :)
12:17:24dom96noonien, that's a good point
12:17:26FromGitter<alehander42> something like an " interface" which would force different impl-s to conform to the most important bits would be best
12:17:40dom96Sadly Nim is also very `interface`-averse :)
12:17:56FromGitter<arnetheduck> @alehander42 sure - though where possible, I prefer to stimulate an environment that does not rely on a central authority to maintain its viability
12:18:19FromGitter<alehander42> well i hope so .. i'd expect ethereum to be central-authority-free :P
12:19:36noonienconsidering mostly everyone wants to write code that can be easily made concurrent, the language not providing concurrency on its own ends up in N concurrrency libraries, each with its own tradeoffs, leaving the user with a choice of basically what libraries can be used depending on what they depend on
12:20:02noonienhowever, having red/blue functions is also bad imho
12:20:05FromGitter<alehander42> on the other hand, it's a little bit of both: if you don't have many users, the ecosystem would probably not be good enough to make up for a stdlib ⏎ but if you have such a big community, naturally you'd have one or several "hubs" which will be able to maintain some central things and in this case having unified management/api design/etc for a bigger stdlib might not be too bad
12:20:53dom96noonien, yeah, both have their advantages and disadvantages. Of course Status has diverged with their own async implementation which worries me :/
12:21:12FromGitter<alehander42> about async: i think it's ok to have it inside, one can still write e.g. routine/actor/whatever dsl-s as 3rd party libs
12:21:25noonienan interesting read regarding the issue: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
12:21:35dom96yeah, that's a classic article :)
12:21:44*seni joined #nim
12:21:55FromGitter<arnetheduck> the nim language can still "recommend" a particular approach or library so as to prevent needless fragmentation - it's a matter of what your first principle is.. you can start with a distributed solution and add helpers or start with a centralized solution and try to spread it.. the latter is arguably less resilient
12:22:16noonienwhat's the difference in a recommendation and including it in the stdlib??
12:22:22noonienbetween*
12:22:40nooniensorry about the double '?', keyboard acting out
12:23:10FromGitter<alehander42> btw dom96: can one tweak the event loop, e.g. have hooks tweaking registering futures/the order of invoking stuff etc
12:23:27FromGitter<alehander42> or there is not an api for that (probably doesn't make sense for most cases)
12:23:35FromGitter<alehander42> async event loop*
12:23:43dom96alehander42: you can register callbacks on the event loop
12:23:50dom96There is different layers
12:24:07dom96You've got the selectors module which is used for Linux/BSD
12:24:22dom96You can use that manually (I use it in httpbeast)
12:24:36dom96and you can integrate it with asyncdispatch which i've done for httpbeast too :)
12:24:46FromGitter<arnetheduck> noonien - maintenance burden and gate keepers to start with. there's an expectation that the std lib will.. you know.. work.. and stay stable. as it grows, that becomes harder and harder to pull off, also because you expect that all moving parts are updated together.. ie implementing destructors in the language and having a std lib that doesn't use them plays poorly with expectations.. but when do you cut the
12:24:46FromGitter... release?
12:25:05dom96and then asyncdispatch is built on top of selectors, with IOCP in there as well for Windows support
12:25:14*traviss quit (Quit: Leaving)
12:25:19dom96Not much there to really hook into
12:25:23dom96It's just functions that return futures
12:25:35dom96and a poll function that either calls selectors' poll or IOCP's
12:26:06clyybber
12:26:33noonienarnetheduck: if the language authors recommend a library, and then change their recommendetion, how is that not the same thing as changing something in the stdlib? in both cases the library becomes "the official library to use", and everyone uses it. both cases end up in severe fragmentation
12:27:13clyybberdom96: Did you implement asyncIO ?
12:27:27*traviss joined #nim
12:28:38dom96clyybber, yep
12:29:20FromGitter<arnetheduck> noonien you can manage, release and upgrade libraries independently of the language, allowing them to keep a pace appropriate to their development phase. the recommendation is there as a curation mechanism, but it doesn't come with the same set of constraints on other aspects (distribution, gate keepers, releases etc)
12:29:41clyybbercool, I'm thinking about adding support for the new io_uring api in linux 5.1
12:29:58dom96clyybber, oooh, first time I'm hearing of this
12:30:39Araqin the end Python with batteries included is a better Python and so is Nim. It helps when the batteries don't explode though.
12:30:55dom96clyybber, would be awesome if you could implement that
12:31:12*xet7 joined #nim
12:31:16clyybberdom96: I'd be glad to :)
12:31:24FromGitter<arnetheduck> dom96, you can't have it both ways - we can't not fork async in std lib *and* develop it at a different pace than nim.. it's not practical for us to keep up with devel but it's also not practical to have to wait 1-2 years for a bugfix to be released.
12:31:27dom96We've still got a lot of things to do for async
12:31:59dom96arnetheduck: why can't you keep up with devel?
12:32:37dom96and in fact, it's not about that
12:32:50dom96You need to contribute your changes upstream
12:32:55dom96the longer you wait the more difficult it'll get
12:33:19FromGitter<arnetheduck> because it's too buggy most of the time, and waiting for nim developers / you to approve every patch creates an inefficient development cycle for both of us - your time and our time is wasted waiting for each other
12:33:19clyybberyeah I agree
12:33:52*traviss quit (Quit: Leaving)
12:33:57dom96okay, that's fair. If you're still developing it, and making sure it's stable then I can understand you not wanting to make a PR for each little thing
12:34:00FromGitter<arnetheduck> we don't *need* to contribute anything - the changes are there for you to pull into the std lib at any time you like - we've had this conversation already
12:35:07*traviss joined #nim
12:36:58dom96Of course you don't. In the end you're hurting the community by never contributing though
12:37:09FromGitter<alehander42> @dom96 i'll read more about it: i wanted to create a web framework based on e.g. actor model as it sounded as a fun side project to do, but i am trying to see if it makes sense
12:37:11FromGitter<kaushalmodi> Hello all, I am attempting to convert some toy code dealing with pointers in C to Nim, but I am getting it wrong. Can someone review this: http://ix.io/1Idm
12:37:20*traviss quit (Client Quit)
12:37:32dom96alehander42: go for it. More web frameworks never hurt :D
12:37:57dom96sounds like you want to make an http server rather than a web framework though :)
12:38:00FromGitter<kaushalmodi> that code compiles, but I am getting something wrong, so I get SIGUSR with running the compiled .so of that with the host application
12:38:04FromGitter<alehander42> @arnetheduck but do you think it's possible to make chronos / stdlib async compatible one day, so people can just choose which impl to use or the difference is bigger
12:38:38FromGitter<alehander42> @dom96 i wanted to focus on the framework part, but i am also interested in learning more about concurrency models
12:39:33*traviss joined #nim
12:39:36dom96Oh nice, I didn't notice the rebrand to chronos.
12:39:47FromGitter<alehander42> initially i also thought that it might be easy to just reuse a c/rust server for benchmarks(as i specifically didn't want to write my own httpbeast :P) but now it's all up in the air still
12:39:58dom96Just use httpbeast :D
12:40:42dom96based on my cursory look chronos doesn't actually seem to be /that/ different from asyncdispatch, mainly just some bug fixes + API changes (the latter sucks IMO and isn't necessary but I didn't look closely)
12:41:04*traviss quit (Client Quit)
12:41:45FromGitter<alehander42> well i obviously like having an alternative for everything :P but if i decide to go with custom actor model impl indeed, this might also make reusing httpbeast harder
12:42:06Araqdom96, destructors would work with a GC, somewhat, but I am opposed to GCs nowadays and #nim would complain anyway, making my job easier
12:42:46livcdkaushalmodi: what can I do to make code completion work in emacs for nim ?
12:42:46dom96Araq, what would #nim complain about?
12:43:20clyybberdom96: Are you gonna try to merge those fixes into the stdlib?
12:43:45dom96clyybber, I don't think I'll have time to do that
12:43:47Araqthe usual things, it's not perfect, the GC might call the finalizer/destructor "too late" and think about the children
12:44:44dom96Araq, so you won't allow destructors for GCd objects?
12:45:36Araqthey are mapped to a finalizer
12:45:42FromGitter<kaushalmodi> livcd: I use just hippie-expand
12:46:07dom96Araq, sounds good
12:46:08dom96bbl
12:46:08livcdkaushalmodi: oh ok
12:47:31clyybberAraq: Nice, thats exactly what I hoped you'd do
12:50:09*solitudesf joined #nim
12:51:11FromGitter<arnetheduck> @dom96 I don't get what you're trying to say - you're claiming that async should not have gone into the std lib and that it would be more efficient to maintain it outside. we're maintaining a version of async outside, giving it a lot more love and attention than it has received in the past, and going through great pains to ensure that it's still available to the community, by licensing it freely and ensuring it
12:51:11FromGitter... works as well as it possibly can with nimble (though that's hard to pull off given the state of nimble).. what more would you like, exactly, that doesn't contract what you said you would have done yourself?
12:53:43*NimBot joined #nim
12:55:22FromGitter<arnetheduck> @alehander42 well, we renamed it so that we would have creative freedom in developing it without constraints.. std lib async will need to be maintained by std lib maintainers, because the conditions for us to upstream it are not there (too inefficient, different goals)
12:56:14clyybberzacharycarter: Hey, long time no irc
12:57:48FromGitter<zacharycarter> Hi clyybber :) Yeah! I had a lot going on, but I'm finally in Finland and at my new job now
12:58:13*hoijui joined #nim
12:58:32FromGitter<zacharycarter> how are you?
13:00:43PMunchI might've asked this before, but where in Finland are you?
13:01:25FromGitter<arnetheduck> @alehander42 I think the win-win situation here is that async is removed from the std lib and put in a nimble library instead - then people can choose to use that or `chronos` as they like (knowing that we're actively maintaining chronos for the next x years), allowing `nim` itself to maintain a higher quality of the batteries that remain in the std lib because there's now less to maintain
13:01:31clyybberzacharycarter: I'm great, how bout you? Have you been to finlands beautiful national parks yet?
13:01:52clyybberPMunch: Helsinki
13:01:58clyybbernot me but zach
13:03:00PMunchAh, of course
13:03:04FromGitter<jrfondren> there's a Helsinki-mobilization project but it's not scheduled to start until after the war.
13:03:05FromGitter<arnetheduck> when you look at societies building roads, you can clearly tell which ones forgot to include a maintenance budget - a programming language community is the same
13:03:48FromGitter<zacharycarter> I'm currently in Lauttasaari - which is part of Helsinki, but it's an island just off to the west of the main part of the city
13:04:15FromGitter<zacharycarter> clyybber: good to hear :) I've been to one right near my apartment. I'm hoping to have more time this weekend to explore
13:05:15Araqarnetheduck: it doesn't happen often I guess, but I completely agree
13:06:16FromGitter<arnetheduck> lol, it happens more than you think, I think.. we just don't bitch about it them :)
13:06:43AraqI don't understand the hate for FTP though, I use FTP to upload the Nim website, for example
13:07:02Araqam I old fashioned? did some other protocol take over and I didn't notice?
13:07:02FromGitter<jrfondren> rsync is way better
13:07:40FromGitter<jrfondren> and rsync over ssh is also not in the clear
13:09:06FromGitter<jrfondren> people still use it, but they mostly don't have to. there's just a lot of guides that tell people how to use FileZilla
13:12:33FromGitter<arnetheduck> yeah you're old fashioned. you're supposed to kubernetes with 30 dockers and travis and web services in the cloud nowadays
13:14:46*seni quit (Ping timeout: 252 seconds)
13:15:09FromGitter<jrfondren> nah the snake oil for moving files around is ceph.
13:16:29*seni joined #nim
13:17:41noonien@Araq ssh or http are used usually
13:17:54noonienor other more complicated deployment mechanisms
13:18:25noonienbut the transport is usually http(either upload, or download) or ssh
13:20:19FromGitter<arnetheduck> point is, it's 2019 and you look at the std lib - it has ftp, md5 and an SQL parser, but for example practically nothing on the parallelism and multi-cpu front.. FTP is one of those unsecured relics of the past - yes, there's SFTP but the connection topology of FTP with its separate data and control streams makes it difficult to configure in modern networks so people have moved on to other protocols. thus, if I look
13:20:19FromGitter... at the computer science landscape today and tomorrow, I'd rather that time and effort was spent on fixing `Channel` than fixing the FTP client
13:20:21*xet7 quit (Quit: Leaving)
13:21:01FromGitter<arnetheduck> at least, that would be more useful to me, and I believe, to the larger community of nim developers
13:25:05*theelous3 joined #nim
13:28:03FromGitter<arnetheduck> the mere presence of and FTP client in there slows down other development - there's no way around that. when you have a community the size of python, you can maybe keep up with the world and include all that stuff - but even python is moving towards a more distributed model with `pip` and `venv` - the core language devs can make a much bigger splash by nourishing an environment for others to build stuff in that
13:28:03FromGitter... trying to maintain everything on their own
13:32:16clyybberit's always the question of wether to encourage users to build a diverse robust ecosystem (representing the computer science landscape today), or a conservative stdlib
13:33:34FromGitter<arnetheduck> well, let the community do the experimenting outside, and port the stable stuff back to std lib - best of both worlds :)
13:33:55Araqmaybe there is also a middle ground. I don't need eg. htmlparser in the stdlib but I also don't want to maintain 20 different github repos, all with travis and appveyor integration, decent versioning and testing against stable Nim and Nim devel
13:34:05FromGitter<mratsim> Wow so much activity in the past hour
13:34:46FromGitter<mratsim> I think the last part Araq means, let's bring batteries to nimble/nawabs
13:34:52FromGitter<arnetheduck> that's actually one of the things I really like about nim - it's quite possible to build it with almost no std lib and adapt it to specific use case
13:35:28FromGitter<arnetheduck> that it has enough power to develop those experiments without having to fall back on changing the compiler is a big plus
13:35:46clyybbermratsim: Someday I'd like to hack with nawabs, maybe make it leverage git submodules for an even more simple but robust system.
13:36:21FromGitter<mratsim> Regarding std vs no std, Rust seem to have an excellent story w.r.t. to the serialization library, there used to be one in stdlib then Serde came along with a superior API, there was article on how to migrate and then the default ones (there was 2 different before serde) were deprecated
13:36:23clyybberarnetheduck: Yeah, even gameboy dev is possible with nim
13:37:07Araqwe need a 'nimble/whatever init' that also sets up travis/appveyor and a git tag scheme
13:38:07FromGitter<mratsim> Concepts have the potential to bring a common interface/API for multiple libraries implementing the same thing, with whatever is agreed on being part of the stdlib concept and whatever is still uncertain being library only.
13:38:16*slugm quit (Remote host closed the connection)
13:38:41FromGitter<mratsim> @Araq, well feel free to fork: https://github.com/status-im/nimbus-launch
13:39:32Araqcool, I missed that one
13:39:37FromGitter<arnetheduck> we'd also like to have more than one library per git repo so we can monorepo the stuff we frequently develop together.. that sort of breaks the whole git tag thing
13:40:21*abm joined #nim
13:41:09Araqhow so? the version only gets a little less informative
13:41:26Araqmuch like os.nim's version is Nim's version, but not a big deal, ymmv
13:41:28FromGitter<arnetheduck> there seems to be a distinct lack of people that *like* nim concepts as they're done now, at least judging from how much usage they get (more "I'd like to use concepts" than "I'm using concepts successfully").. I wonder if it's the quirky syntax, bugs or just unfamiliarity with their existance?
13:41:54Araqarnetheduck: I'll write an RFC about how 'concept' needs to be designed
13:42:34FromGitter<arnetheduck> well, it's another of those game-changers that would require the std lib to be adapted to be truly useful
13:42:38FromGitter<mratsim> I think 1. they are unfinished, VTable, 2. I'm always uneasy about the lack of constraints (and 3, compilation time :?)
13:42:52clyybberarnetheduck: IMO its because concepts are not used in the stdlib, and that they are buggy
13:43:06noonieni have managed to reproduce my second issue as well: https://github.com/nim-lang/Nim/issues/11188
13:43:10clyybberbut they are so powerful I use them anyways :P
13:43:26FromGitter<liquid600pgm> @arnetheduck myself, I don't use concepts that often just because of their bugginess
13:43:49FromGitter<liquid600pgm> I think they're useful, but their implementation needs to be worked on
13:44:02noonienit seems like symbol resolution for generic procs happens when the generic is initialized, not when it's defined
13:44:09FromGitter<mratsim> I'm using them in Arraymancer for neural net declaration and we're using them at Status for serialization
13:44:17clyybberAraq: Isn't concept already designed? Or do you mean the design of the implementation? Because I think only the implementation needs work
13:44:39AraqI don't agree with the current design anymore.
13:44:50FromGitter<mratsim> imho, generics, static, {.compileTime.} and concepts implementation needs an overhaul
13:45:43AraqI also don't like the syntax at all but I now also consider the design flawed.
13:45:54clyybberIn what sense?
13:46:09Araqand to be fair, C++ is making all the same mistakes.
13:46:36Araqclyybber, a concept is a way to precisely nail down the constraints in my generic code.
13:46:40FromGitter<arnetheduck> re rust and serialization, yes, they have a well defined path for stuff to get included in std lib: develop outside to usefulness, intro the best parts into std lib as experimental to work out kinks, then open up to stable..
13:47:02FromGitter<mratsim> and typedesc also are broken, see latest discussion: https://github.com/nim-lang/Nim/issues/11152#issuecomment-488579780
13:47:53Araqclyybber, and given that, it's silly not to *typecheck* the generic code
13:48:05Araqnot the instantiation, but the generic itself.
13:48:37FromGitter<mratsim> @Araq, basically I want an article of Concepts vs Traits because right now Concepts is "wide-open and good luck matching it" while Traits you have to match it or compile-time error
13:48:52FromGitter<arnetheduck> of course, they didn't have that path in the beginning, but now that they're maturing..
13:49:33Araqif the generic proc is not type checked even in the presence of a concept, what's the point?
13:50:01AraqI can already use a generic underconstrainted 'T' instead and don't need to bother with a concept then
13:50:41Araqall that the 'concept' does is that it allows for even more overloading or something, that's not worth their inherent complexity
13:51:03Araqcomplex stuff has to be worth it.
13:51:50FromGitter<mratsim> So higher kinded types? :p
13:52:03Araqlike the destructors and moves semantics, they suck, more language rules, more complexity. But if we use them to remove the freakin' GC is worth it
13:53:39Araqsame for concepts, if we embrace them, we can use them to make generic code less quirky
13:53:43FromGitter<mratsim> Well, I use them to avoid inheritance in Arraymancer: https://github.com/mratsim/Arraymancer/blob/master/src/nn_dsl/dsl_types.nim#L63-L68
13:54:35FromGitter<mratsim> So that user defined types can be used if they are "TrainableLayer" (and no need for GC/ref indirection)
13:55:17Araqterrible :-)
13:55:46AraqInstead of TrainableLayer[TT] you can use TT in your code and maybe a 'when compiles' check
13:56:20FromGitter<mratsim> when compiles is like the ugly hack when everything else fails :P
13:56:59Araqlet me tell you a secret: the concept implementation as a hole is built upon system.compiles
13:57:08Araq*whole, nice typo.
13:57:28*PMunch quit (Remote host closed the connection)
13:58:23FromGitter<mratsim> well uneasiness intensifies
14:00:18FromGitter<arnetheduck> well, that's what concepts are, as defined now: "if all this syntax happen to compile for T, we're green"
14:01:22Araqthere are also other problems with the idea, problems that C# and even Python share
14:02:13AraqI tried to conceptify 'parseutils', for example
14:02:27Araqproc captureBetween*(s: string, first: char, second = '\0', start = 0): string
14:02:58Araqok, 's: string' becomes the new shiny 's: StringLike'
14:03:07Araqwhat does the return type become?
14:03:59AraqConstructibleStringLike ? how to determine what to return?
14:04:23Araqshould all procs that happen to return something grow a typedesc parameter?
14:05:11FromGitter<mratsim> s.concrete() --> that use the concrete typed passed
14:05:29FromGitter<mratsim> but yeah I had this issue as well when I tried to use concepts
14:05:56FromGitter<mratsim> well it's an non-issue if you return Error Code ;)
14:06:56*gmpreussner_ joined #nim
14:07:13Araqin general input parameters and output parameters/return values have different types, one requires only a "readonly" concept, the other some way to construct it
14:07:20*gmpreussner quit (Ping timeout: 255 seconds)
14:08:12noonienstring should just be a specialization of seq[char], or array[N, char], and captureBetween should return a read-only range/slice into that initial string
14:08:39Araqthat has its own set of problems, noonien
14:09:33noonienyes, they might be solved by an ownership system
14:10:01noonieni don't like rust's though
14:10:16FromGitter<liquid600pgm> I have a major concern for the ownership system: strictness
14:10:30Araqok, assuming that it is THE solution, in the end many people use Python/Visual Basic because they need to "get shit done"
14:10:32FromGitter<liquid600pgm> if it's gonna be as strict as Rust, it will be infuriating to get used to
14:11:01noonienyeah, i hate writing describing logic by using types
14:11:27Araqand a multitude of string-like types quickly becomes what I tend to call "sophistry"
14:11:37noonieni'm unfamilliar with other ownership systems other than rusts, i need to look further into thos
14:12:34Araqin the end I don't even want 'captureBetween', I want a lexer generator or something else
14:13:07Araqor an optimizer that understands substr() and optimizes it away
14:15:23nooniendoes nim have any other kind of IR other than what `macros` defines?
14:15:38noonienif not, it would be cool to have a way to provide AST optimizations by libraries
14:16:11Araqwe have term-rewriting macros for that
14:16:25FromGitter<arnetheduck> optimizer approach is kind of sad, limits it to strings
14:16:51*Trustable joined #nim
14:16:51Araqwe also have a bytecode in the vm.nim and a control flow graph that I'm trying to make the new IR, but it's tough :P
14:17:10noonienno, i mean sommething more global, perhaps something akin to importing compile-time optimize libraries, that just contain rewriting macros
14:17:50*rayman22201 joined #nim
14:18:17Araqnoonien, well be my guest and write a TR-macro library
14:18:17noonienthe optimizations would be applied at a certain stage, without any user intervention other than importing them
14:18:27noonienhehe
14:19:17FromGitter<kaushalmodi> How do I cast in coming pointer (void \*) from C side to a proc type?
14:19:25Araqarnetheduck: it was meant an example for how 'concept' has its own problems
14:19:47FromGitter<kaushalmodi> I am trying to translate this from C to Nim: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd042832e2caa1aa61aa27b]
14:20:42clyybbernoonien Theres source code filters
14:20:57clyybberand regexes :P
14:22:19FromGitter<kaushalmodi> I am trying to do below as a conversion of above C code, but it doesn't compile: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd0431bb489bb6ed7262245]
14:22:46FromGitter<kaushalmodi> The error I get is: ⏎ ⏎ > Error: expression cannot be cast to proc (): cint{.closure.}
14:24:58clyybberkhaushalmodi: You gotta add {.cdecl.} afair
14:25:20clyybberI'm not sure if {.cdecl.} works with anon procs though
14:25:32Araqit does.
14:25:37clyybbernice
14:26:20FromGitter<kaushalmodi> actually I tried something by fluke and it worked!
14:26:23*neceve joined #nim
14:26:27FromGitter<kaushalmodi> someone please explain it to me: `pcp = castproc(): cint {.noconv.} (inChandle)`
14:26:54FromGitter<kaushalmodi> I remembered seeing `noconv` in posix.nim and I just tried it .. I read in the manual, but I didn't understand why that worked
14:27:19noonienhmm, can i create a repeating string of N bytes long?, something like "\0".repeat(4)
14:28:10noonienah, repeat in strutils
14:28:10FromGitter<kaushalmodi> Araq, clyybber: `pcp = castproc(): cint {.cdecl.} (inChandle)` also worked
14:28:19FromGitter<kaushalmodi> but .. what does that mean?
14:28:20clyybberkhaushalmodi: noconv is the same as cdecl except on windows
14:28:44FromGitter<kaushalmodi> "cdecl" enforced "C function type" vs "Nim proc type"?
14:28:50clyybberkaushalmodi: Yeah
14:28:52FromGitter<kaushalmodi> s/enforced/enforces
14:28:55FromGitter<kaushalmodi> hmm, ok
14:28:57clyybbernoconv too
14:29:03FromGitter<kaushalmodi> I can live with that explanation :)
14:29:11FromGitter<kaushalmodi> thanks
14:29:28clyybberbut windows c compilers have different calling conventions sometimes, so cdecl adds __cdecl just to be safe
14:29:30clyybberafaik
14:31:30clyybberto clarify its because msvc likes to mangle names differently than any other compiler if you dont add __cdecl
14:33:12FromGitter<kaushalmodi> got it
14:36:04*Perkol joined #nim
14:47:19*kapil____ joined #nim
14:50:02*Perkol quit (Remote host closed the connection)
15:06:24shashlickWill 0.19.6 use the new nimble as well?
15:07:40noonienhmm, how can i run 2 async procs, and wait for them to complete concurrently?
15:08:29dom96await proc1() and proc2()
15:08:43*theelous3 quit (Ping timeout: 248 seconds)
15:10:31noonienhttps://github.com/nim-lang/Nim/blob/master/lib/pure/asyncfutures.nim#L351 nice, thanks!
15:14:33Araqclyybber, calling conventions are only vaguely related to name mangling. every CPU has calling convention(s)
15:15:23Araqfor example, Java's hotspot uses a different calling convention than Linux on x86_64
15:15:50dom96arnetheduck: What I want from you is to merge your changes to asyncdispatch upstream, at least once every 6 months. I think that's fair.
15:16:22*Jesin quit (Quit: Leaving)
15:28:28*JappleAck quit (Ping timeout: 246 seconds)
15:29:10clyybberAraq: Oh, yeah. But in this case(mscv) it affects the name mangling too, I think. I haven't used windows for a long time, but I remember that it caused problems with crosscalling code compiled by mingw and msvc
15:31:07*hoijui quit (Ping timeout: 248 seconds)
15:32:52Araqthe name mangling is a *feature* to detect bugs
15:32:59Araqcaused by different calling conventions
15:34:29*Jesin joined #nim
15:37:00clyybberah, that makes sense
15:48:03*hoijui joined #nim
15:49:41*rnrwashere joined #nim
16:17:24disruptekdom96: you want fixes propogated back to async in stdlib, but you're unwilling/unable to create those patches yourself. not even once every six months.
16:17:45disruptek"If I did it again I wouldn't have put async in the stdlib"
16:17:56disruptek"Because it would be easier to evolve it outside the stdlib"
16:18:02disruptekand yet...
16:18:07dom96disruptek: I do not have the luxury of working full time on a Nim project
16:18:49disrupteki get the impression that status doesn't have the luxury of enhancing async as per your instruction, and that's why the situation is what it is.
16:19:31disruptekit's funny that "once per six months" is == "fulltime", and yet this is what you're asking of status.
16:19:48disruptekso, you don't have that luxury, but you think it's "fair" to ask that of them. :-P
16:21:15dom96If they are truly too busy to do it then fair enough. I get the impression that they don't want to do it for whatever reason
16:22:52disruptekagreed. this won't be the first or last time nim has spawned alternatives to stdlib. hopefully, the ecosystem will grow to where stdlib solutions can be deprecated for better-supported, more performant, and featureful external libs. i think that's what we all want (except for @Araq, perhaps).
16:22:53*drewr quit (Quit: ERC (IRC client for Emacs 26.1))
16:23:29dom96The problem with something like async though is that you need everyone to use the same thing
16:24:00dom96I did say that if I did it again I wouldn't put it in the stdlib, but that was ... probably like 4 years ago now
16:24:22disruptekif you think that's more important than the quality of software, then i guess you should be a proponent of deprecating async in favor of chronos, right? since neither side is willing to merge the other's changes.
16:24:33dom96The situation is now different, we need to work together or we'll split the package repo into pieces
16:27:01federico3but async I/O should be part of the language
16:27:19dom96definitely
16:27:46nooniendoe async not work with unittest?
16:27:54federico3I wish we had some sort of "multisync" by default
16:28:26dom96noonien, it does, but you might have to create async procs and call them from within unittest via `waitFor`
16:29:00noonieni have, the error i'm getting is: Error: undeclared identifier: 'await'
16:29:14dom96then your code isn't inside an async proc
16:29:17noonieneven though i've got `import asyncnet, asyncdispatch`
16:29:41noonienhhm
16:29:48federico3better error msgs and better tracebacks would really help
16:29:49nooniendo i have to have Future[void] as a return value?
16:29:59disruptekyou can only await inside {.async.} though you can waitfor everywhere.
16:30:21noonienthis is the line that is erroring: `proc receive() {.async.} = received = await receiver.recv(T)`
16:30:28noonieneven though it's a proc inside a proc
16:30:31noonienso, a clojure i guess
16:30:47*nsf quit (Quit: WeeChat 2.4)
16:30:54noonieni'm unsure how closures works in nim yet
16:33:27*hoijui quit (Remote host closed the connection)
16:42:47*theelous3 joined #nim
16:43:24*Jjp137 quit (Quit: Leaving)
16:44:12dom96https://user-images.githubusercontent.com/246651/57240465-6c53a500-7026-11e9-82de-51aa910838fe.png :D
16:44:24dom96Prometheus ftw
16:44:34dom96If you've got a leaky server app in Nim, this might help you figure out why
16:46:15*nimer joined #nim
16:47:17*rayman22201 quit (Quit: Connection closed for inactivity)
16:47:25nimerHi all, i am looking for a PDF parsing library. Anything available?
16:48:23*nimer left #nim (#nim)
16:49:03noonienthis is the code that seems to trigger the compile error: http://vpaste.net/5PE3B
16:49:24nooniennot declaring the receive proc seems to not trigger the bug
16:52:16noonienif testSendRcv is not generic, the error does not seem to trigger
16:56:27clyybbernimer: I only know of nimPDF
16:56:37clyybberbut I'm not sure if that does parsing as well
16:57:36narimiranclyybber: yesterday we couldn't even do `import nimpdf`, let alone parsing :D
16:58:41clyybberoh, well nevermind then :D
16:59:11noonienan even simpler repro of the same bug: http://vpaste.net/I7VD2
16:59:21*rnrwashere quit (Remote host closed the connection)
16:59:29noonieni'm not sure this is a bug, perhaps i'm just doing something wrong
17:00:00*mrk joined #nim
17:00:17mrkhey i tried nim back in 2017
17:00:55mrkhad lots of wrong behavior for standard features and when i asked here people told me it was compiler bugs
17:01:02mrkis the language stable yet?
17:01:11FromDiscord_<kodkuce> yes and no 😃
17:01:55FromDiscord_<kodkuce> normal stuff should work , but there is new run-time in works too thats atm i think in alpha stage
17:02:30FromDiscord_<kodkuce> but probbaly dont take my info for granted i mostly lurk here did only some small code stuff with nim
17:05:15narimiranmrk: do you remember, what kinds of wrong behaviour?
17:06:18mrknot exactly
17:06:42mrkbut it was standard features/functions that didnt function how they should
17:06:52mrkpeople told me they were compiler bugs
17:08:26narimiranthen maybe it would be the best for you to try it out yourself. lots of stuff has been changed/improved in the mean time
17:14:13*rnrwashere joined #nim
17:14:41noonienhmm, can i not have var params in async procs?
17:16:00*drewr joined #nim
17:26:53dom96narimiran: huh, why couldn't you import nimpdf?
17:27:07narimirandom96: try it yourself
17:27:29dom96noonien, nope. Use `FutureVar[T]`
17:27:32narimiran`nimble install nimPDF` and then just `import nimPDF` in some file
17:27:55clyybberbecause there is no file called nimpdf
17:28:18clyybbernevermind, there is
17:28:32dom96narimiran: I don't see a nimpdf.nim in the package's repo
17:28:35dom96https://github.com/jangko/nimpdf
17:29:08clyybberdom96 Inside the nimPFD folder, but he seems to forgot to set srcDir in the .nimble
17:29:41dom96no, he should move nimPDF.nim into the root
17:30:09*mrk quit (Quit: Page closed)
17:31:34*nsf joined #nim
17:31:43nooniendom96: awesome! any examples of using FutureVar by any chance?
17:32:55dom96https://github.com/nim-lang/Nim/blob/devel/tests/async/tfuturevar.nim
17:33:16dom96lol why is this disabled
17:33:22federico3dom96: are you exposing the status of async routines now?
17:33:27*kapil____ quit (Quit: Connection closed for inactivity)
17:33:36dom96federico3: yep, once my PR gets merged to devel
17:34:10federico3what changed your mind?
17:34:27dom96federico3: hrm? What of my mind did I change?
17:35:20federico3dom96: in the past I asked to give access to the futures with something like getFuturesInProgress
17:36:40dom96I vaguely recall that, but I don't remember the context in which you wanted this
17:37:37federico3to be able to do profiling or debug a hanging "coroutine", mostly
17:38:39dom96My bad then. That's exactly why I ended up adding it
17:38:58dom96I spent many hours debugging a memory leak and it turned out to be a stuck future
17:40:37*rnrwashere quit (Remote host closed the connection)
17:44:14dom96federico3: you might want to add prometheus to your web servers and set up my prometheus package in your projects
17:44:28federico3unlikely
17:46:05dom96Why?
17:47:13federico3for application metrics, statsd is a better fit (modulo it simplistic metric format) because it does not require an HTTP server
17:47:43federico3(statsd the protocol, not the daemon itself)
17:48:29dom96Right, but if you've got a HTTP server anyway?
17:50:52federico3the one serving metrics to prom should have a different address and thread/coroutine
17:51:35federico3(and not all my daemons use http)
17:52:25federico3also you can use statsd in scripts, applications and other short-lived programs
17:56:33*rnrwashere joined #nim
17:58:50disrupteki prefer statsd, too, but you can always statsd->prometheus.
18:07:39dom96can you go the other way around? :)
18:08:03*rnrwashere quit (Remote host closed the connection)
18:09:14disruptekyou can prometheus->datadog; i haven't done much else with prometheus.
18:09:44disruptekused to use librato, which is now solarwinds or appoptics or something like that.
18:12:03disrupteki guess it's both those things.
18:12:58*rnrwashere joined #nim
18:14:05dom96So this is interesting: https://twitter.com/d0m96/status/1125463625097936897
18:20:45FromDiscord_<j$> is there a way I can compile a link a dir to load dlls from?
18:22:07FromDiscord_<j$> compile and*
18:23:16*jjido joined #nim
18:24:49*Trustable quit (Remote host closed the connection)
18:30:11*neceve quit (Remote host closed the connection)
18:44:19clyybbernarimiran: Have you tried kakoune?
18:44:29narimiranclyybber: long time ago, why?
18:44:51clyybberSolitudeSF made nim syntax highlighting for kak
18:45:00clyybberit works pretty well, am using it rn
18:45:29clyybberand I made a wrapper for nimsuggest for kakoune in bash
18:45:54clyybberwhich broke down after some nimsuggest change :P as expected for so many regexes
18:46:33narimirani'm using neovim with leorize[m]'s plugin and it works like a charm - it replaced vscode for me
18:46:46clyybberoh, yeah leorize's plugin is awesome
18:47:19clyybberah, snap I didn't wrap nimsuggest, I "wrapped" nim check, so nothing fancy
18:48:27livcdwhat is this async vs chronos debate?
18:49:31clyybberchronos is evolving and developing, while async in the stdlib is not. chronos is a fork of the stdlib async
18:50:07livcdjust that sentence alone will make people question the existence of async in the stdlib
18:58:13clyybberwell
18:58:37dom96clyybber, that statement is dangerous and will make people avoid stdlib async
18:58:37*rnrwashere quit (Remote host closed the connection)
18:59:30clyybberdom96: I didn't mean to discourage people from using stdlib async
19:00:04*rnrwashere joined #nim
19:00:20dom96I know. I think some might read it and be discouraged though
19:02:14dom96There is nothing significantly different about chronos to warrant its usage, unless you run into issues which chronos purports to solve
19:18:02livcdthe new terminal on windows looks good
19:32:53*krux02_ joined #nim
19:32:53*solitudesf- joined #nim
19:33:40*Vladar quit (Remote host closed the connection)
19:35:06*deech_ joined #nim
19:35:26zestyrI'm trying to figure out a way to make a simple cache for objects. The program is a jester server that requests data and displays it, so caching that data would be preferable, but since it's multithreaded I can't find a good way to achieve this
19:35:36*luis__ joined #nim
19:36:13zestyrI tried using a table but got GC safety errors
19:37:15*luis__ quit (Remote host closed the connection)
19:38:44*dddddd_ joined #nim
19:39:17*rnrwashere quit (Remote host closed the connection)
19:39:24*cornfeedhobo quit (Ping timeout: 248 seconds)
19:39:24*banc quit (Ping timeout: 248 seconds)
19:39:25*floppydh quit (Ping timeout: 248 seconds)
19:39:42*solitudesf quit (Ping timeout: 248 seconds)
19:39:42*deech quit (Ping timeout: 248 seconds)
19:39:42*dddddd quit (Ping timeout: 248 seconds)
19:39:42*krux02 quit (Ping timeout: 248 seconds)
19:39:56*sz0 quit (Quit: Connection closed for inactivity)
19:40:11FromGitter<jrfondren> I imagine you'd have a single thread handle all the caching, and since it's a server and what you want to do with cache is just send it to a socket, you can pass sockets to the caching thread rather than copy the cached data between threads.
19:40:20*banc joined #nim
19:44:07dom96zestyr, would a cache per each thread work?
19:44:29dom96In that case simply create a `var cache {.threadvar.}: Table[string, Blah]`
19:44:43zestyrcould work but is suboptimal, I'm trying to reduce requests as much as possible
19:44:44dom96in Nim devel the Table is initialised implicitly
19:44:57zestyrI'm working on an alternative twitter front-end so requests are expensive
19:45:28shashlickuse shared memory and locks
19:46:22dom96You can try this as well: https://nim-lang.org/docs/sharedtables.html
19:46:33shashlicki was just about to link that
19:46:35dom96I would avoid passing sockets between threads
19:46:48shashlickor use boehm gc and party
19:46:48zestyrit does say this though: "Use plain old non GC'ed keys and values or you'll be in trouble"
19:47:21zestyrI guess I can just use int keys and non-ref objects
19:47:53*seni quit (Quit: Leaving)
19:48:28shashlickboehm handles shared memory
19:48:43*dddddd_ is now known as dddddd
19:51:06*cornfeedhobo joined #nim
20:07:51*solitudesf-- joined #nim
20:08:24*solitudesf-- quit (Client Quit)
20:08:44*solitudesf joined #nim
20:10:26*nsf quit (Quit: WeeChat 2.4)
20:11:07*solitudesf- quit (Ping timeout: 268 seconds)
20:13:33*Jesin quit (Quit: Leaving)
20:18:50*Jesin joined #nim
20:21:27*Gertm joined #nim
20:28:08zestyrthis is giving me a headache lol, I've tried to use sharedtables in a few different ways now but either I get tons of errors or memory corruption
20:29:56Araquse --gc:boehm and the usual stuff
20:31:06zestyrby usual stuff do you mean Table?
20:32:14Araqyeah, use a {.gcsafe.}: block to make the compiler shut up and accept the GC is threadsafe
20:36:01zestyrhmm I get segfaults from times.zonedTimeFromTime and net.wrapConnectionSocket with --gc:boehm
20:40:14Araqhuh?
20:42:50clyybbergood night
20:42:58*clyybber quit (Quit: WeeChat 2.4)
20:48:48zestyrAraq: here's a small example http://ix.io/1Igf
20:52:30zestyrand here's the net segfault: http://ix.io/1Igg
20:52:37zestyrboth work fine when not using boehm
20:52:51Araqzestyr, what's your OS?
20:53:03zestyrLinux
20:53:16Araqrecent boehm version?
20:55:46*rayman22201 joined #nim
20:55:54zestyr7.6.8 I think
21:02:45Araqworks for me but I'm on Windows
21:04:37*narimiran quit (Ping timeout: 245 seconds)
21:17:46*Jjp137 joined #nim
21:34:53*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:35:24dom96huh, that's super odd zestyr. Maybe you'd be adventurous enough to look into the code pointed to by these stack traces?
21:39:52*rnrwashere joined #nim
21:40:05*lritter quit (Quit: Leaving)
21:42:12Araqdom96, I did look, it's nothing obvious
21:42:27Araqcan have a look tomorrow in my Linux Vm
21:44:04*rnrwashere quit (Ping timeout: 252 seconds)
21:52:11*solitudesf quit (Ping timeout: 244 seconds)
22:38:24*Hexeratops joined #nim
23:09:21*kotrcka joined #nim
23:47:28*krux02__ joined #nim
23:49:28*krux02_ quit (Ping timeout: 252 seconds)
23:55:02*krux02__ quit (Remote host closed the connection)
23:55:12*tiorock joined #nim
23:55:12*tiorock quit (Changing host)
23:55:12*tiorock joined #nim
23:55:12*rockcavera quit (Killed (weber.freenode.net (Nickname regained by services)))
23:55:12*tiorock is now known as rockcavera