00:13:04 | * | skaruts quit (Remote host closed the connection) |
00:18:35 | FromGitter | <Obround> How do you converta seq to an openArray? |
00:19:59 | FromGitter | <awr1> openArray is a typeclass |
00:20:10 | FromGitter | <awr1> it means "either seq or array" |
00:21:12 | FromGitter | <awr1> so if you need to pass a seq to a function taking in an openArray, you don't have to "convert it" - just pass in the seq |
00:38:41 | FromGitter | <Obround> @awr1 -- I need to do it for the echoed output; I need the output to look like how an openArray looks when it is echoed. |
01:05:40 | FromGitter | <JasperJenkins> You can do what you want with `system.toOpenArray`, but totally not what its for. ```proc `$`T (xs: seq[T]): string = system.`$`(xs).substr(1)``` is better. |
01:08:48 | * | sealmove quit (Quit: WeeChat 2.5) |
01:20:27 | * | krux02_ quit (Remote host closed the connection) |
01:40:21 | * | theelous3 joined #nim |
01:53:58 | disruptek | shashlick: i'm trying to preprocess with toast and then c2nim the toast output, but toast only seems to be able to preprocess about 5% of my inputs. admittedly, with ~19,000 c files, i may have bitten off more than i can chew. |
02:05:53 | * | laaron joined #nim |
02:06:42 | shashlick | okay so i'm here now, we can go through this |
02:07:03 | shashlick | are you trying the -r flag? you need to provide the full path to the header file being processed for recursion to work |
02:15:53 | * | rockcavera quit (Ping timeout: 245 seconds) |
02:16:15 | * | rockcavera joined #nim |
02:16:29 | FromGitter | <awr1> what does the -r flag do |
02:16:43 | shashlick | recurses into #include files |
02:19:32 | disruptek | yeah, i'm providing the realpath and the --recurse. |
02:23:41 | shashlick | ok what does the output miss? |
02:23:49 | shashlick | you only want the -p flag to preprocess, not -n |
02:25:03 | disruptek | right. |
02:25:56 | disruptek | went back to the lambda client and here's the output: Error: unhandled exception: git.nim(21, 12) `ret == 0` Command failed: (1, false) |
02:26:03 | disruptek | ccmd: gcc -E -CC -dD -xc++ -w -I/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-core/include -I/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-events/include -I/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-lambda/include /home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-lambda/source/LambdaClient.cpp |
02:27:48 | shashlick | why are you running it on a cpp file? |
02:28:27 | shashlick | what does the nim file look like? |
02:28:54 | disruptek | what nim file? |
02:29:25 | disruptek | i thought i was supposed to preprocess this into a big c file and then c2nim that, no? |
02:29:29 | shashlick | or rather what does the toast command look like |
02:29:47 | shashlick | well, generally, we wrap the header file and compile in the cpp implementation |
02:30:06 | shashlick | that way nim knows how to call the implementation |
02:30:13 | disruptek | i can't wrap any of it; i just chose this one at random. |
02:30:25 | disruptek | here's an example call: toast --mode=c --includeDirs=/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-core/include --includeDirs=/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-events/include --includeDirs=/home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-lambda/include --preprocess --recurse /home/adavidoff/git/aws-sdk-cpp/aws-cpp-sdk-lambda/source/LambdaClient.cpp |
02:30:53 | disruptek | this stuff all gets generated so that it can setup the includes and control the output. |
02:31:55 | shashlick | so when you are wrapping, you want to use the header file and get function prototypes or classes mapped into nim procs and typs |
02:32:21 | shashlick | then you can either compile in the cpp code as is, or link to a dll that contains that cpp code with those func prototypes |
02:33:14 | disruptek | yeah, i'm fine with just linking it, but i can't wrap the headers, either. |
02:34:17 | shashlick | okay so let's start there - did you download the whole project? or just the lambda folder |
02:34:29 | disruptek | lambda has ~100 headers. i am able to preprocess 6 of these. |
02:34:48 | disruptek | i'm working with the whole thing. i wouldn't get far without it. |
02:34:58 | shashlick | okay - let me find the link |
02:38:18 | disruptek | here's the script i'm using to validate the output, etc: https://gist.github.com/disruptek/750bafddc733e19d59be7651ab8e3671 |
02:45:52 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
02:46:01 | shashlick | easier to use nim |
02:46:07 | shashlick | i'm trying it out, give me a few |
02:46:23 | * | laaron joined #nim |
02:46:57 | disruptek | yeah, like i said earlier, it felt like i got further in nim. but then i got the idea i was doing it wrong. :-D |
02:51:16 | shashlick | no worries, i'll get you started |
02:51:31 | shashlick | how do you get `aws/core/SDKConfig.h` |
02:51:35 | shashlick | I see a .in file |
02:51:46 | shashlick | have to run cmake? |
02:52:29 | shashlick | also, win/lin/osx |
02:53:21 | disruptek | that'll build the libs. i'm on linux. i don't think the headers will end up in the build, by and large, though. |
02:53:46 | shashlick | well, you need the libs regardless |
02:54:06 | shashlick | and you need the headers processed to generate the .h files from .in |
02:54:14 | disruptek | yeah, those are fine. but you're saying you don't have a SDKConfig.h? |
02:55:04 | shashlick | No |
02:55:19 | * | smitop quit (Quit: Connection closed for inactivity) |
02:56:25 | disruptek | mine is nimterop output. but i guess it's ignored because it's a build product, so it didn't show up as corrupted. |
02:58:34 | disruptek | hey, lemme wipe this and start over with a fresh build in nim. i don't want to mess with it tonight, as it takes awhile to build and i don't want you wasting time on a b0rken env. |
03:00:35 | disruptek | and i guess one needs to build 3 other packages as well. meh. |
03:10:01 | * | lritter quit (Ping timeout: 246 seconds) |
03:10:08 | * | artemis_coven quit (Read error: Connection reset by peer) |
03:11:06 | * | lritter joined #nim |
03:25:22 | * | fjellfras joined #nim |
03:34:28 | shashlick | no worries - i need to make some hacks into nimterop for cmake and c2nim support |
03:34:34 | shashlick | so i'll do that as part of this |
04:00:54 | * | NimBot joined #nim |
04:12:17 | * | actuallybatman quit (Ping timeout: 268 seconds) |
04:19:56 | * | Elronnd joined #nim |
04:19:58 | * | Elronnd left #nim (#nim) |
04:28:34 | * | nsf joined #nim |
04:52:37 | * | actuallybatman joined #nim |
05:30:57 | FromGitter | <gogolxdong> How to get the file name of current file? |
05:38:11 | FromGitter | <gogolxdong> this could work `currentSourcePath().split("/")[^1]` |
05:42:08 | * | solitudesf joined #nim |
05:43:34 | leorize[m] | os.extractFilename? |
05:50:24 | FromGitter | <gogolxdong> good to know, it's more gurateened ,right? |
05:50:32 | * | narimiran joined #nim |
05:53:47 | * | absolutejam joined #nim |
06:09:16 | FromGitter | <mratsim> we always use currentSOurcePath because it can work at compile-time |
06:13:40 | FromGitter | <gogolxdong> Is there any difference `const currentFileName = currentSourcePath().extractFilename().split(".")[0]` |
06:13:55 | shashlick | os procs may not work at compile time |
06:14:30 | shashlick | @disruptek - i added c2nim, cmake and make support to nimterop |
06:14:46 | shashlick | so now the wrapper looks like this - http://ix.io/1ON4/nim |
06:16:36 | shashlick | however, c2nim cannot parse the preprocessed output - http://ix.io/1ON5/cpp |
06:19:10 | shashlick | http://ix.io/1ON7 is the error message |
06:19:31 | FromGitter | <gogolxdong> `split("/")[^1]` doesn't work in Windows |
06:20:05 | shashlick | you can try editing the generated cpp but i suspect it is not going to be easy |
06:21:20 | shashlick | @gogolxdong - use split({'/', '\\'}) |
06:21:52 | narimiran | https://nim-lang.github.io/Nim/os.html#splitFile%2Cstring ? |
06:23:16 | FromGitter | <gogolxdong> Does split work better than extractFilename()? |
06:24:04 | FromGitter | <gogolxdong> efficiency or more general purpose |
06:24:11 | * | Vladar joined #nim |
06:24:38 | * | Cthalupa quit (Ping timeout: 245 seconds) |
06:24:47 | narimiran | i haven't used any of those, but it sure does look less ugly/fragile than `.split(".")[0]` |
06:28:10 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d30117a202bb93f00c3c95d] |
06:28:49 | FromGitter | <gogolxdong> you are welcome, which is champion? |
06:29:12 | narimiran | the second one certainly isn't :P |
06:29:52 | * | absolutejam quit (Ping timeout: 246 seconds) |
06:35:14 | * | jjido joined #nim |
06:48:53 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
06:56:10 | * | brakmic joined #nim |
06:59:02 | * | Cthalupa joined #nim |
06:59:59 | * | brakmic_ joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:00:21 | FromGitter | <mratsim> https://github.com/status-im/nim-decimal/blob/master/decimal/decimal_lowlevel.nim#L11 @gogolxdong |
07:00:50 | * | absolutejam joined #nim |
07:01:15 | * | krux02 joined #nim |
07:02:31 | * | brakmic_ quit (Client Quit) |
07:02:32 | * | brakmic quit (Ping timeout: 245 seconds) |
07:02:56 | * | brakmic joined #nim |
07:04:00 | * | Cthalupa quit (Ping timeout: 244 seconds) |
07:05:11 | * | gmpreussner joined #nim |
07:07:51 | FromGitter | <mratsim> i.e. use rsplit :p |
07:08:52 | FromGitter | <mratsim> can we get a warning on unused import @Araq? https://github.com/nim-lang/Nim/commit/4becd5a2a8d67c7481af457d5007e1a313d454c8 |
07:12:31 | leorize | Araq was working on it on stream yesterday |
07:19:09 | * | absolutejam1 quit (Quit: WeeChat 2.5) |
07:20:29 | * | lritter quit (Quit: Leaving) |
07:28:07 | * | Cthalupa joined #nim |
07:32:57 | * | Cthalupa quit (Ping timeout: 245 seconds) |
07:50:48 | * | Cthalupa joined #nim |
07:59:04 | * | dddddd joined #nim |
08:00:02 | * | Cthalupa quit (Ping timeout: 245 seconds) |
08:01:06 | * | theelous3 quit (Ping timeout: 248 seconds) |
08:02:39 | * | ng0 joined #nim |
08:03:14 | * | ng0 quit (Client Quit) |
08:05:35 | Araq | mratsim: ok |
08:08:09 | * | Cthalupa joined #nim |
08:11:19 | * | floppydh joined #nim |
08:15:15 | * | Cthalupa quit (Ping timeout: 258 seconds) |
08:20:12 | Araq | https://www.twitch.tv/araq4k |
08:20:19 | Araq | today's topic: nimpretty |
08:20:25 | Araq | special guest: Miran. |
08:21:29 | narimiran | trying to fix: https://github.com/nim-lang/Nim/issues/11699 |
08:26:07 | * | mal`` quit (Quit: Leaving) |
08:31:36 | FromGitter | <gogolxdong> How often is stream on? |
08:36:19 | * | mal`` joined #nim |
08:37:54 | * | absolutejam quit (Ping timeout: 248 seconds) |
08:42:05 | * | trinityhex joined #nim |
08:43:31 | * | absolutejam joined #nim |
08:43:59 | narimiran | 3.27 times per week on average |
08:48:26 | * | absolutejam1 joined #nim |
08:51:17 | * | actuallybatman quit (Ping timeout: 258 seconds) |
09:27:18 | * | Cthalupa joined #nim |
09:42:41 | * | stefanos82 joined #nim |
09:54:10 | * | solitudesf quit (Ping timeout: 248 seconds) |
10:01:02 | narimiran | nimpretty case expression example: https://github.com/nim-lang/Nim/issues/11755#issuecomment-511944563 |
10:11:09 | * | shomodj joined #nim |
10:32:25 | * | Jjp137 quit (Read error: Connection reset by peer) |
10:33:19 | dom96 | narimiran https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370 |
10:34:51 | leorize | I personally write like that |
10:35:03 | leorize | and I'm pretty sure a fair share of docs write like that |
10:36:27 | leorize | narimiran: will you ever stream? :) |
10:38:34 | dom96 | of course NEP-1 does not specify the preferred style |
10:38:44 | dom96 | there is a lot it doesn't specify |
10:39:58 | narimiran | dom96: heh, that (fooB) is what i proposed ;) |
10:40:08 | dom96 | narimiran <3 |
10:40:54 | dom96 | That style has an objective advantage: less indenting, and no need for odd indentation (which is a PITA) |
10:41:19 | narimiran | leorize: i have performance anxiety |
10:44:33 | Zevv | for an audience of 9 :) |
10:44:51 | Zevv | every time you type a line in #nim you are performing, you can do it! |
10:45:07 | narimiran | i even have an anxiety for an audience of 0. (when we record our videos) |
10:45:25 | * | clyybber joined #nim |
10:45:36 | narimiran | it is much easier to type (then delete, correct, improve) than to speak. |
10:46:00 | narimiran | i often catch myself in the middle of some sentence struggling to find an english word, etc. |
10:46:03 | * | ng0 joined #nim |
10:59:44 | FromGitter | <alehander42> but thats the beauty of it |
10:59:47 | Zevv | yeah, true, not speaking your native tongue is an extra reason |
10:59:48 | FromGitter | <alehander42> if you practice it often |
11:00:01 | FromGitter | <alehander42> you stop thinking too much about it |
11:00:33 | Zevv | and I admit: I also feel stupid when recording soemthing and talking into a mic. When when I know I'm talkign to someone in real time it gets easier |
11:00:36 | FromGitter | <alehander42> i am if you speak in croatian |
11:00:52 | FromGitter | <alehander42> can you imagine if twitch watchers also had cams |
11:02:09 | narimiran | heh, i sometimes even have these anxieties when i'm speaking in croatian :D but english is definitely much much worse |
11:02:43 | narimiran | so maaaybe i might do some pre-recorded stuff, when i record it over and over again until it is not too bad |
11:03:05 | FromGitter | <alehander42> nah this is not live! |
11:03:19 | FromGitter | <alehander42> i guess another option is to somehow type comments in some kind of subtitle place |
11:03:21 | FromGitter | <alehander42> while you work |
11:03:33 | FromGitter | <alehander42> e.g. often i am at coffee-s etc where it might be strange to talk a lot |
11:03:39 | FromGitter | <alehander42> so if i was streaming from there |
11:03:42 | FromGitter | <alehander42> i'd try that |
11:03:47 | FromGitter | <alehander42> but talking is better overally |
11:04:29 | narimiran | but who wants to listen to all of the "uuuuuuummmmm", "aaaahhhhmmmm", etc.? |
11:04:34 | dom96 | Just stream, re-recording things until perfection is often just a waste of time |
11:05:19 | narimiran | "i'm doing (long pause here) some streaming (pause) of (pause) uuuummmm (long pause) well (pause) ...." |
11:05:32 | leorize | streams are really forgiving about those stuff :p |
11:05:34 | FromGitter | <alehander42> eh come on, thats live streaming |
11:05:54 | FromGitter | <alehander42> no um-s is like formula1 without noise |
11:06:08 | FromGitter | <alehander42> you can ummmm like a ferrari on a turn |
11:06:10 | narimiran | oh, did you watched silverstone? :) |
11:06:37 | FromGitter | <alehander42> no, i dont watch them often anymore, but i am following the championship |
11:06:45 | FromGitter | <alehander42> my mother is the big fan :D |
11:07:27 | narimiran | do yourself a favour and watch silverstone higlights (hopefully it is a long video, showing all the interesting action happened there) |
11:07:40 | narimiran | more action there in 20 laps than in last 20 races i watched |
11:07:53 | leorize | narimiran: if you're too anxious you can get someone on stream with you to talk to :) |
11:07:57 | FromGitter | <alehander42> oh yeah ive heard its great |
11:08:32 | narimiran | leorize: i'm fine with my current role of a "passenger" |
11:10:46 | * | trinityhex quit (Ping timeout: 276 seconds) |
11:18:31 | * | fjellfras quit (Quit: Leaving) |
11:35:53 | FromGitter | <arnetheduck> lol 500ms wakeups is what you do to cover up for synchronization and serialization bugs in or around your code (ie you're working around limitations and bugs in other code). if something works with wakeups but doesn't without, you've got some very fundamental and serious issues with your architecture. in a well-architected event loop, if you need a regular wakeup, you add a timer and that's it. if you can cover up |
11:35:53 | FromGitter | ... bugs with a 500ms delay, it means at times you're adding a 499ms delay to operations that could have completed at once - that's nuts. |
11:37:01 | FromGitter | <arnetheduck> @narimiran if you're looking at nimpretty, what really works well is cost functions where different formattings / line breaks are assigned different penalties and the cheapest one is chosen - https://github.com/google/yapf#algorithm-design |
11:40:11 | FromGitter | <arnetheduck> consider for example if you have very long variable names - how do you line break a function call? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ that kind of stuff, wehere it's not obvious where the nicest break is.. cost functions deal with this very nicely - it's the same algo as in clang-format which is the first tool I've seen in wide spread use in c++, which is pretty impressive given how sprawling the c++ |
11:40:12 | FromGitter | ... community is [https://gitter.im/nim-lang/Nim?at=5d305a9b3e2c7e3970a863ac] |
11:40:12 | FromGitter | <kaushalmodi> narimiran, dom |
11:40:28 | FromGitter | <kaushalmodi> +1 for the fooB style from me too |
11:40:52 | FromGitter | <kaushalmodi> Can that style be used for both if and case expressions? |
11:41:09 | dom96 | arnetheduck: "with a 500ms delay, it means at times you're adding a 499ms delay to operations that could have completed at once - that's nuts." that's not how the async event loop works |
11:41:29 | FromGitter | <alehander42> what is this fooB style |
11:41:34 | FromGitter | <kaushalmodi> At present, how the "case" and "of" show up in different columns for case expressions is weird |
11:43:00 | FromGitter | <kaushalmodi> @alehander42 https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370 |
11:43:09 | dom96 | kaushalmodi: ouch, does that really happen? |
11:43:16 | narimiran | the problem with "fooB style" - what do you do when you have a oneliner like `let a = if x: 7 else: 9`? |
11:43:18 | dom96 | if so I'd call that a bug |
11:43:34 | dom96 | narimiran: keep it as a one-liner |
11:43:34 | FromGitter | <kaushalmodi> dom96: see my last issue |
11:44:01 | FromGitter | <kaushalmodi> narimiran: not keep it a one liner? |
11:44:19 | narimiran | definitely it should be kept, c'mon |
11:44:34 | FromGitter | <kaushalmodi> I'm fine either way ;) |
11:44:50 | narimiran | and your "case expression" example is quite fine, as i said |
11:45:02 | FromGitter | <kaushalmodi> If you want to keep it, you'll need to count chars and convert that to fooB if it exceeds 80 |
11:45:05 | narimiran | the only improvement it would be to put `case foo` on a separate line |
11:45:13 | FromGitter | <kaushalmodi> "now fooB is a thing" |
11:45:31 | FromGitter | <kaushalmodi> narimiran: isn't that what fooB is? |
11:46:00 | narimiran | as i already said while streaming: if you prefer these manual alignments - don't use nimpretty |
11:46:16 | FromGitter | <alehander42> hm is it possible |
11:46:19 | narimiran | fooB deals with if expressions, not case expressions |
11:46:20 | FromGitter | <alehander42> to make nimpretty ignore |
11:46:22 | FromGitter | <kaushalmodi> It's not manual, fooB will be consistent everywhere |
11:46:23 | FromGitter | <alehander42> a section |
11:46:31 | narimiran | it is |
11:46:46 | narimiran | `#!nimpretty off` is the syntax |
11:46:51 | FromGitter | <alehander42> ok |
11:47:36 | narimiran | `let someVeryLongNameHereWithLotsOfChars = case x` |
11:48:05 | FromGitter | <kaushalmodi> Right.. now fooB it |
11:48:09 | narimiran | do you really want to have these 40+ whitespace alignment? |
11:48:32 | narimiran | and my answer is a very strong NO |
11:48:37 | FromGitter | <kaushalmodi> So "case x" onwards will begin indented on the next line |
11:49:20 | FromGitter | <kaushalmodi> What's wrong with beginning case x on the new line? |
11:49:28 | narimiran | it needs to be implemented :P |
11:49:52 | narimiran | what's wrong with the current nimpretty's way? |
11:50:32 | FromGitter | <kaushalmodi> With your same example, with current way, case will be on far right, and of will be on far left on the next line |
11:50:39 | narimiran | and? |
11:51:02 | FromGitter | <kaushalmodi> Well, that's pretty? |
11:51:36 | narimiran | so i shouldn't use long variable names generally, because the right hand side might be all the way to the right, and `let` was all the way left? |
11:51:41 | narimiran | to me it is pretty, yeah |
11:52:10 | narimiran | for others, here is a case example we're discussing: https://github.com/nim-lang/Nim/issues/11755#issuecomment-511944563 |
11:52:32 | narimiran | is your original case expression pretty? ;) |
11:52:42 | FromGitter | <kaushalmodi> All I am saying is that the if/else and case/of blocks would be nice to have in clean rectangular blocks, whether they are expressions or statements |
11:53:05 | FromGitter | <kaushalmodi> narimiran: I am willing to adapt to fooB style |
11:53:20 | narimiran | and this is that human/ascii stuff that Araq also talked about in the stream |
11:53:35 | FromGitter | <kaushalmodi> That fits the criteria of avoiding unnecessary indentation on left and also keeping the if and case expressions in a rectangle |
11:53:35 | narimiran | [longnamehere, yy] |
11:53:45 | narimiran | [short, (extraspaces)zz] |
11:54:27 | FromGitter | <kaushalmodi> Sorry, I don't get the reference to the human/ASCII stuff, on phone, and haven't watch a stream |
11:55:15 | narimiran | tl;dw version: if you want your custom alignments which make code "pretty", and you already do that stuff manually (!), you should continue to do so. |
11:55:58 | narimiran | "clean rectangular blocks" fit in that category |
11:56:37 | FromGitter | <kaushalmodi> So your only objection to fooB style is that it's not implemented? |
11:57:13 | dom96 | `case` should also be on its own line |
11:57:24 | dom96 | its consistent with the `fooB` if statement |
11:57:35 | narimiran | dom96: yeah, case could, but `if` might not |
11:57:47 | dom96 | why not? |
11:57:48 | narimiran | and then we'll listen to "it is not consistent, you fools" |
11:57:49 | FromGitter | <mratsim> who is this fooB? |
11:58:06 | dom96 | beacause of one-liners? Those are a fair exception |
11:58:19 | narimiran | this is fooB: https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370 |
11:58:31 | dom96 | The only reason for moving this code around is if it doesn't fit on a single line |
11:58:36 | dom96 | so why would this be a problem? |
11:58:42 | dom96 | if the `if` is small, keep it on the same line |
11:59:03 | narimiran | dom96: if `if` is small, but multiline? |
11:59:16 | dom96 | this also includes: `let foo =\n if short: 42 else: 69` |
11:59:34 | FromGitter | <mratsim> I prefer having `let fooB = block:` if the `if` expression doesn't start at the same line |
11:59:35 | dom96 | narimiran not sure what you mean |
11:59:40 | FromGitter | <kaushalmodi> dom96: exactly |
12:00:02 | FromGitter | <kaushalmodi> narimiran: as I mentioned earlier, I don't care much about if you keep one liners as so or not |
12:00:12 | narimiran | `let foo = if short: 42\n else: 69` |
12:00:59 | narimiran | that's the problem. you don't care. somebody else (Araq, in this case) does. and somebody else doesn't care about the stuff you find important. etc etc |
12:01:13 | narimiran | and that's the core of nimpretty "problem" |
12:01:23 | FromGitter | <kaushalmodi> I mean that I leave it up to you on how to deal the one liners |
12:01:25 | narimiran | there's always somebody who doesn't like some decision |
12:01:45 | FromGitter | <mratsim> I thought that was the reason to have nimpretty :p |
12:01:51 | narimiran | "nimpretty should prettify the code the way i want" |
12:02:14 | FromGitter | <mratsim> but like clang-format there should be a config file to customize it to each project guidelines |
12:02:24 | * | absolutejam quit (Ping timeout: 272 seconds) |
12:02:30 | narimiran | btw, it is not like you have an embargo on touching your code after nimpretty has run |
12:02:32 | FromGitter | <kaushalmodi> Coming back to objective argument, is there an issue with fooB style (except that it cannot yet be implemented in nimpretty)? |
12:03:03 | FromGitter | <kaushalmodi> First step would be coming to an agreement and then deal with its implementation |
12:03:05 | FromGitter | <mratsim> it won't be objective for long ;) |
12:03:13 | narimiran | so if it makes 90% of your code nicer, and it fucks up 10% (by some objective or personal criteria) - go an manually fix those 10% |
12:03:32 | FromGitter | <mratsim> the issue is that everytime you run nimpretty you need to refix those |
12:03:39 | FromGitter | <mratsim> that makes nimpretty a non-starter |
12:03:54 | narimiran | not necessarily |
12:04:05 | narimiran | i've run nimpretty on lib/pure/collections |
12:04:08 | FromGitter | <alehander42> yes, this doesnt work |
12:04:13 | FromGitter | <mratsim> ship with a config file and people will customize it |
12:04:15 | narimiran | in some cases nimpretty doesn't stand the chance |
12:04:21 | FromGitter | <alehander42> one should be able to just run his autoformatter and be done |
12:04:29 | FromGitter | <alehander42> i just think people should put |
12:04:36 | FromGitter | <alehander42> such code in section where it doesnt run |
12:04:40 | FromGitter | <alehander42> this is a better fix |
12:04:49 | narimiran | in those cases i manually rearranged the code, and now nimpretty didn't have a problem with it anymore, even if i run it repeatedly |
12:04:50 | FromGitter | <alehander42> as you dont need to change it every time: e.g. type declaration with offset |
12:05:11 | FromGitter | <alehander42> hm, ok this is stranger, nvm then |
12:05:16 | FromGitter | <kaushalmodi> narimiran: but nimpretty still touches the case expressions, right? |
12:05:35 | FromGitter | <kaushalmodi> I like @alehander42's idea about creating scopes for nimpretty to not touch |
12:05:52 | FromGitter | <kaushalmodi> may be special beginDontTouch/endDontTouch comment chars? |
12:05:54 | FromGitter | <alehander42> they exist |
12:05:55 | narimiran | that already exists |
12:06:09 | narimiran | `#!nimpretty off` is the syntax |
12:06:18 | FromGitter | <kaushalmodi> I thought what you mentioned earlier ignores the whole file |
12:06:23 | narimiran | no |
12:06:31 | narimiran | `#!nimpretty on` to turn it back on |
12:06:35 | FromGitter | <kaushalmodi> so.. `#!nimpretty off` .. `#!nimpretty on`? |
12:06:37 | FromGitter | <kaushalmodi> ok! |
12:07:03 | FromGitter | <mratsim> why wasn't {.push.} {.pop} reused? |
12:07:14 | * | narimiran rage quits |
12:07:19 | narimiran | :P |
12:08:21 | FromGitter | <mratsim> if `#!nimpretty` is at the very beginning of a file, does that confuse shell script, it's like `#!/bin/python` |
12:11:59 | dom96 | > "nimpretty should prettify the code the way i want" |
12:12:02 | dom96 | I disagree with this |
12:12:31 | dom96 | nimpretty should prettify code to a single true style |
12:12:32 | dom96 | that we all use :P |
12:12:38 | narimiran | i also disagree, but this is a feeling i get from these discussions |
12:12:56 | FromGitter | <kaushalmodi> narimiran: we are trying to collaborate on one "good" style |
12:13:07 | FromGitter | <kaushalmodi> it's understood that everyone will need to make small compromises |
12:13:23 | narimiran | dom96: so, to update the quote: "single true style is the code style i want"? :P |
12:13:26 | FromGitter | <kaushalmodi> e.g. I proposed something for the if/case expr but dom/you came up with fooB style and I can adopt that |
12:13:37 | FromGitter | <mratsim> Highlander style |
12:13:38 | dom96 | narimiran: it's not about me, I am just pushing for my vision |
12:13:43 | FromGitter | <kaushalmodi> so again, is there any issue with fooB style? |
12:13:53 | narimiran | it isn't, generally speaking |
12:13:59 | dom96 | if my arguments are good I think it's fair to adopt my vision :P |
12:14:01 | FromGitter | <mratsim> I prefer having a block: after the = |
12:14:07 | narimiran | i find it problematic for oneliners, but other than that, i like it |
12:14:22 | FromGitter | <kaushalmodi> narimiran: but you can keep oneliners be so |
12:14:31 | dom96 | mratsim: that's not a style decision, that's a completely new construct |
12:14:31 | narimiran | ok, PRs welcome :P |
12:14:34 | dom96 | you _should_ keep one-liners as-is |
12:14:34 | FromGitter | <kaushalmodi> .. as long as they don't violate the maxCharsPerLine |
12:14:43 | dom96 | unless they are too long |
12:15:10 | FromGitter | <kaushalmodi> so again.. "convert to fooB and leave oneliners as-is unless they exceed maxCharsPerLine"? |
12:15:11 | narimiran | that's the problem, all these nimpretty fixes look like "JUST do something", and the reality is more like "well, how did this now break? c'mon, aaargh" |
12:16:03 | narimiran | look at layouter.nim code. your first reaction will probably be (and it should be) "well, this is ugly, who wrote this shit?" |
12:16:32 | dom96 | the solution is to have lots of tests |
12:16:43 | dom96 | and yes, it'll be a pain to satisfy all of them, but that's just how it is |
12:17:03 | narimiran | dom96: every bugfix adds an additional test(s) |
12:24:56 | FromGitter | <kaushalmodi> narimiran: I just rebuilt nim/nimpretty from devel and found this issue which I missed last time: https://github.com/nim-lang/Nim/issues/11779 |
12:25:17 | FromGitter | <kaushalmodi> there should be no difference of opinion at least on this one :) |
12:25:35 | FromGitter | <arnetheduck> > ship with a config file and people will customize it ⏎ ⏎ this is a mistake.. ⏎ in the vast majority of cases, if the prettfier is *good*, it takes about 15-30 days to get people to stop using any manual formatting at all because you get used to reading the prettified style and that's it. this based on introducing them in larger projects - the one thing that comes out of the process is less useless |
12:25:36 | FromGitter | ... discussion. the `#nimpretty off ` thing is mainly a tool to quiet the sceptics at the start, but in practise (again, if the formatter is good - like those using scoring are) people stop using it because it's uglier to have it there than whatever minor blemishes the formatter comes up with [https://gitter.im/nim-lang/Nim?at=5d30653f3b41924785df92fd] |
12:26:12 | FromGitter | <kaushalmodi> @arnetheduck I agree with you |
12:26:41 | narimiran | @kaushalmodi ah, the comment somehow fools nimpretty |
12:26:44 | FromGitter | <kaushalmodi> would like to have eventually have nimpretty in Travis tests for PR's |
12:26:59 | * | absolutejam joined #nim |
12:27:11 | FromGitter | <arnetheduck> what happens next is that you set your editor to autoformat and start typing random code and let the prettifier deal with it.. this is *so* nice, because you can let go of that OCD to line things up |
12:27:37 | FromGitter | <kaushalmodi> @arnetheduck I am very close to doing that in Emacs.. simply run nimpretty each time I do `C-x C-s` (save) |
12:28:37 | FromGitter | <arnetheduck> yeah, but it takes a good prettifier - those that just dumbly spit out newlines unconditionally are too ugly |
12:29:43 | FromGitter | <arnetheduck> that's the beuaty of the cost function - it allows the formatter to choose the right option for line breaking that `case` statement sanely in different situations: long variable before case, long expression in case, long expression in of etc and weigh the options |
12:30:08 | FromGitter | <arnetheduck> and of course the famous one-liner |
12:33:33 | Araq | I tinkered with the cost functions. it needs tons of domain knowledge and nimpretty can get one |
12:34:31 | Araq | I'm not convinced it works better than throwing some machine learning at the problem, but it's on the table |
12:35:45 | Araq | I agree that nimpretty shouldn't have tons of configuration options |
12:36:18 | FromGitter | <arnetheduck> might be hard to find a corpus of "pretty" code though since humans are humans and suck at formatting code, generally |
12:36:45 | Araq | and apart from that, the next step is that we have git hook so that new commits are always nimprettified |
12:36:47 | FromGitter | <arnetheduck> and I hope we don't get non-constant indent/alignment boxes, they're terrible for git diffs |
12:37:13 | Araq | we need to eat our own dogfood, that's all |
12:38:14 | FromGitter | <kaushalmodi> narimiran: interestingly, now if I right a case expression in fooB style: ⏎ ⏎ ```let ⏎ x = ⏎ case fooB ⏎ of ..``` ⏎ ⏎ nimpretty doesn't touch it, without me needing to but in those special comments\ [https://gitter.im/nim-lang/Nim?at=5d306836570ac36f8d476479] |
12:38:26 | Araq | for 0.20.2 we did run nimpretty over our collection APIs with really good results. |
12:39:17 | FromGitter | <arnetheduck> hooks suck though, either require a local installation step or come a bit late if done remote, when you've already crafted your commits. if we had a good build tool, that would be one place, or a compiler error even, though that's sometimes a bit harsh. unit test suite is one tradeoff I've seen work well (aka build tool option). |
12:39:57 | Araq | but the real tension here is: "format this file consistently with how it currently looks like" |
12:40:03 | Araq | vs "format this file according to our rules" |
12:40:30 | Araq | and that might be the one switch we should add to nimpretty |
12:40:30 | FromGitter | <kaushalmodi> the `#!nimpretty off` .. `#!nimpretty on` does not turn off the LineTooLong warnings |
12:40:53 | FromGitter | <arnetheduck> that's only a problem if you don't start with formatting. if you have a good tool that everyone uses and is integrated by default in your build pipeline / tooling, the two are the same |
12:41:02 | FromGitter | <kaushalmodi> there are places where having long lines makes sense e.g.: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d3068de5fa7895c43229f3a] |
12:41:29 | Araq | arnetheduck: wrong, let's consider the number of spaces to use for indentation ... |
12:41:59 | Araq | compiler + stdlib use 2 but 4 is *very* popular |
12:42:24 | Araq | and telling people "yeah, you can't use nimpretty if you like 4" makes the whole tool a stillborn IMO |
12:42:26 | FromGitter | <arnetheduck> what about it? you set it to 2 and then you're done. there's really nothing else to it when everyone uses the same, the default is enforced from the beginning. you never ever even get the option to consider that 4 *could* be used |
12:43:08 | Araq | I am not following you but I gotta go, see you later |
12:43:39 | FromGitter | <arnetheduck> like imagine that the compiler autoformats as part of compilation.. no 4-space indented file will exist |
12:43:54 | dom96 | yeah, as soon as you allow some customisation you have to draw the line somewhere, and that's difficult |
12:43:57 | FromGitter | <arnetheduck> just the same as with tabs now - no tab-indented nim files exist and that's that |
12:43:59 | dom96 | 2 spaces for everyone |
12:44:24 | FromGitter | <kaushalmodi> I was actually very thrilled to see the 2-space convention in Nim |
12:44:31 | dom96 | indeed, tabs are insanely popular too |
12:44:41 | FromGitter | <kaushalmodi> I have been using that for a long time in my other projects |
12:44:59 | FromGitter | <arnetheduck> `go` is about the only language out there that uses tabs - everyone else has moved to spaces afaik |
12:45:07 | disruptek | tabs. i have no idea what you are on about wrt spaces. makes absolutely no sense to me to reduce the fidelity of such a critical hint i provide the compiler. |
12:45:08 | FromGitter | <arnetheduck> but crucially, *all* go code uses tabs |
12:45:19 | disruptek | because duh. |
12:46:00 | FromGitter | <arnetheduck> spaces almost won this useless debate, then go came along and reopened it :/ |
12:46:21 | disruptek | i actually render as 3, and why shouldn't i? |
12:46:43 | FromGitter | <alehander42> the problem i see is , you can do that with spaces |
12:46:47 | FromGitter | <kaushalmodi> narimiran: nimpretty is doing a great job for me.. with the recent fixes, it is no longer touching my indented if expressions, and the fooB style case expressions also remain as-is. |
12:47:01 | narimiran | yay :) |
12:47:01 | disruptek | and you are free to use spaces if you wish. what's the problem? |
12:47:12 | FromGitter | <alehander42> your editor can see spaces in the beginning of line and if its setup to guess similarly to nimpretty, it can replace them correctly |
12:47:29 | disruptek | why guess, for kickoffs? |
12:47:37 | FromGitter | <alehander42> because it cant *know* |
12:47:48 | FromGitter | <alehander42> if the original code really used 4 spaces |
12:47:56 | FromGitter | <alehander42> or if this is 2 x 2 spaces |
12:47:57 | disruptek | it can know if you use tabs. |
12:48:02 | FromGitter | <alehander42> i mean, it can infer it |
12:48:10 | FromGitter | <alehander42> but it basically can if you use spaces as well |
12:48:23 | FromGitter | <alehander42> it needs a bit more knowledge about the lang |
12:48:29 | disruptek | or are you arguing that guessing is superior to knowing? |
12:48:30 | FromGitter | <alehander42> but its techincally 95% possible |
12:48:36 | FromGitter | <alehander42> i am arguing it doesnt matter |
12:48:42 | FromGitter | <alehander42> you can techincally render 3 spaces |
12:48:48 | FromGitter | <arnetheduck> if nimpretty gives different outputs based on the input, that's a problem onto itself - it means that formatting is path-dependent which sucks for all kinds of reasons - you should end up with the same end result no matter where you start |
12:48:51 | FromGitter | <alehander42> even if your original code was with spaces |
12:49:13 | disruptek | yes, but nimpretty will take quite a bit more work to be truly idempotent. |
12:49:15 | FromGitter | <alehander42> overally i am ok with one consistent thing: tabs are great |
12:49:21 | FromGitter | <alehander42> but spaces already won in most languages |
12:49:27 | FromGitter | <kaushalmodi> Now I will start running `nim fmt` (https://github.com/kaushalmodi/nim_config/blob/df887d1a3fb9c2d6fc63f98f402e8f969edff961/config.nims#L329-L343) in all my projects :) |
12:49:27 | FromGitter | <alehander42> so spaces>tabs |
12:49:37 | disruptek | spaces won for the wrong reasons, and nim isn't most languages. |
12:49:45 | FromGitter | <kaushalmodi> it already worked well for a moderate size project |
12:50:15 | FromGitter | <alehander42> you can make up to X surprising lang design choices |
12:50:24 | FromGitter | <alehander42> the import + casing thing is enough imo |
12:54:52 | * | absolutejam quit (Quit: WeeChat 2.5) |
12:55:31 | * | absolutejam joined #nim |
13:05:00 | shashlick | Hey @disruptek did you see my messages from earlier |
13:05:57 | disruptek | shashlick: i see them now. i had the same issue with c2nim. |
13:06:10 | disruptek | what do you recommend? |
13:07:41 | FromGitter | <kaushalmodi> @alehander42 Are you here? |
13:08:30 | FromGitter | <kaushalmodi> I am working on https://scripter.co/notes/nim/#comprehension .. they are almost complete for now except that I need help conversion this `lc` example: https://github.com/alehander42/comprehension/issues/3#issuecomment-512562894 |
13:09:19 | disruptek | Araq's argument in favor of spaces is that Guido wishes he'd gone that route. to me, that's not a valid argument. ;-) |
13:10:18 | disruptek | shashlick: think i should just write a generator? we have a formal spec in json. |
13:10:19 | * | brakmic quit (Read error: Connection reset by peer) |
13:12:28 | clyybber | arnetheduck: I found that in some cases 4 space indentation makes code much more readable.. |
13:13:07 | disruptek | it'd be awesome if you could just change the way it renders spontaneously with making any commits. |
13:13:12 | disruptek | oh wait. |
13:13:20 | clyybber | Tabs yay |
13:13:49 | shashlick | @disruptek will you can start commenting out portions and see how far you get |
13:13:55 | shashlick | Well |
13:14:37 | * | absolutejam quit (Ping timeout: 245 seconds) |
13:14:59 | disruptek | what's the error you get from that latest c2nim ingestion attempt? |
13:15:51 | shashlick | I was commenting out stuff and finally gave up when I ran into template stuff |
13:16:30 | narimiran | @kaushalmodi: "when the input is a table, the order of elements in the output set is not the same as that of the input." this remark doesn't make much sense to me |
13:16:51 | federico3 | alehander42: it's more complex than that. People also argue for tabs for indentation followed by spaces for alignment |
13:16:51 | narimiran | "table comprehension does not have the key/value pairs of the output table in the same order as that of the input." same here |
13:17:21 | shashlick | An alternate with major benefits is to generate from swagger or whatever they call it now |
13:17:48 | FromGitter | <kaushalmodi> narimiran: if you look at the snippets outputs, you will see that the order is retained for seq/set inputs/outputs |
13:18:03 | narimiran | yes, for seq output |
13:18:11 | narimiran | tables and sets don't have an order |
13:18:14 | FromGitter | <kaushalmodi> but when either input/output is a table, the order is jumbled up (which I understand to be the default table behavior) |
13:18:15 | disruptek | yeah, that's what ryukoposting began, but it was never completed. i think i'm too stupid to make the code work. |
13:18:32 | narimiran | it doesn't matter what's an input |
13:18:36 | FromGitter | <kaushalmodi> narimiran: right, so I am just explicitly saying that the order is not retained |
13:18:51 | FromGitter | <kaushalmodi> with seq in, sets out, the order was retained |
13:19:00 | shashlick | Another option is to enhance c2nim |
13:19:21 | narimiran | but the remark is just wrong |
13:19:27 | shashlick | @ratiotile has been doing some work here already |
13:19:46 | FromGitter | <kaushalmodi> what would be the right way to add that note |
13:19:50 | narimiran | "when the **input is a table**, the order of elements ...." - no, that's not the reason |
13:20:18 | FromGitter | <kaushalmodi> how about "when either the input/output type is Table, the order of elements is not guaranteed" |
13:20:18 | disruptek | i'm asking because i don't have a sense for how far off a working c2nim is. my idea was to wrap this thing as a stopgap, but if it's going to be more work to fix c2nim, then it may be worth finding out if those changes are worthwhile to other c2nim efforts. |
13:21:18 | narimiran | the right way is either to have no remark (because it is well-known how tables and sets (and that's in the output, not input) work) or to have a remark say something like: "note that tables and sets don't have an order, so your outputs could be in any order" |
13:21:19 | shashlick | Enhancing c2nim to support more c++ will be very well received |
13:21:22 | disruptek | kaushalmodi: `undefined` is perhaps both more accurate and more precise. |
13:21:50 | FromGitter | <kaushalmodi> disruptek: noted |
13:22:30 | shashlick | We have a very good c wrapping story, c++ is daunting and I've not been motived yet to add support in nimterop |
13:23:05 | narimiran | if hashing algorithm changes, so might your outputs |
13:23:24 | disruptek | if platform changes, so might your algorithm. |
13:23:33 | narimiran | that too :) |
13:23:38 | disruptek | it's pointless to hazard a guess. the order is undefined, by definition. |
13:23:50 | FromGitter | <kaushalmodi> narimiran, disruptek: "As it can be seen from these examples, the outputs of *table* comprehension have elements in undefined order." |
13:24:29 | narimiran | ...if you ever wondered why you can't do "give me the third element of the set" (`s[3]`) |
13:24:44 | narimiran | off by one there :D :D |
13:24:51 | FromGitter | <kaushalmodi> :) |
13:25:13 | FromGitter | <kaushalmodi> so the same undefined order is for sets too? |
13:25:30 | narimiran | sets == tables with just keys :P |
13:25:45 | FromGitter | <kaushalmodi> ok, just confirmed that in my example |
13:25:50 | FromGitter | <kaushalmodi> updating the example to reflect that |
13:25:54 | FromGitter | <kaushalmodi> thanks for the feedback |
13:26:52 | * | brakmic joined #nim |
13:26:53 | disruptek | realize that there's no concept of order. it's not that it's not implemented, it's that it's not designed into the thing. |
13:26:59 | narimiran | btw, i don't remember exactly, but i think prettyprinting in python will always PRINT the table in ascending key order (that doesn't mean that's the actual "order of a table") |
13:27:31 | * | brakmic_ joined #nim |
13:27:56 | narimiran | disruptek: yep, that's why i suggested that maybe no note at all would be the best course of action |
13:28:05 | disruptek | those are ordered dicts, though, which do what they sound like, as opposed to nim's version that retains the order of insertion. |
13:28:36 | disruptek | narimiran: the fact that we're having this convo suggests that some note might help someone clarify. |
13:29:23 | narimiran | if i was a beginner, from that note i would conclude that `comp` package somehow fucks up the order |
13:30:08 | FromGitter | <kaushalmodi> narimiran: I am looking for a quote from the manual that describes that order is not a thing for sets and tables |
13:30:25 | FromGitter | <kaushalmodi> I'll then link to that |
13:30:46 | narimiran | here: https://en.wikipedia.org/wiki/Hash_table -- "Type Unordered associative array" :P |
13:30:52 | * | brakmic quit (Ping timeout: 245 seconds) |
13:31:15 | clyybber | or here: https://en.wikipedia.org/wiki/Set_(mathematics) |
13:31:32 | disruptek | it might not be that easy to find lists of things that nim types aren't, and that's a good thing. |
13:31:43 | clyybber | If someone doesn't know what a set is, he probably shouldn't use it.. |
13:32:17 | disruptek | documentation serves to teach what it is, so that one may use it successfully. |
13:32:18 | narimiran | ...and if you're not using sets, you're missing quite a lot |
13:33:01 | FromGitter | <kaushalmodi> I know what sets are, but coming from perl, I am spoiled by ordered hashes |
13:33:24 | FromGitter | <kaushalmodi> as I have a taste of "ordered everything", my *my notes* it was important to remind myself that they are not ordered |
13:33:54 | narimiran | btw, we have OrderedTable and OrderedSet |
13:34:01 | FromGitter | <kaushalmodi> I know |
13:34:18 | FromGitter | <kaushalmodi> so I need to clarify in the notes that don't expect output order to be the same as input seq |
13:35:15 | disruptek | well, it should be in cases where the order is defined, such as OrderedTable. |
13:35:39 | FromGitter | <kaushalmodi> that I believe would be something internal to `comp` implementation? |
13:35:52 | disruptek | it's internal to the OrderedTable impl. |
13:36:04 | FromGitter | <kaushalmodi> Just clarifying that this discussion is not about sets and tables in general |
13:36:12 | FromGitter | <kaushalmodi> but the sets and tables that `comprehension.comp` returns |
13:36:37 | disruptek | oh, ignore me then. i have no idea what that is. |
13:37:33 | FromGitter | <kaushalmodi> disruptek: We are talking about my notes in https://scripter.co/notes/nim/#comprehension |
13:39:37 | * | absolutejam joined #nim |
13:40:26 | disruptek | okay, so unless there is a way to compose a comprehension of arbitrary type (neat idea), you probably don't need to stoop to mentioning OrderedTable. |
13:42:34 | disruptek | it seems like you could rewrite comprehension to work that way, and then provide a generic for your type that implements composition. |
13:44:41 | disruptek | it should at least word for those tables, though, so i guess technically it might bear mention. |
13:44:46 | disruptek | ^work, too |
13:45:55 | FromGitter | <alehander42> btw why would i lose my terminal typing "output" |
13:46:19 | FromGitter | <alehander42> can that be related to stdin handlng from a program that i ran |
13:46:27 | FromGitter | <alehander42> somehow closing the fd? |
13:47:02 | disruptek | failure to write to input of another stream, more likely. |
13:47:54 | FromGitter | <alehander42> yeah, makes sense |
13:51:13 | disruptek | narimiran: just curious, but what's the problem with murmur3 in js? |
13:51:27 | narimiran | uint32 * uint32 |
13:51:34 | disruptek | lol |
14:00:28 | clyybber | Araq: WDYT about transforming 'owned ref' parameters to 'sink owned ref' parameters in injectdestructors? |
14:00:39 | clyybber | Would keep the backend a bit simpler |
14:02:11 | * | brakmic_ quit (Read error: Connection reset by peer) |
14:02:58 | * | brakmic joined #nim |
14:03:38 | Araq | clyybber: don't like it |
14:03:57 | Araq | these things always come back to bite you, better is a 'isSinkParam' helper that is used in the backend |
14:05:00 | * | altarrel quit (Quit: ZNC 1.6.5+deb1+deb9u2 - http://znc.in) |
14:09:36 | shashlick | @Araq - i know you aren't a fan of it but nimterop can now use c2nim for wrapping - https://nimterop.github.io/nimterop/cimport.html#c2nImport.m%2C%2Cstring%2Cstring%2Cstring |
14:09:42 | shashlick | basically like nimgen |
14:10:55 | FromGitter | <kaushalmodi> shashlick: can you tag a release of nimterop? |
14:13:01 | shashlick | maybe it is time |
14:13:13 | shashlick | i just hate updating the nimble file AND tagging |
14:13:27 | FromGitter | <kaushalmodi> but you haven't done it even once :P |
14:13:35 | dom96 | it's such a hardship :P |
14:13:50 | disruptek | i mean, he REALLY hates it. |
14:14:05 | FromGitter | <kaushalmodi> sorry, but for my use case, it's pretty stable and would like to associate the working wrappers with a nimterop version tag |
14:14:23 | shashlick | exactly, i've been averse to it without any good reason |
14:14:37 | shashlick | you could use a commit tag tho 😛 |
14:14:59 | dom96 | Implement a `nimble tag` command :) |
14:15:06 | FromGitter | <kaushalmodi> I know.. but it a nice v0.0.1 tag would be cool |
14:15:38 | disruptek | i'd start at v2.0 at least. |
14:15:52 | narimiran | v19.7 |
14:15:53 | shashlick | which is effectively a version |
14:15:54 | shashlick | can someone explain to me why we need a tag when there's already commits? |
14:16:28 | FromGitter | <kaushalmodi> I didn't understand "can someone explain to me why we need a tag when there's already commits" |
14:16:40 | disruptek | commits outta be enough for anybody. |
14:16:57 | shashlick | so if you depend on a particular version, you can use the commit hash - nimble already allows that |
14:17:12 | shashlick | why do we have to go through the extra effort of a cosmetic version tag as well |
14:17:17 | FromGitter | <kaushalmodi> ah OK, tags give you a human readable number |
14:17:33 | FromGitter | <kaushalmodi> you cannot know if commit 1234567 is newer or 1234568 |
14:17:47 | FromGitter | <kaushalmodi> but with a tag, it's obvious which is newer |
14:18:14 | disruptek | the fact that you're using a semantically-irrelevant, albeit human-readable, value versus something that actually places context around a piece of code... well, i'll never understand that. |
14:18:17 | FromGitter | <kaushalmodi> .. and nimble install nimterop will auto-install the newest tag |
14:18:31 | shashlick | how is that info useful? typically, you will pin to head or a particular version and just sit with it until you have to bump up |
14:18:43 | shashlick | nimble install nimterop installs head when there's no tag |
14:18:58 | FromGitter | <kaushalmodi> when you tag a release, I can see diffs between 2 tags easily |
14:19:15 | disruptek | you can always see diffs easily. |
14:19:24 | shashlick | you can see diffs between commit hashes too |
14:19:49 | disruptek | i guess the only argument that makes sense, to me, is that it allows the developer to convey the import of changes. |
14:20:00 | FromGitter | <kaushalmodi> disruptek: it's difficult to explain |
14:20:04 | shashlick | sorry, i'm really trying to understand, not just being difficult |
14:20:07 | shashlick | but i am disciplined in the sense that i don't push broken stuff into master |
14:20:12 | FromGitter | <kaushalmodi> in my git interface, I can see nice milestones where the tags are |
14:20:14 | disruptek | the usage of the value on the side of the consumer seems irrelevant. |
14:21:05 | disruptek | shashlick: the changes you made last nite, would you say they were patch-level changes, minor-release changes, or major-release changes? |
14:21:08 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/yW5N/image.png) |
14:21:17 | disruptek | this is the only value to semantic versioning that i can see. |
14:21:31 | shashlick | minor release |
14:21:32 | FromGitter | <kaushalmodi> then I know that the commits inbetween tags are probably unstable |
14:22:16 | disruptek | so by tagging that commit, you basically give hints to consumers of how valuable or risky those changes are. |
14:22:49 | FromGitter | <kaushalmodi> alright, I'll stay away from this discussion :) |
14:22:54 | disruptek | i think it's crazy for a master branch to ever move backward. |
14:24:40 | FromGitter | <kaushalmodi> > but i am disciplined in the sense that i don't push broken stuff into master ⏎ ⏎ I also don't intend to do that.. I time-test my code before tagging |
14:25:00 | FromGitter | <kaushalmodi> if no bug fix commits are needed for a "while" (subjective), I tag it |
14:25:16 | FromGitter | <kaushalmodi> again, not trying to enforce this flow on anybody.. just describing how I do it |
14:29:29 | shashlick | so basically tags are conveying two things - how stable I think it is and how major the changes are |
14:30:25 | FromGitter | <kaushalmodi> yes |
14:30:30 | disruptek | i think people expect stability standards to vary from project to project and perhaps even according to the tag. |
14:30:38 | FromGitter | <kaushalmodi> for example, if I am working on a feature addition |
14:30:53 | FromGitter | <kaushalmodi> and even if everything works, I will hold off from tagging until I am happy with docs and tests |
14:32:52 | disruptek | whereas, i would tag a patchlevel any time i fix a bug, however minor. |
14:33:04 | disruptek | any time i break anything, it's a new major. any time. |
14:33:29 | disruptek | minors are only for feature additions. |
14:33:56 | FromGitter | <kaushalmodi> that's pretty much semver: https://semver.org/ |
14:35:16 | disruptek | yeah, the way you sandwich numbers together was never a problem. it's what import you cast on them that i take issue with. |
14:36:57 | Araq | shashlick: I appreciate when c2nim is used, so thank you! :-) |
14:37:33 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:37:52 | Araq | and I also have more ideas how to improve it, but "you have to tweak the header" is part of its design, we should be more explicit about it |
14:38:08 | Araq | the idea is that in return you don't have to tweak the Nim output |
14:38:28 | disruptek | but i'd rather write nim than edit generated c++. |
14:39:03 | Araq | there is an .emit like feature |
14:39:13 | Araq | you can write some Nim code inside the C header file |
14:39:47 | disruptek | oh, cool. i guess since i've never gotten to where c2nim worked, i've never dug into it. |
14:40:22 | disruptek | so i'll just generate the header, then use some markup to insert nim code, then c2nim that. |
14:40:30 | clyybber | Araq: You removed the compilerapi from c2nim? So is the linelength now configurable without changing the compiler? |
14:41:19 | Araq | clyybber: yeah |
14:41:35 | shashlick | i've had great success with c2nim, but C++ is a royal pain so some love there would be very beneficial to the community |
14:42:16 | shashlick | i prefer the nimterop strategy of leveraging tree-sitter since C++ is evolving so much |
14:42:46 | Araq | that's fair but keep in mind that I used c2nim to wrap essentially of Urho 3D and wxWidgets |
14:42:55 | shashlick | but updating to support c++ is not something i'm motivated to do right now |
14:43:09 | Araq | the C++ is there, it works, surely it can always be better |
14:43:20 | Araq | and yeah, it's not C++11 ready |
14:43:22 | clyybber | a small shell script and c2nim can do wonders for wrapping massive complicated stuff |
14:43:53 | * | shomodj joined #nim |
14:43:54 | disruptek | i believe it's working for some, but i haven't been able to make it work yet. |
14:44:14 | shashlick | see the existing nimgen projects for some ideas |
14:44:21 | Araq | well the amount of different styles that C and C++ support is massive |
14:44:43 | Araq | they are hard languages for tools, yes, C included. |
14:44:45 | shashlick | they aren't fans of DRY are they |
14:44:52 | disruptek | of course. to me, it's a miracle that our systems still build. |
14:45:34 | shashlick | it is part of the reason why i only want to wrap and not outright convert |
14:48:19 | * | noonien joined #nim |
14:49:18 | noonien | hello, i'm expecting the answer to be yes, but i'm asking anyway, does `asyncnet` support udp? |
14:50:29 | Araq | iirc, yes |
14:51:06 | FromGitter | <kaushalmodi> Nim needs flashy demos like this: https://twitter.com/v_language/status/1150803006025359360 (just saw someone retweeted this in my stream) |
14:51:34 | FromGitter | <kaushalmodi> I have read that Nim supports HCR but I have no idea how to use it.. may be someone can develop some short examples to demo it? |
14:52:22 | Araq | read the 0.20.2 docs |
14:54:51 | * | sniffdtek quit (Read error: Connection reset by peer) |
14:56:19 | * | snuffdtek joined #nim |
15:05:59 | * | floppydh quit (Quit: WeeChat 2.5) |
15:10:42 | * | absolutejam quit (Ping timeout: 244 seconds) |
16:07:08 | * | actuallybatman joined #nim |
16:09:25 | * | clyybber quit (Quit: WeeChat 2.5) |
16:09:27 | * | Trustable joined #nim |
16:11:31 | * | vlad1777d joined #nim |
16:20:03 | * | Trustable quit (Remote host closed the connection) |
16:22:41 | * | Jjp137 joined #nim |
16:23:03 | * | Trustable joined #nim |
16:33:49 | * | clyybber joined #nim |
16:35:31 | * | solitudesf joined #nim |
16:37:22 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:53:18 | * | altarrel joined #nim |
17:01:53 | * | stefanos82 quit (Quit: Quitting for now...) |
17:02:45 | * | Trustable quit (Remote host closed the connection) |
17:11:44 | * | snuffdtek quit (Remote host closed the connection) |
17:12:00 | * | snuffdtek joined #nim |
17:15:10 | clyybber | Araq: Opinion on this fix: https://github.com/nim-lang/Nim/pull/11248/commits/ceaeb9d25ca28609df83b8845350f110784b4620#diff-ca3e84124342c138a94f4b4c6b636e90R164 ? |
17:16:28 | clyybber | It allows passing sink/owned parameters to =move correctly. |
17:17:00 | clyybber | But it generally allows passink sink/owned to procs that take var parameters. |
17:17:13 | clyybber | s/But it/But it also |
17:17:56 | clyybber | But only in the backend, so I guess its fine |
17:27:12 | * | noonien quit (Quit: Connection closed for inactivity) |
17:28:00 | disruptek | this is surprising. http://ix.io/1OQ2/nim -- also, no warnings in `nim check`. |
17:31:14 | clyybber | oh, I didn't know ix.io could do syntax highlighting |
17:34:22 | clyybber | bbl |
17:34:22 | * | clyybber quit (Quit: WeeChat 2.5) |
17:35:41 | * | absolutejam joined #nim |
17:44:11 | * | LyndsySimon quit (Ping timeout: 257 seconds) |
17:46:04 | * | Mister_Magister quit (Ping timeout: 246 seconds) |
17:46:49 | * | LyndsySimon joined #nim |
17:53:14 | * | Mister_Magister joined #nim |
17:54:42 | * | absolutejam quit (Ping timeout: 248 seconds) |
17:54:45 | federico3 | https://chaos.social/users/rixx/statuses/102463047321994048 this sounds very accurate |
17:55:26 | * | jjido joined #nim |
18:10:23 | * | absolutejam joined #nim |
18:37:45 | * | laaron quit (Remote host closed the connection) |
18:42:42 | * | absolutejam quit (Ping timeout: 248 seconds) |
18:44:36 | shashlick | who uses docset here? |
18:47:47 | * | elrood joined #nim |
18:55:35 | * | Cea joined #nim |
18:55:57 | disruptek | what's the smarter way to `when compiles(result)` (ie. see if result is a valid symbol in this scope)? |
18:56:30 | rayman22201 | @shashlick The dash thing? I was looking into it but I always end up just going back to my trusty web browser :/ |
18:57:34 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
18:58:32 | Cea | I'm trying to make bindings for https://bellard.org/quickjs/ and I'm having trouble with https://github.com/ldarren/QuickJS/blob/mod/quickjs.h There's lots of #defines and a few union types which I've tried to work massage out using c2nim but I'm still getting non-descriptive errors and feel like I'm heading in the wrong direction. Would anyone be |
18:58:33 | Cea | able to help me to understand where I'm messing up? |
18:59:12 | FromGitter | <awr1> i'll give it a shot |
19:00:00 | * | Lord_Nightmare joined #nim |
19:01:15 | shashlick | @rayman22201 - i'm looking into using niv's docset json to generate nim.docset on every build |
19:01:21 | FromGitter | <awr1> also @Araq i ended up adding that command line option https://github.com/nim-lang/Nim/pull/11742 |
19:01:59 | shashlick | @Cea - please try nimterop |
19:02:39 | Cea | @shashlick Thanks I'll take a look |
19:03:00 | FromGitter | <kaushalmodi> disruptek: `declaredInScope`? |
19:03:18 | rayman22201 | @shashlick: sounds reasonable. why not? lol |
19:03:32 | disruptek | kaushalmodi: that's probably it, thanks. :-) |
19:03:43 | FromGitter | <kaushalmodi> disruptek: and you were there when I learnt that! :P https://gitter.im/nim-lang/Nim?at=5d20c3908193ce270f33af26 |
19:03:45 | shashlick | anyone know if `koch docs` accepts --git.commit flag? |
19:04:03 | disruptek | kaushalmodi: yeah, that's the only reason i knew i could do this in the vm. ;-) |
19:04:58 | shashlick | okay looks like, will try |
19:07:18 | * | nsf quit (Quit: WeeChat 2.4) |
19:12:58 | * | lritter joined #nim |
19:15:40 | * | Vladar quit (Remote host closed the connection) |
19:18:52 | Cea | @shashlick `toast -p -r -n quickjs.h > quickjs.nim` returns `Error: unhandled exception: getters.nim(100, 14) `name[0] != '_' and name[^1] != '_'` Identifier '__JS_NewFloat64' (nskProc) contains leading/trailing underscores '_' [AssertionError]` |
19:20:11 | shashlick | you need to use cPlugin |
19:20:18 | shashlick | https://nimterop.github.io/nimterop/cimport.html |
19:21:42 | shashlick | start with nimterop/templite.nim |
19:21:48 | shashlick | or template.nim if you need more help |
19:30:35 | * | bars0 joined #nim |
19:31:10 | * | bars0 quit (Client Quit) |
19:31:34 | * | bars0 joined #nim |
19:34:23 | FromGitter | <awr1> is it possible to link to another proc in the same document with nim's doc gen |
19:34:30 | FromGitter | <awr1> from a doc comment |
19:35:09 | * | absolutejam joined #nim |
19:35:45 | shashlick | ya, see https://github.com/nimterop/nimterop/blob/master/nimterop/cimport.nim#L178 |
19:35:48 | shashlick | it isn't pretty |
19:36:12 | FromGitter | <awr1> hm thanks |
19:36:56 | FromGitter | <awr1> i feel like doc gen should bend the rules and make a rst superset so that it would be easier to link but meh |
19:37:16 | narimiran | you can use [markdown](syntax) too |
19:37:39 | FromGitter | <awr1> wait really |
19:37:43 | FromGitter | <awr1> i didn't even know that |
19:37:45 | FromGitter | <awr1> i thought it was just rst |
19:38:34 | FromGitter | <awr1> that still doesn't solve the problem though |
19:38:49 | * | stefanos82 joined #nim |
19:40:26 | FromGitter | <awr1> ideally doc-to-doc links like that could show up a javascript tooltip too or something |
19:41:10 | FromGitter | <awr1> but that's just me throwing that out there |
19:49:58 | * | jfoutaise quit (Ping timeout: 246 seconds) |
19:51:59 | * | jfoutaise joined #nim |
19:58:08 | Cea | @shashlick Working through nimterop and it's translated most of the header but seems to be having issues this struct ``` |
19:58:16 | Cea | Uploaded file: https://uploads.kiwiirc.com/files/89598ccd15b401d91867833b9a5abffb/pasted.txt |
19:59:32 | Cea | when I run the header through it complains: `Error: undeclared identifier: 'JSCFunctionListEntry'` |
20:04:34 | shashlick | @Cea - ya it has nested union and struct |
20:04:37 | shashlick | nimterop doesn't support that |
20:04:46 | shashlick | either try c2nImport() to see if c2nim works for you |
20:04:59 | shashlick | or use cOverride to manually define that symbol |
20:05:16 | shashlick | tho that is challenging since it refers to other symbols |
20:05:34 | shashlick | https://github.com/nimterop/nimterop/issues/133 |
20:08:44 | * | bars0 quit (Quit: leaving) |
20:10:15 | Cea | c2nImport returns the same error as when I was originally using it: `Error: expected ';'` |
20:17:07 | * | vlad1777d quit (Ping timeout: 245 seconds) |
20:17:21 | shashlick | what specific line is it failing? |
20:17:42 | shashlick | can you share your wrapper.nim, i can try |
20:24:44 | federico3 | perhaps the compiler itself should build with hints:off |
20:25:52 | * | narimiran quit (Ping timeout: 245 seconds) |
20:29:38 | Araq | why? |
20:31:03 | FromGitter | <kaushalmodi> federico3: I am actually hoping the entire nim compilation to be warning-free at some point in future |
20:34:00 | federico3 | Araq: it generates more than 10k lines of output. I doubt anyone reads the "Hint: .. [Processing]" messages |
20:35:26 | shashlick | so nim doc doesn't use --git.commit |
20:35:59 | shashlick | ah it is not there in 0.19.6 |
20:47:54 | federico3 | (also it makes Travis CI very heavy on the browser and annoying to search through the logs) |
20:50:18 | * | clyybber joined #nim |
20:50:53 | * | Cea quit (Remote host closed the connection) |
20:54:23 | Araq | federico3: ok, agreed but that means we should disable a set of hints |
20:54:51 | federico3 | yep, e.g. the Processing ones |
20:55:06 | federico3 | only in the nim.cfg file in the compiler repo |
21:12:47 | Araq | +1 |
21:14:00 | * | sschwarzer joined #nim |
21:15:03 | shashlick | Araq: are you cool with generating Dash docset documentation for nim as part of devel travis? |
21:15:38 | Araq | meh |
21:16:20 | Araq | only if you feel like maintaining it |
21:18:18 | Araq | and excuse me, I'll be a little harsh: You have lots on your plate, you are working on nimterop, nimble, choosenim... Can we get lockfiles for Nimble? |
21:18:46 | sschwarzer | I noticed that the documentation for the standard library isn't updated yet for Nim 0.20.2. :) So the source links still point to the `master` branch. (Sorry for being picky.) |
21:18:53 | shashlick | there's already niv/nim-docset - all i need to do is run technosophos/dashing after running koch docs |
21:19:11 | shashlick | it's not mandatory to make it part of CI - manually generating isn't too bad |
21:19:47 | Araq | it's one more thing you have to watch out for, or even do manually |
21:20:35 | shashlick | i'll talk to niv and see if they are up to maintaining the docset, then it should be simple |
21:20:41 | shashlick | but ya i agree i have too much going on |
21:20:42 | Araq | how about this compromise: you enable it and if it becomes annoying you stop doing it ;-) |
21:21:01 | shashlick | i've not taken on lockfiles since i don't understand it well enough |
21:21:43 | Araq | as long as Nimble doesn't have lockfiles, it's hard to take it seriously |
21:21:56 | Araq | esp given how long it already exists |
21:22:22 | Araq | I mean, I personally don't mind. But I guess it's a general impression. |
21:23:04 | disruptek | one can generate nim using a macro and then render it as compilable text (ie. source) easily, right? |
21:23:18 | Araq | yes |
21:23:28 | shashlick | @disruptek - i do that in nimterop - see the cImport() proc |
21:23:34 | FromGitter | <alehander42> Isn't somebody already working on lockfiles |
21:23:35 | shashlick | macros are super cool |
21:23:39 | disruptek | i just cannot understand why this api was written this way. |
21:24:02 | disruptek | it literally takes json as input and composes nim source as a string. |
21:24:59 | Araq | disruptek: lol, that's something I learned the hard way. |
21:25:03 | disruptek | i'm not even sure i'd use a macro; i think it could be done with just a parser + side effects. |
21:25:29 | Araq | programmers do not understand trees or "correct by construction", they understand string concats |
21:25:43 | Araq | and they get them wrong. always. |
21:25:50 | disruptek | i'm complaining because i cannot be bothered to understand string concats. |
21:26:01 | disruptek | maybe i should hang up my spurs. |
21:28:39 | Araq | stringly typed code is a pita. but it's also part of holy Unix so expect it to be fixed in 2500 when the last follower of Linus passed away |
21:28:49 | disruptek | lol |
21:29:32 | disruptek | the fact is that we address memory with the same ordinal we use to express the number of runes it holds. |
21:29:51 | disruptek | how do you think it should work? |
21:30:34 | disruptek | you are making up new types for memory addresses and memory sizes; what are the semantics? |
21:30:52 | Araq | I don't see how this follows. |
21:30:55 | disruptek | just slice-based? |
21:31:25 | Araq | I prefer an API to access the list of currently running processes, not some /proc shit filesystem with string entries that I then have to parse. |
21:31:35 | disruptek | i'm just curious how it could be done differently (read: better). |
21:31:53 | Araq | provide a strongly typed API. The end. |
21:33:22 | Araq | the strings are fundamentally incomplete anyway, you still need to give me at least fopen(); read() etc, you might as well give me more of those then. |
21:33:59 | disruptek | yes, but building api the way it's currently done isn't scalable; it's expensive pretty much everywhere. |
21:34:19 | disruptek | i'd rather have the kernel basically be a database and let me query/memoize it. |
21:35:15 | Araq | oh not that again. "isn't scalable", does that actually mean anything anymore? nothing ever "scales". |
21:35:50 | disruptek | i don't care if it doesn't get bigger, i just don't think that time should make the size available to me for new ideas smaller. |
21:36:18 | Araq | if it doesn't "scale", how come Posix is full of descriptions about which header files exist? |
21:36:19 | disruptek | as it is currently, i have to carry around every api i ever thought up, no matter where it goes or what i use. |
21:36:52 | Araq | as opposed to be able to throw out "/proc" again very easily? whom are you kidding... |
21:37:28 | disruptek | i'm not defending /proc, per se, but it's close to what i want. |
21:41:17 | * | solitudesf quit (Ping timeout: 245 seconds) |
21:44:20 | disruptek | i guess i should do this just to learn how. :-) |
21:44:52 | federico3 | a kernel module that implements an alternative to procfs and sysfs is possible |
21:46:26 | disruptek | yeah, but i meant json->nim. |
21:47:29 | clyybber | disruptek: Which api are you talking about? |
21:48:44 | disruptek | aws |
21:49:46 | clyybber | Ah |
21:50:41 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:01:28 | * | elrood quit (Remote host closed the connection) |
22:01:54 | shashlick | If you are looking at json -> Nim then I hope it is generic and not just aws |
22:02:01 | shashlick | Which is why I was suggesting swagger |
22:02:31 | disruptek | i don't know where to get a swagger version of the api, but i'm not sure i'd want to use that as input, anyway. |
22:02:55 | disruptek | i feel like the likelihood that swagger is replaced and a json version lives on is very high. |
22:02:59 | shashlick | It's called openapi now |
22:03:26 | shashlick | It is a json representation of the api |
22:03:38 | shashlick | With a bunch of tools to convert to any target language |
22:03:41 | disruptek | i believe aws implements a superset, though. |
22:04:18 | shashlick | But then your work is only useful for one company |
22:04:30 | shashlick | Whereas openapi has thousand others |
22:05:16 | disruptek | that's great and all, but unless the input is the same, i care more about it working for aws. |
22:07:36 | shashlick | what do you mean by input |
22:11:28 | disruptek | i mean, unless i can get reliable and complete input that defines the aws apis in an identical format to that which defines the apis of other services, i'm disincentivized to build a program that more broadly supports that input. |
22:12:26 | * | shomodj joined #nim |
22:12:32 | shashlick | that's the whole point of openapi |
22:14:05 | disruptek | i believe openapi is a standard regarding the expression of apis. there seems to be a tool that converts the aws stuff into openapi, so if i trust it, i should use it. |
22:15:04 | shashlick | https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen |
22:15:16 | disruptek | yeah, i'm inspecting the output now. |
22:15:26 | shashlick | see all the nim competitors who are already supported |
22:15:38 | shashlick | unfortunately it is java |
22:15:48 | disruptek | yeah, i feel bad for them that they have to use those languages. |
22:16:01 | disruptek | oh well, what can you do? |
22:18:02 | shashlick | https://apis.guru/browse-apis/ |
22:18:39 | disruptek | okay, i guess it will be swagger->nim. |
22:18:45 | shashlick | ideally someone expands that codegen tool or standard openapi tools to generate |
22:19:05 | shashlick | but i'd be okay if it were a pure nim tool that took any swagger API and generated a nim tool |
22:19:19 | disruptek | that's the idea. |
22:19:41 | disruptek | then araq will be satisfied and he can shutup about stringy types. :-P |
22:19:52 | shashlick | i'd think it should be easy with macros as well but the spec is not small |
22:20:36 | disruptek | maybe macros for composition, but i'm not sure what else i'd use them for. |
22:20:48 | clyybber | Araq: When we assign nil to an owned ref, what should we do? Create a temporary? |
22:20:53 | * | UNIcodeX quit (Quit: Leaving) |
22:22:02 | Araq | clyybber: why? |
22:22:32 | clyybber | Araq: We cant deref NIM_NIL |
22:22:54 | Araq | why do we deref it? |
22:23:12 | clyybber | Because owned params are treated like sink, and thus passed by reference |
22:23:12 | Araq | the destructor checks for nil and turns into a nop, that's how moving works |
22:23:47 | Araq | you can take the address of a stack slot that happens to contain NIM_NIL |
22:24:05 | Araq | the owned ref itself always has an address |
22:25:25 | clyybber | Yeah. So I need to generate a stack variable or temporary that contains NIM_NIL |
22:25:38 | clyybber | should I do that in injectdestructors or the backend? WDYT? |
22:26:46 | Araq | I don't understand |
22:26:54 | clyybber | Araq: Sorry, I didnt mean deref NIM_NIL, but take its address |
22:27:28 | clyybber | Currently, C backend generates eq_XXX(&someOwnedRef, (&NIM_NIL)) |
22:28:15 | Araq | ah! |
22:28:33 | Araq | yeah, you need a temp for that |
22:28:36 | Araq | sucks, I know |
22:29:05 | Araq | in fact, I fear this new "better" spec produces so terrible code that we're better off fixing the old =sink design |
22:29:17 | Araq | we need benchmarks |
22:29:33 | clyybber | Yeah |
22:30:32 | clyybber | Araq: So should I introduce the temporary in injectdestructors or the backend? |
22:31:00 | Araq | injectdestructors and in fact, the spec mentions it |
22:31:02 | * | xet7 joined #nim |
22:31:16 | Araq | 'nil' is quite like a function cal 'f()' |
22:31:32 | Araq | it produces a value, you cannot =move a value |
22:32:33 | clyybber | Araq: Yeah, that part IS implemented correctly.. The problem is not the =move call, its the `=` call. |
22:32:51 | clyybber | The `=` call which sets the temporary to nil. |
22:33:30 | * | shomodj_ joined #nim |
22:34:56 | Araq | huh? the prototype of '=' is (var T; T) |
22:35:36 | clyybber | Araq: Yeah, it IS, but when T is an owned ref type, the above occurs |
22:36:27 | Araq | ouch |
22:36:36 | * | shomodj quit (Ping timeout: 258 seconds) |
22:36:40 | Araq | how come this isn't a problem in devel... |
22:36:53 | blackbeard420 | is there anything like runForever() that has a timeout? |
22:37:20 | clyybber | Araq: Because owned isn't passed by reference in devel? |
22:37:38 | blackbeard420 | whoops, thers poll |
22:38:07 | Araq | ah, right |
22:43:00 | * | theelous3 joined #nim |
22:43:41 | clyybber | Araq: I could fix it in injectdestructors by generating nkAsgn, or handle it in genCall of the C backend. What do you prefer? |
22:44:32 | clyybber | s/genCall/genArg |
22:49:23 | Araq | nkAsgn would be wrong |
22:49:33 | Araq | but I dislike codegen patches |
22:51:03 | Araq | how about this: for '=' the second arg is never a sink parameter |
22:52:43 | * | sschwarzer left #nim (#nim) |
23:02:03 | clyybber | Hmm, ok that could work too. I'll try it tomorrow |
23:02:07 | clyybber | gn8 |
23:02:12 | * | clyybber quit (Quit: WeeChat 2.5) |
23:24:26 | * | stefanos82 quit (Quit: Quitting for now...) |
23:25:27 | * | absolutejam quit (Ping timeout: 268 seconds) |
23:37:53 | * | krux02 quit (Remote host closed the connection) |
23:39:53 | * | brakmic quit () |
23:46:09 | * | altarrel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
23:53:18 | * | yeetcannon quit (Remote host closed the connection) |
23:54:26 | * | yeetcannon joined #nim |