00:00:03 | * | ghost64 quit (Quit: See you!) |
00:01:00 | * | ghost64 joined #nim |
00:39:47 | * | Snircle_ quit (Quit: Textual IRC Client: www.textualapp.com) |
00:58:28 | PMunch | Hmm, can Nim build a table on compile-time to use at run-time? |
01:14:34 | * | sknebel quit (Ping timeout: 268 seconds) |
01:15:53 | FromGitter | <zacharycarter> PMunch: ```let table {.compileTime.} = ⏎ {"test1": "test2", ⏎ "test3": "test4" ⏎ }.toTable ⏎ ... [https://gitter.im/nim-lang/Nim?at=5c01e0c9a6c29a1037c45973] |
01:16:36 | PMunch | Yeah I know I can do that, but I wanted to read a file on compile-time to generate that |
01:16:48 | PMunch | I guess I could do it with a macro that creates the code to create that table.. |
01:17:11 | FromGitter | <zacharycarter> sure |
01:17:12 | * | sknebel joined #nim |
01:18:23 | PMunch | Oh well, it was just something I thought I'd try to use the same kind of atlases that SDLGamelib uses (created by TexturePacker) with gamelight |
01:19:09 | PMunch | SDLGamelib just reads the atlas file in at run-time, but gamelight being run in the browser won't be able to easily to that (unless of course I just load the atlas as text..) |
01:19:22 | PMunch | Oh well, good night |
01:19:23 | * | PMunch quit (Remote host closed the connection) |
01:20:32 | FromGitter | <zacharycarter> night! |
01:38:03 | * | zachk quit (Quit: Leaving) |
01:56:16 | dom96 | So, who's doing Ludum Dare? :) |
02:16:24 | * | abm quit (Quit: Leaving) |
02:24:26 | * | ng0_ joined #nim |
02:27:19 | * | ng0 quit (Ping timeout: 256 seconds) |
02:46:38 | FromGitter | <rayman22201> I won't be able to :-( .... Are you streaming @dom96 ? |
02:48:17 | dom96 | Not sure I will do. I'll either have to deal with my MacBook's fan roaring or having to use my PC :/ |
02:50:16 | FromGitter | <rayman22201> You could just blast your music really loud :-P |
03:07:42 | * | banc quit (Quit: ZNC - http://znc.in) |
03:12:21 | * | rockcavera quit (Remote host closed the connection) |
03:14:29 | * | smitop_ quit (Quit: Connection closed for inactivity) |
03:23:30 | * | banc joined #nim |
03:38:42 | * | dddddd quit (Remote host closed the connection) |
04:37:24 | * | ftsf joined #nim |
04:38:20 | ftsf | ahoy! "Error: internal error: genAssignment: tyNil" any idea what causes this error? |
04:38:33 | leorize | it's an internal error, it's a bug |
04:38:48 | leorize | please file an issue with code snippet on github |
04:39:45 | ftsf | I would like to, but I'm not sure how to track down where it comes from |
04:41:37 | leorize | you could start stripping unnecessary code from the problematic code |
04:41:53 | ftsf | yeah, trying that atm |
04:42:09 | ftsf | but if i knew what the error meant I might be able to narrow it down more easily |
04:42:54 | ftsf | aha, found it |
04:43:12 | ftsf | something to do with assigning a `const` value to something |
04:43:25 | ftsf | changing it from const to let seemed to make the error go away |
04:51:16 | * | narimiran joined #nim |
04:56:23 | narimiran | ok, who's awake and waiting for AoC to start? :) |
04:56:44 | FromGitter | <Vindaar> me :) but still very tired... :D |
04:57:11 | narimiran | excuses, excuses.... :) |
04:58:07 | FromGitter | <Vindaar> :) |
05:03:05 | * | kapil____ quit (Quit: Connection closed for inactivity) |
05:12:56 | * | stefanos82 joined #nim |
05:14:18 | * | endragor joined #nim |
05:17:26 | narimiran | congrats :) see you at the same place tomorrow morning :) |
05:17:36 | FromGitter | <Vindaar> Hehe you too! :) |
05:18:04 | FromGitter | <Vindaar> I misread part 2 several times. Didn't click that the whole list went through several times |
05:24:29 | narimiran | same here. basically, i didn't read the task properly, just wanted to solve it ASAP |
05:24:39 | FromGitter | <Vindaar> yep :D |
05:29:22 | narimiran | and now i find out that parseint can deal with "+123", no need to complicate :D |
05:29:49 | FromGitter | <Vindaar> Heh, that I knew |
05:30:25 | narimiran | btw, now i see that you posted on reddit: you cannot use backticks, you need to indent your code with four spaces |
05:31:02 | FromGitter | <Vindaar> Well, that's what I thought. But for some reason it ate my 4 spaces |
05:31:13 | FromGitter | <Vindaar> Switched to markdown editing and got it working |
05:35:01 | FromGitter | <Vindaar> Anyhow, my plan to stay awake... nah :) |
05:37:30 | narimiran | good night :) |
05:39:01 | * | endragor quit (Remote host closed the connection) |
05:48:27 | * | shashlick quit (Ping timeout: 240 seconds) |
05:51:49 | * | rockcavera joined #nim |
06:04:51 | * | blarghz[m] left #nim ("User left") |
06:06:10 | * | M379229[m] joined #nim |
06:07:31 | M379229[m] | My one day of fame has arrived! |
06:07:46 | M379229[m] | Sort the nim leaderboard by global score :D |
06:08:01 | M379229[m] | (For AoC) |
06:31:16 | narimiran | M379229[m]: congrats!! |
06:40:29 | M379229[m] | Thanks. |
06:40:50 | M379229[m] | I'll bask in my pretend glory. Because it'll probably be the last day that I'm on top :) |
06:41:52 | M379229[m] | It was good fun though. Thanks for organising the leaderboard and for the blog post. |
06:47:46 | narimiran | np :) |
06:48:28 | narimiran | don't play yourself down. for example, if i want to be on the top, i first need to learn to read ;) |
06:49:27 | xace | i feel like there's a sex reference somewhere in there |
06:49:33 | narimiran | :D |
06:50:23 | * | kapil____ joined #nim |
06:53:20 | M379229[m] | You're from Croatia, right? |
06:53:25 | narimiran | right |
06:53:44 | M379229[m] | I think it's a lot harder to speed-code this if English isn't your first language. |
06:53:51 | M379229[m] | Maybe the puzzle text tomorrow will be in Croatian :) |
06:55:53 | narimiran | nah, english was not the problem. it was more like: "ok ok, let's do this fast. search for keywords.... ok, "twice" is there, i know this, let's do it, shit it doesn't work, let's try this, nope, ok, split every change and go one by one (make +3 = +1+1+1), nope, ok maybe i should read the task" |
07:00:19 | narimiran | zielmicha__: i see you've also made it on global leaderboard, but you're not in our nim group. are you using some other language to solve AoC? |
07:07:27 | * | nsf joined #nim |
07:21:45 | * | leorize quit (Ping timeout: 252 seconds) |
07:23:04 | * | leorize joined #nim |
07:27:07 | * | Trustable joined #nim |
07:41:25 | * | Vladar joined #nim |
08:23:44 | * | anamok joined #nim |
08:23:47 | anamok | hi |
08:23:53 | narimiran | hi |
08:25:20 | anamok | I solved AoC 2018 / Day 1 / Part 2 in Nim and Python. Nim runs for 0.53 sec, Python version runs for 0.05 sec. What am I doing wrong? The code is here: https://github.com/jabbalaci/AdventOfCode2018/tree/master/day01 |
08:25:49 | anamok | It's part2.nim and part2.py . The code is the same. |
08:26:14 | anamok | I have the impression that sets is slow in Python. |
08:26:29 | anamok | Sorry, slow in Nim. Sets is slow in Nim. |
08:28:16 | narimiran | my Nim solution on my computer runs in 0.8 seconds |
08:28:29 | anamok | That's a lot. |
08:28:59 | narimiran | which would make it one of the slowest solutions last year |
08:29:21 | anamok | Solve it in Python. It'll be blazingly fast. |
08:29:52 | FromGitter | <Varriount> anamok: Are you compiling with -d:release ? |
08:29:55 | narimiran | i didn't even notice it before you said. now i need to investigate what is going on |
08:30:01 | anamok | Yes, release version. |
08:30:18 | anamok | In debug mode it was 17 secs. |
08:30:24 | narimiran | @Varriount yep, my time is with -d:release |
08:37:20 | narimiran | anamok: system.set would probably be much faster, but there are some values in (my) input which are bigger than int16.high |
08:37:59 | anamok | A HashSet shouldn't be this slow. |
08:40:12 | narimiran | agreed |
08:40:50 | M379229[m] | I agree too. |
08:41:08 | M379229[m] | My nim solution runs in 0.15 s |
08:41:29 | M379229[m] | But I used sets.containsOrIncl |
08:41:33 | narimiran | anamok: i found out the solution |
08:41:36 | M379229[m] | Maybe that's faster? |
08:41:58 | narimiran | anamok: use something like this: `initSet[int](1048576)` -- boom, from 800 to 12 ms |
08:42:07 | M379229[m] | Ah, good point. |
08:42:16 | M379229[m] | :) |
08:42:20 | narimiran | (it must be a power of 2) |
08:42:35 | anamok | Is that the initial set size? |
08:42:42 | narimiran | it is |
08:43:34 | anamok | So we had a small set that was re-copied and re-hashed several times as it grew? Was it the problem? |
08:46:50 | anamok | narimiran, Good catch! My runtime is 0.00 sec :) |
08:47:05 | narimiran | i need a new computer :) |
08:47:30 | anamok | Mine is a 5-6 years old desktop. |
08:49:12 | narimiran | here i7-970, released in 2010. i'm waiting for amd zen2 |
08:51:27 | anamok | I played a bit with the set size, but it also depends on your input numbers. With 65536 it's slow. With 131072 (2 ^ 17) it's fast. In the last iteration my set size 129881, which is less than the initial capacity. |
08:51:32 | M379229[m] | For me it turns out that an initial size of 2**17 is big enough, if you want to overfit your solution... |
08:51:37 | M379229[m] | Hah. |
08:51:44 | anamok | M379229[m], right :) |
08:53:15 | anamok | Nevertheless, it's a strange thing. It's easy to overlook and it has huge impact on the performance. |
08:53:32 | narimiran | for me 2^16 seems to be enough, but as M379229[m] says, that's in overfitting area :) |
08:59:08 | * | M379229[m] sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/XxLRmgTlvFRIgTxanXcdbGmT > |
08:59:14 | M379229[m] | err |
08:59:15 | FromGitter | <alehander42> ok I solved it in 2 lines |
08:59:19 | FromGitter | <alehander42> is this good or what |
08:59:33 | FromGitter | <alehander42> i just woke up |
09:00:24 | * | M379229[m] sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/HeIbZLFKSGnnFtRMJpPnYbZl > |
09:00:50 | narimiran | @alehander i've also solved the first part in 2 lines. now you need to solve part 2 ;) |
09:00:52 | M379229[m] | So that shows you where it has to grow, I guess. |
09:00:57 | narimiran | @alehander42 |
09:00:59 | narimiran | ^ |
09:01:44 | narimiran | and those two lines could be one line :) |
09:02:37 | anamok | I went for readability, so mine is 3 lines :) |
09:04:04 | FromGitter | <alehander42> yeah @narimiran right, ok so mine is 144 |
09:04:07 | FromGitter | <alehander42> characters on 1 line |
09:04:23 | FromGitter | <alehander42> oh second part |
09:05:50 | narimiran | 76 characters oneliner (18 of those are filename of my input), without stripping any whitespace (4 more chars) |
09:06:23 | narimiran | (ok, my imports are on the separate line) |
09:06:29 | FromGitter | <alehander42> why wouldn't you call it 'a' |
09:06:36 | FromGitter | <alehander42> mate codegolf it to 57 :D |
09:07:00 | FromGitter | <alehander42> oh i remember js1k |
09:07:07 | FromGitter | <alehander42> horrible but great days |
09:07:10 | narimiran | i come from python world, and zen of python says "readability counts" ;) |
09:07:35 | FromGitter | <alehander42> well, a readable solution is probably not a 2liner too |
09:07:40 | FromGitter | <alehander42> but it might actually be |
09:08:00 | FromGitter | <alehander42> i mean i imagine in python you just eval joined lines |
09:08:07 | FromGitter | <alehander42> but we dont have eval .. or dont we |
09:08:14 | narimiran | i'll push it to github later, so you decide if it is readable and clear :) |
09:08:35 | narimiran | i didn't use eval, just some functional stuff :) (nuff said, spoilers) |
09:10:29 | FromGitter | <alehander42> me too, just written in a longer way i guess |
09:15:01 | FromGitter | <alehander42> ok, solved the second one |
09:15:05 | FromGitter | <alehander42> very slowly tho |
09:15:20 | narimiran | optimization time ahead :) |
09:17:38 | FromGitter | <alehander42> oh i have to John Nash this thing |
09:17:43 | FromGitter | <alehander42> patterns |
09:23:10 | FromGitter | <alehander42> wow |
09:23:14 | FromGitter | <alehander42> from 20s to 0.2 |
09:23:23 | FromGitter | <alehander42> ok that's enough for me |
09:23:32 | FromGitter | <alehander42> and to think i wanted to find a numeric pattern there |
09:23:35 | narimiran | and now from 0.2 to 0.02! |
09:23:44 | FromGitter | <alehander42> it's avtually 0.02 |
09:23:47 | FromGitter | <alehander42> i misread it |
09:24:02 | narimiran | ok, then you're free to go :D |
09:24:06 | FromGitter | <alehander42> nice |
09:24:15 | FromGitter | <alehander42> wow *spoiler* is slooow |
09:24:28 | FromGitter | <alehander42> *spoiler feature* |
09:26:02 | * | xet7 joined #nim |
09:29:22 | narimiran | i'm not sure what you're referring to |
09:40:39 | FromGitter | <alehander42> adding to a set |
09:40:45 | FromGitter | <alehander42> compared to other thing |
09:50:05 | * | Vladar quit (Remote host closed the connection) |
10:23:02 | anamok | narimiran, Are you here? |
10:23:08 | narimiran | anamok: i am |
10:23:36 | anamok | narimiran, I made a test here: http://ix.io/1uZi/nim . However, our previous problem with the set size is not present here. |
10:24:23 | anamok | narimiran, I don't understand why the AoC exercise was that slow. |
10:25:02 | FromGitter | <alehander42> the problem is that when you use sets without limit |
10:25:05 | FromGitter | <alehander42> you allocate too much |
10:25:10 | FromGitter | <alehander42> at least thats what I think |
10:25:21 | FromGitter | <alehander42> but actually there is an even simpler solution |
10:25:25 | FromGitter | <alehander42> than sets |
10:25:35 | narimiran | anamok: well, you've got *some* improvement :P |
10:26:12 | narimiran | @alehander42: you're saving your first pass, and then just offset it? |
10:26:37 | FromGitter | <alehander42> hm, this might be smart not sure |
10:26:49 | FromGitter | <alehander42> i replaced my set with an array |
10:26:49 | anamok | This morning we used sets size 65356 (2 ^ 16) and 2 ^ 17. With 2 ^ 16 it was very slow, with 2 ^ 17 very fast. However, with 2 ^ 16 it only had to re-allocate and re-hash just once. |
10:27:10 | FromGitter | <alehander42> basically an array does the same job with 0 allocations and hashes |
10:27:27 | FromGitter | <alehander42> but maybe a bit more memory (?) sometimes |
10:27:28 | narimiran | anamok: but you're not exiting early in this example, could that be the difference? |
10:28:07 | narimiran | @alehander42 how big is your array? how did you find its size? do you use negative indices too? |
10:29:10 | FromGitter | <alehander42> big enough to not lead to bounds error |
10:29:29 | FromGitter | <alehander42> nope: I make MAX twice bigge |
10:29:33 | FromGitter | <alehander42> and offset with MAX div 2 |
10:30:26 | FromGitter | <alehander42> sets is more general tho, arrays wouldn't work for a different kind of value |
10:30:38 | FromGitter | <alehander42> https://gist.github.com/alehander42/d3ad382d24dc09d8121c257692f78717 |
10:30:43 | * | nsf quit (Quit: WeeChat 2.3) |
10:30:58 | anamok | narimiran, an early exit means less work, in both cases |
10:31:02 | FromGitter | <alehander42> A can be less for their output maybe? not sure |
10:31:50 | narimiran | i've tried my solution, with a change set --> array and it is indeed twice as fast |
10:32:45 | anamok | alehander: parseInt can eat "+5" and "-5" without any problem |
10:32:53 | narimiran | @alehander42: pro tip (i figured it out later): `parseInt` works just fine with signs |
10:34:15 | FromGitter | <alehander42> ah haha great |
10:34:42 | anamok | But with an array you need to have an a priori knowledge about the max. number of elements. |
10:35:08 | narimiran | anamok: just like you need to know that initial size of your set should be 2^17 ;) |
10:35:13 | FromGitter | <alehander42> yep |
10:35:23 | FromGitter | <alehander42> and usually you know your elements would be e.g. int32 |
10:35:37 | FromGitter | <alehander42> well practically the sum can still be large |
10:35:41 | FromGitter | <alehander42> but if you have the input too |
10:35:55 | FromGitter | <alehander42> it isn't really a practical problem in a competition |
10:36:02 | FromGitter | <alehander42> now, for real world its different ofc |
10:36:22 | anamok | narimiran, But as the other example at http://ix.io/1uZi/nim shows, it's not always the case. |
10:36:48 | FromGitter | <alehander42> well, with arrays it doesnt matter: it should just be big enough |
10:37:45 | FromGitter | <alehander42> and I mean, who doesn't want a 4GB array for edge cases |
10:40:34 | narimiran | :D |
10:47:59 | narimiran | [SPOILERS] here is my solution (with @alehander42's modification): https://github.com/narimiran/AdventOfCode2018/blob/master/nim/day01.nim |
10:52:31 | FromGitter | <alehander42> oh i wasnt sure if negative indices work, nice |
10:53:02 | anamok | cycle is a good idea |
10:53:23 | * | ng0_ is now known as ng0 |
10:54:05 | narimiran | anamok: yep. but i figured out i don't like how i implemented it (in itertools) as a closure iterator, so i need to have an extra line (`let infiniteList = input.cycle()`) to make it work |
10:55:25 | anamok | narimiran, Can you make it better in itertools? |
10:56:36 | narimiran | anamok: i'm thinking about changing it, yes |
10:57:08 | anamok | narimiran, What's wrong with `for n in input.cycle()` ? |
10:57:31 | narimiran | currently it doesn't work ;) |
10:57:35 | anamok | oh |
11:03:03 | narimiran | anamok: but i might change all the infinite iterators (this weekend if i find the time) to allow the syntax you asked for |
11:03:34 | anamok | anamok, AoC helps you write better libraries :) |
11:04:24 | anamok | narimiran, I wanted to address you in my previous comment. Yes, that would be great. |
11:26:06 | anamok | narimiran, a simple iterator would be enough, no? |
11:26:53 | narimiran | anamok: i'm working on it, give me half an hour (code is complete, i need to rewrite the documentation) |
11:38:48 | * | onionhammer quit (Ping timeout: 245 seconds) |
11:39:59 | * | onionhammer joined #nim |
12:00:43 | * | JStoker quit (Ping timeout: 250 seconds) |
12:18:26 | * | JStoker joined #nim |
12:21:38 | Araq | so ... {.push raises: [].} now works |
12:31:12 | * | JStoker quit (Read error: Connection reset by peer) |
12:32:12 | * | bcdfgh joined #nim |
12:32:17 | * | JStoker joined #nim |
12:33:47 | * | bcdfgh quit (Client Quit) |
12:35:43 | narimiran | anamok: i've just pushed the new version of itertools, and it is immediately available in nimble if you're interested |
12:35:55 | FromGitter | <zacharycarter> morning all |
12:36:04 | anamok | narimiran, sure, I'll check it out right now |
12:40:53 | * | mjanssen left #nim (#nim) |
12:45:30 | anamok | narimiran, Thanks, cycle works well. |
12:46:26 | * | asterite_ joined #nim |
12:47:09 | FromGitter | <zacharycarter> I'm wondering what would be better for a level editor - GTK or some immediate mode solution |
12:47:18 | FromGitter | <zacharycarter> like Dear IMGui |
12:47:22 | FromGitter | <zacharycarter> or Nuklear |
12:48:42 | Araq | given a choice, I would always pick immediate mode |
12:50:09 | FromGitter | <zacharycarter> I've never built a very complex GUI with an immediate mode solution |
12:50:21 | FromGitter | <asterite> Hi! I'm doing adventofcode in Nim. I wrote this solution for the second part of the first day: https://gist.github.com/asterite/673d833c4b1a64b529c921ae584edff5#file-two-nim . But it's super slow, it's taking like 3 seconds even if I compile it with `--opt:size`. It takes like 30~60ms in Go and Crystal. Am I doing something wrong? |
12:50:34 | FromGitter | <zacharycarter> heck - last time I worked on a Desktop GUI app - immediate mode GUIs weren't really the thing they are today, they were probably just in casey muttatori's brian |
12:50:48 | FromGitter | <zacharycarter> or however his name is spelled |
12:50:53 | narimiran | @asterite: do not use sequences. (if you want further hints, let me know) |
12:51:21 | narimiran | oh sorry, you use sets already |
12:51:26 | FromGitter | <zacharycarter> but yeah - I suppose I'll run into the whole gui state vs app state thing if I go with a retained mode solution |
12:51:29 | Araq | and pack your stuff in a main proc |
12:51:48 | narimiran | use `seen = initSet[int](<large number, power of two>)` |
12:51:51 | Araq | and --opt:size != -d:release, you need to use -d:release |
12:51:51 | FromGitter | <alehander42> @asterite provide an initial size for the set or use an array |
12:52:00 | FromGitter | <alehander42> it's 20 ms for me |
12:52:25 | narimiran | Araq: the problem is in the initial set size, several of us discovered that this morning |
12:52:25 | FromGitter | <asterite> it's 20ms for you without modifications? |
12:52:53 | FromGitter | <alehander42> @asterite, no, with an initial size |
12:52:57 | FromGitter | <alehander42> with an array its even less |
12:53:06 | FromGitter | <zacharycarter> Does anyone know the state of Nim's GTK stuff? (I'm not ignoring you Araq - this is a sidebar) |
12:53:07 | FromGitter | <asterite> okay... |
12:53:10 | FromGitter | <alehander42> (but its a bit different than other solutions i guess?) |
12:53:15 | FromGitter | <zacharycarter> like - can we basically compete with Vala now in that arena? |
12:53:29 | FromGitter | <asterite> My advice: set should work faster than array for "set" functionality, and it should work fast even if it starts empty |
12:53:41 | Araq | we have maintained Gtk3 wrappers fwiw |
12:54:16 | FromGitter | <zacharycarter> yes but I remember like stefan salewski or someone |
12:54:22 | Araq | yup |
12:54:23 | FromGitter | <zacharycarter> one of our members was big into working on GTK stuff |
12:54:32 | FromGitter | <zacharycarter> I see there is - https://nimble.directory/pkg/gintro |
12:55:05 | FromGitter | <asterite> what's a good initial size? |
12:55:10 | FromGitter | <zacharycarter> and some other gtk-related packages. Vala is used alot with GTK - I'm looking at a game engine written in C++ right now that has its editor written in Vala (prompting the initial question) |
12:55:17 | FromGitter | <asterite> Also, if I pass a size that's not power of two I get an error |
12:55:32 | FromGitter | <asterite> My advice is to narrow to the nearest power of two |
12:55:48 | FromGitter | <zacharycarter> but if Nim has GObject introspection and other similar capabilities to Vala |
12:56:07 | FromGitter | <zacharycarter> we should definitely find a way to make that better known - maybe we need a blog post about it |
12:57:12 | FromGitter | <zacharycarter> Once I get a basic editor going - just a window being drawn or whatever - I'm going to start a blog series about the new engine / editor I'm working on |
12:57:45 | FromGitter | <alehander42> @asterite if we do that, it should be with a suggestSize constructor or something like that, getting a different size than suggested is suprising (i dont like that in some unix's api-s) |
12:57:55 | * | vlad1777d joined #nim |
12:58:18 | Araq | asterite: there is nothing wrong with teaching users instead of out-smarting them |
13:00:09 | Araq | zacharycarter: but your game would be "immediate mode", why would your editor be different. it's harder to reuse the code when you use two different paradigms |
13:00:32 | FromGitter | <alehander42> @asterite otherwise I agree that an empty set shouldn't lead to so much slower performance in this usecase, this should be investigated |
13:00:37 | FromGitter | <zacharycarter> well - you might draw certain portions of your editor with an immediate mode library |
13:00:42 | FromGitter | <zacharycarter> and other portions with a retained mode solution |
13:01:08 | FromGitter | <zacharycarter> but either way - I'm going to start with immediate mode, because I know I'll need an immediate mode GUI library regardless of whether I ever need a retained mode one |
13:01:43 | FromGitter | <zacharycarter> is anyone named lmariscal in here? |
13:01:53 | FromGitter | <zacharycarter> I don't know how to see all IRC folks from gitter |
13:02:09 | * | Trustable quit (Remote host closed the connection) |
13:02:42 | Araq | btw the split into game and editor can also already be a mistake |
13:03:04 | Araq | imagine you can edit the level as you play it. |
13:03:32 | FromGitter | <zacharycarter> well - I'm waiting on code reloading to feature that |
13:03:44 | FromGitter | <zacharycarter> but I am working on an architecture that will enable that sort of thing |
13:04:15 | FromGitter | <zacharycarter> so for instance - I'm going to have a "compile" server that runs in the background of the editor that displays its output inside of a console within the editor |
13:04:24 | * | asterite_ quit (Quit: Page closed) |
13:04:44 | FromGitter | <zacharycarter> it's basically just a CLI that allows you to compile your game resources - but since it runs in the background of the editor, I should be able to use file watchers to detect when a resource in use is changed, and recompile it |
13:04:55 | FromGitter | <zacharycarter> then have hooks to reload whatever type of asset was modified at runtime |
13:05:12 | FromGitter | <zacharycarter> I may end up having to feature an in game edit mode, along with a traditional editor |
13:05:55 | FromGitter | <zacharycarter> it will actually also allow you to start a game session from the CLI - so this is really the editor's interface to the engine |
13:06:24 | FromGitter | <zacharycarter> and I also plan on allowing the user to write their gameplay code - totally separate from the engine code, and it will be compiled and loaded when the game starts |
13:06:32 | Araq | sure hot code reloading is nice but data is data and can be modified on-the-fly |
13:06:43 | FromGitter | <zacharycarter> well part of my data will be code |
13:06:46 | FromGitter | <zacharycarter> is the thing |
13:07:03 | FromGitter | <zacharycarter> but yes - I know what you mean - and I fully eventually plan on supporting that |
13:07:28 | FromGitter | <zacharycarter> this is probably 10x the effort of my previous stabs at little hobby game engines - and it's delving into unfamiliar territory for me |
13:08:07 | FromGitter | <zacharycarter> but I'm hopeful that I've read enough source from other engines at this point / know enough about Nim, not to shoot myself in the foot, architecturally speaking, from day one |
13:08:37 | FromGitter | <zacharycarter> so this is really cool - https://github.com/lmariscal/nimgl_gen - we now have imgui bindings to the c99 api |
13:08:45 | FromGitter | <zacharycarter> but I feel like this poor guy has built his own version of nimgen |
13:09:18 | FromGitter | <zacharycarter> and he's also built this whole thing - https://github.com/lmariscal/nimgl - which looks neat |
13:09:53 | FromGitter | <zacharycarter> but I feel like we already have 10 o these |
13:14:11 | * | Trustable joined #nim |
13:15:57 | * | JStoker quit (Ping timeout: 252 seconds) |
13:16:02 | * | Snircle joined #nim |
13:19:22 | * | kapil____ quit (Quit: Connection closed for inactivity) |
13:26:15 | dom96 | You guys sure asterite's slowness isn't just to do with using --opt:size instead of -d:release? |
13:26:35 | narimiran | dom96: yes we are |
13:27:04 | narimiran | see irclogs from this morning for the exact numbers |
13:27:51 | narimiran | in release mode, choosing the right init size changes runtime from 800ms to 12ms on my end |
13:28:31 | * | abm joined #nim |
13:28:34 | dom96 | interesting |
13:28:55 | * | nsf joined #nim |
13:29:35 | dom96 | Gonna need to catch up with AoC. Sucks that Ludum Dare starts at the same time |
13:31:09 | M379229[m] | dom96: yeah, see the logs from 5 hours ago (probably AoC spoilers). On a slow machine mine went from 150 ms -> 10 ms. |
13:31:23 | narimiran | dom96: speaking of LD, can you answer this? https://twitter.com/tetraduzione/status/1068772757524099072 |
13:31:25 | M379229[m] | It seems understandable that there's some perf penalty with rehashing a set. |
13:31:42 | M379229[m] | But I have no idea what kind of slowdown is reasonable or expected. |
13:32:30 | anamok | dom96: I made a test, see here: http://ix.io/1uZY/nim . It does a lot of re-hashing and still, it's fast. But if I do the same in the morning AoC exercise (part 2), the difference is huge. Something is strange with sets. |
13:32:44 | M379229[m] | Presumably we don't want to initialize with some huge capacity by default. |
13:33:21 | M379229[m] | Like, if you just called `initSet[int]()` |
13:33:25 | dom96 | narimiran: sure |
13:34:57 | anamok | What is Ludum Dare, by the way? |
13:36:23 | dom96 | https://ldjam.com/events/ludum-dare/rules |
13:38:04 | * | dddddd joined #nim |
13:41:16 | * | Trustable quit (Remote host closed the connection) |
13:46:22 | Araq | M379229[m]: narimiran will investigate :P |
13:46:48 | narimiran | yup, i plan to |
13:46:56 | Araq | but better than HashSet[int] is IntSet |
13:47:12 | Araq | (if not let me know, the compiler is full IntSets...) |
13:47:13 | dom96 | csfml_system_gen.nim(92, 1) Error: 'destroy' or 'deepCopy' expected for 'override' :/ |
13:47:14 | narimiran | Araq: that is limited to int16.high, right? |
13:47:33 | Araq | no. |
13:47:48 | Araq | an IntSet is not a set[int] :P |
13:48:05 | narimiran | btw, AoC creator is known for creating "special" inputs, e.g. using some large prime numbers and stuff like that |
13:48:10 | dom96 | Looks like I should have prepared this yesterday |
13:48:44 | narimiran | Araq: oh yeah, the difference is striking, how the hell did i confuse the two :P |
13:50:19 | narimiran | i need to catch some air, see you guys later |
13:50:57 | FromGitter | <alehander42> @Araq if IntSet works for all HashSet[int] cases, can't HashSet[int]] use it internally |
13:51:56 | * | narimiran quit (Remote host closed the connection) |
13:51:57 | Araq | then every HashSet's proc would have a specialization for 'T is int' and a different performance profile |
13:52:13 | Araq | C++ did that for vector<bool> and it suffered |
13:55:11 | Araq | alehander42: I'm waiting for your not-nil prototype |
13:56:54 | FromGitter | <arnetheduck> hey @Araq btw, want a patch that would change the `$n` in the compiler to `\n`? would make it more compatible with the stdlib `%` |
13:57:22 | Araq | can't, ask zahary for details |
13:58:16 | FromGitter | <alehander42> @arnetheduck `$n` is useful for cgen and debugging: sometimes you need to *not* generate newlines because of line directives |
13:58:22 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
13:58:23 | FromGitter | <alehander42> (at least from what I know) |
13:59:25 | FromGitter | <alehander42> Araq, I can show you the current code, but I planned on continuing on Monday |
13:59:48 | FromGitter | <arnetheduck> @alehander42 oh is it? doesn't look like it's doing anything spectacular: https://github.com/nim-lang/Nim/blob/devel/compiler/ropes.nim#L253 |
13:59:51 | FromGitter | <alehander42> but if the approach is bad, it's better to change it sooner, you're right |
14:01:07 | * | Trustable joined #nim |
14:01:18 | FromGitter | <arnetheduck> @zah ping? why `$n`and not `\n` in compiler format string? |
14:01:35 | Araq | there is also $N vs $n |
14:01:49 | Araq | iirc $N means \n and $n means "optional newline" |
14:02:18 | FromGitter | <arnetheduck> yeah, smells historical - doesn't look like there's a lot of optionality in there |
14:03:37 | FromGitter | <alehander42> @arnetheduck please, stop making quick judgements |
14:03:49 | FromGitter | <alehander42> I have no idea why this is not honored in ropes.nim anymore |
14:03:55 | FromGitter | <alehander42> but it doesn't sound right to me |
14:04:14 | Araq | I think I broke it :P |
14:04:26 | Araq | proc ropecg still has the logic |
14:04:42 | FromGitter | <alehander42> yes, this is pretty bad |
14:05:01 | FromGitter | <alehander42> because now you can next several times through the same line |
14:05:22 | Araq | ah I remember |
14:05:27 | M379229[m] | Nice. Just benchmarked `initSet[int]()` (150 ms) vs `initSet[int](2^17)` (10 ms) vs `initIntSet()` (5 ms). Thanks for the tip. |
14:06:09 | FromGitter | <arnetheduck> looks like https://github.com/nim-lang/Nim/commit/a4e2b0c1538134ebf105b669da13db13b5356998 removed it |
14:06:27 | Araq | I reviewed the code, tried to disable $n for %, got crashes, reviewed it even more and decided to live with it |
14:07:29 | Araq | you need to use ropecg() instead of % if your format string has $n and the context is "imperative code relevant for the debugger" |
14:08:41 | FromGitter | <alehander42> basically we should try to use very rarely `$N` except if obviously always being a newline |
14:08:52 | FromGitter | <alehander42> i remember in the past there were many wrong usages of it |
14:09:05 | FromGitter | <alehander42> and even with the right logic in ropes, there were debugging issues |
14:09:13 | dom96 | This is so strange |
14:09:23 | dom96 | nim c "/Users/dom/projects/ld43/src/ld43.nim" works but nim c ld43.nim fails with an error |
14:09:34 | dom96 | And I can never remember where the new nimcache location is :( |
14:09:45 | Araq | use --listcmd to see where it is |
14:10:28 | Araq | I use it all the time too since the new location is in some bullshit dotted directory |
14:11:28 | dom96 | this is some really strange caching bug |
14:11:35 | dom96 | It's building something completely different |
14:13:17 | Araq | use -f to force a full rebuild |
14:13:22 | FromGitter | <arnetheduck> oh, and it looks like `ropes.%` is using `\n` while `ropecg` uses `\L` - won't that lead to mixed win/unix line endings somewhere? |
14:13:23 | dom96 | ohhhh |
14:13:28 | dom96 | I see what happened omg |
14:13:45 | dom96 | nimble init needs to be smarter |
14:13:52 | Araq | arnetheduck: They now mean the same, remember? you wanted it so much... ;-) |
14:14:20 | FromGitter | <arnetheduck> I thought `\L` ended up being the "smart" newline, no? |
14:15:11 | dom96 | So what does this error mean? "'destroy' or 'deepCopy' expected for 'override'" |
14:15:17 | Araq | nah, that's \p |
14:15:54 | FromGitter | <arnetheduck> oh shit, pigs are flying and notepad got unix newline support: https://blogs.msdn.microsoft.com/commandline/2018/05/08/extended-eol-in-notepad/ |
14:16:30 | Araq | lol that's a blog post. |
14:17:13 | Araq | that's something they need to sneak into notepad because it is so embarrassing |
14:17:15 | FromGitter | <arnetheduck> haha: "Today, we’re excited to announce that we have fixed this issue!" after what, 30 years? |
14:17:22 | Araq | yup |
14:17:51 | Araq | but to be fair, they fixed it, 'cat' still outputs ^M |
14:19:04 | Araq | dom96: line? |
14:19:42 | dom96 | proc destroy*(clock: Clock) {.destroy, cdecl, importc: "sfClock_destroy".} |
14:20:12 | anamok | If I want to store int-s in a set, is IntSet always a better choice? |
14:20:13 | Araq | remove the .destroy annotation |
14:21:12 | FromGitter | <alehander42> hmm i have to try the destructors finally |
14:21:47 | Araq | anamok: in theory a HashSet can win for sparse integer values |
14:24:30 | dom96 | Araq: Okay, but is there any way to make the destructor work? |
14:24:44 | FromGitter | <arnetheduck> anyway, I'm eternally grateful that the nim `\n` outputs a `\n` :) |
14:24:50 | anamok | Thanks. For the AoC exercise IntSet is the winner (which is a dense set IMO). |
14:24:51 | dom96 | This wrapper includes destructors and I'd rather keep them |
14:26:41 | Araq | there is a way but it's some work and the feature is heavily in development |
14:28:50 | Araq | proc `=destroy`*(clock: var Clock) assuming that Clock is an object (not a ref) |
14:29:05 | Araq | and you better also figure out how to overload `=` for it |
14:30:25 | * | stefanos82 quit (Remote host closed the connection) |
14:40:44 | * | kapil____ joined #nim |
14:43:16 | * | smitop_ joined #nim |
14:54:40 | dom96 | Araq: meh, okay |
14:54:51 | * | Trustable quit (Remote host closed the connection) |
15:06:15 | ftsf | o/ dom96 how goes the LD? |
15:07:12 | dom96 | Slow. Helping my SO finish off a YT video :) |
15:08:29 | ftsf | ahh |
15:08:37 | ftsf | good luck! |
15:14:17 | anamok | How to measure the execution time of a function? I want to get the wall-clock time. I found cpuTime(), but it measures the CPU time, not the wall-clock time (as I understood). |
15:18:30 | FromGitter | <GULPF> If you're doing benchmarking, you can use https://github.com/LemonBoy/criterion.nim |
15:22:08 | * | nsf quit (Quit: WeeChat 2.3) |
15:22:57 | dom96 | ftsf: You participating with Nim too? :) |
15:23:12 | ftsf | yep =) |
15:23:29 | ftsf | of course! nice to use nim again, much more pleasant than using Unity in my day job |
15:26:44 | dom96 | :D |
15:26:48 | dom96 | Good luck to you too :) |
15:26:56 | dom96 | I really should have prepared better |
15:27:02 | dom96 | Still fighting DLL errors :( |
15:30:02 | FromGitter | <zacharycarter> https://github.com/zacharycarter/nimgui |
15:30:37 | FromGitter | <zacharycarter> I took the nimgui generated project that was - https://github.com/lmariscal/nimgl_gen - and moved it into a separate repo and cleaned up a few things |
15:30:53 | FromGitter | <zacharycarter> going to ask the author if he wants me to transfer it to him - but I think the bindings are worth being in their own repo |
15:32:51 | Calinou | here I'm uploading my game for the Game Off jam :P |
15:34:30 | FromGitter | <zacharycarter> yay :D |
15:37:15 | anamok | GULPF: Thanks. I found epochTime(), which seems to be good for measuring the wall-clock time |
15:43:32 | * | abm quit (Quit: Leaving) |
15:43:46 | anamok | I want to add some text to the source that I don't want to compile in the binary. Is `discard """ text here """` the way to do it? |
15:46:19 | FromDiscord_ | <lastpass> How optimized will Nim get until Nim has all Anaconda's default package functions in place with speeds that exceeds Java and C#? |
15:48:08 | leorize | anamok: you mean comments? |
15:49:02 | anamok | leorize: yes, but I don't want to start every line with a `#` |
15:49:20 | leorize | use comment block: `#[ ]#` |
16:01:08 | * | king3vbo joined #nim |
16:23:19 | * | narimiran joined #nim |
16:35:16 | anamok | bye |
16:35:22 | * | anamok quit (Remote host closed the connection) |
16:35:27 | * | nsf joined #nim |
16:38:41 | * | Vladar joined #nim |
16:52:12 | * | elnee joined #nim |
16:53:38 | * | elnee left #nim (#nim) |
16:57:27 | * | stefanos82 joined #nim |
17:11:18 | FromGitter | <zacharycarter> If I plan on having a long running async process - is there something other than the stdlib async implementation i should use? |
17:12:13 | narimiran | @zacharycarter: maybe this? https://github.com/status-im/nim-asyncdispatch2 |
17:12:49 | FromGitter | <arnetheduck> Araq, https://github.com/nim-lang/Nim/pull/9836 does some of the proc name - nodekind mapping we talked about, nice if it can get a quick merge - if yes, vmgen could get the same treatment (regularity helps with nlvm dev) |
17:13:15 | FromGitter | <zacharycarter> thank you narimiran! |
17:16:08 | * | Trustable joined #nim |
17:23:02 | * | smitop_ quit (Quit: Connection closed for inactivity) |
17:33:25 | * | PMunch joined #nim |
17:41:28 | * | fredrik92 joined #nim |
17:41:54 | * | couven92 quit (Disconnected by services) |
17:42:02 | * | fredrik92 is now known as couven92 |
17:42:22 | * | fredrik92 joined #nim |
17:43:39 | * | king3vbo left #nim ("Leaving") |
17:44:06 | * | craigger quit (Quit: bye) |
17:48:27 | * | craigger joined #nim |
17:52:18 | * | couven92 quit (Quit: Client Disconnecting) |
17:52:49 | * | couven92 joined #nim |
17:54:05 | * | Trustable quit (Remote host closed the connection) |
17:56:04 | PMunch | Hmm, is there a way to get the version number from the nimble file? |
17:56:13 | PMunch | I want to include it in --version |
17:58:11 | PMunch | Or to let both grab it from a git tag or something like that |
17:59:04 | FromGitter | <kdheepak> @PMunch I have done this but I'll warn you that mine is a horrible dirty hack |
17:59:23 | PMunch | kdheepak, how did you do it? |
17:59:54 | FromGitter | <kdheepak> https://github.com/NREL/glm/blob/a5790f0/glm.nimble#L7-L16 |
18:00:14 | FromGitter | <kdheepak> If you have a better suggestion on how to do this I'd like to hear from you. |
18:01:10 | PMunch | What's the deal with the "atal" block? |
18:01:38 | PMunch | Oh, you grab 1..5, so it's to catch fatal :P |
18:01:47 | FromGitter | <kdheepak> If in the repo, get it using staticExec git describe, else try to get it from the folder name (assume it is in the ~/.nimble folder), if that fails just assume it is 0.1.0 |
18:02:05 | FromGitter | <kdheepak> Haha yes (I'm so embarrassed about that!) |
18:02:26 | PMunch | Haha, if it works it works :) |
18:03:25 | FromGitter | <kdheepak> Is anyone able to submit a solution to AdventOfCode.com/2017? |
18:03:48 | FromGitter | <kdheepak> This is my first year trying it and I thought I'd try previous year ones as well |
18:03:55 | dom96 | PMunch: See how Nimble does it for its own .nimble file |
18:04:10 | dom96 | kdheepak: I guess you might not be able to submit for previous years? |
18:04:46 | FromGitter | <kdheepak> But I'm getting a weird error. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02cd3d1c439034af018d15] |
18:04:50 | cavariux | Hi zacharycarter are you here? |
18:04:56 | FromGitter | <kdheepak> ah that's unfortunate. |
18:05:32 | FromGitter | <kdheepak> Yes, I was going to mention as well, dom96 suggested looking into nimble's .nimble file when I asked this question last time. |
18:05:47 | cavariux | I think he is using gitter so @zacharycarter would notify him |
18:20:29 | narimiran | dom96: you can submit for all the years (cc @kdheepak), last year i was solving 2015 tasks |
18:21:07 | FromGitter | <kdheepak> @narimiran I think it might be a bug with the website |
18:21:33 | narimiran | @kdheepak: the error you got means that your solution is not correct, incidentally your solution matches the correct solution for some other input file, and you have already submitted 5 wrong answers |
18:22:23 | narimiran | @kdheepak: i've solved all years of AoC (and many others). if there were a bug, somebody would already report it and it would have been fixed |
18:22:28 | FromGitter | <kdheepak> @narimiran, I think my solution is correct. I've asserted solutions from the "tests" on the page and they all pass. |
18:22:34 | narimiran | which year/day are you trying to solve? |
18:22:42 | FromGitter | <kdheepak> Hmm. |
18:22:44 | FromGitter | <kdheepak> 2017 day 1 |
18:23:00 | narimiran | i also *thought* many of my solutions were correct ;) |
18:23:25 | narimiran | part 1 or 2? |
18:23:33 | FromGitter | <kdheepak> part 1 |
18:23:46 | narimiran | ok, let me see if i can remember some "traps" |
18:23:53 | FromGitter | <kdheepak> haha |
18:24:11 | narimiran | can you share your code, so i can try it with my input? |
18:24:59 | FromGitter | <kdheepak> @narimiran I just pushed my 2017 here: https://github.com/kdheepak/adventofcode/blob/master/2017/nim/day01.nim |
18:25:11 | FromGitter | <kdheepak> Thanks for trying this out! |
18:26:12 | * | craigger quit (Quit: bye) |
18:26:38 | narimiran | pro: it gives a correct solution for my input. con: i need to find out what goes wrong and where :) |
18:27:21 | FromGitter | <kdheepak> Wait, it's giving you the correct solution for your input? So it should give me the correct solution for me input as well? Right? |
18:27:39 | FromGitter | <kdheepak> Can you run your solution on my input and see if you get the same result? 1216? |
18:28:40 | * | craigger joined #nim |
18:29:05 | narimiran | even *your* solution doesn't give you that result! lol :D |
18:31:52 | PMunch | dom96, do you mean this? https://github.com/nim-lang/nimble/blob/master/src/nimble.nim#L302-L317 |
18:32:16 | * | shashlick joined #nim |
18:33:00 | FromGitter | <kdheepak> wait wat. |
18:33:02 | FromGitter | <kdheepak> haha. |
18:33:06 | FromGitter | <kdheepak> Let me run it again. |
18:34:01 | * | shashlick quit (Remote host closed the connection) |
18:34:29 | FromGitter | <kdheepak> I get `1216` ⏎ ⏎ ```$ ./nim/build/main ⏎ Solution1: 1216``` [https://gitter.im/nim-lang/Nim?at=5c02d434a6c29a1037c9ec1f] |
18:35:11 | FromGitter | <kdheepak> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02d45f9aec405095afa071] |
18:35:18 | narimiran | i copy-pasted your program from your git repo and i get a different number :) |
18:35:35 | narimiran | check that you don't have an extra space at the end of your input file, or something like that |
18:35:37 | FromGitter | <kdheepak> If your input is different you'll get a different number, right? |
18:35:45 | FromGitter | <kdheepak> Ohhhhhhh. |
18:36:34 | FromGitter | <kdheepak> Hmm. It doesn't. |
18:36:41 | FromGitter | <kdheepak> Are you trying 2017 or 2018? |
18:37:02 | narimiran | with that extra space i get 1216, without it is a different number ;) (trying to hint as little as possible) |
18:37:16 | FromGitter | <kdheepak> I get the same result I was getting before after running `strip`. |
18:37:24 | FromGitter | <kdheepak> Okay, thanks for the hint. I'll debug again! |
18:39:13 | FromGitter | <kdheepak> Hmm. Oh man this is interesting. I don't see any extra spaces anywhere. But clearly I'm missing something. |
18:41:00 | narimiran | try to copy-paste the input string directly in your nim file |
18:42:29 | * | vlad1777d quit (Remote host closed the connection) |
18:43:24 | * | vlad1777d joined #nim |
18:43:34 | * | junland quit (Quit: Disconnected.) |
18:43:40 | FromGitter | <kdheepak> okay that's a different result. |
18:44:05 | FromGitter | <kdheepak> Wow I genuinely don't know what's going on here? |
18:44:11 | FromGitter | <kdheepak> End of file character? |
18:44:40 | narimiran | so, it is not an "AoC bug"? ;) :P |
18:45:17 | * | junland joined #nim |
18:45:18 | FromGitter | <kdheepak> Haha yes it's not a AoC bug! |
18:46:09 | FromGitter | <kdheepak> @narimiran, I am confused. I used `for i, c in data.strip()` and that gave me 1216. |
18:46:40 | FromGitter | <kdheepak> But when I used const data = readFile("./day01.txt").strip() I get 1223. |
18:46:54 | * | vlad1777d quit (Remote host closed the connection) |
18:46:59 | * | PMunch quit (Remote host closed the connection) |
18:47:51 | * | vlad1777d joined #nim |
18:49:07 | FromGitter | <kdheepak> Using `strip` inside the function does something different.. |
18:49:33 | narimiran | github shows that your file has 2 lines — you have `\n` at the end of the file/line |
18:49:39 | * | craigger quit (Quit: bye) |
18:49:58 | narimiran | it did work correctly for my input, which is only 1 line |
18:50:40 | * | craigger joined #nim |
18:50:53 | narimiran | and, as you noticed, `strip` when you iterate doesn't strip that newline char |
18:51:55 | FromGitter | <kdheepak> readfile seems to return TaintedString, and I think strip on TaintedString must be doing something different. |
18:52:22 | narimiran | that cannot be the explanation because `readFile("./day01.txt").strip()` works fine |
18:53:08 | narimiran | but enough chit-chat, time for you to solve part 2! ;) |
18:54:10 | FromGitter | <kdheepak> haha. I think I don't understand why you said "that cannot be the explanation", but I'll go on to part 2. Maybe that may help understand more. |
19:01:14 | Notkea | hi, what's happening internally when extending a seq through the add procedure? how is it resizing the underlying array? is it allocating just the right amount of memory or is it doubling its capacity each time to avoid reallocs? |
19:04:19 | FromGitter | <kdheepak> This is very unintuitive behaviour for me. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02db3299ad1556dbeef5b1] |
19:04:49 | FromGitter | <zacharycarter> cavariux: I am now |
19:04:56 | FromGitter | <kdheepak> If I uncomment the lines in the function, I get the following ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02db58e8274925258251aa] |
19:05:26 | FromGitter | <kdheepak> Why does the type of the global scope change depending on whether I'm echo-ing inside a function or not? |
19:05:32 | * | rockcavera quit (Remote host closed the connection) |
19:06:12 | FromGitter | <kdheepak> @dom96 or @narimiran any thoughts here? |
19:07:02 | narimiran | i'm to tired to think straight, sorry (been awake since 5:30 a.m. (now is 8 p.m. here) |
19:08:19 | cavariux | @zacharycarter, great, just wanted to let you know that this is my irc username since I forgot to set a notification for lmariscal |
19:09:28 | FromGitter | <zacharycarter> ah cool :D - thanks for letting me know! |
19:11:16 | * | JStoker joined #nim |
19:25:02 | dom96 | kdheepak: pro tip: try repr() on the data to see what the problem might be |
19:28:31 | * | nsf quit (Quit: WeeChat 2.3) |
19:32:48 | * | Jesin joined #nim |
19:34:28 | FromGitter | <kdheepak> @dom96, the type of the variable in the global scope changes? Why does that happen? |
19:40:23 | FromGitter | <dom96> Can you link me the code? |
19:46:15 | FromGitter | <yyyc514> what's the right compiler option to see the code the macros are generating? i can't ever remmeber it |
19:47:06 | * | kungtotte quit (Remote host closed the connection) |
19:49:58 | FromGitter | <kdheepak> @dom96 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02e5e6c4af6856da6fc15e] |
19:51:32 | FromGitter | <kdheepak> If I run the above, I get the following ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c02e644bc1a693e3a3e75ba] |
19:52:31 | FromGitter | <kdheepak> If you want to use the exact text file I'm using, it is here: https://github.com/kdheepak/adventofcode/blob/45cd1e88379e6d576d0bd94e5420178decd04fdf/2017/inputs/day01.txt |
19:53:45 | * | kapil____ quit (Excess Flood) |
19:54:44 | * | kapil____ joined #nim |
19:59:33 | * | kapil____ quit (Excess Flood) |
20:00:36 | * | kapil____ joined #nim |
20:01:24 | * | kapil____ quit (Client Quit) |
20:02:26 | * | kapil____ joined #nim |
20:02:55 | * | smitop_ joined #nim |
20:05:32 | FromGitter | <yyyc514> ``` result.status = "ok"``` what is the compiler trying to tell me?``` |
20:05:41 | FromGitter | <yyyc514> it works just fine without expandMacros |
20:06:11 | * | smitop_ quit (Client Quit) |
20:06:32 | * | smitop_ joined #nim |
20:07:55 | * | smitop_ quit (Client Quit) |
20:08:19 | * | smitop joined #nim |
20:08:46 | dom96 | smitop: you need to be identified with nickserv |
20:11:39 | smitop | Am I identified now? |
20:14:10 | * | vlad1777d quit (Remote host closed the connection) |
20:15:00 | * | vlad1777d joined #nim |
20:29:05 | FromGitter | <alehander42> probably, as i see your comment |
20:35:01 | * | miran joined #nim |
20:37:07 | * | narimiran quit (Ping timeout: 240 seconds) |
20:52:39 | * | so quit (Ping timeout: 246 seconds) |
21:01:37 | FromGitter | <raydf> Is there any boilerplate for web applications with nim? ⏎ example karax, ormin, websockets, postgres, etc... ⏎ something that could establish some kind of pattern, like others with mvc |
21:03:36 | * | zachk joined #nim |
21:05:26 | * | Vladar quit (Remote host closed the connection) |
21:05:31 | * | zachk quit (Changing host) |
21:05:31 | * | zachk joined #nim |
21:17:13 | oprypin | hi, is it possible to have aliases inside enums? trying to replicate this https://github.com/SFML/CSFML/blob/61f17e3c1d109b65ef7e3e3ea1d06961da130afc/include/SFML/Graphics/PrimitiveType.h#L52 |
21:20:31 | * | miran quit (Remote host closed the connection) |
21:20:47 | * | so joined #nim |
21:25:45 | FromGitter | <StefanSalewski> oprypin, something like const sfLinesStrip = sfLineStrip |
21:26:13 | FromGitter | <StefanSalewski> should work, I have used that in gtk3 wrappers. |
21:27:07 | oprypin | StefanSalewski, doesn't seem to work well in a pure enum |
21:27:33 | oprypin | inside the enum it's `identifier expected, but found 'keyword const'` and outside it's not the same thinf |
21:29:07 | FromGitter | <StefanSalewski> Yes, I used it after the enum definition. It is an alias, put without the qualifier for pure enums. But the qualifier is not needed at all for enums. |
21:29:46 | oprypin | > pure enum |
21:30:37 | FromGitter | <StefanSalewski> We generally use qualifier for enum only when it is necessary. With current Nim release we can use pure enums with and with out qualifier. |
21:31:26 | FromGitter | <StefanSalewski> But I agree, it is not perfect. |
21:37:10 | oprypin | oh damn... it actually doesnt even let me be explicit |
21:37:28 | oprypin | `Points = 0, Lines = 1, LineStrip = 2, Triangles = 3, TriangleStrip = 4, TriangleFan = 5, Quads = 6, LinesStrip = 2, TrianglesStrip = 4, TrianglesFan = 5` |
21:40:34 | FromGitter | <StefanSalewski> I did it this way: https://github.com/StefanSalewski/oldgtk3/blob/master/oldgtk3/gdk.nim#L2868 |
21:41:42 | FromGitter | <StefanSalewski> But Araq recomments using distinct ints for C enums :-) |
21:45:50 | FromGitter | <StefanSalewski> But then we have no real qualifier as in pure enums, but something like etDoubleButtonPress. To get a qualifier, we may put the flags in its own module called EventType |
21:45:55 | FromGitter | <StefanSalewski> Bye. |
21:46:51 | * | Trustable joined #nim |
21:49:08 | * | ftsf quit (Ping timeout: 250 seconds) |
21:58:57 | * | stefanos82 quit (Remote host closed the connection) |
22:09:22 | * | kapil____ quit (Quit: Connection closed for inactivity) |
22:21:17 | * | kapil____ joined #nim |
22:31:39 | oprypin | is `import math` supposed to work on latest version or not? |
22:32:08 | dom96 | of course |
22:32:31 | oprypin | i'm just getting `cannot open file: math` O_o |
22:32:42 | oprypin | with https://www.archlinux.org/packages/community-testing/x86_64/nim/ |
22:34:14 | oprypin | seems like i'm getting that for any module |
22:34:38 | dom96 | Looks like the package is terribly broken D: |
22:34:51 | dom96 | narimira: lots of new people joining on the forum for AoC :D |
22:35:03 | dom96 | I made you a mod so you can approve them |
22:35:33 | oprypin | dom96, are you just saying that or have you confirmed it? |
22:35:44 | dom96 | oprypin: Just saying that |
22:35:50 | dom96 | No idea if it's actually the case |
22:35:53 | oprypin | the package has math.nim in the same location as the previous package |
22:36:08 | oprypin | /usr/lib/nim/pure/math.nim |
22:36:18 | dom96 | check the nim config file |
22:36:25 | dom96 | or better yet, strace it |
22:36:28 | oprypin | ahhhh |
22:36:39 | oprypin | warning: /etc/nim.cfg installed as /etc/nim.cfg.pacnew |
22:36:39 | oprypin | warning: /etc/nimdoc.cfg installed as /etc/nimdoc.cfg.pacnew |
22:36:59 | dom96 | that should be in /etc/nim/* now |
22:38:15 | oprypin | ok that works |
22:38:25 | oprypin | you guys should raise an alarm to arch linux maintainers |
22:39:26 | oprypin | also that they should add a test that builds any program ... |
22:44:14 | oprypin | why am i getting this error `Error: 'destroy' or 'deepCopy' expected for 'override'` - wasn't your change supposed to fix 0.19 compat? |
22:44:51 | oprypin | for this line https://github.com/oprypin/nim-csfml/blob/c41b8f7baf3a1eeb3fbe66aa093e1bcc89ddddf9/src/csfml/private/system_gen.nim#L92 |
22:46:53 | oprypin | oh... https://bugs.archlinux.org/task/60490 |
22:47:11 | oprypin | but the error still stands |
22:50:07 | * | Trustable quit (Remote host closed the connection) |
22:56:45 | * | Jesin quit (Quit: Leaving) |
23:03:41 | * | Jesin joined #nim |
23:06:35 | * | NimBot joined #nim |
23:22:27 | dom96 | oprypin: yeah, destructors are being reworked |
23:22:36 | dom96 | I'm just compiling with destructors disabled |
23:24:50 | smitop | If httpclient gets a response with multiple identical header names (For example, if multiple cookies are set, multiple `Set-Cookie` headers will be used), how can I access all those headers? |
23:28:02 | dom96 | headers["Set-Cookie", 0] etc |
23:37:36 | smitop | Is there any way to loop over each of the `Set-Cookie`s? |
23:39:05 | dom96 | headers.seq[string] or (seq[string])(headers) or something like that |