<< 22-03-2019 >>

00:00:10rayman22201ryukoposting, how are you doing the codegen now? are you using the compiler api or just handwritten generator? I've been silently watching with great curiosity lol.
00:06:26ryukopostinghandwritten generator now. There's just a lot of packaging issues that would arise from doing it all with macros
00:06:44ryukopostingit most certainly can be done though, and surprisingly fast when the devel compiler cooperates lol
00:07:19ryukopostingsadly, AWS is just too large for it to handle, and distributing the JSON spec files with any degree of portability would be a mess
00:08:22*solitudesf quit (Ping timeout: 245 seconds)
00:09:11ryukopostinghowever, the new codegen approach is going great. I'm using ec2 and s3 as my guinea pig APIs to test things. codegen's output is (mostly) NEP-1 compliant, includes a ton of doc comments too
00:10:21ryukopostingec2 is enormously complicated and the output code is about 33,000 lines, but it still compiles in under 4 seconds
00:14:08*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
00:14:30ryukopostingI'm a complete newbie when it comes to AWS, thankfully I've got a very experienced person working with me on this thing
00:17:17rayman22201I'm familiar with the AWS api shenanigans. I think it's a cool project.
00:18:06ryukopostingholy moly dude, their API is a mess
00:18:32ryukopostingeven their spec makes it pretty clear that the entire thing is based on some kind of enormous Java hackjob
00:19:25rayman22201oh gawd yeah.... I used to have huge discussions with the Amazon support people over this at a previous job.
00:19:30rayman22201I've always been quite impressed with nims compile speed considering all it does. That's why Araqs incremental compilation project always seemed cool but unnecessary to me lol. I'm kind of glad that he decided to do destructors first.
00:20:14ryukopostingLaunchTemplateInstanceNetworkInterfaceSpecificationRequestList
00:20:22*rnrwashere joined #nim
00:20:23ryukopostingthis is an actual type in the output codegen
00:20:41ryukopostingthankfully, users will never have to actually type that abomination out
00:20:46rayman22201lol
00:21:24rayman22201Neither do they... Eclipse autocomplete does it for them.... *vomit*
00:21:39*ryukoposting pukes
00:22:54ryukopostingI have strayed so far from that kind of workflow, I don't even know what I'd do if I had to use eclipse or something like it
00:23:42rayman22201The really have no incentive to fix it either. People will still keep using AWS
00:23:53rayman22201hey, it creates an opportunity for you :-P
00:25:04ryukopostingany change they make to that API has the potential to knock out half the WWW, I can hardly blame them
00:26:37rayman22201monopoly power at work :-P
00:26:58*leorize joined #nim
00:27:09ryukopostingthere's not a lot of companies who can use that as an excuse lol
00:27:27ryukoposting"if we change this, half the internet goes down for at least a week or two"
00:27:29*chimez joined #nim
00:27:52*chimez quit (Client Quit)
00:29:02rayman22201lol. meh
00:29:26rayman22201The only sad part about handwritten codegen to me is the "stringification" of types that happens. It has to typecheck eventually, when you use the generated code, but there is that in-between place, where you have generated source code that could be complete garbage and you have no real way to check it.
00:29:52ryukopostingyeah, that's the challenge
00:30:49ryukopostingmy approach to it is to manipulate the data as little as possible, just spit out procs that all call a single common one that does the real heavy lifting
00:32:50rayman22201That's a very lisp way to go about it. Not a half bad plan :-P
00:34:52*couven92 quit (Ping timeout: 246 seconds)
00:37:42rayman22201The reason I asked about the compiler api, is that in theory, you could do something that acts like you are writing macros (as in you are generating a nim AST), but it generates nim source code as the end result (at runtime).
00:39:16rayman22201The compiler api is this super under-documented thing that lets you use the compiler itself as a library. I think it's a cool idea and I have all this interesting ideas about it, but I haven't had time to really play with it all.
00:40:25rayman22201idk if that made any sense. I'm rambling. You are doing cool stuff ryukoposting, carry on :-P
00:40:28*abm quit (Ping timeout: 246 seconds)
00:41:02ryukopostingwat
00:41:08ryukopostingI didn't know that was even a thing
00:41:08rayman22201hahahaha
00:41:11ryukopostingthat's neat
00:41:51rayman22201This is the only docs for it: https://github.com/nim-lang/Nim/tree/devel/tests/compilerapi
00:43:00ryukopostingmyscript.nim
00:43:54rayman22201I use the term "docs" loosely lol
00:44:26*theelous3_ quit (Ping timeout: 268 seconds)
00:44:56ryukopostinglmao
00:45:01ryukopostinginteresting nonetheless
00:46:26rayman22201yup....
00:54:16*stefanos82 quit (Remote host closed the connection)
00:59:55*rnrwashere quit (Remote host closed the connection)
01:01:10*rnrwashere joined #nim
01:01:34rayman22201it also lets you use the nim vm as a scripting language, but that's so much more boring lol :-P
01:13:14*rnrwashere quit (Remote host closed the connection)
01:13:37*rnrwashere joined #nim
01:56:48*lritter quit (Ping timeout: 244 seconds)
02:14:23*rnrwashere quit (Remote host closed the connection)
02:16:11*rnrwashere joined #nim
02:17:09*vlad1777d quit (Remote host closed the connection)
02:18:07*vlad1777d joined #nim
02:18:55*rnrwashere quit (Remote host closed the connection)
02:22:37*rnrwashere joined #nim
02:28:13*rnrwashere quit (Remote host closed the connection)
02:29:21*vlad1777d quit (Ping timeout: 244 seconds)
02:29:39*rnrwashere joined #nim
02:35:59*rnrwashere quit (Remote host closed the connection)
02:37:24*rnrwashere joined #nim
02:38:51*rnrwashere quit (Remote host closed the connection)
02:42:52*rnrwashere joined #nim
02:47:10*rnrwashere quit (Ping timeout: 252 seconds)
02:55:48*dddddd quit (Read error: Connection reset by peer)
03:05:54*banc quit (Quit: Bye)
03:26:42*banc joined #nim
03:47:42*shashlick joined #nim
04:17:44*chemist69 quit (Ping timeout: 252 seconds)
04:19:44*chemist69 joined #nim
04:24:12*nsf joined #nim
04:25:15FromGitter<kayabaNerve> I found... something
04:25:18FromGitter<kayabaNerve> I ran the Nim compiler
04:25:29FromGitter<kayabaNerve> And it crashed
04:25:31FromGitter<kayabaNerve> With no error
04:26:20FromGitter<kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c9463ec5547f77448454017]
04:28:47FromGitter<kayabaNerve> I forgot how to debug these
04:31:33*msmorgan quit (Ping timeout: 250 seconds)
04:33:17*zielmicha__ quit (Ping timeout: 250 seconds)
04:33:17*nimblepoultry quit (Ping timeout: 250 seconds)
04:33:45*enigmeta quit (Ping timeout: 268 seconds)
04:33:58*enigmeta joined #nim
04:35:00FromGitter<Varriount> @kayabaNerve run a debug version of the compiler
04:35:07*uptime quit (Ping timeout: 240 seconds)
04:35:17FromGitter<Varriount> One that wasn't built with -d:release
04:36:07FromGitter<Varriount> Alternately, build with `-d:release --stacktrace:on --linetrace:on`
04:36:09*nimblepoultry joined #nim
04:37:21*lritter joined #nim
04:37:51FromGitter<kayabaNerve> I did try verbosity three, but that didn't do much. The last file is a new file, but I do anything... hyper-quirky. The last bits mentioned in verbosity 3 are in a different file, which while related to the new file, compiled fine previously.
04:38:14FromGitter<kayabaNerve> I currently build the project as debug with stack and linetrace on
04:38:42*zielmicha__ joined #nim
04:38:43*Senketsu quit (Quit: WeeChat 2.4)
04:38:54*msmorgan joined #nim
04:39:02FromGitter<kayabaNerve> As for a debug version of the compiler, if I'm Ubuntu using choosenim, what's the best way to grab one?
04:41:28FromGitter<kayabaNerve> No difference under release.
04:42:29FromGitter<kayabaNerve> Looks like I have to build a debug compiler...
04:42:54FromGitter<kayabaNerve> Grabbing devel first to see if this was already fixed.
04:46:02*uptime joined #nim
04:47:18*lritter quit (Ping timeout: 244 seconds)
04:55:39*noeontheend quit (Read error: Connection reset by peer)
04:56:48*noeontheend joined #nim
05:10:18*I_Right_I quit (Remote host closed the connection)
05:23:07*leorize quit (Quit: WeeChat 2.3)
05:53:16FromGitter<kayabaNerve> Sorry for the delay; it didn't work on devel but devel debug at least gave me a... report.
05:53:32FromGitter<kayabaNerve> @Varriount Are you still available or did you head off?
05:55:30FromGitter<kayabaNerve> https://gist.github.com/kayabaNerve/4660b199c6ac133afdec52f10e1c1d21
06:01:03FromGitter<kayabaNerve> Working on a MWE...
06:01:23*narimiran joined #nim
06:24:12*noeontheend quit (Ping timeout: 252 seconds)
06:47:08FromGitter<Varriount> @kayabaNerve I'm here
06:47:20FromGitter<Varriount> For at least another half hour
06:47:51FromGitter<kayabaNerve> I filed a bug report.
06:47:54FromGitter<kayabaNerve> It's messy as hell.
06:47:59FromGitter<kayabaNerve> https://github.com/nim-lang/Nim/issues/10884
06:48:34FromGitter<kayabaNerve> It has to deal with chaining two funcs together in a default argument, but it's only a crash if it's right after a multi-type argument.
06:48:42FromGitter<kayabaNerve> I wish I was joking...
06:55:17*jjido joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:46*gmpreussner joined #nim
07:07:19*krux02 joined #nim
07:16:05*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:20:47*solitudesf joined #nim
07:20:57*jjido joined #nim
07:34:36FromGitter<Varriount> @kayabaNerve Wow. I can't recall the last time there was an infinite loop bug
07:35:09FromGitter<Varriount> I congratulate you on being able to reduce that down to a minimal example.
07:38:20*PMunch joined #nim
07:50:52*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:57:51*cyraxjoe quit (Ping timeout: 246 seconds)
07:58:30*cyraxjoe joined #nim
08:01:44*noeontheend joined #nim
08:02:20FromGitter<kayabaNerve> I haven't found any crashes like this for months. 0.19 has truly been a great release for stability. I've done some things which don't print a clean error, but it prints an error.
08:03:20FromGitter<kayabaNerve> Happy to have another badge of honor :P Thankfully, this was a test based on one of the lowest parts of my codebase, and not an actual part of it.
08:04:14FromGitter<kayabaNerve> That said, I have no idea how to fix it. I hope I've provided enough info/context around it that you don't have to spend too long figuring what the actual bug is.
08:11:32AraqI'm working on it
08:17:40*leorize joined #nim
08:19:21*solitudesf quit (Quit: Leaving)
08:19:37*solitudesf joined #nim
08:20:07*solitudesf quit (Remote host closed the connection)
08:20:27*solitudesf joined #nim
08:20:59*chimez joined #nim
08:32:30FromGitter<kayabaNerve> Oh sweet. I wasn't expecting a bug this specific/weird to be fixed for weeks. Thanks.
08:33:09Araqit's an embarrassing oversight
08:33:26Araqthe compiler only checks for 'proc' in default arguments to prevent this endless recursion
08:33:34Araqand you wrote 'func'
08:37:54FromGitter<kayabaNerve> So would proc pad {.noSideEffect.} work?
08:38:13Araqthe .noSideEffect is inferred for you anyway, but yes
08:38:37Araqinteresting to see how popular 'func' has become
08:38:37FromGitter<kayabaNerve> Good to know. I'm building devel now to test it and then will close the issue.
08:39:01Araqthe fix is not on devel, it's in a branch that is being tested
08:39:08Araqleave the closing to me please
08:43:36FromGitter<kayabaNerve> I realized; I moved over to your branch and it's finishing building now.
08:43:40FromGitter<kayabaNerve> Alrighty.
08:44:06PMunchAraq, yeah func is great :) I've been waiting for it ever since I read that it was a planned feature
08:45:13FromGitter<kayabaNerve> I use it everywhere possible. Better to have than not have, AND it will help me when I'm working on upgrades in the future.
08:45:30FromGitter<kayabaNerve> I can swap out any func function with one that generates the same output from the same input...
08:45:50FromGitter<kayabaNerve> I mean, sure, I can write procs like that, but the Nim's compiler badge of... sameness is great
08:46:46PMunchThe nice thing about func is that you make it explicit that it should be a function and not a procedure. If I want to change your code I need to make sure that this holds
08:47:03PMunchIt's such a subtle thing, but really nice to have
08:49:31FromGitter<kayabaNerve> My main annoyance is echo
08:49:47narimiranthere's `debugEcho`
08:49:53FromGitter<kayabaNerve> Part of me feels func should automatically replace all `echo` with `debugEcho`
08:50:10*chimez quit (Quit: chimez)
08:50:10FromGitter<kayabaNerve> I know. I just don't like forgetting I can't use echo, failing to compile, and then going back.
08:50:29FromGitter<kayabaNerve> My project is 7k lines.
08:50:44FromGitter<kayabaNerve> Not the worst, of course, but there's a noticeable compilation time.
08:53:44FromGitter<kayabaNerve> Araq Works for me. Thank you
08:55:11*abm joined #nim
09:33:15*dddddd joined #nim
09:54:14*shashlick_ joined #nim
09:54:33Araqyeah, IMO 'echo' should be noSideEffect
09:54:42*shashlick quit (Ping timeout: 252 seconds)
09:55:56*shashlick_ quit (Remote host closed the connection)
10:02:33FromGitter<mratsim> so stdout is not a side-effect?
10:03:05PMunchYeah that's not right
10:03:58FromGitter<mratsim> I think that's exactly the kind of bug the compiler should catch
10:04:28FromGitter<mratsim> same vein as cast and unsafeAddr, make the opt out explicit
10:05:41Araq'echo' is special.
10:06:07Araqecho doesn't touch 'stdout', that's an implementation detail, on JS it outputs to the browser's console
10:07:28FromGitter<mratsim> seems like high priority to me: https://github.com/nim-lang/Nim/issues/10886
10:07:43narimirani was about to post it here
10:07:44FromGitter<mratsim> I certainly don't want to hunt this kind of bugs
10:08:52narimirandon't know if you saw my edit? `result = result or false` works
10:09:28AraqdebugEcho vs echo is simply sophistry, 'echo' is what everybody likes for debugging
10:09:52Araqbut whatever, I'm not gonna change it
10:10:52FromGitter<mratsim> yeah I saw miran
10:11:27PMunchAraq, well a terminal utility would use "echo" as its main output.
10:12:31Araqa terminal utility should use stdout.write()
10:19:30Calinouthere's also styledWriteLine so using stdout.write() for non-colored lines makes sense
10:25:30narimiranmratsim: `result = true and result` is also wrong
10:25:46Araqfix it
10:26:32Araqit's not hard, in the vmgen for mOr and mAnd you need to enforce a temp and move the temp to 'dest' after the evaluation
10:26:57narimiranok
10:27:02Araqthe C codegen used to have exactly the same bug :-)
10:27:13Araqit's the number one codegen bug in Nim.
10:28:27Araqbecause the codegens are overly aggressive and ignore aliasing problems :P
10:32:33*rnrwashere joined #nim
10:34:16FromGitter<mratsim> I would love if GCC and CLang were a bit more aggressive and I didn't have to decorate my pointers with restrict everywhere on the other hand ;)
10:34:49Araqhow do you get this annotation with Nim?
10:35:02Araqit needs codegen support IMO
10:35:33FromGitter<mratsim> https://github.com/numforge/laser/blob/master/laser/compiler_optim_hints.nim#L23-L26
10:35:48FromGitter<mratsim> I can't use it for function parameters but I can use it for variables
10:36:38Araqthat sucks, we need restrict support
10:36:47FromGitter<mratsim> and then I use it like this: https://github.com/numforge/laser/blob/e0eaf2e7f6e10756156e7bec6afd6cbc06ab19b3/benchmarks/transpose/transpose_bench.nim#L84-L89
10:37:12*rnrwashere quit (Ping timeout: 252 seconds)
10:37:38FromGitter<mratsim> well restrict is pointer only, and we want to make sure that we only need those in very specific cases
10:37:38Araqwe have aliasing rules in Nim btw, in the compiler
10:38:44Araqproc foo(x: var openArray[int]; y: openArray[int]) # x can be 'restrict'. Why? Because we need to have aliasing control at the callsite anyway in order to prove programs correct
10:43:06FromGitter<mratsim> btw, would you be open to an overload of `||`: https://nim-lang.org/docs/system.html#||.i%2CS%2CT%2Cstring with a "step" parameter? ⏎ ⏎ Currently I have to revert to C if I want to do loop tiling/blocking: https://github.com/numforge/laser/blob/e0eaf2e7f6e10756156e7bec6afd6cbc06ab19b3/laser/primitives/swapaxes.nim#L48-L49
10:43:36Araqyup, please add it
10:44:26FromGitter<mratsim> or do a division first and recompute the index: https://github.com/numforge/laser/blob/master/laser/primitives/matrix_multiplication/gemm.nim#L164-L168
10:52:02*ng0 joined #nim
10:52:29*stefanos82 joined #nim
10:59:14*enigmeta quit (Ping timeout: 252 seconds)
10:59:26*enigmeta joined #nim
10:59:58*zielmicha__ quit (Ping timeout: 252 seconds)
10:59:58*nimblepoultry quit (Ping timeout: 252 seconds)
11:00:17*zielmicha__ joined #nim
11:00:20*msmorgan quit (Ping timeout: 252 seconds)
11:00:56*nimblepoultry joined #nim
11:03:21*msmorgan joined #nim
11:08:13*seni quit (Quit: Leaving)
11:16:13*couven92 joined #nim
11:32:28*seni joined #nim
12:04:52*vlad1777d joined #nim
12:07:13*MD87_ joined #nim
12:08:59*a_chou joined #nim
12:09:08*a_chou quit (Client Quit)
12:10:57*MD87 quit (Disconnected by services)
12:10:58*MD87_ is now known as MD87
12:14:33*zielmicha[m] quit (*.net *.split)
12:14:33*TheManiac[m] quit (*.net *.split)
12:14:33*junk[m] quit (*.net *.split)
12:14:34*GitterIntegratio quit (*.net *.split)
12:22:41*GitterIntegratio joined #nim
12:22:47*zielmicha[m] joined #nim
12:22:48*junk[m] joined #nim
12:22:51*TheManiac[m] joined #nim
12:24:48FromGitter<kayabaNerve> I was trying to rename an Exception
12:25:21FromGitter<kayabaNerve> ```code paste, see link``` ⏎ ⏎ Neither B, C, or D work with newException(). Is this my fault or no? [https://gitter.im/nim-lang/Nim?at=5c94d4313dd8171149322937]
12:40:51*neceve joined #nim
12:42:12Araqsounds like a compiler bug
13:02:18FromGitter<kayabaNerve> I assumed B would work, but figured it may be D due to the language spec.
13:02:28FromGitter<kayabaNerve> I'll create an issue
13:02:32Araqty
13:03:07FromGitter<kayabaNerve> Happy to help. It makes life better for all of us ;)
13:03:19FromGitter<kayabaNerve> Well. I mean you do have one more thing to fix...
13:03:55Araqwait
13:03:57Araqraised object of type $1 does not inherit from Exception
13:04:04Araqis an intended error
13:04:10Araqwhat is your error message?
13:05:31FromGitter<kayabaNerve> `A.nim(6, 1) Error: only a 'ref object' can be raised`
13:05:34FromGitter<kayabaNerve> I'm on stable.
13:05:48Araqwell that's correct
13:06:08FromGitter<kayabaNerve> I get your error when I switch to devel.
13:06:29FromGitter<kayabaNerve> If I define B = A, shouldn't B = ref object of Exception?
13:07:17Araqyes that's a type alias
13:07:23Araqtype aliases should be allowed
13:07:58FromGitter<kayabaNerve> So I should create an issue for B?
13:10:00Araqyes
13:10:38FromGitter<alehander42> if i
13:10:41FromGitter<alehander42> compile A
13:10:51FromGitter<alehander42> and i have nim.cfg path:".." in B/
13:11:00FromGitter<alehander42> and B/C.nim imports A
13:11:04FromGitter<alehander42> should this work?
13:11:16FromGitter<alehander42> (it's /A.nim /B/C.nim)
13:11:55FromGitter<alehander42> basically A.nim imports B/C.nim and B/C imports A_sibling (which is in the root dir)
13:13:00FromGitter<alehander42> hm it seems it works only if i compile B/C
13:13:20FromGitter<kayabaNerve> Done
13:15:51Araqthe config system doesn't care about configs not part of the project.nim file
13:20:04FromGitter<alehander42> about .cfg?
13:22:04Araqif you have module.nim and module.nim.cfg and then main.nim and you compile 'nim c main.nim'
13:22:13Araqand main.nim imports module.nim
13:22:21FromGitter<alehander42> ah so i just need a nim.cfg in the root folder
13:22:22Araqthen module.nim.cfg is NOT used.
13:22:41FromGitter<alehander42> but what can i do there ? path:"." ?
13:22:50FromGitter<alehander42> would this make child folders import parent files
13:23:17Araqit would add the current working directory to your --path
13:23:52Araqin general you're much better off with import ".." / [foo, bar, baz] and no config whatsoever
13:23:56FromGitter<alehander42> awesome thanks
13:24:01FromGitter<alehander42> well i am autogenerating nim code
13:24:03FromGitter<alehander42> so this would be hard
13:24:28FromGitter<alehander42> i mean it can work, but it's ok this way
13:27:43Araqnim c src/foo.nim vs cd src && nim c foo.nim
13:28:11Araqboth should work IMO, with '.' in your --path you break this
13:28:48*sealmove joined #nim
13:29:03Araqit's better to not use --path, less complexity
13:29:51FromGitter<alehander42> yeah but in this case it doesn't make too much sense to be able to run the second one
13:30:31FromGitter<alehander42> in principle i like the ability to refactor: you can move a component or a directory without changing the import paths
13:31:23AraqI disagree, if you want to ignore the subdirs in your import statement, why even have them
13:32:28FromGitter<alehander42> well, you can have different kinds of modules
13:32:31FromGitter<alehander42> which you want to group
13:32:37FromGitter<alehander42> e.g. if i have 100 plugins
13:32:40FromGitter<alehander42> i dont want them all in my root
13:32:46Araqgrouping is allowed in 'import' too
13:33:27FromGitter<alehander42> yes, but why would i want to have the ../ everywhere in the plugin import lines
13:33:34FromGitter<alehander42> and what happens if i decide to add subgrouping
13:33:47FromGitter<alehander42> e.g. plugins/a/ plugins/b/
13:33:51Araqbecause it keeps you honest about your subdir structure
13:34:31Araqlook, I know subdirs are super annoying. The solution is to not use them. The solution is not to pretend they are awesome and then ignore them.
13:34:50FromGitter<alehander42> you mean more than 1 nester dir
13:35:12AraqI mean directories. They are a productivity killer.
13:35:19FromGitter<alehander42> well eh
13:35:32FromGitter<alehander42> if you have 500 files, you need some kind of hierarchy
13:35:33Araqbut I know nobody agrees with me, so whatever.
13:35:41FromGitter<alehander42> the stdlib also have it
13:35:59FromGitter<alehander42> i kinda agree with many nested dirs, but at least 1 level is ok
13:36:27FromGitter<alehander42> or if you have "swappable" parts, its convenient to be able to replace a folder and be good to go
13:36:42FromGitter<alehander42> e.g. themes/configs
13:36:53Araqthe stdlib tries to not to piss off too many people. What I do in nim doesn't always reflect my personal opinions.
13:37:55FromGitter<alehander42> my perfect ide would have different "views", so one would be able to just have a single list of files and define different hierarchies
13:38:15FromGitter<alehander42> and one to use the view he wants
13:38:25Araqbut what's the point of these hierarchies. it is nimsuggest/tests or tests/nimsuggest
13:38:25FromGitter<alehander42> i think this could be a cool compromise
13:38:55FromGitter<alehander42> well, you can have e.g. web apps with hierarchies based on components / on features / on something else
13:39:05FromGitter<alehander42> or just a flat list like you want
13:39:08FromGitter<alehander42> thats the point
13:39:39FromGitter<alehander42> and the import mechanism will be independent and just import flatly
13:39:46Araqok. but everybody should want the flat list.
13:40:04Araq;-)
13:40:06solitudesftrue
13:40:09FromGitter<alehander42> but whats the point of having images, css files and nim files all in one list :)
13:40:50AraqI press control+P, type in 'tester.nim' and pick the wrong one because we have 4 of these
13:41:09FromGitter<alehander42> well now you'd just move the directory name in the filename
13:41:15FromGitter<alehander42> this is like E_F instead of E::F
13:41:21*rnrwashere joined #nim
13:41:33Araqyes, it's "Just a move", but it helps in practice
13:42:03FromGitter<alehander42> it depends
13:42:07FromGitter<alehander42> but in my case i still disagree
13:42:15FromGitter<alehander42> i have a dir with e.g. 100 plugins
13:42:19FromGitter<alehander42> i dont want it to pollute the root
13:43:07FromGitter<liquid600pgm> is there any way of debugging segfaults on -d:release?
13:43:39FromGitter<mratsim> Anyone with better links to explain how to start with nim macros? https://www.reddit.com/r/programming/comments/b38o8c/lisp_macros_delayed_evaluation_and_the_evolution/ej0glml?utm_source=share&utm_medium=web2x
13:44:06FromGitter<alehander42> btw i wanted to ask: how optimized are single dispatch methods
13:44:07FromGitter<mratsim> @lqdev import segfaults and also do not turn stacktraces off
13:44:25Araqliquid600pgm: compile with --debugger:native and run it in gdb
13:44:35narimiranmratsim i don't see the macro tutorial there: https://nim-lang.github.io/Nim/tut3.html
13:44:36FromGitter<alehander42> i feel that in some cases they should be as cheap as normal calls, but maybe i am missing something: i wonder about the case when
13:44:39Araqdebuginfo is independent of -d:release
13:44:52FromGitter<alehander42> hm, i should be wrong
13:44:56FromGitter<mratsim> @alehander42: fast and slow :P. In the ideal case they are only 3x more expensive than proc calls
13:45:15FromGitter<alehander42> i have the case where i have many types that are final
13:45:17FromGitter<mratsim> but when you have inherited objects of inherited objects it's slow
13:45:27FromGitter<alehander42> so i think that if the compiler knows
13:45:40Araqif you don't override them there is no overhead but usually you use method because you wanna override them
13:45:46FromGitter<mratsim> For example: only 3x slower than proc: https://github.com/mratsim/Arraymancer/blob/master/benchmarks/implementation/proc_method_closure_bench.nim
13:45:51*rnrwashere quit (Ping timeout: 252 seconds)
13:45:52FromGitter<alehander42> yeah i wonder about when
13:45:54*cgfuh joined #nim
13:45:57FromGitter<alehander42> a and b are both overriden
13:46:06FromGitter<alehander42> and child a calls child b
13:46:27FromGitter<mratsim> and super slow methods for VM dispatch: https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources#nim-implementation-benchmark
13:46:29FromGitter<alehander42> if the compiler knows they're final, so it's exactly Child#b
13:46:46FromGitter<alehander42> would this help to skip a step
13:47:04Araqusually .final really helps, yes
13:47:25FromGitter<alehander42> huh, so we already have final
13:47:40Araqit refers to object types, not to methods
13:47:50FromGitter<alehander42> yes
13:48:49FromGitter<alehander42> so in this case is a direct call generated?
13:48:52FromGitter<alehander42> i can look at the code
13:49:12FromGitter<mratsim> it creates a proc with a tree of if
13:49:28FromGitter<mratsim> you can inline your methods in that tree if you want
13:49:30FromGitter<alehander42> thanks for the links @mratsim
13:49:44Araqthe 'tree of ifs' can be empty
13:49:56FromGitter<alehander42> yes, but i wondered if this is optimized for the final calling the same final
13:50:09AraqI don't remember, probably not
13:50:28*Senketsu joined #nim
13:53:18FromGitter<alehander42> final => parent its the same right
13:53:24FromGitter<alehander42> yeah it makes sense
13:57:33*sz0 joined #nim
14:02:06FromGitter<liquid600pgm> Araq: how could a segfault occur within a thread?
14:02:32FromGitter<liquid600pgm> I'm not trying to access any GC'd memory, just doing some computations and sending the results through a Channel
14:05:25FromGitter<liquid600pgm> it seems my program runs so fast under `-d:release` some kind of race condition (?) occurs and the GC tries to deallocate some memory that's already deallocated
14:07:08FromGitter<liquid600pgm> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c94ec0b8126720abc25c289]
14:10:23FromGitter<liquid600pgm> I'm using the low-level API by the way, as I'm writing a benchmark and need full control over the threads' affinities
14:11:47Araqmaybe you use the low level API incorrectly?
14:12:30FromGitter<liquid600pgm> is there a tutorial covering it? I couldn't find that much info in Nim's docs
14:13:28Araqdon't use ptr/cast/addr and then it's safe
14:14:03Araqoh and use Thread and Channel only as global variables
14:14:47FromGitter<alehander42> hm so there is one redirect with finals
14:14:56FromGitter<liquid600pgm> so I can't create a `Thread` in a proc, and then receive events from the thread in that proc?
14:16:36FromGitter<alehander42> so yeah its not optimized: but i dont know how hard would it be
14:16:53FromGitter<alehander42> but this is not last devel (but i guess this hasnt changed)
14:17:17FromGitter<liquid600pgm> making threads globals fixed the problem, thanks
14:19:15Araqthreads are too heavy to allocate in a proc anyway
14:27:50sealmoveguys, simple question: when I pass a `typed` symbol in a macro, how do I get the symbol's identifier and type?
14:32:37FromGitter<alehander42> hm how is untyped working with class types Araq
14:32:44FromGitter<alehander42> it seems if i have a template
14:32:50FromGitter<alehander42> and i pass a child type
14:32:57FromGitter<alehander42> nim automatically does ->Sup it
14:33:01FromGitter<alehander42> to pass the parent
14:33:09FromGitter<alehander42> i am not sure why
14:33:48Araqbecause C lacks inheritance?
14:34:02Araqsealmove: macro.getType, getTypeInst, getTypeImpl
14:34:12Araqmacros.getType, getTypeInst, getTypeImpl
14:34:37sealmoveI saw these, but documentation doesn't explain what exactly they return
14:34:51FromGitter<alehander42> hm then would generics work
14:35:24sealmoveif you pass a `x: int` then getType gives you `int` and getTypeInst gives you `x`?
14:37:34Araqin what world is 'x: int' a type?
14:37:49Araqlooks like a declaration with a type part to me.
14:38:31sealmovebut I need both the type and the symbol `x`, seperately
14:39:03FromGitter<alehander42> but then this seems to happen with method calls too
14:39:11sealmoveso these 3 procs are for retrieving the type, what about the identifier?
14:39:41FromGitter<alehander42> ahh this is because of alias
14:39:48FromGitter<alehander42> so basically if i have A = B
14:39:54FromGitter<alehander42> and i override with A instead of B
14:39:58Araqsealmove: the identifier is not part of the type
14:39:59FromGitter<alehander42> it seems nim doesnt recognize this
14:40:02FromGitter<alehander42> is this a bug Araq?
14:40:04FromGitter<alehander42> or intended
14:40:28sealmoveohh, so if you pass `typed` then you lose that info?
14:40:32Araqtype aliases shouldn't influence method bindings
14:40:48Araqhow can you even pass 'x: int' to a 'typed' macro?
14:41:09Araqit doesn't type check.
14:41:21Araq(undeclared identifier: 'x' )
14:43:28FromGitter<alehander42> yeah Araq i was wrong, my macro was doing another thing
14:44:04sealmovehmm, https://termbin.com/pu1x
14:45:53sealmoveis there a way to pass both the identifier's name and the type to a macro? but user is only required to write the identifier?
14:48:34Araqmymacro(identifier, typeHere)
14:49:01Araqmymacro: identifier: typeHere # requires a staging approach
14:52:18*lritter joined #nim
14:52:34*Vladar joined #nim
14:54:31*PMunch quit (Remote host closed the connection)
14:56:18FromGitter<arnetheduck> what's the latest on pattern matching in nim? I remember someone was playing with some macros for that?
14:57:26*stefanos82 quit (Remote host closed the connection)
14:58:41FromGitter<alehander42> i have a lib called gara
14:58:48FromGitter<alehander42> but i dont know if anybody uses it
15:00:00FromGitter<alehander42> https://github.com/alehander42/gara
15:00:07FromGitter<alehander42> it should be extendable
15:00:20FromGitter<alehander42> but its still not stable
15:01:27FromGitter<alehander42> @krux02's ast_pattern_matching is the one for macros and andreaferretti's patty is also general purpose(but we planned to combine our efforts with him maybe)
15:02:22FromGitter<arnetheduck> mm.. I'm looking for something where I can match over object variants (ie objects with `case kind` in them), and pick out the fields conditionally
15:02:43FromGitter<alehander42> for what
15:02:50FromGitter<alehander42> yes, this should be possible
15:03:14FromGitter<alehander42> variant objects are one of the main usecases: but maybe its not very optimized yet(it doesnt generate a `case`)
15:03:37*arecacea1 quit (Remote host closed the connection)
15:03:56*arecacea1 joined #nim
15:07:56FromGitter<arnetheduck> for example: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ doing it this way, the construct *should* be guaranteed to never trigger FieldError or whatever it's called, so in the generated code there should be no exceptions / cost.. and ideally, it would also report any cases that were not covered [https://gitter.im/nim-lang/Nim?at=5c94fa4c6a3d2e230d090203]
15:08:37FromGitter<arnetheduck> (syntax doesn't matter, just typing out an example)
15:09:48FromGitter<alehander42> the first part should be possible now
15:10:01FromGitter<alehander42> the second part isnt happening yet
15:10:17Araqthere is also nim c --warning:ProveField:on temp4.nim
15:10:20FromGitter<alehander42> (finding out if there are not-covered cases)
15:10:34Araqto enforce you got your case object fields right
15:11:35FromGitter<arnetheduck> oh, there's a field prover? what does it support? both case and if?
15:11:39FromGitter<alehander42> actually yeah, i dont think the lib checks for correct fields: it expects the generated code to eventually compiletime check
15:11:56FromGitter<alehander42> (the provefield thing)
15:12:19Araqarnetheduck: I don't remember, I think both
15:12:37Araqthere is also a branch with a better prover somewhere
15:12:51Araq(yay, working with branches)
15:14:54*lf-araujo joined #nim
15:15:21FromGitter<arnetheduck> interesting.
15:15:38Araqand before you bring it up. Yes this ProveField:on should be the default and disabled for the compiler.
15:16:59*rnrwashere joined #nim
15:27:10FromGitter<arnetheduck> me? arguing for safe defaults and clean compiler code? where did you ever get that idea? :)
15:30:52*Trustable joined #nim
15:37:30*noeontheend quit (Ping timeout: 252 seconds)
15:38:25Araqmaybe I confused you with arnetheturtle
15:38:53FromGitter<mratsim> > _>
15:39:03*krux02 quit (Remote host closed the connection)
15:41:20*krux02 joined #nim
15:45:37sealmove hahahaha
15:46:32sealmove(sorry, for some reason I laughed xD)
15:58:12sealmoveAraq, I found the solution! passedArgument.repr
15:58:53sealmoveso if I pass `x: int` as `typed`, x.repr gives me `x` and getType(x) give me `int`
16:02:47sealmove(I mean, pass `x` which is of type int)
16:07:30FromGitter<mratsim> but it will always give you x I think
16:07:44FromGitter<mratsim> or I missed something.
16:08:24FromGitter<mratsim> it's only with untyped that you can get the proper identifiers, with anything else you only get the new identifier associated for the template/macro call.
16:08:37FromGitter<mratsim> had this issue a lot with astToStr function
16:10:52*abm quit (Ping timeout: 245 seconds)
16:12:44sealmovemratsim: what do you mean "proper identifiers"?
16:13:30sealmoveI only need it as string actually, don't need other metadata
16:13:49sealmovebut still curious about what more you get with untyped
16:14:48FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c9509f7d0133e21e5f97a83]
16:15:07FromGitter<mratsim> and let me try with macros now
16:15:40*lf-araujo quit (Ping timeout: 250 seconds)
16:16:22FromGitter<mratsim> mmh seems you get a in both case. weird, I'm pretty sure I remember a case where I had the local identifier bound
16:16:46FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c950a6e3dd817114933bdd4]
16:22:10sealmoveyeah, it works
16:22:48sealmovemaybe you did astToStr instead of repr, in the macrto
16:22:49sealmovemacro*
16:23:29sealmovedunno
16:23:32FromGitter<liquid600pgm> how do I add conditional flags to `nim.cfg`? more specifically, I want to create a `-d:windows` flag which makes Nim use the MinGW toolchain
16:24:17*gh0st[m] joined #nim
16:24:28Araqyou write '-d:windows' in your nim.cfg
16:25:00Araqbut keep in mind that the global nim.cfg is processed before your local nim.cfg and so doesn't pick up the -d:windows switch
16:25:56FromGitter<liquid600pgm> that's not what I want, I want nim.cfg to trigger some extra flags when I pass `-d:windows` to `nim c`
16:26:41Araq@if windows: ...
16:26:53Araqbut it's probably better to define -d:mingw instead
16:27:08FromGitter<liquid600pgm> yeah, but I wanted that feature on stable
16:29:01FromGitter<mratsim> I think I have most of the nim.cfg magic in Arraymancer: https://github.com/mratsim/Arraymancer/blob/master/nim.cfg and laser: https://github.com/numforge/laser/blob/master/nim.cfg
16:30:05FromGitter<mratsim> but I need a way to have projects that use Arraymancer or laser inherits my nim.cfg @Araq, it would be very annoying for people to maintain my compile flags for say AVX, SSE and such
16:30:50FromGitter<mratsim> alternatively file specific passC or passL pragma would work
16:31:27Araqdon't they work as pragmas?
16:31:33Araq{.passC: "".}
16:31:53Araqthe config system is inferior to the pragma system for these reasons.
16:33:04Araqliquid600pgm @if inside nim.cfg is part of stable
16:34:23FromGitter<mratsim> the passC will apply to all files
16:35:02FromGitter<mratsim> I want certain files to have {.passC:"-mavx".} and others {.passC:"-mavx512".}
16:53:03*I_Right_I joined #nim
17:05:10FromGitter<liquid600pgm> Araq: I was talking about `-d:mingw`, which has been introduced in devel
17:06:36FromGitter<mratsim> you'll haave to wait for 1.0 like everyone :P
17:06:57*rnrwashere quit (Remote host closed the connection)
17:10:18*rnrwashere joined #nim
17:14:09I_Right_Ianyone here have much experience using nim on Arduino?
17:15:09ryukopostingI don't, but there's some arduino nim stuff out there
17:15:11ryukopostinghttps://github.com/gokr/ardunimo
17:15:25ryukopostinghttps://gitlab.com/NetaLabTek/Arduimesp
17:16:05ryukopostingI think the project in the second link can be used to convert Nim code into arduino projects that you can run through the arduino IDE to deploy code
17:18:57sealmovenot sure if intended but my macro is not expanded before `echo`'s arguments are checked.
17:19:26sealmove(I tried to use a macro as an expression)
17:19:27*rnrwashere quit (Remote host closed the connection)
17:21:19*rnrwashere joined #nim
17:21:34I_Right_Iryukoposting: thanks
17:21:38I_Right_Iportability and easily meshing with c are some of the things that drew me to nim
17:22:37I_Right_Iplus its nice to write a GC'd app where the binary is under 200k
17:24:07FromGitter<liquid600pgm> I just made a performance benchmark in Nim: https://github.com/liquid600pgm/pibench2
17:27:04BaldEagleX02@I_Right_I: I am writing a Nim library to use Arduino boards easily
17:27:40BaldEagleX02(I am trying to wrap Arduino AVR Core libraries from C++ to Nim)
17:35:26*neceve quit (Read error: Connection reset by peer)
17:36:04FromGitter<mratsim> someone posted and arduino lib recently in the forum
17:36:09FromGitter<mratsim> an*
17:37:55FromGitter<mratsim> looks nice @lqdev
17:38:31FromGitter<mratsim> a nim progressbar package would super useful by the way
17:39:23I_Right_IbaldEagleX02: :) awesome! I am just now getting my feet wet in nim, love it so far! And using to to write for Arduino I strongly look forward too!
17:41:31*abm joined #nim
17:43:11*fanta7531 joined #nim
17:45:29I_Right_Iright now I am trying to write a library in nim similar to the enet library(UDP only). It uses thread pool and will hopefully be thread safe.
17:45:59ryukopostinghot
17:46:29ryukopostingbest of luck, man. does arduino have actual threading? seems really heavy for an 8-bit uC
17:47:12ryukopostingI've made preemptive kernels for Cortex-M0 but I can't recall ever seeing anything like that for arduino
17:47:13I_Right_Ioh not for ardunio
17:47:17ryukopostingooooooh okay lol
17:47:23ryukopostingI was concerned
17:47:24*stefanos82 joined #nim
17:50:00I_Right_Ibut even a single threaded networking interface on arduino would be fun to play with.
17:50:15*Trustable quit (Remote host closed the connection)
17:59:36xaceany recommedations for releasing binaries? atm i use nim c -d:release main.nim && strip main.exe # are there more things I can do?
18:01:15I_Right_Ixace: maybe --opt:speed
18:02:36solitudesfopt:speed is implied with-d:release
18:02:59*rnrwashere quit (Remote host closed the connection)
18:04:37xaceyeah my main concern was with things that shouldn't be in the final release of the executable, in this case if I don't `strip` the binary it leaves symbols that reveals information that shouldn't be presented to the end user
18:05:28*nsf quit (Quit: WeeChat 2.4)
18:06:00I_Right_Idoes nim have name mangling?
18:06:06FromGitter<liquid600pgm> yes
18:07:54ryukopostingthere's a pragma that turns it off though
18:08:05ryukopostingand iirc, if you use the C++ backend, it just uses C++'s name mangling
18:31:27sealmove(for anyone interested) I published a macro I've been working on https://github.com/sealmove/ease
18:31:30*rnrwashere joined #nim
18:32:25*Cthalupa quit (Ping timeout: 244 seconds)
18:32:48*noeontheend joined #nim
18:33:30*Cthalupa joined #nim
18:39:16*rnrwashere quit (Remote host closed the connection)
18:39:30*sealmove quit (Quit: WeeChat 2.4)
18:46:12*sealmove joined #nim
19:25:34sealmovedoes n.expectKind(this|that) work?
19:27:27FromDiscord<Generic> expectKind has an overload which accepts a set
19:27:50FromDiscord<Generic> so you can use n.expectKind({nnkThis, nnkThat})
19:27:56sealmoveoh nice, thx
19:28:18sealmovedidn't notice :|
19:36:24*theelous3_ joined #nim
19:46:37*rnrwashere joined #nim
19:46:39*rnrwashere quit (Remote host closed the connection)
19:50:04*sz0 quit (Quit: Connection closed for inactivity)
19:59:29*sealmove quit (Quit: WeeChat 2.4)
20:07:26*fanta7531 quit (Quit: fanta7531)
20:11:15*hoijui joined #nim
20:30:29*rnrwashere joined #nim
20:33:39*Vladar quit (Remote host closed the connection)
20:34:56*rnrwashere quit (Ping timeout: 250 seconds)
20:41:42*rnrwashere joined #nim
20:43:18*lf-araujo joined #nim
20:43:25*hoijui quit (Remote host closed the connection)
20:46:04*rnrwashere quit (Ping timeout: 250 seconds)
20:47:52*rnrwashere joined #nim
20:49:19*vegax87 quit (Changing host)
20:49:19*vegax87 joined #nim
20:49:19*vegax87 quit (Changing host)
20:49:19*vegax87 joined #nim
20:58:11*Trustable joined #nim
21:02:17*lf-araujo quit (Ping timeout: 250 seconds)
21:03:39*rnrwashere quit (Remote host closed the connection)
21:03:40ryukopostinghot take: save the new runtime for Nim 2.0 and keep the current GC
21:14:01*rnrwashere joined #nim
21:14:33*jxy quit (Quit: leaving)
21:18:16*vlad1777d quit (Ping timeout: 244 seconds)
21:18:25*rnrwashere quit (Ping timeout: 246 seconds)
21:21:17Zevvsealmove: I like anonymous, thanks
21:21:41FromGitter<iffy> I'm calling a C function that expects me to pass in a cstring, which it will write a string to. I know the length and am trying this: `var s = newStringOfCap(size + 1); napi_get_value_string_utf8(ign1, ign2, s[0].unsafeAddr, size)` but I get the error: Error: unhandled exception: index 0 not in 0 .. -1 [IndexError]
21:22:12FromGitter<iffy> oh brother; just use newString :)
21:27:46*rnrwashere joined #nim
21:31:57*rnrwashere quit (Ping timeout: 246 seconds)
21:33:03*jxy joined #nim
21:48:43Araqryukoposting: why?
21:49:03*rnrwashere joined #nim
21:51:09I_Right_Iso I found a bug, while using thread pools. iterating a 'for loop' on the main thread outside of a function(in global scope only) the 'for loop' exits early. I'll try to reproduce this with a proof case if this isn't a know issue.
21:53:25*rnrwashere quit (Ping timeout: 246 seconds)
21:55:40Araqnah, it's something else
21:56:08Araqbut sure, report it. thread pools suck though and need to be rewritten
21:57:52I_Right_IAraq: I had seen you had a few comments on thread pool issues
22:00:14I_Right_Iall i know is when i wrapped the code in a function I lost the bug.
22:06:08*jjido joined #nim
22:06:54*rnrwashere joined #nim
22:09:11*rnrwashere quit (Read error: Connection reset by peer)
22:09:24*rnrwashere joined #nim
22:17:27*Trustable quit (Remote host closed the connection)
22:34:32federico3https://github.com/nim-lang/Nim/issues/5626 any hint on this threading/channel issue?
22:37:10*I_Right_I quit (Remote host closed the connection)
22:53:06*ng0 quit (Quit: Alexa, when is the end of world?)
22:53:58*I_Right_I joined #nim
23:01:36I_Right_IAraq: To my sadness you are correct, Sir! Thread pools are as buggy as a rotted stump in the rain forest.
23:05:07*rnrwashere quit (Remote host closed the connection)
23:05:21I_Right_II don't know how I got this thread pool based UDP socket library working at all!
23:06:32AraqI_Right_I: try yglokhov's threadpool package
23:13:41federico3Araq: should people be warned not to use threadpool in the module docs?
23:25:24*solitudesf quit (Ping timeout: 252 seconds)
23:26:24*narimiran quit (Ping timeout: 244 seconds)
23:44:24*rnrwashere joined #nim
23:48:38*rnrwashere quit (Ping timeout: 250 seconds)
23:58:22FromGitter<mratsim> @lqdev used them successfully in his pibench though on my computer it's quite slow due to pthread_mutex_lock: https://forum.nim-lang.org/t/4732
23:58:37*a_b_m joined #nim