<< 11-08-2019 >>

00:00:01*junland quit (Quit: %ZNC Disconnected%)
00:03:42*junland joined #nim
00:13:43FromDiscord_<Shield> the part abotu Swap in https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst
00:37:58*krux02_ quit (Remote host closed the connection)
00:40:18*dddddd quit (Remote host closed the connection)
01:20:59*HP-YC9 quit (Remote host closed the connection)
01:21:07*HP-YC9 joined #nim
01:23:33FromDiscord_<Shield> it may be the lack of sleep but I can't wrap my head around newruntime
02:05:58*HP-YC9 quit (Remote host closed the connection)
02:06:05*HP-YC9 joined #nim
02:06:15*HP-YC9 quit (Remote host closed the connection)
02:08:55*HP-YC9 joined #nim
02:09:05*HP-YC9 quit (Remote host closed the connection)
02:10:12*HP-YC9 joined #nim
02:10:51*HP-YC9 quit (Remote host closed the connection)
02:10:59*HP-YC9 joined #nim
02:11:06*HP-YC9 quit (Remote host closed the connection)
02:12:31*HP-YC9 joined #nim
02:16:01*HP-YC9 quit (Remote host closed the connection)
02:16:09*HP-YC9 joined #nim
02:26:40*steshaw_ quit ()
02:26:58*HP-YC9 quit (Remote host closed the connection)
02:27:08*HP-YC9 joined #nim
02:27:19*steshaw_ joined #nim
02:32:36*HP-YC9 quit (Remote host closed the connection)
02:33:19*HP-YC9 joined #nim
02:45:45*steshaw_ quit ()
02:46:21*steshaw_ joined #nim
02:52:38*HP-YC9 quit (Remote host closed the connection)
02:52:46*HP-YC9 joined #nim
02:55:15*kungtotte joined #nim
03:00:29*lritter quit (Ping timeout: 244 seconds)
03:01:16*lritter joined #nim
03:12:40*steshaw_ quit (*.net *.split)
03:12:42*meff[m] quit (*.net *.split)
03:12:42*lqdev[m] quit (*.net *.split)
03:12:42*xomachine[m] quit (*.net *.split)
03:12:42*yglukhov[m] quit (*.net *.split)
03:12:42*spymasterd[m] quit (*.net *.split)
03:12:42*Demos[m] quit (*.net *.split)
03:12:44*snowolf quit (*.net *.split)
03:13:01*odc quit (*.net *.split)
03:13:01*nuxdie quit (*.net *.split)
03:13:01*dashed quit (*.net *.split)
03:13:01*enthus1ast quit (*.net *.split)
03:13:01*LyndsySimon quit (*.net *.split)
03:13:01*surma quit (*.net *.split)
03:13:01*nimblepoultry quit (*.net *.split)
03:13:01*deansher quit (*.net *.split)
03:13:01*d10n-work quit (*.net *.split)
03:13:01*msmorgan quit (*.net *.split)
03:13:33*nuxdie joined #nim
03:13:42*steshaw_ joined #nim
03:13:46*yglukhov[m] joined #nim
03:13:49*d10n-work joined #nim
03:14:13*nimblepoultry joined #nim
03:14:52*Demos[m] joined #nim
03:15:32*xomachine[m] joined #nim
03:15:41*spymasterd[m] joined #nim
03:18:02*meff[m] joined #nim
03:18:02*lqdev[m] joined #nim
03:18:02*msmorgan joined #nim
03:18:02*odc joined #nim
03:18:02*dashed joined #nim
03:18:02*snowolf joined #nim
03:18:02*deansher joined #nim
03:18:02*enthus1ast joined #nim
03:18:02*LyndsySimon joined #nim
03:18:02*surma joined #nim
03:18:03*odc quit (Changing host)
03:18:03*odc joined #nim
03:18:04*dashed quit (Changing host)
03:18:04*dashed joined #nim
03:18:05*deansher quit (Changing host)
03:18:05*deansher joined #nim
03:18:06*msmorgan quit (Changing host)
03:18:06*msmorgan joined #nim
03:18:09*lqdev[m] quit (Changing host)
03:18:09*lqdev[m] joined #nim
03:18:09*meff[m] quit (Changing host)
03:18:09*meff[m] joined #nim
03:20:05*snowolf is now known as Guest9706
03:50:08*leorize quit (Ping timeout: 260 seconds)
03:51:15*leorize joined #nim
04:08:35*nif quit (Quit: ...)
04:08:45*nif_ joined #nim
04:17:09*laaron quit (Remote host closed the connection)
04:21:12*laaron joined #nim
04:26:27*lritter quit (Quit: Leaving)
04:29:42*endragor joined #nim
04:30:38*joshbaptiste quit (Ping timeout: 268 seconds)
04:35:07*nif_ quit (Quit: ...)
04:35:16*nif joined #nim
04:45:41FromGitter<bevo009> Can you assign a proc to a variable in Nim? ⏎ I can't find it mentioned in the docs ⏎ If it is possible, how would I fix this statement? ⏎ ```var msg = echo 42``` #error [https://gitter.im/nim-lang/Nim?at=5d4f9d755178a724766839b0]
04:48:13FromGitter<bevo009> Arent these examples procs being assigned to variables? ⏎ ```var rs = initRand(6)``` ⏎ or ⏎ ```let name = readLine(stdin)``` [https://gitter.im/nim-lang/Nim?at=5d4f9e0dbfd2887f53c9b482]
04:49:45FromGitter<bevo009> I know I could do this: ⏎ ⏎ ```proc a = echo 42 ⏎ a()``` ⏎ But that's not my question``` [https://gitter.im/nim-lang/Nim?at=5d4f9e694e17537f520ebd06]
04:58:16*joshbaptiste joined #nim
05:07:31rayman22201@bevo009 https://play.nim-lang.org/#ix=1RhG
05:17:25*nif quit (Quit: ...)
05:17:35*nif joined #nim
05:24:54FromGitter<bevo009> That's interesting. Is it documented anywhere?
05:25:07FromGitter<bevo009> or maybe it's not idiomatic in Nim
05:29:28*joshbaptiste quit (Ping timeout: 272 seconds)
05:29:54*endragor quit (Remote host closed the connection)
05:38:08rayman22201It is idiomic. Documented under closures perhaps?
05:42:21*solitudesf joined #nim
05:53:31FromGitter<zacharycarter> so there's no way to get a typedesc back from a NimNode after passing a typedesc to a macro - correc?
05:53:35FromGitter<zacharycarter> correct*
05:56:01*joshbaptiste joined #nim
05:58:12FromGitter<zacharycarter> actually I think I have another way of doing what I need to do so disregard my last qusetion
06:00:02FromDiscord_<Shield> what are you working on @zacharycarter?
06:00:22FromGitter<zacharycarter> still working on that macro for NimScript
06:00:45*endragor joined #nim
06:01:09FromGitter<zacharycarter> just adding some extra features - I'd like the feature to be smart enough to call each macro for every complex object nested inside another complex object
06:01:11FromDiscord_<Shield> use nimscript as a scripting language? or to replace hcr?
06:01:48FromGitter<zacharycarter> oh - well - I'm using it as an alternative to HCR, since HCR has some kinks I haven't been able to find the solution to on my own
06:02:07FromGitter<zacharycarter> and you can already use NimScript as a scripting language - but you have to embed the stdlib in your codebase which isn't ideal - but is another problem entirely
06:02:20FromGitter<zacharycarter> the macro I'm working on basically eases passing complex object b/w NimScript and Nim
06:02:55FromGitter<zacharycarter> it generates the vmhook to create an instance of a complex object from VmArgs and it also generates a proc to create a PNode from a complex object for calling setResult on
06:05:46*endragor quit (Ping timeout: 276 seconds)
06:06:43*solitudesf quit (Ping timeout: 245 seconds)
06:10:05FromDiscord_<Shield> cool, hcr sounds great but I didn't have long compile times past the initial compiling
06:10:14FromDiscord_<Shield> yet
06:11:42FromGitter<zacharycarter> once incremental compiling is done it may make HCR etc kind of pointless
06:11:58FromGitter<zacharycarter> but I still think games present a special case where you can need to reload code, art assets, shaders, etc
06:12:10FromGitter<zacharycarter> so I don't think it's necessarily wasted on them
06:31:59*nif quit (Quit: ...)
06:32:10*nif_ joined #nim
06:32:46*laaron quit (Remote host closed the connection)
06:34:15*laaron joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:03:24*endragor joined #nim
07:04:52*gmpreussner joined #nim
07:08:48*endragor quit (Ping timeout: 245 seconds)
07:22:07*joki1337 joined #nim
07:28:12*steshaw_ quit ()
07:28:38*steshaw_ joined #nim
07:30:15FromGitter<zacharycarter> is it possible to have a gathers all of the fields of an object which are also objects?
07:30:33FromGitter<zacharycarter> I am trying to write a recursive procedure which calls a macro to do this - but I'm struggling
07:39:23FromGitter<mratsim> Something like this? https://github.com/mratsim/Arraymancer/blob/master/src/nn/optimizers/optimizers.nim#L74-L80
07:41:37FromGitter<zacharycarter> thanks - let me give that a go
07:42:20FromGitter<mratsim> basically when iterating with fields, you can use when foo is object for recursive expansion
07:43:08FromGitter<mratsim> it’s the same strategy as my flat iterator: https://github.com/mratsim/Arraymancer/blob/master/src/private/nested_containers.nim#L22-L30
08:01:22*laaron quit (Remote host closed the connection)
08:03:39*joki1337 quit (Remote host closed the connection)
08:04:23*joki1337 joined #nim
08:08:32FromGitter<zacharycarter> thanks @mratsim - I think I can get this working with your suggestion :)
08:09:16*joki1337 quit (Ping timeout: 276 seconds)
08:13:43*joki1337 joined #nim
08:15:39FromGitter<zacharycarter> hmm - it does work kind of - it generates the procs but since the second proc that is generated calls the first proc - I get an error about the identifier being undeclared
08:16:30FromGitter<zacharycarter> even though I recurse before I generate the procs for the actual type
08:16:34FromGitter<zacharycarter> so that's weird
08:22:20*steshaw_ quit ()
08:22:50*steshaw_ joined #nim
08:34:12*joki1337 quit ()
08:38:07*krux02 joined #nim
08:42:47shashlick@mratsim - just saw this https://github.com/Qthreads/qthreads
08:48:49FromGitter<mratsim> yes I know about it, didn’t delve too much though
08:49:18FromGitter<mratsim> I like the lab report on parallel runtime they did in 2013
08:49:53FromGitter<mratsim> https://prod-ng.sandia.gov/techlib-noauth/access-control.cgi/2012/1210594.pdf
08:52:19FromGitter<mratsim> There are so many libraries and papers and so little time to do actual code though :/
08:52:26FromGitter<zacharycarter> can anyone think of why this would be happening? If I echo my macro's result.repr - I can see `getBar` being created before `getFoo` (which calls `getBar`)
08:52:37FromGitter<zacharycarter> but I still get - Error: undeclared identifier: 'getBar'
08:52:47FromGitter<zacharycarter> maybe I need to generate a forward declaration?
08:53:07FromGitter<mratsim> maybe bind or bindSym”getBar"
08:53:18FromGitter<mratsim> instead of just ident”getBar"
08:53:19FromGitter<zacharycarter> hmm let me try that - good idea
09:05:41*nsf joined #nim
09:06:22FromGitter<zacharycarter> neither seem to work :/
09:07:44FromGitter<zacharycarter> oh well - maybe there's a different way to go about this
09:17:05shashlickDo you need code reordering
09:17:15FromGitter<zacharycarter> oooo
09:17:16FromGitter<zacharycarter> maybe
09:22:03FromGitter<zacharycarter> didn't help either
09:22:04FromGitter<zacharycarter> doh well
09:24:18*laaron joined #nim
09:37:27*endragor joined #nim
09:40:09*Vladar joined #nim
09:42:52*endragor quit (Ping timeout: 276 seconds)
09:53:21*clyybber joined #nim
10:25:11*PMunch joined #nim
10:37:29*endragor joined #nim
10:40:50FromDiscord_<tomku> how do I declare a template string with some {vars} that can later on be fed to $? like so: https://play.nim-lang.org/#ix=1Rit
10:41:42*endragor quit (Ping timeout: 245 seconds)
10:41:44*lkw joined #nim
10:43:05FromGitter<Vindaar> @zacharycarter did you figure it out?
10:43:23FromGitter<zacharycarter> no - taking a break from it and just working on my game for a bit
10:43:42FromGitter<Vindaar> @tomku: this might be what you're looking for: https://nim-lang.github.io/Nim/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D
10:43:55FromGitter<Vindaar> ah, ok!
10:49:49FromDiscord_<tomku> @Vindaar: works like a charm, thanks!
10:52:54*stefanos82 joined #nim
10:57:39*laaron quit (Remote host closed the connection)
10:59:31*nif_ quit (Quit: ...)
10:59:40*nif joined #nim
11:03:56*laaron joined #nim
11:10:06lqdev[m]also, you can declare the string as const and feed it to fmt later
11:13:50*endragor joined #nim
11:15:48*laaron quit (Remote host closed the connection)
11:15:52*endragor quit (Remote host closed the connection)
11:15:58*endragor joined #nim
11:18:27*laaron joined #nim
11:32:40*HP-YC9 quit (Remote host closed the connection)
11:32:48*HP-YC9 joined #nim
11:33:16*leorize_ joined #nim
11:33:32*leorize quit (Ping timeout: 260 seconds)
11:44:29Araqping clyybber
11:48:31clyybberAraq: Hi
11:48:41Araqdid you find new problems?
11:48:58clyybberAraq: Nope. But I have an idea for an optimization
11:49:08clyybberA very simple one
11:49:14Araqhah, me too
11:49:30Araqmove destructors into after "last usage of 'x'"
11:49:50Araqand then let 'wasMoved(x); =destroy(x)' cancel each other out
11:50:15clyybberAraq: Yay
11:50:36clyybberI think thats basically the branch based approach if I understand you correctly
11:50:48Araq=sink looks better and better.
11:50:52Araq;-)
11:51:53*laaron quit (Remote host closed the connection)
11:53:00Araqbut if we want to optimize, we should write an optimizer, it doesn't affect the spec much.
11:54:17clyybberBtw, it *was* actually cooldomes patch that fixed our problems: https://github.com/nim-lang/Nim/commit/948c625f95d061e7f2608d9ead20d1fd05a64cd0#diff-c2f32b8561115a01d52343ae891a8640R381
11:54:47*laaron joined #nim
11:55:04clyybberBecause it causes wasMoved(x) to be applied before x gets assigned to select(...)
11:55:58clyybberMy Idea for an optimization is to not generate those blitTemps for the sink arguments, but instead only one temporary for the return value of select(...)
11:56:22clyybberSo we transform: x = select(true, x, y)
11:56:41clyybberto: let tmp = select(true, x, y)
11:56:50clyybberwasMoved(x); wasMoved(y)
11:56:57clyybberx = tmp
11:57:00*laaron quit (Remote host closed the connection)
11:57:33clyybberIts a very minor optimization, but it depends on the number of sink arguments involved.
11:57:35Araqthat's worse because missing NRVO
11:58:03Araqx = f(...) is often turned into 'f(..., x)' # construct inplace
11:58:37Araqer... doubt it's called NRVO but you get the idea.
11:59:36Araqalso, usually you pass a construction to a sink parameter
11:59:59Araqand then we don't generate wasMoved anyway.
12:01:55Araqhowever there is bug https://github.com/nim-lang/Nim/issues/11833 which means we generate too few 'wasMoved' :P
12:02:24Araqand so I'm patching the spec and after that I can check where the implementation got it wrong.
12:06:27*clyybber quit (Ping timeout: 248 seconds)
12:07:35*laaron joined #nim
12:10:09*clyybber joined #nim
12:10:53*laaron quit (Client Quit)
12:15:46*laaron joined #nim
12:21:13*HP-YC9 quit (Remote host closed the connection)
12:21:21*HP-YC9 joined #nim
12:21:23*PMunch quit (Remote host closed the connection)
12:27:30*laaron quit (Remote host closed the connection)
12:27:54*laaron joined #nim
12:36:47*laaron quit (Remote host closed the connection)
12:41:07*laaron joined #nim
12:41:23clyybberAraq: 11833 happens because in injectdestructors:504 isSinkTypeForParam is false.
12:41:51Araqwell system.`@` doesn't use 'sink'
12:42:11Araqwhich means worse codegen, but it should still be correct
12:42:21clyybberYeah, thats what buffles me too
12:42:26clyybberIt should still not crash
12:42:32Araqyup
13:02:38dom96Araq, easy merge? https://github.com/nim-lang/Nim/pull/11879
13:04:51Araqdom96: no. I don't understand it completely
13:06:10dom96It's similar to how this was fixed: https://github.com/nim-lang/Nim/issues/8484
13:07:02Araqwhat's special about nkVarTy, nkBracketExpr? nothing
13:07:29*shomodj joined #nim
13:08:29Araqso this patch is at best incomplete
13:08:47Araqand most likely the fix for nkVarTy was wrong too
13:08:47dom96The problem is that I can't call hasCustomPragma on a field that is `Point[float]` for example
13:09:00dom96Not sure why I can't reproduce it though
13:09:10Araqso? 'ref Point' is also affected then
13:09:16Araq(that would be nkRefTy)
13:09:31dom96That's possible
13:10:12dom96It's likely that this is incomplete, but at least it fixes the problem I am having
13:10:36dom96(and Vindaar too by the looks of it)
13:11:22Araqhmm, I remember this patch differently
13:11:29FromGitter<Vindaar> yes. Although for me personally it was only a blocker for that `doNotSerialize` PR
13:11:42Araqplease rebase, mark it with 'XXX look into this further'
13:11:51Araqand if it's green, I shall merge it
13:11:56dom96yeah, that's exactly what I'm trying to implement in my own serialization library
13:12:01Araqbut as I said, it's incomplete.
13:12:42Araqkrux02 also rewrote customPragmaNode but I don't know what happened with the PR
13:13:23krux02I looked at the PR recently
13:13:44krux02I think there was only something minor holding it back and then I forgot about it.
13:13:55krux02I should probably finish it.
13:14:38krux02it does split the functionality a bit nicer into procedures, and most importantly, it provides an api that takes NimNode (use from macros)
13:17:06dom96krux02, if you do finish it CC me in the PR (and possibly here) so that I can test it with my code
13:17:19krux02ok
13:17:21dom96anyway, I updated my PR
13:24:03*laaron quit (Remote host closed the connection)
13:28:01*laaron joined #nim
13:29:00krux02dom96: this is my PR: https://github.com/nim-lang/Nim/pull/11526
13:29:11krux02it is ready to be tested
13:29:57krux02it is feature complete, all that needs to be done now is to massage the test environment.
13:30:43*sentreen quit (Ping timeout: 248 seconds)
13:33:35*solitudesf joined #nim
13:34:01dom96krux02, commented with a stack trace that I get
13:34:11krux02ok
13:34:12dom96very odd
13:34:48krux02can you also post a code to use the serializer?
13:34:55dom96afraid not
13:34:56krux02I would like to make a test out of it
13:35:20dom96I think @Vindaar might have a test case of some sort though
13:35:35FromDiscord_<Kiloneie> Really cool that you can view other people's solutions on Exercism, you can find like a ton of approaches to the same problem, this is a great tool for learning.
13:36:23dom96Nice! Big props to those that are creating exercises for Nim on Exercism :)
13:37:24FromDiscord_<tomku> yep! shame there are so few mentors though
13:38:04FromGitter<Vindaar> Unfortunately I don't have one either. As I commented here: https://github.com/nim-lang/Nim/pull/11879#issuecomment-519496631, the problem started happening with an existing test case, after this commit: https://github.com/nim-lang/Nim/commit/28bb5650bb347520e41033181a064ac16646f6a8
13:38:27dom96but that test case reproduces it, right?
13:39:15FromGitter<Vindaar> yes, but only if that commit were merged ;)
13:40:02FromGitter<mratsim> BTW @Araq and @Clyybber can we create types that can't be copied, only moved?
13:40:57Araqhttps://github.com/nim-lang/Nim/blob/devel/lib/system/widestrs.nim#L36 sure, and it's shipping
13:41:00FromGitter<Vindaar> the thing is I don't even know if it's really the same problem. The test case that breaks makes no use of a custom pragma
13:41:20*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
13:41:25dom96Vindaar: hrm, but your change makes sense I think. Before the custom pragma wasn't checking all nodes it was supposed to
13:41:36dom96Yeah, but even if no custom pragma is used the nodes still are checked
13:41:56*laaron joined #nim
13:42:00clyybberAraq: Yeah, just declare `=` with an {.error.} pragma
13:42:22clyybberOh, sry wrong tag, @mratsim
13:42:36FromGitter<Vindaar> yes, which is why https://github.com/nim-lang/Nim/issues/11415 happens
13:43:06Araqclyybber: if =sink doesn't need to check for self-assignment, does it even need to call =destroy ?
13:43:12*ng0 joined #nim
13:43:38Araqand then why do we need =sink? it's always a bitcopy
13:43:54*sentreen joined #nim
13:44:28clyybberAraq: But we leak if we don't =destroy x in `=sink(x, ...)`
13:44:58Araqnot if we emit the =destroy before it
13:45:07clyybberYeah, thats an idea that came to mind too
13:45:46Araqwell I'm leaving it as it is now
13:45:58Araqmaybe the self-assign check is required after all
13:46:36clyybberIt is only required when the rexpression in an assignment includes the lhs symbol.
13:47:13Araqsure.
13:47:16*solitudesf quit (Ping timeout: 272 seconds)
13:47:22clyybberAnd since `=` makes a deep copy, we wont have problems with aliasing.
13:47:30clyybberEverything will just work
13:47:32clyybberI think
13:47:50Araqhmm if we don't have =sink we can get 'emplacement' for free, maybe?
13:48:06clyybberWhat do you mean with emplacement?
13:48:10Araqthat's still a major missing piece
13:48:27Araqin C++ there is vector::emplace_back
13:48:49Araqit constructs the object directly at vec[vec.len]
13:49:32Araqwe have to zero its memory so that =destroy doesn't do anything
13:50:00*dddddd joined #nim
13:52:02clyybberAraq: Afaict emplacement is only saving one copy with a type with reference semantics. So it only matters for value types. But emplace back in cpp isn't that special right?
13:52:17clyybberIt just takes whatever is required to construct the object in place
13:52:37Araqit uses some forwarding technique to make construction lazy
13:52:51Araqand so it can construct into uninit'ed memory
13:55:35clyybberAraq: I would introduce an `=overwrite` operator or something like that which doesn't care what location is it's destination.
13:55:45clyybberAnd use that in emplace_back
13:56:24clyybberAh, but if =sink is a simple shallow copy, that won't be neccessary
13:56:51clyybberHmmm, I like how everything convienently falls into place
13:57:16krux02clyybber I don't think you can do that
13:57:38krux02if you override =, you have to deconstruct the object on the left hand side of the operator
13:58:02krux02if you emplace, you may not deconstruct the object on the left hand side of the operator, because it is uninitialized data.
13:58:24clyybberkrux02: Thats why I was talking about a new operator
13:58:31clyybberwhich wont deconstruct the object on the lhs
13:59:14krux02and when will that operator be called?
14:00:33clyybber`=overwrite`
14:00:42clyybberBut as it turns out that wont be needed
14:00:52krux02My solution for an emplace back would be a macro/template that can be called like this ``emplaceBack(myInitProc, arg1, arg2, arg3)``
14:00:56clyybberWhen =sink doesn't deconstruct the lhs itself
14:01:25clyybberBut rather the compiler injects a `=destroy`(lhs) before a `=sink`(lhs, ...)
14:02:07clyybberThen you could have some pragma or whatever that tells the compiler to not inject `=destroy`(lhs)
14:02:14clyybberan then we have a free emplacement
14:02:19clyybberI think thats what Araq meant
14:03:15FromDiscord_<Kiloneie> I think the documentation could be updated (added examples on certain procedure uses) from solutions on exercism.
14:05:09*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
14:05:36dom96btw we're overdue our yearly community survey
14:05:37*laaron joined #nim
14:06:18dom96I guess we can stop doing this if it's not valuable
14:06:25dom96but it was nice to get this signal every year
14:07:45FromDiscord_<Kiloneie> im up for a survey, wasn't the last one from 2017 ?
14:08:41FromDiscord_<Kiloneie> if you ask me, it's good to know whats going on in the Nim community, based on the data, one could see areas to improve for more growth
14:08:46dom96https://nim-lang.org/blog/2018/06/23/community-survey-2018.html
14:08:48dom962018
14:11:05FromGitter<mratsim> BTW will we have destroy for ptr object in the future? That would really help wrapping C library with all the pointers and context that you need to manage.
14:12:38Araqmratsim: no, pointers are pointers, C++ doesn't attach destructors to pointers either
14:13:25Araqdom96: I think it's very valuable and what we improved was based on the feedback we got, even though sometimes it doesn't look like it
14:13:45FromDiscord_<Kiloneie> Based on the surveys, tutorials/documentation and 1.0 is really the biggest issue, (documentation is also Godot's problem)
14:14:00clyybbermratsim: You can just wrap the pointer in an object.
14:14:35FromDiscord_<Kiloneie> im a bit behind my schedule on making those videos, constant shit going on, freaking holidays, and people keep bugging me xD...
14:19:38*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
14:21:29*laaron joined #nim
14:23:05*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:25:02*laaron quit (Remote host closed the connection)
14:27:02*laaron joined #nim
14:27:12clyybberAraq: So everything boils down to:\n * Inject `=destroy`(x) when before a `=sink`(x, ...) or a `=`(x, ...)
14:28:08FromGitter<Vindaar> @treeform: in case you're around, have you seen my chroma PR? https://github.com/treeform/chroma/pull/4
14:28:17clyybberWrap (`=destroy`(x)` and) `=sink`(x, ...) in a self-assigncheck when `...` includes `x`
14:28:34clyybberAnd `destroy`(x) after its last use.
14:29:05clyybberAnd then we have a fast new runtime :D
14:30:09clyybberAnd the self-assign check AND the nil check in =sink will be gone
14:30:30*Kaivo joined #nim
14:31:15*steshaw_ quit (Quit: Connection closed for inactivity)
14:32:53clyybberBtw Araq, I think I have found why 11833 is crashing
14:33:33clyybberArgh, nevermind, not yet
14:38:52Araqclyybber, krux02 proc add*(x: seq; y: sink T) {.nodestroy.} = copyMem(x[x.len], y)
14:39:03Araqwe can do "emplace" already
14:40:10dom96krux02, Araq: I've reproduced it: https://github.com/nim-lang/Nim/issues/11923
14:40:12Araqbut copyMem doesn't always work, I guess
14:43:35clyybber=sink could be the new copyMem
14:43:42clyybberor will if we implement the above
14:44:16dom96btw am I missing something obvious? Why doesn't this compile? https://play.nim-lang.org/#ix=1Rjq
14:46:12FromGitter<Vindaar> because `Point` is defined after `MyObj`?
14:48:36dom96yep
14:48:41dom96Do we have an issue for this?
14:48:48dom96The error message is horrible
14:48:54Araqyeah, we do.
14:49:00krux02dom96: I tested your issue on my branch, here it works
14:50:03dom96There must be some other issue in your branch then
14:50:33dom96or maybe I just needed to re-bootstrap
14:53:35Araqclyybber: well Rust uses copyMem for moving, so there is some way to make it work
14:54:33Araqbut how Rust does it precisely is not documented well and in a state of flux. It uses hidden 'wasMoved' bit flags
14:54:50AraqNim uses the default(T) state for this.
14:55:26Araqmore elegant IMO and Nim can move from array[index] and Rust can't.
15:07:34*onionhammer1 is now known as onionhammer
15:10:33Araqclyybber: did you play with .cursor variables?
15:10:51AraqIMHO we should simply remove them again, 'lent T' does the same (?)
15:13:54clyybberYeah, looks like that to me.
15:14:06clyybberThey both are always shallow copied and never destroyed.
15:15:00Araqok, good
15:15:11*Araq removes them from the spec
15:20:21*joki1337 joined #nim
15:21:27disruptekclyybber: you deserve a lot of credit for the time you put in on this.
15:21:34*joki1337 quit (Client Quit)
15:31:37FromGitter<arnetheduck> Araq, do you have a like to the rust wasMoved bits?
15:35:21Araqarnetheduck: we had these bits too, they simply don't work well
15:35:56FromGitter<arnetheduck> er, oops, I meant link ;)
15:36:12Araqhmm, let me see
15:37:15Araqhttps://doc.rust-lang.org/nomicon/drop-flags.html
15:37:34Araqhttps://blog.rust-lang.org/2016/04/19/MIR.html
15:37:58*aq60 joined #nim
15:38:01Araqthere always was an RFC that made me "WTF?!" :P
15:38:43Araqwhere they ignored the problems entirely. (The problem being: How do you store the drop bits on the **heap**?)
15:39:40FromGitter<arnetheduck> and thinking about the array[index] case, what does it actually mean to have moved away from an array? `default(T)` means you have two instances after the operation of `move` - is that the intended intuition?
15:39:45FromGitter<arnetheduck> thanks
15:40:27aq60Hi, when using the newruntime, and this `proc `toref`*[T](x: var T): ref T = cast[ref typeof(x)](x.addr)` theres an error: `nim-0.20.2\lib\core\runtime_v2.nim nimDecWeakRef attemt to read from nil`
15:42:45aq60Basicly im casting to ref in a loop, it passes with the first 5-6 objects, but on the next one it fails
15:44:48Araqaq60: that's simply not a valid cast, in no runtime, neither old nor new
15:45:07Araq'ref' means it's provably on the heap.
15:45:57aq60how should I cast ref, like you do .addr with ptr?
15:46:06clyybberdisruptek: Thanks, it was more of a learning experience, now that we know =move is actually unneccessary
15:46:12Araqarnetheduck: it means you won't access array[index] afterwards anymore but when you do, at least it's deterministic and it will have the "empty" container in it
15:47:02Araqit's a compromise because nobody knows how to reason about heap locations effectively
15:48:21aq60It works with the old runtime
15:48:36Araqaq60: you simply got very very lucky
15:48:46aq60:)
15:48:54disruptekclyybber: sure, but you got your hands dirty and newruntime as a research project is the beneficiary. ;-)
15:48:56FromGitter<arnetheduck> well, there's "shouldn't" and "won't" - there's no way for the compiler to prevent it, so code *will* access it - there's no point pretending otherwise - the interpretation that there are two instances after `move` seems more correct and honest at that point, and seemingly it provides the correct explanation for what goes on instead of leaving a black box of uncertainty
15:50:23FromGitter<arnetheduck> I mean, consider the simple case of iterating over the array - if you explain to users that "it means you won't access it", intuitively the for loop should skip it?
15:54:05clyybberarnetheduck: It is consistent with the fact that Nim initializes to 0. So if you want to you can imagine, that by iterating over the moved location you create a new T in it
15:54:35FromGitter<arnetheduck> (what I'm after is a mental model for the feature that allows me to derive behaviours in corner cases - a simple model, but not a simplistic one)
15:55:39FromGitter<arnetheduck> clyybber, that doesn't "work" though - iterating over something is not a mutating operation
15:56:04FromGitter<arnetheduck> neither is reading it by accessing array[index] after the move
15:56:04clyybberarnetheduck: Then imagine it was always there
15:57:06FromGitter<arnetheduck> well, that's what I suggest as interpretation: after `move`, you have two instances - a new one where the previous one was, and a moved-to one
15:57:17*joki1337 joined #nim
15:57:25FromGitter<arnetheduck> but I wonder if it's a) correct and b) the simplest one
15:57:46clyybberarnetheduck: Well, yeah, but it doesn't matter. I can also pretend there is an instance of *something* at any pointer/
15:58:10disruptekwhy isn't `import net` an "unused import" here? https://play.nim-lang.org/#ix=1RjL
15:58:26disrupteksomething to do with the `to()` call.
15:58:31FromGitter<arnetheduck> not really - most languages declare that there's nothing at `nil` for example and build logic around that
15:59:13clyybberarnetheduck: Well, then theres nothing at the previous location
15:59:21clyybberSince the move nils out the source
15:59:48clyybberOr default(T)'s out the location. It doesn't matter
16:00:45FromGitter<arnetheduck> well, that's the point - there's language in the standards that says that at address 0, there *can't* be an instance - it's simply invalid to interpret it as one, 0 or not..
16:01:31aq60still waiting for the proper way of casting a ref :)))
16:01:53FromGitter<arnetheduck> this is not an opinion really on whether it's good or not to use default(T) as a marker, just an exploration of the consequences
16:02:55Araqaq60: there is *none*, ref points into the heap and usually there is a header with a refcount etc that the compiler wants to touch
16:03:55Araqdisruptek: I don't know, report it please
16:04:21aq60I knew i should model the objects with ptr, but no, I wanted to try the safe ref :))
16:04:27disruptekarnetheduck: to me it seems like a simple model, but not a correct one. the fact that we can discern the difference in conversation means that the difference isn't captured by the model. if that's the case, as long as the difference has semantic relevance, then the model is insufficient, right?
16:04:47disruptekAraq: okie.
16:06:24Araqdisruptek: there is always a way to talk about things that are not captured by the programming model. Does "" for an email address mean that you don't know the address or that you know that the user has no email address?
16:06:45disruptekexactly, it's insufficient to capture the semantics.
16:07:17disrupteki would not say that this is "always" the case, though.
16:07:23Araqinsufficient depends on the context, "" is good enough for you to notice that you cannot send an email to this person
16:07:39disruptekwell, we decide what the semantics will be and how the data will reflect that.
16:08:15shashlick@mratsim that's how I made shared - ptr in object
16:08:36shashlickhttps://github.com/genotrance/shared
16:08:51FromGitter<arnetheduck> and even if you have "" and nil both, it's not enough to capture that the user has two email addresses - likewise, if you say that default(T) is the thing, then there are certain things you can't express / do efficiently, but the argument here is that in relation to other features in the language, it's a reasonable tradeoff
16:08:54shashlickBut it still suffers from multiple gc issue
16:09:10disrupteki guess if `default(T)` was written as `nonexistent(T)`, it would satisfy my point; does that make sense?
16:09:52FromGitter<arnetheduck> you have to pay the price for `nonexistent(T)`
16:10:10disruptekie. the programmer conveys the semantic intent instead of picking and choosing from data which is (merely by convention) matching their intent.
16:10:27disruptekhey, nothing in this life comes free. ;-)
16:10:48FromGitter<arnetheduck> so you can use an `option[T]` if you need that - default(T) for that is "no instance". done.
16:11:22disruptekisn't that kinda accidental and arbitrary, though? what if the default value for a type is not "no instance"?
16:11:31disruptekit's convention, right?
16:11:58Araqwell it's just a bunch of bits, the rest is convention, of course.
16:12:18FromGitter<arnetheduck> no, it's design: you know that default(T) works in way X, so you design option(T) (or you seq, or whatever else you're doing) to work this way
16:12:36Araqwell yeah. that's what we do.
16:12:41aq60so this is blasphemy? https://play.nim-lang.org/#ix=1RjP
16:12:42disruptekso default(T) is nonexistent(T), by spec.
16:13:09disrupteki'm fine with that, if that's the case; i got the impression that there was some "third way" here.
16:13:15Araqwell I would say "empty", not "nonexistent".
16:13:22Araqand I'm not sure these are the same.
16:13:23Araq;-)
16:13:43FromGitter<arnetheduck> no, it's not - it's default(T) - you can't distinguish between the two - that's what I'm trying to say: you have two instances after move - that intuition covers this potential ambiguity
16:14:22disrupteksame same. the issue is whether the programmer needs to discern between these, and whether they can provide that discrimination to the compiler, right?
16:15:30clyybberWell, ram is flat, so empty and nonexistant is the same really?
16:16:47FromGitter<arnetheduck> well, it has other consequences to: when do you run the destructor for a type in the array case? once when moving and once when the array is destroyed?
16:16:50disruptekdepends on how many dimensions your ram has. :-P
16:17:38FromGitter<arnetheduck> it seems that after you've moved from array[index], you'll have two destructor calls: once for the new instance in array[index], and once for the location you moved to
16:17:50clyybberarnetheduck: The reason for moves is to elide destructors. So you will only destroy something that isnt default(T)
16:18:07*Kaivo quit (Quit: WeeChat 2.5)
16:19:06clyybberAraq: I fixed 11833
16:19:17clyybberI'll make a PR
16:19:24FromGitter<arnetheduck> well, you will only sometimes *not* destroy something that is `default(T)` - you can't assume in your destructor that it's not `default(T)`?
16:19:44clyybberAraq: Are you ok with me cleaning up injectdestructors a bit while I'm at it?
16:20:44clyybberarnetheduck: You put a check in the destructor: `if x == default(T): return`
16:20:51clyybberAnd put it at the top
16:21:07FromGitter<arnetheduck> well, then you *are* calling the destructor
16:21:14clyybberarnetheduck: I mean, we could also move that check out of the destructor and wrap every destructor call in it
16:21:21*tiorock joined #nim
16:21:21*rockcavera is now known as Guest4031
16:21:21*tiorock is now known as rockcavera
16:21:22clyybberIt doesn't really matter
16:21:35clyybberarnetheduck: But this way it provides a bit more flexibility
16:21:54clyybberAnd that flexibility can of course also be used to make shit go break
16:22:00*tiorock joined #nim
16:23:03FromGitter<arnetheduck> it means that all destructors must always be written in a way that they work with `default(T)`.. for example in `C++` you can enforce in a constructor that an instance never enters particular states like default(T) and it's therefore possible to write "optimal" code for the destructor that assumes that it's never in that state
16:23:40clyybberarnetheduck: Ok, does it do that with static analysis?
16:23:52*Guest4031 quit (Ping timeout: 246 seconds)
16:24:10FromGitter<arnetheduck> well, it does that because constructors are the only "legal" way to create instances - in nim, there's no such thing
16:24:39clyybberarnetheduck: Yeah. Does CPP do that with static analysis?
16:24:42clyybberOr at runtime?
16:25:07clyybberBecause if it does it at runtime, there probably isn't any performance benefit over Nims design
16:25:26FromGitter<arnetheduck> it's part of the language - I wouldn't call it static analysis really, but I guess you could
16:25:37*rockcavera quit (Ping timeout: 246 seconds)
16:26:15clyybberarnetheduck: Yeah, but how does it guarantee that it will never enter a particular state? With runtime checks I assume
16:27:02FromGitter<arnetheduck> no, once a constructor exists, that's the only legal way to construct an object (there's no `default(T)`)
16:28:28clyybberAh, ok.
16:28:42clyybberDestructors in nim rely on default(T) though.
16:29:02clyybberSince ATM we don't elide them at compile time.
16:29:35clyybberBut even if we do there will be cases where we can't statically determine wether a variable has been moved, and thus the destructor body skipped
16:31:17clyybberAnd for those cases we have a state which indicates that the object is not really there (just like a nullpointer)
16:31:53FromGitter<arnetheduck> sure, so that's something that you need to consider when explaining/documenting what move does - for example by saying that the destructor is *sometimes* elided.. c++ has this quirk too - the language allows the compiler to elide copies in certain cases - more recent versions provide stronger guarantees in some of those cases by requiring an elision
16:32:29clyybberYeah
16:32:30disruptekah, so you already have an `empty(T)` or `nonexistent(T)`.
16:32:52FromGitter<arnetheduck> for example, the number of times a copy-constructor will be called might differ between an optimized and a debug build, and that's something you need to be aware of as programmer, or you'll introduce bugs
16:33:51*endragor quit (Remote host closed the connection)
16:33:52FromGitter<arnetheduck> it seems like for destructors, nim will be similar - sometimes they'll be called and sometimes not
16:34:11clyybberYeah, depending on wether the location got moved
16:34:15FromGitter<arnetheduck> so the two-instances intuition is slightly wrong also
16:34:32disruptekit may never be empty or nonexistent, too.
16:34:36FromGitter<arnetheduck> but it's still more correct than "won't be accessible"
16:34:41clyybberbbl
16:39:00Araqclyybber: oh yes please, clean it up
16:42:30disruptekZevv: got a link to example where you cannot generate valid ast for a Table type, as per https://github.com/zevv/npeg/issues/9 ?
16:44:42Araq"two-instances intuition" is the wrong idea. You teach them how it really is and why, your fellow programmers should be able to cope. ;-)
16:49:52FromGitter<zacharycarter> I have no idea to do when I get errors like - `first type mismatch at position: 1 required type: ptr obj but expression 'o' is of type: ptr obj`
16:50:14*solitudesf joined #nim
16:50:21Araqyou have 2 different 'obj' types of the same name
16:50:47Araqthere is logic in the compiler to use moda.obj vs modb.obj then but it doesn't always trigger, unfortunately.
16:51:17Zevvdisruptek: oh great, yes, Id love some more brains on that. Do you want the short simplified version where I probably ask the wrong question, leave out relevant details and make my self hard to understand? Or would you like the long version, taking a lot of your time, but having a higher chance of making my actual problem clear?
16:51:23FromGitter<zacharycarter> okay thanks - actually I just figured out what's causing it - this is interesting
16:51:33FromGitter<zacharycarter> so I had an import at the top of my file which wasn't valid
16:51:48FromGitter<zacharycarter> but it had the same name as the module from the object I was trying to use
16:51:51disruptekZevv: start with the simple one. :-)
16:52:03FromGitter<zacharycarter> so I guess the compiler first complained about them not being the same type of object
16:52:13FromGitter<zacharycarter> before it reported that the module I was trying to import, didn't actually exist
16:52:27disrupteki'm just wondering, because i have some table types i'm generating, so we're probably traversing the same ground...
16:52:28FromGitter<zacharycarter> but thanks for the explanation - that helped me figure it out
16:54:07*lritter joined #nim
16:55:01Araqaq60: cast[ref typeof(x)](x.addr) cannot ever work reliably.
16:55:38Zevvdisruptek: well, I have this partly working. It seems have had three problems: getAast/quote do builds AST-generator code with knowledge of the underlying objects that is not available in the context that tries to execute that code - for example, for Tables it tries to emit the .data and .counter fields which are internal to the Table implementation.
16:55:51aq60Thats my question, what do you use for address?
16:55:59aq60Araq
16:56:15ZevvThen there was a problem that getAst is not properly generating code for variant types - which it does not have to because const variant types are not supported anyway
16:56:23Araqthe problem is not the 'addr', the problem is the 'ref', use 'ptr' instead
16:56:35dom96Zevv: rayman22201: any plans to continue with the spawn+await efforts?
16:56:39aq60I have a C program that has some heavy usage of pointer arithmetics
16:56:43disruptekZevv: got a link to the first part, with the tables and .data?
16:56:45aq60Im porting it to Nim
16:56:54Zevvthird is that the data structure I am trying to ast-ize also holds NimNode code blocks, which does not work
16:57:03Araqthat works easily, but you need to learn about 'ptr' :P
16:57:24Zevvdisruptek: I have a branch, one sec. Basically I provided manual newLit() procs for my objects
16:57:48aq60I just changed all procs and objects to use ptr, it works with the newruntime too :)
16:58:59Zevvdisruptek: https://github.com/zevv/npeg/blob/newlit/src/npeg.nim#L43
16:59:13disruptekconst variant types... this is a concept that is breaking my little brain.
16:59:26Zevvdom96: not sure. After the initial first work we kind of gave up because of motivational reasons, but I guess we should be able to pick that up again
16:59:59rayman22201@dom96 in theory yes. But I don't have a timeline.
17:00:15Zevvdisruptek: why? You have type T which is a variant, and you make a const instance of that type?
17:00:37Zevvdom96: and I guess we have to make some new plans, because we were not on the right path it seems
17:01:08disruptekjust seems like an oxymoron.
17:01:29dom96Zevv, it would be an awesome feature, happy to help any way I can
17:01:30Zevvdisruptek: so basically I got my tables exported from the macro, but now I have no clue how to get them back in to generate code from it
17:03:15Zevvdisruptek: this is what I was trying: https://github.com/zevv/npeg/blob/newlit/src/npeg.nim#L43
17:03:19Zevvhighly illegal, but it compiles :)
17:06:31ZevvI think my whole problem comes down to this: I can use a macro to transform Ast A into Ast X. But what I *want* to do combining multiple AST blocks from multiple macro calls, and generate one single new Ast from that.
17:07:00ZevvSo Ast A and Ast B, mangle them and create Ast X
17:07:16disruptekright, but where does the const part come into play?
17:07:22disruptekA and B are const?
17:07:24*Jesin quit (Quit: Leaving)
17:07:45Zevvmacros run at compile time, so I was trying to do Ast A, store it in a const. Then call another macro passing Ast B and the const data, and create Ast X
17:07:55disruptekare you trying to A +-> B =-> X?
17:07:59*joki1337 quit (Remote host closed the connection)
17:08:11Zevvthat kind of sums it up.
17:08:28ZevvI'll write a tiny practical example of the real thing.
17:08:43*joki1337 joined #nim
17:10:09*laaron quit (Remote host closed the connection)
17:10:22disruptekseems like you want to permute existing ast with another ast as input. i think you are going to need some more data around the ast though; it won't be enough to just guess at the intention, right? maybe the data is as simple as an operation? i guess having it be const is important from an interop perspective.
17:10:28Zevvdisruptek: https://paste.debian.net/plain/1095365
17:11:18Zevvthat's npeg syntax: first grammar 'p' defines a rule called 'ip_address'. I want to be able to reuse that thing in another macro invocation at a later time.
17:11:49disruptekactually, that seems easier.
17:12:00ZevvAnother approach I tried was to postpone the actual transformations until the last stage and simply store the original Nim ast of the patterns I would like to later import.
17:12:11ZevvBut: NimNodes can not be stored in consts.
17:12:35disruptekthey are kinda a pita, right? like poison.
17:12:40*laaron joined #nim
17:13:20Zevvwell, I have this fun thing with macros. It takes a few hours to understand how it all fits together and understand the power. Then you go "Yoooooo this is sick!" and start building great stuff.
17:13:24ZevvAnd then you Hit. A. Wall.
17:13:37ZevvAnd another, and another. And now I'm black and blue and painted myself in a corner
17:13:58*joki1337 quit (Ping timeout: 276 seconds)
17:14:22Zevvmacros seem to be this all-empowering feature, but later I found out they are really ment to do this one thing.
17:14:48ZevvAnd I'm not complaining - they're super useful and make life easier in tons of ways, but I feel I'm tring to bend this into a shep it's not ment to go
17:14:53Araqas in: "They can only transform ASTs"
17:14:59Araq? :P
17:15:10Zevvright. Only one ast to one ast.
17:15:13*laaron quit (Remote host closed the connection)
17:15:28Zevvwhich is of course the whole purpose of macros :)
17:15:45disruptekthe problem, i think, is that we're not used to there being real limitations to our nim code. :-P
17:15:59Zevv^
17:16:04*joki1337 joined #nim
17:16:28disruptekyou have to admit, we're kinda asking a lot of the implementation.
17:16:28ZevvI basiscally learned all this stuff building Npeg. I made a handful of detours and mis-implementations, and ended up with the current approach which is pretty cool imho.
17:16:40Zevvbut I've reached a cul-de-sac now.
17:16:40*Jesin joined #nim
17:16:48Zevvoh definately :)
17:16:55Zevv*definitely*
17:17:03*laaron joined #nim
17:18:00disruptekhonestly, i think this looks easier than it did. you're just basically chaining with imports, right? can a later import shadow an earlier env?
17:18:33ZevvI don't care at this point.
17:19:04AraqZevv: in the longer run, with the new "Packed AST" idea and IC and "semityped ASTs" you won't have these restrictions anymore. maybe
17:19:04ZevvMy biggest issue now is: where can I store my stuff inbetween macro invocations?
17:19:11*laaron quit (Remote host closed the connection)
17:19:21Araqin a .compileTime variable. Obviously.
17:19:56disruptekwould it be easier to change the syntax so you do a withPatterns firstGrammar, secondGrammar: ... and then perform your lookups in some order through those?
17:19:57Zevvok, but is there a real technical limitation at this time, or is it just me not figuring out how to do it?
17:21:25Zevvdisruptek: that's also possible. The practical thing I'm trying to solve is just a method of reusing grammar rules as libraries. So ideally I could create a nimble package providing an URI parser with all its separate components. If someone wants to parse an uri, the do an import of this package, refer to it in their grammar and *poof* all rules are available.
17:21:26disruptekno, i don't see a technical limitation. seems to me you are making this harder than it needs to be, but what do i know? you're the expert!
17:21:38ZevvI'm not at all. I'm only learning this stuff :)
17:21:47*laaron joined #nim
17:23:15*tiorock is now known as rockcavera
17:23:15disruptekwell, .compileTime. does work. you could make them procs although they are basically macros, right? or you can just operate on the outputs as straight data (albeit, compiletime ast).
17:23:15*rockcavera quit (Changing host)
17:23:15*rockcavera joined #nim
17:25:24Zevvwell, what do you know. .compileTime. variables.
17:25:57ZevvI never realized those existed explicitly - I only used compileTime on procs
17:26:44disruptekso your grammar is a table of string, patt, and patt is a seq of instructions. seems like you only need to encode the order in which you perform grammar lookup.
17:27:42Zevvcomplicating factor is that instructions are variants (but I can easily drop that), and can also contain NimNodes which hold nim code
17:28:29disrupteki would just caution you to use as little compiletime as possible, as i've found it's a limiting poison. better off using it as rarely as you can, in my limited experience.
17:28:59Zevvwould it not be easier if I were able to simply store the whole NimNode AST of a macro invocation somewhere, and pass that to another macro somehow?
17:29:03disrupteki don't think that's a complication; does it limit you somehow?
17:29:51Zevvwell, it did when I tried to store my grammar in a const. But with ct vars that is probably not an issue
17:30:02Zevvgoing consts is probably my big mistake
17:30:05disrupteki don't think you can make the same assumptions about input once you start saying, "look, i will consume any valid nim ast that you want to give me."
17:30:22disruptekfact is, you only care about implementations of your (hopefully more limited) "Grammar" type.
17:30:43*nif quit (Quit: ...)
17:30:52*nif joined #nim
17:31:04Zevvwell, this gramamar can *contain* any valid nim ast - which is the embedded nim code
17:31:21FromGitter<zacharycarter> aq60: pointer arithmetic in Nim isn't hard - I do it in my game code in some places
17:31:25disruptekyeah, but that's very different. you can make assumptions about what it contains because it's your code that's generating it.
17:31:31FromGitter<zacharycarter> there's a forum thread that has a bunch of templates for doing exactly this
17:31:46FromGitter<zacharycarter> actually - here: https://gist.github.com/oltolm/1738289b5ac866ec6a7e4ef20095178e
17:31:47Zevvdisruptek: nope, its user supplied code.
17:31:50disrupteki mean, maybe you *want* to be able to compose npeg with any valid nim ast. i dunno.
17:32:20ZevvI thought of mitigating this by storing the embeddded code simply as text and parse it again later
17:32:26disrupteki thought the only input you want to consume is output from your `grammar:`, no?
17:33:22Zevvyes, but grammar: can in real life contain snippets of nim code.
17:33:24disrupteki would start with the simplest model that captures the semantics you want. i don't think that's raw and arbitrary nim ast.
17:33:59disruptekthat's fine; it's not that you cannot support nim ast, it's that it will be wrapper and/or validated and/or generated by your own code, so you can make assumptions about how it will behave.
17:34:08disrupteks/wrapper/wrapped/
17:34:08Zevvtrue
17:34:37disruptekthis is a neat library, thanks for the labor you've put in.
17:35:43Zevvit's *almost* finished :)
17:36:41disruptekwell, i wouldn't be frustrated by an inability to craft what you think will be the last implementation -- the *next* implementation is good enough for now. ;-)
17:38:10Zevvoh very true. And it is already very usable as is, I use it a lot to create all kinds of ad-hoc parser scripts for log files or collecting data for which I ussually sed/awk/python/perl my way around.
17:38:37Zevvand it is used in production at one of my customers for some small things
17:39:28ZevvAnd I personally like the way how it maps on ABFN, for example https://github.com/zevv/npeg/blob/master/tests/examples.nim#L252 is almost literally the URI spec from the RFC
17:39:33disruptekyeah, i'm using it. it's not a complex use-case, but it buys me something significant, so i'm very happy.
17:39:49Zevv\o/
17:40:27disruptekyeah, that's awesome. 👍
17:42:11FromGitter<Vindaar> Zevv: you might have realized that now, but for reference this works: https://play.nim-lang.org/#ix=1Rk7
17:43:30Zevvyes, I was just trying similar things, although I still have issues grokking all the semantics
17:44:48*nsf quit (Quit: WeeChat 2.4)
17:45:49Zevvcan I create a macro that does nothing but returning a passed code block's NimNode AST so I can store that in a compiletime var?
17:46:25Zevv(given that this Ast is *not* valid Nim program code!)
17:46:37Zevvso I can't embed it into an anonymous proc, or something like that
17:46:41disruptekisn't that what `quote do` does?
17:46:54Zevvthat is what I thought as well
17:47:02Zevvbut then Nim tries to interpretet the block somehow as Nim code
17:47:33disruptekit just parses it; it doesn't invoke it.
17:47:50Zevvit does semchecks it seems: https://play.nim-lang.org/#ix=1Rka
17:47:51disruptekalso, it helpfully elides comments. 🙄
17:48:25disruptekwell, that's not nim.
17:48:50Zevvno it is not, but it is representable in Nim AST, right
17:49:14disruptekyes, but it's kinda a big ask to expect `quote do` to successfully parse a grammar it doesn't know, right?
17:49:37Zevvwhy? The nim compiler parsed it into a nimnode tree already?
17:52:08FromGitter<Vindaar> all fine: https://play.nim-lang.org/#ix=1Rkb
17:52:38Zevvwhat?!
17:53:08disruptekdo we need to quote it again?
17:53:59FromGitter<Vindaar> nah, sorry. that was copy & paste
17:54:14disruptekgood.
17:54:35Zevvpff i was mixing up two things, messing up
17:54:41FromGitter<Vindaar> i.e. this is fine https://play.nim-lang.org/#ix=1Rkk
17:54:55disruptekyep.
17:54:58ZevvI partly blame my kids to have stolen my laptop so im typing on my phone :/
17:55:23Zevvwell vindaar, that should definitely get me going. the compiletime var was my whole problem
17:56:04disruptekyeah, i think you're much closer to making this work than you think. the question is just how you want to handle symbol resolution.
17:56:16Zevvthis should work for me. I dont mind having one global pool for storing all grammars in, I can just make my own namespaces from there.
17:57:33disrupteklooking forward to it!
17:57:33ZevvIf I store grammars as nim ast and only transform to a parser at the last moment, I should be able to travers the global pool to find nimnodes defining the referenced rules, and just inject those nimnodes into the final grammar nimnode ast before doing the transformation
17:58:00Zevvgreat, thanks once more for hearing me ramble folks, always a pleasure!
17:58:19disruptekoh, so you won't even have `import` statements or any context passed by the user?
17:58:41Zevvthats details
17:59:22ZevvI probably want to do some kind of nested name spacing, but i guess one level would be enough. So if you import "uri" you just get all rules from the uri grammar available in your peg
17:59:43Zevvif i would later want to be more fine grained, that should be trivial
18:02:22FromGitter<Vindaar> hehe, good to hear. hope it works out :)
18:02:43disruptekyour chroma pr looks pretty good, btw, vindaar.
18:05:37FromGitter<Vindaar> thanks! :)
18:06:27FromGitter<Vindaar> I needed HCL support to reproduce the ggplot2 colors :D
18:08:10dom96Anyone else wishes `echo` followed `print`'s suit and added spaces in between arguments implicitly?
18:08:20disruptekah, always funny to see a pr that seems to quadruple the functionality of a lib. ;-)
18:09:00shashlickIt does bother me that `echo a, b` doesn't add spaces
18:09:09disruptekdom96: yes. but, i think i'd be satisfied if only the logging templates did that. it really bothers me there.
18:09:39Zevvvindaar: what exactly causes the different behaviour between your and my macro?
18:09:53ZevvMin returns the output of quote do, but yours returns the output of quote do
18:10:01FromGitter<mratsim> @Zevv I've stressed the {.compileTime.} pragma in all kind of ways while writing a compiler in Nim macros. It works fine.
18:10:19FromDiscord_<Kiloneie> Exercises on Exercism are labeled badly, all side ones but one are marked as EASY, i did reversing a string yesterday, took me an hour because im a slow learner, but it was easy like it was labeled. Today i went solving a "EASY" Run Length Encoder + Decoder(im close to finishing it now), and i spent a LOT more time on it and wrote a lot more code for it, it's definitely labeled wrong.
18:10:19FromDiscord_<Kiloneie>
18:10:19FromDiscord_<Kiloneie> How do i contact the right person to change this ?
18:10:30Zevvmratsim: cool, thanks
18:10:51FromGitter<mratsim> The main issue to be aware of is to not do in-place modification but assign the complete modified object
18:11:09FromGitter<mratsim> There are 2 bugs from the past 3 weeks on that
18:11:19Zevvhmm but could I have a seq ct var and add elements to it?
18:11:30Zevvor should I replace it with a new copy of a seq?
18:15:36Araqno, you need to add
18:15:46Araqand IC kinda relies on it, read the RFC... :P
18:16:07FromGitter<Vindaar> zevv: sorry, was afk. The problem with your code was simply that you never assigned to `myNode`
18:16:53Zevvyeah I was messing up, sorry. I have my computer back, should be better now :)
18:16:56*joki1337 quit ()
18:18:24FromGitter<Vindaar> nothing to apologize for ;)
18:19:54*nif quit (Quit: ...)
18:20:03*nif joined #nim
18:21:13FromGitter<zacharycarter> without any kind of shadow shader:
18:21:20FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/o7Mv/image.png)
18:22:04FromGitter<zacharycarter> it's actually a pleasant surprise that this renders - because I hadn't tried before
18:22:13FromGitter<zacharycarter> I had just been using a map with all flat tiles
18:22:58*nif quit (Client Quit)
18:23:07*nif joined #nim
18:23:48Zevvarghh. I just implemented peg libraries with 5 lines of code
18:38:33ZevvI'm too old to have my pride hurt. But it hurts my soul :(
18:39:15FromGitter<Vindaar> it just means it's an /elegant/ feature :) plus it's easy to maintain, hehe
18:39:22Zevvright :)
18:39:28FromGitter<zacharycarter> Zevv: are you into just PEGs or grammars in general?
18:39:45FromGitter<zacharycarter> because I built something from this whitepaper a few years ago -
18:39:51FromGitter<zacharycarter> https://pdfs.semanticscholar.org/ab05/4224e6c43f96f06ece41f336b7a5a070a4e3.pdf
18:39:52ZevvSo it was completely trivial. conclusion: my mistake was that I was trying to store intermediate grammars in consts, but needed ct vars
18:40:33Zevvzacharycarter: I miss any formal education on this stuff, but I have always been intrigued by grammars and parsers
18:40:50Zevvwow that's cool :)
18:41:31FromGitter<zacharycarter> yeah - they can be pretty powerful in the procgen world
18:41:31ZevvI saw a cool dungeon gen on HN the other day, let me look that up
18:41:50FromGitter<zacharycarter> I think I'm going to try to incorporate procgen elements into my RTS
18:42:10FromGitter<zacharycarter> so I might use some sort of grammar for rules around different types of scenarios
18:42:39Zevvsounds like a fun project you're doing there :)
18:42:57FromGitter<zacharycarter> well - I have a game designer from work working with me on the concept for the game
18:43:14FromGitter<zacharycarter> we want to blend MOBA and RTS - so we're thinking about a RTS where the macro is much simpler but the micro is more complex]
18:43:20FromGitter<zacharycarter> and also oriented towards team play
18:43:41FromGitter<zacharycarter> you won't have to produce units - they'll be auto-produced but you still need to build buildings
18:43:51FromDiscord_<Kiloneie> like red alert 3 where that didn't work ?
18:44:09FromGitter<zacharycarter> I'm not making red alert 3
18:44:26FromDiscord_<Kiloneie> just don't try giving EVERY unit a special ability
18:44:35FromGitter<zacharycarter> and fyi red alert 3 has 9/10 rating on steam
18:44:51FromDiscord_<Shield> good to see somebody working on an rts, I have a lot of questions about those
18:45:01FromDiscord_<Kiloneie> yeh.... that's why NOBODY cares about it and everybody prefers red alert 2
18:45:03FromGitter<zacharycarter> but no - you'll mostly control your hero character
18:45:09krux02auto production of units reminds of of the game: Z
18:45:32FromGitter<zacharycarter> the auto generated forces will be controlled by a dumb AI
18:45:35FromDiscord_<Kiloneie> also wehich rating, meta or users ? recent or overall ?
18:45:43FromGitter<zacharycarter> I don't know - I just looked at google
18:45:53krux02but that was no buildings, just capturing of zones. The buildings the captured zones belong to you, and the more zones you have the faster you produce units.
18:46:05FromGitter<zacharycarter> but you'll build buildings to upgrade units as well as give your hero powers
18:46:10Zevvzacharycarter: do you have any concept art?
18:46:13FromGitter<zacharycarter> and if someone destroys a building - your hero loses that power
18:46:30krux02That game was a fast paced RTS, if you didn't play offensive and captured all sones you could as fast as possible you loose.
18:46:42FromGitter<zacharycarter> nah - I don't have any artist friends that I've convinced to work on the game yet with us, I want to get further along in developing the game before I try to recruit some
18:46:51FromGitter<zacharycarter> but it's good that I work at a game company now - it should be much easier :(
18:46:53Zevv:)
18:46:54FromGitter<zacharycarter> err :)
18:47:18FromGitter<zacharycarter> also - we want to have synergies between heroes and make hero roster construction important
18:47:27FromGitter<zacharycarter> but ultimately - every hero will be able to choose what skills they take
18:47:30krux02well, what I know about game companies is that you probably do so much crush that you have 0 time left for your own project.
18:47:33FromGitter<zacharycarter> I'm not having some artist create 1000 hero models
18:47:42FromGitter<zacharycarter> not in Finland :)
18:47:48FromGitter<zacharycarter> pretty strict labor laws here
18:47:57krux02cool
18:48:13krux02we have labor laws as well here in Germany.
18:48:20FromDiscord_<Shield> how do you handle pathfinding? are you using simple A* or flow field? how does you do unit positioning and obstacle avoidance? what's your multithreading model? how do you handle networking?
18:48:59FromGitter<zacharycarter> I haven't gotten that far but I'll probably do some sort of navigation grid - I'm sure A* will be a part of it as well as djikstra
18:49:12FromGitter<zacharycarter> I don't do multithreading
18:49:34FromGitter<zacharycarter> I don't do networking (yet) - I'm not sure what I'm going to do there, I haven't thought about it enough yet
18:49:55FromGitter<zacharycarter> but I'll be reading a lot of gafferon games
18:50:01FromDiscord_<Shield> out of all those things, networking feels the hardest, most rts use simulation with fixed time steps and other black magic that requires a whole change of the structure, there's also problems with float point accuracy...etc
18:50:17FromGitter<zacharycarter> yeah
18:50:33FromGitter<zacharycarter> well - I haven't worked on the simulation part of the game much yet
18:50:38FromGitter<zacharycarter> I'm focusing on map generation / editing first
18:51:10FromGitter<zacharycarter> since that's pretty unlikely to need to need changes once it's implemented
18:51:27FromGitter<zacharycarter> also I need to work on skeletal animation and sounds - lots of plumbing work basically
18:52:05FromGitter<zacharycarter> I'll probably try and use soloud for audio
18:52:06FromDiscord_<Shield> https://www.youtube.com/watch?v=bovlsENv1g4
18:52:55FromDiscord_<Shield> I honestly don't know how to handle different unit size with A*
18:53:00FromDiscord_<tomku> re: crunch in game dev - varies wildly between companies
18:53:43FromGitter<zacharycarter> well - I don't think you do unless you have include it as some sort of heuristic and even then it's not likely to produce reliable results
18:53:45krux02tomku: If you go AAA in the US, then crunch is basically everywhere.
18:53:48FromDiscord_<tomku> game i'm working on enters steam early access in a month and I'm already preparing for a grind
18:54:04FromDiscord_<tomku> but that's expected
18:54:06FromDiscord_<Shield> the problem with multiplayer rts is that the simulation needs to be deterministic, if your army movement depends on how fast your machine are, it will be bad
18:54:11krux02tomku: what game are you working on?
18:54:13FromGitter<zacharycarter> I've been in Finland at Wargaming since May - and I've had two weeks where I felt like I wasn't getting enough sleep
18:54:27FromDiscord_<tomku> @krux02: last oasis
18:54:32FromGitter<zacharycarter> Shield: yup - that's why most games used deterministic lockstep
18:54:38FromGitter<zacharycarter> tomku: want to hook me up with a key :P
18:54:38FromGitter<zacharycarter> ?
18:54:43FromGitter<zacharycarter> I'm in your discord
18:55:20FromGitter<zacharycarter> I'm just joking btw - I'm sure there are fans more deserving of a key than I am
18:55:22FromDiscord_<tomku> i know we entered new beta last week, did you sign up?
18:55:22krux02I am just watching the trailler now, last oasis does look interesting
18:55:32FromGitter<zacharycarter> I don't think so - I'll go do that
18:55:54FromDiscord_<tomku> but that's boring large project in UE4, let's talk nim stuff
18:56:24clyybbernim in ue4 :p
18:56:29krux02looks like the structures from Theo Jansen
18:56:47FromGitter<zacharycarter> kind of sad the Nim UE4 stuff died
18:56:55clyybberoh there was something?
18:56:59FromGitter<zacharycarter> yeah
18:57:06clyybberShouldn't be too hard to revive it, right?
18:57:06FromGitter<zacharycarter> https://github.com/pragmagic/nimue4
18:57:24FromGitter<zacharycarter> I just don't want to use UE4 - but I think there were limitations that made the author want to switch to godot
18:57:28FromDiscord_<Shield> a lot of nim stuff dies and language changes don't help
18:57:36clyybberAh, endragor also did the godot bindings
18:57:55FromDiscord_<tomku> i got godot-nim to work with latest nim, looks pretty cool
18:58:03FromGitter<zacharycarter> I'm very meh about godot
18:58:08clyybbertomku: Do you have your fork up?
18:58:20clyybberzacharycarter: I guess its because of the OO?
18:58:34clyybberBecause thats the only thing that really bothers me about godot
18:58:34FromGitter<zacharycarter> clyybber: you mean the UE4 limitations wiith Nim?
18:58:38FromGitter<zacharycarter> oh
18:58:38FromGitter<zacharycarter> godot
18:58:42clyybberYeah
18:58:46FromDiscord_<tomku> clybber: i used other people forks for both the bindings and the sutb
18:58:54clyybbertomku: Ah, ok
18:59:03FromGitter<zacharycarter> there are several things that bother me about it, but OO i sone
18:59:12FromGitter<zacharycarter> also - I'm still waiting for a 3d game built with godot to come out
18:59:16FromDiscord_<tomku> the latest opened issue on github has all the info
18:59:37clyybberzacharycarter: I made a small online shooter with my friends
18:59:46krux02@tomku: do you give credit to Theo Jansen in the game?
18:59:49clyybberthe online rpc interface is really cool
18:59:56FromDiscord_<Shield> there is a 3d game out, but it's nothing fancy
19:00:24clyybberI couldn't figure out any way on how to do reverse kinematics though
19:00:25FromGitter<zacharycarter> I'd rather just use Unity over Godot
19:00:32FromGitter<Varriount> Does anyone have a more thorough explanation of what this phrase means in Nim's destructors plan: "Objects that contain pointers that point to the same object are not supported by Nim's model. Otherwise swapped objects would end up in an inconsistent stat"?
19:00:32FromGitter<zacharycarter> if I was going to use a pre-made engine
19:00:57FromGitter<zacharycarter> making a game engine these days is pretty simple though
19:01:08FromGitter<zacharycarter> it's mostly just cobbling together libraries to use to create different subsystems
19:01:09FromDiscord_<tomku> krux02: you'd better off asking on the official discord, but im pretty sure we do acknowledge the inspiration
19:01:09clyybberVarriount: It means an object P containing and pointer to itself is not supported
19:01:48clyybberzacharycarter: Yeah, I also like to make my own engine, mainly because I don't need a fancy editor for proc gen
19:01:51krux02tomku: If they have an IRC bridge, then I might do that :P
19:01:52*joshbaptiste quit (Ping timeout: 276 seconds)
19:01:59FromGitter<zacharycarter> editors are super annoying
19:02:20FromGitter<zacharycarter> my #1 main beef with UE4 / Unity / Godot - is having to learn how to use them
19:02:25FromGitter<zacharycarter> it's super annoying
19:02:33krux02Well, I like editors, but they must be specialized for the game.
19:02:40FromDiscord_<tomku> clyybber: well I guess I'm your IRC bridge in a sense, then 😉
19:02:42FromGitter<zacharycarter> yes - like the map editor I'm buidling
19:03:01FromDiscord_<tomku> any nim exercism mentors around
19:03:04FromDiscord_<tomku> ?
19:03:05FromDiscord_<Shield> lol I've wasted more than a week trying to figure out IK with constraints but apparently they're expensive and most engines do 2 bones IK with either positive or negative rotation only
19:03:13clyybbertomku: Huh, wdym?
19:03:25krux02I never had fun in general purpose game editors, but building maps in Age of Empires 1 was very fun. Also making games for Jetpack.
19:03:35krux02making levels for Jetpack
19:03:55clyybberkrux02: You came from scala right?
19:04:28clyybberDo you know if theres an up to date way to generate the equivalent of a public static field?
19:04:55*sschwarzer joined #nim
19:05:23clyybberI found a commit that introduced @static in 2012, but it seems that got reverted
19:05:34FromDiscord_<tomku> @clyybber sorry, was meant to tag krux02
19:05:43clyybbertomku: Ah, ok :D
19:06:24krux02clyybber: public static does not exist in scala, you have to put the things in the companion object.
19:06:41krux02The companion object is like if you put values to the type
19:06:48krux02you can do something like that in nim as well
19:07:24sschwarzerHi everyone. I have my Nim files in a `src` subdirectory and a `config.nims` in the project directory (the parent directory of `src`). By default, when compiling my main file under `src/vppdiff.nim`, the binary is placed there as well. How can I put the binary in the project directory? I tried `--outdir:..` in the `config.nims` file, but this gives me `Error: undeclared identifier: ':..'`
19:07:29krux02template typeProperty(_: typedesc[MyObjectType]): string = "MyValue"
19:07:40clyybberkrux02: I know, sadly I have an annotation that requires a static field. https://github.com/scala/scala/pull/894 this one implemented it.
19:08:09clyybberFor know I'm just resorting to a seperate java file and import that from scala
19:08:20sschwarzerOr is it not reocmmended to put the binaries in the project directory?
19:10:38krux02clyyber, well this is the Nim chat. I could help you to bring stuff from scala over to Nim, but I don't think that I can help you in scala. The scala thet I worked in was Scala 2.7 2.8 2.9 that think you are reffering to came into scala when I already moved on.
19:12:16krux02but I think scala java interop is really great on the scala side of things, so putting things as a java file and then just use it is a good thing.
19:12:19clyybberAh, ok. Thank you anyways :)
19:12:30clyybberkrux02: Yeah thats really cool
19:13:25krux02I think you shouldn't have cycling java scala dependencies though. I don't know if they support it, but it sounds to be like you are begging for something to break.
19:18:31krux02sschwarzer, how do you call the compiler?
19:19:10sschwarzerkrux02: nim c src/vppdiff.nim
19:19:42sschwarzerI can compile if I leave out the `outdir` option, but then I get the binary in the `src` folder.
19:19:53krux02well you can move the binary with ``mv``
19:19:59krux02(bash command)
19:20:35krux02that is how the nim compiler is build as well. It is build in the source directory, and then when everything goes well, it is put in the bin folder, but only then.
19:20:52krux02sschwarzer, yes
19:21:07sschwarzerkrux02: I was hoping to have `nim` doing this after compiling. Or can I put the `mv` somehow in `config.nims`?
19:21:08krux02leave out the output opiton, and then simply move the file. THat is how I would do it.
19:21:21krux02nope you can't
19:21:29krux02if you use nimble, maybe you can.
19:21:54krux02nimble as a task system. there you can specify tasts to do after the build has been completed.
19:22:05sschwarzerkrux02: With `bin` folder, you mean the folder where the binary is placed, although this happens to be the source folder as well? (just asking for clarification)
19:22:40krux02with bin bin folder I mean a folder where you would like the binary to be placed.
19:22:53krux02but maybe it is better if you use nimble with default settings.
19:23:09sschwarzerkrux02: I'll look into Nimble at some later time, I guess. I'm still not very acquainted with the language (although I like it :) )
19:23:10krux02build your project with nimble. then call nimble install and see what happens
19:23:38sschwarzerkrux02: Ok, so I understood you regarding the "bin folder"
19:23:45krux02nimble puts links to executables that you build into $HOME/.nimble/bin
19:24:19krux02with bin folder I mean the folder where you eventuall want to have the binary.
19:24:26krux02the executable.
19:24:40krux02it doesn't need to be called bin though. You can call it whatever you want.
19:24:55sschwarzerkrux02: I guess I'll do this later (like in days or weeks later :) ). For now, for development, it's good enough for me to have the binary in the `src` folder. I was just wondering if I could place it in the parent dir.
19:25:22sschwarzerI mean place it there easily.
19:28:05*joshbaptiste joined #nim
19:28:14sschwarzerkrux02: Thanks anyway :)
19:28:31krux02np
19:28:39sschwarzerYes, I'll look into Nimble at some point. :-)
19:31:17Araq--outdir: ".." ?
19:31:40AraqI mean, it's not like you can forget about Nim's syntax in a *Nim*script config file, duh.
19:33:39sschwarzerAraq: Hi, welcome back :)
19:34:16sschwarzerAraq: `--outdir: ".."` in the `config.nims` file creates a folder `".."` and puts the binary there :-D
19:34:55Araqswitch("outdir", "..") # maybe like this then
19:35:35*HP-YC9 quit (Remote host closed the connection)
19:36:15*HP-YC9 joined #nim
19:36:54sschwarzerAraq: no, doesn't work ...
19:36:56sschwarzer/usr/bin/ld: cannot open output file /home/schwa/sd/nim/vppdiff: Is a directory
19:36:56sschwarzercollect2: error: ld returned 1 exit status
19:36:57sschwarzerError: execution of an external program failed: 'gcc
19:37:00sschwarzer...
19:37:04Araqclyybber: in the new spec f_sink(g()) is converted to f_sink(g())
19:37:08*joshbaptiste quit (Ping timeout: 244 seconds)
19:37:54Araqdoes that make sense? no need to use a temporary since sink parameters are destroyed in 'f' and there is no location to unset for 'g()'
19:38:57FromGitter<Vindaar> sschwarzer: that error happens, because the nim file you compile is called "vppdiff.nim" and the directory it is in "vppdiff". So gcc crashes when trying to create a binary in a directory, with a folder named "vppdiff"
19:41:23sschwarzerVindaar: Ok, that makes sense. But what I wanted is to put the binary (named `vppdiff`) in the current directory (called `vppdiff`, but shouldn't matter), parallel to the `src` directory. So the path of the binary would be `sd/nim/vppdiff/vppdiff`.
19:42:45FromGitter<Vindaar> then either define `--outdir:"."` (not sure if that works), or simply compile with `nim c --out:vppdiff src/vppdiff`
19:42:46sschwarzerVindaar: the Nim file is `sd/nim/vppdiff/src/vppdiff.nim`
19:44:26sschwarzerVindaar: The combination of Araq's tip and yours worked: `switch("outdir", ".")`
19:44:33sschwarzerThanks for your help!
19:45:09FromGitter<Vindaar> no worries!
19:45:12sschwarzerI had tried `..` instead of `.` because I thought, the directory should be relative to the source file.
19:45:41clyybberAraq: Yeah, makes sense
19:46:10Araqok, then the spec is almost ready
19:46:22clyybberNice, do you have it up somewhere?
19:46:25Araqit's not much more complex than before
19:46:31Araqjust different.
19:46:32sschwarzerFor the record, I also changed `--threads:on` to `switch("threads", "on")` for consistency
19:48:47sschwarzerSo the information about using `--option...` as a convenience for `switch(...)` potentially is somewhat confusing. I read this here: https://nim-lang.org/docs/nims.html , section "NimScript as a configuration file"
19:49:09sschwarzerI mean I read there about the "convenience"
19:50:04clyybberAraq: Did you incorporate that =sink will have no self-assign check and also no =destroy call?
19:50:27Araqthe =destroy call is still in there
19:50:48Araqand I don't intend to change it for v1
19:50:50clyybberOk
19:51:04sschwarzerI had seen `--threads:on` in some `config.nims` somewhere and had wrongly assumed that `--outdir:.` would work as well.
19:51:17clyybberIts fine I guess. Perhaps there are cases where some controle over that `=destroy` call is wanted
19:57:31Araqclyybber: it's here https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst
19:57:59Araqand I'll remove the wiki page
19:58:41Araqand if you enjoy it, mark in the source code the rewrite rules
20:03:43clyybberAraq: Cool, btw can I remove this branch: https://github.com/nim-lang/Nim/blob/devel/compiler/injectdestructors.nim#L220 or does it contain something for the future?
20:04:29Araqfine with me
20:05:27Araqso ... what was the bug?
20:05:58*joshbaptiste joined #nim
20:06:42*NimBot joined #nim
20:08:46*jokul left #nim ("http://quassel-irc.org - Chat comfortably. Anywhere.")
20:09:10sschwarzerI just found out that `xmltree.items` doesn't work recursively ;-)
20:10:25sschwarzerSo there doesn't seem to be a way to recurse over all nodes if I don't care about the name (or rather only in the loop body). `xmltree` documentation is here: https://nim-lang.github.io/Nim/xmltree.html
20:11:09sschwarzerBut if I didn't overlook something, I can write the recursion myself as in `findAll`, but without the tag comparison.
20:13:51disrupteksschwarzer: sure.
20:14:19sschwarzerI think the documentation for `items` and `mitems` is a bit vague here ("Iterates over any child of n.")
20:14:32clyybberAraq: p() didn't have a case for nkBracket
20:15:13disrupteksschwarzer: convention is that `items` yields immutable values while `mitems` values are mutable.
20:16:09sschwarzerdisruptek: That's not my point. :) My point is that I thought that `items` and `mitems` both recurse down into the tree, but they don't. :)
20:16:16Araqclyybber: there is some unhealthy code duplication going on here
20:16:42disrupteki agree it should be improved. easy enough to submit a pr via github! :-)
20:17:00clyybberAraq: Yeah, the 3 way mutual recursion is really something rare
20:17:09clyybbers/rare/special
20:17:13sschwarzerdisruptek: a PR for the documentation or a PR for improved code? :-)
20:17:37*ljoonal joined #nim
20:17:55sschwarzerdisruptek: Of course, for the code change we would probably need a flag (?) to remain backward-compatible?
20:18:09disrupteksschwarzer: for the docs, at a minimum (it can be done via the web ui). i am wondering if we don't already have a treewalking generic that we could reference (or repurpose) for this. we have several tree types in stdlib...
20:18:28disrupteki wouldn't change the code; it's too breaky.
20:19:19sschwarzerdisruptek: It would be really helpful if this (recursing) would be possible without writing the recursion yourself. Of course it's easy, but my intuition is that this should be supported by the standard library.
20:19:36disruptekshould probably just come up with a simple api for walk() and then add it to xml, json, critbits, etc.
20:20:22disruptekiirc, we have a walk() for filesystem objects; maybe you can replicate that api for consistency?
20:20:31sschwarzerdisruptek: Sounds good, at least for the moment. Also I agree it's nice if different tree-like structures behave consistently.
20:21:14sschwarzerBy the way, I'm starting to lose track of the things I want to contribute to Nim. :-D
20:21:18disruptekgotta put some meat on the bone to make a stdlib patch worthwhile. ;-)
20:21:42*joshbaptiste quit (Ping timeout: 245 seconds)
20:22:19sschwarzerdisruptek: Do you mean me or you here?
20:22:24*joshbaptiste joined #nim
20:23:30disrupteki can do it if you don't wanna, but, maybe run it up the flagpool and see who salutes. i think it should be accepted pretty readily if it touches 3+ modules.
20:24:40clyybberAraq: I have the PR up, looking at the spec now.
20:25:42sschwarzerdisruptek: I would like to, but it's unrealistic for me to get this done anytime soon. :-( I have another (own) open source project to take care of, I need to prepare a talk for PyCon DE and I'm still in the beginnings of working with Nim.
20:26:33disruptekmake an issue and if people want it, i will author the pr. fair? ;-)
20:26:41sschwarzerdisruptek: Regarding Nim improvements, my first goal is to make sure that `osproc.waitForExit` doesn't deadlock.
20:27:31sschwarzerdisruptek: Yes, sounds fair. I hope I'll be able to do it tomorrow. I want to go to bed now, and I'm traveling tomorrow.
20:27:48disruptekaight, i will keep an eye out. gn
20:27:54clyybbergn8
20:28:00sschwarzerdisruptek: thanks! :)
20:28:09*sschwarzer quit (Quit: leaving)
20:30:01clyybberAraq: That branch I removed is a duplicate
20:30:09Araqhow so?
20:30:21clyybberA few lines above it is repeated
20:30:31clyybberSo it is dead duplicated code.
20:30:51Araqah indeed
20:31:03Araqok then
20:31:50clyybberAh, maybe I should add a test case
20:31:54Araqwe don't implement (self-assignment-removal) yet, but there is an open issue for it :P
20:33:13Araqbtw if you fear Nim is turning into C++, all it takes is to look at https://en.cppreference.com/w/cpp/language/lifetime#Access_outside_of_lifetime
20:33:28Araqand we're really far, far away from this complexity :P
20:38:11*joshbaptiste quit (Ping timeout: 268 seconds)
20:47:02clyybberUgh, looks like the fix is causing leaks in other tests..
20:49:21Araqer, why not run 'tt destructor' on your local machine?
20:49:44AraqI can't develop without it, feedback cycle via the CIs is much too slow
20:50:02clyybberAraq: I just did it. Thats how I figured it out
20:50:11Araqah ok
20:50:17clyybberBut I used ./koch test c destructor, which was a mistake
20:50:30clyybbersince that takes ages
20:50:53clyybberwould be cool if we could make the tester use nim_temp
20:54:26clyybberAraq: Is nkBracket always an array constructor?
20:54:44Araqyes.
20:55:00Araqyou can run testament/tester --nimexe:nim_temp cat destructor
20:55:09Araqor something along these lines
20:55:11clyybberAh, thanks
20:55:56*HP-YC9 quit (Remote host closed the connection)
20:56:28*HP-YC9 joined #nim
20:57:46*HP-YC9 quit (Remote host closed the connection)
21:00:36*HP-YC9 joined #nim
21:00:51FromDiscord_<Kiloneie> Why does Nim in VS Code only shows procedures imported from a module after i use them once ? Is it because once i use a proc it does a hidden import on it or... ? I don't get autocomplete the first time.
21:01:17*HP-YC9 quit (Remote host closed the connection)
21:01:30FromDiscord_<Kiloneie> Like i import strutils, call variable.isAlphaAscii(), no autocomplete, only the second time
21:02:13*Vladar quit (Remote host closed the connection)
21:02:18Araqchange the plugin setup
21:02:22Araqgood night.
21:02:28clyybbergn8
21:03:32*HP-YC9 joined #nim
21:13:57*HP-YC9 quit (Remote host closed the connection)
21:15:18FromDiscord_<Kiloneie> In the preference i see nothing of the sorts that helps with imports... idk
21:18:27*HP-YC9 joined #nim
21:18:47*HP-YC9 quit (Remote host closed the connection)
21:19:53*joshbaptiste joined #nim
21:21:33*HP-YC9 joined #nim
21:22:11*clyybber quit (Quit: WeeChat 2.5)
21:24:01FromDiscord_<Kiloneie> I don't understand why Case statement doesn't work this way:
21:24:01FromDiscord_<Kiloneie> https://play.nim-lang.org/#ix=1Rlq
21:26:17FromDiscord_<Kiloneie> Thought maybe this would work: https://play.nim-lang.org/#ix=1Rls
21:26:18FromDiscord_<Kiloneie> I don't get it.
21:29:15solitudesfthats not whatr case statement does. you're supposed to use plain ifs for that
21:29:57FromDiscord_<Kiloneie> Okay, so what is the purpose of case then ?
21:30:19solitudesfto perform action based on a variable's value?
21:31:18FromDiscord_<Kiloneie> isn't that what im trying to do with it ? INstead of writing a bunch of IF statements i thought a single case with the same number of OFs would do the trick. Idk
21:32:46solitudesfno, you're not matching on values
21:33:02solitudesfyou just check arbitrary conditions, that what if does
21:33:35solitudesfthats how it works in every language, you can read any programming manual
21:33:48*joshbaptiste quit (Ping timeout: 245 seconds)
21:34:16FromDiscord_<Kiloneie> Woops, i guess my memory is foggy on that, my bad xD, it's been years since i coded for a week straight
21:36:01disruptekyour if/else ladder is testing for boolean results of expressions while your case is testing for identity between the case X variable and the of Y, Y, Y constants.
21:36:49FromDiscord_<Kiloneie> Yeah, i get that now.
21:37:26FromDiscord_<Kiloneie> Im rushing trough things trying to get things done, and fail to understand some things.
21:38:49disruptekcase statements are great because they can help prevent oversight when conditions change.
21:39:22disruptekit's all part of the correct-by-construction mantra.
21:45:40*solitudesf quit (Ping timeout: 276 seconds)
22:03:51*joshbaptiste joined #nim
22:07:33*Jesin quit (Read error: Connection reset by peer)
22:09:02*joshbaptiste quit (Ping timeout: 244 seconds)
22:10:31*steshaw_ joined #nim
22:10:50*steshaw_ quit (Client Quit)
22:11:20*steshaw joined #nim
22:13:31FromDiscord_<Kiloneie> Do you guys find any of the exercises on Exercism Nim Track difficult or time consuming ?
22:34:23*joshbaptiste joined #nim
22:34:44FromGitter<Varriount> Anyone read any interesting CS papers recently?
22:41:23*shomodj joined #nim
23:16:19*krux02_ joined #nim
23:18:41*krux02 quit (Ping timeout: 250 seconds)
23:19:20*Jesin joined #nim
23:31:11*sagax quit (Ping timeout: 244 seconds)
23:31:24*sagax joined #nim
23:42:21*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:43:55FromDiscord_<Kiloneie> Man i suck, look how long of a code i wrote vs what someone else wrote xD...
23:43:55FromDiscord_<Kiloneie> MINE: https://exercism.io/my/solutions/e1e97e1bb04e40c7947f65608e1535ef
23:43:55FromDiscord_<Kiloneie> Someone else's: https://exercism.io/tracks/nim/exercises/run-length-encoding/solutions/cf672220e5684ef78a5392cf720ba824
23:45:38FromDiscord_<Kiloneie> Sorry you can't see mine, here: https://play.nim-lang.org/#ix=1Rmk