00:00:01 | * | junland quit (Quit: %ZNC Disconnected%) |
00:03:42 | * | junland joined #nim |
00:13:43 | FromDiscord_ | <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:33 | FromDiscord_ | <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:41 | FromGitter | <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:13 | FromGitter | <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:45 | FromGitter | <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:31 | rayman22201 | @bevo009 https://play.nim-lang.org/#ix=1RhG |
05:17:25 | * | nif quit (Quit: ...) |
05:17:35 | * | nif joined #nim |
05:24:54 | FromGitter | <bevo009> That's interesting. Is it documented anywhere? |
05:25:07 | FromGitter | <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:08 | rayman22201 | It is idiomic. Documented under closures perhaps? |
05:42:21 | * | solitudesf joined #nim |
05:53:31 | FromGitter | <zacharycarter> so there's no way to get a typedesc back from a NimNode after passing a typedesc to a macro - correc? |
05:53:35 | FromGitter | <zacharycarter> correct* |
05:56:01 | * | joshbaptiste joined #nim |
05:58:12 | FromGitter | <zacharycarter> actually I think I have another way of doing what I need to do so disregard my last qusetion |
06:00:02 | FromDiscord_ | <Shield> what are you working on @zacharycarter? |
06:00:22 | FromGitter | <zacharycarter> still working on that macro for NimScript |
06:00:45 | * | endragor joined #nim |
06:01:09 | FromGitter | <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:11 | FromDiscord_ | <Shield> use nimscript as a scripting language? or to replace hcr? |
06:01:48 | FromGitter | <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:07 | FromGitter | <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:20 | FromGitter | <zacharycarter> the macro I'm working on basically eases passing complex object b/w NimScript and Nim |
06:02:55 | FromGitter | <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:05 | FromDiscord_ | <Shield> cool, hcr sounds great but I didn't have long compile times past the initial compiling |
06:10:14 | FromDiscord_ | <Shield> yet |
06:11:42 | FromGitter | <zacharycarter> once incremental compiling is done it may make HCR etc kind of pointless |
06:11:58 | FromGitter | <zacharycarter> but I still think games present a special case where you can need to reload code, art assets, shaders, etc |
06:12:10 | FromGitter | <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:15 | FromGitter | <zacharycarter> is it possible to have a gathers all of the fields of an object which are also objects? |
07:30:33 | FromGitter | <zacharycarter> I am trying to write a recursive procedure which calls a macro to do this - but I'm struggling |
07:39:23 | FromGitter | <mratsim> Something like this? https://github.com/mratsim/Arraymancer/blob/master/src/nn/optimizers/optimizers.nim#L74-L80 |
07:41:37 | FromGitter | <zacharycarter> thanks - let me give that a go |
07:42:20 | FromGitter | <mratsim> basically when iterating with fields, you can use when foo is object for recursive expansion |
07:43:08 | FromGitter | <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:32 | FromGitter | <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:39 | FromGitter | <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:30 | FromGitter | <zacharycarter> even though I recurse before I generate the procs for the actual type |
08:16:34 | FromGitter | <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:47 | shashlick | @mratsim - just saw this https://github.com/Qthreads/qthreads |
08:48:49 | FromGitter | <mratsim> yes I know about it, didn’t delve too much though |
08:49:18 | FromGitter | <mratsim> I like the lab report on parallel runtime they did in 2013 |
08:49:53 | FromGitter | <mratsim> https://prod-ng.sandia.gov/techlib-noauth/access-control.cgi/2012/1210594.pdf |
08:52:19 | FromGitter | <mratsim> There are so many libraries and papers and so little time to do actual code though :/ |
08:52:26 | FromGitter | <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:37 | FromGitter | <zacharycarter> but I still get - Error: undeclared identifier: 'getBar' |
08:52:47 | FromGitter | <zacharycarter> maybe I need to generate a forward declaration? |
08:53:07 | FromGitter | <mratsim> maybe bind or bindSym”getBar" |
08:53:18 | FromGitter | <mratsim> instead of just ident”getBar" |
08:53:19 | FromGitter | <zacharycarter> hmm let me try that - good idea |
09:05:41 | * | nsf joined #nim |
09:06:22 | FromGitter | <zacharycarter> neither seem to work :/ |
09:07:44 | FromGitter | <zacharycarter> oh well - maybe there's a different way to go about this |
09:17:05 | shashlick | Do you need code reordering |
09:17:15 | FromGitter | <zacharycarter> oooo |
09:17:16 | FromGitter | <zacharycarter> maybe |
09:22:03 | FromGitter | <zacharycarter> didn't help either |
09:22:04 | FromGitter | <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:50 | FromDiscord_ | <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:05 | FromGitter | <Vindaar> @zacharycarter did you figure it out? |
10:43:23 | FromGitter | <zacharycarter> no - taking a break from it and just working on my game for a bit |
10:43:42 | FromGitter | <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:55 | FromGitter | <Vindaar> ah, ok! |
10:49:49 | FromDiscord_ | <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:06 | lqdev[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:29 | Araq | ping clyybber |
11:48:31 | clyybber | Araq: Hi |
11:48:41 | Araq | did you find new problems? |
11:48:58 | clyybber | Araq: Nope. But I have an idea for an optimization |
11:49:08 | clyybber | A very simple one |
11:49:14 | Araq | hah, me too |
11:49:30 | Araq | move destructors into after "last usage of 'x'" |
11:49:50 | Araq | and then let 'wasMoved(x); =destroy(x)' cancel each other out |
11:50:15 | clyybber | Araq: Yay |
11:50:36 | clyybber | I think thats basically the branch based approach if I understand you correctly |
11:50:48 | Araq | =sink looks better and better. |
11:50:52 | Araq | ;-) |
11:51:53 | * | laaron quit (Remote host closed the connection) |
11:53:00 | Araq | but if we want to optimize, we should write an optimizer, it doesn't affect the spec much. |
11:54:17 | clyybber | Btw, 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:04 | clyybber | Because it causes wasMoved(x) to be applied before x gets assigned to select(...) |
11:55:58 | clyybber | My 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:22 | clyybber | So we transform: x = select(true, x, y) |
11:56:41 | clyybber | to: let tmp = select(true, x, y) |
11:56:50 | clyybber | wasMoved(x); wasMoved(y) |
11:56:57 | clyybber | x = tmp |
11:57:00 | * | laaron quit (Remote host closed the connection) |
11:57:33 | clyybber | Its a very minor optimization, but it depends on the number of sink arguments involved. |
11:57:35 | Araq | that's worse because missing NRVO |
11:58:03 | Araq | x = f(...) is often turned into 'f(..., x)' # construct inplace |
11:58:37 | Araq | er... doubt it's called NRVO but you get the idea. |
11:59:36 | Araq | also, usually you pass a construction to a sink parameter |
11:59:59 | Araq | and then we don't generate wasMoved anyway. |
12:01:55 | Araq | however there is bug https://github.com/nim-lang/Nim/issues/11833 which means we generate too few 'wasMoved' :P |
12:02:24 | Araq | and 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:23 | clyybber | Araq: 11833 happens because in injectdestructors:504 isSinkTypeForParam is false. |
12:41:51 | Araq | well system.`@` doesn't use 'sink' |
12:42:11 | Araq | which means worse codegen, but it should still be correct |
12:42:21 | clyybber | Yeah, thats what buffles me too |
12:42:26 | clyybber | It should still not crash |
12:42:32 | Araq | yup |
13:02:38 | dom96 | Araq, easy merge? https://github.com/nim-lang/Nim/pull/11879 |
13:04:51 | Araq | dom96: no. I don't understand it completely |
13:06:10 | dom96 | It's similar to how this was fixed: https://github.com/nim-lang/Nim/issues/8484 |
13:07:02 | Araq | what's special about nkVarTy, nkBracketExpr? nothing |
13:07:29 | * | shomodj joined #nim |
13:08:29 | Araq | so this patch is at best incomplete |
13:08:47 | Araq | and most likely the fix for nkVarTy was wrong too |
13:08:47 | dom96 | The problem is that I can't call hasCustomPragma on a field that is `Point[float]` for example |
13:09:00 | dom96 | Not sure why I can't reproduce it though |
13:09:10 | Araq | so? 'ref Point' is also affected then |
13:09:16 | Araq | (that would be nkRefTy) |
13:09:31 | dom96 | That's possible |
13:10:12 | dom96 | It's likely that this is incomplete, but at least it fixes the problem I am having |
13:10:36 | dom96 | (and Vindaar too by the looks of it) |
13:11:22 | Araq | hmm, I remember this patch differently |
13:11:29 | FromGitter | <Vindaar> yes. Although for me personally it was only a blocker for that `doNotSerialize` PR |
13:11:42 | Araq | please rebase, mark it with 'XXX look into this further' |
13:11:51 | Araq | and if it's green, I shall merge it |
13:11:56 | dom96 | yeah, that's exactly what I'm trying to implement in my own serialization library |
13:12:01 | Araq | but as I said, it's incomplete. |
13:12:42 | Araq | krux02 also rewrote customPragmaNode but I don't know what happened with the PR |
13:13:23 | krux02 | I looked at the PR recently |
13:13:44 | krux02 | I think there was only something minor holding it back and then I forgot about it. |
13:13:55 | krux02 | I should probably finish it. |
13:14:38 | krux02 | it does split the functionality a bit nicer into procedures, and most importantly, it provides an api that takes NimNode (use from macros) |
13:17:06 | dom96 | krux02, if you do finish it CC me in the PR (and possibly here) so that I can test it with my code |
13:17:19 | krux02 | ok |
13:17:21 | dom96 | anyway, I updated my PR |
13:24:03 | * | laaron quit (Remote host closed the connection) |
13:28:01 | * | laaron joined #nim |
13:29:00 | krux02 | dom96: this is my PR: https://github.com/nim-lang/Nim/pull/11526 |
13:29:11 | krux02 | it is ready to be tested |
13:29:57 | krux02 | it 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:01 | dom96 | krux02, commented with a stack trace that I get |
13:34:11 | krux02 | ok |
13:34:12 | dom96 | very odd |
13:34:48 | krux02 | can you also post a code to use the serializer? |
13:34:55 | dom96 | afraid not |
13:34:56 | krux02 | I would like to make a test out of it |
13:35:20 | dom96 | I think @Vindaar might have a test case of some sort though |
13:35:35 | FromDiscord_ | <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:23 | dom96 | Nice! Big props to those that are creating exercises for Nim on Exercism :) |
13:37:24 | FromDiscord_ | <tomku> yep! shame there are so few mentors though |
13:38:04 | FromGitter | <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:27 | dom96 | but that test case reproduces it, right? |
13:39:15 | FromGitter | <Vindaar> yes, but only if that commit were merged ;) |
13:40:02 | FromGitter | <mratsim> BTW @Araq and @Clyybber can we create types that can't be copied, only moved? |
13:40:57 | Araq | https://github.com/nim-lang/Nim/blob/devel/lib/system/widestrs.nim#L36 sure, and it's shipping |
13:41:00 | FromGitter | <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:25 | dom96 | Vindaar: hrm, but your change makes sense I think. Before the custom pragma wasn't checking all nodes it was supposed to |
13:41:36 | dom96 | Yeah, but even if no custom pragma is used the nodes still are checked |
13:41:56 | * | laaron joined #nim |
13:42:00 | clyybber | Araq: Yeah, just declare `=` with an {.error.} pragma |
13:42:22 | clyybber | Oh, sry wrong tag, @mratsim |
13:42:36 | FromGitter | <Vindaar> yes, which is why https://github.com/nim-lang/Nim/issues/11415 happens |
13:43:06 | Araq | clyybber: 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:38 | Araq | and then why do we need =sink? it's always a bitcopy |
13:43:54 | * | sentreen joined #nim |
13:44:28 | clyybber | Araq: But we leak if we don't =destroy x in `=sink(x, ...)` |
13:44:58 | Araq | not if we emit the =destroy before it |
13:45:07 | clyybber | Yeah, thats an idea that came to mind too |
13:45:46 | Araq | well I'm leaving it as it is now |
13:45:58 | Araq | maybe the self-assign check is required after all |
13:46:36 | clyybber | It is only required when the rexpression in an assignment includes the lhs symbol. |
13:47:13 | Araq | sure. |
13:47:16 | * | solitudesf quit (Ping timeout: 272 seconds) |
13:47:22 | clyybber | And since `=` makes a deep copy, we wont have problems with aliasing. |
13:47:30 | clyybber | Everything will just work |
13:47:32 | clyybber | I think |
13:47:50 | Araq | hmm if we don't have =sink we can get 'emplacement' for free, maybe? |
13:48:06 | clyybber | What do you mean with emplacement? |
13:48:10 | Araq | that's still a major missing piece |
13:48:27 | Araq | in C++ there is vector::emplace_back |
13:48:49 | Araq | it constructs the object directly at vec[vec.len] |
13:49:32 | Araq | we have to zero its memory so that =destroy doesn't do anything |
13:50:00 | * | dddddd joined #nim |
13:52:02 | clyybber | Araq: 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:17 | clyybber | It just takes whatever is required to construct the object in place |
13:52:37 | Araq | it uses some forwarding technique to make construction lazy |
13:52:51 | Araq | and so it can construct into uninit'ed memory |
13:55:35 | clyybber | Araq: I would introduce an `=overwrite` operator or something like that which doesn't care what location is it's destination. |
13:55:45 | clyybber | And use that in emplace_back |
13:56:24 | clyybber | Ah, but if =sink is a simple shallow copy, that won't be neccessary |
13:56:51 | clyybber | Hmmm, I like how everything convienently falls into place |
13:57:16 | krux02 | clyybber I don't think you can do that |
13:57:38 | krux02 | if you override =, you have to deconstruct the object on the left hand side of the operator |
13:58:02 | krux02 | if you emplace, you may not deconstruct the object on the left hand side of the operator, because it is uninitialized data. |
13:58:24 | clyybber | krux02: Thats why I was talking about a new operator |
13:58:31 | clyybber | which wont deconstruct the object on the lhs |
13:59:14 | krux02 | and when will that operator be called? |
14:00:33 | clyybber | `=overwrite` |
14:00:42 | clyybber | But as it turns out that wont be needed |
14:00:52 | krux02 | My solution for an emplace back would be a macro/template that can be called like this ``emplaceBack(myInitProc, arg1, arg2, arg3)`` |
14:00:56 | clyybber | When =sink doesn't deconstruct the lhs itself |
14:01:25 | clyybber | But rather the compiler injects a `=destroy`(lhs) before a `=sink`(lhs, ...) |
14:02:07 | clyybber | Then you could have some pragma or whatever that tells the compiler to not inject `=destroy`(lhs) |
14:02:14 | clyybber | an then we have a free emplacement |
14:02:19 | clyybber | I think thats what Araq meant |
14:03:15 | FromDiscord_ | <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:36 | dom96 | btw we're overdue our yearly community survey |
14:05:37 | * | laaron joined #nim |
14:06:18 | dom96 | I guess we can stop doing this if it's not valuable |
14:06:25 | dom96 | but it was nice to get this signal every year |
14:07:45 | FromDiscord_ | <Kiloneie> im up for a survey, wasn't the last one from 2017 ? |
14:08:41 | FromDiscord_ | <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:46 | dom96 | https://nim-lang.org/blog/2018/06/23/community-survey-2018.html |
14:08:48 | dom96 | 2018 |
14:11:05 | FromGitter | <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:38 | Araq | mratsim: no, pointers are pointers, C++ doesn't attach destructors to pointers either |
14:13:25 | Araq | dom96: 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:45 | FromDiscord_ | <Kiloneie> Based on the surveys, tutorials/documentation and 1.0 is really the biggest issue, (documentation is also Godot's problem) |
14:14:00 | clyybber | mratsim: You can just wrap the pointer in an object. |
14:14:35 | FromDiscord_ | <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:12 | clyybber | Araq: So everything boils down to:\n * Inject `=destroy`(x) when before a `=sink`(x, ...) or a `=`(x, ...) |
14:28:08 | FromGitter | <Vindaar> @treeform: in case you're around, have you seen my chroma PR? https://github.com/treeform/chroma/pull/4 |
14:28:17 | clyybber | Wrap (`=destroy`(x)` and) `=sink`(x, ...) in a self-assigncheck when `...` includes `x` |
14:28:34 | clyybber | And `destroy`(x) after its last use. |
14:29:05 | clyybber | And then we have a fast new runtime :D |
14:30:09 | clyybber | And 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:53 | clyybber | Btw Araq, I think I have found why 11833 is crashing |
14:33:33 | clyybber | Argh, nevermind, not yet |
14:38:52 | Araq | clyybber, krux02 proc add*(x: seq; y: sink T) {.nodestroy.} = copyMem(x[x.len], y) |
14:39:03 | Araq | we can do "emplace" already |
14:40:10 | dom96 | krux02, Araq: I've reproduced it: https://github.com/nim-lang/Nim/issues/11923 |
14:40:12 | Araq | but copyMem doesn't always work, I guess |
14:43:35 | clyybber | =sink could be the new copyMem |
14:43:42 | clyybber | or will if we implement the above |
14:44:16 | dom96 | btw am I missing something obvious? Why doesn't this compile? https://play.nim-lang.org/#ix=1Rjq |
14:46:12 | FromGitter | <Vindaar> because `Point` is defined after `MyObj`? |
14:48:36 | dom96 | yep |
14:48:41 | dom96 | Do we have an issue for this? |
14:48:48 | dom96 | The error message is horrible |
14:48:54 | Araq | yeah, we do. |
14:49:00 | krux02 | dom96: I tested your issue on my branch, here it works |
14:50:03 | dom96 | There must be some other issue in your branch then |
14:50:33 | dom96 | or maybe I just needed to re-bootstrap |
14:53:35 | Araq | clyybber: well Rust uses copyMem for moving, so there is some way to make it work |
14:54:33 | Araq | but how Rust does it precisely is not documented well and in a state of flux. It uses hidden 'wasMoved' bit flags |
14:54:50 | Araq | Nim uses the default(T) state for this. |
14:55:26 | Araq | more elegant IMO and Nim can move from array[index] and Rust can't. |
15:07:34 | * | onionhammer1 is now known as onionhammer |
15:10:33 | Araq | clyybber: did you play with .cursor variables? |
15:10:51 | Araq | IMHO we should simply remove them again, 'lent T' does the same (?) |
15:13:54 | clyybber | Yeah, looks like that to me. |
15:14:06 | clyybber | They both are always shallow copied and never destroyed. |
15:15:00 | Araq | ok, good |
15:15:11 | * | Araq removes them from the spec |
15:20:21 | * | joki1337 joined #nim |
15:21:27 | disruptek | clyybber: you deserve a lot of credit for the time you put in on this. |
15:21:34 | * | joki1337 quit (Client Quit) |
15:31:37 | FromGitter | <arnetheduck> Araq, do you have a like to the rust wasMoved bits? |
15:35:21 | Araq | arnetheduck: we had these bits too, they simply don't work well |
15:35:56 | FromGitter | <arnetheduck> er, oops, I meant link ;) |
15:36:12 | Araq | hmm, let me see |
15:37:15 | Araq | https://doc.rust-lang.org/nomicon/drop-flags.html |
15:37:34 | Araq | https://blog.rust-lang.org/2016/04/19/MIR.html |
15:37:58 | * | aq60 joined #nim |
15:38:01 | Araq | there always was an RFC that made me "WTF?!" :P |
15:38:43 | Araq | where they ignored the problems entirely. (The problem being: How do you store the drop bits on the **heap**?) |
15:39:40 | FromGitter | <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:45 | FromGitter | <arnetheduck> thanks |
15:40:27 | aq60 | Hi, 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:45 | aq60 | Basicly im casting to ref in a loop, it passes with the first 5-6 objects, but on the next one it fails |
15:44:48 | Araq | aq60: that's simply not a valid cast, in no runtime, neither old nor new |
15:45:07 | Araq | 'ref' means it's provably on the heap. |
15:45:57 | aq60 | how should I cast ref, like you do .addr with ptr? |
15:46:06 | clyybber | disruptek: Thanks, it was more of a learning experience, now that we know =move is actually unneccessary |
15:46:12 | Araq | arnetheduck: 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:02 | Araq | it's a compromise because nobody knows how to reason about heap locations effectively |
15:48:21 | aq60 | It works with the old runtime |
15:48:36 | Araq | aq60: you simply got very very lucky |
15:48:46 | aq60 | :) |
15:48:54 | disruptek | clyybber: sure, but you got your hands dirty and newruntime as a research project is the beneficiary. ;-) |
15:48:56 | FromGitter | <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:23 | FromGitter | <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:05 | clyybber | arnetheduck: 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:35 | FromGitter | <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:39 | FromGitter | <arnetheduck> clyybber, that doesn't "work" though - iterating over something is not a mutating operation |
15:56:04 | FromGitter | <arnetheduck> neither is reading it by accessing array[index] after the move |
15:56:04 | clyybber | arnetheduck: Then imagine it was always there |
15:57:06 | FromGitter | <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:25 | FromGitter | <arnetheduck> but I wonder if it's a) correct and b) the simplest one |
15:57:46 | clyybber | arnetheduck: Well, yeah, but it doesn't matter. I can also pretend there is an instance of *something* at any pointer/ |
15:58:10 | disruptek | why isn't `import net` an "unused import" here? https://play.nim-lang.org/#ix=1RjL |
15:58:26 | disruptek | something to do with the `to()` call. |
15:58:31 | FromGitter | <arnetheduck> not really - most languages declare that there's nothing at `nil` for example and build logic around that |
15:59:13 | clyybber | arnetheduck: Well, then theres nothing at the previous location |
15:59:21 | clyybber | Since the move nils out the source |
15:59:48 | clyybber | Or default(T)'s out the location. It doesn't matter |
16:00:45 | FromGitter | <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:31 | aq60 | still waiting for the proper way of casting a ref :))) |
16:01:53 | FromGitter | <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:55 | Araq | aq60: 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:55 | Araq | disruptek: I don't know, report it please |
16:04:21 | aq60 | I knew i should model the objects with ptr, but no, I wanted to try the safe ref :)) |
16:04:27 | disruptek | arnetheduck: 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:47 | disruptek | Araq: okie. |
16:06:24 | Araq | disruptek: 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:45 | disruptek | exactly, it's insufficient to capture the semantics. |
16:07:17 | disruptek | i would not say that this is "always" the case, though. |
16:07:23 | Araq | insufficient depends on the context, "" is good enough for you to notice that you cannot send an email to this person |
16:07:39 | disruptek | well, we decide what the semantics will be and how the data will reflect that. |
16:08:15 | shashlick | @mratsim that's how I made shared - ptr in object |
16:08:36 | shashlick | https://github.com/genotrance/shared |
16:08:51 | FromGitter | <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:54 | shashlick | But it still suffers from multiple gc issue |
16:09:10 | disruptek | i guess if `default(T)` was written as `nonexistent(T)`, it would satisfy my point; does that make sense? |
16:09:52 | FromGitter | <arnetheduck> you have to pay the price for `nonexistent(T)` |
16:10:10 | disruptek | ie. the programmer conveys the semantic intent instead of picking and choosing from data which is (merely by convention) matching their intent. |
16:10:27 | disruptek | hey, nothing in this life comes free. ;-) |
16:10:48 | FromGitter | <arnetheduck> so you can use an `option[T]` if you need that - default(T) for that is "no instance". done. |
16:11:22 | disruptek | isn't that kinda accidental and arbitrary, though? what if the default value for a type is not "no instance"? |
16:11:31 | disruptek | it's convention, right? |
16:11:58 | Araq | well it's just a bunch of bits, the rest is convention, of course. |
16:12:18 | FromGitter | <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:36 | Araq | well yeah. that's what we do. |
16:12:41 | aq60 | so this is blasphemy? https://play.nim-lang.org/#ix=1RjP |
16:12:42 | disruptek | so default(T) is nonexistent(T), by spec. |
16:13:09 | disruptek | i'm fine with that, if that's the case; i got the impression that there was some "third way" here. |
16:13:15 | Araq | well I would say "empty", not "nonexistent". |
16:13:22 | Araq | and I'm not sure these are the same. |
16:13:23 | Araq | ;-) |
16:13:43 | FromGitter | <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:22 | disruptek | same 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:30 | clyybber | Well, ram is flat, so empty and nonexistant is the same really? |
16:16:47 | FromGitter | <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:50 | disruptek | depends on how many dimensions your ram has. :-P |
16:17:38 | FromGitter | <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:50 | clyybber | arnetheduck: 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:06 | clyybber | Araq: I fixed 11833 |
16:19:17 | clyybber | I'll make a PR |
16:19:24 | FromGitter | <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:44 | clyybber | Araq: Are you ok with me cleaning up injectdestructors a bit while I'm at it? |
16:20:44 | clyybber | arnetheduck: You put a check in the destructor: `if x == default(T): return` |
16:20:51 | clyybber | And put it at the top |
16:21:07 | FromGitter | <arnetheduck> well, then you *are* calling the destructor |
16:21:14 | clyybber | arnetheduck: 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:22 | clyybber | It doesn't really matter |
16:21:35 | clyybber | arnetheduck: But this way it provides a bit more flexibility |
16:21:54 | clyybber | And that flexibility can of course also be used to make shit go break |
16:22:00 | * | tiorock joined #nim |
16:23:03 | FromGitter | <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:40 | clyybber | arnetheduck: Ok, does it do that with static analysis? |
16:23:52 | * | Guest4031 quit (Ping timeout: 246 seconds) |
16:24:10 | FromGitter | <arnetheduck> well, it does that because constructors are the only "legal" way to create instances - in nim, there's no such thing |
16:24:39 | clyybber | arnetheduck: Yeah. Does CPP do that with static analysis? |
16:24:42 | clyybber | Or at runtime? |
16:25:07 | clyybber | Because if it does it at runtime, there probably isn't any performance benefit over Nims design |
16:25:26 | FromGitter | <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:15 | clyybber | arnetheduck: Yeah, but how does it guarantee that it will never enter a particular state? With runtime checks I assume |
16:27:02 | FromGitter | <arnetheduck> no, once a constructor exists, that's the only legal way to construct an object (there's no `default(T)`) |
16:28:28 | clyybber | Ah, ok. |
16:28:42 | clyybber | Destructors in nim rely on default(T) though. |
16:29:02 | clyybber | Since ATM we don't elide them at compile time. |
16:29:35 | clyybber | But 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:17 | clyybber | And for those cases we have a state which indicates that the object is not really there (just like a nullpointer) |
16:31:53 | FromGitter | <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:29 | clyybber | Yeah |
16:32:30 | disruptek | ah, so you already have an `empty(T)` or `nonexistent(T)`. |
16:32:52 | FromGitter | <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:52 | FromGitter | <arnetheduck> it seems like for destructors, nim will be similar - sometimes they'll be called and sometimes not |
16:34:11 | clyybber | Yeah, depending on wether the location got moved |
16:34:15 | FromGitter | <arnetheduck> so the two-instances intuition is slightly wrong also |
16:34:32 | disruptek | it may never be empty or nonexistent, too. |
16:34:36 | FromGitter | <arnetheduck> but it's still more correct than "won't be accessible" |
16:34:41 | clyybber | bbl |
16:39:00 | Araq | clyybber: oh yes please, clean it up |
16:42:30 | disruptek | Zevv: 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:42 | Araq | "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:52 | FromGitter | <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:21 | Araq | you have 2 different 'obj' types of the same name |
16:50:47 | Araq | there is logic in the compiler to use moda.obj vs modb.obj then but it doesn't always trigger, unfortunately. |
16:51:17 | Zevv | disruptek: 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:23 | FromGitter | <zacharycarter> okay thanks - actually I just figured out what's causing it - this is interesting |
16:51:33 | FromGitter | <zacharycarter> so I had an import at the top of my file which wasn't valid |
16:51:48 | FromGitter | <zacharycarter> but it had the same name as the module from the object I was trying to use |
16:51:51 | disruptek | Zevv: start with the simple one. :-) |
16:52:03 | FromGitter | <zacharycarter> so I guess the compiler first complained about them not being the same type of object |
16:52:13 | FromGitter | <zacharycarter> before it reported that the module I was trying to import, didn't actually exist |
16:52:27 | disruptek | i'm just wondering, because i have some table types i'm generating, so we're probably traversing the same ground... |
16:52:28 | FromGitter | <zacharycarter> but thanks for the explanation - that helped me figure it out |
16:54:07 | * | lritter joined #nim |
16:55:01 | Araq | aq60: cast[ref typeof(x)](x.addr) cannot ever work reliably. |
16:55:38 | Zevv | disruptek: 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:51 | aq60 | Thats my question, what do you use for address? |
16:55:59 | aq60 | Araq |
16:56:15 | Zevv | Then 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:23 | Araq | the problem is not the 'addr', the problem is the 'ref', use 'ptr' instead |
16:56:35 | dom96 | Zevv: rayman22201: any plans to continue with the spawn+await efforts? |
16:56:39 | aq60 | I have a C program that has some heavy usage of pointer arithmetics |
16:56:43 | disruptek | Zevv: got a link to the first part, with the tables and .data? |
16:56:45 | aq60 | Im porting it to Nim |
16:56:54 | Zevv | third is that the data structure I am trying to ast-ize also holds NimNode code blocks, which does not work |
16:57:03 | Araq | that works easily, but you need to learn about 'ptr' :P |
16:57:24 | Zevv | disruptek: I have a branch, one sec. Basically I provided manual newLit() procs for my objects |
16:57:48 | aq60 | I just changed all procs and objects to use ptr, it works with the newruntime too :) |
16:58:59 | Zevv | disruptek: https://github.com/zevv/npeg/blob/newlit/src/npeg.nim#L43 |
16:59:13 | disruptek | const variant types... this is a concept that is breaking my little brain. |
16:59:26 | Zevv | dom96: 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:59 | rayman22201 | @dom96 in theory yes. But I don't have a timeline. |
17:00:15 | Zevv | disruptek: why? You have type T which is a variant, and you make a const instance of that type? |
17:00:37 | Zevv | dom96: and I guess we have to make some new plans, because we were not on the right path it seems |
17:01:08 | disruptek | just seems like an oxymoron. |
17:01:29 | dom96 | Zevv, it would be an awesome feature, happy to help any way I can |
17:01:30 | Zevv | disruptek: 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:15 | Zevv | disruptek: this is what I was trying: https://github.com/zevv/npeg/blob/newlit/src/npeg.nim#L43 |
17:03:19 | Zevv | highly illegal, but it compiles :) |
17:06:31 | Zevv | I 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:00 | Zevv | So Ast A and Ast B, mangle them and create Ast X |
17:07:16 | disruptek | right, but where does the const part come into play? |
17:07:22 | disruptek | A and B are const? |
17:07:24 | * | Jesin quit (Quit: Leaving) |
17:07:45 | Zevv | macros 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:55 | disruptek | are you trying to A +-> B =-> X? |
17:07:59 | * | joki1337 quit (Remote host closed the connection) |
17:08:11 | Zevv | that kind of sums it up. |
17:08:28 | Zevv | I'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:22 | disruptek | seems 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:28 | Zevv | disruptek: https://paste.debian.net/plain/1095365 |
17:11:18 | Zevv | that'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:49 | disruptek | actually, that seems easier. |
17:12:00 | Zevv | Another 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:11 | Zevv | But: NimNodes can not be stored in consts. |
17:12:35 | disruptek | they are kinda a pita, right? like poison. |
17:12:40 | * | laaron joined #nim |
17:13:20 | Zevv | well, 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:24 | Zevv | And then you Hit. A. Wall. |
17:13:37 | Zevv | And 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:22 | Zevv | macros seem to be this all-empowering feature, but later I found out they are really ment to do this one thing. |
17:14:48 | Zevv | And 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:53 | Araq | as in: "They can only transform ASTs" |
17:14:59 | Araq | ? :P |
17:15:10 | Zevv | right. Only one ast to one ast. |
17:15:13 | * | laaron quit (Remote host closed the connection) |
17:15:28 | Zevv | which is of course the whole purpose of macros :) |
17:15:45 | disruptek | the problem, i think, is that we're not used to there being real limitations to our nim code. :-P |
17:15:59 | Zevv | ^ |
17:16:04 | * | joki1337 joined #nim |
17:16:28 | disruptek | you have to admit, we're kinda asking a lot of the implementation. |
17:16:28 | Zevv | I 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:40 | Zevv | but I've reached a cul-de-sac now. |
17:16:40 | * | Jesin joined #nim |
17:16:48 | Zevv | oh definately :) |
17:16:55 | Zevv | *definitely* |
17:17:03 | * | laaron joined #nim |
17:18:00 | disruptek | honestly, 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:33 | Zevv | I don't care at this point. |
17:19:04 | Araq | Zevv: 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:04 | Zevv | My 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:21 | Araq | in a .compileTime variable. Obviously. |
17:19:56 | disruptek | would 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:57 | Zevv | ok, but is there a real technical limitation at this time, or is it just me not figuring out how to do it? |
17:21:25 | Zevv | disruptek: 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:26 | disruptek | no, 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:38 | Zevv | I'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:15 | disruptek | well, .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:24 | Zevv | well, what do you know. .compileTime. variables. |
17:25:57 | Zevv | I never realized those existed explicitly - I only used compileTime on procs |
17:26:44 | disruptek | so 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:42 | Zevv | complicating factor is that instructions are variants (but I can easily drop that), and can also contain NimNodes which hold nim code |
17:28:29 | disruptek | i 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:59 | Zevv | would 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:03 | disruptek | i don't think that's a complication; does it limit you somehow? |
17:29:51 | Zevv | well, it did when I tried to store my grammar in a const. But with ct vars that is probably not an issue |
17:30:02 | Zevv | going consts is probably my big mistake |
17:30:05 | disruptek | i 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:22 | disruptek | fact 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:04 | Zevv | well, this gramamar can *contain* any valid nim ast - which is the embedded nim code |
17:31:21 | FromGitter | <zacharycarter> aq60: pointer arithmetic in Nim isn't hard - I do it in my game code in some places |
17:31:25 | disruptek | yeah, but that's very different. you can make assumptions about what it contains because it's your code that's generating it. |
17:31:31 | FromGitter | <zacharycarter> there's a forum thread that has a bunch of templates for doing exactly this |
17:31:46 | FromGitter | <zacharycarter> actually - here: https://gist.github.com/oltolm/1738289b5ac866ec6a7e4ef20095178e |
17:31:47 | Zevv | disruptek: nope, its user supplied code. |
17:31:50 | disruptek | i mean, maybe you *want* to be able to compose npeg with any valid nim ast. i dunno. |
17:32:20 | Zevv | I thought of mitigating this by storing the embeddded code simply as text and parse it again later |
17:32:26 | disruptek | i thought the only input you want to consume is output from your `grammar:`, no? |
17:33:22 | Zevv | yes, but grammar: can in real life contain snippets of nim code. |
17:33:24 | disruptek | i 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:59 | disruptek | that'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:08 | disruptek | s/wrapper/wrapped/ |
17:34:08 | Zevv | true |
17:34:37 | disruptek | this is a neat library, thanks for the labor you've put in. |
17:35:43 | Zevv | it's *almost* finished :) |
17:36:41 | disruptek | well, 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:10 | Zevv | oh 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:37 | Zevv | and it is used in production at one of my customers for some small things |
17:39:28 | Zevv | And 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:33 | disruptek | yeah, i'm using it. it's not a complex use-case, but it buys me something significant, so i'm very happy. |
17:39:49 | Zevv | \o/ |
17:40:27 | disruptek | yeah, that's awesome. 👍 |
17:42:11 | FromGitter | <Vindaar> Zevv: you might have realized that now, but for reference this works: https://play.nim-lang.org/#ix=1Rk7 |
17:43:30 | Zevv | yes, 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:49 | Zevv | can 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:25 | Zevv | (given that this Ast is *not* valid Nim program code!) |
17:46:37 | Zevv | so I can't embed it into an anonymous proc, or something like that |
17:46:41 | disruptek | isn't that what `quote do` does? |
17:46:54 | Zevv | that is what I thought as well |
17:47:02 | Zevv | but then Nim tries to interpretet the block somehow as Nim code |
17:47:33 | disruptek | it just parses it; it doesn't invoke it. |
17:47:50 | Zevv | it does semchecks it seems: https://play.nim-lang.org/#ix=1Rka |
17:47:51 | disruptek | also, it helpfully elides comments. 🙄 |
17:48:25 | disruptek | well, that's not nim. |
17:48:50 | Zevv | no it is not, but it is representable in Nim AST, right |
17:49:14 | disruptek | yes, but it's kinda a big ask to expect `quote do` to successfully parse a grammar it doesn't know, right? |
17:49:37 | Zevv | why? The nim compiler parsed it into a nimnode tree already? |
17:52:08 | FromGitter | <Vindaar> all fine: https://play.nim-lang.org/#ix=1Rkb |
17:52:38 | Zevv | what?! |
17:53:08 | disruptek | do we need to quote it again? |
17:53:59 | FromGitter | <Vindaar> nah, sorry. that was copy & paste |
17:54:14 | disruptek | good. |
17:54:35 | Zevv | pff i was mixing up two things, messing up |
17:54:41 | FromGitter | <Vindaar> i.e. this is fine https://play.nim-lang.org/#ix=1Rkk |
17:54:55 | disruptek | yep. |
17:54:58 | Zevv | I partly blame my kids to have stolen my laptop so im typing on my phone :/ |
17:55:23 | Zevv | well vindaar, that should definitely get me going. the compiletime var was my whole problem |
17:56:04 | disruptek | yeah, 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:16 | Zevv | this 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:33 | disruptek | looking forward to it! |
17:57:33 | Zevv | If 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:00 | Zevv | great, thanks once more for hearing me ramble folks, always a pleasure! |
17:58:19 | disruptek | oh, so you won't even have `import` statements or any context passed by the user? |
17:58:41 | Zevv | thats details |
17:59:22 | Zevv | I 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:43 | Zevv | if i would later want to be more fine grained, that should be trivial |
18:02:22 | FromGitter | <Vindaar> hehe, good to hear. hope it works out :) |
18:02:43 | disruptek | your chroma pr looks pretty good, btw, vindaar. |
18:05:37 | FromGitter | <Vindaar> thanks! :) |
18:06:27 | FromGitter | <Vindaar> I needed HCL support to reproduce the ggplot2 colors :D |
18:08:10 | dom96 | Anyone else wishes `echo` followed `print`'s suit and added spaces in between arguments implicitly? |
18:08:20 | disruptek | ah, always funny to see a pr that seems to quadruple the functionality of a lib. ;-) |
18:09:00 | shashlick | It does bother me that `echo a, b` doesn't add spaces |
18:09:09 | disruptek | dom96: yes. but, i think i'd be satisfied if only the logging templates did that. it really bothers me there. |
18:09:39 | Zevv | vindaar: what exactly causes the different behaviour between your and my macro? |
18:09:53 | Zevv | Min returns the output of quote do, but yours returns the output of quote do |
18:10:01 | FromGitter | <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:19 | FromDiscord_ | <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:19 | FromDiscord_ | <Kiloneie> |
18:10:19 | FromDiscord_ | <Kiloneie> How do i contact the right person to change this ? |
18:10:30 | Zevv | mratsim: cool, thanks |
18:10:51 | FromGitter | <mratsim> The main issue to be aware of is to not do in-place modification but assign the complete modified object |
18:11:09 | FromGitter | <mratsim> There are 2 bugs from the past 3 weeks on that |
18:11:19 | Zevv | hmm but could I have a seq ct var and add elements to it? |
18:11:30 | Zevv | or should I replace it with a new copy of a seq? |
18:15:36 | Araq | no, you need to add |
18:15:46 | Araq | and IC kinda relies on it, read the RFC... :P |
18:16:07 | FromGitter | <Vindaar> zevv: sorry, was afk. The problem with your code was simply that you never assigned to `myNode` |
18:16:53 | Zevv | yeah I was messing up, sorry. I have my computer back, should be better now :) |
18:16:56 | * | joki1337 quit () |
18:18:24 | FromGitter | <Vindaar> nothing to apologize for ;) |
18:19:54 | * | nif quit (Quit: ...) |
18:20:03 | * | nif joined #nim |
18:21:13 | FromGitter | <zacharycarter> without any kind of shadow shader: |
18:21:20 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/o7Mv/image.png) |
18:22:04 | FromGitter | <zacharycarter> it's actually a pleasant surprise that this renders - because I hadn't tried before |
18:22:13 | FromGitter | <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:48 | Zevv | arghh. I just implemented peg libraries with 5 lines of code |
18:38:33 | Zevv | I'm too old to have my pride hurt. But it hurts my soul :( |
18:39:15 | FromGitter | <Vindaar> it just means it's an /elegant/ feature :) plus it's easy to maintain, hehe |
18:39:22 | Zevv | right :) |
18:39:28 | FromGitter | <zacharycarter> Zevv: are you into just PEGs or grammars in general? |
18:39:45 | FromGitter | <zacharycarter> because I built something from this whitepaper a few years ago - |
18:39:51 | FromGitter | <zacharycarter> https://pdfs.semanticscholar.org/ab05/4224e6c43f96f06ece41f336b7a5a070a4e3.pdf |
18:39:52 | Zevv | So it was completely trivial. conclusion: my mistake was that I was trying to store intermediate grammars in consts, but needed ct vars |
18:40:33 | Zevv | zacharycarter: I miss any formal education on this stuff, but I have always been intrigued by grammars and parsers |
18:40:50 | Zevv | wow that's cool :) |
18:41:31 | FromGitter | <zacharycarter> yeah - they can be pretty powerful in the procgen world |
18:41:31 | Zevv | I saw a cool dungeon gen on HN the other day, let me look that up |
18:41:50 | FromGitter | <zacharycarter> I think I'm going to try to incorporate procgen elements into my RTS |
18:42:10 | FromGitter | <zacharycarter> so I might use some sort of grammar for rules around different types of scenarios |
18:42:39 | Zevv | sounds like a fun project you're doing there :) |
18:42:57 | FromGitter | <zacharycarter> well - I have a game designer from work working with me on the concept for the game |
18:43:14 | FromGitter | <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:20 | FromGitter | <zacharycarter> and also oriented towards team play |
18:43:41 | FromGitter | <zacharycarter> you won't have to produce units - they'll be auto-produced but you still need to build buildings |
18:43:51 | FromDiscord_ | <Kiloneie> like red alert 3 where that didn't work ? |
18:44:09 | FromGitter | <zacharycarter> I'm not making red alert 3 |
18:44:26 | FromDiscord_ | <Kiloneie> just don't try giving EVERY unit a special ability |
18:44:35 | FromGitter | <zacharycarter> and fyi red alert 3 has 9/10 rating on steam |
18:44:51 | FromDiscord_ | <Shield> good to see somebody working on an rts, I have a lot of questions about those |
18:45:01 | FromDiscord_ | <Kiloneie> yeh.... that's why NOBODY cares about it and everybody prefers red alert 2 |
18:45:03 | FromGitter | <zacharycarter> but no - you'll mostly control your hero character |
18:45:09 | krux02 | auto production of units reminds of of the game: Z |
18:45:32 | FromGitter | <zacharycarter> the auto generated forces will be controlled by a dumb AI |
18:45:35 | FromDiscord_ | <Kiloneie> also wehich rating, meta or users ? recent or overall ? |
18:45:43 | FromGitter | <zacharycarter> I don't know - I just looked at google |
18:45:53 | krux02 | but 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:05 | FromGitter | <zacharycarter> but you'll build buildings to upgrade units as well as give your hero powers |
18:46:10 | Zevv | zacharycarter: do you have any concept art? |
18:46:13 | FromGitter | <zacharycarter> and if someone destroys a building - your hero loses that power |
18:46:30 | krux02 | That 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:42 | FromGitter | <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:51 | FromGitter | <zacharycarter> but it's good that I work at a game company now - it should be much easier :( |
18:46:53 | Zevv | :) |
18:46:54 | FromGitter | <zacharycarter> err :) |
18:47:18 | FromGitter | <zacharycarter> also - we want to have synergies between heroes and make hero roster construction important |
18:47:27 | FromGitter | <zacharycarter> but ultimately - every hero will be able to choose what skills they take |
18:47:30 | krux02 | well, 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:33 | FromGitter | <zacharycarter> I'm not having some artist create 1000 hero models |
18:47:42 | FromGitter | <zacharycarter> not in Finland :) |
18:47:48 | FromGitter | <zacharycarter> pretty strict labor laws here |
18:47:57 | krux02 | cool |
18:48:13 | krux02 | we have labor laws as well here in Germany. |
18:48:20 | FromDiscord_ | <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:59 | FromGitter | <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:12 | FromGitter | <zacharycarter> I don't do multithreading |
18:49:34 | FromGitter | <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:55 | FromGitter | <zacharycarter> but I'll be reading a lot of gafferon games |
18:50:01 | FromDiscord_ | <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:17 | FromGitter | <zacharycarter> yeah |
18:50:33 | FromGitter | <zacharycarter> well - I haven't worked on the simulation part of the game much yet |
18:50:38 | FromGitter | <zacharycarter> I'm focusing on map generation / editing first |
18:51:10 | FromGitter | <zacharycarter> since that's pretty unlikely to need to need changes once it's implemented |
18:51:27 | FromGitter | <zacharycarter> also I need to work on skeletal animation and sounds - lots of plumbing work basically |
18:52:05 | FromGitter | <zacharycarter> I'll probably try and use soloud for audio |
18:52:06 | FromDiscord_ | <Shield> https://www.youtube.com/watch?v=bovlsENv1g4 |
18:52:55 | FromDiscord_ | <Shield> I honestly don't know how to handle different unit size with A* |
18:53:00 | FromDiscord_ | <tomku> re: crunch in game dev - varies wildly between companies |
18:53:43 | FromGitter | <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:45 | krux02 | tomku: If you go AAA in the US, then crunch is basically everywhere. |
18:53:48 | FromDiscord_ | <tomku> game i'm working on enters steam early access in a month and I'm already preparing for a grind |
18:54:04 | FromDiscord_ | <tomku> but that's expected |
18:54:06 | FromDiscord_ | <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:11 | krux02 | tomku: what game are you working on? |
18:54:13 | FromGitter | <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:27 | FromDiscord_ | <tomku> @krux02: last oasis |
18:54:32 | FromGitter | <zacharycarter> Shield: yup - that's why most games used deterministic lockstep |
18:54:38 | FromGitter | <zacharycarter> tomku: want to hook me up with a key :P |
18:54:38 | FromGitter | <zacharycarter> ? |
18:54:43 | FromGitter | <zacharycarter> I'm in your discord |
18:55:20 | FromGitter | <zacharycarter> I'm just joking btw - I'm sure there are fans more deserving of a key than I am |
18:55:22 | FromDiscord_ | <tomku> i know we entered new beta last week, did you sign up? |
18:55:22 | krux02 | I am just watching the trailler now, last oasis does look interesting |
18:55:32 | FromGitter | <zacharycarter> I don't think so - I'll go do that |
18:55:54 | FromDiscord_ | <tomku> but that's boring large project in UE4, let's talk nim stuff |
18:56:24 | clyybber | nim in ue4 :p |
18:56:29 | krux02 | looks like the structures from Theo Jansen |
18:56:47 | FromGitter | <zacharycarter> kind of sad the Nim UE4 stuff died |
18:56:55 | clyybber | oh there was something? |
18:56:59 | FromGitter | <zacharycarter> yeah |
18:57:06 | clyybber | Shouldn't be too hard to revive it, right? |
18:57:06 | FromGitter | <zacharycarter> https://github.com/pragmagic/nimue4 |
18:57:24 | FromGitter | <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:28 | FromDiscord_ | <Shield> a lot of nim stuff dies and language changes don't help |
18:57:36 | clyybber | Ah, endragor also did the godot bindings |
18:57:55 | FromDiscord_ | <tomku> i got godot-nim to work with latest nim, looks pretty cool |
18:58:03 | FromGitter | <zacharycarter> I'm very meh about godot |
18:58:08 | clyybber | tomku: Do you have your fork up? |
18:58:20 | clyybber | zacharycarter: I guess its because of the OO? |
18:58:34 | clyybber | Because thats the only thing that really bothers me about godot |
18:58:34 | FromGitter | <zacharycarter> clyybber: you mean the UE4 limitations wiith Nim? |
18:58:38 | FromGitter | <zacharycarter> oh |
18:58:38 | FromGitter | <zacharycarter> godot |
18:58:42 | clyybber | Yeah |
18:58:46 | FromDiscord_ | <tomku> clybber: i used other people forks for both the bindings and the sutb |
18:58:54 | clyybber | tomku: Ah, ok |
18:59:03 | FromGitter | <zacharycarter> there are several things that bother me about it, but OO i sone |
18:59:12 | FromGitter | <zacharycarter> also - I'm still waiting for a 3d game built with godot to come out |
18:59:16 | FromDiscord_ | <tomku> the latest opened issue on github has all the info |
18:59:37 | clyybber | zacharycarter: I made a small online shooter with my friends |
18:59:46 | krux02 | @tomku: do you give credit to Theo Jansen in the game? |
18:59:49 | clyybber | the online rpc interface is really cool |
18:59:56 | FromDiscord_ | <Shield> there is a 3d game out, but it's nothing fancy |
19:00:24 | clyybber | I couldn't figure out any way on how to do reverse kinematics though |
19:00:25 | FromGitter | <zacharycarter> I'd rather just use Unity over Godot |
19:00:32 | FromGitter | <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:32 | FromGitter | <zacharycarter> if I was going to use a pre-made engine |
19:00:57 | FromGitter | <zacharycarter> making a game engine these days is pretty simple though |
19:01:08 | FromGitter | <zacharycarter> it's mostly just cobbling together libraries to use to create different subsystems |
19:01:09 | FromDiscord_ | <tomku> krux02: you'd better off asking on the official discord, but im pretty sure we do acknowledge the inspiration |
19:01:09 | clyybber | Varriount: It means an object P containing and pointer to itself is not supported |
19:01:48 | clyybber | zacharycarter: Yeah, I also like to make my own engine, mainly because I don't need a fancy editor for proc gen |
19:01:51 | krux02 | tomku: If they have an IRC bridge, then I might do that :P |
19:01:52 | * | joshbaptiste quit (Ping timeout: 276 seconds) |
19:01:59 | FromGitter | <zacharycarter> editors are super annoying |
19:02:20 | FromGitter | <zacharycarter> my #1 main beef with UE4 / Unity / Godot - is having to learn how to use them |
19:02:25 | FromGitter | <zacharycarter> it's super annoying |
19:02:33 | krux02 | Well, I like editors, but they must be specialized for the game. |
19:02:40 | FromDiscord_ | <tomku> clyybber: well I guess I'm your IRC bridge in a sense, then 😉 |
19:02:42 | FromGitter | <zacharycarter> yes - like the map editor I'm buidling |
19:03:01 | FromDiscord_ | <tomku> any nim exercism mentors around |
19:03:04 | FromDiscord_ | <tomku> ? |
19:03:05 | FromDiscord_ | <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:13 | clyybber | tomku: Huh, wdym? |
19:03:25 | krux02 | I 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:35 | krux02 | making levels for Jetpack |
19:03:55 | clyybber | krux02: You came from scala right? |
19:04:28 | clyybber | Do 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:23 | clyybber | I found a commit that introduced @static in 2012, but it seems that got reverted |
19:05:34 | FromDiscord_ | <tomku> @clyybber sorry, was meant to tag krux02 |
19:05:43 | clyybber | tomku: Ah, ok :D |
19:06:24 | krux02 | clyybber: public static does not exist in scala, you have to put the things in the companion object. |
19:06:41 | krux02 | The companion object is like if you put values to the type |
19:06:48 | krux02 | you can do something like that in nim as well |
19:07:24 | sschwarzer | Hi 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:29 | krux02 | template typeProperty(_: typedesc[MyObjectType]): string = "MyValue" |
19:07:40 | clyybber | krux02: 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:09 | clyybber | For know I'm just resorting to a seperate java file and import that from scala |
19:08:20 | sschwarzer | Or is it not reocmmended to put the binaries in the project directory? |
19:10:38 | krux02 | clyyber, 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:16 | krux02 | but 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:19 | clyybber | Ah, ok. Thank you anyways :) |
19:12:30 | clyybber | krux02: Yeah thats really cool |
19:13:25 | krux02 | I 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:31 | krux02 | sschwarzer, how do you call the compiler? |
19:19:10 | sschwarzer | krux02: nim c src/vppdiff.nim |
19:19:42 | sschwarzer | I can compile if I leave out the `outdir` option, but then I get the binary in the `src` folder. |
19:19:53 | krux02 | well you can move the binary with ``mv`` |
19:19:59 | krux02 | (bash command) |
19:20:35 | krux02 | that 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:52 | krux02 | sschwarzer, yes |
19:21:07 | sschwarzer | krux02: I was hoping to have `nim` doing this after compiling. Or can I put the `mv` somehow in `config.nims`? |
19:21:08 | krux02 | leave out the output opiton, and then simply move the file. THat is how I would do it. |
19:21:21 | krux02 | nope you can't |
19:21:29 | krux02 | if you use nimble, maybe you can. |
19:21:54 | krux02 | nimble as a task system. there you can specify tasts to do after the build has been completed. |
19:22:05 | sschwarzer | krux02: 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:40 | krux02 | with bin bin folder I mean a folder where you would like the binary to be placed. |
19:22:53 | krux02 | but maybe it is better if you use nimble with default settings. |
19:23:09 | sschwarzer | krux02: 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:10 | krux02 | build your project with nimble. then call nimble install and see what happens |
19:23:38 | sschwarzer | krux02: Ok, so I understood you regarding the "bin folder" |
19:23:45 | krux02 | nimble puts links to executables that you build into $HOME/.nimble/bin |
19:24:19 | krux02 | with bin folder I mean the folder where you eventuall want to have the binary. |
19:24:26 | krux02 | the executable. |
19:24:40 | krux02 | it doesn't need to be called bin though. You can call it whatever you want. |
19:24:55 | sschwarzer | krux02: 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:22 | sschwarzer | I mean place it there easily. |
19:28:05 | * | joshbaptiste joined #nim |
19:28:14 | sschwarzer | krux02: Thanks anyway :) |
19:28:31 | krux02 | np |
19:28:39 | sschwarzer | Yes, I'll look into Nimble at some point. :-) |
19:31:17 | Araq | --outdir: ".." ? |
19:31:40 | Araq | I mean, it's not like you can forget about Nim's syntax in a *Nim*script config file, duh. |
19:33:39 | sschwarzer | Araq: Hi, welcome back :) |
19:34:16 | sschwarzer | Araq: `--outdir: ".."` in the `config.nims` file creates a folder `".."` and puts the binary there :-D |
19:34:55 | Araq | switch("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:54 | sschwarzer | Araq: no, doesn't work ... |
19:36:56 | sschwarzer | /usr/bin/ld: cannot open output file /home/schwa/sd/nim/vppdiff: Is a directory |
19:36:56 | sschwarzer | collect2: error: ld returned 1 exit status |
19:36:57 | sschwarzer | Error: execution of an external program failed: 'gcc |
19:37:00 | sschwarzer | ... |
19:37:04 | Araq | clyybber: in the new spec f_sink(g()) is converted to f_sink(g()) |
19:37:08 | * | joshbaptiste quit (Ping timeout: 244 seconds) |
19:37:54 | Araq | does 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:57 | FromGitter | <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:23 | sschwarzer | Vindaar: 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:45 | FromGitter | <Vindaar> then either define `--outdir:"."` (not sure if that works), or simply compile with `nim c --out:vppdiff src/vppdiff` |
19:42:46 | sschwarzer | Vindaar: the Nim file is `sd/nim/vppdiff/src/vppdiff.nim` |
19:44:26 | sschwarzer | Vindaar: The combination of Araq's tip and yours worked: `switch("outdir", ".")` |
19:44:33 | sschwarzer | Thanks for your help! |
19:45:09 | FromGitter | <Vindaar> no worries! |
19:45:12 | sschwarzer | I had tried `..` instead of `.` because I thought, the directory should be relative to the source file. |
19:45:41 | clyybber | Araq: Yeah, makes sense |
19:46:10 | Araq | ok, then the spec is almost ready |
19:46:22 | clyybber | Nice, do you have it up somewhere? |
19:46:25 | Araq | it's not much more complex than before |
19:46:31 | Araq | just different. |
19:46:32 | sschwarzer | For the record, I also changed `--threads:on` to `switch("threads", "on")` for consistency |
19:48:47 | sschwarzer | So 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:09 | sschwarzer | I mean I read there about the "convenience" |
19:50:04 | clyybber | Araq: Did you incorporate that =sink will have no self-assign check and also no =destroy call? |
19:50:27 | Araq | the =destroy call is still in there |
19:50:48 | Araq | and I don't intend to change it for v1 |
19:50:50 | clyybber | Ok |
19:51:04 | sschwarzer | I had seen `--threads:on` in some `config.nims` somewhere and had wrongly assumed that `--outdir:.` would work as well. |
19:51:17 | clyybber | Its fine I guess. Perhaps there are cases where some controle over that `=destroy` call is wanted |
19:57:31 | Araq | clyybber: it's here https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst |
19:57:59 | Araq | and I'll remove the wiki page |
19:58:41 | Araq | and if you enjoy it, mark in the source code the rewrite rules |
20:03:43 | clyybber | Araq: 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:29 | Araq | fine with me |
20:05:27 | Araq | so ... 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:10 | sschwarzer | I just found out that `xmltree.items` doesn't work recursively ;-) |
20:10:25 | sschwarzer | So 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:09 | sschwarzer | But if I didn't overlook something, I can write the recursion myself as in `findAll`, but without the tag comparison. |
20:13:51 | disruptek | sschwarzer: sure. |
20:14:19 | sschwarzer | I think the documentation for `items` and `mitems` is a bit vague here ("Iterates over any child of n.") |
20:14:32 | clyybber | Araq: p() didn't have a case for nkBracket |
20:15:13 | disruptek | sschwarzer: convention is that `items` yields immutable values while `mitems` values are mutable. |
20:16:09 | sschwarzer | disruptek: 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:16 | Araq | clyybber: there is some unhealthy code duplication going on here |
20:16:42 | disruptek | i agree it should be improved. easy enough to submit a pr via github! :-) |
20:17:00 | clyybber | Araq: Yeah, the 3 way mutual recursion is really something rare |
20:17:09 | clyybber | s/rare/special |
20:17:13 | sschwarzer | disruptek: a PR for the documentation or a PR for improved code? :-) |
20:17:37 | * | ljoonal joined #nim |
20:17:55 | sschwarzer | disruptek: Of course, for the code change we would probably need a flag (?) to remain backward-compatible? |
20:18:09 | disruptek | sschwarzer: 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:28 | disruptek | i wouldn't change the code; it's too breaky. |
20:19:19 | sschwarzer | disruptek: 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:36 | disruptek | should probably just come up with a simple api for walk() and then add it to xml, json, critbits, etc. |
20:20:22 | disruptek | iirc, we have a walk() for filesystem objects; maybe you can replicate that api for consistency? |
20:20:31 | sschwarzer | disruptek: Sounds good, at least for the moment. Also I agree it's nice if different tree-like structures behave consistently. |
20:21:14 | sschwarzer | By the way, I'm starting to lose track of the things I want to contribute to Nim. :-D |
20:21:18 | disruptek | gotta put some meat on the bone to make a stdlib patch worthwhile. ;-) |
20:21:42 | * | joshbaptiste quit (Ping timeout: 245 seconds) |
20:22:19 | sschwarzer | disruptek: Do you mean me or you here? |
20:22:24 | * | joshbaptiste joined #nim |
20:23:30 | disruptek | i 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:40 | clyybber | Araq: I have the PR up, looking at the spec now. |
20:25:42 | sschwarzer | disruptek: 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:33 | disruptek | make an issue and if people want it, i will author the pr. fair? ;-) |
20:26:41 | sschwarzer | disruptek: Regarding Nim improvements, my first goal is to make sure that `osproc.waitForExit` doesn't deadlock. |
20:27:31 | sschwarzer | disruptek: 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:48 | disruptek | aight, i will keep an eye out. gn |
20:27:54 | clyybber | gn8 |
20:28:00 | sschwarzer | disruptek: thanks! :) |
20:28:09 | * | sschwarzer quit (Quit: leaving) |
20:30:01 | clyybber | Araq: That branch I removed is a duplicate |
20:30:09 | Araq | how so? |
20:30:21 | clyybber | A few lines above it is repeated |
20:30:31 | clyybber | So it is dead duplicated code. |
20:30:51 | Araq | ah indeed |
20:31:03 | Araq | ok then |
20:31:50 | clyybber | Ah, maybe I should add a test case |
20:31:54 | Araq | we don't implement (self-assignment-removal) yet, but there is an open issue for it :P |
20:33:13 | Araq | btw 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:28 | Araq | and we're really far, far away from this complexity :P |
20:38:11 | * | joshbaptiste quit (Ping timeout: 268 seconds) |
20:47:02 | clyybber | Ugh, looks like the fix is causing leaks in other tests.. |
20:49:21 | Araq | er, why not run 'tt destructor' on your local machine? |
20:49:44 | Araq | I can't develop without it, feedback cycle via the CIs is much too slow |
20:50:02 | clyybber | Araq: I just did it. Thats how I figured it out |
20:50:11 | Araq | ah ok |
20:50:17 | clyybber | But I used ./koch test c destructor, which was a mistake |
20:50:30 | clyybber | since that takes ages |
20:50:53 | clyybber | would be cool if we could make the tester use nim_temp |
20:54:26 | clyybber | Araq: Is nkBracket always an array constructor? |
20:54:44 | Araq | yes. |
20:55:00 | Araq | you can run testament/tester --nimexe:nim_temp cat destructor |
20:55:09 | Araq | or something along these lines |
20:55:11 | clyybber | Ah, 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:51 | FromDiscord_ | <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:30 | FromDiscord_ | <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:18 | Araq | change the plugin setup |
21:02:22 | Araq | good night. |
21:02:28 | clyybber | gn8 |
21:03:32 | * | HP-YC9 joined #nim |
21:13:57 | * | HP-YC9 quit (Remote host closed the connection) |
21:15:18 | FromDiscord_ | <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:01 | FromDiscord_ | <Kiloneie> I don't understand why Case statement doesn't work this way: |
21:24:01 | FromDiscord_ | <Kiloneie> https://play.nim-lang.org/#ix=1Rlq |
21:26:17 | FromDiscord_ | <Kiloneie> Thought maybe this would work: https://play.nim-lang.org/#ix=1Rls |
21:26:18 | FromDiscord_ | <Kiloneie> I don't get it. |
21:29:15 | solitudesf | thats not whatr case statement does. you're supposed to use plain ifs for that |
21:29:57 | FromDiscord_ | <Kiloneie> Okay, so what is the purpose of case then ? |
21:30:19 | solitudesf | to perform action based on a variable's value? |
21:31:18 | FromDiscord_ | <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:46 | solitudesf | no, you're not matching on values |
21:33:02 | solitudesf | you just check arbitrary conditions, that what if does |
21:33:35 | solitudesf | thats how it works in every language, you can read any programming manual |
21:33:48 | * | joshbaptiste quit (Ping timeout: 245 seconds) |
21:34:16 | FromDiscord_ | <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:01 | disruptek | your 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:49 | FromDiscord_ | <Kiloneie> Yeah, i get that now. |
21:37:26 | FromDiscord_ | <Kiloneie> Im rushing trough things trying to get things done, and fail to understand some things. |
21:38:49 | disruptek | case statements are great because they can help prevent oversight when conditions change. |
21:39:22 | disruptek | it'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:31 | FromDiscord_ | <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:44 | FromGitter | <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:55 | FromDiscord_ | <Kiloneie> Man i suck, look how long of a code i wrote vs what someone else wrote xD... |
23:43:55 | FromDiscord_ | <Kiloneie> MINE: https://exercism.io/my/solutions/e1e97e1bb04e40c7947f65608e1535ef |
23:43:55 | FromDiscord_ | <Kiloneie> Someone else's: https://exercism.io/tracks/nim/exercises/run-length-encoding/solutions/cf672220e5684ef78a5392cf720ba824 |
23:45:38 | FromDiscord_ | <Kiloneie> Sorry you can't see mine, here: https://play.nim-lang.org/#ix=1Rmk |