00:05:28 | * | theelous3_ quit (Ping timeout: 245 seconds) |
00:12:37 | FromGitter | <arnetheduck> reading from a db means parsing the db and splitting it up into records that you then have to explode into an ast.. it's not a given that source code is that much more efficient, as long as you only have linear ops in the semcheck part |
00:13:40 | FromGitter | <arnetheduck> I had that as a distribution idea for `nlvm` though, that it could precompile the std lib and embed that into a single executable so it could be distributed without an accompanying folder.. it's a bit tricky though |
00:14:01 | FromGitter | <timotheecour> @yyc514 do you have a link? |
00:14:32 | FromGitter | <arnetheduck> `llvm` also gives you a jit, so the hot code reloading could be done without the dll tricks.. again, tricky, but doable |
00:16:56 | FromGitter | <timotheecour> also, it depends on impedence mismatch bw the db and the AST |
00:19:06 | FromGitter | <timotheecour> sqlite may be ill suited for storing certain types of objects (eg with nesting and repeated elements); maybe other db’s (document dbs like mongodb) or graph dbs could be more performant; but we still need to know what are the performance bottlenecks before doing anything |
00:29:37 | * | kapil____ joined #nim |
01:00:38 | * | jakob0094 quit (Remote host closed the connection) |
01:07:03 | FromGitter | <yyyc514> @timotheecour https://gist.github.com/yyyc514/403a645acfbab533687c7f76a361d3f1 something like that |
01:07:21 | FromGitter | <yyyc514> just makes a case statement to determine the type at runtime |
01:09:53 | FromGitter | <yyyc514> i have another macro that creates types so it just rolls up all the different types available into a compile time seq |
01:12:08 | * | lritter quit (Ping timeout: 245 seconds) |
01:13:12 | * | lritter joined #nim |
01:21:16 | * | zachk quit (Quit: Leaving) |
01:22:53 | * | MightyJoe quit (Remote host closed the connection) |
01:32:23 | * | vlad1777d joined #nim |
01:59:06 | * | lritter quit (Ping timeout: 250 seconds) |
02:04:17 | * | king3vbo joined #nim |
02:24:14 | * | couven92 quit (Ping timeout: 250 seconds) |
02:49:00 | * | Tyresc quit (Quit: WeeChat 2.3-dev) |
03:07:42 | * | banc quit (Quit: ZNC - http://znc.in) |
03:17:24 | * | dddddd quit (Remote host closed the connection) |
03:24:37 | * | banc joined #nim |
04:27:03 | * | narimiran joined #nim |
04:51:58 | narimiran | good morning @Vindaar, are you ready? :) |
04:58:46 | FromDiscord_ | <technicallyagd> Morning! |
04:58:57 | FromDiscord_ | <technicallyagd> 1 min to go |
04:59:28 | * | endragor joined #nim |
05:17:00 | * | nsf joined #nim |
05:52:42 | FromDiscord_ | <technicallyagd> lol, strong typing gets really annoying today |
05:57:12 | narimiran | everything gets really annoying today ;) i've completely failed, and i plan to take a rest before starting all over again |
05:59:34 | FromDiscord_ | <technicallyagd> yeah, I was on the brink of breaking down as well |
06:00:21 | FromDiscord_ | <technicallyagd> I really should take the time to read through the whole description |
06:10:01 | FromGitter | <kdheepak> I spent sooo long on this one (doing it in Python). Still working on a nim solution. I feel so dumb today. |
06:13:27 | FromGitter | <timotheecour> what’s the context? was there some coding challenge? |
06:13:40 | FromDiscord_ | <technicallyagd> Yeah adventofcode.com |
06:14:38 | FromDiscord_ | <technicallyagd> It's has a speed coding competition layer |
06:47:53 | FromDiscord_ | <technicallyagd> Is there a way to see how much time the compiler spent on compiling each module? |
07:13:42 | * | narimiran quit (Ping timeout: 250 seconds) |
07:32:47 | FromGitter | <alehander42> @yyyc514 ah nice, I also have something like this but i call it genCase |
07:45:56 | * | dddddd joined #nim |
07:57:58 | * | tiorock joined #nim |
07:57:58 | * | tiorock quit (Changing host) |
07:57:58 | * | tiorock joined #nim |
07:57:58 | * | rockcavera quit (Killed (barjavel.freenode.net (Nickname regained by services))) |
07:57:58 | * | tiorock is now known as rockcavera |
08:03:07 | * | Vladar joined #nim |
08:04:50 | * | krux02 joined #nim |
08:06:21 | edcragg | hi, is there any convenience function to get the item in a table (or array even) by maximum value? i've been looking around but i can't see one |
08:08:18 | * | stefanos82 joined #nim |
08:08:44 | * | kapil____ quit (Quit: Connection closed for inactivity) |
08:15:47 | * | endragor quit (Remote host closed the connection) |
08:16:06 | * | dddddd quit (Ping timeout: 250 seconds) |
08:17:47 | * | endragor joined #nim |
08:18:14 | FromGitter | <mratsim> in countTable there should be a max |
08:18:41 | FromGitter | <mratsim> https://nim-lang.org/docs/tables.html#largest%2CCountTableRef%5BA%5D |
08:19:41 | FromGitter | <mratsim> otherwise fold(low(T), max(a, b), yourseq) don’t remember the parameter orders |
08:20:29 | FromGitter | <mratsim> yourseq.fold(max(a, b), low(YourType)) |
08:20:48 | FromGitter | <mratsim> foldl* |
08:28:54 | * | dddddd joined #nim |
08:30:17 | * | endragor quit (Remote host closed the connection) |
08:31:36 | * | endragor joined #nim |
09:08:42 | * | floppydh joined #nim |
09:10:59 | * | couven92 joined #nim |
09:21:20 | * | stefanos82 quit (Remote host closed the connection) |
09:25:52 | * | ftsf joined #nim |
09:39:37 | * | nandraj joined #nim |
09:40:14 | nandraj | Hi |
09:47:52 | * | zakora joined #nim |
09:48:39 | * | stefanos82 joined #nim |
09:52:17 | Araq | nandraj, welcome |
09:52:49 | nandraj | Thanks. |
09:53:04 | nandraj | Just started to use Nim |
09:53:10 | * | xace quit (Ping timeout: 250 seconds) |
09:53:19 | nandraj | After python |
09:56:06 | * | PMunch_ joined #nim |
09:56:24 | * | PMunch_ is now known as PMunch |
09:57:15 | * | nandraj is now known as Nandraj |
10:00:09 | * | dom96_w joined #nim |
10:02:14 | * | xace joined #nim |
10:28:56 | * | PMunch quit (Remote host closed the connection) |
10:29:14 | * | PMunch joined #nim |
10:32:34 | FromGitter | <mratsim> welcome |
10:35:54 | * | platoff joined #nim |
10:36:24 | FromGitter | <alehander42> what are your impressions |
10:55:00 | * | noonien quit (Quit: Connection closed for inactivity) |
11:01:08 | FromGitter | <timotheecour> welcome :) |
11:03:00 | FromGitter | <Vindaar> @narimiran for once I stayed in bed. Colleague got his PhD yesterday and my professor always has a party that evening at his place. Will do it after lunch. Back tomorrow morning :) |
11:05:04 | FromGitter | <narimiran> hey @Vindaar! i wish i could swap with you :) i was awake (before my alarm clock) from 5:10, and all for nothing — i've overcomplicated my solution and took me lots of trial and error to finally get the correct solution |
11:06:39 | FromGitter | <Vindaar> Ouch, you need sleep! Or were you so exited for the challenge? ;) |
11:07:16 | FromGitter | <narimiran> i have no idea what's going on, but i guess today i'll be in my bed at 9 pm :D |
11:08:06 | FromGitter | <narimiran> btw, for those who are not involved: Nim private leaderboard for AoC has more than 100 members!! (i am very pleasantly surprised) |
11:08:24 | FromGitter | <Vindaar> Sounds like a good plan. I try to go to bed early every day so that I can stay awake after the challenge is done. But I always stay up late anyways :| |
11:16:14 | FromGitter | <mratsim> I guess after the standard lib we need the aoclib |
11:17:21 | FromGitter | <narimiran> @mratsim even just tuple unpacking in for-loops would already make our solutions much nicer :) |
11:18:53 | FromGitter | <mratsim> oh yeah tuple unpacking would be nice |
11:25:32 | * | CcxWrk quit (Read error: Connection reset by peer) |
11:25:46 | * | CcxWrk joined #nim |
11:26:11 | Araq | for a, b in items() ? |
11:26:27 | Araq | there was a syntax for it... |
11:27:36 | * | Ven`` joined #nim |
11:27:52 | FromGitter | <narimiran> Araq: this: https://github.com/nim-lang/Nim/issues/7486 |
11:34:46 | Araq | yeah, see? I'm right |
11:36:49 | FromGitter | <narimiran> true, i forgot about `items`, but as mentioned there, it doesn't solve the problem when you want to have both index and tuple unpacking. |
11:39:30 | * | freddy92 joined #nim |
11:42:56 | * | fredrik92 quit (Ping timeout: 244 seconds) |
11:52:55 | * | ng0 joined #nim |
12:11:09 | Araq | I found out why IC is slow |
12:11:36 | Araq | the AST is serialized multiple times |
12:14:09 | * | Ven`` quit (Ping timeout: 268 seconds) |
12:15:27 | * | Ven`` joined #nim |
12:23:11 | FromGitter | <mratsim> @narimiran important comment: https://github.com/nim-lang/Nim/issues/7486#issuecomment-444081693 |
12:23:33 | edcragg | mratsim: ah cool, thanks i'll have a look. didn't realise nim had fold either, nice |
12:25:05 | edcragg | i'm also new and liking nim a lot so far, coming from C, python and rust as main languages, it's a great middleground, the type system is reassuringly handy so far |
12:27:19 | FromGitter | <mratsim> if you like functional programming, this has a lot of utilities: https://github.com/vegansk/nimfp |
12:27:38 | FromGitter | <mratsim> or zero-functional to use that on base seqs: https://github.com/zero-functional/zero-functional |
12:28:02 | FromGitter | <mratsim> or my own lib if you want to work with optimised for loop: https://github.com/numforge/loop-fusion |
12:30:33 | PMunch | Uhm, Error: unhandled exception: invalid integer: 0: [ValueError] |
12:35:27 | PMunch | Oh never mind |
12:48:40 | edcragg | mratsim: very fancy :) ta |
12:48:44 | edcragg | any monads? (kidding of course :P) |
12:49:45 | FromGitter | <mratsim> here you go: https://github.com/unicredit/emmy |
12:49:58 | FromGitter | <mratsim> Monoid, Groups, Euclidean rings |
12:50:36 | edcragg | hmmm |
12:51:12 | FromGitter | <mratsim> implementing a lift proc is easy as well: https://github.com/numforge/laser/blob/master/laser/private/lift.nim |
12:51:27 | FromGitter | <mratsim> I’m trying to find again the haskell like instance package |
12:51:52 | * | Vladar quit (Remote host closed the connection) |
12:51:59 | FromGitter | <mratsim> ah, here you go: Functors - https://github.com/nigredo-tori/classy |
13:02:06 | * | CcxWrk quit (Ping timeout: 250 seconds) |
13:06:31 | * | PrimHelios joined #nim |
13:09:24 | FromGitter | <alehander42> wow, impressive :D |
13:27:52 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:31:04 | * | zakora quit (Quit: WeeChat 2.2) |
13:31:23 | * | jakob0094 joined #nim |
13:31:53 | * | Vladar joined #nim |
13:37:13 | * | nsf quit (Quit: WeeChat 2.3) |
13:42:23 | * | platoff joined #nim |
13:45:58 | FromDiscord_ | <technicallyagd> Ah, so private leader board can have more than 100 people |
13:46:27 | FromDiscord_ | <technicallyagd> Ah, so private leader board for AoC can have more than 100 people |
13:55:37 | FromGitter | <zacharycarter> Not sure if this is an issue or not - it doesn't appear to cause any issues during runtime - but I figured I'd share it nonetheless - ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c0687586c3c565096d175d6] |
13:56:51 | FromGitter | <narimiran> @technicallyagd the limit is 200, IIRC |
14:03:40 | * | eubn quit (Quit: ZNC 1.6.5+deb2build2 - http://znc.in) |
14:05:31 | FromDiscord_ | <technicallyagd> @narimira cool! wonder if we can reach that limit this year. |
14:07:45 | * | PrimHelios quit (Ping timeout: 246 seconds) |
14:08:01 | FromGitter | <narimiran> well, even this (103 currently) is impressive! |
14:08:10 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
14:10:14 | * | lritter joined #nim |
14:11:37 | FromGitter | <arnetheduck> hey, @Araq, @krux02 - any thoughts on ETA for https://github.com/nim-lang/Nim/issues/9494 fix? it's causing us some grief in an integer library where we put in an ugly workaround - the kind that scales poorly |
14:12:56 | * | endragor quit (Remote host closed the connection) |
14:14:11 | * | PrimHelios joined #nim |
14:30:16 | * | Trustable joined #nim |
14:30:30 | FromDiscord_ | <technicallyagd> I wrote a sequence/object unpacking/destructuring library to help with AoC. Just gonna leave it here if anyone is interested. https://github.com/technicallyagd/unpack |
14:32:44 | * | endragor joined #nim |
14:36:10 | FromGitter | <narimiran> @technicallyagd re your nimble submission: you need to put that link in the `url` field |
14:36:20 | FromDiscord_ | <technicallyagd> @narimiran yeah, I think we only had 91 people yesterday |
14:36:41 | FromDiscord_ | <technicallyagd> @narimiran oh, ok |
14:37:08 | * | endragor quit (Ping timeout: 246 seconds) |
14:37:48 | FromGitter | <narimiran> see some other packages in that .json to get an idea |
14:40:18 | FromGitter | <zacharycarter> more things to love about macOSX - the default installation of llvm / clang doesn't include address sanitizer support for leak detection, in newer versions of the operating system |
14:40:30 | FromGitter | <zacharycarter> so you're forced to install a newer non-apple version of llvm |
14:40:49 | FromGitter | <zacharycarter> but I finally got asan dumps of my leaking processes to share with bgfx author |
14:45:50 | * | Notkea quit (Ping timeout: 244 seconds) |
14:47:50 | FromDiscord_ | <technicallyagd> @narimiran done, thank you. I just `nimble publish` in the first attempt, everything seemed auto-magical so I didn't realize you have to fill in info in nim-lang/packages fork as well. |
14:51:22 | * | Vladar quit (Remote host closed the connection) |
14:55:16 | king3vbo | @technicallyagd Thanks for the link, I can see that package being helpful for AoC challenges |
14:56:28 | * | Vladar joined #nim |
14:56:54 | * | CcxWrk joined #nim |
14:58:36 | FromGitter | <zacharycarter> technicallyagd: awesome work! |
14:59:03 | FromGitter | <zacharycarter> does it support the js backend too? |
14:59:30 | FromGitter | <zacharycarter> looks like it should have no problem doing so... |
15:00:00 | FromGitter | <zacharycarter> now we just need a spread operator :P |
15:00:20 | * | Perkol joined #nim |
15:01:44 | * | kapil____ joined #nim |
15:02:01 | * | ofelas quit (Remote host closed the connection) |
15:08:12 | FromGitter | <alehander42> @technicallyagd : very nice work |
15:08:26 | FromDiscord_ | <technicallyagd> @king3vbo you're welcome, it's indeed a direct consequence of the frustration caused by AoC tasks |
15:08:29 | FromGitter | <alehander42> still, I think there can be a better API |
15:08:38 | FromGitter | <alehander42> the name = otherName thing |
15:08:40 | FromGitter | <alehander42> is very confusing |
15:09:06 | FromGitter | <alehander42> (or does it actually mean otherName = name ) ? |
15:09:09 | FromDiscord_ | <technicallyagd> @alehander42 yeah... I hesitated for quite a while there |
15:09:49 | FromDiscord_ | <technicallyagd> @alehander42 I could switch them up though |
15:10:33 | FromDiscord_ | <technicallyagd> @zacharycarter I haven't tried on js backend yet, don't see any reason why it would not work though. |
15:10:58 | FromGitter | <alehander42> @technicallyagd : and overally if we can have assigned value being left of the rvalue |
15:11:02 | FromGitter | <alehander42> it would be best |
15:11:12 | FromGitter | <alehander42> e.g. `(d, e) <- someSeq` |
15:12:12 | FromGitter | <alehander42> I have something similar in https://github.com/alehander42/gara |
15:12:14 | * | narimiran joined #nim |
15:12:20 | FromGitter | <alehander42> maybeMatches, but its more verbose |
15:12:27 | FromGitter | <alehander42> because it returns an option |
15:12:50 | FromGitter | <alehander42> however, maybe we can combine them with your lib and have more powerful direct unpacking |
15:13:59 | FromDiscord_ | <technicallyagd> Sure, I will try making it work with <- |
15:14:39 | FromDiscord_ | <technicallyagd> I preferred `.unpack(x,y)` only because it took me less key stroke with auto-complete |
15:15:09 | FromGitter | <alehander42> e.g. ⏎ ⏎ [(b: 1), *(b: @others)] <- [(b: 1), (b: 3), (b: 5)] ⏎ echo others # [(b: 3), (b: 5)] [https://gitter.im/nim-lang/Nim?at=5c0699fd1c439034af190b63] |
15:15:47 | FromGitter | <alehander42> (if we combine gara & <-/unpack, we can use most of the pattern matching niceties for unpacking) |
15:20:06 | narimiran | that sounds nice |
15:20:12 | * | Perkol quit (Ping timeout: 272 seconds) |
15:21:22 | * | krux02 quit (Ping timeout: 246 seconds) |
15:22:23 | * | seni joined #nim |
15:31:27 | * | gangstacat quit (Quit: Ĝis!) |
15:34:15 | * | Perkol joined #nim |
15:34:17 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:36:39 | * | ftsf quit (Ping timeout: 246 seconds) |
15:36:58 | FromGitter | <mratsim> @zacharycarter Apple doesn’t include OpenMP as well in OSX (aka, use Grand Central Dispatch). So you need to use GCC or upstream LLVM compiled from source. |
15:38:42 | * | endragor joined #nim |
15:39:58 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:41:13 | * | PMunch quit (Remote host closed the connection) |
15:43:10 | * | Trustable quit (Remote host closed the connection) |
15:43:18 | * | endragor quit (Ping timeout: 250 seconds) |
15:45:28 | FromGitter | <arnetheduck> why is it that var parameters cannot be captured? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c06a1188fa4333e393af305] |
15:46:55 | leorize | in `devel` there's an error message saying that it messes with memory safety so it's forbidden afair |
15:47:11 | * | Tyresc joined #nim |
15:54:05 | FromGitter | <alehander42> @arnetheduck aren't captured args just copied somewhere? how would that work with var (just speculating) |
15:54:06 | * | gangstacat joined #nim |
15:54:36 | narimiran | i have a `Table[int, array[60, int]]` is there a way to simplify `var bleh: array[60, int]; myTable[key] = bleh`? |
15:55:20 | * | floppydh quit (Quit: WeeChat 2.3) |
15:55:33 | Araq | not really |
15:56:40 | Araq | myTable[key] = [0] &* 60 |
15:56:55 | Araq | but we don't have a &* operator |
15:57:05 | FromGitter | <mratsim> lol for a moment I stopped |
15:57:21 | FromGitter | <arnetheduck> @alehander42 well, that code is the moral equivalent of: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c06a3e0500e8e37285c15c5] |
15:57:39 | narimiran | @mratsim you're not the only one :) |
15:57:45 | FromGitter | <arnetheduck> (the echo was wrong in the example, but that's beside the point) |
15:58:15 | FromGitter | <mratsim> otherwise @miran: ⏎ ⏎ ```type array60 = array[60, int] ⏎ myTable[key] = array60()``` [https://gitter.im/nim-lang/Nim?at=5c06a4179aec405095c71738] |
15:58:35 | FromGitter | <mratsim> actually it might not work with arrays |
15:59:01 | Araq | arnetheduck: hiding the 'var' in a tuple is not supposed to change anything |
15:59:35 | narimiran | @mratsim: "Error: object constructor needs an object type" it seemed too good to be true :) |
15:59:47 | FromDiscord_ | <technicallyagd> @mratsim make a proc called array60 and return array[60,int] lol |
16:00:28 | FromGitter | <alehander42> you can have initArray(n: int) template which makes block: with blah |
16:00:47 | FromGitter | <arnetheduck> @narimiran ⏎ ⏎ ```proc empty(T: typedesc): T = discard ⏎ myTable[key] = empty(array[60, int)``` [https://gitter.im/nim-lang/Nim?at=5c06a4afa6c29a1037e1face] |
16:00:53 | narimiran | @technicallyagd that would make it like my yesterday's attempt to use template, and in the end i saved whopping 2 lines :D |
16:00:58 | FromGitter | <alehander42> m[key] = initArray(60) |
16:01:02 | FromGitter | <alehander42> or even |
16:01:19 | FromGitter | <alehander42> m[key] = initArray60 (0) |
16:01:29 | FromGitter | <alehander42> ugh `initArray60 ()` |
16:01:37 | FromGitter | <mratsim> I’d like a `&*` operator in Nim sugar. Python uses [0] * 30 a lot |
16:01:47 | narimiran | `initArray` seems like most idiomatic solution |
16:01:48 | FromDiscord_ | <technicallyagd> @narimiran lol |
16:02:05 | FromGitter | <mratsim> initArray exists? |
16:02:09 | narimiran | nope |
16:02:35 | FromGitter | <mratsim> @Araq do you agree on the `&*` name? |
16:02:40 | FromGitter | <mratsim> in Nim sugar |
16:02:56 | FromGitter | <arnetheduck> @alehander42 you need to pass `int` as well for an array |
16:02:59 | FromGitter | <mratsim> maybe with initArray alias |
16:03:07 | FromGitter | <mratsim> or initArrayWith* |
16:03:20 | FromGitter | <arnetheduck> `empty` solves that generically, not just for arrays... |
16:03:37 | narimiran | @mratsim can you give some examples where you would use `&*`? |
16:04:08 | narimiran | btw, this problem of mine would be in python be solved by using defaultdict ;) |
16:04:12 | FromGitter | <mratsim> [0] &* 10 to initialize an array with 10 zeros |
16:04:42 | FromGitter | <mratsim> or [1, 2] &* 5 to initialize an array [1, 2, 1, 2, 1, 2, 1, 2, 1, 2] |
16:04:48 | FromGitter | <alehander42> @arnetheduck I didn't know of empty, it sounds better probably |
16:05:06 | FromGitter | <alehander42> @mratsim why not just repeat([0], 10) |
16:05:13 | narimiran | eh, zeros are poor example, because i thought "why don't you do it with `array[10, int]`, but non-zero values make kinda sense |
16:05:14 | FromGitter | <alehander42> we already have a repeat for seq/string |
16:05:18 | FromGitter | <mratsim> repeat creates a seq |
16:05:35 | FromGitter | <mratsim> to mimic Python `*` operator. |
16:05:44 | FromGitter | <alehander42> yeah, but repeat *is* `*` |
16:05:45 | FromGitter | <mratsim> and he suggested `&*` |
16:05:54 | FromGitter | <alehander42> hm |
16:05:59 | FromGitter | <arnetheduck> @Araq, I don't understand you comment - I just used `tuple` to show how captures are implemented |
16:06:51 | FromDiscord_ | <technicallyagd> does `*` do anything with arrays now? |
16:07:18 | FromDiscord_ | <technicallyagd> Would there be any problem if we just use `[0] * 60` |
16:07:21 | FromDiscord_ | <technicallyagd> Would there be any problem if we just use `[0] * 60`? |
16:07:24 | FromGitter | <alehander42> yeah, in this case why not just overloading `*`, technicallyagd is right |
16:07:45 | narimiran | one might say... he is technicallycorrect! |
16:07:55 | * | narimiran shows himself out |
16:08:07 | FromDiscord_ | <technicallyagd> best kinda correct! |
16:08:13 | * | dom96_w joined #nim |
16:09:56 | FromDiscord_ | <technicallyagd> but seriously, I think it would be nice to just mimic python's syntax here, since it's familiar to most people. |
16:10:08 | FromDiscord_ | <technicallyagd> but seriously, I think it would be nice to just mimic python's syntax here, since most people is familiar with it. |
16:10:20 | FromDiscord_ | <technicallyagd> but seriously, I think it would be nice to just mimic python's syntax here, since most people are familiar with it. |
16:10:43 | narimiran | (every your edit is another message for us on irc ;)) |
16:11:14 | FromDiscord_ | <technicallyagd> LOL sorry for the bad grammar then. |
16:11:54 | * | Perkol quit (Ping timeout: 250 seconds) |
16:13:50 | FromGitter | <Vindaar> simple and works :) https://gist.github.com/Vindaar/6d0e550e9b8944b30f6b030deda271fc |
16:16:25 | FromDiscord_ | <hotdog> Any idea why this would happen: |
16:16:28 | FromDiscord_ | <hotdog> /usr/bin/ld: stdlib_system.c.o: in function `systemDatInit000': undefined reference to `NTI_hmZoNQaqzZALvVp0rE7faA_' |
16:17:13 | FromDiscord_ | <hotdog> Can't get a small example to reproduce it, but it keeps happening in a fairly large program |
16:19:16 | Araq | [0] * 60 == [0], that's why... |
16:19:29 | leorize | hotdog: have you tried cleaning the nimcache? |
16:19:42 | Araq | [0, 1, 2] * 60 == [0, 60, 120] |
16:20:09 | Araq | &* is a repeated concatenation, not a multiply |
16:21:36 | FromDiscord_ | <hotdog> @leorize yeah, and tried stable and devel |
16:22:00 | FromGitter | <arnetheduck> @Araq, should i open a bug about `var` capture, or is it intended that way? ie if the capture leaks outside the context of the var, it's kind of dangerous.. |
16:22:40 | FromGitter | <arnetheduck> but then it should be disallowed for local `var`'s as well |
16:26:05 | * | Perkol joined #nim |
16:26:57 | Araq | well it's intended that it doesn't compile |
16:27:06 | Araq | and what are local vars? |
16:30:28 | FromDiscord_ | <technicallyagd> @Vindaar That is cool! You can even do this https://gist.github.com/technicallyagd/9626195fee66d3ea71aaee2f2234ee71 |
16:33:06 | FromDiscord_ | <technicallyagd> @Araq do you mean the `*` operator's connotation in general? Or is that how it's going to be implemented in the future? |
16:33:15 | FromGitter | <arnetheduck> ```code paste, see link``` ⏎ ⏎ this compiles and effectively does the exact same thing [https://gitter.im/nim-lang/Nim?at=5c06ac4a9f38cc0fd5a40da7] |
16:33:54 | FromGitter | <arnetheduck> or no? I always forget how var is handled in that case |
16:35:23 | FromGitter | <arnetheduck> a nevermind, my bad |
16:35:47 | FromGitter | <arnetheduck> that one will modify a local copy, right? |
16:37:39 | FromGitter | <Vindaar> @technicallyagd nice, indeed! Added the same to my gist after I saw @mratsim's comment about that :) |
16:38:20 | FromDiscord_ | <hotdog> How can I figure out what is causing stdlib_system.c to generate incorrectly? |
16:40:07 | FromDiscord_ | <technicallyagd> @Vindaar would there be any difference between using `array.len` and `static[int]` ? |
16:40:30 | FromDiscord_ | <technicallyagd> in terms of compilation speed |
16:41:43 | FromGitter | <arnetheduck> so.. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ if I do that, c will capture y from x's stack and.. what happens when the returned capture is called? [https://gitter.im/nim-lang/Nim?at=5c06ae47464b6c0fd68dfe03] |
16:41:48 | leorize | hotdog: only big programs face this problem? can you try to strip your program down to pieces and see if there can be any reproducible snippet? |
16:42:28 | leorize | technicallyagd: shouldn't be any |
16:42:48 | FromGitter | <arnetheduck> if I get all the pointers right, it'll have a pointer to x's stack that it writes to (invalidly), and xxx remains unmodified |
16:43:10 | FromGitter | <Vindaar> @technicallyagd well, even if there was a difference, the access to `len` of a should hardly matter time wise. But your solution is clearer, imo |
16:43:54 | FromDiscord_ | <technicallyagd> @Vindaar @leorize I see, thank you. |
16:44:25 | FromDiscord_ | <hotdog> @leorize I've tried to get a simple reproduction, but even small changes to the program make it go away. And then a while later it reappears |
16:44:55 | FromDiscord_ | <hotdog> I'll keep on and see if I can get a small example |
16:49:41 | FromDiscord_ | <hotdog> If I switch to js output I get `Error: internal error: genTypeInfo(tyEmpty)`. Not sure what's causing that |
16:51:55 | FromGitter | <zacharycarter> @mratsim - annoying |
16:52:24 | leorize | hotdog: have you tried the c++ generator? |
16:53:49 | FromDiscord_ | <hotdog> leorize: Yeah cpp gives same error as c - `/usr/bin/ld: stdlib_system.cpp.o: in function `systemDatInit000()': undefined reference to `NTI_hmZoNQaqzZALvVp0rE7faA_'` |
16:54:40 | leorize | weird, maybe check the cpp file to see what is `NTI_<some hash>_`? |
16:56:55 | FromDiscord_ | <hotdog> There are two references to it, `extern TNimType NTI_hmZoNQaqzZALvVp0rE7faA_;` and `NTI_77YVzYb2AOu2vP0iI0b8Dw_.base = (&NTI_hmZoNQaqzZALvVp0rE7faA_);` |
17:02:45 | FromDiscord_ | <hotdog> What is TNimType? Can't find much about it |
17:08:06 | leorize | maybe Araq can help with that |
17:11:10 | FromGitter | <arnetheduck> `TNimType` is runtime type information - if you haven't already, clear your nim cache and try again - if it still fails, it's probably a bug where it's not getting generated properly |
17:11:24 | FromGitter | <arnetheduck> ^ @hotdog |
17:15:08 | FromDiscord_ | <hotdog> arnetheduck: thanks - Just cleared cache but issue still there |
17:15:24 | FromDiscord_ | <hotdog> Is there any way I can find which type is causing it? |
17:15:58 | * | PrimHelios quit (Quit: Leaving) |
17:20:24 | leorize | hotdog: try searching for the hash in the .cpp files |
17:21:30 | FromDiscord_ | <hotdog> The only references to it are the two I pasted above |
17:27:04 | leorize | you mean looking for 'hmZoNQaqzZALvVp0rE7faA' in the cache only result in two occurrences? |
17:27:47 | FromDiscord_ | <hotdog> leorize: Yeah |
17:27:49 | leorize | then that'd mean the type info was generated for a type that doesn't exist somehow... |
17:27:56 | FromDiscord_ | <hotdog> Well two for c, two for cpp |
17:28:02 | FromDiscord_ | <hotdog> Pretty much identical |
17:29:30 | FromDiscord_ | <hotdog> @leorize: I do have a lot of generic types/procs going on |
17:31:24 | * | PrimHelios joined #nim |
17:31:31 | leorize | can you check in which function was that typeinfo object being assigned to? |
17:31:54 | leorize | hmm, during initialization of the system module |
17:32:18 | * | nsf joined #nim |
17:32:35 | * | PrimHelios quit (Client Quit) |
17:32:52 | shashlick | am trying gprof - its not quite as helpful to tell what to optimize in my nim code |
17:34:31 | FromDiscord_ | <hotdog> @leorize: you mean `systemDatInit000()`? |
17:35:24 | * | PrimHelios joined #nim |
17:35:57 | * | PrimHelios quit (Client Quit) |
17:36:46 | leorize | wait, can you search for this hash '77YVzYb2AOu2vP0iI0b8Dw'? |
17:38:54 | FromGitter | <alehander42> shashlick: I used perf today, and it helped me after a bit battling |
17:39:03 | FromGitter | <alehander42> what do you want to find out? hotspots? |
17:39:38 | shashlick | trying to optimize nimterop a bit - it's slower than i'd like |
17:39:45 | shashlick | is pegs faster than nim-regex |
17:40:00 | narimiran | shashlick: in my limited experience, it was |
17:40:15 | FromGitter | <matrixbot> `rad_wagon` Hey all, I'm having an issue with threads and channels. Here (https://pastebin.com/wFwMQzLj) is a pastebin. The compiler is giving an error that `Channel` is an invalid type to assign to a `var` Not exactly sure what the proper way to handle this since most of the examples I've seen are this way |
17:40:16 | narimiran | but i guess it might be on case-by-case basis |
17:40:27 | shashlick | ok i'm wondering if i should move to pegs or compile my regex patterns at compile time |
17:41:53 | narimiran | shashlick: sorry, i somehow mis-read and thought you're asking about nre. i didn't use pegs |
17:42:11 | FromDiscord_ | <hotdog> @leorize: that gives more results, referencing `tySequence_77YVzYb2AOu2vP0iI0b8Dw*1` |
17:42:16 | FromDiscord_ | <hotdog> Where did that hash come from? |
17:42:22 | shashlick | narimiran: no worries, will try it out |
17:45:39 | leorize | hotdog: that hash come from the assignment you found earlier |
17:46:32 | FromGitter | <Vindaar> @rad_wagon: Your channel needs specific type! E.g. `Channel[string]` |
17:49:20 | * | kapil____ quit (Quit: Connection closed for inactivity) |
17:50:14 | FromDiscord_ | <hotdog> @leorize ah yeah I see. So is it likely this problematic type is in a seq? |
17:50:32 | leorize | yea |
17:51:31 | FromGitter | <matrixbot> `rad_wagon` > <@gitter_vindaar:matrix.org> @rad_wagon: Your channel needs specific type! E.g. `Channel[string]` ⏎ ⏎ Ah, thanks! I then see that the compiler tells me that my `channel.open()` call has no type. Shouldn't the type be infered from the `var` declaration if I declare it like `var channel: Channel[string]` ? |
17:51:42 | * | zachk joined #nim |
17:53:07 | * | zachk quit (Changing host) |
17:53:07 | * | zachk joined #nim |
17:53:58 | leorize | why is there a matrixbot on gitter? :P |
17:55:29 | * | kapil____ joined #nim |
17:56:02 | FromGitter | <Vindaar> rad_wagon: Not entirely sure, but I reckon the error you see on `channel.open()` is that you write `discard` before it. Thus the compiler is telling you that `channel.open()` has no type, meaning it doesn't return anything. Remove the `discard` and it'll work |
17:58:31 | FromDiscord_ | <hotdog> @leorize: thank you so much for your help! I think I've narrowed it down to a few troublesome type definitions that may be causing it |
17:59:05 | FromDiscord_ | <hotdog> I'm going to carry on tomorrow and see if I can get a small reproducible example, and fix the issue |
17:59:18 | leorize | you're welcome :) |
18:00:41 | * | junland quit (Quit: Disconnected.) |
18:01:14 | * | junland joined #nim |
18:02:56 | FromGitter | <matrixbot> `rad_wagon` > <@gitter_vindaar:matrix.org> rad_wagon: Not entirely sure, but I reckon the error you see on `channel.open()` is that you write `discard` before it. Thus the compiler is telling you that `channel.open()` has no type, meaning it doesn't return anything. Remove the `discard` and it'll work ⏎ ⏎ Works! Thanks! |
18:03:13 | FromGitter | <Vindaar> happy to help :) |
18:09:26 | narimiran | @Vindaar less helping others, more AoC solving! :P |
18:10:02 | FromGitter | <arnetheduck> what's the best way to get a reference to an item in a list? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c06c2fa43c68b3727fca2a2] |
18:11:29 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:12:35 | narimiran | @arnetheduck ` var x = addr v[1]; x[] = 42`? |
18:13:42 | shashlick | Araq: I didn't see much improvement in speed going from closure to proc but they are procs inside a proc |
18:13:55 | FromGitter | <arnetheduck> @narimiran thanks, that's a good one, though it's easy to overlook / forget the `addr` |
18:14:06 | shashlick | 0.3 seconds reduction from 8 seconds |
18:15:22 | FromGitter | <arnetheduck> shashlick, not sure what you're doing, but generally closures can get inlined just like normal functions when enough information is available to the compiler.. |
18:16:19 | FromGitter | <arnetheduck> for example, as long as the closure doesn't escape its context there "should" be no difference between a closure call and a regular call |
18:17:27 | * | Perkol quit (Ping timeout: 240 seconds) |
18:18:01 | FromGitter | <arnetheduck> conversely, if the problem requires an escaping closure, any alternate solution will require you to manually do what the closure did - or it didn't require it after all and you were just sloppy :) |
18:18:52 | FromGitter | <arnetheduck> (there are some specific cases where that doesn't apply) |
18:19:29 | FromGitter | <Vindaar> @narimiran :D will head home soon and it's AoC time :) |
18:20:06 | narimiran | @Vindaar you better! :P and tomorrow morning you'll be ready? |
18:20:15 | FromGitter | <Vindaar> Yes, I will! |
18:20:34 | narimiran | :) |
18:23:31 | * | endragor joined #nim |
18:28:46 | FromDiscord_ | <technicallyagd> @alehander42 I have added the <- syntax to unpack https://github.com/technicallyagd/unpack let me know how you feel about it. |
18:29:45 | shashlick | thanks @arnetheduck |
18:30:02 | narimiran | at one point in readme you have `<--` is this a typo, or is it valid (and means something different than `<-`)? |
18:31:03 | shashlick | @arnetheduck: here's what i'm doing - https://github.com/genotrance/nimterop/blob/master/nimterop/grammar.nim#L5 |
18:32:55 | * | theelous3_ joined #nim |
18:33:57 | narimiran | ok, now i see in the tests: "<-- should assign data to existing variables" |
18:34:40 | * | nsf quit (Quit: WeeChat 2.3) |
18:38:38 | shashlick | is @nitely here? |
18:44:05 | FromGitter | <alehander42> @techicallyagd oh looks much better |
18:44:19 | FromGitter | <alehander42> is it possible to do for let the same as for `[var d2, e2] <- someSeq` |
18:44:43 | FromGitter | <alehander42> and then `[a, b] <- ` can be for existing variables: more uniform |
18:44:50 | FromGitter | <alehander42> and easy to sport let declarations still |
18:45:12 | narimiran | @technicallyagd 'unpack' looks really nice! will follow its development |
18:45:55 | FromDiscord_ | <technicallyagd> @narimiran Thank you! 😄 |
18:46:54 | FromDiscord_ | <technicallyagd> @alehander42 unfortunately `[let d2, e2] <- someSeq` causes compile error |
18:47:06 | narimiran | unpack + gara = very powerful combo |
18:47:15 | FromDiscord_ | <technicallyagd> That's why I had to use `<--` for assignment |
18:47:31 | FromGitter | <alehander42> yeah it makes sense |
18:48:06 | FromGitter | <alehander42> narimiran, I think `<-` can be made to work with gara, but it would need to use `@name` for captures(variables) |
18:48:44 | shashlick | how come you cannot store a Regex object in nim-regex? if I put it into an object or seq, it stays uninitialized and unusable |
18:48:48 | FromDiscord_ | <technicallyagd> Because I think assignment will be used less often, so making people to type one more repetitive key stroke seemed reasonable |
18:48:59 | * | abm joined #nim |
18:49:21 | narimiran | @alehander42 gara already uses `@name`, so that would be consistent. (i haven't used that feature just yet) |
18:49:54 | narimiran | shashlick: code example please? |
18:51:35 | FromDiscord_ | <technicallyagd> Lol, I haven't got time to check out what gara does. Will definitely do that later. I got to go now. see you guys later. |
18:52:15 | FromGitter | <arnetheduck> @shashlick, doesn't look like you're actually capturing anything in there (on a very quick look), so it's basically equivalent to an indirect function call (ie call a function through a pointer).. you could move those closures to stand-alone functions and it wouldn't be any different |
18:52:46 | shashlick | so I don't get any performance gains or losses in either case |
18:53:03 | shashlick | @arnetheduck - I just want the strings and procs adjacent |
18:55:37 | shashlick | narimiran: never mind, figured out my mistake |
18:55:44 | narimiran | :) |
18:56:05 | FromGitter | <alehander42> @narimiran @techicallyagd well the problem is that gara does the capturing itself, so it would have to expose this directly as a capture(input, pattern) ⏎ which can be called by into pattern <- input ⏎ ⏎ so most work would be to expose this `capture` and add support for tweaking let/var directly into the patterns [https://gitter.im/nim-lang/Nim?at=5c06cdc543c68b3727fceb91] |
18:56:31 | FromGitter | <alehander42> I am not sure if there is a way to make that without it being inside gara's internals |
18:56:53 | shashlick | narimiran: i think the problem i have is that if I just say var rgx: Regex, i have no way to check if that regex is initialized or not |
18:57:14 | FromGitter | <alehander42> otherwise maybe just simpler unpacking with `<-` being separate from gara is cool too, I dont know |
18:57:20 | Araq | yay, from 25s down to 4s |
18:57:27 | Araq | that's some progress. |
18:57:55 | Araq | now if we can get it down to 0.4s we've won |
18:58:07 | FromGitter | <alehander42> how much is it without incremental? |
18:58:12 | Araq | 4s :P |
18:58:16 | FromGitter | <alehander42> haha |
18:58:19 | narimiran | :D :D |
18:58:37 | Araq | but I did no low level optimizations yet |
18:58:42 | Araq | and the logic is still incomplete |
18:58:43 | FromGitter | <alehander42> your pc is more powerful than mine! |
18:59:17 | Araq | but I think it's fair to say we are now at "in the worst case the cache doesn't hurt" |
19:02:34 | * | endragor quit (Remote host closed the connection) |
19:05:38 | FromGitter | <alehander42> wirth's law: now we can write way slower/more complex macros :D |
19:06:20 | shashlick | oh man what an improvement - i was compiling regex patterns thousands of time - fixed that and now nimterop runs in 0.369 seconds, down from 8 seconds |
19:06:36 | shashlick | and this is still not release mode |
19:07:13 | narimiran | shashlick: you had your pattern inside of some loop? |
19:07:34 | shashlick | ya and its still a crappy workaround since i have no way to check if a regex is initialized or not |
19:08:02 | shashlick | i'll improve it but this was just for testing |
19:09:02 | narimiran | shashlick: sorry for the stupid question, but what do you mean when you say "initialized (or not) regex"? |
19:10:02 | shashlick | so if you do var rgx: Regex, it gets initialized with something. if i later want to check and then initialize it, like you would with something that's nil, you cannot |
19:12:39 | * | masquino quit (Quit: WeeChat 1.9.1) |
19:12:58 | narimiran | hmm, it's been a long time since i used regex in nim (last year's AoC), but i don't remember stumbling on these kinds of problems :/ |
19:13:17 | shashlick | that's because in most cases, you just create and use your regex right away |
19:13:49 | narimiran | true |
19:15:06 | * | Vladar quit (Remote host closed the connection) |
19:20:36 | leorize | shashlick: you could use 'Option[T]' to abstract away the uninitalized state |
19:21:37 | shashlick | leorize: good idea - will keep in mind |
19:22:32 | shashlick | so in case anyone cares, using re (pcre) vs regex in nimterop, I see 0.07 vs 0.095 in release mode as far as time is concerned |
19:29:26 | * | narimiran quit (Remote host closed the connection) |
19:43:30 | * | kungtotte joined #nim |
19:44:19 | shashlick | can you create an object at compile time that contains pointers to procs? |
20:00:43 | * | tdc quit (Quit: Leaving) |
20:06:25 | * | PMunch joined #nim |
20:09:20 | * | kapil____ quit (Quit: Connection closed for inactivity) |
20:15:45 | Araq | shashlick, yeah |
20:28:27 | * | Yardanico quit (Ping timeout: 240 seconds) |
20:48:51 | shashlick | meh - i created a table of objects at compile time and consumed at runtime - it is slower than doing everything at runtime |
21:03:04 | * | endragor joined #nim |
21:07:54 | * | endragor quit (Ping timeout: 272 seconds) |
21:19:24 | Araq | er, yglukhov[m] in lambdalifting.nim why are nkFuncDef not handled like nkProcDef? This makes no sense whatsoever |
21:23:45 | * | noonien joined #nim |
21:38:10 | * | PMunch quit (Read error: Connection reset by peer) |
21:49:46 | * | stefanos82 quit (Remote host closed the connection) |
21:51:27 | * | Jesin quit (Quit: Leaving) |
21:54:10 | * | Jesin joined #nim |
22:04:49 | FromGitter | <Vindaar> @narimiran phew, day4 took me 53 minutes for both parts :O |
22:29:18 | FromGitter | <zetashift> I'm stuck on day3 |
22:29:25 | * | vlad1777d quit (Ping timeout: 246 seconds) |
22:37:33 | * | xet7 quit (Quit: Leaving) |
22:45:01 | * | shpx joined #nim |
22:50:01 | FromGitter | <zetashift> Does nim-csfml support 2.4? |
22:55:26 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:55:29 | FromGitter | <citycide> @technicallyagd I like unpack, the new operators look great. anyone know why the `[let a, b] <- foo` syntax doesn't with though? |
22:55:54 | FromGitter | <citycide> work*. and could it |
23:04:52 | FromGitter | <citycide> @alehander42 really starting to love gara btw. was working on array support but got a bit confused by the condition that's generated |
23:06:25 | FromGitter | <citycide> considering it doesn't seem called whatsoever. if you use a capture the `repr` shows a let declaration right in the middle of the `and` chain |
23:06:50 | FromGitter | <citycide> doesn't seem valid* |
23:09:04 | FromGitter | <Vindaar> @citycide I guess `[let a, b] <- foo` isn't supported, because the default `[a, b] <- foo` means just that? ⏎ @zetashift anything specific you struggle with on day 3? |
23:09:59 | FromGitter | <citycide> @Vindaar no it's actually not syntactically possible apparently |
23:10:19 | FromGitter | <Vindaar> oh, I see |
23:10:36 | FromGitter | <zetashift> @Vindaar nothing I shouldn't be able to do with some proper problem solving thinkering :P |
23:10:39 | FromGitter | <zetashift> tinkering* |
23:14:18 | FromGitter | <citycide> I suppose the "why" is that `let` isn't a type like `var`, `ref` etc. which means that syntax likely would never be possible unfortunately |
23:50:10 | * | Tyresc quit (Quit: WeeChat 2.3-dev) |
23:55:02 | * | kapil____ joined #nim |