<< 05-01-2020 >>

00:00:01*junland quit (Quit: %ZNC Disconnected%)
00:03:16*junland joined #nim
00:06:39FromDiscord<exelotl> Hey, the compiler guide mentions setting e.g. `arm.linux.gcc.exe = "arm-linux-gcc"` in your nim.cfg file, in order to use a cross compiler toolchain
00:07:10*Lord_Nightmare joined #nim
00:07:13FromDiscord<exelotl> what would be the equivalent line in a `config.nims` file?
00:10:01FromDiscord<Clyybber> @exelotl Probably switch("arm.linux.gcc.exe", "arm-linux-gcc")
00:11:25*sealmove quit (Quit: WeeChat 2.7)
00:11:29FromDiscord<exelotl> that doesn't seem right, cause it's not `--arm.linux.gcc.exe = ...`
00:12:18FromDiscord<Clyybber> hmm, right. does it work though?
00:12:27FromDiscord<exelotl> I'll give it a try
00:12:42FromGitter<matrixbot> `arkaroo` hrm, interestingly
00:12:50disruptekhow is it that travis lets nimph clone a tree on windows but then won't let nimph remove that very same tree.
00:12:53FromDiscord<exelotl> (well I'm just getting started with a fairly dauting build script so it's a bit hard to confirm if it works lol)
00:13:06FromGitter<matrixbot> `arkaroo` it seems it's only the smembers function that's not gc safe, at least of the redis functions I'm currently using
00:13:24disruptekarkaroo: just mark it as safe and run it with --gc:boehm.
00:14:35FromGitter<matrixbot> `arkaroo` @disruptek: the redis library isn't mine, it's the official one, I'd have to submit a PR to mark it as safe. but riddle me this if you're willing to indulge: why would this be GC-safe: https://github.com/nim-lang/redis/blob/master/src/redis.nim#L534 but this not: https://github.com/nim-lang/redis/blob/master/src/redis.nim#L880
00:15:00disruptekarkaroo: install nimph, type `nimph fork redis`, make your changes, call it good.
00:15:32disruptekit doesn't matter if it's safe or not: you're gonna rely upon boehm to protect you.
00:16:25FromGitter<matrixbot> `arkaroo` looks like nimph assumes I'm using github?
00:16:36disruptekit does.
00:16:52FromGitter<matrixbot> `arkaroo` RIP, I run my own gitlab instance
00:17:08disruptekyour local git can be wherever you want.
00:17:12FromDiscord<exelotl> @Clyybber oh, it's `put`
00:17:13FromDiscord<exelotl> https://nim-lang.github.io/Nim/nimscript.html#put%2Cstring%2Cstring
00:17:35disruptekfork just forks it at github and then sets your remotes for you. you can just do it manually.
00:18:06FromDiscord<Clyybber> @exelotl Ah, good to know
00:18:53FromGitter<matrixbot> `arkaroo` I'm not a fan of forking things like this, it sets me up to have to keep fixing it every 6 months or so as I reintegrate
00:19:14FromGitter<matrixbot> `arkaroo` seems I'm not the only one with this kind of issue: https://github.com/dom96/nim-in-action-code/issues/6#issuecomment-484755006
00:19:14disruptekthere's no accounting for taste.
00:19:16disbotnot GC-safe ; snippet at 12https://play.nim-lang.org/#ix=26qK
00:19:44FromGitter<matrixbot> `arkaroo` that guy's got basically the same problem, except with sqlite.
00:20:18disruptekhe sounds cute.
00:20:31FromGitter<matrixbot> `arkaroo` I might be able to wrap my redis calls in a generic proc that is marked as gc-safe and takes an argument for what it should do, and then use boehm
00:21:35FromGitter<matrixbot> `arkaroo` BTW, if the default gc has cycle detection, what extra protection does boehm give in exchange for the stop-the-world operation (not that it matters since it's not a real time app, just curious)
00:21:44FromGitter<matrixbot> `arkaroo` * BTW, if the default gc has cycle detection, what extra protection does boehm give in exchange for the stop-the-world operation? (not that it matters since it's not a real time app, just curious)
00:22:08disruptekit's smarter wrt threads.
00:23:38FromGitter<matrixbot> `arkaroo` hrm, apparently it gives a shared heap too, although that sounds like a landmine of a feature to rely on in a threaded environment
00:24:28disruptekyes, that's the idea.
00:24:52disruptekit's a shoehorn that could get you running faster.
00:34:02*ng0 quit (Quit: leaving)
00:34:19*ng0 joined #nim
00:35:57FromGitter<matrixbot> `arkaroo` aaah, now I know why smembers is a problem, it's because it returns a sequence and apparently that make them "garbage collected objects" according to this guy: https://github.com/nim-lang/RFCs/issues/142#issuecomment-471486518
00:35:59disbotProposal to remove the `.gcsafe` effect from Nim ; snippet at 12https://play.nim-lang.org/#ix=26qX
00:36:07FromGitter<matrixbot> `arkaroo` is there anywhere with good reading on this stuff?
00:36:37disruptekare you able to use devel?
00:37:12FromGitter<matrixbot> `arkaroo` for testing things out, sure
00:37:20FromGitter<matrixbot> `arkaroo` has this behavior changed in devel?
00:37:29disruptekwell, you could try --gc:arc in devel.
00:37:33disruptek!rfc memory
00:37:35disbothttps://github.com/nim-lang/RFCs/issues/177 -- 3Unify Nim's GC/memory management options 7& 29 more...
00:39:01disrupteki would expect to still have to hack a bit, but arc is the future.
00:39:24FromGitter<matrixbot> `arkaroo` I can give it a spin but I don't know that it'll solve my immediate problem, since ultimately that comes from the fact that jester is marked up with gcsafe pragmas and redis is not. Ironically it doesn't actually have much to do with whether either library is *actually* gcsafe
00:39:52FromGitter<matrixbot> `arkaroo` unless I don't understand something, which is very possible
00:39:58rayman22201you hit the nail on the head arkaroo... That's it
00:40:18disruptekyes, but this is the state of things right now.
00:40:35rayman22201unfortunately, you have to hack it one way or the other atm.
00:40:48FromGitter<matrixbot> `arkaroo` yeah, seems that way
00:41:25FromDiscord<Clyybber> gn8 peeps
00:41:28FromGitter<matrixbot> `arkaroo` issue #142 says something about being able to use a {.gcsafe.} pragma in the middle of a proc to hint something to the compiler, but I've never seen pragmas anywhere except in proc definition signatures
00:41:29disbothttps://github.com/nim-lang/Nim/issues/142 -- 5Can't compile dialogs.nim
00:41:48FromGitter<matrixbot> `arkaroo` is that standard syntax that I just haven't stumbled across?
00:43:23*couven92 quit (Ping timeout: 260 seconds)
00:43:57rayman22201where do you see that?
00:44:32FromGitter<matrixbot> `arkaroo` https://github.com/nim-lang/RFCs/issues/142#issuecomment-471432179
00:44:34disbotProposal to remove the `.gcsafe` effect from Nim ; snippet at 12https://play.nim-lang.org/#ix=26qX
00:44:59FromGitter<matrixbot> `arkaroo` if I follow the issue correctly, araq is proposing taking existing syntax and changing what it does?
00:45:47rayman22201arc supersedes that. arc will in theory smooth out a lot of these kinds of annoying thread issues. But arc is very new. It's going to take time to move the ecosystem.
00:46:33FromGitter<matrixbot> `arkaroo` yeah, but arc won't magically make my gcsafe pragma problem go away, so I still need to find some way to write code which lies to the compiler about whether the smembers call is gcsafe
00:46:54FromGitter<matrixbot> `arkaroo` I'm basically trying to wrap the redis call inside another proc which is marked as gcsafe, but the compilers having none of it :P
00:47:11rayman22201it will make it go away, b/c arc ignore .gcsafe. iirc
00:47:35FromGitter<matrixbot> `arkaroo` oh, interesting. stand by and I'll test it
00:47:40rayman22201yeah, no cheating :-P Nim tracks it with the effect system.
00:48:50rayman22201I have never seen a pragma used outside of a proc definition like that. The closest thing I can think of is the push/pop pragma.
00:48:51rayman22201https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas
00:49:08rayman22201idk what that comment was getting at
00:49:09FromGitter<matrixbot> `arkaroo` I might just be misreading the issue
00:50:27FromGitter<matrixbot> `arkaroo` alright, cover your ears while all my dependencies explode into tiny pieces :P
00:50:47rayman22201other option. Spawn a separate thread by hand, do all redis calls in that seperate thread, and communicate back to the main thread with channels
00:50:48rayman22201https://nim-lang.org/docs/channels.html
00:51:39FromGitter<matrixbot> `arkaroo` that's a go solution if ever I heard one, but maybe not a bad idea
00:52:06rayman22201I call it "DIY erlang" :-P
00:52:06FromGitter<matrixbot> `arkaroo` if arc doesn't work I'll pencil that one down to explore tomorrow
00:52:36rayman22201👍
00:52:58FromGitter<matrixbot> `arkaroo` this will be the sixth time I have done a shitty reimplementation of erlang in another language, and I have become exceedingly efficient at it :D
00:53:09rayman22201lol
00:54:38FromGitter<matrixbot> `arkaroo` huh, nice
00:55:13FromGitter<matrixbot> `arkaroo` yep, looks like arc has moved past the gcsafe pragmas, which has now revealed that the prometheus library has a bug in it >_<
00:56:32rayman22201🎉 great success :-P
00:58:00FromGitter<matrixbot> `arkaroo` deepCopy hasn't been removed or anything, right?
00:59:09rayman22201I'm not sure :/
00:59:53FromGitter<matrixbot> `arkaroo` `/root/.nimble/pkgs/metrics-#master/metrics.nim(221, 9) Error: undeclared identifier: 'deepCopy'` getting that from the metrics library :/
01:00:06FromGitter<matrixbot> `arkaroo` that might be enough for me to hang up my hat for the night I think
01:00:22FromGitter<matrixbot> `arkaroo` cheers for the help all
01:00:40rayman22201gn
01:25:14FromDiscord<exelotl> anyone know how to stop the vscode-nim plugin from checking my config.nims file?
01:25:15FromDiscord<exelotl> https://cdn.discordapp.com/attachments/371759389889003532/663191242149986315/unknown.png
01:26:43FromDiscord<exelotl> (either making it understand the nimscript environment or disabling the checks altogether for this file)
01:27:23*ng0 quit (Quit: leaving)
01:28:23FromGitter<matrixbot> `arkaroo` I lied about sleep, sleep is for the weak
01:28:45FromGitter<matrixbot> `arkaroo` @rayman22201 I've found an example of that inline gcsafe pragma in the wild: https://github.com/status-im/nim-metrics/blob/f2199d9285e5f626be0c30b3293b3d76b548ab54/metrics.nim#L853
01:29:27FromGitter<matrixbot> `arkaroo` looks like the deepcopy issue is a breaking change with the devel version of the nim compiler, something about a nimv2 runtime
01:30:08rayman22201Interesting. It looks like an unnamed block
01:31:22FromGitter<matrixbot> `arkaroo` I'm going to go back to release nim and try to use that kind of syntax to bypass the GC issue, seems easier than shimming something to solve the deepcopy issue
01:31:31rayman22201Hrmmm. You might need Araq or Clyybber to help with the deepcopy business.
01:32:38FromGitter<matrixbot> `arkaroo` I don't think it's a problem as such, I found some changes in the threadpool lib from araq that had conditionals that switched from some new behavior to deepcopy behavior depending on whether the nimv2 runtime state was set
01:33:01FromGitter<matrixbot> `arkaroo` so I think it's a deliberate breaking change in the devel branch?
01:33:27rayman22201That's correct. I just don't remember the exact details of the change. 🤔
01:33:43disrupteki think the intention is to reimpl it in the new runtime eventually.
01:34:03rayman22201Ah ok
01:34:15FromGitter<matrixbot> `arkaroo` that'd make sense, I was wondering if we were going to go to a nimv2 so soon after the v1 release
01:34:47rayman22201 it's all definitely experimental stuff at this stage.
01:34:51FromGitter<matrixbot> `arkaroo` but either way, there's nothing for me to do there, a production library not being compatible with the devel branch is kinda no ones problem but mine :P
01:36:43FromGitter<matrixbot> `arkaroo` holy hell, it compiled
01:36:46FromGitter<matrixbot> `arkaroo` brace yourselves
01:36:54rayman22201Nice!
01:37:05rayman22201TIL
01:41:30FromGitter<matrixbot> `arkaroo` ` get "/someroute/?": ⏎ ⏎ ```{.gcsafe.}: ⏎ let things_from_redis: seq[string] = redisClient.smembers("some_key")```` [https://gitter.im/nim-lang/Nim?at=5e113eca865af87363bdba0d]
01:41:43FromGitter<matrixbot> `arkaroo` bah, rip my intenting
01:41:57FromGitter<matrixbot> `arkaroo` ``` get "/someroute/?": ⏎ ⏎ ```{.gcsafe.}: ⏎ let things_from_redis: seq[string] = redisClient.smembers("some_key")`````` [https://gitter.im/nim-lang/Nim?at=5e113ee54e9ea12051b76ecf]
01:42:11FromGitter<matrixbot> `arkaroo` * ``` ⏎ get: ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5e113ef3016ca663c19090fb]
01:42:39FromGitter<matrixbot> `arkaroo` * ``` ⏎ get "/someroute/?": ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5e113f0f809bc77efeeddf34]
01:42:41FromGitter<matrixbot> `arkaroo` that's valid syntax, it seems
01:43:00FromGitter<matrixbot> `arkaroo` and I'm getting metrics \o/
01:43:20FromGitter<matrixbot> `arkaroo` so yeah, redisClient is a threadvar declared outside of the jester routes block
01:43:41FromGitter<matrixbot> `arkaroo` and then for a given route I can put the entire route code inside that gcsafe pragma
01:43:43rayman22201it's block expression syntax I think.... https://nim-lang.org/docs/manual.html#statements-and-expressions-block-expression
01:44:08rayman22201another place the docs could probably be improved. I don't think that syntax is documented anywhere :-/
01:44:19rayman22201but anyway. Yay! glad you got it working!
01:44:26FromGitter<matrixbot> `arkaroo` yeah, feels a bit like black magic ATM
01:44:42FromGitter<matrixbot> `arkaroo` I'll take it, but I don't know if I'm using a feature or a bug :P
01:48:42FromGitter<matrixbot> `arkaroo` oh well, at least my webserver is multithreaded now, that's probably a worthwhile improvement
01:48:57FromGitter<matrixbot> `arkaroo` k, bedtime for reals this time!
01:49:15disruptekgc:arc will only improve; it's not going to get removed.
01:49:20rayman22201it is documented. I'll be damned: https://nim-lang.org/docs/manual.html#threads-gc-safety
01:49:36rayman22201yeah. arc will make all this nonsense much better in the near future tm
01:50:09rayman22201gn and congrats again
02:51:11*endragor joined #nim
02:54:26*dwdv quit (Ping timeout: 240 seconds)
02:56:04*endragor quit (Ping timeout: 258 seconds)
02:56:49*laaron quit (Remote host closed the connection)
03:15:00*deniel joined #nim
03:15:23*deniel is now known as Guest21700
03:16:12*Guest21700 quit (Remote host closed the connection)
03:16:24*deniel joined #nim
03:16:48*deniel is now known as Guest93425
03:28:17*endragor joined #nim
03:36:26*endragor quit (Remote host closed the connection)
03:36:32*endragor joined #nim
03:49:15*endragor quit (Remote host closed the connection)
03:49:44*Guest93425 quit (Remote host closed the connection)
03:49:57*deniel joined #nim
03:50:21*deniel is now known as Guest97696
04:00:17*muffindrake quit (Ping timeout: 260 seconds)
04:02:14*muffindrake joined #nim
04:23:50*endragor joined #nim
04:29:08*endragor quit (Ping timeout: 260 seconds)
04:37:02*chemist69 quit (Ping timeout: 246 seconds)
04:39:10*chemist69 joined #nim
04:39:41disruptekmy arc bug seems to have something to do with iteration where the yielded type is Result, ie. a union of value/error. i have to look at more carefully, but it could be due to instantiating what feels like two different types among different yield statements.
04:41:22disruptekapparently, nimble thinks that "2.1" as a version specification means "2.1.0", not "2.1.*".
04:41:57disruptekof course, it doesn't understand "2.1.*", so what did i expect?
04:42:00disrupteki mean, honestly...
04:45:14*Guest97696 quit (Remote host closed the connection)
05:22:44*laaronp joined #nim
06:10:03*dddddd quit (Ping timeout: 260 seconds)
06:11:38*narimiran joined #nim
06:23:53*laaronp quit (Quit: ZNC 1.7.5 - https://znc.in)
06:24:14*laaronp joined #nim
06:26:39*laaronp- joined #nim
06:26:40*laaronp quit (Client Quit)
06:28:59*laaronp- quit (Client Quit)
06:29:31*kitech1 joined #nim
07:08:50*seerix quit (Ping timeout: 240 seconds)
07:26:52*seerix joined #nim
07:57:12*nsf joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:03:46*solitudesf joined #nim
08:05:00*gmpreussner joined #nim
08:16:59*endragor joined #nim
08:32:32*neceve joined #nim
08:33:50FromDiscord<Rika> can i store an async proc inside an object
08:44:22*ptdel quit (Ping timeout: 260 seconds)
09:11:36*Vladar joined #nim
09:26:15*nsf quit (Quit: WeeChat 2.7)
09:31:22*endragor quit (Remote host closed the connection)
09:36:26zedeusAraq: I replied to your comment regarding my httpclient streaming PR with a possible implementation, let me know what you think
09:38:36FromDiscord<Skaruts> I was reading on templates and macros, and I'm wondering: how would a template look like for initializing 2D sequences of arbitrary types... in one line?
09:39:22FromDiscord<Skaruts> (to replace the nested for loops and newSeq calls)
09:40:59fireglowcan nim be written using tabs instead of spaces?
09:41:53fireglowaah dang. Found the FAQ
09:46:38*endragor joined #nim
09:49:15*tane joined #nim
09:56:13*letto quit (Quit: Konversation terminated!)
09:57:53*letto joined #nim
10:02:52*ng0 joined #nim
10:11:16*xet7 quit (Quit: Leaving)
10:14:16*xet7 joined #nim
10:16:20Araqdisruptek: can you tell us the commit that broke nimph with --gc:arc?
10:19:58FromDiscord<mratsim> @Skaruts don't use a sequence of sequence, use a 1d sequence indexed with row*numCols+col
10:20:27FromDiscord<mratsim> otherwise newSeqWith(row, newSeqWith(col, ))
10:20:39FromDiscord<mratsim> newSeqWith(row, newSeqWith(col, 123))
10:21:06FromDiscord<mratsim> but 1d sequence will be much more friendly to your memory, your cache and the Nim GC
10:22:00Araqindeed, an Nim provides really good support for overloading [] IMHO
10:26:34*Hideki_ joined #nim
10:31:14Araqzedeus: go for it, it should be possible to keep the old API and simply add a new, better one
10:31:21Araquse the .since annotation for it
10:33:55*dddddd joined #nim
10:41:50*dwdv joined #nim
10:46:16*nsf joined #nim
10:46:27*ng0 quit (Quit: leaving)
10:50:28*narimiran quit (Ping timeout: 240 seconds)
10:54:40Araqany C++ experts around?
10:54:43*Hideki_ quit (Ping timeout: 268 seconds)
11:28:31FromDiscord<Skaruts> @mratsim true. I tend to be lazy about it...
11:36:24*NimBot joined #nim
11:41:13lqdev[m]if an object with a string field is copied, is the string copied along with the object?
11:41:29FromGitter<mratsim> Yes
11:41:53FromGitter<mratsim> String and seq have value semantics they are deep coied by default
11:42:09lqdev[m]dang it. is there any way one could make a string or seq have ref semantics?
11:42:32lqdev[m]would I just do `ref string`
11:42:32lqdev[m]?
11:46:04*kitech1 quit (Max SendQ exceeded)
11:46:22*kitech1 joined #nim
11:47:01*kitech1 quit (Max SendQ exceeded)
11:47:33*kitech1 joined #nim
11:48:02*kitech1 quit (Max SendQ exceeded)
11:48:22*kitech1 joined #nim
12:08:16arecaceaeI guess there's no `method iterator`
12:14:20arecaceaeI guess I can use generics in my case
12:14:30lqdev[m]arecaceae: there is. create a method that returns a closure iterator
12:14:55FromDiscord<KcVinu> Hi all, how can i use an array in a case statement ?, i mean, can i use an "in" key word ? Like "of in myArray : "
12:15:25lqdev[m]@KcVinu you can't, you must use a set
12:15:36lqdev[m]or an if statement
12:15:41FromDiscord<KcVinu> A set ? Ok
12:32:40*sealmove joined #nim
12:33:00*couven92 joined #nim
12:39:44sealmovelqdev/lqdev[m]: need your help with implementing what you suggested the other day (for getting type of complex expression)
12:44:22lqdev[m]sure
12:44:45sealmovethanks! :)
12:45:18sealmoveso please elaborate on mechanics
12:46:08lqdev[m]so what you have now is a single macro that parses your DSL, right?
12:46:23*arecaceae quit (Remote host closed the connection)
12:46:29lqdev[m]and generates that expression
12:46:39lqdev[m]using NimNodes
12:46:54sealmovethe way i have it set up is very simple. I use procs which return `NimNode`s to construct everything. The macro is just 5 lines.
12:47:01sealmovemacro injectParser*(path: static[string]) =
12:47:03sealmove mt = parse(path)
12:47:05sealmove result = newStmtList(
12:47:07sealmove types(),
12:47:09sealmove property(),
12:47:11sealmove reads(),
12:47:13sealmove destructors(),
12:47:15sealmove api())
12:47:17*arecaceae joined #nim
12:47:34sealmoveyes, basically what you said
12:47:59lqdev[m]ok, the place where you generate the expression is types()?
12:48:03sealmoveyup
12:48:15sealmovewait
12:48:40lqdev[m]and based on that expression's type, you need to generate an object declaration?
12:49:19sealmoveno, the expressions are generated in reads()...
12:49:26sealmovebut
12:49:34sealmoveI can generate them in types(), it's no problem
12:50:02sealmoveand yes, I need to generate object fields' declaration in types()
12:50:39sealmovethe expressions are available everywhere after parse()
12:50:44lqdev[m]I assume the expressions you generate are valid expressions you could possibly `echo` out?
12:51:22lqdev[m](not that we're going to use echo, you'll see what I mean in a sec)
12:52:27sealmovenot sure because they might include identifiers
12:52:45sealmovewhich are actually assigned values in reads()
12:53:02sealmovethe general idea is the following:
12:54:12sealmovein the DSL, you define linearly some fields. each fields usually has a type based on which its declaration is generated. but there is a special case where it might not have type but an expression instead, based on which the type can be derived automatically
12:54:41sealmoveand that expression might use previous fields
12:55:07lqdev[m]all right, makes sense
12:55:47sealmoveand currently I don't have a symbolTable
12:56:08lqdev[m]that makes things a little bit harder
12:56:25sealmovei can implement a symbolTable is absolutely necessary
12:56:29sealmoveif*
12:57:48sealmoveso yeah... now that I think of it, each expression depends on previous ones. it's not autonomous
12:58:32lqdev[m]I think you'll have to. the general working principle would be that when a field is generated, you add (name -> type) to the table, and then other expressions can reference it
12:58:48sealmoveyeah, per-object symbol table
12:59:07lqdev[m]I assume forward references are not supported? that wouldn't really make sense in a binary file parser
12:59:13*Vladar quit (Quit: Leaving)
12:59:52sealmovehmm, there is the concept of instances, where parsing is lazy
13:00:18lqdev[m]oh no, even more complexity
13:00:23lqdev[m]let's just solve this first
13:00:29lqdev[m]focus on one task
13:01:00sealmovethe way I generate the code atm is set up in a way that reads() works
13:01:18lqdev[m]so now, what you'd do in your expression generator is generate default(T) instead of these idents, where T is the type of the field in the expression
13:01:24sealmovebecause the expressions are written in the correct order, and in nim level the identifiers are valid
13:04:49lqdev[m]after you've generated the expressions, the idea is to defer everything else to another macro, I'll call it `genObject`
13:06:08*krux02 joined #nim
13:06:15sealmoveso I have a `seq[tuple[fieldName, exprToDeriveType NimNode]]` for each object right?
13:06:25lqdev[m]yes
13:07:22lqdev[m]and the idea is to generate a call to a different macro that can get the type of your expression
13:08:30lqdev[m]assuming you have a list of names, types, and expressions, where at least the type or the expression must be present, you could do that by passing 3 openarrays to the other macro
13:09:03lqdev[m]where the first two could be untyped, but the third one (with the expressions) would be typed
13:09:33sealmoveso seq[typed]
13:09:54sealmovenever used typed before
13:10:28sealmovewith typed you can call getType() on any Node?
13:10:34lqdev[m]yes
13:10:41sealmoveI see, great
13:11:20sealmovehmm, it sounds like `typed` macros are not expanded purely at CT
13:11:22lqdev[m]on any nnkSym to be precise
13:11:32lqdev[m]what do you mean?
13:12:33lqdev[m]all macros are expanded at compile time
13:12:59lqdev[m]what happens with typed macro parameters is what we're after: semchecking
13:13:01sealmovenvm, it's still CT, but the fact that they need type info means they have to be work concurrently with semantic pass?
13:13:11lqdev[m]yes
13:13:30lqdev[m]typed params are semchecked, which turns nnkIdent into nnkSym
13:13:41lqdev[m]and you can do cool things with nnkSyms
13:13:42sealmovedamn, how did Araq manage all this? :3
13:14:06AraqI had help
13:14:14lqdev[m]my theory is that macro expansion is done iteratively
13:14:35lqdev[m]so it expands one level, then another, etc. until it doesn't have anything to expand
13:15:56sealmovethere is one problem
13:16:22lqdev[m]what is it?
13:16:39sealmoveduring object declaration the expressions have to *run* right?
13:16:58lqdev[m]no
13:17:12lqdev[m]they're not executed, they're only checked
13:17:34sealmovehow does Nim knows to check them in corrent order
13:17:40lqdev[m]unless you mean that you need them to run
13:17:46sealmoveno
13:18:11lqdev[m]can you give an example?
13:18:33sealmoveI mean, what is the nnkCall you mentioned for?
13:18:48sealmovei am not sure I get it
13:18:52lqdev[m]to invoke another macro expansion pass
13:19:04sealmovein which we do what?
13:19:16lqdev[m]hmm, how do I describe this
13:19:26lqdev[m]let me give you an example
13:19:30sealmovegenerate series of `let fieldName = expr` ?
13:19:39lqdev[m]no
13:20:30lqdev[m]say we have a macro `pass1`, which generates an nnkCall(bindSym"pass2")
13:20:49lqdev[m]the macro `pass2` returns an `echo "test"`
13:21:13lqdev[m]we call the first macro, and we have `pass1()`
13:21:32lqdev[m]pass1 executes, we end up with `pass2()`
13:21:45lqdev[m]pass2 executes, we end up with `echo "test"`
13:22:04sealmoveok
13:22:31lqdev[m]so essentially, macros generate code (duh)
13:22:45sealmovein what form do we obtain the inferred types?
13:23:34lqdev[m]after we pass our expressions to the second macro through an nnkCall, they get semantically checked, so all idents are resolved to syms
13:24:02lqdev[m]thus, we can call `getType` on the expression and get its type without problem
13:25:45sealmoveah, and this is done through side-effects I suppose, so the NimNodes change by calling the macro
13:27:33lqdev[m]read this https://nim-lang.org/docs/manual.html#templates-typed-vs-untyped-parameters
13:27:58sealmovelastly, pass2() is called once (not 1 pass2() call for each field), and there no need to do anything in its body?
13:28:49lqdev[m]pass2 gets an array of names, types, and expressions, and it generates the object declaration
13:30:49sealmovei see, but still don't get how nim knows how to resolve the types of idents. we do have a seq of expressions but how does Nim knows to check them in order, just because we pass them as typed params?
13:31:27sealmovebecause the expressions are not actually generated
13:31:49sealmoveand they are separated from the corresponding name of field
13:32:08lqdev[m]wait a sec, I'll write a complete example and show you this way
13:50:31lqdev[m]dang, macros are annoying sometimes
13:52:36lqdev[m]sealmove: it just checks them left to right, symbol resolving does not generate code and is a separate pass in the compiler
13:53:24sealmoveI see, this is quite handy
13:53:24lqdev[m]I tried to write that minimal example btw, but parameter passing between macros is confusing
13:54:24sealmovelemme give it a try with what I understood through your tutoring :D
13:55:45lqdev[m]I'm not good at teaching, but give it a shot and see what you can come up with
13:56:05lqdev[m]for some reason nobody understands what I say. :P
13:56:55lqdev[m]but once you understand this deferring to other macros fully, everything magically clicks into place
13:57:48sealmoveit's a bit convoluted concepts
13:57:55*ng0 joined #nim
13:58:13sealmoveconcept*
13:59:44lqdev[m]yeah, macros are convoluted in general
13:59:59lqdev[m]and it's really useful to have some experience in language implementations
14:01:14sealmoveI only started programming (excluding minimal exprerience in school) 2.5 years ago
14:14:20*narimiran joined #nim
14:20:50sealmovelqdev: when generating the nnkCall, how to pass the arguments? I am thinking something like:https://play.nim-lang.org/#ix=26u3
14:21:15*endragor quit (Remote host closed the connection)
14:22:31lqdev[m]passing seq[NimNode] is not possible in this case, you need to create an nnkPrefix(ident"@", nnkBracket(elements))
14:22:37lqdev[m]to pass a seq here
14:23:18lqdev[m]problem is, seqs are semchecked even if you ask for untyped, so you may want to convert any idents to strLits when passing them to the other macro
14:28:12*lritter joined #nim
14:30:09sealmovea simple question: when constructing nodes, do they have to be var? or you can use let because they are ref objects?
14:35:13*Trustable joined #nim
14:35:14lqdev[m]doesn't matter
14:35:31lqdev[m]I always use var for the ones I modify, though
14:40:31disruptekgood thinking.
14:51:36*Hideki_ joined #nim
14:52:19blackbeard420with asyncnet, i accept a client and process the message. then i spawn off a long running task in the threadpool. is it possible to send the result to the AsyncSocket from another thread?
14:55:51*couven92 quit (Quit: Disconnecting)
14:55:58*Hideki_ quit (Ping timeout: 258 seconds)
15:01:22disruptekmy arc issue arrived with this "fix" that sinks a manually alloc'd C type into a proc that may free/realloc it elsewhere, wrapping it in a Result: https://github.com/disruptek/gittyup/commit/2ebc3d18cd60df06eeca5894e4165348e94aca4f
15:01:30*Vladar joined #nim
15:01:46disruptekit seemed simple at the time.
15:03:28disruptekbtw, this causes windows to hang. linux/osx c compiler crash.
15:06:51disruptekhttps://travis-ci.com/disruptek/gittyup/builds/143060149
15:13:13*ng0 quit (Ping timeout: 258 seconds)
15:14:13sealmovelqdev: I think I grapped the concept. Still getting errors though. Will try more later
15:14:20sealmovegrasped*
15:15:05*ng0 joined #nim
15:15:05*ng0 quit (Changing host)
15:15:05*ng0 joined #nim
15:15:41lqdev[m]nice to hear that :) feel free to ask any more questions
15:17:38sealmoveyou are the best ^^
15:21:39FromGitter<Albus70007> it seems like sockets.recv() decode the data by their self, how can i avoid it or use another formatting
15:22:34FromGitter<deech> disruptek, had no idea you could qualify with std like this: https://github.com/disruptek/gittyup/blob/master/gittyup.nim#L8. Nice tip!
15:22:42lqdev[m]@Albus70007 recv() receives raw bytes into a string, it does not do any decoding/encoding
15:23:02disrupteki just find it a little easier to read.
15:25:26FromGitter<Albus70007> then why i receive data as bytes, but it gets printed as a decoded string?
15:26:47FromGitter<deech> I'm curious how that works, is the 'std' namespace special? Also I would have expected to see 'import std/pure/strutils' in that example.
15:27:03disruptekit's magic, yes.
15:27:46FromGitter<deech> And presumably Bad Things happen if I have a local module in a directory called 'std'?
15:28:45disruptekfair question; i would expect it to work, actually, as i think it turns std/ into config.libPath in the search and then will proceed to searchPaths, lazyPaths.
15:29:02disruptekbut it's worth testing.
15:35:00FromGitter<deech> Just tested with a local module `std/strutils.nim`, it's ignored when I `import std/strutils` and `import strutils`.
15:35:25disruptekright, but what if it's name std/foo
15:35:32FromGitter<deech> It finds it.
15:35:36disruptekgood.
15:36:22FromGitter<deech> A warning that a local module was ignored would be nice.
15:36:42disrupteknimph will warn of shadowed modules.
15:37:16disruptekactually, i don't think i check stdlib for shadows.
15:37:33FromGitter<deech> oh nice!
15:38:00disrupteki wonder if it makes sense to do that.
15:38:08FromGitter<deech> Package qualified imports would also be nice.
15:38:28disruptekwhat do you mean?
15:39:57FromGitter<deech> Like if you shadow a dependency's directory structure, you could do `import "mydep" a/b`as an example.
15:40:40disruptekif you shadow a dep, you just `import a/b`.
15:40:58FromGitter<deech> How do you get to the dep's `a/b`?
15:41:08disruptekie. the shadows happen at the level of the package directory.
15:42:18disruptekthere's no way to selectively replace a shadow when the foo author specifies foo/bar, afaik.
15:44:03lqdev[m]@Albus70007 because that's what recv() returns. you can use strutils.toHex if you wish to print hex bytes.
15:49:00*marmotini_ joined #nim
15:57:03FromGitter<deech> disruptek, btw when I moved `strutils` to the same directory as the module importing it doing `import strutils` uses that instead of the standard lib.
16:00:34FromGitter<Albus70007> @lqdev[m] thank you, although i think it should just give you the raw data they sent
16:06:22disruptekdeech: as expected.
16:11:08*krux02 quit (Remote host closed the connection)
16:17:47*sealmove quit (Quit: WeeChat 2.7)
16:19:29*Trustable quit (Remote host closed the connection)
16:26:09disrupteki think i have to trust that the programmer knows what's in the stdlib and is shadowing stuff intentionally, as opposed to warning them needlessly.
16:27:23narimirandeech, disruptek you can do `import strutils` for local one, and `import std/strutils` for stdlib one
16:27:40disruptekyeah, that's what we're talking about.
16:28:11disrupteknimph doesn't sniff for "std/" imports, though, so i'd either have to start grokking code, running nimsuggest, or looking at artifacts.
16:28:16disrupteki think it's too much ask.
16:28:50disruptekthere has to be a line where we assume the programmer is smarter than we are. by staying kinda dumb, we define that line.
16:28:54disruptekwe're a tool, after all.
16:29:08FromGitter<deech> From your explanation of 'std/' I now get why it works out that way but a warning would still save someone's sanity in the future I think. :) I say this as someone who's been bitten by shadowing before.
16:29:32disruptekso how does it work? tell me the story.
16:30:51FromGitter<deech> From your explanation it special cases 'std/' when that's not there it looks around in local scope first.
16:31:07disrupteki mean, how can nimph warn you when it should?
16:32:21FromGitter<deech> I wasn't refering to nimph, I meant a warning for nim itself.
16:32:42disrupteknim has a lib called "events". it's deprecated, but it could easily clash with a package's "events" submodule.
16:33:27disrupteknim could warn of shadows, yes. i would impl it if araq liked it.
16:33:45disruptekmuch cleaner to do it in the compiler.
16:36:28dom96this is why you should always import packages with an "absolute" import, i.e. `import pkgName/events`
16:37:29FromGitter<deech> Oh wait, Nim does have package qualified imports? That's awesome.
16:39:16disruptekdom96: if that's the case, why can't nimble build nimph?
16:39:43dom96hrm? how are the two related?
16:40:09disrupteknimph imports nimph/foo but nimble cannot build it because it cannot find nimph/foo before nimph is installed.
16:40:49dom96where are the files that import `nimph/foo`?
16:41:13disruptekin the nimble-dictated subdirectory src/nimph.
16:42:23dom96ahh yes, in that case you're screwed :)
16:44:03dom96would be nice if we could come up with a solution to this
16:45:23disruptekthe solution is for nimble to inject the path to the source.
16:45:56dom96sure, but then compilation via `nim` will break
16:46:07disruptekwhy?
16:46:29dom96because it would also need to inject this path?
16:46:46disruptekonce the package is installed, it's a non-issue.
16:47:06disrupteknimble/nimph can create a nim.cfg, etc.
16:47:32disruptekif it's installed to a --nimblePath, it'll already get picked up by nim.
16:47:59disruptekthis is from nimph's installation "bootstrap.sh": nimble install "--passNim:--path:\"`pwd`/src\" --outdir:\"`pwd`\""
16:48:39dom96you could surely say the same thing about Nimble failing to build it
16:48:42disrupteknimph.nimble also specifies the srcDir.
16:48:57*federico2 joined #nim
16:49:53disruptekyes, i wish nimble could build it.
16:50:54dom96but you don't care if`nim` can, right?
16:51:15disrupteknim doesn't have a problem with it.
16:51:38dom96maybe I'm misunderstanding, but if Nim doesn't have a problem then Nimble also doesn't
16:51:52disruptekwell, if you have git on your machine, you can try it for yourself.
16:52:07dom96Nim also has the same problem: you need to install Nimph to build it, no?
16:52:15disrupteknah.
16:52:44disruptekwith no --path to the src in nim.cfg, just `nim c src/nimph.nim`
16:53:27*federico2 quit (Client Quit)
16:53:36dom96Can you explain how Nim works in this case?
16:53:47dom96is it some flag that Nimble passes that makes the build fail?
16:54:01disruptekprobably.
16:54:36disrupteknim uses the projectPath for resolution so that you can `import foo` and import a local-to-the-source 'foo.nim'.
16:54:49disruptekthus, 'nimph/foo' imports nimph/foo.nim.
16:55:10*ptdel joined #nim
16:56:04disruptekthus, 'import nimph/foo' imports src/nimph/foo.nim, i should say.
16:56:24dom96Okay, so this is once you've installed nimph
16:56:33disrupteknope.
16:56:42dom96most definitely
16:56:47dom96there is no other way it could work
16:56:56*ng0 quit (Quit: leaving)
16:57:03disrupteki have never "installed" nimph, so i'm pretty confident on this.
16:57:28dom96your bootstrap.sh installs it, so maybe you did by accident
16:57:54disruptekmy .nimble directory doesn't exist.
16:59:07disruptekactually, it exists, but it's unreadable and unexecutable.
16:59:39dom96https://gist.github.com/dom96/b6032baa2ebb6ad3801854b0c898f306
17:00:00disruptekit's hard to build without dependencies, isn't it?
17:00:08dom96oh yeah
17:00:11dom96my bad
17:00:17disruptek😉
17:01:01disruptekthe next problem you'll run into is that you cannot install hybrid packages (binary + library).
17:01:20disruptek!search nimble hybrid
17:01:22disbothttps://github.com/nim-lang/nimble/issues/582 -- 3nim project complains about missing src/ prefix in hybrid package 7& 22 more...
17:01:44dom96https://gist.github.com/dom96/ec27e50730b22d5cbf2bfd063137bcb4
17:01:47*dom96 gives up
17:02:26disruptekit's pretty tough.
17:02:41disrupteksee if the bootstrap works for you.
17:02:43dom96It would be helpful if you could find out which command line flags Nimble uses that break it
17:03:11disrupteki'd rather fix arc for gittyup.
17:03:35disruptekbut feel free to create an issue in nimble.
17:04:32*Kaivo quit (Quit: WeeChat 2.7)
17:07:27dom96https://gist.github.com/dom96/8ca782fbd7dcb800ac2866082de78d17
17:07:47dom96am I missing some magic?
17:08:28FromGitter<deech> dom96, https://github.com/nim-lang/nimble/blob/master/src/nimble.nim#L1065?
17:09:16dom96hrm? That's for `test`
17:09:41FromGitter<deech> oops
17:11:18disruptekyou are missing the nimph.nim.cfg.
17:11:46disrupteksee the "# fix nimble?" attempt at the bottom. 😉
17:13:11*vesper quit (Quit: ZNC 1.7.4 - https://znc.in)
17:13:53dom96...
17:14:28dom96so you've fixed `nim` yourself
17:14:32dom96just say so next time
17:14:32*vesper11 joined #nim
17:15:07disrupteki don't follow...
17:15:38dom96The reason you can compile this way with `nim` is because you've supplied it with a --path flag
17:15:39disruptekthe compiler works fine. it's nimble that breaks the build.
17:15:47disruptekyes.
17:16:32dom96so for whatever reason Nimble causes Nim to ignore this nim.cfg file
17:16:44dom96but in addition you think Nimble should just do this implicitly, right?
17:17:02dom96(this meaning what you've specified in your nim.cfg file)
17:17:12disruptekno; i don't think nimble should be used to build nim software.
17:17:34dom96No? Why not?
17:17:51*filcuc joined #nim
17:17:52disruptekbecause it's not a compiler and can offer nothing over what already exists in the compiler.
17:18:11disruptekin fact, i think we've demonstrated numerous problems with its behavior.
17:18:33disrupteknimph used to ship a nim.cfg and the "fix nimble" comment dates back to then.
17:18:45disrupteknim.cfg is now expected to be ephemeral.
17:18:54dom96You've demonstrated a bug
17:19:18dom96And you're making it sound like Nimble is deviating from Nim's behaviour, where you've had to modify Nim's config to make it do what you want
17:19:18disruptekcan you give me an example of a benefit to building with nimble?
17:19:47dom96Yes, dependencies are installed and managed for you automatically
17:20:00disruptekwhat does that have to do with building?
17:20:27dom96Everything. Without dependencies you cannot build the software
17:21:21disrupteki guess there's nothing to talk about, then.
17:22:30*filcuc is now known as help
17:22:36*help is now known as filippo
17:24:02dom96I created https://github.com/nim-lang/nimble/issues/760 in any case
17:24:03disbotNimble ignores nim.cfg?
17:25:02FromGitter<sheerluck> I know what to do. @dom96 and @disruptek run `$ nimble list -i | wc -l` Larger number wins. Mine is 14 ^_^
17:25:54disruptekmine doesn't produce any output. what's it supposed to do?
17:26:10dom96397 :D
17:26:28disruptekmine is probably broken.
17:26:39*filippo is now known as filcuc
17:27:01disrupteknimble has more open bugs than nimph has tickets.
17:27:16solitudesfthats a weird metric
17:27:24dom96that's a poor metric
17:27:40disruptekit's not a metric.
17:27:53disrupteki'm saying that i don't assume that any behavior is correct.
17:28:23FromGitter<sheerluck> Friends. That was a joke. Why so serious?
17:29:03*marmotini_ quit (Remote host closed the connection)
17:29:38*marmotini_ joined #nim
17:33:49*marmotini_ quit (Read error: Connection reset by peer)
17:33:54*marmotin_ joined #nim
17:33:56FromGitter<Albus70007> ok guys, i know receive a proper header, but when i try to receive the rest of the buffer, the program will just stop, thinking but not returning me anything
17:34:07FromGitter<Albus70007> (i can send the code if you want)
17:34:46disruptek!search nimble pass-through
17:34:48disbothttps://github.com/disruptek/nimph/issues/107 -- 3nimble pass-through doesn't pass all options 7& 29 more...
17:36:47skrylar[m]i bring gifts https://github.com/Skrylar/skcbor 🎉
17:37:23FromGitter<Albus70007> proc recievePacket(): JsonNode = ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e121ed3be6bab58cd7ac680]
17:37:36disruptekskrylar[m]: neat, does it work with arc?
17:38:00skrylar[m]i have no idea.
17:38:11disruptekwant me to setup travis on it?
17:38:18*marmotin_ quit (Remote host closed the connection)
17:38:26skrylar[m]i dont use travis but you can test it if you want to
17:38:28FromGitter<Albus70007> the program breaks at let more_data ...
17:38:38*marmotini_ joined #nim
17:38:55skrylar[m]in a couple days i'll go put the sax interface on top of it. right now its just parsing primitives
17:39:05disruptekalbus70007: i cannot read gitter, but most likely you need to specify the length to read as parsed from the header.
17:39:25disruptekskrylar: good contribution, thank you.
17:40:16FromGitter<Albus70007> could you show me how?
17:40:29disrupteksee how i do it in here:
17:40:32disruptek!repo swayipc
17:40:33disbothttps://github.com/disruptek/swayipc -- 9swayipc: 11swayipc (i3ipc) for Nim 15 3⭐ 0🍴
17:41:29shashlickwhy does compiler still need -d:nimOldCaseObjects in debug mode?
17:45:52FromGitter<Albus70007> disruptek, i am not sure wdym, i do specify a length to read
17:46:17disruptekas i said, i cannot read gitter.
17:46:25FromGitter<Albus70007> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e1220f1809bc77efef37935]
17:46:33disruptekLOUDER
17:46:49FromGitter<Albus70007> *while len(recieved).uint16 < fromHexuint16 (header): ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ var packet: JsonNode = json.parseJson(recieved) ... [https://gitter.im/nim-lang/Nim?at=5e122108865af87363c382f4]
17:49:10FromGitter<Albus70007> it freezes at more_data, and doesnt move
17:49:41disruptekyou might share code via a pastebin service such as gist or ix.
17:50:37FromGitter<Albus70007> i will try
17:51:51federico3https://github.com/nim-lang/c2nim <-- the URL in the description gives 404
17:56:17FromGitter<Albus70007> https://pastebin.com/CMyGhmZU here you go, i commented and explained the problem
17:57:06*abm joined #nim
17:57:23disruptekyou need to keep decrementing the amount of data that remains to be read such that the final read succeeds even if reading less than 1k.
17:57:53FromGitter<Albus70007> but i am not able to read even once
17:58:06disruptekthen there is less than 1024 to read, most likely.
17:58:30disruptekfwiw, `received` is mispelled.
17:58:42FromGitter<Albus70007> so how should i do it, (ups)
17:59:17disruptekread min(1024, total-received.len)
17:59:32FromGitter<Albus70007> ill try that
18:02:47FromGitter<Albus70007> no luck :(
18:02:58disrupteklemme see.
18:03:05FromGitter<Albus70007> output?
18:03:11disruptekcode
18:03:42FromGitter<Albus70007> let more_data: string = socket.recv(fromHexint (header) - len(recived))
18:03:54FromGitter<Albus70007> int is between [ ]
18:04:33disrupteki think you should output some of these values and confirm that they match your expectations.
18:08:14FromGitter<Albus70007> ok, i think i got it
18:08:18disrupteknice.
18:09:06FromGitter<Albus70007> still having problems with parsing to json. but i will see, thx
18:17:14*endragor joined #nim
18:22:25*endragor quit (Ping timeout: 268 seconds)
18:23:38*filcuc quit (Ping timeout: 240 seconds)
18:27:54Araqonce again, any C++ experts around?
18:30:21FromDiscord<demotomohiro> I have used C++ for about 10 years before start using Nim.
18:30:39FromDiscord<demotomohiro> But I don't know much about C++17 or newer
18:31:00Araqhttps://stackoverflow.com/questions/8920699/why-am-i-getting-non-aggregate-cannot-be-initialized-with-initializer-list we have a similar problem in the Nim C++ codegen
18:31:38Araqand I wonder if there is a good fix beyond emitting toplevel vars with explicit assignment statements
18:35:02FromDiscord<demotomohiro> Nim C++ codegen need to initialize std::map or other container class?
18:36:33Araqa Nim object that uses inheritance
18:36:46Araqand we map Nim's inheritance to C++'s inheritance
18:37:03Araqmostly in order to play nice with C++'s aliasing rules.
18:50:05FromDiscord<demotomohiro> Do you want to generate c++ code like this in older C++ standard?
18:50:06FromDiscord<demotomohiro> https://wandbox.org/permlink/SWjJ0gmX7WPf8Wpt
18:51:37FromDiscord<demotomohiro> It works with -std=c++17 but doesn't with -std=c++14
18:53:16*Hideki_ joined #nim
18:53:58Araqyeah, like that
18:57:14*Hideki_ quit (Ping timeout: 240 seconds)
18:58:17*marmotini_ quit (Remote host closed the connection)
19:02:23*cyraxjoe quit (Ping timeout: 265 seconds)
19:08:20FromDiscord<demotomohiro> I have no idea other than initializing struct or class type with constructors, or explicit assignment statements.
19:11:18Araqhmm we could generate a constructor
19:12:09AraqI never considered that
19:15:36FromGitter<deech> It follows logically but Nim implicit initialization of `ref` to `nil` is a little surprising: ⏎ ⏎ ```proc f():ref int = discard ⏎ echo f()[]``` [https://gitter.im/nim-lang/Nim?at=5e1235d8809bc77efef40c8f]
19:16:45Araqbeing addressed with our not-nil RFC.
19:17:32FromDiscord<demotomohiro> It uses C++11 feature but you can set default value to member variables.
19:17:32FromDiscord<demotomohiro> https://wandbox.org/permlink/Ixcx1HROGIEQYVfL
19:17:32FromDiscord<demotomohiro> I don't know it works in the Nim C++ codegen.
19:17:44Araqhowever, after all these years I know one thing for sure, a small set of consistent rules that lead to occasional surprises is much better than a set rules always expanding to capture human "intuitions"
19:17:46FromGitter<deech> Araq, nice!
19:18:00*cyraxjoe joined #nim
19:18:40FromGitter<deech> Araq, yes agreed. But maybe worth a warning. I learned that stuffing "human intuition" violations in warnings is a nice compromise.
19:18:53disruptekwhat's your intuition for a ref?
19:19:14Araqthat's true too, warnings can help
19:19:21disruptekthat it perform a heap alloc? what if it's a type that requires initialization?
19:19:54Araqdisruptek: that it doesn't compiler, nobody expects even more secret allocs
19:20:00Araq*compile+
19:20:21disruptekoh, it should fail to compile if it's not initialized?
19:21:01FromGitter<deech> That it's initialized to `nil` but implicit `result` initialization had me scratching my head for a second. I can't think of an instance where that isn't a mistake so good to warn.
19:21:56skrylar[m]i see that password reset on the forum is still broken. bummer.
19:22:30disrupteki can think of instances where nil makes sense for result; how about "i cannot create that type"
19:24:17disrupteki am looking forward to notnil, though.
19:25:04skrylar[m]this is where Option types are nice /shrug
19:25:36disruptekyes, but technically you have the same problem.
19:25:58skrylar[m]those can at least differentiate "i returned nothing" from "i returned something: it was a nil"
19:26:42disrupteki like nim-result. i think it belongs in stdlib. although, it might not work with arc properly yet.
19:26:58*krux02 joined #nim
19:27:47FromGitter<deech> A warning that says something to the effect of "I'm returning the default initialized value for the result because you haven't read/assigned to it" would be the gist of what I'm suggesting.
19:28:54skrylar[m]i kinda do that lately by having an `unbox` function that accepts an output, optional default, and returns true or false based on if it gave you the default or the genuine value, which reads a little ugly but the semantics work :b
19:30:15skrylar[m]poking around with the promise/future model ... might be interesting to shove default checking in those too
19:30:26skrylar[m]bleh.then(..).default(..)
19:32:15Araqdisruptek: so ... nimph worked with arc and then it didn't anymore?
19:32:16FromGitter<deech> It sounds like a trivial thing but it just happened to me when I `echo`ed what I intended to return for debugging purposes, forgot to remove it and got a `nil` when I called the function. In a small code base it's fine, in a large one when you're tired a warning is much appreciated.
19:32:35disruptekgittyup stopped working in that commit i linked. want another link?
19:32:47AraqI missed the link
19:33:03disruptekhttps://github.com/disruptek/gittyup/commit/2ebc3d18cd60df06eeca5894e4165348e94aca4f
19:33:53Araqok but you said it's an arc regression
19:34:01Araqnot that you changed your code
19:34:16disrupteknah, i said "it worked yesterday" 😉
19:34:33Araqjust imagine I could say on the forum, "first big project (nimph) compiles and run with arc"
19:34:36disruptekanyway, i am working on it. tightening up memory.
19:34:39*Araq needs a success
19:35:12disruptekit was working in 2.0.4, and i think that release has the same iterator semantics.
19:35:50disruptekso i think it has to do with manual alloc somehow.
19:37:16Araqit produced wrong C code, right?
19:37:28disruptekon linux/osx, yes. on windows, compilation hangs.
19:37:51Araqfor the same reason, invalid C code
19:37:55disruptekhttps://github.com/disruptek/gittyup/runs/373100299
19:38:04Araqit's just that osproc hangs for too much C compiler output
19:38:10disruptekahh.
19:38:32disruptekwhen i looked at the code, it seemed that two Result types weren't matching up.
19:38:50Araq(and before you bash Windows once again, the other OSes merely have bigger buffers and osproc is just as broken on them too)
19:38:56disrupteknoted.
19:39:34disruptekalso, i'm yielding a template that builds the Result. so that's another possible wrinkle, i guess.
19:40:11Araqdoes it produce valid C code with the default GC?
19:40:15disruptekyeah.
19:40:38AraqI almost bet it doesn't but C is forgiving enough so we don't notice
19:41:50disruptekcan't rule it out.
19:50:35disrupteki've never used a dev environment that was as friendly to my workflow.
19:50:43disruptekeveryone should take the time to develop their own tooling.
19:54:14FromDiscord<mratsim> that's the reason why I maintain my own packages for data science: https://github.com/mratsim/arch-Data-Science
19:54:27FromDiscord<mratsim> instead of using the awful pip or conda
19:55:06AraqI wrote my own scatter plots via putPixel for this reason
19:55:24Araqwas easier than figuring out matplotlib's clusterfuck API
19:55:43disruptekyou and 100 other grumpy devs.
19:55:44FromDiscord<mratsim> don't use matplotlib
19:56:06FromDiscord<mratsim> it's like using Asembly
19:56:38Araqassembler is nice, matplotlib is more like computing with Roman numerals
19:57:08FromDiscord<mratsim> Assembler is nice when you have the tooling
19:57:16FromDiscord<mratsim> good luck with pure hexadecimal assembler
19:57:25Araqah that's what you mean
20:05:37Araqonce again, shall we add codegen support for suspension/yield points?
20:06:22Araqin the end it's what it comes down to, async transforms proc calls into isolated tasks you can run anywhere
20:07:08Araqno cactus stacks required, no split stacks, we have N threads that run tasks
20:07:32Zevvhow should the codegen figure out what the "right" spots are to put those in?
20:07:57Araqput them into loops
20:08:08ZevvI don't want them in my inner tight loops probably?
20:08:35Araqput them in the outermost loop and also offer a .nosuspend pragma
20:10:05AraqJava uses loop strip mining to get the overhead into noise levels
20:10:06disruptekprefer truthy syntax like .yieldable versus .unyielding
20:10:10ZevvPff that's a though one. You risk slowing down a lot of loops inadvertently
20:10:25Zevvdisruptek: yes, but then you might just as well put an explict yield() in there
20:10:49disrupteki just mean that .no might not add anything syntactically.
20:10:57Araqas I said, it's well explored ground in Java
20:10:59disrupteklet's not say what it isn't; let's say what it is.
20:11:05*endragor joined #nim
20:11:19ZevvI have zero java experience, so nothing to add here
20:12:30disrupteki think performance is always something you add, so .nosuspend is probably the right semantic. i just wish there was a better term.
20:12:41FromDiscord<mratsim> no idea, I prefer leaving that in developer hands
20:12:55FromDiscord<mratsim> when you use parallelFor you automatically get suspension points in Weave
20:13:33Zevvbut we're talking async only here, right?
20:13:36FromDiscord<mratsim> but for example in state of the art matrix multiplication, I have 6 loops nesting level
20:13:52FromDiscord<mratsim> it's about inserting async suspension point in CPU-bound tasks
20:14:00FromDiscord<mratsim> to unify CPU and IO
20:14:15FromDiscord<mratsim> so that within a CPU-bound task you don't delay IO too much
20:14:38Araqexactly
20:14:47ZevvSure, but especially with async I'd like my yields explicit
20:15:14Zevvthere is no locking in place or other synchronization mechanisms, so by choosing my yield points one keeps code atomic and invariants invariant
20:15:33FromDiscord<mratsim> so going back to matmul, if you insert a suspension point in the inner loop, you're going to flush my handcrafter register allocations where I precisely use 12 registers for matmul and 4 registers for loop bounds, and you're going to kill my perf by a huge factor (I expect way more than 50%)
20:15:53*endragor quit (Ping timeout: 268 seconds)
20:16:05FromDiscord<mratsim> so i only insert my suspension points on the 2nd inner loop
20:16:13FromDiscord<mratsim> 2nd loop around the inner kernel*
20:16:26Zevvright, that's what I said, and that sounds pretty hard for the compiler to guess right
20:16:47Zevvand if I don't know where my code will yield, thinking about async gets harder
20:16:53FromDiscord<mratsim> yes
20:16:59FromDiscord<mratsim> explicit is better i think
20:17:12FromDiscord<mratsim> and after long experience, maybe we can think about making it implicit
20:17:31FromDiscord<mratsim> or having a pragma or template magic that does that
20:17:41FromDiscord<mratsim> {.implicitYield.}
20:18:37FromDiscord<mratsim> the whole deal about me writing linear algebra kernel from scratch is that compiler don't know how to generate fast code from them if I don't do 95% of the job
20:18:44ZevvHow does this work in other languages? If there are 'hidden' yields, how do you sync your code? There are no locks, but my code gets preempted anyway?
20:26:50Araqwell in some sense whenever you run 2 threads there is potential preemption
20:27:10Araqwithout you being aware of it, it works fine
20:29:28FromDiscord<mratsim> in anycase, weave doesn't need implicit yield, I can have a proc hook that threads trigger in my "loadBalance" proc or a closure iterator
20:30:48FromDiscord<mratsim> and asyncdispatch chronos can expose a "setAsyncDispatch" callback that allows them to be plugged into anything
20:35:37FromDiscord<mratsim> btw, do we want to keep the type name "Promise" for async? for now I will be using "Pledge" for CPU-bound task promises
20:38:51disruptekmakes sense to me.
20:39:09skrylar[m]"cactus stacks" kek
20:39:42FromDiscord<inv> Hello, I found that playground has white text-color on white background in output. is it only my problem ?
20:39:59skrylar[m]was watching the talk on promise/a+ and some tooling they built with generators on top of that for async functions the other day actually
20:47:01ZevvSo now we have Promises, AsyncFutures, Futures and Pledges.
20:47:40ZevvSound like my kids. Tons of pledges and promises. Buy in the end, all of them get cancelled
20:48:11disruptekmaybe they should be less suggestive of success.
20:48:20disruptekWishes, Hopes, Dreams
20:49:06ZevvThat would be pretty cool actually, so my code can there be sitting, waiting on a dream
20:50:36FromDiscord<mratsim> for now Weave pledges cannot be cancelled 😉
20:51:08FromDiscord<mratsim> and you have Futures and Flowvars
20:51:12FromGitter<Albus70007> I have this two types: ⏎ ⏎ 1) 'type PlayerInputs* = object ⏎ ⏎ ```name*: string ⏎ rootsocket*: Socket ⏎ inputs*: PlayerInputs'*``` ... [https://gitter.im/nim-lang/Nim?at=5e124c40c23234403cd4c7df]
20:52:26Zevvaraq: I was trying to get my Nim-in-linux-kernel-space running with arc, is there a shortcut to get --gc:arc on --os:standalone not to use theHeap, but lie directly on top of malloc()/free() for allocations? I'd like to get rid of the 32Mb allocation
21:04:40FromGitter<deech> What am I doing wrong here? If I wrap the inner `proc` on line 5 in parens it works: https://play.nim-lang.org/#ix=26vU
21:07:06ZevvI think I hit that once, the workaround is - you guessed - wrapping it inside parens
21:07:13ZevvIt was noted it was a quirk of the nim parser
21:09:10FromGitter<deech> Ok, that's odd.
21:11:03FromGitter<deech> This doesn't work either `run f, proc (s:string) = echo s`.
21:12:13FromGitter<deech> And neither does: ⏎ ⏎ ```run "hello world": ⏎ proc (s:string) = ⏎ echo s``` [https://gitter.im/nim-lang/Nim?at=5e12512d6dda2430fed56962]
21:13:16*sschwarzer joined #nim
21:14:43sschwarzerWhat's a recommended way to convert a string like "abc" to a sequence of strings like @["a", "b", "c"] ? I could write a loop of course, but I wonder if there's a simpler way.
21:15:45FromGitter<deech> Try `toSeq(items("abc"))` , you need to import `strutils` and `sequtils`.
21:15:47sschwarzer"abc".toSeq() gives me a sequence of chars, which isn't quite what I want.
21:16:22Zevv!eval echo "abc".distribute(3)
21:16:24NimBotCompile failed: /usercode/in.nim(1, 11) Error: attempting to call undeclared routine: 'distribute'
21:16:32Zevv!eval import sequtils; echo "abc".distribute(3)
21:16:34NimBotCompile failed: /usercode/in.nim(1, 28) Error: type mismatch: got <string, int literal(3)>
21:16:42Zevvdaaang
21:16:49FromGitter<deech> How about `toSeq(items("abc")).mapIt($it)`?
21:17:18sschwarzerdeech: I tried something like that, but let me check
21:18:58sschwarzerdeech: It works, thanks. I had used this (almost), but written $It instead of $it .
21:19:36sschwarzerActually I have now "abc".toSeq().mapIt($it) , without `items`
21:19:56Zevv!eval import npeg; echo patt(+>1).match("abc").captures
21:20:00NimBot@["a", "b", "c"]
21:20:04Zevvbwah that's ugly
21:20:08sschwarzerZevv: oh dear :)
21:20:23Zevvdon't go there :)
21:20:43sschwarzerZevv: "abc".toSeq().mapIt($it) works, so I'm set. :-)
21:20:59Zevvyou should! I was hoping distribute works with strings, but it's limited to seq[T]
21:21:00sschwarzerUnless there's an even simpler way
21:21:14*ltriant joined #nim
21:21:25Zevvwhich makes me wonder again why nim does not treat strings and seq[char] the same, since technically they are
21:21:38Zevvis it the trailing '\0'?
21:22:01sschwarzerI'm really enjoying Nim. I'm also experimenting with the cligen package, very interesting.
21:23:16ZevvAlways good to hear! Please also enjoy our *fine* community services at #nim and forum.nim-lang.org!
21:24:32FromGitter<deech> Free continental breakfast
21:25:51Zevvthere is no such thing as a free breakfast
21:26:28sschwarzerZevv: I've written several forum postings already (both questions and answers) :)
21:27:49sschwarzerIt seems cblake isn't here? Or under a different name?
21:36:15sschwarzerThanks for your help, bye!
21:36:34*sschwarzer quit (Quit: leaving)
21:38:01*luis_ joined #nim
21:39:35*ltriant quit (Read error: Connection reset by peer)
21:39:47*nsf quit (Quit: WeeChat 2.7)
21:40:26*narimiran quit (Ping timeout: 240 seconds)
21:41:23FromDiscord<exelotl> uuh, the nim compiler appears to be stuck on a CC step
21:41:30FromDiscord<exelotl>
21:41:30FromDiscord<exelotl> https://cdn.discordapp.com/attachments/371759389889003532/663497321610477568/unknown.png
21:41:46FromDiscord<exelotl> anyone know how I can debug this? :\
21:42:42*ltriant joined #nim
21:42:44FromDiscord<exelotl> previously I was using `--compileOnly` and relying on a makefile to compile the C files
21:45:49FromDiscord<exelotl> ohh it's this issue https://forum.nim-lang.org/t/5396#33815
21:58:58*tane quit (Quit: Leaving)
21:59:36*filcuc joined #nim
21:59:49zedeusahh finally! I got MultipartData file streaming working smoothly without any API changes
22:08:04*luis_ quit (Ping timeout: 248 seconds)
22:15:54*ng0 joined #nim
22:15:54*ng0 quit (Changing host)
22:15:54*ng0 joined #nim
22:17:21*luis_ joined #nim
22:17:21*luis_ quit (Remote host closed the connection)
22:17:50*luis_ joined #nim
22:18:34*luis_ quit (Client Quit)
22:33:16*neceve quit (Remote host closed the connection)
22:36:47shashlickAraq: when you get a chance, curious about https://github.com/nim-lang/Nim/issues/13047
22:36:49disbotCompiler still needs -d:nimOldCaseObjects in non-danger mode ; snippet at 12https://play.nim-lang.org/#ix=26wx
22:38:47disruptekgot a new bot feature for you all.
22:39:00disruptekDefine a footnote with `~term is /some text here/` and fetch definitions with `~term`.
22:40:27shashlickyou need a web page with bot features documented along with examples
22:41:38disruptek~rfc is a `Request For Comments`; a proposal for discussion, such as you might find at https://github.com/nim-lang/RFCs
22:41:49disruptek~rfc
22:42:10disruptekhmm, i guess it should share it with the whole channel.
22:42:53FromDiscord<mratsim> someone has a clever workaround for this? https://github.com/nim-lang/Nim/issues/13048
22:42:55disbotrecursive default call in type sections: invalid type in this context for proc ; snippet at 12https://play.nim-lang.org/#ix=26wy
22:45:27FromDiscord<mratsim> I guess I have to write a macro with getImpl
22:53:33skrylar[m]Zevv: some day the password reset on the forums will even work :^)
22:54:45*Hideki_ joined #nim
22:59:18*Hideki_ quit (Ping timeout: 268 seconds)
23:03:34*solitudesf quit (Ping timeout: 258 seconds)
23:04:46*abm quit (Quit: Leaving)
23:04:47disruptekit's confusing that when you login to the forum, the dialog isn't dismissed. i have to refresh the page to discover that the login worked.
23:06:32FromDiscord<mratsim> yep
23:06:50FromDiscord<mratsim> found a workaround for my issue, ugly macros to the rescue
23:10:25*federico3 quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
23:12:18dom96disruptek, which dialog?
23:12:37disruptekthe authentication dialog presented when i click the signin button.
23:12:53*lmariscal06 quit (Quit: I'm Out!)
23:13:13dom96in what way is it not dismissed?
23:13:18*uu91 quit (Remote host closed the connection)
23:13:25dom96I just logged in and it went away as soon as I was logged in
23:13:48disrupteki guess in a different way to that.
23:13:57disruptekchrome 72.
23:13:59dom96you see any errors in console?
23:14:06dom96guess karax is failing
23:14:15dom96I'm on FF
23:14:20disruptekUncaught Error: Error: unhandled exception: same(kxi.currentTree, getElementById(document, kxi.rootId), 0) [AssertionError]
23:14:24dom96yep
23:15:03disrupteki can run chrome 80, but it's not as fast as 72.
23:15:29*lmariscal06 joined #nim
23:15:55disruptekseems to produce the same error, though.
23:16:22dom96it's possible this has been fixed in latest Karax, the forum's front end hasn't been rebuilt in a while
23:16:32disruptekyeah, looks like ~17mos.
23:19:40disruptek~forum is Nim has a forum at https://forum.nim-lang.org/ -- ask @dom96 for help with any account issues.
23:19:40disbotNim has a forum at https://forum.nim-lang.org/ -- ask @dom96 for help with any account issues.
23:25:03zedeusdom96: please take a look at #12982 when you have time
23:25:04disbothttps://github.com/nim-lang/Nim/pull/12982 -- 3Implement file streaming for httpclient's MultipartData
23:30:02*Vladar quit (Quit: Leaving)
23:32:45*federico3 joined #nim
23:37:37*NimBot joined #nim
23:49:08*endragor joined #nim