<< 06-09-2018 >>

00:01:10*Serenitor joined #nim
00:03:35*Jesin joined #nim
00:09:20*Notkea quit (Remote host closed the connection)
00:15:28*Serenitor quit (Quit: Leaving)
00:15:53*leaf__ quit (Quit: Page closed)
01:00:33*noonien quit (Quit: Connection closed for inactivity)
01:07:51*Yardanico quit (Ping timeout: 252 seconds)
01:21:54*Yardanico joined #nim
01:25:13*Yardanico quit (Client Quit)
01:28:49*ryanhowe joined #nim
01:39:57*ryanhowe quit (Read error: Connection reset by peer)
01:49:07FromGitter<gogolxdong> Does NEP-1 apply to nimsuggest or nimpretty?
01:54:01FromGitter<gogolxdong> How to keep lines no longer than 80 characters? How to change them if they are rather than manual edit?
02:11:13*abm quit (Read error: Connection reset by peer)
02:19:11FromDiscord<treeform> sagax, % and c %, can be confusing when dealing with negative numbers. if you run into issues use this: https://gist.github.com/treeform/51db7a31b1bb64daf5bdb662a9b8e6c8
02:19:47FromDiscord<treeform> https://stackoverflow.com/questions/1907565/c-and-python-different-behaviour-of-the-modulo-operation
02:19:56FromDiscord<treeform> https://www.rapitasystems.com/blog/ada-c-rem-and-mod
02:22:51*Yardanico joined #nim
02:24:45FromDiscord<emekoi> is the nim `mod` a mathematical mod or is it the remainder?
02:25:37FromDiscord<treeform> I think nim's mod is the engineering mod while python's mod is the mathematical mod.
02:25:52FromDiscord<treeform> but they are both called mod and rem in different languages...
02:26:05FromDiscord<treeform> It really depends on number system you have to deal with
02:38:45*endragor joined #nim
02:43:21*endragor quit (Ping timeout: 252 seconds)
02:57:15*endragor joined #nim
02:58:34*dddddd quit (Read error: Connection reset by peer)
03:05:16zachcarteris there a way to get the value of a const inside a macro?
03:05:46zachcarterfrom within an untyped block?
03:05:51zachcarterI just have the ident
03:14:36*Yardanico quit (Ping timeout: 252 seconds)
03:20:10Tangerzachcarter, Would the typeVal procs work? ie floatVal, boolVal etc?
03:21:52zachcarterI think I figured it out
03:27:39TangerWhat was the deal?
03:29:35FromGitter<gogolxdong> compiler set MaxLineLen = 80, codes write by macro implements the rule No.1 of NEP-1 ,but doesn't go further along with it. Like alignment of tuple, proc definition and call of Conventions for multi-line statements and expressions.
03:30:40zachcarterTanger: still working on it :/
03:36:44FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b90a0cce5b40332ab4fa4c5]
03:41:33FromGitter<gogolxdong> there are two lines longer than 80 characters ,have no idea why it can even though written by compiler, alignment of seq is not clear , the alignment of tuple shows alignment right at the first character in the same seq.
03:42:44FromGitter<gogolxdong> in the same bracket.
03:50:07*Yardanico joined #nim
03:55:19*cspar joined #nim
05:01:47FromDiscord<emekoi> if your object has a destructor and you create a `ref` to it, is the destructor run when your `ref`'s ref count reaches 0?
05:36:19*nsf joined #nim
06:05:33*leorize quit (Quit: WeeChat 2.2)
06:12:08FromGitter<codem4ster> there is an example in streams module; ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ but there is no readLine proc in streams. How can I read a file line by line without getting all the file to the memory? [https://gitter.im/nim-lang/Nim?at=5b90c538c9500b4bab8cbb32]
06:21:25FromGitter<codem4ster> I made it with open(), discard my question. But `fs.readLine(line)` is not working on this example. May be we can consider correct the example.
06:25:41sagaxwow
06:25:49sagax% it's like as "mod"
06:25:52sagax% it's like as "mod"
06:25:55sagax"%" it's like as "mod"
06:26:02sagaxhm
06:26:08sagaxi type % twice
06:26:20sagaxbut see only one %
06:26:38sagaxok, twice % it like as "mod"
06:48:03FromGitter<narimiran> sagax: it is not the same
06:48:18FromGitter<narimiran> try `-3 mod 4` and `-3 %% 4`
06:49:32FromGitter<kayabaNerve> !eval echo (-3 mod 4)
06:49:35NimBot-3
06:49:47FromGitter<kayabaNerve> !eval echo (-3 %% 4)
06:49:50NimBot1
06:49:55FromGitter<kayabaNerve> ABS value?
07:10:20FromGitter<narimiran> i have two `var` HashSets, let's call them `a` and `b`. i cannot do `(a - b).pop()`. the error says `'a - b' is immutable`. is this the intended behaviour? (cc @Araq)
07:16:38*leorize joined #nim
07:17:05*Senketsu quit (Quit: WeeChat 2.2)
07:20:02*Senketsu joined #nim
07:30:13*Vladar joined #nim
07:35:25*PMunch joined #nim
07:35:57*Senketsu quit (Quit: WeeChat 2.2)
07:40:15*Senketsu joined #nim
07:41:43*Senketsu quit (Client Quit)
07:45:01*Senketsu joined #nim
07:50:47FromGitter<mratsim> because `a - b` gives you a new HashSet
07:51:24FromGitter<mratsim> you would need to do something like `a -= b; a.pop()`
07:52:55FromGitter<mratsim> `a - b` expression is a rvalue: a temporary that needs to be assigned or passed to a proc for further computation. (Rvalue because it lives on the right side of the assignment).
07:54:06*Senketsu quit (Quit: WeeChat 2.2)
07:58:18FromGitter<codem4ster> how can I add a string to a global seq in a thread? I tried like this without luck; ⏎ part of the code like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b90de1ac2bd5d117a2854ef]
07:58:28*Senketsu joined #nim
07:59:04FromGitter<codem4ster> I want to add a word to foundWords in a thread
08:00:05FromGitter<codem4ster> but it gives `wordGenerator.nim(18, 6) Error: 'hasTdkWord' is not GC-safe as it accesses 'foundWords' which is a global using GC'ed memory` in compile time
08:02:12FromGitter<codem4ster> and I tried this with threadpool before but spawn with a parallel never created a new thread they're working just linear.
08:03:04*gmpreussner quit (Ping timeout: 240 seconds)
08:03:53*gmpreussner joined #nim
08:06:40zachcartercodem4ster - use channels or shared heap
08:06:51FromGitter<mratsim> @dom96 Should I delete spam account or keep them as spammer or banned on the forum?
08:07:20FromGitter<mratsim> It’s for hongwei284h
08:07:45FromGitter<narimiran> thanks @mratsim
08:08:24FromGitter<mratsim> @codem4ster Use ptr to the seq.
08:22:05FromGitter<codem4ster> @zacharycarter how can I turn this pointer into a seq for adding data into it
08:22:59FromGitter<codem4ster> @zacharycarter is there an example?
08:24:21FromGitter<mratsim> use `ptr seq` and dereference
08:24:39FromGitter<mratsim> but you might have GC conflicts.
08:25:13FromGitter<narimiran> !eval echo (-10 mod 5), (-10 %% 5)
08:25:15NimBot01
08:25:27FromGitter<mratsim> For shared data structure it’s much safer to preallocate and never use `add`
08:25:48FromGitter<mratsim> because if you go over the reserved space, the GC will move everything
08:26:03FromGitter<mratsim> and your pointer will point to garbage
08:26:04*xet7 joined #nim
08:26:33FromGitter<mratsim> (that’s exactly what Rust means by fearless concurrency)
08:26:59FromGitter<codem4ster> will locking prevent these situations?
08:27:05FromGitter<mratsim> no
08:27:47FromGitter<mratsim> you would need to keep the pointer on each thread in sync with the real seq location
08:28:03FromGitter<codem4ster> and I already make prt seq, but I cannot use pointer as seq. I need to convert it to seq again, but I dont't know how to do that
08:28:23FromGitter<mratsim> `a[]` <— that’s the dereference operator
08:29:05FromGitter<codem4ster> > you would need to keep the pointer on each thread in sync with the real seq location ⏎ how can I do this?
08:31:39FromGitter<codem4ster> if so, what is the purpose of this; https://rosettacode.org/wiki/Mutex#Nim
08:32:48PMunchLocks are only to assure only one thread accesses shared variables at the same time
08:35:42PMunchThe issue here is that a sequence in Nim is just a malloced piece of memory. When you add something and it doesn't have room for it it will realloc the entire thing, possibly moving the entire seq somewhere else in memory. In Nim each thread has it's own thread-local GC and so it can't access memory managed by another threads GC. So if you start a thread and want to add something to a sequence you essentially try to add the string (which is GC'ed by the
08:35:42PMunchthread) to a sequence GC'ed by the main thread. This would cause all kinds of complexity. The best option is probably to use a channel and have the main thread listen on that channel and add everything that comes along on it to the sequence.
08:37:21PMunchAnother option is to have a shared pointer to the sequence, but every time you want to add something on the sequence you must ensure that this pointer is updated (and I'm not sure how that would handle strings, if it would handle them at all).
08:39:07FromGitter<mratsim> @codem4ster I’m pretty sure that’s PhD thesis research material and why Araq choose to go with thread local GC
08:39:27FromGitter<mratsim> Global GC are probably much more complex beasts with lots of corner cases
08:40:23*stefanos82 joined #nim
08:40:49FromGitter<mratsim> and also those kind of bookkeeping are why GCs are slow in other languages.
08:41:46FromGitter<mratsim> so I see 3 solutions: ⏎ ⏎ 1) Channels ⏎ 2) thread local seq that you merge at the end ⏎ 3) Preallocating [https://gitter.im/nim-lang/Nim?at=5b90e84a1d3a5711b6f0f5d6]
08:41:59PMunchThere are ways around the string problem by the way, for example: https://gist.github.com/aboisvert/0791b53e492ebc4020c4e1cc049d539d
08:42:22PMunchmratsim, how does preallocating work with strings?
08:42:36PMunchCan a thread add a string to let's say an array?
08:43:29FromGitter<mratsim> I don’t like strings, my libraries don’t use strings at all ;). Problem solved.
08:43:59PMunchHuh, there even is a sharedstring implementation built in: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sharedstrings.nim
08:44:20PMunchAnd a shared list for that matter: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sharedlist.nim
08:45:31PMunchI wish there was a way to have read-only access to a static shared resource in threads
08:45:45FromGitter<codem4ster> oh, very much thanks for lot of information. :) You are great. I will look at channels then. I think this shared memory things are a bit much for me.
08:46:04PMunchE.g. build a table of data, spawn threads that read from table.
08:46:27PMunchcodem4ster, I've been thinking of writing something about concurrency in Nim
08:46:35PMunchBut I'm hardly an expert on the subject myself
08:47:32PMunchWell I guess there is this: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sharedtables.nim
08:47:56FromGitter<mratsim> @PMunch that’s parallelism here ;)
08:48:42PMunchYeah I've given up on those terms. Think I asked the professor about three times about what the difference was and he couldn't give me a good answer..
08:49:14FromGitter<mratsim> https://cdn-images-1.medium.com/max/409/1*_4B2PKsJn9pUz3jbTnBnYw.png
08:50:35PMunchAh, that makes it a bit clearer
08:50:38FromGitter<mratsim> concurrency is about interleaving on the same hardware thread. Parallelism is about distributing on the same hardware thread
08:51:05*leorize quit (Quit: WeeChat 2.2)
08:51:07FromGitter<codem4ster> @mratsim is there any simple example with channels? Cannot found a proper one :(
08:51:08FromGitter<mratsim> Concurrency is very useful for IO, because the CPU is idle when waiting for IO
08:51:45FromGitter<codem4ster> that's why nodejs is faster than java in IO operations :)
08:52:34FromGitter<mratsim> tbh, I’m not a channel expert (or a concurrency expert) I understand the challenges but that’s all :/
08:53:10FromGitter<mratsim> this is relevant but it’s more about someone struggling in 2015: https://forum.nim-lang.org/t/959
08:53:24FromGitter<mratsim> maybe scouring gists/github
08:54:16*seni joined #nim
08:54:40FromGitter<mratsim> and check what this beginner is doing, he recently asked about channels and seems like he unstuck himself: https://github.com/nais314/stui/blob/b9c44615929e6bbd3c428fdae5a46901cde2fbac/mainloop.inc.nim
08:54:48PMunchcodem4ster, it's pretty simple. Create a globally scoped Channel type variable (with T being the type you want to send over it), then in your thread use "mychannel.send(<data>)". And in the main thread do "myChannel.open(<max number of units before waiting>); spawn threads; read from channel
08:57:15FromDiscord<2vg> concurrency is fun x)
08:58:20FromGitter<Bennyelg> Where can I see how much threads nim opened ?
09:00:43FromGitter<codem4ster> In Nim you must create your threads into an Thread[T]. And you will probably need to attach them to an array. You can count running threads in this array.
09:09:41PMunchcodem4ster, here is an example of threads for you: http://ix.io/1m5b/Nim
09:10:28PMunch(By the way if you want to copy from ix.io without line numbers simply remove the "/Nim" part of the link: http://ix.io/1m5b
09:10:31PMunch)
09:15:30*rockcavera quit (Ping timeout: 252 seconds)
09:16:55FromGitter<Bennyelg> (https://files.gitter.im/nim-lang/Nim/2upM/image.png)
09:16:57FromGitter<Bennyelg> presto in action
09:26:42PMunch@codem4ster ^
09:26:54PMunchDoes the irc bot translate highlights properly?
09:27:07PMunchOr do you still have to use @ when talking to people on Gitter?
09:28:25FromGitter<mratsim> need @
09:29:59PMunchAight
09:30:38PMunchThat's the most annoying thing on the IRC->Gitter bot. You can't tab complete user names, and highlighting doesn't work properly..
09:35:45PMunchCould the IRC bot theoretically create a new user per user on Gitter?
09:59:15*abm joined #nim
10:08:00FromGitter<codem4ster> @PMunch thanks for the code I was at lunch. gitter complete user names if you start typing with @
10:09:25PMunchYeah I know Gitter does it, but I can't complete your Gitter name on IRC
10:09:32PMunchBecause all of you are named FromGitter :P
10:10:14PMunchI remember at some point a guy on Gitter thought that someone on IRC was a bot :P
10:16:25livcdnim-forum feels slower on ff nightly
10:28:48*zachcarter quit (Ping timeout: 272 seconds)
10:30:47FromGitter<Bennyelg> reuse of jobs which done their job is done
10:31:35sagaxhelp me understand this http://susepaste.org/77910319
10:32:01sagaxwhere i can read about % vs mod
10:32:04sagax?
10:32:15sagaxdouble % vs mod
10:36:54*dddddd joined #nim
10:36:58*xet7 quit (Quit: Leaving)
10:37:03FromGitter<narimiran> sagax: `%%` treats numbers as unsigned, and this produces 'confusing' results
10:37:26FromGitter<narimiran> if you want python-like behaviour, i use `a % b + b`
10:37:36FromGitter<narimiran> oops, i meant `a mod b + b`
10:38:49FromGitter<narimiran> this is for negative numbers, where you want/expect `-10 % 3 == 2`
10:43:53sagaxthanks
10:44:11sagaxwe have iterator with syntax .. example 0..10
10:44:31sagaxbut with this syntax we have 11 number
10:44:49sagaxwe have syntax like as ... example 0...10 ?
10:45:00FromGitter<narimiran> use `0 ..< 10` if you want to exclude higher limit
10:45:12sagaxyes, exclude
10:48:36*xet7 joined #nim
10:55:59FromGitter<codem4ster> @PMunch channels works great thanks for your helps :)
11:01:42PMunch@codem4ster, no problem :)
11:18:04*kapil___ joined #nim
11:26:52*rockcavera joined #nim
11:53:42*noonien joined #nim
11:56:46FromGitter<alehander42> man sympy is huge
11:57:20FromGitter<alehander42> I hoped to port the most important stuff in it
11:57:54FromGitter<alehander42> but it has so many additional modules
11:58:06stefanos82you mean simpy
11:58:31FromGitter<alehander42> No, sympy
11:59:08stefanos82you mean the actual sympy.org?
11:59:42stefanos82lol I have confused it with nimpy @alehander42
12:00:07FromGitter<alehander42> ha I didn't know about simpy
12:00:14FromGitter<alehander42> Well it's not my domain haha
12:00:20FromGitter<alehander42> Problem domain
12:00:39FromGitter<alehander42> Oh yeah nimpy is its own beast
12:01:10stefanos82so you are dealing with math?
12:03:09FromGitter<alehander42> well I have a bit more experience with it compared to signal processing
12:05:19stefanos82signal processing is an amazing topic to invest time in it
12:05:30stefanos82especially video processing
12:09:43FromGitter<alehander42> it sounds intriguing
12:10:06FromGitter<alehander42> why is it so fascinating
12:18:03stefanos82because it's a category that can open so many doors for job opportunities and advanced research topics
12:18:20stefanos82audio processing, image / video processing
12:18:29stefanos82there are so many things you could do with it
12:19:41stefanos82from medical research to NASA sophisticated projects
12:20:09FromGitter<alehander42> I see
12:20:32FromGitter<Aaron-JM> hey
12:20:38FromGitter<alehander42> I have to read more about it, no idea what do they use
12:20:41*leorize joined #nim
12:20:47FromGitter<alehander42> Hello Aaron
12:21:02stefanos82@alehander42: ffmpeg is one of such projects
12:21:26stefanos82mplayer, mpv, VideoLAN as well
12:37:51*regtools_ quit (Quit: leaving)
12:38:02*regtools joined #nim
12:43:35*leorize quit (Quit: WeeChat 2.2)
13:08:31*endragor quit (Remote host closed the connection)
13:20:56FromGitter<Grabli66> Hi! Is there a procedure for finding max for seq[int] ? I don't see any. Only for openarray in module system
13:23:00FromGitter<Vindaar> Hey @Grabli66! `openArray` is just a combined type of `seq` and `array` basically. So any proc taking `openArray` also takes `seq`
13:23:55FromGitter<Grabli66> Ok. It works :)
13:26:45*endragor joined #nim
13:30:47*endragor quit (Ping timeout: 240 seconds)
13:44:45*endragor joined #nim
13:54:11*craigger_ quit (Quit: bye)
13:54:28*craigger joined #nim
14:11:09*Perkol joined #nim
14:17:36FromGitter<Araq> hmm I hope you guys don't mind yet another compiler API breakage...
14:18:13FromGitter<Araq> I'm adding distinct strings for AbsoluteFile, RelativeDir etc. I'm tired of getting the compiler's path handling wrong all the time...
14:18:42FromGitter<Clyybber> What would it be?
14:19:35FromGitter<Clyybber> @Araq What would it be?
14:20:08FromGitter<Araq> as I said, path handling is becoming typesafe
14:27:17FromGitter<Clyybber> I don't think anyone would have a problem with that...
14:33:50FromGitter<Araq> I might break Nimble and all other clients of the compiler API
14:33:53FromGitter<Araq> but we'll see
14:34:27FromGitter<Araq> the clarity is worth it, stringly-based code is so bad
14:39:09*PMunch quit (Quit: Leaving)
14:43:07euantorI quite like Rust's Path and pathBuf for a similar reason: https://doc.rust-lang.org/std/path/struct.Path.html
14:43:34euantorThough it still uses strings, having a little bit of safety on top is nice
14:47:09*kapil___ quit (Quit: Connection closed for inactivity)
14:47:25FromDiscord<treeform> I have no issues with paths... i think it will just introduce extra typing?
14:48:39FromGitter<Araq> well only the compiler is affected for now. but if the experiment is successful I'll push for a stdlib addition
14:49:47FromGitter<Araq> good that you mention Rust's Path. for now I consider it illdesigned
14:50:00FromGitter<Araq> I'm adding 4 different distinct string types
14:50:23FromGitter<Araq> as absoluteDir / absoluteFile makes no sense it shouldn't even compile
14:51:25FromGitter<Clyybber> How does it not make sense? I thought you want to add AbsoluteFile, AbsoluteDir (and RelativeFile, RelativeDir)?
14:56:39*leorize joined #nim
15:08:54*kapil___ joined #nim
15:09:44*tribly quit (Quit: WeeChat 2.2)
15:10:04*TheLemonMan joined #nim
15:12:02*tribly joined #nim
15:24:47FromDiscord<treeform> Has there been a change with now `new` works? I think before it required `new` before creating a `ref object` and now it does not?
15:26:16FromGitter<mratsim>  it does
15:26:38FromGitter<mratsim> either you use new or you use RefObject(field1: foo, field2: bar)
15:27:47FromDiscord<treeform> I think I did not know about the RefObject(field1: foo, field2: bar) case
15:56:11*nsf quit (Quit: WeeChat 2.2)
16:06:33FromGitter<Alan-FGR> hey guys, the basic math links are broken here: https://nim-lang.org/docs/lib.html#pure-libraries-math-libraries
16:07:37FromGitter<Alan-FGR> btw did the state of editors change in the past couple of years? last i checked editors weren't great, no refactor and such
16:07:55FromGitter<mratsim> @Alan-FGR, it works for me.
16:08:53FromGitter<mratsim> Regarding editors what do you expect them to do when refactoring? I like VScode. works great even when refactoring big codebases
16:10:24FromGitter<Alan-FGR> do these links work for you: https://nim-lang.org/docs/basic2d.html https://nim-lang.org/docs/basic3d.html ?
16:10:28FromGitter<Alan-FGR> I get server error here
16:11:20FromGitter<Alan-FGR> @mratsim well, maybe i should give it a try, is vscode the best nim editor currentl?
16:11:43FromGitter<mratsim> Arguably it’s that and Vim/Emacs
16:14:08FromGitter<Alan-FGR> also, when you do say `SomeCppObj = {.importcpp: "someClass"} = object` does that declare a nim object that holds and underlying cpp object? if so how is memory managed? fully manually?
16:19:54FromGitter<mratsim> no, you reuse the C++ struct
16:20:00FromGitter<mratsim> there is no holder object
16:21:32FromGitter<mratsim> If the C++ struct declaration includes destructor those will apply
16:23:55FromGitter<Alan-FGR> nice. thanks.
16:26:33FromGitter<mratsim> In terms of memory management: ⏎ ⏎ `type Foo = object` ==> Stack allocation, automatically managed ⏎ `type Foo = ref object` ==> Heap alloc, GC-managed ⏎ `type Foo = ptr object` ==> view, manually managed. You need to allocate the buffer manually. [https://gitter.im/nim-lang/Nim?at=5b915539ac25fd11b5edd1e1]
16:27:30FromGitter<Alan-FGR> wow, it's great that you have the option to manage memory manually!
16:27:45FromGitter<mratsim> and @Alan-FGR basic2D was deprecated in devel which may explain why it doesn’t get generated or something
16:28:07FromGitter<Alan-FGR> @mratsim so the link is broken for you too?
16:29:47FromGitter<mratsim> You can even choose the GC implementation: ⏎ ⏎ 1) default: ref counting ⏎ 2) markAndSweep: Java like mark and sweep GC (except that it doesn’t reserve 100+MB memory before running) ⏎ 3) boehm: Boehm GC ... [https://gitter.im/nim-lang/Nim?at=5b9155fbac25fd11b5edd549]
16:30:13FromGitter<mratsim> and ye the link is broken
16:30:17FromGitter<mratsim> yes*
16:32:11FromGitter<Alan-FGR> i'll make sure to give nim another try, thanks :)
16:32:26FromGitter<mratsim> @Alan-FGR https://nim-lang.org/blog/2018/03/01/version-0180-released.html ⏎ ⏎ Documentation bug
16:32:45FromGitter<mratsim> you should probably use GLM: https://github.com/stavenko/nim-glm
16:35:58FromGitter<Alan-FGR> oh boi :(
16:39:17*Trustable joined #nim
16:42:04*noonien quit (Quit: Connection closed for inactivity)
16:43:13FromGitter<mratsim> In short basic2D and basic3d were really too basic and people had to use GLM (for physics/graphics) or Neo/Arraymancer (for matrix/science) anyway.
16:43:36FromGitter<mratsim> you can still get those here: https://github.com/nim-lang/basic2d
16:43:47FromGitter<mratsim> https://github.com/nim-lang/basic3d
16:56:22*endragor quit (Ping timeout: 246 seconds)
17:10:58*erratic quit (Ping timeout: 272 seconds)
17:13:24*Perkol quit (Quit: Leaving)
17:17:11*kapil___ quit (Quit: Connection closed for inactivity)
17:37:51*Jesin quit (Quit: Leaving)
17:41:46*Jesin joined #nim
18:07:15*rockcavera quit (Remote host closed the connection)
18:10:51*PMunch joined #nim
18:11:49livcdI want to thank everyone in this small community for all the hard work and libs you guys create
18:11:57livcdJust realized how painful would it be without you
18:12:17PMunchHaha, yeah we often take libs for granted
18:13:02TheLemonManhey PMunch, did you finish your cocktail thingie?
18:13:28livcdPMunch: yeah
18:13:55livcdPMunch: i am not very good at reinventing the necessary pkgs. I would end up with barely working crap if I would do everything by myself
18:14:22PMunchTheLemonMan, well kind of
18:14:36PMunchIt works as I wanted, but it doesn't have any kind of interface
18:15:29TheLemonManthat's all that matters, interfaces are boring :P
18:15:37PMunchCurrently you just type into the script itself what you have and which categories you are interested in and how many ingredients you want to get and it will spit out lists of drinks you can make, list of drinks you can make if you by a list of ingredients, etc.
18:19:31*Notkea joined #nim
18:19:32*Notkea quit (Remote host closed the connection)
18:22:26livcdhmm do we have a way to read/write to boltdb ? :O
18:25:01FromGitter<mratsim> BoltDB is in go, so … if they provide a C API you can use c2nim or Nimgen
18:25:14FromGitter<mratsim> otherwise just use RocksDB
18:25:36livcdI dont think they do
18:25:47livcdI thought about rw existing boltdb files
18:36:48FromGitter<codem4ster> my threads leaking memory :(
18:37:15FromGitter<kayabaNerve> @codem4ster What's the app?
18:37:17FromGitter<codem4ster> VIRT memory is always increasing
18:37:49FromGitter<codem4ster> and it gives out of memory and shut down
18:37:58FromGitter<kayabaNerve> If it's a video game, just spawn an unkillable boss when the memory gets out of hand. ez
18:38:39FromGitter<codem4ster> it is a script which connects to a site and get multiple page content at the same time
18:38:49FromGitter<codem4ster> I have 8 active threads all the time
18:39:11FromGitter<kayabaNerve> Just erase the internet drivers when memory gets out of hand.
18:39:11FromGitter<kayabaNerve> ez
18:39:36FromGitter<codem4ster> hmm, so funny yes
18:40:28FromGitter<kayabaNerve> I thought so *shrugs*
18:41:28FromGitter<mratsim> do you only use seq and strings?
18:41:50FromGitter<mratsim> I suppose something keeps a reference to those even though they should be collected
18:42:57*stefanos82 quit (Quit: Quitting for now...)
18:46:05FromGitter<codem4ster> this is my thread: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9175edc9500b4bab911244]
18:46:18*Jesin quit (Quit: Leaving)
18:47:02FromGitter<codem4ster> it connects to a url make a check and if its true it sends data to a channel. If connection lost then it tries (at most 3 times).
18:47:34FromGitter<mratsim> your client.close() should be in a try finally or a defer: statement
18:47:36FromGitter<codem4ster> and this is the thread caller; ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b91764894f8164c17e9912e]
18:49:14*Jesin joined #nim
18:49:29FromGitter<codem4ster> @mratsim but the code reaches the client.close()
18:49:50FromGitter<codem4ster> always
18:50:57FromGitter<mratsim> regarding the leak, unfortunately I’m not that familiar with threads/httpclient. but you can print the GC statistics
18:51:47FromGitter<codem4ster> how can I print that
18:52:25*erratic joined #nim
19:00:54*Jesin quit (Quit: Leaving)
19:01:30FromGitter<tim-st> livcd: boltdb was inspired by lmdb and lmdb is available for nim and only has advantages over boltdb
19:04:15*Jesin joined #nim
19:17:50FromGitter<Araq> don't do this `for thread in threads:`
19:18:33FromGitter<codem4ster> how can I use a threadpool then
19:18:52FromGitter<codem4ster> a real threadpool not like Nim's :D
19:19:03FromGitter<Araq> Nim's threadpool is real.
19:19:16FromGitter<Araq> check how it iterates over the threads, at least.
19:19:22FromGitter<codem4ster> spawn do nothing for me :(
19:19:42FromGitter<Araq> `setMinPoolSize`, jezz
19:20:09FromGitter<codem4ster> really :( I want to cry now
19:20:49FromGitter<Araq> either use dead simple code with `createThread` and watch out for all its problems, or use threadpool.nim
19:21:05FromGitter<Araq> and it's all terrible :P
19:21:12FromGitter<Araq> but your code seems much worse
19:21:38FromGitter<codem4ster> :) I'm very new to Nim, you know
19:21:54FromGitter<Araq> somebody needs to revive Yuriy's PR ...
19:25:25FromGitter<Araq> @codem4ster yeah, it's not your fault. in order to get threads sane we need `=sink`() {.error.}
19:25:58FromGitter<codem4ster> @Araq how can I understand all spawned procs ended their job?
19:27:40FromGitter<codem4ster> sync() is not an option, I will break a loop if they all finished
19:28:20FromGitter<Araq> make them return something and wait for all
19:30:25FromGitter<codem4ster> but spawn is async, and I don't know the count of the spawns, they're dynamic
19:30:53FromGitter<codem4ster> I will spawn about 90000 of them
19:31:25TheLemonManslightly over nine thousand, I like it
19:31:49FromGitter<codem4ster> 90_000
19:32:02FromGitter<codem4ster> :D
19:32:38FromGitter<codem4ster> I will spawn them in a 8 threads pool
19:33:28FromDiscord<Gilgamish> Good day! I have two questions that I'd apprecaite if anyone could answer.
19:33:28FromDiscord<Gilgamish>
19:33:29FromDiscord<Gilgamish> 1. Does Nim have any system for union types/algebraic data types or polymorphism?
19:33:29FromDiscord<Gilgamish> 2. I'd like to build a tokenizer/lexer: I did something similar in Java where I used regex Is nims regex library mature enough or should I just process the string instead?
19:35:23PMunch1. Yes, look at this: https://github.com/nim-lang/Nim/blob/master/lib/pure/json.nim#L606
19:35:36PMunchThat's a very basic example of a union type in Nim
19:36:38PMunch2. There are multiple regex libraries, one is a simple wrapper around a C library, which obviously is very stable. And there are some that are pure Nim, not 100% sure on the status of those though
19:37:14*rockcavera joined #nim
19:37:58FromDiscord<Gilgamish> Thanks man
19:38:06FromDiscord<Gilgamish> Any documentation on the union types?
19:38:55PMunchhttps://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
19:39:47PMunchNot sure if there is more..
19:39:57PMunchBut they're pretty simple to get a grasp on
19:40:21FromDiscord<Gilgamish> That's actually quite nice
19:40:39FromDiscord<Gilgamish> No need for inheritance, thanks!
19:42:42PMunchWell inheritance solves another kind of problem
19:42:48PMunchAnd you can use that as well :)
19:43:12PMunchBut yeah, often you wouldn't need it
19:43:52FromGitter<Araq> don't build lexers with regexes, unless it's a specialized lexer generator like lexim, flex etc
19:47:21FromGitter<mratsim> @codem4ster there are 2 unfortunately named spawned. One for async and one for threadpools.
19:48:42FromGitter<mratsim> anyway if you want to spawn 90000 threads you are looking for a M-N threading (i.e. M lightweight threads over N hardware threads) similar to Erlang Beam VM or goroutines. Unfortunately you can’t do that in Nim, that’s very complex.
19:49:26FromDiscord<Gilgamish> Thanks for the input, Araq
19:50:01FromGitter<mratsim> @Gilgamish, the main use case for inheritance in Nim is to allow a library to be extensible by user-derived types.
19:50:29FromGitter<mratsim> don’t use it to write a parser, you would have hundreds of allocations otherwise
19:50:36FromGitter<mratsim> and that would be your bottleneck
19:51:08FromGitter<mratsim> A state machine would be the fastest.
19:51:35FromGitter<mratsim> with states in enum
19:56:32FromDiscord<Gilgamish> I'm not really looking for performance
19:57:08FromGitter<codem4ster> I did it @mratsim threadpool doing that :)
19:57:34FromDiscord<Gilgamish> I wanted to build a programming language (it's my goto toy project when learning a language) and some union type works well in that case
19:57:43FromGitter<codem4ster> now I'm looking to the non-leaking flowing data from my terminal :) ⏎ ahh, that's the life... :D
19:57:54FromDiscord<Gilgamish> You know, for grouping statements, or variables
20:00:28FromGitter<Araq> @mratsim: it's actually not that hard to do with a trick... (famous last words)
20:02:09FromGitter<mratsim> @codem4ster congrats =), now you can write a blog post :P
20:03:05FromGitter<mratsim> @Gilgamish, I see, then you can check this as example: https://github.com/gokr/spryvm
20:04:04*nsf joined #nim
20:04:06FromGitter<mratsim> and check this as well for some example code of interpreters in Nim: https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources#nim-implementation-benchmark
20:05:39TheLemonMandid I just hear the "benchmark" word? :D
20:05:44FromGitter<mratsim> You have 5 examples: ⏎ ⏎ 1) Switch dispatch ⏎ 2) function table ⏎ 3) inheritance ... [https://gitter.im/nim-lang/Nim?at=5b918898c2bd5d117a2c8f22]
20:06:00FromGitter<unreadable> hey
20:06:18FromGitter<unreadable> How safe is Nim to use? :)
20:06:30FromGitter<mratsim> @TheLemonMan, beware this wiki link is a time blackhole
20:06:56FromGitter<mratsim> @unreadable, I would say “with great power comes great responsibility"
20:06:58TheLemonManunreadable, quite to very
20:07:43FromGitter<mratsim> Nim comes with several tools from Ada that can makes very robust programs, or you can the C way with raw pointers
20:07:46FromGitter<unreadable> well, the fact that compiles to C made me wonder it
20:08:15FromGitter<mratsim> well assembly can be safe or unsafe, it’s not the language
20:08:27FromDiscord<Gilgamish> Thanks a lot @mratsim I genuinly could not ask for any more help! 😃
20:09:46FromGitter<mratsim> @Gilgamish, here is another one a CPU interpreter: https://github.com/mratsim/chirp8/blob/master/src/cpu.nim
20:10:10FromGitter<unreadable> thanks, I'll deep into nim to see what is has to offer
20:10:12FromGitter<mratsim> if you have doubt on object variant you should see how to use them
20:10:34FromGitter<mratsim> you have both tagged and untagged union even
20:11:46*Notkea joined #nim
20:13:29*Trustable quit (Remote host closed the connection)
20:22:09*endragor joined #nim
20:26:30*endragor quit (Ping timeout: 252 seconds)
20:35:25*PMunch quit (Remote host closed the connection)
20:40:55*skelett1 quit (Quit: WeeChat 2.1)
20:41:23*skelett joined #nim
20:46:46FromDiscord<treeform> Does any one know if nim's strings in JS mode, are arrays of utf-8s or unicode chars? There seems to be a bug that comes up with `toJSStr` and I am trying to figure out what it should be.
20:48:27*skelett quit (Quit: WeeChat 2.1)
20:48:44*skelett joined #nim
21:02:32*erratic quit (Quit: this server has gone to sleep)
21:02:42*sz0 quit (Ping timeout: 252 seconds)
21:04:09*sz0 joined #nim
21:04:38FromGitter<Araq> arrays of unicode chars
21:05:26FromGitter<Araq> @mratsim: the better example is "illegal instruction". asm has it, C lacks it. but oh why? C compiles to asm... the big riddle.
21:09:01*leaf__ joined #nim
21:10:07*erratic joined #nim
21:17:11dom96no?
21:24:23*nsf quit (Quit: WeeChat 2.2)
21:31:24*Notkea quit (Ping timeout: 252 seconds)
21:32:44*Notkea joined #nim
21:47:58*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
21:57:57*leaf__ quit (Ping timeout: 252 seconds)
22:03:52FromDiscord<emekoi> i think i broke nim
22:04:18FromDiscord<emekoi> the compiler dies silently and returns error code -1073741571
22:05:41AlexMaxSo I notice that when I use nimble build to build my binaries, the binaries end up in the root directory and nimcache ends up in src/
22:06:03AlexMaxBut I now want a nims build task as well, so it doesn't look up dependencies every build
22:06:35AlexMaxTo get the exact same beavhior, I use switch("nimcache", "src/nimcache"); setCommand("c", "src/rocked"); switch("out", "rocked")
22:06:39ldleworkemekoi hehe
22:07:29AlexMaxIs there a single switch that I can use instead - or rather, does nimble just use one switch to get the behavior I describe?
22:07:49AlexMaxI mean, it works well enough for me
22:11:47FromDiscord<emekoi> AlexMan, in the nimble file you can set `binDir` to the desired binary directory.
22:24:12*a_b_m joined #nim
22:24:51FromDiscord<emekoi> does nim do ci tests for mac, linux, and windows (32 and 64 bit)?
22:24:56*zachcarter joined #nim
22:25:30FromGitter<mratsim> @emekoi yes, check our repo https://github.com/status-im/nimbus
22:27:30*abm quit (Ping timeout: 252 seconds)
22:27:47*Vladar quit (Remote host closed the connection)
22:30:51FromDiscord<emekoi> okay, so would it be feasible for the binaries from those ci tests to be uploaded/deployed/etc. to some sort of "server" if the test succeds and then choosenim downloads those binaries, instead of building locally?
22:31:20FromGitter<mratsim> yes search for Travis:Appveyor build artifacts
22:34:21FromDiscord<emekoi> then why doesn't choosenim do this? is there some advantage to building locally instead of downloading a binary?
22:35:13FromGitter<mratsim> the stable version are downloaded
22:35:55FromGitter<mratsim> there are no nightlies because no one set it up but dom96 said 2 days ago that he welcomes any PR in that direction
22:36:25FromDiscord<emekoi> oh boy add one more to my todo list 😉
22:42:17*xet7 quit (Quit: Leaving)
23:03:42*gangstacat quit (Ping timeout: 252 seconds)
23:14:11*seni quit (Quit: Leaving)
23:16:16*gangstacat joined #nim
23:19:12*sagax quit (Ping timeout: 244 seconds)
23:30:01*sagax joined #nim
23:36:08*a__b__m joined #nim
23:39:55*a_b_m quit (Ping timeout: 246 seconds)
23:44:07*sagax quit (Quit: Konversation terminated!)