<< 18-07-2019 >>

00:13:04*skaruts quit (Remote host closed the connection)
00:18:35FromGitter<Obround> How do you converta seq to an openArray?
00:19:59FromGitter<awr1> openArray is a typeclass
00:20:10FromGitter<awr1> it means "either seq or array"
00:21:12FromGitter<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:41FromGitter<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:40FromGitter<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:58disruptekshashlick: 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:42shashlickokay so i'm here now, we can go through this
02:07:03shashlickare 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:29FromGitter<awr1> what does the -r flag do
02:16:43shashlickrecurses into #include files
02:19:32disruptekyeah, i'm providing the realpath and the --recurse.
02:23:41shashlickok what does the output miss?
02:23:49shashlickyou only want the -p flag to preprocess, not -n
02:25:03disruptekright.
02:25:56disruptekwent 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:03disruptekccmd: 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:48shashlickwhy are you running it on a cpp file?
02:28:27shashlickwhat does the nim file look like?
02:28:54disruptekwhat nim file?
02:29:25disrupteki thought i was supposed to preprocess this into a big c file and then c2nim that, no?
02:29:29shashlickor rather what does the toast command look like
02:29:47shashlickwell, generally, we wrap the header file and compile in the cpp implementation
02:30:06shashlickthat way nim knows how to call the implementation
02:30:13disrupteki can't wrap any of it; i just chose this one at random.
02:30:25disruptekhere'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:53disruptekthis stuff all gets generated so that it can setup the includes and control the output.
02:31:55shashlickso 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:21shashlickthen 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:14disruptekyeah, i'm fine with just linking it, but i can't wrap the headers, either.
02:34:17shashlickokay so let's start there - did you download the whole project? or just the lambda folder
02:34:29disrupteklambda has ~100 headers. i am able to preprocess 6 of these.
02:34:48disrupteki'm working with the whole thing. i wouldn't get far without it.
02:34:58shashlickokay - let me find the link
02:38:18disruptekhere'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:01shashlickeasier to use nim
02:46:07shashlicki'm trying it out, give me a few
02:46:23*laaron joined #nim
02:46:57disruptekyeah, 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:16shashlickno worries, i'll get you started
02:51:31shashlickhow do you get `aws/core/SDKConfig.h`
02:51:35shashlickI see a .in file
02:51:46shashlickhave to run cmake?
02:52:29shashlickalso, win/lin/osx
02:53:21disruptekthat'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:46shashlickwell, you need the libs regardless
02:54:06shashlickand you need the headers processed to generate the .h files from .in
02:54:14disruptekyeah, those are fine. but you're saying you don't have a SDKConfig.h?
02:55:04shashlickNo
02:55:19*smitop quit (Quit: Connection closed for inactivity)
02:56:25disruptekmine 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:34disruptekhey, 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:35disruptekand 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:28shashlickno worries - i need to make some hacks into nimterop for cmake and c2nim support
03:34:34shashlickso 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:57FromGitter<gogolxdong> How to get the file name of current file?
05:38:11FromGitter<gogolxdong> this could work `currentSourcePath().split("/")[^1]`
05:42:08*solitudesf joined #nim
05:43:34leorize[m]os.extractFilename?
05:50:24FromGitter<gogolxdong> good to know, it's more gurateened ,right?
05:50:32*narimiran joined #nim
05:53:47*absolutejam joined #nim
06:09:16FromGitter<mratsim> we always use currentSOurcePath because it can work at compile-time
06:13:40FromGitter<gogolxdong> Is there any difference `const currentFileName = currentSourcePath().extractFilename().split(".")[0]`
06:13:55shashlickos procs may not work at compile time
06:14:30shashlick@disruptek - i added c2nim, cmake and make support to nimterop
06:14:46shashlickso now the wrapper looks like this - http://ix.io/1ON4/nim
06:16:36shashlickhowever, c2nim cannot parse the preprocessed output - http://ix.io/1ON5/cpp
06:19:10shashlickhttp://ix.io/1ON7 is the error message
06:19:31FromGitter<gogolxdong> `split("/")[^1]` doesn't work in Windows
06:20:05shashlickyou can try editing the generated cpp but i suspect it is not going to be easy
06:21:20shashlick@gogolxdong - use split({'/', '\\'})
06:21:52narimiranhttps://nim-lang.github.io/Nim/os.html#splitFile%2Cstring ?
06:23:16FromGitter<gogolxdong> Does split work better than extractFilename()?
06:24:04FromGitter<gogolxdong> efficiency or more general purpose
06:24:11*Vladar joined #nim
06:24:38*Cthalupa quit (Ping timeout: 245 seconds)
06:24:47narimirani haven't used any of those, but it sure does look less ugly/fragile than `.split(".")[0]`
06:28:10FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d30117a202bb93f00c3c95d]
06:28:49FromGitter<gogolxdong> you are welcome, which is champion?
06:29:12narimiranthe 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:21FromGitter<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:51FromGitter<mratsim> i.e. use rsplit :p
07:08:52FromGitter<mratsim> can we get a warning on unused import @Araq? https://github.com/nim-lang/Nim/commit/4becd5a2a8d67c7481af457d5007e1a313d454c8
07:12:31leorizeAraq 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:35Araqmratsim: ok
08:08:09*Cthalupa joined #nim
08:11:19*floppydh joined #nim
08:15:15*Cthalupa quit (Ping timeout: 258 seconds)
08:20:12Araqhttps://www.twitch.tv/araq4k
08:20:19Araqtoday's topic: nimpretty
08:20:25Araqspecial guest: Miran.
08:21:29narimirantrying to fix: https://github.com/nim-lang/Nim/issues/11699
08:26:07*mal`` quit (Quit: Leaving)
08:31:36FromGitter<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:59narimiran3.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:02narimirannimpretty 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:19dom96narimiran https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370
10:34:51leorizeI personally write like that
10:35:03leorizeand I'm pretty sure a fair share of docs write like that
10:36:27leorizenarimiran: will you ever stream? :)
10:38:34dom96of course NEP-1 does not specify the preferred style
10:38:44dom96there is a lot it doesn't specify
10:39:58narimirandom96: heh, that (fooB) is what i proposed ;)
10:40:08dom96narimiran <3
10:40:54dom96That style has an objective advantage: less indenting, and no need for odd indentation (which is a PITA)
10:41:19narimiranleorize: i have performance anxiety
10:44:33Zevvfor an audience of 9 :)
10:44:51Zevvevery time you type a line in #nim you are performing, you can do it!
10:45:07narimirani even have an anxiety for an audience of 0. (when we record our videos)
10:45:25*clyybber joined #nim
10:45:36narimiranit is much easier to type (then delete, correct, improve) than to speak.
10:46:00narimirani often catch myself in the middle of some sentence struggling to find an english word, etc.
10:46:03*ng0 joined #nim
10:59:44FromGitter<alehander42> but thats the beauty of it
10:59:47Zevvyeah, true, not speaking your native tongue is an extra reason
10:59:48FromGitter<alehander42> if you practice it often
11:00:01FromGitter<alehander42> you stop thinking too much about it
11:00:33Zevvand 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:36FromGitter<alehander42> i am if you speak in croatian
11:00:52FromGitter<alehander42> can you imagine if twitch watchers also had cams
11:02:09narimiranheh, i sometimes even have these anxieties when i'm speaking in croatian :D but english is definitely much much worse
11:02:43narimiranso maaaybe i might do some pre-recorded stuff, when i record it over and over again until it is not too bad
11:03:05FromGitter<alehander42> nah this is not live!
11:03:19FromGitter<alehander42> i guess another option is to somehow type comments in some kind of subtitle place
11:03:21FromGitter<alehander42> while you work
11:03:33FromGitter<alehander42> e.g. often i am at coffee-s etc where it might be strange to talk a lot
11:03:39FromGitter<alehander42> so if i was streaming from there
11:03:42FromGitter<alehander42> i'd try that
11:03:47FromGitter<alehander42> but talking is better overally
11:04:29narimiranbut who wants to listen to all of the "uuuuuuummmmm", "aaaahhhhmmmm", etc.?
11:04:34dom96Just stream, re-recording things until perfection is often just a waste of time
11:05:19narimiran"i'm doing (long pause here) some streaming (pause) of (pause) uuuummmm (long pause) well (pause) ...."
11:05:32leorizestreams are really forgiving about those stuff :p
11:05:34FromGitter<alehander42> eh come on, thats live streaming
11:05:54FromGitter<alehander42> no um-s is like formula1 without noise
11:06:08FromGitter<alehander42> you can ummmm like a ferrari on a turn
11:06:10narimiranoh, did you watched silverstone? :)
11:06:37FromGitter<alehander42> no, i dont watch them often anymore, but i am following the championship
11:06:45FromGitter<alehander42> my mother is the big fan :D
11:07:27narimirando yourself a favour and watch silverstone higlights (hopefully it is a long video, showing all the interesting action happened there)
11:07:40narimiranmore action there in 20 laps than in last 20 races i watched
11:07:53leorizenarimiran: if you're too anxious you can get someone on stream with you to talk to :)
11:07:57FromGitter<alehander42> oh yeah ive heard its great
11:08:32narimiranleorize: 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:53FromGitter<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:53FromGitter... 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:01FromGitter<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:11FromGitter<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:12FromGitter... community is [https://gitter.im/nim-lang/Nim?at=5d305a9b3e2c7e3970a863ac]
11:40:12FromGitter<kaushalmodi> narimiran, dom
11:40:28FromGitter<kaushalmodi> +1 for the fooB style from me too
11:40:52FromGitter<kaushalmodi> Can that style be used for both if and case expressions?
11:41:09dom96arnetheduck: "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:29FromGitter<alehander42> what is this fooB style
11:41:34FromGitter<kaushalmodi> At present, how the "case" and "of" show up in different columns for case expressions is weird
11:43:00FromGitter<kaushalmodi> @alehander42 https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370
11:43:09dom96kaushalmodi: ouch, does that really happen?
11:43:16narimiranthe problem with "fooB style" - what do you do when you have a oneliner like `let a = if x: 7 else: 9`?
11:43:18dom96if so I'd call that a bug
11:43:34dom96narimiran: keep it as a one-liner
11:43:34FromGitter<kaushalmodi> dom96: see my last issue
11:44:01FromGitter<kaushalmodi> narimiran: not keep it a one liner?
11:44:19narimirandefinitely it should be kept, c'mon
11:44:34FromGitter<kaushalmodi> I'm fine either way ;)
11:44:50narimiranand your "case expression" example is quite fine, as i said
11:45:02FromGitter<kaushalmodi> If you want to keep it, you'll need to count chars and convert that to fooB if it exceeds 80
11:45:05narimiranthe only improvement it would be to put `case foo` on a separate line
11:45:13FromGitter<kaushalmodi> "now fooB is a thing"
11:45:31FromGitter<kaushalmodi> narimiran: isn't that what fooB is?
11:46:00narimiranas i already said while streaming: if you prefer these manual alignments - don't use nimpretty
11:46:16FromGitter<alehander42> hm is it possible
11:46:19narimiranfooB deals with if expressions, not case expressions
11:46:20FromGitter<alehander42> to make nimpretty ignore
11:46:22FromGitter<kaushalmodi> It's not manual, fooB will be consistent everywhere
11:46:23FromGitter<alehander42> a section
11:46:31narimiranit is
11:46:46narimiran`#!nimpretty off` is the syntax
11:46:51FromGitter<alehander42> ok
11:47:36narimiran`let someVeryLongNameHereWithLotsOfChars = case x`
11:48:05FromGitter<kaushalmodi> Right.. now fooB it
11:48:09narimirando you really want to have these 40+ whitespace alignment?
11:48:32narimiranand my answer is a very strong NO
11:48:37FromGitter<kaushalmodi> So "case x" onwards will begin indented on the next line
11:49:20FromGitter<kaushalmodi> What's wrong with beginning case x on the new line?
11:49:28narimiranit needs to be implemented :P
11:49:52narimiranwhat's wrong with the current nimpretty's way?
11:50:32FromGitter<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:39narimiranand?
11:51:02FromGitter<kaushalmodi> Well, that's pretty?
11:51:36narimiranso 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:41narimiranto me it is pretty, yeah
11:52:10narimiranfor others, here is a case example we're discussing: https://github.com/nim-lang/Nim/issues/11755#issuecomment-511944563
11:52:32narimiranis your original case expression pretty? ;)
11:52:42FromGitter<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:05FromGitter<kaushalmodi> narimiran: I am willing to adapt to fooB style
11:53:20narimiranand this is that human/ascii stuff that Araq also talked about in the stream
11:53:35FromGitter<kaushalmodi> That fits the criteria of avoiding unnecessary indentation on left and also keeping the if and case expressions in a rectangle
11:53:35narimiran[longnamehere, yy]
11:53:45narimiran[short, (extraspaces)zz]
11:54:27FromGitter<kaushalmodi> Sorry, I don't get the reference to the human/ASCII stuff, on phone, and haven't watch a stream
11:55:15narimirantl;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:58narimiran"clean rectangular blocks" fit in that category
11:56:37FromGitter<kaushalmodi> So your only objection to fooB style is that it's not implemented?
11:57:13dom96`case` should also be on its own line
11:57:24dom96its consistent with the `fooB` if statement
11:57:35narimirandom96: yeah, case could, but `if` might not
11:57:47dom96why not?
11:57:48narimiranand then we'll listen to "it is not consistent, you fools"
11:57:49FromGitter<mratsim> who is this fooB?
11:58:06dom96beacause of one-liners? Those are a fair exception
11:58:19narimiranthis is fooB: https://github.com/nim-lang/Nim/commit/6d8913ee1422143baebd438f7526208193c0bd5e#r34352370
11:58:31dom96The only reason for moving this code around is if it doesn't fit on a single line
11:58:36dom96so why would this be a problem?
11:58:42dom96if the `if` is small, keep it on the same line
11:59:03narimirandom96: if `if` is small, but multiline?
11:59:16dom96this also includes: `let foo =\n if short: 42 else: 69`
11:59:34FromGitter<mratsim> I prefer having `let fooB = block:` if the `if` expression doesn't start at the same line
11:59:35dom96narimiran not sure what you mean
11:59:40FromGitter<kaushalmodi> dom96: exactly
12:00:02FromGitter<kaushalmodi> narimiran: as I mentioned earlier, I don't care much about if you keep one liners as so or not
12:00:12narimiran`let foo = if short: 42\n else: 69`
12:00:59narimiranthat'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:13narimiranand that's the core of nimpretty "problem"
12:01:23FromGitter<kaushalmodi> I mean that I leave it up to you on how to deal the one liners
12:01:25narimiranthere's always somebody who doesn't like some decision
12:01:45FromGitter<mratsim> I thought that was the reason to have nimpretty :p
12:01:51narimiran"nimpretty should prettify the code the way i want"
12:02:14FromGitter<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:30narimiranbtw, it is not like you have an embargo on touching your code after nimpretty has run
12:02:32FromGitter<kaushalmodi> Coming back to objective argument, is there an issue with fooB style (except that it cannot yet be implemented in nimpretty)?
12:03:03FromGitter<kaushalmodi> First step would be coming to an agreement and then deal with its implementation
12:03:05FromGitter<mratsim> it won't be objective for long ;)
12:03:13narimiranso 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:32FromGitter<mratsim> the issue is that everytime you run nimpretty you need to refix those
12:03:39FromGitter<mratsim> that makes nimpretty a non-starter
12:03:54narimirannot necessarily
12:04:05narimirani've run nimpretty on lib/pure/collections
12:04:08FromGitter<alehander42> yes, this doesnt work
12:04:13FromGitter<mratsim> ship with a config file and people will customize it
12:04:15narimiranin some cases nimpretty doesn't stand the chance
12:04:21FromGitter<alehander42> one should be able to just run his autoformatter and be done
12:04:29FromGitter<alehander42> i just think people should put
12:04:36FromGitter<alehander42> such code in section where it doesnt run
12:04:40FromGitter<alehander42> this is a better fix
12:04:49narimiranin 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:50FromGitter<alehander42> as you dont need to change it every time: e.g. type declaration with offset
12:05:11FromGitter<alehander42> hm, ok this is stranger, nvm then
12:05:16FromGitter<kaushalmodi> narimiran: but nimpretty still touches the case expressions, right?
12:05:35FromGitter<kaushalmodi> I like @alehander42's idea about creating scopes for nimpretty to not touch
12:05:52FromGitter<kaushalmodi> may be special beginDontTouch/endDontTouch comment chars?
12:05:54FromGitter<alehander42> they exist
12:05:55narimiranthat already exists
12:06:09narimiran`#!nimpretty off` is the syntax
12:06:18FromGitter<kaushalmodi> I thought what you mentioned earlier ignores the whole file
12:06:23narimiranno
12:06:31narimiran`#!nimpretty on` to turn it back on
12:06:35FromGitter<kaushalmodi> so.. `#!nimpretty off` .. `#!nimpretty on`?
12:06:37FromGitter<kaushalmodi> ok!
12:07:03FromGitter<mratsim> why wasn't {.push.} {.pop} reused?
12:07:14*narimiran rage quits
12:07:19narimiran:P
12:08:21FromGitter<mratsim> if `#!nimpretty` is at the very beginning of a file, does that confuse shell script, it's like `#!/bin/python`
12:11:59dom96> "nimpretty should prettify the code the way i want"
12:12:02dom96I disagree with this
12:12:31dom96nimpretty should prettify code to a single true style
12:12:32dom96that we all use :P
12:12:38narimirani also disagree, but this is a feeling i get from these discussions
12:12:56FromGitter<kaushalmodi> narimiran: we are trying to collaborate on one "good" style
12:13:07FromGitter<kaushalmodi> it's understood that everyone will need to make small compromises
12:13:23narimirandom96: so, to update the quote: "single true style is the code style i want"? :P
12:13:26FromGitter<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:37FromGitter<mratsim> Highlander style
12:13:38dom96narimiran: it's not about me, I am just pushing for my vision
12:13:43FromGitter<kaushalmodi> so again, is there any issue with fooB style?
12:13:53narimiranit isn't, generally speaking
12:13:59dom96if my arguments are good I think it's fair to adopt my vision :P
12:14:01FromGitter<mratsim> I prefer having a block: after the =
12:14:07narimirani find it problematic for oneliners, but other than that, i like it
12:14:22FromGitter<kaushalmodi> narimiran: but you can keep oneliners be so
12:14:31dom96mratsim: that's not a style decision, that's a completely new construct
12:14:31narimiranok, PRs welcome :P
12:14:34dom96you _should_ keep one-liners as-is
12:14:34FromGitter<kaushalmodi> .. as long as they don't violate the maxCharsPerLine
12:14:43dom96unless they are too long
12:15:10FromGitter<kaushalmodi> so again.. "convert to fooB and leave oneliners as-is unless they exceed maxCharsPerLine"?
12:15:11narimiranthat'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:03narimiranlook at layouter.nim code. your first reaction will probably be (and it should be) "well, this is ugly, who wrote this shit?"
12:16:32dom96the solution is to have lots of tests
12:16:43dom96and yes, it'll be a pain to satisfy all of them, but that's just how it is
12:17:03narimirandom96: every bugfix adds an additional test(s)
12:24:56FromGitter<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:17FromGitter<kaushalmodi> there should be no difference of opinion at least on this one :)
12:25:35FromGitter<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:36FromGitter... 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:12FromGitter<kaushalmodi> @arnetheduck I agree with you
12:26:41narimiran@kaushalmodi ah, the comment somehow fools nimpretty
12:26:44FromGitter<kaushalmodi> would like to have eventually have nimpretty in Travis tests for PR's
12:26:59*absolutejam joined #nim
12:27:11FromGitter<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:37FromGitter<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:37FromGitter<arnetheduck> yeah, but it takes a good prettifier - those that just dumbly spit out newlines unconditionally are too ugly
12:29:43FromGitter<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:08FromGitter<arnetheduck> and of course the famous one-liner
12:33:33AraqI tinkered with the cost functions. it needs tons of domain knowledge and nimpretty can get one
12:34:31AraqI'm not convinced it works better than throwing some machine learning at the problem, but it's on the table
12:35:45AraqI agree that nimpretty shouldn't have tons of configuration options
12:36:18FromGitter<arnetheduck> might be hard to find a corpus of "pretty" code though since humans are humans and suck at formatting code, generally
12:36:45Araqand apart from that, the next step is that we have git hook so that new commits are always nimprettified
12:36:47FromGitter<arnetheduck> and I hope we don't get non-constant indent/alignment boxes, they're terrible for git diffs
12:37:13Araqwe need to eat our own dogfood, that's all
12:38:14FromGitter<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:26Araqfor 0.20.2 we did run nimpretty over our collection APIs with really good results.
12:39:17FromGitter<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:57Araqbut the real tension here is: "format this file consistently with how it currently looks like"
12:40:03Araqvs "format this file according to our rules"
12:40:30Araqand that might be the one switch we should add to nimpretty
12:40:30FromGitter<kaushalmodi> the `#!nimpretty off` .. `#!nimpretty on` does not turn off the LineTooLong warnings
12:40:53FromGitter<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:02FromGitter<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:29Araqarnetheduck: wrong, let's consider the number of spaces to use for indentation ...
12:41:59Araqcompiler + stdlib use 2 but 4 is *very* popular
12:42:24Araqand telling people "yeah, you can't use nimpretty if you like 4" makes the whole tool a stillborn IMO
12:42:26FromGitter<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:08AraqI am not following you but I gotta go, see you later
12:43:39FromGitter<arnetheduck> like imagine that the compiler autoformats as part of compilation.. no 4-space indented file will exist
12:43:54dom96yeah, as soon as you allow some customisation you have to draw the line somewhere, and that's difficult
12:43:57FromGitter<arnetheduck> just the same as with tabs now - no tab-indented nim files exist and that's that
12:43:59dom962 spaces for everyone
12:44:24FromGitter<kaushalmodi> I was actually very thrilled to see the 2-space convention in Nim
12:44:31dom96indeed, tabs are insanely popular too
12:44:41FromGitter<kaushalmodi> I have been using that for a long time in my other projects
12:44:59FromGitter<arnetheduck> `go` is about the only language out there that uses tabs - everyone else has moved to spaces afaik
12:45:07disruptektabs. 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:08FromGitter<arnetheduck> but crucially, *all* go code uses tabs
12:45:19disruptekbecause duh.
12:46:00FromGitter<arnetheduck> spaces almost won this useless debate, then go came along and reopened it :/
12:46:21disrupteki actually render as 3, and why shouldn't i?
12:46:43FromGitter<alehander42> the problem i see is , you can do that with spaces
12:46:47FromGitter<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:01narimiranyay :)
12:47:01disruptekand you are free to use spaces if you wish. what's the problem?
12:47:12FromGitter<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:29disruptekwhy guess, for kickoffs?
12:47:37FromGitter<alehander42> because it cant *know*
12:47:48FromGitter<alehander42> if the original code really used 4 spaces
12:47:56FromGitter<alehander42> or if this is 2 x 2 spaces
12:47:57disruptekit can know if you use tabs.
12:48:02FromGitter<alehander42> i mean, it can infer it
12:48:10FromGitter<alehander42> but it basically can if you use spaces as well
12:48:23FromGitter<alehander42> it needs a bit more knowledge about the lang
12:48:29disruptekor are you arguing that guessing is superior to knowing?
12:48:30FromGitter<alehander42> but its techincally 95% possible
12:48:36FromGitter<alehander42> i am arguing it doesnt matter
12:48:42FromGitter<alehander42> you can techincally render 3 spaces
12:48:48FromGitter<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:51FromGitter<alehander42> even if your original code was with spaces
12:49:13disruptekyes, but nimpretty will take quite a bit more work to be truly idempotent.
12:49:15FromGitter<alehander42> overally i am ok with one consistent thing: tabs are great
12:49:21FromGitter<alehander42> but spaces already won in most languages
12:49:27FromGitter<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:27FromGitter<alehander42> so spaces>tabs
12:49:37disruptekspaces won for the wrong reasons, and nim isn't most languages.
12:49:45FromGitter<kaushalmodi> it already worked well for a moderate size project
12:50:15FromGitter<alehander42> you can make up to X surprising lang design choices
12:50:24FromGitter<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:00shashlickHey @disruptek did you see my messages from earlier
13:05:57disruptekshashlick: i see them now. i had the same issue with c2nim.
13:06:10disruptekwhat do you recommend?
13:07:41FromGitter<kaushalmodi> @alehander42 Are you here?
13:08:30FromGitter<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:19disruptekAraq'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:18disruptekshashlick: 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:28clyybberarnetheduck: I found that in some cases 4 space indentation makes code much more readable..
13:13:07disruptekit'd be awesome if you could just change the way it renders spontaneously with making any commits.
13:13:12disruptekoh wait.
13:13:20clyybberTabs yay
13:13:49shashlick@disruptek will you can start commenting out portions and see how far you get
13:13:55shashlickWell
13:14:37*absolutejam quit (Ping timeout: 245 seconds)
13:14:59disruptekwhat's the error you get from that latest c2nim ingestion attempt?
13:15:51shashlickI was commenting out stuff and finally gave up when I ran into template stuff
13:16:30narimiran@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:51federico3alehander42: it's more complex than that. People also argue for tabs for indentation followed by spaces for alignment
13:16:51narimiran"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:21shashlickAn alternate with major benefits is to generate from swagger or whatever they call it now
13:17:48FromGitter<kaushalmodi> narimiran: if you look at the snippets outputs, you will see that the order is retained for seq/set inputs/outputs
13:18:03narimiranyes, for seq output
13:18:11narimirantables and sets don't have an order
13:18:14FromGitter<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:15disruptekyeah, that's what ryukoposting began, but it was never completed. i think i'm too stupid to make the code work.
13:18:32narimiranit doesn't matter what's an input
13:18:36FromGitter<kaushalmodi> narimiran: right, so I am just explicitly saying that the order is not retained
13:18:51FromGitter<kaushalmodi> with seq in, sets out, the order was retained
13:19:00shashlickAnother option is to enhance c2nim
13:19:21narimiranbut the remark is just wrong
13:19:27shashlick@ratiotile has been doing some work here already
13:19:46FromGitter<kaushalmodi> what would be the right way to add that note
13:19:50narimiran"when the **input is a table**, the order of elements ...." - no, that's not the reason
13:20:18FromGitter<kaushalmodi> how about "when either the input/output type is Table, the order of elements is not guaranteed"
13:20:18disrupteki'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:18narimiranthe 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:19shashlickEnhancing c2nim to support more c++ will be very well received
13:21:22disruptekkaushalmodi: `undefined` is perhaps both more accurate and more precise.
13:21:50FromGitter<kaushalmodi> disruptek: noted
13:22:30shashlickWe have a very good c wrapping story, c++ is daunting and I've not been motived yet to add support in nimterop
13:23:05narimiranif hashing algorithm changes, so might your outputs
13:23:24disruptekif platform changes, so might your algorithm.
13:23:33narimiranthat too :)
13:23:38disruptekit's pointless to hazard a guess. the order is undefined, by definition.
13:23:50FromGitter<kaushalmodi> narimiran, disruptek: "As it can be seen from these examples, the outputs of *table* comprehension have elements in undefined order."
13:24:29narimiran...if you ever wondered why you can't do "give me the third element of the set" (`s[3]`)
13:24:44narimiranoff by one there :D :D
13:24:51FromGitter<kaushalmodi> :)
13:25:13FromGitter<kaushalmodi> so the same undefined order is for sets too?
13:25:30narimiransets == tables with just keys :P
13:25:45FromGitter<kaushalmodi> ok, just confirmed that in my example
13:25:50FromGitter<kaushalmodi> updating the example to reflect that
13:25:54FromGitter<kaushalmodi> thanks for the feedback
13:26:52*brakmic joined #nim
13:26:53disruptekrealize 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:59narimiranbtw, 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:56narimirandisruptek: yep, that's why i suggested that maybe no note at all would be the best course of action
13:28:05disruptekthose are ordered dicts, though, which do what they sound like, as opposed to nim's version that retains the order of insertion.
13:28:36disrupteknarimiran: the fact that we're having this convo suggests that some note might help someone clarify.
13:29:23narimiranif i was a beginner, from that note i would conclude that `comp` package somehow fucks up the order
13:30:08FromGitter<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:25FromGitter<kaushalmodi> I'll then link to that
13:30:46narimiranhere: https://en.wikipedia.org/wiki/Hash_table -- "Type Unordered associative array" :P
13:30:52*brakmic quit (Ping timeout: 245 seconds)
13:31:15clyybberor here: https://en.wikipedia.org/wiki/Set_(mathematics)
13:31:32disruptekit might not be that easy to find lists of things that nim types aren't, and that's a good thing.
13:31:43clyybberIf someone doesn't know what a set is, he probably shouldn't use it..
13:32:17disruptekdocumentation serves to teach what it is, so that one may use it successfully.
13:32:18narimiran...and if you're not using sets, you're missing quite a lot
13:33:01FromGitter<kaushalmodi> I know what sets are, but coming from perl, I am spoiled by ordered hashes
13:33:24FromGitter<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:54narimiranbtw, we have OrderedTable and OrderedSet
13:34:01FromGitter<kaushalmodi> I know
13:34:18FromGitter<kaushalmodi> so I need to clarify in the notes that don't expect output order to be the same as input seq
13:35:15disruptekwell, it should be in cases where the order is defined, such as OrderedTable.
13:35:39FromGitter<kaushalmodi> that I believe would be something internal to `comp` implementation?
13:35:52disruptekit's internal to the OrderedTable impl.
13:36:04FromGitter<kaushalmodi> Just clarifying that this discussion is not about sets and tables in general
13:36:12FromGitter<kaushalmodi> but the sets and tables that `comprehension.comp` returns
13:36:37disruptekoh, ignore me then. i have no idea what that is.
13:37:33FromGitter<kaushalmodi> disruptek: We are talking about my notes in https://scripter.co/notes/nim/#comprehension
13:39:37*absolutejam joined #nim
13:40:26disruptekokay, 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:34disruptekit seems like you could rewrite comprehension to work that way, and then provide a generic for your type that implements composition.
13:44:41disruptekit should at least word for those tables, though, so i guess technically it might bear mention.
13:44:46disruptek^work, too
13:45:55FromGitter<alehander42> btw why would i lose my terminal typing "output"
13:46:19FromGitter<alehander42> can that be related to stdin handlng from a program that i ran
13:46:27FromGitter<alehander42> somehow closing the fd?
13:47:02disruptekfailure to write to input of another stream, more likely.
13:47:54FromGitter<alehander42> yeah, makes sense
13:51:13disrupteknarimiran: just curious, but what's the problem with murmur3 in js?
13:51:27narimiranuint32 * uint32
13:51:34disrupteklol
14:00:28clyybberAraq: WDYT about transforming 'owned ref' parameters to 'sink owned ref' parameters in injectdestructors?
14:00:39clyybberWould 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:38Araqclyybber: don't like it
14:03:57Araqthese 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:36shashlick@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:42shashlickbasically like nimgen
14:10:55FromGitter<kaushalmodi> shashlick: can you tag a release of nimterop?
14:13:01shashlickmaybe it is time
14:13:13shashlicki just hate updating the nimble file AND tagging
14:13:27FromGitter<kaushalmodi> but you haven't done it even once :P
14:13:35dom96it's such a hardship :P
14:13:50disrupteki mean, he REALLY hates it.
14:14:05FromGitter<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:23shashlickexactly, i've been averse to it without any good reason
14:14:37shashlickyou could use a commit tag tho 😛
14:14:59dom96Implement a `nimble tag` command :)
14:15:06FromGitter<kaushalmodi> I know.. but it a nice v0.0.1 tag would be cool
14:15:38disrupteki'd start at v2.0 at least.
14:15:52narimiranv19.7
14:15:53shashlickwhich is effectively a version
14:15:54shashlickcan someone explain to me why we need a tag when there's already commits?
14:16:28FromGitter<kaushalmodi> I didn't understand "can someone explain to me why we need a tag when there's already commits"
14:16:40disruptekcommits outta be enough for anybody.
14:16:57shashlickso if you depend on a particular version, you can use the commit hash - nimble already allows that
14:17:12shashlickwhy do we have to go through the extra effort of a cosmetic version tag as well
14:17:17FromGitter<kaushalmodi> ah OK, tags give you a human readable number
14:17:33FromGitter<kaushalmodi> you cannot know if commit 1234567 is newer or 1234568
14:17:47FromGitter<kaushalmodi> but with a tag, it's obvious which is newer
14:18:14disruptekthe 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:17FromGitter<kaushalmodi> .. and nimble install nimterop will auto-install the newest tag
14:18:31shashlickhow 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:43shashlicknimble install nimterop installs head when there's no tag
14:18:58FromGitter<kaushalmodi> when you tag a release, I can see diffs between 2 tags easily
14:19:15disruptekyou can always see diffs easily.
14:19:24shashlickyou can see diffs between commit hashes too
14:19:49disrupteki guess the only argument that makes sense, to me, is that it allows the developer to convey the import of changes.
14:20:00FromGitter<kaushalmodi> disruptek: it's difficult to explain
14:20:04shashlicksorry, i'm really trying to understand, not just being difficult
14:20:07shashlickbut i am disciplined in the sense that i don't push broken stuff into master
14:20:12FromGitter<kaushalmodi> in my git interface, I can see nice milestones where the tags are
14:20:14disruptekthe usage of the value on the side of the consumer seems irrelevant.
14:21:05disruptekshashlick: the changes you made last nite, would you say they were patch-level changes, minor-release changes, or major-release changes?
14:21:08FromGitter<kaushalmodi> (https://files.gitter.im/nim-lang/Nim/yW5N/image.png)
14:21:17disruptekthis is the only value to semantic versioning that i can see.
14:21:31shashlickminor release
14:21:32FromGitter<kaushalmodi> then I know that the commits inbetween tags are probably unstable
14:22:16disruptekso by tagging that commit, you basically give hints to consumers of how valuable or risky those changes are.
14:22:49FromGitter<kaushalmodi> alright, I'll stay away from this discussion :)
14:22:54disrupteki think it's crazy for a master branch to ever move backward.
14:24:40FromGitter<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:00FromGitter<kaushalmodi> if no bug fix commits are needed for a "while" (subjective), I tag it
14:25:16FromGitter<kaushalmodi> again, not trying to enforce this flow on anybody.. just describing how I do it
14:29:29shashlickso basically tags are conveying two things - how stable I think it is and how major the changes are
14:30:25FromGitter<kaushalmodi> yes
14:30:30disrupteki think people expect stability standards to vary from project to project and perhaps even according to the tag.
14:30:38FromGitter<kaushalmodi> for example, if I am working on a feature addition
14:30:53FromGitter<kaushalmodi> and even if everything works, I will hold off from tagging until I am happy with docs and tests
14:32:52disruptekwhereas, i would tag a patchlevel any time i fix a bug, however minor.
14:33:04disruptekany time i break anything, it's a new major. any time.
14:33:29disruptekminors are only for feature additions.
14:33:56FromGitter<kaushalmodi> that's pretty much semver: https://semver.org/
14:35:16disruptekyeah, 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:57Araqshashlick: I appreciate when c2nim is used, so thank you! :-)
14:37:33*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:37:52Araqand 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:08Araqthe idea is that in return you don't have to tweak the Nim output
14:38:28disruptekbut i'd rather write nim than edit generated c++.
14:39:03Araqthere is an .emit like feature
14:39:13Araqyou can write some Nim code inside the C header file
14:39:47disruptekoh, cool. i guess since i've never gotten to where c2nim worked, i've never dug into it.
14:40:22disruptekso i'll just generate the header, then use some markup to insert nim code, then c2nim that.
14:40:30clyybberAraq: You removed the compilerapi from c2nim? So is the linelength now configurable without changing the compiler?
14:41:19Araqclyybber: yeah
14:41:35shashlicki'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:16shashlicki prefer the nimterop strategy of leveraging tree-sitter since C++ is evolving so much
14:42:46Araqthat's fair but keep in mind that I used c2nim to wrap essentially of Urho 3D and wxWidgets
14:42:55shashlickbut updating to support c++ is not something i'm motivated to do right now
14:43:09Araqthe C++ is there, it works, surely it can always be better
14:43:20Araqand yeah, it's not C++11 ready
14:43:22clyybbera small shell script and c2nim can do wonders for wrapping massive complicated stuff
14:43:53*shomodj joined #nim
14:43:54disrupteki believe it's working for some, but i haven't been able to make it work yet.
14:44:14shashlicksee the existing nimgen projects for some ideas
14:44:21Araqwell the amount of different styles that C and C++ support is massive
14:44:43Araqthey are hard languages for tools, yes, C included.
14:44:45shashlickthey aren't fans of DRY are they
14:44:52disruptekof course. to me, it's a miracle that our systems still build.
14:45:34shashlickit is part of the reason why i only want to wrap and not outright convert
14:48:19*noonien joined #nim
14:49:18noonienhello, i'm expecting the answer to be yes, but i'm asking anyway, does `asyncnet` support udp?
14:50:29Araqiirc, yes
14:51:06FromGitter<kaushalmodi> Nim needs flashy demos like this: https://twitter.com/v_language/status/1150803006025359360 (just saw someone retweeted this in my stream)
14:51:34FromGitter<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:22Araqread 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:10clyybberAraq: Opinion on this fix: https://github.com/nim-lang/Nim/pull/11248/commits/ceaeb9d25ca28609df83b8845350f110784b4620#diff-ca3e84124342c138a94f4b4c6b636e90R164 ?
17:16:28clyybberIt allows passing sink/owned parameters to =move correctly.
17:17:00clyybberBut it generally allows passink sink/owned to procs that take var parameters.
17:17:13clyybbers/But it/But it also
17:17:56clyybberBut only in the backend, so I guess its fine
17:27:12*noonien quit (Quit: Connection closed for inactivity)
17:28:00disruptekthis is surprising. http://ix.io/1OQ2/nim -- also, no warnings in `nim check`.
17:31:14clyybberoh, I didn't know ix.io could do syntax highlighting
17:34:22clyybberbbl
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:45federico3https://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:36shashlickwho uses docset here?
18:47:47*elrood joined #nim
18:55:35*Cea joined #nim
18:55:57disruptekwhat's the smarter way to `when compiles(result)` (ie. see if result is a valid symbol in this scope)?
18:56:30rayman22201@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:32CeaI'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:33Cea able to help me to understand where I'm messing up?
18:59:12FromGitter<awr1> i'll give it a shot
19:00:00*Lord_Nightmare joined #nim
19:01:15shashlick@rayman22201 - i'm looking into using niv's docset json to generate nim.docset on every build
19:01:21FromGitter<awr1> also @Araq i ended up adding that command line option https://github.com/nim-lang/Nim/pull/11742
19:01:59shashlick@Cea - please try nimterop
19:02:39Cea@shashlick Thanks I'll take a look
19:03:00FromGitter<kaushalmodi> disruptek: `declaredInScope`?
19:03:18rayman22201@shashlick: sounds reasonable. why not? lol
19:03:32disruptekkaushalmodi: that's probably it, thanks. :-)
19:03:43FromGitter<kaushalmodi> disruptek: and you were there when I learnt that! :P https://gitter.im/nim-lang/Nim?at=5d20c3908193ce270f33af26
19:03:45shashlickanyone know if `koch docs` accepts --git.commit flag?
19:04:03disruptekkaushalmodi: yeah, that's the only reason i knew i could do this in the vm. ;-)
19:04:58shashlickokay 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:52Cea@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:11shashlickyou need to use cPlugin
19:20:18shashlickhttps://nimterop.github.io/nimterop/cimport.html
19:21:42shashlickstart with nimterop/templite.nim
19:21:48shashlickor 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:23FromGitter<awr1> is it possible to link to another proc in the same document with nim's doc gen
19:34:30FromGitter<awr1> from a doc comment
19:35:09*absolutejam joined #nim
19:35:45shashlickya, see https://github.com/nimterop/nimterop/blob/master/nimterop/cimport.nim#L178
19:35:48shashlickit isn't pretty
19:36:12FromGitter<awr1> hm thanks
19:36:56FromGitter<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:16narimiranyou can use [markdown](syntax) too
19:37:39FromGitter<awr1> wait really
19:37:43FromGitter<awr1> i didn't even know that
19:37:45FromGitter<awr1> i thought it was just rst
19:38:34FromGitter<awr1> that still doesn't solve the problem though
19:38:49*stefanos82 joined #nim
19:40:26FromGitter<awr1> ideally doc-to-doc links like that could show up a javascript tooltip too or something
19:41:10FromGitter<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:08Cea@shashlick Working through nimterop and it's translated most of the header but seems to be having issues this struct ```
19:58:16CeaUploaded file: https://uploads.kiwiirc.com/files/89598ccd15b401d91867833b9a5abffb/pasted.txt
19:59:32Ceawhen I run the header through it complains: `Error: undeclared identifier: 'JSCFunctionListEntry'`
20:04:34shashlick@Cea - ya it has nested union and struct
20:04:37shashlicknimterop doesn't support that
20:04:46shashlickeither try c2nImport() to see if c2nim works for you
20:04:59shashlickor use cOverride to manually define that symbol
20:05:16shashlicktho that is challenging since it refers to other symbols
20:05:34shashlickhttps://github.com/nimterop/nimterop/issues/133
20:08:44*bars0 quit (Quit: leaving)
20:10:15Ceac2nImport returns the same error as when I was originally using it: `Error: expected ';'`
20:17:07*vlad1777d quit (Ping timeout: 245 seconds)
20:17:21shashlickwhat specific line is it failing?
20:17:42shashlickcan you share your wrapper.nim, i can try
20:24:44federico3perhaps the compiler itself should build with hints:off
20:25:52*narimiran quit (Ping timeout: 245 seconds)
20:29:38Araqwhy?
20:31:03FromGitter<kaushalmodi> federico3: I am actually hoping the entire nim compilation to be warning-free at some point in future
20:34:00federico3Araq: it generates more than 10k lines of output. I doubt anyone reads the "Hint: .. [Processing]" messages
20:35:26shashlickso nim doc doesn't use --git.commit
20:35:59shashlickah it is not there in 0.19.6
20:47:54federico3(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:23Araqfederico3: ok, agreed but that means we should disable a set of hints
20:54:51federico3yep, e.g. the Processing ones
20:55:06federico3only in the nim.cfg file in the compiler repo
21:12:47Araq+1
21:14:00*sschwarzer joined #nim
21:15:03shashlickAraq: are you cool with generating Dash docset documentation for nim as part of devel travis?
21:15:38Araqmeh
21:16:20Araqonly if you feel like maintaining it
21:18:18Araqand 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:46sschwarzerI 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:53shashlickthere's already niv/nim-docset - all i need to do is run technosophos/dashing after running koch docs
21:19:11shashlickit's not mandatory to make it part of CI - manually generating isn't too bad
21:19:47Araqit's one more thing you have to watch out for, or even do manually
21:20:35shashlicki'll talk to niv and see if they are up to maintaining the docset, then it should be simple
21:20:41shashlickbut ya i agree i have too much going on
21:20:42Araqhow about this compromise: you enable it and if it becomes annoying you stop doing it ;-)
21:21:01shashlicki've not taken on lockfiles since i don't understand it well enough
21:21:43Araqas long as Nimble doesn't have lockfiles, it's hard to take it seriously
21:21:56Araqesp given how long it already exists
21:22:22AraqI mean, I personally don't mind. But I guess it's a general impression.
21:23:04disruptekone can generate nim using a macro and then render it as compilable text (ie. source) easily, right?
21:23:18Araqyes
21:23:28shashlick@disruptek - i do that in nimterop - see the cImport() proc
21:23:34FromGitter<alehander42> Isn't somebody already working on lockfiles
21:23:35shashlickmacros are super cool
21:23:39disrupteki just cannot understand why this api was written this way.
21:24:02disruptekit literally takes json as input and composes nim source as a string.
21:24:59Araqdisruptek: lol, that's something I learned the hard way.
21:25:03disrupteki'm not even sure i'd use a macro; i think it could be done with just a parser + side effects.
21:25:29Araqprogrammers do not understand trees or "correct by construction", they understand string concats
21:25:43Araqand they get them wrong. always.
21:25:50disrupteki'm complaining because i cannot be bothered to understand string concats.
21:26:01disruptekmaybe i should hang up my spurs.
21:28:39Araqstringly 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:49disrupteklol
21:29:32disruptekthe fact is that we address memory with the same ordinal we use to express the number of runes it holds.
21:29:51disruptekhow do you think it should work?
21:30:34disruptekyou are making up new types for memory addresses and memory sizes; what are the semantics?
21:30:52AraqI don't see how this follows.
21:30:55disruptekjust slice-based?
21:31:25AraqI 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:35disrupteki'm just curious how it could be done differently (read: better).
21:31:53Araqprovide a strongly typed API. The end.
21:33:22Araqthe 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:59disruptekyes, but building api the way it's currently done isn't scalable; it's expensive pretty much everywhere.
21:34:19disrupteki'd rather have the kernel basically be a database and let me query/memoize it.
21:35:15Araqoh not that again. "isn't scalable", does that actually mean anything anymore? nothing ever "scales".
21:35:50disrupteki 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:18Araqif it doesn't "scale", how come Posix is full of descriptions about which header files exist?
21:36:19disruptekas 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:52Araqas opposed to be able to throw out "/proc" again very easily? whom are you kidding...
21:37:28disrupteki'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:20disrupteki guess i should do this just to learn how. :-)
21:44:52federico3a kernel module that implements an alternative to procfs and sysfs is possible
21:46:26disruptekyeah, but i meant json->nim.
21:47:29clyybberdisruptek: Which api are you talking about?
21:48:44disruptekaws
21:49:46clyybberAh
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:54shashlickIf you are looking at json -> Nim then I hope it is generic and not just aws
22:02:01shashlickWhich is why I was suggesting swagger
22:02:31disrupteki 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:55disrupteki feel like the likelihood that swagger is replaced and a json version lives on is very high.
22:02:59shashlickIt's called openapi now
22:03:26shashlickIt is a json representation of the api
22:03:38shashlickWith a bunch of tools to convert to any target language
22:03:41disrupteki believe aws implements a superset, though.
22:04:18shashlickBut then your work is only useful for one company
22:04:30shashlickWhereas openapi has thousand others
22:05:16disruptekthat's great and all, but unless the input is the same, i care more about it working for aws.
22:07:36shashlickwhat do you mean by input
22:11:28disrupteki 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:32shashlickthat's the whole point of openapi
22:14:05disrupteki 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:04shashlickhttps://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen
22:15:16disruptekyeah, i'm inspecting the output now.
22:15:26shashlicksee all the nim competitors who are already supported
22:15:38shashlickunfortunately it is java
22:15:48disruptekyeah, i feel bad for them that they have to use those languages.
22:16:01disruptekoh well, what can you do?
22:18:02shashlickhttps://apis.guru/browse-apis/
22:18:39disruptekokay, i guess it will be swagger->nim.
22:18:45shashlickideally someone expands that codegen tool or standard openapi tools to generate
22:19:05shashlickbut i'd be okay if it were a pure nim tool that took any swagger API and generated a nim tool
22:19:19disruptekthat's the idea.
22:19:41disruptekthen araq will be satisfied and he can shutup about stringy types. :-P
22:19:52shashlicki'd think it should be easy with macros as well but the spec is not small
22:20:36disruptekmaybe macros for composition, but i'm not sure what else i'd use them for.
22:20:48clyybberAraq: When we assign nil to an owned ref, what should we do? Create a temporary?
22:20:53*UNIcodeX quit (Quit: Leaving)
22:22:02Araqclyybber: why?
22:22:32clyybberAraq: We cant deref NIM_NIL
22:22:54Araqwhy do we deref it?
22:23:12clyybberBecause owned params are treated like sink, and thus passed by reference
22:23:12Araqthe destructor checks for nil and turns into a nop, that's how moving works
22:23:47Araqyou can take the address of a stack slot that happens to contain NIM_NIL
22:24:05Araqthe owned ref itself always has an address
22:25:25clyybberYeah. So I need to generate a stack variable or temporary that contains NIM_NIL
22:25:38clyybbershould I do that in injectdestructors or the backend? WDYT?
22:26:46AraqI don't understand
22:26:54clyybberAraq: Sorry, I didnt mean deref NIM_NIL, but take its address
22:27:28clyybberCurrently, C backend generates eq_XXX(&someOwnedRef, (&NIM_NIL))
22:28:15Araqah!
22:28:33Araqyeah, you need a temp for that
22:28:36Araqsucks, I know
22:29:05Araqin fact, I fear this new "better" spec produces so terrible code that we're better off fixing the old =sink design
22:29:17Araqwe need benchmarks
22:29:33clyybberYeah
22:30:32clyybberAraq: So should I introduce the temporary in injectdestructors or the backend?
22:31:00Araqinjectdestructors and in fact, the spec mentions it
22:31:02*xet7 joined #nim
22:31:16Araq'nil' is quite like a function cal 'f()'
22:31:32Araqit produces a value, you cannot =move a value
22:32:33clyybberAraq: Yeah, that part IS implemented correctly.. The problem is not the =move call, its the `=` call.
22:32:51clyybberThe `=` call which sets the temporary to nil.
22:33:30*shomodj_ joined #nim
22:34:56Araqhuh? the prototype of '=' is (var T; T)
22:35:36clyybberAraq: Yeah, it IS, but when T is an owned ref type, the above occurs
22:36:27Araqouch
22:36:36*shomodj quit (Ping timeout: 258 seconds)
22:36:40Araqhow come this isn't a problem in devel...
22:36:53blackbeard420is there anything like runForever() that has a timeout?
22:37:20clyybberAraq: Because owned isn't passed by reference in devel?
22:37:38blackbeard420whoops, thers poll
22:38:07Araqah, right
22:43:00*theelous3 joined #nim
22:43:41clyybberAraq: I could fix it in injectdestructors by generating nkAsgn, or handle it in genCall of the C backend. What do you prefer?
22:44:32clyybbers/genCall/genArg
22:49:23AraqnkAsgn would be wrong
22:49:33Araqbut I dislike codegen patches
22:51:03Araqhow about this: for '=' the second arg is never a sink parameter
22:52:43*sschwarzer left #nim (#nim)
23:02:03clyybberHmm, ok that could work too. I'll try it tomorrow
23:02:07clyybbergn8
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