<< 03-04-2020 >>

00:27:31*dwdv quit (Ping timeout: 265 seconds)
01:06:12*zacharycarter quit (Quit: Lost terminal)
01:14:53FromDiscord<dryajov> I'm trying to dump the heap contents using `-d:nimTypeNames` and `dumpNumberOfInstances`, but getting `undeclared identifier: 'dumpNumberOfInstances'`, any hints at how to get it working?
01:19:42FromDiscord<Rika> thats not a function anywhere
01:20:39FromDiscord<dryajov> interesting, it actually builds, but vscode complains about it... never mind, seems to work ๐Ÿ™‚
01:24:08*chemist69 quit (Ping timeout: 246 seconds)
01:26:22*chemist69 joined #nim
01:32:14*lritter quit (Ping timeout: 240 seconds)
01:36:34*couven92 quit (Ping timeout: 240 seconds)
02:03:29sagaxhi all!
02:03:37sagaxhow to `echo` without new line/
02:03:38sagax?
02:04:52leorizestdout.write <- use that instead
02:06:57*jegfish joined #nim
02:10:13axionhow do i divide 2 uint64's to get a float?
02:11:43Yardanicofloat(a / b) ?
02:12:06Yardanicoor you want float(a) / float(b) ?
02:12:08axionit's telling me that there is no overload for uint64, uint64
02:12:37Yardanicoah, use "div" then
02:12:53Yardanico"a div b" if you want to divide uint64s
02:12:55axiondoesn't that do integer division dropping the remainder?
02:13:06Yardanicowell, if you want to get a float then do
02:13:10Yardanicofloat(a) / float(b)
02:13:15axionOk cool
02:15:16*jegfish quit (Quit: Leaving)
02:15:37*jegfish joined #nim
02:16:12sagaxthanks
02:29:27*krux02_ quit (Remote host closed the connection)
02:32:26axion@Rika I have more questions for you sometime :)
02:37:17*muffindrake quit (Ping timeout: 246 seconds)
02:39:41*muffindrake joined #nim
02:45:46FromDiscord<Rika> ๐Ÿ˜ฎ
02:55:00*nekits quit (Ping timeout: 256 seconds)
02:58:26*nekits joined #nim
03:04:42*jegfish quit (Quit: Leaving)
03:10:44*rnrwashere joined #nim
03:10:44*rnrwashere quit (Client Quit)
03:52:04*rockcavera quit (Remote host closed the connection)
03:54:46*endragor joined #nim
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:43*supakeen joined #nim
04:18:17*sz0 quit ()
04:19:06*sz0 joined #nim
04:41:44*waleee-cl quit (Quit: Connection closed for inactivity)
05:16:06*letto quit (Quit: Konversation terminated!)
05:20:20*narimiran joined #nim
05:22:40*letto joined #nim
05:24:36*dddddd quit (Ping timeout: 256 seconds)
05:27:45*dadada joined #nim
05:28:09*dadada is now known as Guest40604
05:33:40*rnrwashere joined #nim
05:42:56*rnrwashere quit (Remote host closed the connection)
05:45:21*rnrwashere joined #nim
05:53:08*CcxWrk quit (Quit: ZNC 1.7.4 - https://znc.in)
05:53:28*CcxWrk joined #nim
06:12:01*solitudesf joined #nim
06:23:27*tane joined #nim
06:26:44*Pixeye joined #nim
06:36:27*PMunch joined #nim
06:49:47FromDiscord<Benumbed> So while hunting for something else today, I found this: https://scripter.co/notes/nim/
06:49:50FromDiscord<Benumbed> It may help the Python people who drop in
06:50:18FromDiscord<Benumbed> (or other languages, Python just seems to be the common denominator)
06:51:20leorizethat's @kaushalmodi blog iirc
06:51:44*NimBot joined #nim
06:52:53FromDiscord<Benumbed> It's not linked in 'Learn'
06:56:52*rnrwashere quit (Remote host closed the connection)
06:57:14narimiranit is
06:57:26narimiranNim Notes: A collection of Nim snippets with brief notes.
06:58:12FromDiscord<Benumbed> Ohhh oops, I was looking for 'script' as a keyword ๐Ÿ™‚
06:58:54*rnrwashere joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:01:30*kenran joined #nim
07:04:50*gmpreussner joined #nim
07:12:50*andinus joined #nim
07:22:01FromDiscord<Benumbed> Hah, I just found the AKB48 reference in `unittest`'s docs
07:22:29FromDiscord<Benumbed> Someone's a fan of JPop ๐Ÿ˜„
07:27:55*chemist69 quit (Ping timeout: 272 seconds)
07:28:28*chemist69 joined #nim
07:54:54*kenran quit (Quit: leaving)
08:01:58*rnrwashere quit (Remote host closed the connection)
08:15:34*munksgaard joined #nim
08:16:20munksgaardFor weird reasons I want to `nim compile` a file with no .nim extension, is that possible? It seems like when I try to do `nim compile foo` it automatically adds a `.nim` at the end.
08:19:42Araqmaybe it's possible but files are better with extensions
08:20:51PMunchSure it's possible: "mv myfile myfile.nim && nim c myfile.nim; mv myfile.nim myfile"
08:20:57*MarderIII joined #nim
08:21:36PMunchOh wait: "mv myfile myfile.nim && nim c myfile.nim && mv myfile myfile.a; mv myfile.nim myfile"
08:21:53PMunchOr just use -o I guess
08:23:07munksgaardOkay, thank you :-)
08:50:12*sleepyqt joined #nim
08:50:34*hax-scramper quit (Ping timeout: 240 seconds)
08:52:47*hax-scramper joined #nim
08:53:32*Trustable joined #nim
08:56:51*hax-scramper quit (Read error: Connection reset by peer)
08:57:08*hax-scramper joined #nim
09:02:03*opal quit (Ping timeout: 240 seconds)
09:05:33*dwdv joined #nim
09:08:56*hax-scramper quit (Read error: Connection reset by peer)
09:09:15*hax-scramper joined #nim
09:11:42*Vladar joined #nim
09:14:22*opal joined #nim
09:15:34*hax-scramper quit (Ping timeout: 240 seconds)
09:16:14*hax-scramper joined #nim
09:16:28*emery[m] is now known as ehmry[m]
09:21:27*ehmry left #nim ("https://quassel-irc.org - Chat comfortably. Anywhere.")
09:22:58*kenran joined #nim
09:24:10*hax-scramper quit (Read error: Connection reset by peer)
09:24:27*hax-scramper joined #nim
09:30:29*hax-scramper quit (Read error: Connection reset by peer)
09:31:30*hax-scramper joined #nim
09:36:19Araqnarimiran, I think it's something like
09:36:27Araq"converter allowed for distinct types"
09:36:41Araqand localized conversions based on proc definitions like
09:37:41narimiran(before anyone gets scared, this is just some "thinking aloud" about converters, nothing serious (yet :P))
09:37:52*hax-scramper quit (Read error: Connection reset by peer)
09:37:59Araqproc `+`(x: Matrix; y: Matrix.alsoAllowedAs(Vector, toVector)): Matrix
09:38:07*hax-scramper joined #nim
09:38:52Araqsomething along the lines of varargs[`$`] where we got it right
09:39:28Araqyeah, like this
09:40:11Araqproc `+`(x: Matrix; y: convert[Matrix, toMatrix]): Matrix
09:41:28Araqthen toMatrix can also be a template or a method
09:41:30*hax-scramper quit (Read error: Connection reset by peer)
09:41:42*hax-scramper joined #nim
09:43:52*Vladar quit (Remote host closed the connection)
09:43:52*solitudesf quit (Read error: Connection reset by peer)
09:44:14*Vladar joined #nim
09:45:53*inv2004 joined #nim
09:50:40*hax-scramper quit (Ping timeout: 258 seconds)
09:51:14*hax-scramper joined #nim
09:52:00*solitudesf joined #nim
10:04:45*natrys joined #nim
10:07:43*solitudesf quit (Read error: Connection reset by peer)
10:09:31*sunwukong joined #nim
10:13:21*solitudesf joined #nim
10:13:26*dddddd joined #nim
10:19:13FromDiscord<Rika> `use strformat module instead, round is deprecated` what, so i have to fmt it then parseFloat?
10:22:40FromDiscord<flywind> `parseFloat` and then `round`? generic round is deprecated, but float round is ok.
10:23:58FromDiscord<Rika> i already have it, i dont understand what you mean by generic round
10:30:46FromDiscord<flywind> find this: https://forum.nim-lang.org/t/4402
10:48:26*PMunch quit (Quit: leaving)
10:54:58*kenran quit (Ping timeout: 256 seconds)
10:56:30*Trustable quit (Remote host closed the connection)
10:57:16*nsf joined #nim
11:00:55*kenran joined #nim
11:02:50*sleepyqt quit (Read error: Connection reset by peer)
11:23:43WilhelmVonWeinerdoes the db_mysql library keep the mysql socket alive?
11:24:02WilhelmVonWeineror will it eventually timeout?
11:25:35*narimiran quit (Ping timeout: 260 seconds)
11:27:08Araqdunno, try it
11:28:38WilhelmVonWeinerwell i think it's timing out but hard to test especially as i cant get very many erros logged from it
11:29:36FromGitter<eliezedeck> Hey guys, using `httpclient` ... how can I POST dynamic data that is not yet known in advanced, and is generated with time?
11:30:10*liblq-dev joined #nim
11:35:29Yardanicoyou want to stream POST request? is that even possible with http 1?
11:36:36YardanicoI'm not really sure if that's possible with httpclient
11:43:00*krux02 joined #nim
11:43:27*nsf quit (Quit: WeeChat 2.7)
11:47:20*MarderIII quit (Ping timeout: 256 seconds)
11:58:54FromGitter<eliezedeck> I have a Golang program that does exactly this, but I'm looking for a way to do this in Nim
12:00:12FromDiscord<Recruit_main707> by "dynamic data that is not yet known" you mean you dont know its size?
12:00:14FromGitter<eliezedeck> for Golang, the API takes an io.Reader ... so, you can basically plug in any reader and stream POST anything to the server
12:00:49FromGitter<eliezedeck> I believe one will have to set a size in HTTP/1.1
12:01:09FromGitter<eliezedeck> but the content, you should be able to stream it, as you create it dynamically
12:03:02*Kaivo quit (Quit: WeeChat 2.7.1)
12:04:11Araqthe API uses a 'bodyStream'
12:04:13Araqer
12:04:22Yardanicoit's only for the response :(
12:04:28*Kaivo joined #nim
12:04:31Araqthe implementation uses a bodyStream but it's not exported
12:05:03FromGitter<eliezedeck> indeed, Response only
12:05:06*filcuc joined #nim
12:05:21FromDiscord<Recruit_main707> can we interop with Go?
12:05:23FromGitter<eliezedeck> oh... for the Request?
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:18Yardanicowell, scrolling through httpclient I don't think it supports that
12:06:41*supakeen joined #nim
12:07:01shashlickShouldn't be hard to add
12:09:10FromGitter<eliezedeck> yes, I also looked at it, and it's only for Response ... not request
12:09:53FromGitter<eliezedeck> I'll create a bug report to track this
12:10:58FromGitter<eliezedeck> > but bear in mind that adding new features to the language is currently a low priority.
12:11:09FromGitter<eliezedeck> hmm...
12:11:20Yardanicoit's okay
12:11:26*narimiran joined #nim
12:13:11*s4mu3lbk quit (Ping timeout: 265 seconds)
12:13:47*inv2004_ joined #nim
12:14:37inv2004_I did: proc auth(): Future[JsonNode] {.async.} and result.add(json) internally. It compiles, but I have "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" is it ok ?
12:15:15Yardanicocan you somehow make a reproducible example? and is it with latest stable nim?
12:15:24Yardanicomaybe your "json" variable is not initialized
12:15:54*s4mu3lbk joined #nim
12:16:37*andinus quit (Quit: ERC (IRC client for Emacs 26.3))
12:16:38Yardanicooh yeah, I just tested it
12:16:43Araqeliezedeck: stdlib additions are not language features
12:16:49Yardanicoyou didn't initialize that "json" variable most likely
12:16:59inv2004_@Yardanico, if it would not be initialized I would expect compile error anyway, let me create one
12:17:12Yardanicoinv2004_: well I already made it myself kinda
12:17:16inv2004_Nim Compiler Version 1.0.6 [Linux: amd64]
12:17:24inv2004_@Yardanico, nice
12:17:29Yardanicobut JsonNode is a "ref" so in "var json: JsonNode" json will be "nil"
12:19:14inv2004_But I do echo json.pretty and I see it
12:19:29Yardanicowell, then can you make an example? :)
12:19:46Yardanicoin my code I just tries to declare "var a: JsonNode" and "result.add(a)" with the proc definition like in your case
12:20:03FromGitter<eliezedeck> Here is the bug report: https://github.com/nim-lang/Nim/issues/13856
12:21:37*Guest40604 quit (Ping timeout: 250 seconds)
12:22:13FromGitter<eliezedeck> At this time, I'm going to have to prepare and send a string
12:22:40FromGitter<eliezedeck> and on that subject: how can I get a string from a pointer (created using `alloc()`) ?
12:23:03*dadada joined #nim
12:23:07FromGitter<eliezedeck> may be casting? but then that won't have a proper length
12:23:17*andinus joined #nim
12:23:26*dadada is now known as Guest19241
12:23:40FromGitter<eliezedeck> ... it's been a while since I last used Nim, I'm relearning again :) ...
12:23:44FromDiscord<Recruit_main707> varname[] will give you what the pointer points to
12:24:29FromGitter<eliezedeck> and what about the length? needless to say that this is an buffer that has plenty of null-char in it
12:25:17FromDiscord<Rika> prolly have to figure the length out yoursel
12:25:18FromDiscord<Rika> f
12:25:27*rockcavera joined #nim
12:25:52FromGitter<eliezedeck> I know the length
12:26:28FromDiscord<Recruit_main707> then what length do you want?
12:26:31FromGitter<eliezedeck> source is: `pointer` + `length` .... desired outcome: `string` with length
12:26:38Yardanicowell I'm not sure if that's really correct
12:26:51Yardanicobut I did $cast[cstring](outData) in some project where "outData" is "ptr cuchar"
12:27:38Yardanicobasically to create a nim string out of C string (it'll do an allocation too because nim strings are GC'd IIRC )
12:28:50*waleee-cl joined #nim
12:29:35FromGitter<eliezedeck> it is a `pointer` to a series of `uint8`, just a sequence of bytes ... I allocated it using `alloc()` so I know the exact `length` ... but to create a string out of it, one will have to cast, and *then*, also set some may be hidden field for the `.len` to be reported correctly, right?
12:29:50inv2004_@Yardanico, https://gist.github.com/0a71607514cb278bcd64543c225e1166
12:29:51Yardanicowell idk how it worked lol
12:29:51FromGitter<eliezedeck> or, may be, I should have created a `string` in the first place?
12:30:01Yardanicowhy are you even doing alloc ?
12:30:17Yardanicoinv2004_: ahhh
12:30:21YardanicoI understand now
12:30:28FromDiscord<Rika> you'd prolly have an easier time making the string first then the cstring
12:30:28Yardanicobasically your "result" is uninitialized
12:30:34FromGitter<eliezedeck> @Yardanico: alloc 50 MB or memory?
12:30:46Yardanicoyou must do result = newJsonNode() and after that you can append to it
12:30:47FromGitter<eliezedeck> *of
12:31:16Yardanicoah sorry
12:31:26Yardanicoit's newJObject
12:31:34inv2004_@Yardanico, But it is Future. I would say that should be Future[seq[JsonNode]] probably
12:31:37Yardanicoor actually
12:31:48Yardanicoinv2004_: why do you need a seq of json nodes though?
12:31:51Yardanicowhy not a json array
12:32:03Yardanico"result = newJArray()" and then add json nodes to it
12:32:04inv2004_Because I like normal seq more than json :)
12:32:49inv2004_But result = newJArray() does not help also
12:32:59inv2004_maybe because it is Future
12:33:07Yardanicoinv2004_: it does help
12:33:18Yardanicohttps://play.nim-lang.org/#ix=2gto
12:33:50inv2004_Maybe my local nim is 1.0.4
12:34:04Yardanicoit works on 1.0.4 on playground
12:34:11inv2004_https://gist.github.com/inv2004/0a71607514cb278bcd64543c225e1166
12:34:28Yardanicoyes that works for me
12:34:33Yardanicoand it works on playground with 1.0.4 too
12:34:45inv2004_I am a bit confused - does not work for me :)
12:34:48Yardanicotry to --forceBuild ?
12:34:52Yardanicomaybe something got cached or idk
12:35:36Yardanicoit even works on the oldest nim version on playground - 0.13.0 :P
12:35:58inv2004_Ah, I have 1.0.6, but --forceBuild did not help
12:36:11inv2004_let me go to another machine
12:36:15Yardanicowell really strange, are you sure you actually recompile the file? did you save it?
12:36:40FromGitter<eliezedeck> alright ... so, how can I create a string with a specific length? preferably without having to zero-out (or set) its content?
12:36:43inv2004_ok, it works on another linux machine
12:37:11Yardanico@eliezedeck there are both newString and newStringOfCap
12:37:20inv2004_One question: Do I undestand correct that "result" should not initialize Future for {.async.} ?
12:37:21FromGitter<eliezedeck> cool ... thanks
12:37:29Yardanicoinv2004_: yeah, async macro does that automagically :P
12:37:36Yardanicowith newString you need to assign data like str[0] = 'a', str[1] = 'b' , etc
12:37:54Yardanicowith newStringOfCap you do str.add("stuff"); str.add("morestuff")
12:38:04inv2004_That is why, if I set seq[JsonNode] - then it should init automatically without newJArray
12:38:22FromDiscord<Rika> for wrapping i think you want newString and not the OfCap one
12:38:32Yardanico@Rika I don't think he's wrapping though
12:38:40Yardanicoinv2004_: it depends on how your code works
12:38:53Yardanicolike do you need a JSON with an array of these values, or you _really_ need a seq of json nodes?
12:38:55inv2004_and fine, seq[JsonNode] is why
12:39:08FromDiscord<Rika> Yardanico, im just sayin thougj
12:39:35inv2004_ok, another question: why the JsonNode is not initialized somehow to default value ?
12:39:41Yardanicobecause it's a "ref"
12:39:49Yardanicoall "ref" objects have a "nil" value
12:39:54FromDiscord<Rika> anything ref is default nil
12:39:54Yardanico"ref" is GC'd pointer
12:40:14YardanicoI mean traced/managed/etc
12:40:18*josch557 joined #nim
12:40:44FromDiscord<Rika> i still dont know the difference of `pointer` and `ptr`...
12:41:10inv2004_@Rika, I suppose one with type and another is not
12:41:14Yardanicoyeah
12:41:22Yardanico4raq's reply from the forum from 2015: "ptr without anything is a typeclass, perhaps it would have been better to use SomePtr for that instead. ptr[T] is the same as ptr T, pointer is just the untyped pointer, like C's void*."
12:41:26Yardanicohttps://forum.nim-lang.org/t/823#4753
12:41:34FromDiscord<Rika> huh
12:42:04FromDiscord<Rika> so from increasing "unsafeness", its ref -> ptr -> pointer
12:42:16inv2004_ok, I have to think is it problem or not to have unitialized ref :) and what would I have in rust
12:42:39Yardanicowell if you will automatically initialize it then you'll lose some performance in some cases
12:42:52Yardanicolike what if you wouldn't want to initialize it?
12:42:54FromDiscord<Rika> you cant do much with an uninitialized ref
12:43:07FromGitter<eliezedeck> thanks @Yardanico
12:43:20inv2004_It is why, probably I would expect warning from compiler
12:44:43Yardanicowell maybe with https://github.com/nim-lang/Nim/pull/13808 some annotations can be added to stdlib types
12:47:32inv2004_I would be fine, because in 5 minutes I had a feeling like I returned to the age when I was C-dev :) After Rust it was a bit painful :)
12:47:43*couven92 joined #nim
12:47:46Yardanicowell, I would prefer nim style over Rust anyway
12:47:52Yardanicorust just seems too verbose for me
12:48:02FromDiscord<Recruit_main707> ^
12:48:22inv2004_I do the same, but the question about the nil-refs is also important I suppose
12:49:55Yardanicowell yeah, there's always work in safety direction
12:50:02Yardanicobut you need to understand that it's not easy :P
12:52:26inv2004_I am just trying to compare how rust would help to avoid the problem
12:52:42Yardanicowell yeah I understand that rust is all about safety, i'm not doubting that
12:53:23FromDiscord<Recruit_main707> too safe and verbose for me, there is no fun if there is no little risk
12:53:24inv2004_I am not trying to compare best/not best. Is it possible with result only?
12:53:38Yardanicoas I said, initialize it
12:53:45*endragor quit (Remote host closed the connection)
12:55:18FromGitter<eliezedeck> Where can I find the implementation of `string.add()` => `AppendStrStr ` ... in the source, it's just magic :) โŽ ultimately, what I'd like to know is the behavior of this function in regards to many calls to `string.add()` in trying to create the HTTP request body ... I'm trying to find an analogy with Golang's `bytes.Buffer`, which tries to reallocate the buffer if it grows beyond capacity with some smart
12:55:18FromGitter... algorithms to avoid too many memory re/allocations
12:55:39Yardaniconim does that too AFAIK
12:55:51FromGitter<eliezedeck> Sweet!
12:56:30Yardanicoor not, lemme check :D
12:57:09Yardanicoah yeah it does kinda
12:57:10Yardanicohttps://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1120
12:58:44Yardanicothe most efficient way would be to use newString and then set values like data[0] = ...
12:58:56Yardanicobut newStringOfCap is easier to use I think
12:59:06FromGitter<eliezedeck> yes, indeed
12:59:17YardaniconewStringOfCap preallocates too
12:59:20FromGitter<eliezedeck> but that code looks cryptic/complex
12:59:29Yardanicowell it's C backend's code :)
12:59:43YardanicoI think the resizing logic is not exactly in there
12:59:56Yardanicoah right
12:59:59FromGitter<eliezedeck> yeah, that's what I was trying to look for
13:00:23Yardanicohttps://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L199
13:01:40*sunwukong quit (Quit: Leaving)
13:02:11FromGitter<eliezedeck> what is `nimIncrSeqV3 `?
13:02:19FromGitter<eliezedeck> or, what does it denote?
13:02:30Yardanicoa define
13:02:52FromGitter<eliezedeck> yes, but do you know what does it mean?
13:03:16Yardanicothese defines mostly exist for bootstrapping new nim compiler with old one
13:03:25Yardanicosee https://github.com/nim-lang/Nim/blob/version-1-0/compiler/condsyms.nim#L34 (nimIncrSeqV3 is in there too)
13:04:09FromGitter<eliezedeck> it doesn't seem to allocate a bit more space that is needed
13:04:47Yardanicowell it kinda does
13:04:52Yardanicohttps://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L43
13:04:57FromGitter<eliezedeck> yeah, but that's not helping in trying to know the actual meaning
13:05:07Yardanicobut well, it's compiler logic :P
13:05:25Yardanicoand string implementation
13:06:30FromGitter<alehander92> Araq i see you merged the sourcemap PR, i wondered if you want to somehow test the sourcemap itself
13:06:35FromGitter<eliezedeck> hmm... all I'm seeing is extra 7 bytes ... or may be I'm dumb
13:07:09Yardanicowell yeah, 7 minimum and maybe + 1 (if I understand " + s + 1" correctly)
13:07:29Yardanicothat code is not that new, and string appending is a hot path in quite a lot of programs, so it's all pretty optimized
13:07:43FromGitter<alehander92> i can also PR a little code removal for one global variable that's not needed now i think
13:08:03FromGitter<eliezedeck> but that's not of much importance in regards to large buffer use cases, my current use case is dealing with `string.add()` until it reaches 50 MB
13:08:14Yardanicowell but you preallocate it
13:08:18Yardanicoso why do you care?
13:08:52FromGitter<eliezedeck> and it can be much lower, like less than 5 MB at times
13:09:39FromGitter<eliezedeck> so, one would love for the language/compiler/... to take care of that kind of thing automatically
13:09:48Yardanicowhat thing exactly?
13:09:54Yardanicohow it can predict the future? :P
13:10:15Yardanicolet's not try to compare the code but rather compare the actual performance :)
13:10:46FromGitter<alehander92> @eliezedeck the language probably does, but its not clear what you want
13:11:05Yardanico@alehander92 they asked if the compiler does some "smart" string preallocation
13:11:12FromGitter<alehander92> actually, the simplest way `add` can work is by periodically reallocating stuff
13:11:19FromGitter<alehander92> i dont see what simpler way is to do it
13:11:47FromGitter<alehander92> like, i suppose "allocate certain capacity, if len > capacity, allocate function(currentcapacity)"
13:11:49FromGitter<alehander92> etc
13:11:51FromGitter<eliezedeck> you are right, it doesn't predict the future indeed ... I'm just trying to translate an existing Golang app to Nim ... I used `bytes.Buffer`, which does smart reallocation
13:12:16FromGitter<alehander92> but what is "not smart" reallocation
13:12:33FromGitter<alehander92> is it reallocation after each `add`
13:12:47FromGitter<eliezedeck> that would not be smart
13:12:50FromGitter<alehander92> :))))
13:12:53FromGitter<eliezedeck> :D
13:13:02FromGitter<alehander92> sorry
13:13:12FromGitter<eliezedeck> anyway, let's drop that
13:13:20FromGitter<alehander92> no, you're right
13:13:37FromGitter<eliezedeck> I think it would be better to manually implement that in a different library
13:13:51FromGitter<eliezedeck> I understand that string is a core part of the language
13:14:05*natrys quit (Ping timeout: 265 seconds)
13:14:12Yardanicowhy?
13:14:13FromGitter<eliezedeck> and the feature that I'm referring too, even in Go, is from a library
13:14:19Yardanicowell nim has Stream
13:14:33Yardanicoit's just that httpclient doesn't support it for sending requests (yet)
13:15:01FromGitter<alehander92> @eliezedeck i dont understand the problem
13:15:20FromGitter<alehander92> strings and seq-s do smart reallocation
13:15:23FromGitter<eliezedeck> so, I suppose we don't have this kind of library yet in Nim, right?
13:15:30Yardanicowhat kind of library?
13:15:32Yardanicostreams are in nim
13:15:47Yardanicobut if you specifically mean streams for sending requests - they're not implemented in httpclient (yet)
13:15:49FromGitter<kaushalmodi> Benumbed: Glad you are finding my Nim notes useful :)
13:17:14*natrys joined #nim
13:18:10FromGitter<eliezedeck> like I said, I haven't used Nim for years, I'm not aware of a lot of things that have changed ... the last time I used Nim was I think in v0.4.x something โŽ I don't even know what Streams are now :) ... thanks for the information guys, I'll try to keep up
13:19:12FromGitter<alehander92> maybe you can use them
13:19:34FromGitter<eliezedeck> > strings and seq-s do smart reallocation โŽ For now, I'll trust what you say, but I'll have to see how it goes. Thanks
13:20:20FromGitter<alehander92> you're right that we should look at the source: i havent studied this particular part of it before
13:27:36FromGitter<alehander92> so from what i see https://github.com/nim-lang/Nim/blob/devel/lib/system/sysstr.nim#L18
13:27:38*filcuc quit (Remote host closed the connection)
13:27:38FromGitter<alehander92> is being called
13:27:49FromGitter<alehander92> when a resize is needed, so here you can see the reallocation logic
13:28:18FromGitter<alehander92> (unless you use destructors etc which default nim iirc doesnt)
13:28:31Yardanicohow is memory allocated/resized with --gc:arc btw?
13:28:35FromGitter<alehander92> this seems to return the new capacity, which seems to then be malloc-ed and the previous string to be memcopied there
13:28:41FromGitter<alehander92> hm, i have to try with --gc:arc
13:28:53Yardanicowell I mean strings
13:29:01Yardanicomemory itself is still memory, it wouldn't change with --gc:arc :D
13:29:04*filcuc joined #nim
13:29:38*sleepyqt joined #nim
13:30:40FromGitter<alehander92> it seems it does something similar
13:30:46FromGitter<alehander92> on low level
13:31:25FromGitter<alehander92> it calls reallocShared
13:31:43*filcuc quit (Client Quit)
13:33:47*filcuc joined #nim
13:34:32FromGitter<alehander92> interesting thing is it seems to often reallocate from existing gc lists free cells
13:34:50FromGitter<alehander92> and it allocates pages if this fails from os, e.g. `mmap` on posix
13:35:17FromGitter<alehander92> but you can also use -d:useMalloc , right
13:35:21Yardanicoyeah
13:35:42inv2004_Hey, hey, my first nim project :) https://github.com/inv2004/strava_nim
13:36:11FromGitter<alehander92> yes, if you do that, you just get `realloc` indeed
13:36:18FromGitter<alehander92> so thats predictable
13:36:26Yardanicoinv2004_: 4-space indents oh no
13:37:01inv2004_@Yardanico, it was another question! I set plugin into vs-code, and it did not change default ts=4
13:37:17inv2004_+ ?nim format? did not change it also
13:37:28Yardanicoit's nimpretty
13:37:41Yardanicoand i doubt it will change number of spaces
13:37:56Yardanicoinv2004_: you have to set indentation level globally in vscode I think
13:38:02inv2004_yes, nimpretty. Ok, but anyway, I wondered, what nim-vscode did not overwrite default value for nim files
13:38:42inv2004_@Yardanico, I am not sure that it is a rule, because a lot of plugins change it for your own files-types
13:39:22FromGitter<alehander92> hm, so thats interesting, following memory access patterns
13:47:13FromGitter<eliezedeck> > when a resize is needed, so here you can see the reallocation logic โŽ โŽ Thanks @alehander92 ... that is exactly what I was looking for ... now I can code in pease :D
13:52:44FromGitter<eliezedeck> So, I also take it that if I have a `string.len == 500` and the capacity is also 500, and I do a `string.setLen(0)` to truncate the length of the string, the underlying buffer will be reused and will still have the same capacity so I can `.add` more data to it, right?
13:52:56FromGitter<eliezedeck> I'm thinking to re-use the string
13:53:51FromGitter<eliezedeck> and may be: is there a kind of object pool library that I'm not aware of ?
13:54:49*endragor joined #nim
13:55:16*endragor quit (Remote host closed the connection)
13:57:37Araqright, reusing memory is easy with Nim's strings
13:57:58FromGitter<eliezedeck> Wonderful!
14:10:36*endragor joined #nim
14:16:51*endragor quit (Remote host closed the connection)
14:18:31*MarderIII joined #nim
14:19:30AraqI think I made a mistake and choosenim already knows about 1.2 :P
14:19:33Araqbbl
14:19:57FromGitter<eliezedeck> Yay!!! :P
14:20:17FromGitter<eliezedeck> can't wait for the blog post
14:23:12FromGitter<alehander92> @eliezedeck no problem
14:26:30FromDiscord<mratsim> @eliezedeck, setLen will reallocate if needed, if you want to preallocate a specific size use newStringOfCap
14:27:01FromDiscord<mratsim> then you now that realloc will only occur if you exceed the initial capacity you predefined with newSeqOfCap
14:27:31FromDiscord<mratsim> i.e. add + setLen + newSeqOfCap should give you all the flexibility you need
14:28:17FromDiscord<mratsim> regarding object pools I have 2 varieties depending on your use cases
14:30:26FromDiscord<mratsim> a simple one, that implements a simple bounded object pool: https://github.com/mratsim/weave/blob/master/weave/memory/persistacks.nim
14:30:34*couven92 quit (Ping timeout: 240 seconds)
14:31:11FromDiscord<mratsim> and a threadsafe unbounded memory pool that can only serve fixed-sized memory blocks: https://github.com/mratsim/weave/blob/master/weave/memory/memory_pools.nim
14:32:25FromGitter<eliezedeck> thanks @mratsim ... greetings and best regards from a fellow citizen :)
14:41:05*inv2004_ quit (Ping timeout: 265 seconds)
14:41:18*inv2004 quit (Ping timeout: 256 seconds)
14:44:05*solitudesf quit (Read error: Connection reset by peer)
14:49:53*abm joined #nim
15:11:09*inv2004 joined #nim
15:11:09*inv2004_ joined #nim
15:12:14*kenran quit (Ping timeout: 240 seconds)
15:13:02*filcuc quit (Quit: Konversation terminated!)
15:16:50FromGitter<maattdd> The doc website seems down : https://nim-lang.org/docs/manual.html
15:16:56krux02mratsim: I think `shrinkToFit` and `reserve` from c++ is still missing.
15:17:34krux02maattdd: maybe you can take this instead: https://nim-lang.org/0.11.0/theindex.html
15:17:52krux02sorry
15:17:54krux02outdated
15:18:09liblq-devhttps://nim-lang.github.io/Nim/
15:18:32*s4mu3lbk quit (Ping timeout: 256 seconds)
15:18:38liblq-devis the latest devel documentation, but most of the time it's fine for regular use
15:18:57*inv2004_ quit (Quit: Leaving)
15:19:00*Mister_Magister quit (Excess Flood)
15:19:13*s4mu3lbk joined #nim
15:21:14*solitudesf joined #nim
15:25:37*Mister_Magister joined #nim
15:37:08*solitudesf quit (Read error: Connection reset by peer)
15:48:44*lritter joined #nim
15:58:17Araqwho can update the #nim channel?
15:59:41liblq-devI think dom96 can, but he isn't here atm
16:02:50narimiranhttps://nim-lang.org/blog/2020/04/03/version-120-released.html
16:03:04FromDiscord<clyybber> \o/
16:09:53FromDiscord<Kiloneie> Nim documentation now has dark mode D:, wooo my eyes !
16:10:30FromDiscord<Kiloneie> Wait what 1.2.0, wellp gotta install that
16:12:35liblq-dev1.2 yay! \o/
16:19:00*andinus quit (Quit: ERC (IRC client for Emacs 26.3))
16:19:08*solitudesf joined #nim
16:20:18FromGitter<maattdd> @krux02 thanks :)
16:20:35FromGitter<maattdd> Another question: I guess the VM can't deal with opening socket at compiletime right ?
16:20:57FromGitter<maattdd> `/Users/matthieudubet/repos/Nim/lib/pure/net.nim(232, 12) Error: cannot evaluate at compile time: osInvalidSocket`
16:22:25krux02maattdd: I realized it is very outdated, but better than nothing I guess.
16:24:14FromGitter<maattdd> Official link is back online anyway :) Might be related to the 1.2.0 release
16:24:49dom96Nice, 1.2
16:26:03dom96Some grammar mistakes in that release article
16:27:10dom96"We tried to keep breaking changes to a minimum" fun
16:27:34narimirandom96: fix them ;)
16:27:42dom96I am
16:28:50dom96does --useVersion:1.2 work per-module?
16:29:22FromGitter<alehander92> hey is the sourcemap
16:29:24FromGitter<alehander92> in the changelog
16:29:28FromGitter<alehander92> or is it under 1.4
16:29:44FromGitter<alehander92> i forgot to really write anything in the changelog
16:30:21*nsf joined #nim
16:31:22dom96https://github.com/nim-lang/website/commit/76e3ce5a22b4badb29ee1f4a828cdbded234ba7e
16:31:23*vegai quit (*.net *.split)
16:31:33*vegai joined #nim
16:31:54FromGitter<alehander92> i guess it cant be as it just got merged
16:31:54shashlickunbelievable number of changes, fantastic job folks!
16:32:19FromGitter<alehander92> but i have to ping @skellock about it anyway :D
16:32:20narimirandom96: :thumb up:
16:32:58narimiran@alehander92 your changes are in 1.2, but if you didn't write anything in the changelog then there's nothing about it in the changelog :)
16:33:13FromGitter<alehander92> ohh no
16:34:18FromGitter<alehander92> it should be inside, many people asked for it
16:35:21narimiranpeople asked to have a line in the changelog? :P
16:36:08*tefter quit (Quit: WeeChat 2.8)
16:36:43FromGitter<alehander92> well, to have sourcemaps for the javascript backend
16:37:25FromGitter<alehander92> it's something that should be mentioned in the "new features" of the release for sure
16:38:09*abm quit (Ping timeout: 250 seconds)
16:41:30narimiran@alehander92 can you write something and make a PR here: https://github.com/nim-lang/website ?
16:41:49narimiranthis is the file you need to edit: https://github.com/nim-lang/website/blob/master/jekyll/_posts/2020-04-03-version-120-released.md
16:42:36FromGitter<alehander92> it might as well be in the `compiler changes`, sorry if i am being pushy, i just think it's eye-catching, as improved debugging/javascript support are often a discussion starter in forums
16:42:44FromGitter<alehander92> no problem
16:43:04dom96better yet, write a separate article talking about your changes
16:45:20FromGitter<alehander92> well, that might be too much? i dont know
16:46:29FromGitter<alehander92> on the other hand i guess one can share that in javascript/web communities for some exposure
16:46:52*inv2004 quit (Ping timeout: 256 seconds)
16:47:53*inv2004 joined #nim
16:50:43*MarderIII quit (Ping timeout: 250 seconds)
16:50:51dom96yep
16:51:15dom96too much? We've got like no articles being written about things that Nim can do
16:51:44FromGitter<alehander92> awesome
16:51:51FromGitter<alehander92> ok, i can write a small one these days
16:52:24FromGitter<alehander92> otherwise writing about 3rd party projects really does it best imho(tho compiler writeups are also very cool)
16:52:40FromGitter<alehander92> e.g. the vim 3d post: suddenly it got so many random people to read about nim/nimble
16:52:56FromGitter<alehander92> because that's what sparks up people's imagination
16:54:49FromGitter<zetashift> 1) 2 looks superb, thanks for all the hard work!
16:55:08*Jesin quit (Quit: Leaving)
16:55:56*MarderIII joined #nim
16:56:07Araqalehander92: do you think it's production ready? (source maps)
16:56:23AraqI merged it because it looked good and we can always fix bugs later
16:56:30dom96narimiran, why does the article not have a clear list of breaking changes?
16:56:50FromGitter<alehander92> Araq well, not sure , i think I expected it to be merged later
16:57:06Araqsee? so test it well once again before you announce it :P
16:57:23FromGitter<alehander92> i absolutely want to, but i am not sure why it got included into 1.2 then
16:57:54Araqbecause 1.2 is not an LTS
16:58:49FromGitter<alehander92> i just thought we cant announce it in 1.4 if it's released in 1.2 :D
16:59:20FromGitter<alehander92> but yeah probably best to include it in some kind of experimental/compiler changes list with a note for people to play with it
16:59:31dom96is 1.4 going to be an LTS?
16:59:37FromGitter<alehander92> (but still people need to know that it actually exists now)
17:00:37Araqdom96, IMO 2.0 is going to be one
17:01:01federico3"new commits which have not already been backported" ?
17:01:25dom96Araq, and what is that scheduled to break?
17:02:10Araqmy plan is roughly: we add features in 1.2, 1.4, 1.6. features that can replace older features. and then 2.0 removes the old stuff
17:02:55FromGitter<alehander92> is incremental compilation still coming
17:03:11FromGitter<alehander92> for 2.0
17:03:15Araqdisruptek is/was working on it
17:03:19FromGitter<alehander92> i am willing to help in my spare time somehow if its still in the plans
17:03:23Araqand I'm trying to guide him
17:03:24dom96Araq, right, so which features are you planning to remove?
17:03:25FromGitter<alehander92> ah ok
17:03:59*Vladar quit (Quit: Leaving)
17:04:29Araqdom96, don't quote me on that but we could remove implicit items/pairs, 'converter', redo concepts, redo "term rewriting macros", redo the .tags system
17:04:54Araqremove proc vs iterator overloading
17:05:05FromGitter<alehander92> whats the plan about the `.tags` system?
17:05:06dom96okay, I can deal with that. Just don't remove GC or async await :P
17:05:25dom96Also, we should talk about .tags. I wonder why you need breaking changes for that
17:05:31FromGitter<zetashift> feels good Nim 1.2 at the top of HN
17:05:48FromGitter<alehander92> wow, people actually use it fo rweb
17:06:00Araqdom96, DrNim can check for 'not Tag'
17:06:02leorizequarantine happens to get people to discover new things :)
17:06:16*PMunch joined #nim
17:06:36Araqand once we have the 'not' operator for tags the system is hopefully more useful
17:07:32Araqin general I like the fact that DrNim gives us a "staged" type system. the compiler does basic type checking, DrNim does the clever checking and proves things about your code
17:07:39liblq-devwtf, repr() does not support uint16
17:07:48Araqbut it's too early to talk about DrNim really
17:07:52FromGitter<Vindaar> congrats for Nim 1.2! :)
17:07:57dom96Araq, hmm, okay, interesting idea.
17:07:59liblq-devunder --gc:arc
17:08:13dom96Araq, regarding my question above, can --useVersion be used per-module? Is that the plan?
17:08:26Araqdom96, you cannot.
17:08:32Araqbut it might be a good idea
17:08:51dom96without that I don't really see the point of this.
17:08:58*s4mu3lbk quit (Ping timeout: 256 seconds)
17:09:01dom96You can much more easily and reliably just use an older Nim
17:09:26FromGitter<alehander92> Araq, but still would there be a way to annotate "positive" tags just one by one
17:10:29*Jesin joined #nim
17:10:31FromGitter<alehander92> because even if you can just write `not Blocking` for `a` (just my example, dont press on the blocking thing), you still have to write down other non-related tags for `b` which has the effect
17:10:40*s4mu3lbk joined #nim
17:11:14FromGitter<alehander92> which i think is making it hard, as often people would be interested in just some effects in their codebase, while wanting to ignore the others
17:12:02rayman22201Yay 1.2 ๐ŸŽ‰
17:15:15FromGitter<maattdd> the VM can't deal with opening socket at compiletime right ? I was trying to reimplement some procedural macro from Rust
17:15:37FromGitter<alehander92> what are you trying to do
17:15:45dom96indeed, you cannot use the FFI at compile-time
17:15:56dom96but you can call out to a process, so you can write what you need as a nim program and then exec it
17:16:13FromGitter<alehander92> also you might be able to workaround with some flags if its just for personal use
17:16:15FromDiscord<slymilano> Nim 1.2 hit the hackernews frontpage ๐Ÿš€
17:16:21FromGitter<maattdd> I'm trying to write a func which connect to postgres and typecheck some sql query
17:16:59FromGitter<alehander92> nice!
17:17:40*dom96 is watching google analytics users rise
17:17:45dom9690 currently
17:18:00FromGitter<maattdd> (reimplement this basically https://github.com/launchbadge/sqlx#compile-time-verification )
17:18:04FromGitter<alehander92> @maattdd so you can do this in general using `staticExec` as @dom96 said : in general you can even make this nice by using some serialization
17:18:36FromGitter<alehander92> one we talked with PMunch that one can make an api that lets you call typed runtime code from CT this way
17:18:50leorize@maattdd: you might be interested in this too: https://github.com/araq/ormin
17:19:13PMunchHuh?
17:19:37PMunchOh nice 1.2.0 is out :)
17:19:50PMunchI guess it's time to check all my packages again for breakages..
17:20:06*inv2004 quit (Ping timeout: 265 seconds)
17:20:08leorize@maattdd: and here's the documentation: https://github.com/Araq/blog/blob/master/ormin.rst
17:20:08FromGitter<alehander92> well, i had this strange idea that you can write something like `run: code` and on compile time to put it in a file, compile it if needed and staticExec it and decode the results from the exec
17:20:23FromGitter<alehander92> i think this was because of some of your code PMunch but i might not remember well
17:20:25PMunchAh right, yes I remember we talked about that
17:20:39PMunchI don't think I needed it for anything in particular
17:20:50PMunchBut I might've
17:21:02FromGitter<alehander92> @maattdd but you can put your code in a normal nim module, generate all the typeinfo there and just return as e.g. json
17:21:13PMunchThat's kinda how scopes works (the programming language)
17:21:15FromGitter<alehander92> and load it from your lib using staticExec
17:21:26FromGitter<alehander92> which might be even faster, as you dont run this in the vm
17:21:32FromGitter<maattdd> actually I think this kind of "typesafe" ORM is the wrong approach, because it need to support an arbitrary set of SQL constructs. The only way to support *exactly* what your database supports is to call postgres decribe feature.
17:21:43PMunchWell it certainly depends on what you're doing
17:21:55FromGitter<alehander92> so this way it can work: and you can generalize it for different databases
17:22:03FromDiscord<Chiqqum_Ngbata> How to write a type for a proc that may contain a side effect?
17:22:09PMunchBut if you want to do some heavy processing then offloading that to a compiled program might offer a performance benefit
17:22:39leorize@Chiqqum_Ngbata: then it'd just be a normal proc type
17:22:45PMunchChiqqum_Ngbata, what do you mean?
17:22:55leorizethe opposite of `{.noSideEffect.}` is to not specify it :P
17:23:03FromGitter<alehander92> now, calling the other one might feel icky, but i think it is not really hard
17:23:06Araqmaattdd well ymmv but I've never written a single program where I need to support "an arbitrary set of SQL constructs"
17:23:18PMunchYeah, that's just a normal `proc`. If you want to have no side effects then you can use `func` or the `noSideEffect` pragma
17:23:30FromGitter<maattdd> @alehander92 indeed, I guess I can glue something with staticExec
17:23:38Araqit also sounds like a security desaster
17:23:57PMunchNice top comment on HN :)
17:24:01FromGitter<alehander92> @maattdd one can even make a good api for that, but if you just use it for one lib, its not needed
17:24:15dom96That dark mode though. Big props to whoever implemented that!
17:24:45FromDiscord<Chiqqum_Ngbata> I have a type for a normal proc. The implementation is a proc that has a side effect (in v1.2 seems os.sleep() side-effects, makes sense I guess)
17:25:02FromDiscord<Chiqqum_Ngbata> Not sure how to adjust the type to accommodate proc that may contain side effect
17:25:56FromGitter<alehander92> but procs with side effects are normal procs
17:26:03FromGitter<maattdd> @Araq Well obviously you need a DB access at compile-time :)
17:29:20FromDiscord<Chiqqum_Ngbata> type mismatch: got <tuple of (proc (): Thing{.gcsafe, locks: 0.})> but expected 'tuple of (proc (): Thing{.noSideEffect, gcsafe, locks: <unknown>.})'
17:29:25FromDiscord<Chiqqum_Ngbata> Type doesn't have any pragmas
17:29:38leorizehow did you define the type?
17:29:48FromGitter<alehander92> ah so you want to accept funcs in place of procedures
17:30:11FromGitter<alehander92> huh, yeah there should be a rule for that in the type system somewhere
17:30:38FromDiscord<Chiqqum_Ngbata> type FnType* = proc(a: string, b: string): RetType
17:31:37PMunchHmm, what's the difference between useVersion and just choosenim-ing the version you want?
17:31:51leorizeyou get to use the newer stdlib :P
17:32:03PMunchAah
17:33:02livcdshould choosenim update self work?
17:33:04livcddom96:
17:33:16dom96leorize: huh? How do you?
17:33:21dom96livcd, sure
17:33:40livcdError: unhandled exception: 404 Not Found [HttpRequestError]
17:34:55FromGitter<zetashift> shoudln't you do choosenim update stable?
17:35:02FromGitter<zetashift> or you want to update choosenim itself?
17:35:37livcdupdate stable works
17:35:57livcdupdate self should update choosenim binary no? :D
17:37:28dom96livcd, yeah, maybe you got a broken choosenim version. Can you update manually and try again? Just download https://github.com/dom96/choosenim/releases/download/v0.6.0/choosenim-0.6.0_windows_amd64.exe
17:37:34dom96and replace your choosenim.exe with it
17:37:38livcdyes please
17:38:55livcddo you also set env vars with choosenim?
17:40:22FromGitter<zetashift> update self works fine for me tho(but I got the latest version already so I don't know how it checks that)
17:41:21livcdwell it's not a biggie i usually just dump Nim to my kitchen sink path
17:42:51FromDiscord<Chiqqum_Ngbata> Surely there is a way to capture a proc that might contain side effect?
17:44:20livcdbtw can one get a Nim compiler version from the binary it compled?
17:46:25liblq-devwhat is the overhead of `sequtils.any` and `sequtils.all` compared to just making a regular for loop?
17:47:01leorizefunction call overhead
17:47:06leorizeuse anyIt or allIt to avoid it
17:47:53leorizealso if the proc passed to is a closure then there's that as well
17:50:34leorizeAraq: what do you think about a function in macros that let you check if a generic matches with the type symbol that you have?
17:50:40Araqdom96, effictively it's how C/C++ handle this too, eg. -std=gnu++14
17:50:59*luis_ joined #nim
17:51:01leorizeie. something to check if `int` matches the `T` in `proc something[T: SomeInteger](i: T)`
17:51:11Araqand if you don't see the point of that consider that you might want to use old code on a new platform
17:51:31Araqso "just use an old compiler" doesn't work well in practice
17:51:54*luis_ quit (Client Quit)
17:52:13Araqleorize, macro expansion is often done before typechecking though
17:52:23*luis_ joined #nim
17:53:36leorizethen I guess I should complete the `{.borrow: identifier.}` feature instead of trying to write a macro for it...
17:53:55planetis[m]congratulations on the new release people! well done!
17:54:10Araqthanks!
18:03:07*rockcavera quit (Remote host closed the connection)
18:05:41*josch557 quit (Ping timeout: 252 seconds)
18:10:28*Vladar joined #nim
18:17:23*luis_ quit (Quit: luis_)
18:18:01*luis_ joined #nim
18:21:56*luis_ quit (Client Quit)
18:21:57*Jesin quit (Quit: Leaving)
18:27:51*luis_ joined #nim
18:29:11rayman22201@dom96 I would riot with you if async were removed lol, and while I'm an arc fan boi, even I have come around to the idea that leaving the other gc's is a good idea :-)
18:29:48*inv2004 joined #nim
18:31:55FromDiscord<exelotl> "Added a `with` macro for easy function chaining thatโ€™s available everywhere"
18:32:28*couven92 joined #nim
18:32:43FromDiscord<exelotl> This one is a bit misleading because you still have to import it
18:33:08FromDiscord<exelotl> At least in the playground where I tried it
18:33:23leorizeyep, you still have to import it:)
18:33:57*kenran joined #nim
18:35:08FromDiscord<exelotl> Will it be moved to system in the future, if it sees good adoption?
18:35:20PMunchLink to an example?
18:35:22*s4mu3lbk quit (Quit: WeeChat 2.3)
18:35:29leorizeI think we should keep things out of `system`
18:35:36leorizethat module is just huge
18:36:16FromDiscord<exelotl> In that case I guess it should be moved to sugar in the future instead then
18:38:07*rockcavera joined #nim
18:40:30FromDiscord<dryajov> question, what is -d:smokeCycles
18:40:30FromDiscord<dryajov> this seemed to trigger GC collects much more frequently and aggressively
18:46:34leorizeit basically tell the gc to collect cycles at all costs
18:47:09leorizethe gc usually defers cycle collecting until it passes a threshold
18:48:35Araqrayman22201, fwiw I still think once I fixed more bugs 'thinout' will work well enough
18:49:46Araqwith a slight modification to async it might work
18:49:59*Trustable joined #nim
18:51:51FromGitter<ksandvik_gitlab> Congrats to 1.2!
18:52:48FromGitter<ksandvik_gitlab> Quick question, each time I do choosenim update devel I'm getting: โŽ Extracting nim-1.1.1-osx.tar.xz โŽ Is this still top of trunk?
18:54:12leorizeguess we haven't bumped the version to 1.3 for devel yet
18:57:37*luis_ quit (Ping timeout: 272 seconds)
18:57:51Araqksandvik_gitlab: update your choosenim please
19:01:48*kenran quit (Ping timeout: 256 seconds)
19:02:19shashlicklivcd: for choosenim, do you mean setting up PATH?
19:02:47shashlickksandvik - update devel will update to latest nightly release
19:02:55shashlickif you want 1.2, use stable
19:03:06shashlickdevel will become 1.3.x soon
19:03:07FromGitter<ksandvik_gitlab> choosenim update self โŽ Updating choosenim โŽ โŽ ``` Info: Already up to date at version 0.6.0``` [https://gitter.im/nim-lang/Nim?at=5e87886b17a95e30a19ad48e]
19:03:37FromGitter<ksandvik_gitlab> So I assume then that Extracting nim-1.1.1-osx.tar.xz is dev trunk....
19:04:38FromGitter<ksandvik_gitlab> or soon....
19:05:23shashlickit is the last devel nightly build
19:05:35Zevvah 1.2, i missed the party!
19:05:35shashlickif you want #head then use `choosenim update devel --latest`
19:06:12FromGitter<ksandvik_gitlab> Thx, adding that to my notes.
19:06:17rayman22201Araq: cool. I hope it works, for the sake of all the existing async code. I still think it's worth investigating this alternative async implementation for the memory efficiency benefits.
19:06:32Araqrayman22201, oh definitely!
19:06:38FromGitter<alehander92> where is disruptek
19:06:49liblq-devoh, hi Zevv
19:06:51FromGitter<alehander92> !last disruptek
19:06:56Araqalehander92: busy, his country is burning
19:07:09FromGitter<alehander92> ughhhh
19:08:27rayman22201Lol. He didn't come to my part of the country fast enough
19:09:51FromGitter<alehander92> didnt he live in a truck
19:10:04FromGitter<alehander92> i hope he's fine with their new rules
19:10:29*inv2004 quit (Ping timeout: 265 seconds)
19:11:02shashlickhe's just on vacation
19:11:50dom96shashlick, am I misremembering, I thought semantics of `choosenim update devel` were going to remain as-is? :(
19:12:16shashlickyou wanted `choosenim update devel` to install nightlies and `--latest` to install head
19:13:28dom96right, I was hoping the messages would be clearer about what the nightly being installed is
19:13:38Zevvliblq-dev: you had problems, but i only saw the error dump, not what caused it. care to share?
19:14:07liblq-devyea I was going to submit an issue but then forgot about it
19:14:17liblq-devall I tried to do was `patt("frame=")`
19:14:22Zevvand why are you changing your nick all of the time, thats confusing as hell
19:14:25FromGitter<zetashift> he's on vacation..during lockdown?
19:14:30liblq-devsorry dude, lqdev was taken
19:14:50liblq-devfreenode is purging the nick database soon though so maybe I'll be able to get it back :)
19:15:00Zevvfor me you are now "the guy with something l something q seomething"
19:15:09liblq-devlol
19:15:45*luis_ joined #nim
19:15:46liblq-devbut while you were away I moved to plain IRC from Matrix, the lag pissed me off
19:15:55liblq-devbut it turned out that the name 'lqdev' was taken
19:16:11liblq-devI quickly had to come up with a different name, this is the resultโ€ฆ
19:16:56shashlickdom96: #head isn't updated yet so looks like devel is old - https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L2048
19:17:17Zevvanyway, i'd like to hear how npeg barfed up on you, if you can reproduce
19:17:40FromGitter<alehander92> is npeg a dog now
19:17:55dom96shashlick, so we don't have any functionality to detect this and let the user know yet, right?
19:18:01Zevvit"s whatever you want it to be
19:18:10FromGitter<alehander92> i can use a dog honestly
19:18:28Zevvits turing complete
19:18:51liblq-devZevv: somehow it's working now, but it didn't wanna work in my bigger module
19:18:57liblq-devnot sure what caused the crash
19:18:58FromGitter<alehander92> with so much dogfooding ..
19:19:01FromGitter<alehander92> not surprised
19:19:33Zevvhm ok, just let me know if you need any help on that. I'd like to keep up the hygiene on these kind of errors.
19:19:38dom96Araq, I am part of the HN hive-mind: https://news.ycombinator.com/item?id=22772362
19:24:30shashlickdom96: nope - it just downloads and installs latest release in devel branch
19:25:06*rnrwashere joined #nim
19:27:37supakeenIs the primary package index for nim the nim-lang/packages repository? :)
19:28:04liblq-devyes
19:28:08FromGitter<zetashift> Yes but for easier browsing you have : https://nimble.directory/
19:29:06supakeenYea, I've seen it and some of the discussion surrounding versions/discoverability!
19:29:24supakeenI was wondering if there had been any movement on that front as most of the discussion seems to date back about a year.
19:35:38*rnrwashere quit (Remote host closed the connection)
19:36:08FromGitter<eliezedeck> How do I disable the `Async traceback:` stack trace ? I tried `--stacktrace:off`, but no
19:37:12FromDiscord<dryajov> thanks @leorize
19:40:41rayman22201@dom96 and what do you have to say about the counterpoints in that thread?
19:41:51*Jesin joined #nim
19:42:06shashlicki think useVersion should be maintained for n-1 and perhaps n-2 at best so that people get enough time to transition
19:42:39shashlickafter that, older versions should be cleaned out so that people can be expected to move on rather than being stuck with 1989's version of C
19:43:07FromGitter<eliezedeck> It seems that only `-d:release` will get rid of it!: โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e8791cb9d4ed673c4256897]
19:43:43shashlickwill make it a pain to keep libraries up to date but an old library from 15 years ago that is unmaintained is probably not useful either
19:44:11shashlickif it is useful, that someone will update it
19:44:27dom96eliezedeck: don't think there is a way to get rid of it except that I'm afraid, feel free to make a PR to improve this (you can introduce this with a -d:noAsyncStacks or similar)
19:45:28FromGitter<eliezedeck> Oh, I see โŽ On another thing, what's with: `Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]`? how to fix this?
19:46:47dom96rayman22201, ehh I guess. Still think it's time better spent elsewhere
19:49:32FromGitter<alehander92> well, is it initialized @eliezedeck
19:49:35krux02eliezedeck: The correct way to handle it would be to open an issue on github about it if you can't get rid of the warning.
19:50:10krux02before enforced initialization becomes a compile time error message, all issues related to it must be fixed.
19:50:25FromGitter<eliezedeck> @krux02 I believe someone already did
19:51:00krux02well then you shouldn't worry about it becoming a compile time error.
19:51:51dom96You do, if the compiler is complaining then it's likely to become a compile-time error. You probably just need to use the MyObject(field1: 124) object constructor syntax
19:51:59dom96instead of setting each field manually
19:54:41FromGitter<eliezedeck> Oh, ok ... thanks for the tips
19:55:52livcdshashlick: yeah was thinking about setting the PATH
19:56:22*Jesin quit (Quit: Leaving)
19:58:02shashlick--firstInstall should ask you if you want to do it
19:58:45shashlickbut only on windows
19:59:50*rnrwashere joined #nim
20:04:29*Jesin joined #nim
20:09:41livcdright
20:12:09supakeenHey, I've been playing with asynchttpserver and pasted the example code in a test file but I end up with a traceback: https://bpaste.net/raw/XEMA my nim version is 1.2.0, what am I missing :)
20:12:47supakeenSorry, I copy/pasted the example from here: https://nim-lang.org/docs/asynchttpserver.html
20:17:40shashlickAraq: had a question around wrapping C variables if you're here
20:18:45*liblq-dev quit (Quit: WeeChat 2.7.1)
20:20:39*MarderIII quit (Read error: Connection reset by peer)
20:23:50*moerm joined #nim
20:23:52moermeveryone
20:24:16matlockWhere is the best place to raise an issue I am having with my account on the Nim forum? Thanks in advance.
20:24:30PMunchmatlock, depends on the issue
20:25:24matlockPMunch, I am trying to set my e-mail to the e-mail associated with my Gravatar and I use for work, but when I put in it and click Save I get the message 'You cannot set a rank that is higher than yours.'
20:27:35PMunchHuh, that's strange. Try highlighting dom96
20:27:45PMunchWell, I guess I just did..
20:31:02matlockHappens in Edge and Firefox. In trying to change it I also got downgraded to moderated, my username here is haydenb.
20:33:31matlockAnyways, the snap packages of Nim are rebuilt nightly but I went ahead and triggered a build of 1.2 to go out on stable, so those are available with $ snap install nim-lang
20:38:08FromGitter<kaushalmodi> Congrats on the 1.2 release!
20:38:49PMunch!eval echo NimVersion
20:38:51NimBot1.2.0
20:39:10PMunchYes! The auto-build and update of the playground is working :)
20:39:11moermYay! Hurray!
20:40:47*rnrwashere quit ()
20:41:43*rnrwashere joined #nim
20:43:23leorizeshashlick: just ask, maybe I can answer :)
20:44:04FromGitter<kaushalmodi> PMunch: ๐ŸŽ‰
20:44:31PMunchHmm, trying to make my tree edit distance library generic is proving to be a pain
20:45:12*nsf quit (Quit: WeeChat 2.7)
20:45:48*narimiran quit (Quit: leaving)
20:55:00PMunchThis for example seems to fail: http://ix.io/2gx5/nim
20:55:22PMunchIt suddenly doesn't recognise that `index` is port a parameter and the name of the procedure..
20:56:59*NimBot joined #nim
20:58:35AraqPMunch: come on, that's bad code
20:58:51Araqwhy not use 'result'?
20:58:56PMunchNaming things are hard okay!
20:59:19PMunchCan I use result as the input variable?
20:59:20moermHello, Araq. Thanks for 1.2!
20:59:44Araqyou're welcome. don't use DrNim yet though
20:59:50Araqit's still junk :-)
21:00:10PMunchNope, apparently not..
21:00:39moermmeaning? "totally useless"? "unreliable"? "lots of open ends dangling"?
21:01:56PMunchWhat about this then: http://ix.io/2gx5/nim
21:02:06*Pixeye quit (Ping timeout: 256 seconds)
21:02:24PMunchThat last line I get an error: `Error: type mismatch: got <int, proc (x: var seq[T], i: Natural){.noSideEffect.}>`
21:02:33PMunchexpression: forestdist[i1 - 1][0] + delete
21:02:58PMunchSo it doesn't see delete as the int argument to zhangShasha, but rather as the delete procedure?
21:04:25*luis_ quit (Ping timeout: 264 seconds)
21:04:26Araqmoerm: I need to implement 'old' properly and base it on a CFG
21:04:43shashlick@leorize @Araq - if a C header has a global variable - is there value in wrapping it if {.header.} is not included
21:04:57*inv2004 joined #nim
21:05:01moermAraq Hmmm, OK (a bit grumbly because I was soooo hot for Drnim)
21:05:07Araqshashlick: what does that mean?
21:05:43moermPMunch are you sure you want to name an arg just like the proc?
21:06:04PMunchI've fixed that now, as Araq said, not very good code
21:06:33PMunchIt was just an issue with index being a verb and a noun..
21:06:47shashlickExample https://github.com/svn2github/pcre/blob/10e4adbfe9aab5869079fba5edc0ce56fa1b078e/pcre.h.in#L489
21:07:14shashlickDoes pcre_malloc even exist if the header isn't included
21:07:17leorizeshashlick: yes, you still have to wrap them
21:08:08moermA global var in a header? Someone with a dark sense of humour ...
21:08:16shashlickWill it refer to the same memory
21:09:04Araqmoerm: still waiting for your article :-)
21:09:04leorizeyes, mark it with `{.importc.}`
21:09:19leorizeand maybe `{.dynlib.}`
21:09:37leorizebut `{.importc.}` should be more than enough
21:10:04moermAray Almost completed, sir
21:10:23Araqand btw DrNim received about 5 days of development, give me 5 more days and I'll use it myself for the Nim compiler :-)
21:10:33shashlickOk makes sense
21:11:07*inv2004 quit (Ping timeout: 260 seconds)
21:11:30moermPraise the Lord ... and right after Him, praise Araq! *g
21:12:02Araqbut for the Nim compiler I'll add --assumeUnique
21:12:37Araqit's unsound but otherwise not useful for the Nim compiler
21:13:18moermAraq ... like "restrict"? Makes sense
21:13:47shashlickSome questions feel dumb in retrospect but what can you do
21:14:03Araqmoerm: lise 'assume restrict everywhere'
21:14:06Araq*like
21:14:41PMunchHuh, curiously removing the [T] from the closure procedure there fixed the issue..
21:15:04moermAraq As long as there is a way to declare an alias, no problem
21:16:43FromDiscord<kaderallam> Hello Guys, it's been a long time since i first tried to switch to Nim back in 2015/2016 then had not time and now i am again looking at a language to replace C/Python combination, I am looking at Go/Rust and of course Nim.
21:17:22FromDiscord<kaderallam> I have a question, is there a simple way to exchange/synchronise/persist data between nim program sitting on different servers
21:18:00leorizeyou can just turn data into json then beam them to whatever servers of your choice :)
21:18:44*Vladar quit (Quit: Leaving)
21:19:58PMunchWait, when was this warning removed? "Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]"
21:20:38FromDiscord<kaderallam> Thanks @leorize how do you beam data between servers
21:21:15PMunchHowever you want
21:21:41PMunchHTTP is an obvious candidate
21:22:08FromDiscord<kaderallam> http is slow
21:22:34FromDiscord<kaderallam> is there a way to keep a tcp socket between nim programs and stream data over it
21:22:38PMunchYou could use a straight socket if you'd like
21:22:44PMunchSure
21:23:11FromDiscord<kaderallam> Thanks @PMuch
21:24:09*rnrwashere quit (Remote host closed the connection)
21:24:37PMunchLots of new "faces" here today, is it because the 1.2.0 release and HN coverage?
21:25:34FromDiscord<kaderallam> Yeah I saw the 1.2
21:25:39FromDiscord<kaderallam> on hackers news
21:25:50FromDiscord<kaderallam> and also i am killing myself trying to do rust
21:27:12FromDiscord<Rika> what 1.2 released??
21:27:18FromDiscord<Rika> man am i not in touch lol
21:28:01PMunchHaha, yeah it dropped today
21:28:26PMunchkaderallam, Nim might be a good fit if you're trying to replace Python/C
21:28:54PMunchNot sure if you saw the Nim April fools joke, but it basically played on how Nim is great for exactly that usecase
21:31:05*rnrwashere joined #nim
21:32:03*Zectbumo joined #nim
21:32:08FromDiscord<Rika> `The compiler now warns about inheriting directly from system.Exception as this is very bad style.` WOOOOOOOOOO
21:32:14FromDiscord<Rika> yes!
21:32:16FromDiscord<kaderallam> no where can i see ? I did write some code in Nim just to test it a few years ago, ( https://github.com/aallamaa/desirnim ) but finally never made the switch
21:33:03leorizeit's on the forum, you can't miss it :P
21:33:17PMunchkaderallam: https://forum.nim-lang.org/t/6136
21:33:32FromDiscord<kaderallam> thx @PMunch
21:37:22*luis_ joined #nim
21:42:10FromDiscord<Rika> oh man, docs dark mode is now on stable docs
21:45:28PMunchOof, my .choosenim directory is 11G..
21:48:20PMunchhttps://uploads.peterme.net/choosenim.png
21:48:30*natrys quit (Quit: natrys)
21:48:33PMunchThe red inner circle is toolchains
21:48:43PMunchThe orange is downloads
21:49:02FromDiscord<Rika> what versions do you have???
21:49:25PMunchAnd in each of those blocks in toolchains (one for each version) there is a c_sources folder that is the bulk of the thing
21:50:10PMunchhttps://uploads.peterme.net/choosenim_list.png
21:50:16PMunchRika ^
21:50:22PMunchMost of them I think :P
21:52:44FromDiscord<Rika> nim 0.11...
21:53:17*Trustable quit (Remote host closed the connection)
21:54:23rayman22201Nim evangelism strike force engage :-P
21:55:36PMunchRika, well I started using Nim around version 0.13 I think..
22:06:14*solitudesf quit (Ping timeout: 265 seconds)
22:11:52moerm- falling back into the chat - hello to the new ones
22:13:39FromDiscord<Rika> hello moerm, i saw the post you made in the april fools thread
22:13:45FromDiscord<Rika> and i hate it lmao
22:18:04Araquh oh
22:20:58FromDiscord<Rika> uh oh?
22:21:57FromDiscord<Recruit_main707> It was Araq to my iirc
22:21:58leorizePMunch: https://old.reddit.com/r/programming/comments/fub4s0/nim_v12_released/fmcdyv0/ <- you can advertise here :)
22:22:17FromDiscord<Recruit_main707> Released already!!!
22:22:22FromDiscord<Recruit_main707> HYPE
22:23:47*WilhelmVonWeiner quit (Ping timeout: 240 seconds)
22:26:19*rnrwashere quit (Remote host closed the connection)
22:27:43*rnrwashere joined #nim
22:27:52*inv2004 joined #nim
22:28:18*jegfish joined #nim
22:32:38shashlickPMunch: choosenim now deletes csources after installation
22:32:58FromGitter<brentp> ```[SYSASSERT] sizeof FreeCell โŽ Error: execution of an external program failed: ...``` [https://gitter.im/nim-lang/Nim?at=5e87b99a17666550b2024fb3]
22:33:34PMunchOh, I guess I should update it then..
22:33:58FromGitter<brentp> should i open an issue? this is on `Nim Compiler Version 1.3.1 [Linux: amd64]`
22:34:25PMunchchoosenim v0.3.2 (2018-02-28 14:12:37)
22:34:33PMunchRight, I was a couple of versions behind..
22:34:35shashlickv0.6.0 is latest
22:34:39*luis_ quit (Quit: luis_)
22:34:43shashlickbut it won't clean up older versions
22:34:47moerm1.3.1 ? From what I know we just got 1.2
22:34:54shashlickso might want to xargs rm or something
22:35:18shashlickmoerm: that will be the next devel version - like 1.1.1
22:37:05moermAh, OK
22:37:24PMunchfind . -type d -name c_code -exec rm -rf {} +
22:37:35PMunchTook that folder from 11.6G to 2.9G :P
22:43:53*rnrwashere quit (Remote host closed the connection)
22:45:14*rnrwashere joined #nim
22:47:11moermBye, cu soon
22:47:17*moerm quit (Quit: Leaving)
23:01:29*rnrwashere quit (Remote host closed the connection)
23:08:37*inv2004 quit (Quit: Leaving)
23:08:52*dddddd quit (Ping timeout: 256 seconds)
23:15:40*tane quit (Quit: Leaving)
23:18:53*noonien joined #nim
23:35:43PMunchOh nice, StackOverflow now also has a darkmode
23:43:34*rnrwashere joined #nim
23:46:14*krux02_ joined #nim
23:48:26*krux02 quit (Ping timeout: 240 seconds)
23:49:02*PMunch quit (Quit: leaving)
23:56:56FromDiscord<exelotl> lol yeah that blew my mind
23:57:34FromDiscord<exelotl> I'm still using the april fools skin from last year lol
23:57:43FromDiscord<exelotl> (as a userscript)
23:58:04FromDiscord<exelotl> I wish github would get a dark mode
23:58:44*rnrwashere quit (Remote host closed the connection)