<< 27-01-2019 >>

00:22:21FromGitter<nepeckman> Is it possible to create a type for compile time? I'd like to keep some NimNodes together in an object for a set of compile time procs
00:28:40FromGitter<nepeckman> I tried putting the type declaration under a static statement, doesn't seem to help the procs know about the type
00:28:55FromGitter<timotheecour> use a macro
00:29:28FromGitter<timotheecour> ```macro foo(): untyped = ⏎ quote do: ⏎ type Foo = object``` [https://gitter.im/nim-lang/Nim?at=5c4cfb68975714406b4925f7]
00:29:51FromGitter<nepeckman> These procs are running at compile time though, won't that macro be too late?
00:30:05FromGitter<timotheecour> u can call a macro at CT
00:30:11FromGitter<timotheecour> try
00:30:33FromGitter<nepeckman> So write that macro and immediately invoke?
00:32:53FromGitter<nepeckman> ```code paste, see link``` ⏎ ⏎ This doesn't compile [https://gitter.im/nim-lang/Nim?at=5c4cfc35c2dba5382e93475b]
00:33:14FromGitter<timotheecour> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c4cfc4a41775971a08c8578]
00:34:18FromGitter<timotheecour> gtg
00:37:37*oculux quit (Remote host closed the connection)
00:38:23*oculux joined #nim
00:48:11*pagnol quit (Ping timeout: 246 seconds)
00:57:45*zachk quit (Quit: Leaving)
01:14:26*libman_ joined #nim
01:15:20*oculux quit (Quit: blah)
01:15:24*darithorn_test joined #nim
01:18:10*darithorn_test quit (Remote host closed the connection)
01:22:58*crem quit (Ping timeout: 272 seconds)
01:24:49*crem joined #nim
01:26:00*oculux joined #nim
01:30:57*xet7 quit (Remote host closed the connection)
01:39:26*oculux quit (Quit: blah)
01:41:19*elrood quit (Remote host closed the connection)
02:03:21*rect0x51 joined #nim
02:03:23*zachcarter quit (Ping timeout: 245 seconds)
02:08:26*ng0_ joined #nim
02:11:59*ng0 quit (Ping timeout: 256 seconds)
02:14:52*Tyresc quit (Quit: WeeChat 2.4-dev)
02:26:57*oculux joined #nim
02:41:53*gangstacat quit (Remote host closed the connection)
02:42:31*zachcarter joined #nim
02:45:56*crem quit (Ping timeout: 240 seconds)
02:48:24*crem joined #nim
03:02:21*banc quit (Quit: Bye)
03:08:02*rect0x51 quit (Quit: WeeChat 2.3)
03:18:28*ng0_ quit (Quit: Alexa, when is the end of world?)
03:22:59*banc joined #nim
03:30:31*smitop quit (Quit: Connection closed for inactivity)
03:52:00*crem quit (Ping timeout: 252 seconds)
03:53:44*crem joined #nim
04:10:56*crem quit (Ping timeout: 240 seconds)
04:12:14*crem joined #nim
04:33:33*darithorn quit (Quit: Leaving)
04:36:18*darithorn_ joined #nim
04:36:35*darithorn_ quit (Remote host closed the connection)
04:41:06*darithorn_ joined #nim
04:41:14*darithorn_ quit (Remote host closed the connection)
05:08:32*nsf joined #nim
05:21:02*noonien quit (Quit: Connection closed for inactivity)
05:22:52*Marumoto joined #nim
05:25:39*Marumto quit (Ping timeout: 244 seconds)
05:35:57*oz quit (Ping timeout: 252 seconds)
05:40:18*dddddd quit (Remote host closed the connection)
05:50:40*wildlander quit (Excess Flood)
05:51:34*wildlander joined #nim
06:02:43*oz joined #nim
06:08:38*Marumoto quit (Remote host closed the connection)
06:18:35*nsf quit (Quit: WeeChat 2.3)
06:25:08FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ what am I missing here? image data send incorrectly [https://gitter.im/nim-lang/Nim?at=5c4d4ec478e1ed4103972d5f]
06:27:36*narimiran joined #nim
06:46:07leorizenarimiran: autocomplete arrived https://github.com/alaviss/nim.nvim
06:46:50narimiranleorize: thanks for ruining my free sunday! :P
06:48:37leorize:P
07:02:50libman_nim vim zim Lim
07:14:38libman_Reminder: https://github.com/nim-lang/Nim/wiki/Editor-Support needs updating
07:15:38narimiranleorize: "Add this to your configuration file to register the autocomplete source" sorry for the stupid question, but what file is that?
07:15:55leorizeneovim configuration file
07:20:33narimiranleorize: i guess i'm doing something wrong because i can't get the behaviour you showed in that asciinema video
07:21:47leorizewhat do you get?
07:21:51narimirannothing :D
07:22:28leorizethis is why I don't share plugins :P
07:22:36leorizecan you give me you :messages output?
07:22:38leorizeyour*
07:22:50narimirannah, this is on me, i'm complete nvim newbie
07:23:00leorizeI was joking :P
07:23:09leorizedid you get the semantic highlighter working?
07:23:18narimiranlet us go on private, to not spam it here
07:33:21*lritter joined #nim
07:48:55*xet7 joined #nim
07:53:58*Perkol joined #nim
07:55:25PerkolIn jester, I get a crash when I try to access static file https://bpaste.net/show/09cc91e15b71
07:55:33PerkolWhat may be the reason?
07:59:44Araqjester.nim(177)
08:03:36*Trustable joined #nim
08:10:09PerkolIt thinks it doent exist?
08:14:11PerkolHm, it serves css normally, bot not this file
08:15:35*fanta7531 joined #nim
08:21:45PerkolThis file is an ELF executable, other filetypes work. Should I submit bugreport?
08:25:19*Trustable quit (Remote host closed the connection)
08:35:29Araqensure it's not a permission problem first
08:35:53FromGitter<Bennyelg> Hey, where can I find a simple guide of 'How create an nim code and import it on python' ?
08:44:06FromGitter<bung87> https://github.com/bung87/nim-pymod
08:46:09FromGitter<bung87> https://github.com/yglukhov/nimpy
08:46:54FromGitter<Bennyelg> thank you!
08:57:25FromGitter<Bennyelg> `````` [https://gitter.im/nim-lang/Nim?at=5c4d72757b68f94102268b18]
09:06:16FromGitter<Varriount> Araq: is there any documentation on how to use the regions Garbage collector?
09:08:37*fanta7531 quit (Quit: fanta7531)
09:19:30Araqit is not a GC, you need to free memory regions explicitly
09:21:39PerkolHow do I get random element from set?
09:26:18narimiranPerkol: does it have to be random, or can it be any element?
09:32:58Perkolany element
09:35:26*nsf joined #nim
09:35:54narimiranugly hack: `let a = mySet.pop` (followed by `mySet.incl a`)
09:38:21Araqno he wants the pop, no need to incl it back
09:38:39*Vladar joined #nim
09:39:16narimirani didn't know if Perkol just wants to have some element (while it stays in the set), or a simple pop is what he's looking for
09:40:00Araqmost (all?) algorithms I know ask for an arbitrary set element and then delete it from the set
09:41:20narimiraneh, i guess i overanalyzed "how do i *get*", thinking that otherwise he would write "how do i remove" :)
09:51:47FromGitter<Varriount> Araq: So is there any documentation on how to use it properly?
10:03:33AraqI wrote a blog post about it but it's still being refined
10:03:56*vonHabsi quit (Ping timeout: 250 seconds)
10:03:57Araqanyhow, gcbench or thavlak have been patched to show --gc:regions work
10:05:12Araqand if you use threading, it's particularly easy, every thread has 'withScratchRegion' in its main loop and the .gcsafe effect ensures you cannot mix memory regions
10:05:34*vonHabsi joined #nim
10:09:38*fanta7531 joined #nim
10:13:39*STX_ joined #nim
10:14:02*STX_ is now known as Guest13981
10:19:57*Guest13981 left #nim (#nim)
10:41:47*narimiran quit (Ping timeout: 246 seconds)
10:45:46*elrood joined #nim
10:47:26ZevvAraq, on friday you were having a lengthy discussion with timotheecour about return vs result and proving correctness. I do understand your point here, but I was wondering: how could you ever cope with having exceptions in a language if your highest goal is to have things provable? Aren't exceptions even worse then premature returns, because you can't even *see* in your code where it might drop out of
10:47:32Zevvonly-god-knows-how-many stack frames?
10:50:03*zachcarter quit (Ping timeout: 245 seconds)
10:53:19*oculux quit (Remote host closed the connection)
10:54:26*oculux joined #nim
10:57:02AraqZevv: they are the same as 'return', read my blog post about "quirky exceptions"
10:58:03FromGitter<Clyybber> Araq: Are you hoping to merge quirky-exceptions anytime soon?
10:59:07*smitop joined #nim
11:00:54Araqwell it's a rather clean patch, could be merged today. But I don't know if it's good. I'm still thinking about an escape analysis that would make them safer to use.
11:06:59FromGitter<Clyybber> Great to hear. It sounds good to me at least. But I now nothing about escape analysis so :D
11:07:10FromGitter<Clyybber> @leorize Is this the one? https://github.com/baabelfish/nvim-nim
11:08:17FromGitter<Clyybber> nvrmind, found your one
11:11:34*pagnol joined #nim
11:23:57*aguspiza joined #nim
11:31:36*dddddd joined #nim
11:41:24*Perkol quit (Remote host closed the connection)
11:43:22AraqZevv: or actually, you are right, you don't "see" them like you see 'return' but we have exception tracking in the language to fight it
11:47:51*zachcarter joined #nim
11:52:08*zachcarter quit (Ping timeout: 245 seconds)
11:59:46ZevvI was just reading up on that yes
12:03:28ZevvI guess things get hairy with callback functions etc, hard to infere effects there
12:03:32*PMunch joined #nim
12:09:12*stefanos82 joined #nim
12:12:15*leorize quit (Quit: WeeChat 2.3)
12:12:25*leorize joined #nim
12:20:52*pagnol quit (Ping timeout: 250 seconds)
12:33:30*MyMind joined #nim
12:34:56*Sembei quit (Ping timeout: 240 seconds)
12:36:26PMunch"Warning, the .this pragma is deprecated" did it get replaced with something, or did we miss some really nice functionality there?
12:38:03leorizenope, it's not replaced by anything
12:38:37Zevvcommit b4e5c9d0 Aug 9: "deprecate the .this pragma"
12:41:02Zevvleorize: add you plugin to the editor support page on the github wiki!
12:43:21leorizeI think I should document the plugin properly before adding it there :P
12:43:33Zevvdocumentation is for sissies
12:43:52Zevvvim plugins for the masses!
12:45:08*dddddd quit (Ping timeout: 250 seconds)
12:48:01leorizewell, I guess I'll add it later :P
12:48:50*dddddd joined #nim
12:53:52PMunchleorize :( Why was it deprecated though? Such a nice feature when doing OO stuff
12:54:06leorizeAraq: ^
12:59:10*Trustable joined #nim
13:07:50elroodyou know a language is not yet mature when things get deprecated without a link to any preceding discussion
13:09:46*vonHabsi quit (Ping timeout: 272 seconds)
13:15:46*Yardanico quit (Quit: No Ping reply in 180 seconds.)
13:17:12*Yardanico joined #nim
13:22:08FromGitter<kaushalmodi> PMunch: https://github.com/nim-lang/Nim/commit/b4e5c9d075d9c2ef6192749b02738966b3dc943d
13:23:05*nc-x joined #nim
13:23:16FromGitter<kaushalmodi> I haven't used that pragma, but based on that commit, looks like it provided just some syntactic sugar earlier and now you need to prefix the "scope" (like `obj.elem`)?
13:24:11FromGitter<kaushalmodi> elrood: Looks like the reason for deprecation is in that commit and changelog.
13:24:22nc-xIIRC the reason for deprecation was that {.this.} had bugs related to generics, there is `using`, and Araq said that in the future it could probably be implemented as a macro.
13:26:23PMunchkaushalmodi, {.this: X.} was used to set the name of the first argument as the scope of procedures. Meaning you wouldn't have to do "obj.field" within those functions
13:27:23FromGitter<kaushalmodi> PMunch: I believe there was a package that did that
13:28:00PMunchHmm, I can't find anything about `using`
13:28:55elroodkaushalmodi, i've seen that commit. Zevv mentioned it earlier, and it's reasonably easy to find anyways. reason: yes, link to any background info, issue, exchange of opinions: no
13:31:43FromGitter<kaushalmodi> Punch: there was a package that defined a macro .. let's say `with`, that allowed doing:
13:31:48FromGitter<kaushalmodi> ``````
13:31:57FromGitter<kaushalmodi> Argh, cannot type on mobile
13:32:26FromGitter<kaushalmodi> `with a:\n echo b # echoes a.b`
13:32:57FromGitter<kaushalmodi> Does someone remember the name?
13:36:00*nsf quit (Quit: WeeChat 2.3)
13:46:47*nc-x quit (Ping timeout: 256 seconds)
13:47:06*nc-x joined #nim
13:47:16nc-xPMunch: https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement
13:47:23nc-xelrood: it was discussed a lot on gitter/irc before being deprecated
13:49:03*zachcarter joined #nim
13:49:12elrooda link to that discussion naturally belongs into the commit message for a language that's aiming to be ready for a 1.0 release is what i was saying, nc-x
13:49:26PMunchHmm, so `using` only saves some type typing
13:50:11PMunchThat's not as annoying as having a procedure meant for an object and having the specify the name of the parameter of the object every time you need to use some state of the object though..
13:50:50*nc-x quit (Client Quit)
13:53:57*zachcarter quit (Ping timeout: 268 seconds)
14:10:11Araqelrood: I agree completely but it was deprecated some time ago already, nowadays there would have been an RFC covering it
14:10:37Araqplus it always had to be enabled explicitly.
14:11:23Araqwe need to be able to remove features that don't pull in their weight.
14:12:57PMunchthis: self is such a convenient feature though..
14:13:09AraqPMunch: I feel your pain but this feature should never have made it, due to its poor quality
14:13:43PMunchAre there any options that get me kind of the same function?
14:14:47Araqyou can write a macro that transforms the proc that uses 'system.compiles' to see if 'x' should be 'self.x'
14:14:58Araqbut I never tried to do that :-)
14:15:55AraqI think .self turned the language past its breaking point, even "freedom of boilerplate" can be taken too far
14:16:13Araqbbl
14:20:11*vonHabsi joined #nim
14:21:02*narimiran joined #nim
14:34:18*stefanos82 quit (Remote host closed the connection)
14:49:00*Ven`` joined #nim
14:56:22*zachcarter joined #nim
14:58:07*gangstacat joined #nim
14:58:13*gangstacat quit (Remote host closed the connection)
14:58:37*gangstacat joined #nim
15:00:46*zachcarter quit (Ping timeout: 250 seconds)
15:16:39*PMunch quit (Remote host closed the connection)
15:30:42*ng0 joined #nim
15:31:07FromGitter<kaushalmodi> finally remembered!
15:31:10FromGitter<kaushalmodi> PMunch: https://github.com/citycide/cascade ?
15:40:16FromGitter<zetashift> that's pretty handy actually
15:46:31*fanta7531 quit (Quit: fanta7531)
15:55:45*zachcarter joined #nim
15:59:56*zachcarter quit (Ping timeout: 240 seconds)
16:02:33*fanta7531 joined #nim
16:15:44FromDiscord_<exelotl> it would be lovely if a 'with foo: ...' macro existed to fill the role of {.this:foo.} but such a macro seems really hard to get right
16:17:34FromDiscord_<exelotl> it needs to handle every kind of node, transform x into foo.x but only if foo.x is valid, but also not if x exists at a lower scope
16:18:12ZevvWhy not if x exists at a larger scope?
16:18:45ZevvThe rule could simple be that the inner hides the outer
16:19:38FromGitter<kaushalmodi> Zevv, exelotl: may be an RFC is in order :)
16:19:45leorizeI don't think such a macro is too complex
16:19:51FromDiscord_<exelotl> I think a local x should take precedence over foo.x, but foo.x should take precedence over a global x
16:19:55FromGitter<kaushalmodi> I don't know Nim enough to design such a macro, but can surely test it out
16:19:56FromDiscord_<exelotl> if that's clear
16:19:58leorizebut iirc pascal people seems to dislike the idea of `with`
16:20:14FromGitter<kaushalmodi> leorize: `with` is beautiful
16:20:27FromGitter<kaushalmodi> *at least in Emacs (Lisp) I see it everywhere*
16:20:40leorizeyea, I used it a lot back when I was initializing structures in pascal
16:20:42FromDiscord_<exelotl> JS folks hate it but that's because it's poorly designed in JS
16:23:50leorizehttp://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-with-is-evil-isn-t-it-td3219144.html
16:33:31*skellock joined #nim
16:34:58*smitop quit (Quit: Connection closed for inactivity)
16:35:02*gsc70cstr joined #nim
16:36:42*gsc70cstr quit (Quit: leaving)
16:38:01*zachcarter joined #nim
16:39:09*narimiran quit (Quit: Leaving)
16:39:11*gscacco joined #nim
16:42:29*zachcarter quit (Ping timeout: 244 seconds)
16:43:21*narimiran joined #nim
16:44:14FromGitter<Varriount> What is "with" in Pascal?
16:45:26*zachcarter joined #nim
16:45:31*pagnol joined #nim
16:45:45*gscacco quit (Quit: leaving)
16:46:00*gscacco joined #nim
16:47:09*gscacco quit (Client Quit)
16:54:44*livcd quit (Ping timeout: 250 seconds)
16:55:41leorizeVarriount: `with a do x := 10;` == `a.x := 10;` if `x` is a member of `a`
16:56:38narimiranhmm, doesn't nim have (or it had), `using` or something like that?
16:56:55narimirani know i've seen it somewhere, but never used it myself
16:57:32leorizeusing is to avoid specifying types for function
16:57:41narimiranaha! true
16:57:46leorizeno one seem to use it tho
16:58:01narimirannobody is using using :)
17:01:56*livcd joined #nim
17:06:56*Ven`` quit (Ping timeout: 240 seconds)
17:15:19FromGitter<Clyybber> I am using `using`
17:15:44FromGitter<Clyybber> I dont want to have to write "device: VkDevice" all the time
17:15:50FromGitter<Clyybber> as an example
17:21:49*pagnol_ joined #nim
17:22:09pagnol_can nimble install packages directly from github?
17:22:16narimiranpagnol_: yep
17:22:26narimiran`nimble instal <url>`
17:22:42pagnolI tried that but nimble kept installing an older version, not the one in master
17:22:54pagnolwith https://github.com/niv/websocket.nim
17:23:11pagnolnimble keeps downloading 0.3.4
17:23:13federico3https://travis-ci.community/c/languages no Nim entry :(
17:23:25narimiranpagnol: https://github.com/nim-lang/nimble#nimble-install
17:23:36narimiranspecify "@#head"
17:24:27pagnoloh, thanks
17:37:43zestyrpagnol: take a look at this package https://github.com/treeform/ws
17:37:55*nsf joined #nim
17:38:41zestyraccording to treeform, the websocket.nim package isn't very Nim-like, so he created ws
17:40:53*skellock quit (Ping timeout: 245 seconds)
17:48:00*pagnol_ quit (Ping timeout: 252 seconds)
17:48:00*pagnol quit (Ping timeout: 252 seconds)
18:04:33*ng0 quit (Ping timeout: 256 seconds)
18:10:43*skellock joined #nim
18:26:10*skellock quit (Ping timeout: 250 seconds)
18:27:44*noonien joined #nim
18:31:07*noonien quit (Client Quit)
18:50:27*pagnol joined #nim
18:51:27*skellock joined #nim
19:01:47*skellock1 joined #nim
19:05:56*skellock quit (Ping timeout: 240 seconds)
19:06:20*skellock1 quit (Ping timeout: 272 seconds)
19:12:57FromGitter<Clyybber> @kaushalmodi exelotl Zevv PMunch I quickly extracted this from citycides cascades: https://gist.github.com/Clyybber/7655fb852dafa701a3ee7847c5b51b10
19:13:07FromGitter<Clyybber> Pretty simple as leorize said
19:14:07FromGitter<Clyybber> Usage is something like this: ⏎ ⏎ ```with someObject: ⏎ someMethodOfThatObj ⏎ someField = 0``` [https://gitter.im/nim-lang/Nim?at=5c4e02ff41775971a09281df]
19:16:35FromGitter<Clyybber> @kaushalmodi tagging you because it didn't work in the message above
19:16:56ZevvClyybber: Ah, I was trying to build my own `with` macro, but you beat me to it
19:17:41Zevv*but*: I was also traversing the whole AST recursively, wich yours doesn't. Can you handle nested blocks under the "with:" block?
19:17:50FromGitter<Clyybber> nope
19:18:20ZevvThen I'll see if I can get this to work! :)
19:18:49FromGitter<Clyybber> Let me know how it goes :D
19:18:59ZevvI started too complicated I'm afraid
19:19:27ZevvI'm recursively looking op all nnkIdent nodes to check if the ident is a member of the given object
19:20:29FromGitter<Clyybber> Yeah I think you just need to do something like citycide does here (in the commented part of the code I sent)
19:24:13FromGitter<Clyybber> and then join the statement lists somehow
19:30:21zestyrthat cascade macro looks pretty useful, especially for UI code, thanks for sharing it
19:32:41*abm joined #nim
19:35:25FromGitter<kaushalmodi> zestyr: you're welcome :)
19:36:11FromGitter<kaushalmodi> @Clyybber how does that `with` macro differ from Cascade?
19:36:46FromGitter<Clyybber> it doesn't "return"
19:37:23FromGitter<kaushalmodi> Araq: wondering if citycide's Cascade (probably renamed to `with`) would be accepted as an stdlib package
19:37:30FromGitter<Clyybber> as in you can't do this ⏎ ⏎ ```let someObj = with someObj(): ⏎ someField = 0``` [https://gitter.im/nim-lang/Nim?at=5c4e087a93fe7d5ac0fd574c]
19:38:03FromGitter<Clyybber> but have to do this: ⏎ ⏎ ```var someObje = someObj() ⏎ with someObj: ⏎ someField = 0``` [https://gitter.im/nim-lang/Nim?at=5c4e089b1b62f126505b8ee5]
19:38:16FromGitter<kaushalmodi> Understood
19:38:52FromGitter<Clyybber> @kaushalmodi Cascade can't be used the way that with macro can be used, because it returns
19:39:04Zevvdoes anyone know a simple idiomatic snippet for recursively traversing and modifying AST? What I'm doing feels too convoluted
19:39:14FromGitter<Clyybber> @kaushalmodi Yeah, I think we need a with in the stdlib
19:39:29FromGitter<Clyybber> Let's see if Zevv or me can come up with something worthy :D
19:39:56Zevv:)
19:40:37FromGitter<Clyybber> Zevv I don't know any "idiomatic" way, but I think a while loop should do?
19:40:58FromGitter<Clyybber> I don't think you can use recursive macros, but I may be wrong
19:43:36Zevv have something that nests
19:43:41Zevvand can even nest with itself
19:44:18Zevvhttp://paste.debian.net/1062784/
19:44:27Zevvits not efficient though, I guess
19:44:41ZevvUsage is on the bottom: two objects 'foo' and 'bar'
19:45:04Zevvget passed to the macro. Top of the macro finds the list of field names and places those in a seq[str] - should be some kind if hash of course
19:45:13FromGitter<Clyybber> Thats awesome
19:45:27Zevvand then passes the code block to the 'aux' proc which recurses and find all idents which match the field name, and replaces those with a dot expr
19:46:11FromGitter<Clyybber> Zevv, why should it hash them?
19:46:46ZevvLine 19
19:47:12*lritter quit (Ping timeout: 250 seconds)
19:48:08FromGitter<Clyybber> Why do you check if the field is valid anyways?
19:48:29FromGitter<Clyybber> If it isn't the compiler is gonna complain by itself
19:48:42ZevvYeah but you'd want to use non-field identifiers as well, right?
19:49:00FromGitter<Clyybber> Ah, yes
19:49:01Zevvyou could basically throw the whole contents of a proc in a 'with' and forget about it
19:49:12Zevvso basically it should work kind of the old with pragma
19:49:28Zevvbut this implementation is probably severely broken for all but the most trivial use cases
19:50:23ZevvI'll do some cleaning up
19:53:55*nsf quit (Quit: WeeChat 2.3)
19:59:17Zevvhttps://github.com/zevv/nimwith/blob/master/with.nim
20:02:30FromGitter<Clyybber> Oh yeah, that looks nice, good job !
20:03:27Araqkaushalmodi: unlikely, we polish what we have and only occasionally add modules we need for the infrastructure ('diff' algorithm)
20:03:36Zevvbroken for refs, trying to fix that
20:04:46FromGitter<Clyybber> @Araq Wouldn't this fit in sugar.nim tho?
20:04:46Zevvah araq, could you spare a second if you have time? I'm for the first time doing recursion in a macro, is this the proper way to recurs and modify? https://github.com/zevv/nimwith/blob/master/with.nim
20:04:57Zevvline 20, proc `aux`
20:05:33Zevvfor each node I do a copyNimNode and then add() all children of the current node. It feels expensive
20:05:57Zevvbut it is consice
20:06:13*Tyresc joined #nim
20:07:34AraqZevv: it's what I do too. a 'recurse' macro would be nice to have though
20:08:24Zevvhm, one baby step at a time for me, first let me get this to work :)
20:08:28Zevvthanks
20:11:56Araqbtw "hello world" now works with --gc:destructors
20:12:07Araqbut str.add crashes :P
20:12:10Zevv\o/
20:12:17FromGitter<Clyybber> yay
20:13:02ZevvIts funny - there is *so* much else you could do in all the time you spent getting constructors to work :/
20:13:03*Trustable quit (Remote host closed the connection)
20:13:17FromGitter<Clyybber> Zevv When you add a common field to both objects, the nested with wont work
20:13:24Araqreally? like what? Zevv
20:13:29FromGitter<Clyybber> I think constructors are really important
20:13:30ZevvClybber: of coruse not :)
20:13:46Araqthe feature is called "destructors" btw
20:13:57FromGitter<Clyybber> Zevv It could though, I expected it to shadow them
20:13:58Zevvyeah, of course, destructors, sorry
20:14:18FromGitter<Clyybber> Araq: I just copied that typo :P
20:14:51ZevvI'm just nitpicking from my limited world view as someone who never used a destructor in his life.
20:15:12ZevvAnd if I never used it, it must be stupid because I never missed it :)
20:15:43FromGitter<Clyybber> they are a life saviour in complicated big messy interacting codebases
20:16:24ZevvI can only think of the nightmare implementing this must be. How he hell do you handle the case where an exception causes destructors to trigger which cause an exception themselves?
20:17:10ZevvDo you then have two pending exceptions? Which one can you catch? What do you do if in that case only half your destructor was ran?
20:17:38FromGitter<Clyybber> thats why in cpp destructors cant raise exceptions afaik
20:18:12Zevvand what if they do? are you not allowed to write code in a destructor that *could* raise? Or does it simple not raise where it normally would?
20:18:19FromGitter<Clyybber> or at least its undefined behaviour
20:18:28Zevvand there you have it :/
20:18:51Araqthat's why I researched "quirky exceptions" :-)
20:19:16Araqin a destructor you set the error indicator.
20:19:53ZevvUB is one of the reasons I'm sick of C, I'm happy to now use a language which doesn't have too much of that
20:20:51ZevvAraq: would switching to Q.E. make your destructors more simple?
20:22:05FromGitter<Clyybber> It would allow destructors to raise: ⏎ ⏎ > Destructors can "raise" exceptions naturally since it merely sets an error flag. There are no special rules like "must not throw in a destructor", everything composes in a nice fashion.
20:22:28TyrescDoes len() give back the bytecount of the given string?
20:22:53Araqyou don't have to go "all in" with QE, the conclusion I got from QE is that setting an error indicator works.
20:22:54FromGitter<Clyybber> Zevv So yeah, technically you could have two pending exceptions as in stacking them
20:23:58ZevvAnd you catch them both? So then multiple 'except:'s in one block could go off?
20:25:00ZevvClybber: `with` macro update, now also works for ref obj
20:25:17FromGitter<Clyybber> Tyresc Nim uses utf8, so yeah
20:25:25FromGitter<Clyybber> Zevv Nice
20:25:51ZevvProblem with dup identifiers is that it gets double dotted
20:26:20pagnolanyone here familiar with karax? I'm trying to figure out what triggers the rerendering (and what doesn't)
20:26:50Zevvpagnol: the author is here, I believe
20:28:14ZevvClybber: still lots of cases where with macro is still useless - nested objects, for example.
20:29:56Araqpagnol: every wrapped event causes a redraw()
20:30:44AraqZevv: not sure what you mean, but yes?
20:32:56*narimiran quit (Ping timeout: 240 seconds)
20:33:11FromGitter<Clyybber> Zevv Can you give an example?
20:34:24ZevvClyybber: http://paste.debian.net/1062794/
20:34:33FromGitter<Clyybber> Thanks
20:34:35Zevv'subfoo' does not work here. But its a bit of a corner case
20:34:39*narimiran joined #nim
20:34:44ZevvAraq: sorry, but what question were you answering? :)
20:35:38pagnolAraq, ah thanks I just arrived at this conclusion myself... I guess I should just call redraw() manually after state changes that happen outside of event handlers?
20:40:51Zevvclyybber: I might put it in a nimble, is "with" the right name for this thing? Python people might expect something like `with open("x.txt") as f:` instead
20:43:47FromGitter<Clyybber> I think with is fine.
20:44:00pagnolAraq, I'm modifying the state in a websocket message handler
20:44:49*oculux quit (Quit: blah)
20:44:58Araqyeah redraw() is for cases like this
20:45:10pagnolok, thanks
20:45:23AraqZevv: your question about QE for destructors
20:46:02*oculux joined #nim
20:46:11ZevvNevermind that, this actually goes a bit over my head I think. I was just wondering if your musings about exceptions were inspired by the destructors work, that's why
20:46:52FromDiscord_<exelotl> Zevv: here's how I think `with` should behave regarding local variables with conflicting names: https://gist.github.com/exelotl/a9d1c75012e4287bf9598c084fd7eef5
20:48:04FromGitter<Clyybber> exelotl Yep, I think so too. But that is hard to do, I think
20:48:08Zevvexelotl: yes, that makes sense, but that'll complicate stuff a lot already
20:48:30ZevvI'm already excited as a toddler that I was able to make this work
20:48:53FromGitter<Clyybber> But I think not allowing shadowing this way is also fine
20:52:19Zevvwow, my first nimble
20:52:21Zevv\o/
20:52:36FromGitter<Clyybber> congrats :D
20:53:20*fanta7531 quit (Quit: fanta7531)
20:56:20ZevvBwah, `nimble publish` died on me: ./../../lib/pure/httpclient.nim(222) httpError
20:56:20ZevvError: unhandled exception: Connection was closed before full request has been made [ProtocolError]
20:56:23*TheLemonMan joined #nim
20:58:24*TheLemonMan quit (Client Quit)
21:01:48Zevvclyybber: pkg moved to https://github.com/zevv/with. Time for sleep now.
21:03:09FromGitter<Clyybber> Gn8
21:03:20*skellock1 joined #nim
21:03:55narimiranZevv: show the result of running your example (in readme) ;)
21:04:31narimiranand of course, the more examples the better
21:04:33Zevvnarimiran: willdo
21:05:22*narimiran quit (Remote host closed the connection)
21:07:35*skellock1 quit (Ping timeout: 246 seconds)
21:32:33*elrood quit (Remote host closed the connection)
21:33:06*absolutejam joined #nim
21:33:24absolutejamevening
21:33:54absolutejamI'm using the nimyaml/yaml package and trying to use the macro yaml.set_default_value, but it doesn't work on a ref object
21:34:16absolutejamIs there a way to make it work that I'm missing?
21:34:23FromDiscord_<citycide> @kaushalmodi, zestyr: yeah thanks for sharing and glad cascade seems useful
21:36:11FromDiscord_<citycide> Zevv: haven't looked at code difference yet but if anything you had is a good change or addition to cascade that'd be cool
21:36:41FromDiscord_<citycide> although now I see you published a separate package
21:49:02Araqabsolutejam: I don't know
21:58:01absolutejamfair enough. I'll have a poke at the source, but it may be a bit whooosh for me
21:58:33absolutejamjust didn't know if there was an easy wayt to deref it or something (I know that's wrong) in this context
22:16:56*vlad1777d quit (Ping timeout: 240 seconds)
22:41:11FromGitter<timotheecour> @Clyybber @zevv regarding destructors that throw: it’s not always undefined behavior, as I wrote in that note https://github.com/Araq/blog/issues/1 regarding `quirky exceptions` article: ⏎ ⏎ > there are well defined cases where it's legal to do so since c++11, with noexcept(false) see spec here https://en.cppreference.com/w/cpp/language/destructor
22:51:31*Vladar quit (Remote host closed the connection)
23:04:47FromGitter<timotheecour> better idea
23:05:04FromGitter<timotheecour> (sorry wrong channel, ignore “better idea”)
23:06:15FromGitter<Varriount> Araq: I'm trying the quirky exceptions branch - the only behavior change I can seem to detect is that exception handler code isn't generated.
23:15:22FromGitter<Varriount> I try to open a nonexistant file, then catch the resulting error, however the exception still seem to be thrown.
23:25:29*skellock joined #nim
23:35:58*abm quit (Quit: Leaving)