<< 15-09-2018 >>

00:07:12FromGitter<gogolxdong> bindSym
00:12:38*demtomohiro quit (Quit: Leaving)
00:13:19FromGitter<arnetheduck> so looks like my particular gcc causes markandsweep to go nuts at -O3 level.. -O2, -Os all work fast, as does -flto.. weird
00:16:58FromGitter<rayman22201> @zacharycarter https://gist.github.com/rayman22201/77e6360a7508e2fcba08487c366b1737
00:26:46*francisl joined #nim
00:34:15AlexMaxWait a minute, what's this
00:34:30AlexMaxDoes c2nim know how to deal with functions like `nk__draw_begin`
00:36:38AlexMaxInside the output nim file, I see an importC to 'nk_draw_begin'
00:36:54AlexMaxProblem is, the actual function name is nk__draw_begin
00:37:00AlexMaxWonder if that's nimgen or c2nim
00:38:27*abm joined #nim
00:38:34AlexMaxalso lol - "while true:" complains about an ambiguous identifier, and I can't disambiguate it
00:47:33*heinrich5991 quit (Ping timeout: 245 seconds)
00:47:34*flyx quit (Ping timeout: 240 seconds)
00:48:31*abm quit (Read error: Connection reset by peer)
00:49:20AlexMaxthe compiler suggests bool.true, but that gives me a different error about a missing field
00:49:27AlexMaxmaybe the compiler message is out of date
00:49:47*heinrich5991 joined #nim
00:51:11*flyx joined #nim
00:53:37*heinrich5991 quit (Client Quit)
01:40:17*heinrich5991 joined #nim
01:43:47shashlickThat might be nimgen
01:43:57shashlickCause I replace __ with _
01:44:03shashlickSince Nim didn't like that
01:44:33shashlickBut should be okay in an importc
01:45:45*heinrich5991 quit (Quit: quit.)
01:49:26*Rame21 joined #nim
01:50:07*Rame21 quit (Remote host closed the connection)
01:55:06AlexMaxshashlick: 10-4, I'll let you know if it crashes
01:57:11AlexMaxI'm nearly done with the header that deals with setting up GL state
02:03:54*francisl quit (Quit: francisl)
02:10:47*zachcarter joined #nim
02:13:51*leorize quit (Quit: WeeChat 2.2)
02:15:09*zachcarter quit (Ping timeout: 252 seconds)
02:25:00*kapil___ joined #nim
02:32:45*ftsf joined #nim
02:34:40shashlickNice
02:52:13FromGitter<kayabaNerve> I asked this a few days ago and got no response. I know templates can't override `=` but I don't see this as impossible. ⏎ ⏎ How can I write a = overload for a generic? ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5b9c73dd1ee2ca65021b010c]
02:52:45*wildlander quit (Quit: Konversation terminated!)
02:53:37FromGitter<kayabaNerve> First says it doesn't match the signature. Second says X is undefined. Third compiles but is ignored.
02:55:39FromGitter<kayabaNerve> Even ``` ⏎ proc `=`(x: var Generic[int], y: Generic[T]) ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b9c74aabe4f30062696f757]
02:56:16FromGitter<kayabaNerve> *both would be int in that last one.
02:56:22AlexMaxdamn
02:56:27AlexMaxheck yeah
02:56:37AlexMaxGot rid of the obvious syntax errors
02:56:48AlexMaxnow on to the actual compile errors
02:57:50AlexMaxjust in case i lose power...
02:57:53AlexMaxhttps://paste.ee/p/Nbzd2
02:58:00FromGitter<kayabaNerve> It does work if I use any symbol other than =...
03:17:13*PrimHelios joined #nim
03:17:15PrimHeliosmew mew
03:17:18PrimHelioslong time no mew
03:19:20PrimHeliosWRONG SERVER
03:22:46*francisl joined #nim
03:26:01AlexMax...okay this is kind of bizarre
03:26:25AlexMaxI'm getting an error dump trying to compile nimnuklear_nuklear
03:26:33AlexMax.c
03:26:58AlexMaxsays it can't find a bunch of type names that 100% do exist
03:27:02AlexMaxhttps://paste.ee/p/38rgZ
03:28:09FromGitter<bung87> how to determin x64 or x86 32?
03:28:33AlexMaxOh shoot
03:30:54AlexMaxwhat the heck kind of codegen is this...
03:31:34AlexMaxSome of these typedefs are backwards
03:31:42AlexMaxOr something
03:33:18AlexMaxNo wait, they're not backwards. They're missing the 'struct' keyword
03:34:49AlexMaxshoot, if you wrap a c struct, you need to .importc "struct foo", don't you...
03:40:12*francisl quit (Quit: francisl)
03:40:55FromGitter<kungtotte> I've been scouring the documentation and the forums and I'm coming up short, but is there a straightforward way of writing the equivalent to this C# code in nim: bytes[] = BitConverter.GetBytes(unsigned_integer, length)
03:41:50FromGitter<kungtotte> What it does is it takes each byte in turn from an int (up to length bytes)
03:43:15AlexMaxYep, importc needs "struct"
03:43:22AlexMaxC is dumb lol
03:43:51*francisl joined #nim
03:49:57FromGitter<bung87> @kungtotte you can try cast it to array of char
03:52:18AlexMaxokay, I'm all nimmed out today
03:53:00FromGitter<kungtotte> @bung87 Something like this? castarray[4, uint8 (value)
03:53:24AlexMaxat least I've got this pushed remotely
03:53:32FromGitter<kungtotte> Uh, that looks like it got formatted weirdly. Not used to gitter on my phone
03:53:47FromGitter<bung87> `cast[array[4, uint8]]`
03:55:06AlexMaxalso I have no idea how I'm supposed to get at the scancodes in the sdl2 package, but maybe I haven't looked hard enough
03:55:20AlexMaxseems like they're all in the private section
03:55:32FromGitter<bung87> oh it's `char` type not uint8
04:06:07*francisl quit (Quit: francisl)
04:20:15*dddddd quit (Remote host closed the connection)
04:51:04FromGitter<kungtotte> Isn't `char` an alias for `uint8`?
04:53:54*miran joined #nim
05:00:46*erratic quit (Ping timeout: 246 seconds)
05:08:39*nsf joined #nim
05:22:47FromGitter<bung87> not sure about how the type infered
05:26:07FromGitter<kaushalmodi> @Araq Before I create a PR for nightly docs, I noticed that the internal links to modules is incorrect when building docs on Travis. For example, in https://kaushalmodi.github.io/nim-nightly-docs/cpuinfo.html, it is: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9c97eeb9531f2dfa6c430b]
05:26:36FromGitter<kaushalmodi> What would cause that `lib/pure/concurrency/` hierarchy to go missing?
05:27:03FromGitter<kaushalmodi> Another issue that I see both locally and on Travis is that it's pointing to `tree/master` instead of `tree/GITHASH`.
05:33:34*cspar quit (Ping timeout: 272 seconds)
05:33:48*nsf quit (Quit: WeeChat 2.2)
05:35:00FromGitter<kaushalmodi> The links under "Imports" are broken too, when generating koch docs on Travis (see that same cpuinfo page)
05:38:09FromGitter<kaushalmodi> Actually, I am now able to recreate that issue locally too.
06:01:08*xet7 joined #nim
06:03:52*NimBot joined #nim
06:11:10*zachcarter joined #nim
06:15:45*zachcarter quit (Ping timeout: 244 seconds)
06:20:01FromGitter<alehander42> @Araq yeah indexes vs pointers, but the point seemed to be that if you are not managing your indexes correctly, you can and up with incorrect index state without any type checker or runtime exception showing that
06:27:50*travelion joined #nim
06:32:13*Atque joined #nim
06:32:34*travelion quit (Ping timeout: 240 seconds)
06:38:07*Atque quit (Ping timeout: 240 seconds)
06:52:37FromGitter<alehander42> btw is there a problem with supporting e.g. a.`__enter__` in nim
06:52:41FromGitter<alehander42> ops
06:52:52FromGitter<alehander42> ```a.`_enter````
06:53:47FromGitter<alehander42> it seems the quotes also accepts only valid names, but it should be easy to make them accept more characters: it would make sense for js backend or nimpy: https://github.com/yglukhov/nimpy/issues/43
06:58:10FromGitter<alehander42> pff, i didnt know of eqIdent ..
06:58:25FromGitter<alehander42> (looking at mratsim's julia challenge)
06:59:11FromGitter<bung87> seems template and block similar to this
07:04:05FromGitter<alehander42> ?
07:06:07*miran quit (Ping timeout: 240 seconds)
07:06:23FromGitter<bung87> just thoughts , implements a `with` macro and `context.__enter` `body` `context.__leave__`
07:08:33FromGitter<alehander42> ah yeah
07:09:02FromGitter<alehander42> we even did that automatically in py2nim, we translated python context managers to stuff like https://github.com/metacraft-labs/py2nim/blob/master/tests/nim/context.nim
07:10:15FromGitter<bung87> oh ,why not use py2nim then = _=
07:10:34FromGitter<alehander42> well it's very unfinished
07:11:10FromGitter<alehander42> and it will always require at least a bit of manual postprocessing
07:11:46FromGitter<alehander42> and for libs it's usually better to design them with nim types and metaprogramming in mind, not to automatically simulate the python way
07:12:45FromGitter<bung87> I'm not confortable with import a python dylib
07:13:43FromGitter<bung87> comfortable
07:14:03FromGitter<alehander42> i guess in some cases it's fine
07:15:15*Te[u]K20 joined #nim
07:15:59FromGitter<bung87> in python there's GIL in import a dylib
07:19:58*Te[u]K20 quit (Remote host closed the connection)
07:20:19*krowthulhu26 joined #nim
07:20:59*erratic joined #nim
07:23:08*cavariux quit (Remote host closed the connection)
07:24:03*cavariux joined #nim
07:25:04*krowthulhu26 quit (Remote host closed the connection)
07:41:38*TheLemonMan joined #nim
07:44:56TheLemonMandevel is red again FFS :(
07:57:21*edi27 joined #nim
07:57:59*edi27 quit (Remote host closed the connection)
07:58:33*SenasOzys joined #nim
08:01:11*Guest8490 is now known as awal
08:03:07*gmpreussner quit (Ping timeout: 240 seconds)
08:03:29*gmpreussner joined #nim
08:04:12Araqalehander42: well yeah, you add a "generation" part to the index
08:04:56Araqand you still have no security violations, no remote exploits...
08:17:22*_brainbomb_ joined #nim
08:24:01*xet7 quit (Quit: Leaving)
08:25:03*ftsf quit (Ping timeout: 245 seconds)
08:27:20*xet7 joined #nim
08:36:06*_brainbomb_ quit (Ping timeout: 252 seconds)
08:47:03*Vladar joined #nim
08:49:32*PMunch joined #nim
08:50:33FromGitter<bung87> https://github.com/Nim-NLP/minhash/blob/master/src/minhash.nim does it necessary define two versions of interfaces ?
08:51:36FromGitter<mratsim> you can use `MinHasher[T: uint32 or uint64]` if you want
08:53:18FromGitter<bung87> wow let me try will reduce much code
08:54:01*ftsf joined #nim
08:58:35FromGitter<Bennyelg> How I can do that: ⏎ type ⏎ SimpleTest = ref object ⏎ ⏎ ```execute: proc()``` [https://gitter.im/nim-lang/Nim?at=5b9cc9bbbe4f30062698b912]
09:04:39FromGitter<Vindaar> @Bennyelg: what do you mean? That's perfectly valid
09:07:52FromGitter<Vindaar> to expand on that: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ is fine. Or did you have something else in mind? [https://gitter.im/nim-lang/Nim?at=5b9ccbe73b7e6c2edd1da953]
09:08:21FromGitter<Bennyelg> this is probably the behavior I want
09:08:23FromGitter<Bennyelg> but . i get incorrect object construction syntax
09:09:26FromGitter<Bennyelg> fixed
09:09:31FromGitter<Bennyelg> I forgot keyword
09:09:58FromGitter<Vindaar> ah :)
09:15:23*abm joined #nim
09:18:55FromGitter<Bennyelg> @Vindaar ⏎ I can't do something like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cce7ff7e1580625d43339]
09:20:42FromGitter<Bennyelg> I just removed the ref
09:20:47FromGitter<Bennyelg> and it's working
09:22:09FromGitter<Vindaar> do you want your different strategies to be just different aliases or actually objects inheriting from `Strategy`?
09:22:46FromGitter<Bennyelg> object inheriting from Strategy I am trying to mimic strategy pattren in nim
09:23:06FromGitter<Bennyelg> looks like I did it
09:23:06FromGitter<mratsim> I sense Java-ism distrubance in the Force
09:23:15FromGitter<Bennyelg> lol
09:23:21FromGitter<Bennyelg> just practice
09:23:23FromGitter<Bennyelg> nothing more
09:23:33FromGitter<mratsim> ugh, don’t practice Java in Nim :P
09:23:38FromGitter<Bennyelg> lol
09:23:54FromGitter<mratsim> Patterns mean you’re language is not powerful enough ;)
09:23:57FromGitter<Bennyelg> I was urgy with friend which is fun of Kotlin, that I can do anything better
09:24:05FromGitter<Vindaar> In the example above all your different strategies are just aliases of the same thing, a `ref Strategy`. If you want to inherit from them, you'll have to write `ref object of Strategy`, no? (I've never used inheritance in Nim before, just my little understanding)
09:24:19FromGitter<mratsim> read that by the way, it’s fun: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
09:24:45FromGitter<mratsim> for inheritance Strategy must be a ref object of RootObj
09:25:02FromGitter<mratsim> and everything else ref object of Strategy
09:25:13FromGitter<Bennyelg> yea i got this to work
09:25:17FromGitter<Vindaar> ah, indeed :)
09:26:04FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd02cbe4f30062698da58]
09:27:11FromGitter<mratsim> but your types are all aliases
09:27:31FromGitter<mratsim> well I don’t know the strategy patter so whatever :P
09:27:35FromGitter<mratsim> pattern*
09:28:39FromGitter<mratsim> according to wikipedia "The strategy pattern uses composition instead of inheritance"
09:29:48FromGitter<mratsim> but it seems like you can use this: ⏎ ⏎ ```type ⏎ Strategy = object ⏎ name: string ⏎ selectedStrat: proc ()``` ⏎ ⏎ No need for anything else [https://gitter.im/nim-lang/Nim?at=5b9cd10cd655361f7601ed40]
09:29:59FromGitter<mratsim> it’s just a proc handler
09:30:09FromGitter<Bennyelg> just pass proc
09:30:25FromGitter<mratsim> you don’t need all those extra types
09:30:33FromGitter<Bennyelg> yea I understand
09:30:34FromGitter<Bennyelg> you are right
09:31:07FromGitter<bung87> ```lib/pure/collections/sets.nim(480, 15) Error: type mismatch: got <HashSet[system.uint64]>``` ⏎ ⏎ why this happen? [https://gitter.im/nim-lang/Nim?at=5b9cd15b8909f71f75d87f93]
09:31:26FromGitter<mratsim> uint64 might not be Hashable
09:31:49FromGitter<mratsim> ah they are
09:32:03FromGitter<mratsim> but your stacktrace is too short
09:32:19FromGitter<mratsim> must go though, I can’t help right now
09:32:46FromGitter<Bennyelg> @mratsim thanks for help
09:33:00FromGitter<mratsim> you’re welcome
09:33:10FromGitter<bung87> when it calling ``` ⏎ ⏎ `````` ⏎ when it compute intersection [https://gitter.im/nim-lang/Nim?at=5b9cd1d6b4990c30eebb28c2]
09:33:57FromGitter<bung87> previous with two version interface has no such problem.
09:34:19FromGitter<mratsim> intersection is called intersection not `/`
09:34:32FromGitter<mratsim> ah no I see
09:34:41FromGitter<mratsim> intersection returns a `/`
09:34:45FromGitter<mratsim> a HashSet
09:34:55FromGitter<mratsim> but there is no `/` defines for HasSet
09:35:15FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd2533b7e6c2edd1dcc43]
09:35:24FromGitter<mratsim> ah no there is a len before, well, sorry can’t really help but type issues should be easy
09:35:46*klaas__ joined #nim
09:35:59FromGitter<mratsim> also don’t forget to convert len to float
09:36:37FromGitter<bung87> but it will raise before that
09:37:23FromGitter<Vindaar> in which line does it raise? That's not clear from the single line of the stack trace
09:37:59FromGitter<bung87> ok let me put all
09:38:13FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd305e5c2cc56ad9207a7]
09:38:38*klaas__ quit (Remote host closed the connection)
09:39:26FromGitter<alehander42> what does fingerprint return
09:40:33FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd3918909f71f75d88a00]
09:41:10FromGitter<bung87> ok , I update it https://github.com/Nim-NLP/minhash/blob/master/src/minhash.nim
09:50:25FromGitter<bung87> kinda weird,what could be a problem between same type sets intersection...
09:51:32FromGitter<Vindaar> so the issue happens in the call to intersection?
09:56:43FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ after init the first call is .jaccard , then it throw error from std lib nothing more useful info. [https://gitter.im/nim-lang/Nim?at=5b9cd75b7dca306503044a12]
09:59:05FromGitter<Vindaar> If you tell me how I can run that code locally, I'll take a look. But the github link is missing that `murmur3` module
10:00:16FromGitter<bung87> yeah , I renamed it ,forget to push , now updated.
10:01:47*miran joined #nim
10:02:25FromGitter<bung87> now you can run it as usual
10:03:44FromGitter<Vindaar> it compiles just fine for me?
10:04:46FromGitter<bung87> you passed test1.nim ?
10:05:08FromGitter<Vindaar> ahh, I thought the `isMainModule` part of `minhash.nim` was enough :)
10:06:09FromGitter<Vindaar> your problem is that you don't import `sets` into `test1.nim`
10:06:31FromGitter<Vindaar> either export `sets` from `minhash.nim` or you need to import it into every module that uses `minhash`
10:08:42FromGitter<bung87> oh . but test1.nim doest declared any HashSet , why need that?
10:11:39*zachcarter joined #nim
10:11:47*stefanos82 joined #nim
10:16:06*zachcarter quit (Ping timeout: 252 seconds)
10:18:36FromGitter<bung87> @mratsim @Vindaar thank you guys! now it reduce code less than 100 lines:)
10:19:14FromGitter<Vindaar> happy to help :) I can't properly answer the `why` though. It's just how scoping / imports work in Nim I think?
10:21:16FromGitter<bung87> before this, I have two version interfaces, not use generic, so when it comes to generic ,it acts this way?
10:21:41FromGitter<Vindaar> yeah, it might be related to how generics are instantiated
10:22:31FromGitter<bung87> that makes it like a runtime importing : (
10:23:18FromGitter<Vindaar> well, in practice it's not really an issue imo
10:23:43FromGitter<bung87> ok I got it.
10:28:00*nsf joined #nim
10:31:44FromGitter<dm1try> > It's just how scoping / imports work in Nim I think? ⏎ ⏎ actually looks like a bug.. why someone should import `sets` module it is just an implementations details of `minhash`
10:33:10FromGitter<dm1try> and this is related only to the `items` iterator; there is no problem with other methods
10:33:32FromGitter<dm1try> nope?
10:34:00FromGitter<Vindaar> I don't know. I stumbled on this myself quite a few times and just accepted it
10:34:24FromGitter<bung87> good to know..
10:34:35FromGitter<dm1try> hm.. happy you =) I cannot accept such behaviour
10:34:50FromGitter<Vindaar> then please raise an issue about it :)
10:35:01FromGitter<Vindaar> I mean I'd be happy if it's just a bug :D
10:36:47FromGitter<Vindaar> there's an even more subtle way this can occur (which I did think was a bug before), but I never spent enough time to figure out how to reproduce it in a simple way
10:40:50FromGitter<bung87> `Issues 1,410` much more than most popular projects...
10:41:08FromGitter<dm1try> yep, it makes sense, I will try to reproduce and find or file an new issue then
10:44:15FromGitter<Vindaar> 👍
10:48:09*PMunch quit (Remote host closed the connection)
10:54:35FromGitter<dm1try> https://github.com/nim-lang/Nim/issues/4773
10:54:42FromGitter<dm1try> this is the related issue
10:55:11FromGitter<dm1try> and the solution that proposed by Araq is works
10:56:10FromGitter<dm1try> if you change this line https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sets.nim#L480 to use explicit `items` iterator
10:56:22FromGitter<dm1try> you do not need to import `sets`
10:56:26Araqyeah, we should fixt that, but it's hard :P
10:57:14TheLemonMangotta run more of the lib/pure stuff in the test suite
10:58:00*ftsf quit (Ping timeout: 252 seconds)
10:59:25TheLemonManis there a way to grab an anonymous ident in a macro?
11:00:13Araqgensym()
11:06:20TheLemonManAraq, I'm curious about what the rationale behind the choice of having the field name only in nkCheckedFieldExpr is :)
11:11:24Araqguide the implementation into not evaluating 'f' twice in f().checkedField
11:12:47TheLemonManhm, I can implement that in the VM if you want
11:13:07FromGitter<codenoid> btw @Bennyelg about csv parsing
11:13:17FromGitter<codenoid> i let my user to define the separator
11:14:05*kapil___ quit (Quit: Connection closed for inactivity)
11:14:09FromGitter<Bennyelg> @codenoid I'll add this option
11:16:35FromGitter<codenoid> https://github.com/Muonyet/lazy-mongo
11:17:18FromGitter<codenoid> https://github.com/Muonyet/lazy-mongo#usage
11:28:19FromGitter<Bennyelg> nice
11:28:35FromGitter<Bennyelg> nice but you should ditch crystal and move to Nim :P
11:36:40*demotomohiro joined #nim
12:10:42*kapil___ joined #nim
12:21:44*ericbmerritt_24 joined #nim
12:26:31*ericbmerritt_24 quit (Remote host closed the connection)
12:32:23*Vladar quit (Remote host closed the connection)
13:00:18*SenasOzys quit (Ping timeout: 244 seconds)
13:05:20FromGitter<tim-st> when I have a threadvar but `--threads:off` is there a difference to a normal var that is inside a proc?
13:10:06*SenasOzys joined #nim
13:23:48FromGitter<tim-st> ok, here is an answer for delphi, though not very clear: https://stackoverflow.com/questions/5180933/what-is-the-difference-between-a-threadvar-and-a-local-variable
13:23:54*nsf quit (Quit: WeeChat 2.2)
13:25:10FromGitter<Bennyelg> anyone can throw an example? ⏎ https://github.com/nim-lang/Nim/issues/8944
13:25:40FromGitter<Bennyelg> passing function to aggregate a seq ? this is what it means?
13:26:29FromGitter<bung87> maybe groupBy ( proc(x): x["myindex"])
13:28:21*TheLemonMan quit (Ping timeout: 252 seconds)
13:35:23FromGitter<Bennyelg> but it's seq
13:37:18*halirc joined #nim
13:37:30FromGitter<bung87> oh ,then I can assuming he means seq of seq.
13:37:55FromGitter<bung87> no ,also not right..
13:38:44halircHello. Is anyone with the nim json module?
13:38:48halirc*familiar
13:38:55FromGitter<bung87> seq of tables sounds make sense.
13:40:04halircI'm wondering if it would be difficult to sort hashes in existing json files by key name and write them back out sorted
13:43:09FromGitter<bung87> halirc there's no order in javascript object keys , so ..
13:45:14FromGitter<bung87> if you handle json files , then that could be possible, just scan "somkey": if it's not nested object that would be simple.
13:45:26halircwell, they say the order is not guaranteed and it isn't, but in the file you write out you have an order of the keys just by the way it was writen. I would like that order to be the same always to better put those files into version control
13:47:59FromGitter<bung87> you may try https://github.com/Araq/packedjson/ since it store json as a single string.
13:54:21*TheLemonMan joined #nim
14:04:56*zachcarter joined #nim
14:15:04*wildlander joined #nim
14:23:42*PrimHelios quit (Ping timeout: 252 seconds)
14:27:32*stefanos82 quit (Read error: Connection reset by peer)
14:29:14*stefanos82 joined #nim
14:31:00*Vladar joined #nim
15:06:39*elrood joined #nim
15:08:30TheLemonManI've just pushed an update to criterion.nim, the measureArg annotation is now gone :D
15:10:36*nsf joined #nim
15:11:26*cspar joined #nim
15:15:50FromGitter<alehander42> Araq is [expr] [expr] guaranteed to work as command in ast
15:16:15FromGitter<alehander42> i was surprised even `2 @b` works while doing pattern matching experiments
15:16:36FromGitter<alehander42> so e.g. `of expr @name` seems to be always valid ast
15:17:25FromGitter<alehander42> i am not sure why i am surprised: i guess i expected literals etc to be detected as i thought nnkCommand is only for invocations of the left operand
15:26:57*Calinou quit (Ping timeout: 252 seconds)
15:32:27*Calinou joined #nim
15:37:45Araqthe "command invokation syntax" got greatly improved with the 'await' "keyword"
15:38:44FromGitter<alehander42> I see
15:39:26*SenasOzys quit (Ping timeout: 244 seconds)
15:47:39FromGitter<Bennyelg> this is what he ment ? ⏎ https://github.com/nim-lang/Nim/issues/8944
15:51:07FromGitter<Vindaar> @Bennyelg I would guess he means something like: https://clojuredocs.org/clojure.core/group-by
15:51:38FromGitter<bung87> guess so,may prefer return a table with group key
15:52:21FromGitter<Vindaar> i.e. input is some `seq[T]` as well as some proc taking `T` and returning U. Then group all elements of the input by the result of the proc (the key) to get a `Table[U, seq[T]]`
15:53:26FromGitter<Bennyelg> @Vindaar I thought he was thinking something like itertools.groupBy (python)\
15:53:49FromGitter<Vindaar> ok that Python proc I don't know :D
15:55:47FromGitter<Bennyelg> clojure groupBy is cool
15:55:49FromGitter<bung87> prefer think it means sonething in functional programing in scala or some other
15:57:21miran@Benyelg: the input seq shouldn't be limited to `seq[Table]`
15:57:35FromGitter<Bennyelg> Yea I guess you are right
15:57:43FromGitter<Bennyelg> seq[T] indeed
15:59:40miran@Vindaar: python.itertools is a great (very powerful) library! there's no excuse to not know everything in it by heart! :P
16:00:17FromGitter<Vindaar> miran: haha you're probably right. :D I know itertools, but I only used it sparingly
16:01:52miran@Bennyelg but thanks for reminding me that i didn't implement groupBy in https://github.com/narimiran/itertools
16:03:16FromGitter<Vindaar> ```code paste, see link``` ⏎ ⏎ I guess? And why can `len` not be handed as a `procvar`? [https://gitter.im/nim-lang/Nim?at=5b9d2d448909f71f75da8fa3]
16:03:58FromGitter<Bennyelg> cool I am just writing the same now lol
16:04:02FromGitter<Vindaar> haha :D
16:04:08FromGitter<Bennyelg> what is keyP ?
16:04:10FromGitter<Vindaar> always fun to implement something like this :)
16:04:12FromGitter<Bennyelg> another function?
16:04:14FromGitter<Vindaar> `key proc`
16:04:14FromGitter<Bennyelg> yea
16:04:21FromGitter<Bennyelg> oh
16:04:22FromGitter<Vindaar> that was supposed to go in `"`
16:04:23FromGitter<Bennyelg> didnt saw it
16:04:31FromGitter<Bennyelg> Awesome
16:06:08FromGitter<bung87> cool ,you do it so quick
16:06:23FromGitter<Bennyelg> yea I just wrote the first 2 lines
16:06:29FromGitter<Bennyelg> and they looks almost the same lol
16:06:38FromGitter<Bennyelg> but it's fine I am learning and seeing Im in the right path lol
16:06:57FromGitter<Vindaar> hehe 🙈
16:07:24FromGitter<Bennyelg> 🔨
16:10:57*SenasOzys joined #nim
16:15:13FromGitter<Bennyelg> ```code paste, see link``` ⏎ ⏎ looks good thanks @Vindaar [https://gitter.im/nim-lang/Nim?at=5b9d3011be4f3006269af363]
16:15:56FromGitter<Vindaar> cool :)
16:16:18FromGitter<tim-st> `marshal.$$` dont support non-ascii field names? :(
16:16:28miran@Vindaar @Bennyelg can i use your versions as a basis for itertools.groupBy?
16:16:31FromGitter<Bennyelg> Comment this pull request with your solution or just make a pull request with this groupBy inside the collections :D
16:16:46FromGitter<Bennyelg> I guess you could
16:16:55FromGitter<Vindaar> sure thing!
16:17:05FromGitter<Bennyelg> just start coding Muhahaha
16:17:44*stefanos82 quit (Quit: Quitting for now...)
16:19:23TheLemonMantim-st, if Nim supports them then marshal must support those too
16:19:47FromGitter<Bennyelg> https://github.com/nim-lang/Nim/issues/8944 ⏎ credit to @Vindaar ;]
16:22:03TheLemonManwhy split ` ... = @[]/ ... .add(el)`? that way you do two lookups in the table
16:22:26FromGitter<Vindaar> because real quick I didn't know how else to do it
16:22:37TheLemonMan@[el] ?
16:22:45FromGitter<Bennyelg> hehe
16:22:47FromGitter<Vindaar> Oh
16:22:48FromGitter<Vindaar> haha
16:22:52FromGitter<Vindaar> indeed :D
16:23:03FromGitter<Bennyelg> when things are so easy we always look for hard solution
16:23:13FromGitter<Bennyelg> complicated *
16:23:49FromGitter<tim-st> TheLemonMan: it works indeed, I had to add "Content-Type: application/json" to the request to get it correct
16:25:10FromGitter<bung87> it is easy make it more compilcated, support custom obj
16:25:54copygirlWhile away from the computer, I just realized the reason why I've been getting a proc mismatch error.
16:26:13copygirlI have a camera module and an exported camera variable inside that.
16:26:40copygirlTrying to write `camera.update()` doesn't work because that camera refers to the module.
16:26:56FromGitter<bung87> no not meant to send the message...
16:27:47copygirlI feel like there should be a more useful error message / hint or perhaps an error / hint in the module where I define the variable.
16:29:32FromGitter<tim-st> when my database is a threadvar and it does locking internally does it mean my application is ready for multithreading? (I have no warnings when compiling with `--threads:on`)
16:31:05FromGitter<bung87> to copygirl that might be IDE job
16:31:17TheLemonMancopygirl, I think the compiler should be smart enough to consider the symbol as ambiguous and to require it to be fully qualified
16:31:37TheLemonMantim-st, threadvar means each thread gets a copy of the variable, that's it
16:32:16copygirlTheLemonMan: How would you even fully qualify a module?
16:32:54TheLemonMancopygirl, you don't, but you can't use `camera` and have to use `camera.camera` instead
16:33:30FromGitter<tim-st> TheLemonMan: yes I meant my database app locks internally, I dont understand why a threadvar is different from non threadvar though...
16:34:15FromGitter<tim-st> I mean why i get a warning when it's not threadvar and at global scope
16:34:38TheLemonMantim-st, thread-vars are allocated in the TLS so each thread is free to do whatever it pleases
16:35:42FromGitter<tim-st> yes, I understand what this means for a string, but when I have a database handle what makes this more secure?
16:36:46TheLemonManno, it just means you have N database handles (where N is the number of threads)
16:37:30FromGitter<tim-st> yes, I understand this too, but what makes it better than 1 db handle? I assume they all have the same content independent on threadvar or non threadvar
16:38:12TheLemonMannobody said it is better :)
16:38:46FromGitter<tim-st> the compiler says it only allows threadvars, and I dont understand why
16:39:03TheLemonMandoes it?
16:39:47FromGitter<tim-st> yes, once it's at global scope. When I do the same strucure and put a proc around everything stays without wanring. Without threadvar + global scope gives compiler error
16:39:51miran@Bennyelg @Vindaar i'll also add a variant of groupby without a `proc` parameter — the same elements will be grouped together
16:40:22FromGitter<tim-st> TheLemonMan: https://github.com/2vg/mofuw/issues/62
16:41:04FromGitter<tim-st> the same when I just make `l = s.len` where s is from global scope
16:52:45*demotomohiro quit (Ping timeout: 252 seconds)
16:56:55*arecaceae quit (Remote host closed the connection)
16:57:14*arecaceae joined #nim
17:09:18*johnsom5 joined #nim
17:10:48FromGitter<Clyybber> !echo Test
17:10:56FromGitter<Clyybber> !nimbot echo Test
17:11:59*johnsom5 quit (Remote host closed the connection)
17:14:26*leorize joined #nim
17:18:41FromGitter<Clyybber> @Araq @zah @TheLemonMan ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This crashes the compiler... [https://gitter.im/nim-lang/Nim?at=5b9d3ef1be4f3006269b48ea]
17:19:05FromGitter<Clyybber> Is a type annotation inside an array valid syntax?
17:19:09FromGitter<cfsamson> Anyone from the core team here?
17:19:16*rofer20 joined #nim
17:19:37TheLemonManClyybber, woah that's extra weird
17:20:03TheLemonMancfsamson, there's Araq on call 24/7
17:21:17FromGitter<Clyybber> @TheLemonMan Is the 7th line even valid syntax?
17:22:06*rofer20 quit (Remote host closed the connection)
17:22:26TheLemonManClyybber, not sure about that, but surely it shouldn't generate an array with a typedesc in it
17:22:34FromGitter<cfsamson> OK, so @Araq On the Nim homepage under "featured projects" the Reel Valley is a dead link, kust thought to let you know since it is on a prime location on the homepage ;) (facebook 404 response)
17:24:33FromGitter<Clyybber> @TheLemonMan Yeah its wierd. In the code I extracted the sample from it didn't crash, but complain that I passed in a ```ptr type num``` instead of a ```ptr num```
17:24:43TheLemonManClyybber, good news, the syntax is fine but it doesn't do what you think it does
17:24:53TheLemonManit's `<index>: <value>`
17:25:02FromGitter<Clyybber> Aha
17:25:05FromGitter<Clyybber> Cool
17:25:21FromGitter<Clyybber> So Its possible to have an array of types?
17:26:10TheLemonManthe language says yes, the codegen says no and Araq says ...
17:27:42FromGitter<Clyybber> I will see if I can make a test case where it doesn't crash, but instead generates a ```ptr type num```
17:28:22TheLemonManI guess not because it makes no sense to have an array of typedescs
17:28:35FromGitter<bung87> I think you are looking for typetraits or typeinfo
17:29:26FromGitter<Clyybber> @bung87 I don't WANT to use this code, I just happen to came across it
17:30:30FromGitter<bung87> ok
17:32:22*Jesin quit (Quit: Leaving)
17:32:39FromGitter<Clyybber> @TheLemonMan I succeeded
17:33:55FromGitter<Clyybber> Interestingly in a proc it doesn't crash the compiler: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9d4283b9531f2dfa6fff65]
17:35:47FromGitter<bung87> weird case...
17:35:52FromGitter<Clyybber> Yep
17:36:23FromGitter<Clyybber> A ```ptr type num``` doesn't make a whole lot of sense
17:39:43*Jesin joined #nim
17:43:04*halirc quit (Ping timeout: 246 seconds)
17:48:33*Roedy6 joined #nim
17:51:19*Roedy6 quit (Remote host closed the connection)
18:04:31*demotomohiro joined #nim
18:04:38Araq[0: 2] is a valid array literal iirc
18:08:37def-I see someone is having fun on the Nim wiki article and replaced all mentions of "compile" with "transpile". Description of the change is "Nim is transpiled, Not compiled, stop lying" :D
18:10:46Araqdef-, thanks for pointing it out
18:11:03dom96lol nice
18:11:11FromGitter<Clyybber> @Araq Notice that `num` is a type
18:11:28AraqClyybber: yeah, a type is obviously not valid here
18:11:36FromGitter<kayabaNerve> Yo Ara
18:11:41FromGitter<kayabaNerve> *Araq
18:12:16Araqdef-, er, my wiki skills are not good enough to find a list of changes
18:13:10dom96I undid it
18:13:25Araqdom96, thanks, also report the user to github's admins
18:13:37dom96github?
18:13:47dom96It's an IP address anyway
18:14:01dom96Hrm, not sure when the "Transpiler" section popped up
18:14:02Araqer
18:14:22Araqwhat article are we talking about?
18:14:32Araqgithub's wiki? wikipedia?
18:14:49miranwikipedia
18:14:49FromGitter<Clyybber> Githubs wiki
18:14:54def-https://en.wikipedia.org/w/index.php?title=Nim_(programming_language)&diff=859682685&oldid=859682234
18:14:56dom96Oh i see.
18:15:05FromGitter<Clyybber> Nvrmind
18:15:14def-Also now references Rust as an influence: https://en.wikipedia.org/w/index.php?title=Nim_(programming_language)&diff=859682820&oldid=859682685
18:15:22dom96I undid it all
18:16:02dom96if it continues we can ask Wikipedia admins to lock it]
18:16:26Araqlock it already and report the user
18:17:11miranoh oh, look at other contributions from the same IP
18:17:22miranremoving mentions of Nim on other articles
18:17:53def-Removing mentions of Nim everywhere on Wikipedia
18:18:10miranok, somebody is very hurt by nim. Araq what did you do to him? :D
18:18:45dom96oh :(
18:18:48dom96That really sucks :(
18:19:02AraqI did nothing.
18:19:38miranAraq: are you sure you didn't offend somebody? :D c'mon man, we all know you :P
18:19:48dom96miran: Hey, that's not nice.
18:20:01FromGitter<Clyybber> @miran It is not Araq's job not to offend people
18:20:01miran(i'm joking, if that's not obvious)
18:20:11FromGitter<Clyybber> Oh,
18:20:22dom96Even if it's a joke, it's still not nice.
18:20:24FromGitter<Clyybber> well :D
18:20:27miran@Clyybber don't worry, i'm on his side :)
18:20:34Araqeven if I did that's no reason to go into troll beserker mode
18:21:26Araqshouldn't there be a review process on Wikipedia article changes?
18:21:37def-only if an article had previous vandalism
18:21:51dom96well, I asked in #wikipedia
18:22:07mirandom96: Araq: sorry, i really didn't mean anything bad, just a (bad) joke, really
18:22:11def-https://en.wikipedia.org/wiki/Wikipedia:Reviewing_pending_changes
18:22:42Araqdon't worry, miran, it's fine. I know I can hurt people by being right.
18:22:48dom96miran: It's okay. I just wouldn't like to be known as someone who offends people, even if it's a joke. I think Araq might feel the same.
18:22:54FromGitter<kayabaNerve> Anyone here know what folder the operator overloading (specifically =) tests are under?
18:23:03Araqdestructor/
18:23:07FromGitter<kayabaNerve> Well. I'm sure someone knows. Anyone gere mind telling me?
18:23:08FromGitter<kayabaNerve> Thanks
18:23:15mirandom96: heh, i thought Araq enjoys that reputation :)
18:23:21TheLemonManmany enemies, much honor
18:23:37Araqmiran, I don't really care tbh. :-)
18:25:11FromGitter<Epictek> "(Nim is transpiled, Not compiled, stop lying)" wowie
18:26:09dom96mod in #wikipedia rolled back their other changes
18:26:10dom96:)
18:26:16FromGitter<kayabaNerve> Araq So the tests seem to fail.
18:26:43Araqλ tt destructor
18:26:43AraqPASS: tatomicptrs.nim C (2.15376067 secs)
18:26:43AraqPASS: tcustomseqs.nim C (1.10206389 secs)
18:26:43AraqPASS: tcustomstrings.nim C (0.93250632 secs)
18:26:43AraqSKIP: tdestructor.nim C
18:26:44AraqPASS: tdestructor3.nim C (0.92104244 secs)
18:26:46AraqPASS: tmove_objconstr.nim C (0.98786497 secs)
18:26:46FromGitter<kayabaNerve> Sorry. Let me declare the topic. The tests that exemplify the overloading of = for a Generic.
18:26:48AraqPASS: topttree.nim C (0.91057825 secs)
18:26:50AraqPASS: turn_destroy_into_finalizer.nim C (1.16489625 secs)
18:26:53TheLemonMando we really align parameters to the opening brace in stdlib?
18:27:07FromGitter<kayabaNerve> They don't fail in that sense.
18:27:10dom96Araq: pastebin
18:27:16FromGitter<kayabaNerve> I'm saying the declared = overload don't work.
18:27:41Araqdom96, the next time.
18:27:49FromGitter<kayabaNerve> In `tatomicptrs.nim`, if you have the = operator print something distinct, you can see its never printed.
18:28:05FromGitter<kayabaNerve> Or at least on my compiler from the 11th. I should upgrade...
18:28:06dom96TheLemonMan: yes
18:28:16dom96It's certainly not done how you've indented it
18:28:34FromGitter<kayabaNerve> NVM. I messed up.
18:28:35FromGitter<kayabaNerve> Sorry.
18:28:40FromGitter<kayabaNerve> Trust in Araq, our BDFL.
18:29:25TheLemonManI indent my own code however the fuck I like, I just asked what the style for the stdlib was
18:30:01FromGitter<dm1try> I like hist style guide^
18:36:42FromDiscord<Shield> So I've found a way to release memory back to the system that should be useful for the sync file serving (and maybe async), creating a new thread to do the work will free the memory consumed by it without a problem, threadpool seem to not do that tho
18:37:10FromDiscord<Shield> now the question is, can you share a socket with a thread without breaking connection?
18:39:46Araqyes if you pass the raw socket handle
18:40:18Araqalso called "file descriptor"
18:42:49FromGitter<xmonader> @Araq I'm considering applying for the nim position but I really need to know before wasting your time ⏎ ⏎ ```Does it mean it's okay not to be experienced with type theory, c, c++``` [https://gitter.im/nim-lang/Nim?at=5b9d52a9a56b215c974230b3]
18:43:33FromDiscord<Shield> is it safe to use with asyncdispatch? i'll be more than happy if somebody can help with it
18:44:59Araqxmonader: yeah, I can teach you everything anyway
18:45:54FromGitter<xmonader> @Araq awesome! Thanks
18:49:06FromGitter<tim-st> what? my database handle does work without `threadvar` now, maybe it only fails when the server is started in global scope (what the examples show)
18:49:28FromGitter<tim-st> in global scope there always were compiler errors
18:58:33FromGitter<tim-st> no, it fails for `string` too, but not for my type `ptr Environment`, is this a nim bug or why is string not gcsafe and my type is?
19:00:24FromGitter<tim-st> nims string is ptr too: https://github.com/nim-lang/Nim/blob/0e33a8676e325fa4174893291ed41d59b689c577/lib/system.nim#L444 that's weird
19:03:19FromGitter<dm1try> https://nim-lang.org/docs/manual.html#threads-gc-safety
19:04:13FromGitter<dm1try> gc-safety it is about procs and related vars that tracked by GC, `ptr` is not tracked by GC by design I think
19:04:54FromGitter<tim-st> @dm1try thanks, makes sense
19:22:05FromGitter<tim-st> when I press f5 in browser more ram is used with my httpserver, is it possible that many request fill ram complete or does the server reject request at some level or is it task of nginx?
19:22:28FromGitter<tim-st> I currently dont have ngix in front
19:24:53FromGitter<Bennyelg> It so sad aws sdk package is not working
19:25:32FromGitter<Bennyelg> most of the companies today are working using google or amazon and interaction with them is top priority
19:28:58FromDiscord<Shield> tim-st did you try the workaround I suggested?
19:29:51FromGitter<tim-st> Shield: no where have you posted it?
19:32:25FromGitter<dm1try> I bet the workaround is kinda complicated :)
19:33:07FromDiscord<Shield> about the thread, if there is a way to create a thread to handle the request, when it ends it is guaranteed to free the memory
19:35:38FromGitter<dm1try> you should be able go down through the layers to get the raw socket handle/unregister it from dispatcher maybe if it is needed/do your job in other thread and then go to the top =)
19:36:09FromGitter<dm1try> if you are using httpserver from stdlib
19:36:27FromGitter<dm1try> I might be wrong on this
19:36:46FromGitter<tim-st> Shield: I dont think that works, the main server is running on a thread that never ends and the memory is received there at first step afaik
19:37:06FromGitter<tim-st> at least that's what I imagine
19:37:39FromGitter<tim-st> I mean it would work for each single thread but still the main thread is there that grows ram
19:39:44FromDiscord<Shield> my point is, you encapsule the things that eat ram into its own thread and let it terminate when you're done with them, like when you send a file, you make the file reading and sending within the new thread
19:42:04FromGitter<tim-st> yes, I understood that, but I think that has to be done from the thread where the server runs so the memory has to be copied somehow I think, but as long as the memory can get limit to a max size, the huge memory shouldnt be a problem, I'm just not sure if it's possible to set a limit
19:42:04FromDiscord<Shield> so far it seems impossible to use nim to serve files, multiple fast requests leads to a constant growing in ram usage without reusing it, restarting the server every now and then doesn't seem like a good solution, using threads can work but i'm not sure
19:43:42FromGitter<tim-st> You are talking about windows only? I have to say I have not tested this memory growing under linux with a webbrowser
19:44:40FromGitter<tim-st> I have the same fear that once my system is finished the server needs to be restarted each x days :D
19:45:20FromGitter<tim-st> I hope we can see some statistics about nimforum
19:47:29FromDiscord<Shield> better make an example and ask somebody on linux to run it, i'm also in fear that my application will just crash the system
19:48:05FromDiscord<Shield> even a simple image server will keep eating ram for me...
19:50:09FromGitter<tim-st> I think the best is if we can get some nimforum statistics, it runs linux I think, and with asynchttpserver, I read that it needs to be restarted once a month or so, it would be good to hear the reasons
19:54:38FromGitter<dm1try> solutions from Ruby world: puma-killer, unicorn-killer, ...-killer, + heroku reloads yours dyno for you once a day =)
19:55:05FromGitter<tim-st> they do this really?
19:56:50*PrimHelios joined #nim
19:56:53FromGitter<dm1try> "Dynos are also restarted (cycled) at least once per day to help maintain the health of applications running on Heroku. " https://devcenter.heroku.com/articles/dynos
19:59:36FromGitter<tim-st> hm, maybe doing this once a day to a time where not much traffic is will solve the problem
19:59:38*krux02 joined #nim
20:01:23FromGitter<tim-st> is this tutoria enough? shouldnt it be needed to block incoming traffic on nim http server via iptables? https://github.com/nim-lang/nimforum/blob/master/setup.md
20:01:54*miran quit (Ping timeout: 244 seconds)
20:05:43AraqI've said it before. I can look into the leaks once you give me a program that is somewhat reasonable
20:08:55FromGitter<tim-st> ok, thanks, I will test it on linux better and try to find patterns before
20:12:19Araqand as I said it before, not sending the data with a fixed buffer size immediately creates a DoS attack vector
20:13:52FromGitter<tim-st> what does fixed buffer size mean?
20:14:05FromGitter<tim-st> is it the content-length?
20:19:05FromGitter<dm1try> deploy first, then we'll talk =) while testing some scripts uploaded here I found that `markAndSweep` gc has more predictable behaviour vs default gc in sense of allocation/deallocation(but it still on my list for the investigation)
20:19:59FromGitter<dm1try> obvious leaks were not found
20:20:20FromGitter<tim-st> yes, in worst case I will restart once a day
20:23:27FromDiscord<Shield> tim-st please keep me updated if you run it on linux
20:24:01FromGitter<tim-st> ok
20:25:04FromGitter<tim-st> I already tested a minimum example that didnt work good on windows, on linux the occupied memory was stable, but I think the total amount (allocated memory that is not used) is too high
20:25:12*Vladar quit (Remote host closed the connection)
20:25:28FromGitter<tim-st> but I will test it again maybe tomorrow
20:31:53FromDiscord<Shield> araq, i'm not sure what do you mean by a reasonable program, while reading large files to memory at once doesn't seem like a good idea, but it doesn't make sense to split an image file for example, it should be served whole, i think the question would be how fast can the gc reuse memory
20:32:31*tefter joined #nim
20:32:41FromDiscord<Shield> so far threads free their memory without problem but it's hard to use any current framework with that approach
20:34:07*kapil___ quit (Quit: Connection closed for inactivity)
20:45:45*SenasOzys quit (Remote host closed the connection)
20:47:10*SenasOzys joined #nim
20:48:07*akiman20 joined #nim
20:50:50*akiman20 quit (Remote host closed the connection)
20:56:43FromDiscord<Shield> I tried a minimal example with node.js serving a 10mb string, it works fine, only taking memory depending on the numbers of requests and free it when it's done sending
20:57:29AraqI tried a minimal Nim example serving 40mb files and got no leaks. Now what
20:58:30Araqand any approach that depends on Nim giving memory back to the OS seems flawed to me
20:58:48Araqyou required the memory once, you might require it again
21:01:29Araqand yeah, even when serving images, you better stream anything larger than X MB.
21:01:51Araqespecially if your "server" has a limited amount of RAM and swap disabled
21:01:55ldleworkNim programs releasing memory is a flaw. Hmm.
21:02:38Araqldlework, polemic is not a substitute for an argument. Hmm.
21:03:26ldlework1. a strong verbal or written attack on someone or something.
21:03:28ldleworkerm
21:03:39FromDiscord<Shield> i think the problem is that the gc isn't reusing memory fast enough, it leads to each request allocating new memory, a server would be dealing with handreds of requests if not more, even serving a less than 1mb image would lead to massive ram usage
21:04:19FromDiscord<Shield> not freeing memory back to the os if fine as long as you provide a workaround that isn't "buy more ram lol"
21:04:20Araqldlework, ok you win, I picked the wrong word.
21:05:08TheLemonManwhat about "download more ram lol" ?
21:05:44TheLemonManhttps://downloadmoreram.com/ is always there for your big data™ needs
21:05:44shashlickI appreciate the requirement @Shield but you need to provide a simple failing example
21:07:00shashlickIf the gc isn't reusing memory that it should then that's something that can be pursued
21:07:29FromDiscord<Shield> shashlick you're free to use tim-st's snippet since the example shouldn't rely on any framework
21:07:29FromDiscord<Shield> https://gist.github.com/tim-st/abbb86a591172a7b997c853fcda5cff9
21:08:11*smt joined #nim
21:08:12Araqthat snippet uses 'sockets' which is deprecated and does not reproduce any leak for me
21:08:28AraqI'm asking for a better one
21:10:04FromDiscord<Shield> is asyncdispatch out of question too?
21:10:22AlexMaxHey shashlick! I made good progres last night, but ran into https://github.com/nim-lang/c2nim/issues/131
21:10:51Araq"out of question"? no, you should use it.
21:10:57AlexMaxI'm assuming I can just modify the config and add "struct" to the importc's...though that regex might be a little big :P
21:11:27FromDiscord<Shield> okay then
21:44:49zestyrAraq: is there a simple solution in the stdlib that lets you stream files instead of loading them into memory?
21:45:04zestyrhttpclient's "post" doesn't support FutureStream
21:46:08FromDiscord<Shield> can browsers stream images for example?
21:48:01zestyrShield: I managed to lower the memory overhead further btw, with a 50MB it now peaks at 100MB using markAndSweep, instead of around 300 MB. I can make a new gist if you want
21:50:10shashlickAlexMax: is that in many places
21:50:46FromDiscord<Shield> please do, i'm running some test now
21:52:47zestyrAlright. Same disclaimer as before, it's very ugly and probably shouldn't be used for anything serious, but without support for streaming files this is useful as a temporary hack
21:52:49zestyrhttps://gist.github.com/zestyr/22b187cab89e762cfd9ad3f90691cbb1
21:53:02AlexMaxshashlick: Only about 103
21:53:05AlexMax:P
21:53:34AlexMaxI was hoping I could maybe search on "header: headernuklear, bycopy" which appears to be used for all structs
21:53:44AlexMaxBut the line sometimes splits
21:54:40AlexMaxand I'm not sure if that's 100% of structs
21:55:49*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
21:58:44FromDiscord<Shield> thanks zestyr
21:59:19zestyrnote that this only works on linux, uses the posix module
21:59:27AlexMaxSo I think for now, the best appraoch is something like
21:59:28AlexMaxregex.33 = "importc: \"(nk_(?:buffer|allocator))\""
21:59:28zestyrcould probably make it use readbuffer or whatever
22:02:51FromDiscord<Shield> this is just bizzare, converting tim-st example to asynsockets works fine, it does eat 110mb to send a 10mb file, but it's stable, sending 40mb file eats about 500mb
22:04:27FromDiscord<Shield> why did tim-st example cause the same problem as mofuw tho, using mofuw I tried to serve a webpage of about 800kb, it kept eating ram until it was about to fully saturate it before I stopped the program
22:05:49*nsf quit (Quit: WeeChat 2.2)
22:09:03*cyraxjoe quit (Quit: No Ping reply in 180 seconds.)
22:09:26FromDiscord<Shield> zestyr can you help me with a way to pass the socket between threads and let the thread handle the sending? if it can be done, then ram can be freed
22:10:15*cyraxjoe joined #nim
22:11:39zestyrShield: have you tried using channels? I haven't played with sockets yet
22:12:04dom96Shield: what's the use case?
22:12:13*Pisuke quit (Ping timeout: 246 seconds)
22:12:31*Sembei joined #nim
22:15:07shashlick@AlexMax: basically, every importc which has bycopy in the line should get replaced to "struckt nk*"
22:16:43FromDiscord<Shield> I wanna know the proper way to use a socket in a new thread once you pass the file descriptor
22:17:35*kapil___ joined #nim
22:20:35FromDiscord<Shield> the main thread will be some sort of a watcher, restarting the other thread and such, so far the server will take 10x the biggest file size and keep that memory even if such file no longer exists
22:23:41dom96Shield: the proper way is don't use threads unless you have a use case that requires them
22:25:00dom96Is there a reason why using async won't work?
22:29:51FromDiscord<Shield> it's more of "memory can't be freed once allocated" kind of issue
22:31:30*_brainbomb_ joined #nim
22:34:49dom96Let's fix the leaks instead of working around them by messing with threads
22:38:09*_brainbomb_ quit (Quit: Leaving.)
22:39:46*cyraxjoe quit (Read error: Connection timed out)
22:39:50FromDiscord<Shield> well it's not a leak, serving a big file once will lead to keeping that memory thinking it may be used again when there's a high chance it won't
22:41:01*cyraxjoe joined #nim
22:41:40FromDiscord<Shield> by the way, using GC_fullCollect right after sending the file will lead to a stable 277mb instead of 530mb for a 40mb file
22:42:26FromDiscord<Shield> it won't be that bad for an image server at least
22:43:01dom96That sound excessive, we need to fix that.
22:43:16dom96If it happens when a file is served it sounds like the reproduction is easy
22:43:20dom96Why not report it?
22:49:01FromDiscord<Shield> well this is a minimal example https://pastebin.com/FEQ6RwVT
22:50:48FromDiscord<Shield> it may be the "&" operator making more copies tho, and as Araq said, once the memory is requested from the os it's hard to give it back
22:54:31dom96I'll chat with Araq about it
22:54:33dom96good night
22:58:33FromDiscord<Shield> good night
23:07:48*arecaceae quit (Remote host closed the connection)
23:08:07*arecaceae joined #nim
23:09:50*rockcavera quit (Remote host closed the connection)
23:12:05*elrood quit (Quit: Leaving)
23:14:06FromGitter<DanielSokil> Why does this throw a ValueError? ⏎ ⏎ ```{ ⏎ "Antelope (Blackbuck)": { ⏎ "LifeSpan": "15" ⏎ } ⏎ }``` [https://gitter.im/nim-lang/Nim?at=5b9d923e3b7e6c2edd21f073]
23:23:35FromGitter<Vindaar> @DanielSokil because of the extra `"` around the 15
23:24:43FromGitter<Vindaar> during parsing of the json it is therefore not parsed as a `JInt`, but a `JString`. So when converting back to a string it still has those `"` around it. And that's not allowed for `parseInt`
23:30:37FromGitter<Vindaar> It's a little subtle, because the `$` operator for json doesn't retrieve the contained string in the `JsonNode`, but rather converts it to a string representation
23:31:04FromGitter<Vindaar> If you can be sure it's always going to be strings, you can replace the `$` call by a call to `getStr`, then the conversion won't have those `"` around
23:31:44FromGitter<Vindaar> (by conversion to string representation I mean as a JSON like string)
23:36:39AlexMaxMan
23:36:43AlexMaxGot through all that regex
23:36:47FromGitter<DanielSokil> @Vindaar That's what I was looking for, Thank you.
23:36:59AlexMaxNow gcc is dying on something that I am totally baffled by
23:37:03AlexMaxSome internal thing
23:38:02*cspar quit (Quit: Leaving)
23:40:42AlexMaxhttps://paste.ee/p/XZ5pA
23:46:26AlexMaxoh god I am totally lost