00:28:00 | FromDiscord_ | <treeform> dom96, thanks, I will try it out. |
00:45:23 | * | abm quit (Ping timeout: 268 seconds) |
01:03:20 | * | krux02 quit (Remote host closed the connection) |
01:15:35 | * | kapil____ joined #nim |
01:55:45 | * | vaios joined #nim |
01:56:05 | * | vaios left #nim (#nim) |
02:05:59 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
02:09:44 | * | vlad1777d quit (Ping timeout: 250 seconds) |
02:10:28 | * | zachk quit (Quit: Leaving) |
03:06:25 | * | PMunch quit (Remote host closed the connection) |
03:07:40 | * | banc quit (Quit: ZNC - http://znc.in) |
03:16:24 | * | nif quit (Ping timeout: 252 seconds) |
03:17:01 | * | nif joined #nim |
03:17:05 | * | flyx quit (Ping timeout: 268 seconds) |
03:18:36 | * | sknebel quit (Ping timeout: 252 seconds) |
03:20:10 | * | flyx joined #nim |
03:23:28 | * | banc joined #nim |
03:30:46 | * | sknebel joined #nim |
03:33:51 | * | dddddd quit (Remote host closed the connection) |
03:36:15 | FromGitter | <Varriount> @mratsim Maybe the implied calling convention of a procedure? |
03:38:02 | FromGitter | <Varriount> @mratsim https://github.com/nim-lang/Nim/blob/eb919c35b29afee8fb26a2145d88f4db9e6c332b/compiler/ast.nim#L109 |
04:22:29 | * | demond joined #nim |
04:22:38 | * | demond left #nim (#nim) |
04:31:03 | * | Jesin joined #nim |
04:32:53 | * | Jesin quit (Remote host closed the connection) |
04:54:24 | FromGitter | <AchalaSB> how to solve the issues. here is my code ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bfcce0097a8982b9a6ebcc6] |
04:59:39 | leorize | well, the issue is literally written in the error message... |
04:59:48 | leorize | have you `import os`? |
05:00:57 | leorize | also, you might want to fix your indentation |
05:06:43 | * | Jesin joined #nim |
05:06:59 | FromGitter | <AchalaSB> Yes. There is no error for indentation |
05:08:00 | leorize | ofc, but context wise, you should indent the for loop |
05:08:06 | FromGitter | <AchalaSB> The keyword `fileDir` and `path` etc are user defined for that Im getting error |
05:08:09 | leorize | it's currently outside of that proc with then indentation |
05:08:15 | leorize | that* |
05:11:04 | leorize | AchalaSB: the `for` loop and that `if` is outside of the proc |
05:11:18 | leorize | you have to indent it for it to be part of the proc |
05:11:22 | leorize | so it could access `path` |
05:11:44 | leorize | as of the functions, `import os` should be suffice |
05:12:45 | FromGitter | <AchalaSB> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bfcd24df59704348e0dd1b4] |
05:15:15 | FromGitter | <AchalaSB> Now Im getting indentation errors. and the previous errors are not solved. ⏎ another error ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bfcd2e3e25cc274054ce551] |
05:19:18 | leorize | please, indent them correctly |
05:19:28 | leorize | it should solve your problems |
05:25:55 | * | nsf joined #nim |
06:18:18 | * | nif quit (Ping timeout: 268 seconds) |
06:19:30 | * | nif joined #nim |
06:29:24 | * | nif quit (Ping timeout: 268 seconds) |
06:29:59 | * | nif joined #nim |
07:27:58 | FromGitter | <narimiran> @AchalaSB you can set up in your code editor that pressing Tab will indent your code X amount of spaces (for nim, X = 2), so you shouldn't have indentation problems anymore |
07:40:26 | * | jjido quit (Remote host closed the connection) |
07:44:13 | * | vqrs quit (Ping timeout: 245 seconds) |
07:52:59 | * | vqrs joined #nim |
08:06:00 | FromGitter | <gogolxdong> How to generate 4..18 size random bytes? |
08:12:00 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bfcfc507d26db1e8301d0c9] |
08:12:32 | FromGitter | <gogolxdong> Is this a good method? How about Windows? |
08:15:20 | Araq | import random |
08:15:30 | Araq | var s: seq[byte] = @[] |
08:15:55 | Araq | for i in 4..18: s.add byte(random([0..255])) |
08:17:52 | FromGitter | <gogolxdong> ah, yes, what I was thinking! |
08:23:12 | * | stefanos82 joined #nim |
08:32:15 | * | zakora joined #nim |
08:32:56 | * | krux02 joined #nim |
08:35:22 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bfd01caa115c91ef79d3c21] |
08:41:46 | FromGitter | <gogolxdong> Should randmize be used only once globally? |
08:42:52 | leorize | it should be used anytime you need to reseed the generator |
08:43:21 | leorize | but for most usecase related to it, yes, executing it once should be suffice |
08:43:43 | FromGitter | <gogolxdong> ok |
08:55:26 | * | nsf quit (Quit: WeeChat 2.3) |
08:56:21 | * | nsf joined #nim |
09:18:14 | * | leorize quit (Quit: WeeChat 2.2) |
09:36:10 | * | abm joined #nim |
09:42:52 | FromGitter | <mratsim> this reminds me of the threads with the OP getting unbelievable head or tails result with Nim random |
09:43:23 | FromGitter | <mratsim> it was because he was reseeding the PRNG just before rand, everytime. |
09:44:17 | * | dom96_w joined #nim |
09:57:27 | FromGitter | <alehander42> this is always confusing with random api-s :( |
10:03:57 | Araq | dunno how so, if it were (randomize(); random()) then why would randomize() even exist |
10:04:36 | * | ng0 joined #nim |
10:04:53 | Araq | the only logical conclusion is that randomize() usually needs to be called in a different scope |
10:05:00 | Araq | like "once at program startup" |
10:06:37 | * | dddddd joined #nim |
10:06:39 | FromGitter | <alehander42> yeah, but then people forget to call randomize at all |
10:07:07 | FromGitter | <alehander42> there must be something that forces them to either `randomize()` or `dontRandomize()` initially :D |
10:36:31 | * | floppydh joined #nim |
11:00:07 | * | Vladar joined #nim |
11:01:00 | FromGitter | <narimiran> that something is "we don't have to do it in python" |
11:04:23 | * | vlad1777d joined #nim |
11:06:43 | Araq | true but real systems programming languages (TM) require it explicitly |
11:10:34 | FromGitter | <narimiran> i have no problem with that, but i think "python way" is the reason for the behaviour @alehander42 mentions |
11:27:02 | serialdev[m] | Do you guys have any areas in which, there is a lack of good libraries / none in the Nim ecosystem atm? just wondering where you are seeing lacks to for example fully adopt Nim, also to guide what to work on on the side as I master the language |
11:28:05 | FromGitter | <bung87> there’s a repo for this https://github.com/nim-lang/needed-libraries |
11:28:52 | FromGitter | <narimiran> serialdev[m] i would like to see "one lib to rule them all" when it comes to plotting (think of it like a sane matplotlib with normal API) |
11:29:41 | Araq | serialdev[m], many are asking for good Qt wrappers |
11:29:49 | FromGitter | <narimiran> i know we have couple of small plotting libraries in nim, but none of them convinced me to use them. so i still switch back to python and MPL when i need to plot something |
11:30:37 | serialdev[m] | That is really nice! thanks guys, would interop with arraymancer be a must :P? |
11:30:42 | FromGitter | <alehander42> I think I've heard also requests for a better http lib, e.g. similar to python requests |
11:31:09 | FromGitter | <narimiran> nothing is a must ;) |
11:31:10 | Araq | plotting is something I think we should do without a wrapper |
11:31:26 | Araq | base it on putPixel and SDL2 |
11:31:40 | serialdev[m] | yeah python requests is really well made, I agree plotting could be a killer feature too |
11:31:40 | serialdev[m] | cross compiling plots can be so useful |
11:32:08 | FromGitter | <narimiran> scikit-learn clone would also be nice, but i doubt we'll see it (feel free to prove me wrong ;)) |
11:32:36 | serialdev[m] | putPixel and SDL2 sounds good!, I will eventually go for the machine learning stuff (its my day job) but atm wanna get really good at nim first |
11:33:54 | FromGitter | <bung87> something like tensorflow also is a good target. |
11:34:10 | Araq | it's what I did with Python back then fwiw |
11:34:40 | Araq | I threw away my matplotlib code and wrote my own charts renderer with putPixel |
11:34:45 | FromGitter | <narimiran> @bung87 i think @mratsim has some big plans with Arraymancer :) |
11:34:57 | serialdev[m] | yeah I'm awaiting the arraymancer hdf5 pull request atm to see if we can use Nim to target embedded systems |
11:35:11 | serialdev[m] | and just convert keras-2-nim |
11:35:17 | FromGitter | <bung87> @narimiran that’s cool! |
11:36:18 | FromGitter | <narimiran> regarding plotting: as i said, there are lots of small plotting libraries, people scratched their own itch i guess. but if we want "one big plotting lib", it should be a group effort, not a single man project |
11:36:50 | serialdev[m] | should we start one then? and settle on SDL2 + putPixel? |
11:37:34 | FromGitter | <narimiran> i would like to hear more opinions before settling on anything ;) |
11:38:20 | serialdev[m] | which one would be the best way to target both C and Wasm/js |
11:38:34 | FromGitter | <mratsim> nim-plotly |
11:38:38 | serialdev[m] | then worry about other targets I think cause we basically cover ground with that |
11:38:58 | FromGitter | <mratsim> I’ve also started a quick proof of concept using Vega here: https://github.com/numforge/monocle |
11:39:27 | FromGitter | <mratsim> And link to nim-plotly: https://github.com/brentp/nim-plotly |
11:39:43 | FromGitter | <mratsim> the hdf5 PR was merged normally |
11:39:53 | FromGitter | <narimiran> btw, i've recently discovered Plotnine — it is based on the famous ggplot2. i haven't used it yet, but it looks good: https://plotnine.readthedocs.io/en/stable/ |
11:41:49 | serialdev[m] | these ones are nice, but should we target some sort of "native" nim libs aswell? since depending on another can become a hassle |
11:42:30 | FromGitter | <mratsim> In monocle I’m embedding Vega. |
11:42:53 | FromGitter | <mratsim> see here: https://github.com/numforge/monocle/tree/master/src/monocle/vega |
11:43:49 | FromGitter | <xmonader> is there a way to access variables in `try` block in the `execpt` block instead of declaring them before the try block? |
11:43:53 | FromGitter | <mratsim> Idem for display, I’m using the native webview on all platforms (and no it’s not Electron) |
11:44:25 | FromGitter | <mratsim> I’m using this to bind the webview: https://github.com/zserge/webview |
11:44:51 | FromGitter | <mratsim> so it’s super tiny, it’s just a 2k lines header. |
11:46:22 | FromGitter | <mratsim> but I didn’t work on it in the past 2 months because I don’t like JS and frontend and I got busy with low-level optimizations :D |
11:47:44 | FromGitter | <narimiran> classic Mamy :) |
11:48:24 | FromGitter | <narimiran> btw @mratsim, I would subscribe to your posts/thoughts/snippets, if you offered such a thing! |
11:48:43 | FromGitter | <mratsim> me too :P |
11:48:53 | FromGitter | <narimiran> lol |
11:49:40 | FromGitter | <mratsim> Here is one that can be a blog post, I think caching JIT code fragment is a similar problem to dynamic vs static framework in machine learning: https://github.com/mratsim/jitterland/blob/master/jit/jit_datatypes.nim#L90 |
11:52:23 | serialdev[m] | loop fusion could be a really interesting one too! |
11:53:32 | FromGitter | <mratsim> done here: https://github.com/numforge/laser/blob/master/benchmarks/loop_iteration/iter_bench_prod.nim#L87-L90 |
11:54:10 | FromGitter | <alehander42> while implementing `[]=` for distinct seq, I can't typecheck ` castseq[T (b)[c.int] = e` |
11:54:26 | FromGitter | <alehander42> what is the correct way to do that |
11:54:34 | FromGitter | <mratsim> There is also an advanced example with loopfusion for parallel reduction here: https://github.com/numforge/laser/blob/master/examples/ex05_tensor_parallel_reduction.nim |
11:55:30 | serialdev[m] | Thanks! that will be fun to work through |
11:55:32 | FromGitter | <mratsim> but yeah lots of stuff to document. btw Laser will be the future backend of Arraymancer |
11:55:55 | FromGitter | <narimiran> @mratsim make that one a proper blog post, please |
11:56:11 | FromGitter | <alehander42> yep, we need more blog posts |
11:56:14 | FromGitter | <mratsim> As a highlight, I reach OpenBLAS speed with pure Nim: https://github.com/numforge/laser/blob/master/benchmarks/gemm/gemm_bench_float64.nim#L201-L255 |
11:56:19 | FromGitter | <narimiran> (jitterland) |
11:56:48 | FromGitter | <mratsim> so in the future I will fuse neural net operations like relu/tanh/sigmoid into the matrix multiplication |
11:57:14 | FromGitter | <mratsim> to gain 1.5 to 2x speed by avoiding to loop again for NN activations |
11:57:38 | serialdev[m] | That will be super nice!, specially in constrained systems |
11:57:50 | FromGitter | <mratsim> and I will also fuse the im2col reshaping for convolution into the matrix multiplication call |
11:58:12 | serialdev[m] | so computer vision killer features for nim there |
11:58:41 | FromGitter | <mratsim> another good read by the way, fast convolutions research: https://github.com/numforge/laser/blob/master/research/convolution_optimisation_resources.md |
11:59:56 | serialdev[m] | How do you have the time! also this is amazing work :) |
12:00:43 | FromGitter | <mratsim> Good read as well, with Intel engineers participation: fast recurrent neural net: https://github.com/mratsim/Arraymancer/issues/228 |
12:01:45 | * | rockcavera quit (Read error: Connection reset by peer) |
12:04:11 | serialdev[m] | optimizing rnns would be great , since most people are actively avoiding them atm due to the high cost |
12:09:31 | FromGitter | <mratsim> It can be fast but, it can’t compare to convolution speed I think. I’ll see when I revamp the backend. |
12:09:45 | * | rockcavera joined #nim |
12:14:23 | serialdev[m] | Thanks for the links btw :) |
12:17:42 | FromGitter | <narimiran> btw, for those of you who weren't here last night — great opportunity to practice your nim skills and have loads of fun: Advent of Code https://nim-lang.org/blog/2018/11/26/advent-of-nim.html |
12:23:37 | FromGitter | <mratsim> the fastest = someone who wakes up at 5am UTC :P |
12:27:07 | FromGitter | <narimiran> yup, been there done that. can recommend, will do it again :D |
12:28:58 | FromGitter | <narimiran> it would be really nice if some of us would make it to global leaderboard (it is highly competitive and people are very fast). it would be a prove that in nim, although it is compiled, you can be as fast as people in scripting languages |
12:29:52 | FromGitter | <alehander42> i think it's really just a matter of popularity: if you have 100x people in lang X, it's probable that more of them would be up there |
12:31:00 | FromGitter | <narimiran> so, let's increase number of nim people participating ;) |
12:38:30 | * | sknebel quit (Ping timeout: 250 seconds) |
12:46:51 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:47:42 | * | dom96_w joined #nim |
12:50:48 | * | Snircle joined #nim |
12:53:07 | serialdev[m] | mratsim you might find this library interesting, I was evaluating it before settling on arraymancer https://github.com/marcoheisig/Petalisp (it is in lisp) kinda covers the same ground and might have some interesting attributes. |
13:01:46 | * | sknebel joined #nim |
13:39:21 | * | PMunch joined #nim |
13:43:06 | FromGitter | <mratsim> you need to tag gitter people with @ before their name ;) and thanks |
13:46:20 | FromGitter | <mratsim> Yeah it’s exactly the same scope as Laser. Being a building block for high performance computing high level library similar to Numpy |
13:46:57 | FromGitter | <mratsim> I can’t really read lisp though :P |
14:00:50 | * | sknebel quit (Ping timeout: 250 seconds) |
14:02:39 | * | sknebel joined #nim |
14:05:06 | * | leorize joined #nim |
14:26:39 | * | vlad1777d quit (Ping timeout: 246 seconds) |
14:44:15 | * | leorize quit (Quit: WeeChat 2.2) |
14:44:25 | * | leorize joined #nim |
14:44:37 | * | Vladar quit (Remote host closed the connection) |
14:57:11 | shashlick | is it possible to have multiple of same argument with cligen - e.g. -I with gcc can be done multiple times |
14:58:16 | Araq | shashlick, read my remark on github? |
15:01:48 | shashlick | yes Araq - was going to respond but good to discuss here |
15:02:13 | shashlick | so first, nimgen runs most wrapper headers thru gcc -E to resolve all preprocessor declarations |
15:02:49 | shashlick | so running on the user's system is useful since all platform specific stuff gets done that way |
15:03:14 | shashlick | second, most nimgen wrappers compile in the source rather than using dynlib so i need more than just the headers |
15:03:34 | shashlick | so what nimgen does is clones the repo (sparse checkout usually of essential files) as the first step |
15:04:00 | shashlick | you can now pin to a commit/tag so that can be fixed and updated when needed so I don't need to check in headers into the wrapper repo |
15:05:21 | PMunch | Araq, I have two issues with nimlsp. First, how should the user specify where the "nimsuggest.nim" file is? I guess this could be done with a -d:nimsuggestpath switch but does that work with Nimble? Second is that nimsuggest needs to find the Nim source files, which fails for nimlsp but works for nimsuggest (because of how findExe works, I think). |
15:08:25 | Araq | shashlick, well that's why c2nim translates #define, after the preprocessing step, you have already lost |
15:09:08 | Araq | PMunch, why does it matter where nimsuggest.nim is? nimlsp.exe should be next to nim.exe |
15:10:19 | shashlick | Araq: what's the value in us preprocessing which is mostly used for platform specific stuff when the compiler already does all that for us |
15:10:31 | shashlick | makes the code specific to the user's system |
15:10:39 | Araq | but that's wrong, it's usually not platform specific |
15:10:52 | PMunch | Because with the PR I created nimlsp can now import nimsuggest.nim instead of calling it as a program on run-time |
15:10:52 | Araq | *after* the preprocessor it's platform specific |
15:10:59 | PMunch | So it needs nimsuggest.nim to import it |
15:11:32 | shashlick | but then you want c2nim or equivalent to go through all defines and only convert procs/structs that are relevant to the platform |
15:11:42 | shashlick | why do that when the preprocessor already does that for you |
15:12:41 | Araq | no, you want c2nim to translate an #ifdef to a 'when defined' |
15:13:16 | shashlick | just try "gcc -E -dM -xc /dev/null" - there's over 350 default defines on my ubuntu system |
15:13:26 | Araq | the preprocessor throws away precious information |
15:13:56 | Araq | and stuff in /usr/include is not representative for C libs that are supposed to be wrapped for other PLs |
15:16:43 | leorize | PMunch: you could use git submodule to fetch Nim's source |
15:16:52 | PMunch | Hmm, I guess that's true.. |
15:17:03 | leorize | or you could just create a nimble package out of nimsuggest |
15:17:10 | PMunch | That's probably the "rightest" way to compile it |
15:17:32 | shashlick | Araq: ok lets use an example - https://github.com/vurtun/nuklear/blob/master/src/nuklear.h |
15:17:49 | shashlick | how much of that ifdef stuff is relevant to the nim wrapper that needs to be generated? |
15:17:52 | PMunch | Well it already is a nimble package |
15:18:04 | PMunch | But it's old and only meant for issue tracking |
15:18:11 | PMunch | Old as in 0.15.2 old |
15:18:22 | leorize | well, maybe you could now patch it up? |
15:18:35 | leorize | nimble package can be within a subfolder, no? |
15:19:42 | shashlick | Araq: your idea is interesting but that means we need to convert all this into Nim when most of it is irrelevant |
15:20:24 | shashlick | and the only benefit is to have a generic nim file that is done up front rather than generating a specific nim file on the user's machine |
15:20:36 | leorize | isn't that the point of c2nim? |
15:22:43 | shashlick | leorize: related to https://github.com/nim-lang/Nim/issues/8327 - more about how to architect and maintain wrappers |
15:23:46 | Araq | shashlick, "the only benefit"? sorry, but that's how every wrapper was created without nimgen |
15:23:59 | Araq | and I argued before that it is a tremendous benefit |
15:24:39 | Araq | because then you have Nim code that is only subject to Nim compiler versioning problems |
15:25:41 | * | Araq is looking at nuklear.h |
15:27:49 | shashlick | http://nimgen.genotrance.com/nimnuklear/nuklear.nim.html is what nimgen+c2nim generate after running on Windows |
15:27:59 | shashlick | after running it thru gcc -E |
15:28:46 | shashlick | that is a snapshot which a user gets when he runs it on his machine - i don't have to maintain this output, i maintain the process |
15:29:24 | shashlick | and the tools are built in nim, no depending on anything so it is not like yak and cmake and such |
15:29:25 | Araq | "after running it thru gcc -E" <-- that is AGAINST c2nim's design |
15:30:06 | Araq | what you should do instead is to wrap the stuff you don't need in an #ifndef C2NIM #endif section, for example |
15:31:34 | shashlick | if you run c2nim on nuklear.h directly, it dies on line 37 - it does not handle preprocessor stuff today |
15:31:43 | * | Trustable joined #nim |
15:34:54 | shashlick | let me ask this differently - and maybe I missed something you said earlier - while I agree it is more valuable to generate a generic Nim wrapper, it is tedious since neither c2nim nor nimterop understand the preprocessor and the crazy ways people have used it |
15:35:13 | shashlick | i already have to deal with the actual C/C++ code and ensure it is wrapped correctly and works with Nim |
15:35:52 | shashlick | what is the value in investing a lot of time on the preprocessor rather than leveraging existing tools and bringing more libraries into the Nim ecosystem |
15:36:33 | shashlick | each user can still checkin the resulting wrapper |
15:41:44 | shashlick | just like you would expect the user to download a dll or support files or whatever and maintain that as part of his build environment |
15:43:26 | shashlick | again, i'm talking as a package maintainer, not a user of the package. I have my pragmatic hat on - the one that thinks having more libraries makes Nim easier to build with |
15:44:01 | shashlick | but if this approach is unusable as a user then I'd like to know why |
15:49:33 | Araq | c2nim understands the preprocessor |
15:49:54 | Araq | but you have to translate the #define into a #def |
15:50:20 | Araq | a #define for c2nim is always something it tries to convert into either a const or a template |
15:50:34 | Araq | a #def is a directive for c2nim's builtin preprocessor |
15:50:50 | * | narimiran joined #nim |
15:54:17 | PMunch | leorize, yeah I guess there could exist a nimsuggest.nimble alongside compiler.nimble in the root of the repo and that would install the nimsuggest folder.. |
15:54:52 | shashlick | well a file like nuklear.h has 120 lines with a #define in it, some of which should be changed to #def and others left alone |
15:56:12 | shashlick | that works if i love nukear.h enough to sit and hand examine and edit it and then check in my copy and leave it like that until i'm motivated enough to do it again |
15:56:34 | shashlick | its hard to automate and keep compatible with nuklear as it evolves |
15:58:37 | shashlick | I understand that's how it has been with existing Nim wrappers that have been created since the user was doing it and found it worth it for their application |
15:59:27 | shashlick | it does not scale when I want to bring 200 wrappers into the ecosystem |
15:59:42 | PMunch | leorize, oops maybe not: Error: Only one .nimble file should be present in /home/peter/Projects/Nim |
16:00:35 | shashlick | but again, my motivation is to build wrappers quickly and maintain indefinitely - if they are useless then I will obviously reassess 🙂 |
16:02:37 | shashlick | for example, I wrapped all of tree-sitter in a couple days and built nimterop on top of that - you should be able to nimble install https://.../nimterop and it will just work - i think there's value in that but i'm very open to adjusting if there's deficiencies |
16:07:57 | Araq | https://github.com/curl/curl/blob/master/include/curl/curl.h |
16:08:04 | Araq | #define CURL_HTTPPOST_PTRBUFFER (1<<5) |
16:08:12 | Araq | ^ do you get this const with your approach? |
16:09:32 | shashlick | right now, I only look for "#define XXXY int|float|hex" but it is a poor method since it does not handle ifdefs |
16:09:50 | shashlick | but @timotheecour found a way to get #defines in the preprocessor output |
16:10:10 | shashlick | using "gcc -E -dD" you get hte preprocessed output as well as resulting #defines |
16:10:21 | shashlick | i'm investigating that to get better results than what nimgen does today |
16:10:25 | Araq | as I said, you don't have to re-do it all over again if a new header file version arrives |
16:11:13 | Araq | "gcc -E -dD" is just as wrong, it assumes e.g. LINUX is defined and expands the macros correspondingly |
16:11:52 | shashlick | it seems to work fine on Windows mingw so far but i'll look into it |
16:12:47 | Araq | well I'm not saying your approach doesn't work, I'm saying it will bitrot much more quickly than the old approach |
16:14:26 | Araq | and if you lack a good solution for the #define problem, I don't see the benefits over c2nim |
16:15:00 | shashlick | so i have had 25 wrappers being tested daily and only one wrapper failed in the last year due to some file rearchitecting of fastText - was a 5 minute fix |
16:15:22 | shashlick | it is an ongoing effort so I hope to improve it |
16:15:31 | shashlick | will approach -dD with reservations |
16:16:25 | Araq | yeah but that was by fixed by you |
16:16:53 | Araq | would I have been able to fix a failing 'nimble install foo'? |
16:17:05 | Araq | (assuming nimble install does the nimgen dance) |
16:18:38 | Araq | and how do I install the win32 version of the foo wrapper when I'm on Linux? |
16:19:43 | Araq | generated platform specific wrappers are not good. In ordinary Nim code I can do 'nim check --os:linux --cpu:i386 stuff.nim' on a Windows machine |
16:19:45 | shashlick | you are far smarter than me - I'll bet you could fix it! |
16:20:02 | shashlick | https://github.com/genotrance/nimfastText/commit/c1c7f6e61f2c233f0426ac120e32ba8ea37402cb is the commit change for nimfastText and half of it was cleanup - only new thing was meter.nim |
16:20:10 | shashlick | yes - nimble install does the nimgen dance |
16:20:47 | shashlick | you cannot install the windows version on linux since I rely on the preprocessor so yes that use case isn't possible with this approach |
16:21:12 | shashlick | but that's why I use Nim and not C/C++ |
16:22:01 | shashlick | actually, if you install mingw on linux and use that preprocessor, it will generate Windows wrappers |
16:22:10 | shashlick | since all defines will be windows specific |
16:22:34 | Araq | well your changes to nimfastText.cfg are black magic to me |
16:22:46 | Araq | and yes, I'm sure I can figure it out. eventually. |
16:23:03 | Araq | but here is what I usually do instead. |
16:23:07 | Araq | 'brew install foobar' |
16:23:16 | Araq | --> shitty error message |
16:23:37 | * | Araq curses every package manager and uses something else. |
16:24:13 | shashlick | so i hope you try one of the nimgen wrappers and see how it works for you |
16:24:20 | Araq | ok |
16:24:24 | shashlick | and perhaps use nimgen to wrap something in the future and see what you think |
16:24:37 | Araq | give me 5 "nimble install" commands please |
16:26:11 | shashlick | https://docs.google.com/spreadsheets/d/1sM1TE6Cp8owVU1NxYyKd_0rhJCS2YbHorzhDVAoxxk4/edit#gid=0 - that's a list of all nimgen wrappers so far |
16:26:46 | shashlick | anything of interest to you, if it is in the nimble directory, you can `nimble install X` and it should work |
16:26:57 | Araq | nimble install nimfastText |
16:27:03 | Araq | Error: Package not found. |
16:27:16 | shashlick | its not in the nimble directory yet |
16:27:32 | shashlick | nimble install https://github.com/genotrance/nimfastText |
16:27:39 | shashlick | fingers crossed 😄 |
16:27:53 | shashlick | you had to pick the most painful one didn't you! |
16:28:07 | shashlick | https://github.com/genotrance/nimfastText/blob/master/tests/tnimfastText.nim is a test example |
16:28:20 | Araq | https://gist.github.com/Araq/876d2c5255eff71fe3dae53b3e323d19 |
16:30:06 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
16:30:08 | Araq | I'm adding comments to this gist |
16:30:51 | shashlick | weird - that's not my package - it is something else |
16:31:38 | Araq | Success: nimgen installed successfully. |
16:31:39 | Araq | Der Befehl "nimgen" ist entweder falsch geschrieben oder |
16:31:39 | Araq | konnte nicht gefunden werden. |
16:31:50 | Araq | which means "could not find nimgen" |
16:32:08 | shashlick | is ~/.nimble/bin in your path? |
16:33:48 | shashlick | looks like I never added nimfuzz to the nimble directory - probably because there was a name conflict and i forgot |
16:33:57 | Araq | it wasn't, so ok, error on my part. |
16:34:08 | * | Vladar joined #nim |
16:34:43 | Araq | nimfuzz remains broken though |
16:35:15 | shashlick | yes - like I said, nimfuzz is another package, not the one I am maintaining - will have to post on nimble with another name |
16:35:23 | shashlick | i've added it to my tracker |
16:35:48 | Araq | nimble install nim7z |
16:35:51 | Araq | works. |
16:36:14 | Araq | so ... congrats. |
16:36:19 | shashlick | whew! |
16:36:21 | Araq | for now. :P |
16:36:52 | Araq | but it's a complex setup so the chances are higher it will break |
16:37:11 | shashlick | i agree - that's why i have both appveyor and travis daily builds running |
16:37:23 | shashlick | 0.18.0, 0.19.0 and devel across win/lin/osx |
16:37:26 | Araq | whereas with the old appraoch you at least have some outdated Nim code you can fix |
16:38:16 | Araq | nevertheless it seems to work well enough that I'll shut up now. |
16:38:28 | shashlick | but see nuklear-nim - it was built 2 years ago and no updates since |
16:39:04 | shashlick | and nuklear has evolved quite a bit since then |
16:40:41 | shashlick | anyway, is it safe to say that your primary concern is that the nimgen approach is more fragile than what you have had so far? |
16:44:42 | shashlick | I attempt to alleviate that with a wide CI test matrix |
16:45:11 | shashlick | other feedback I got was - #defines are still primitive/kludgy, needs re-eval |
16:45:25 | leorize | is there any approach that doesn't end up with a CI matrix? :P |
16:45:57 | shashlick | reproducible builds - we don't have that yet, need to highlight that end user should save the generated wrapper |
16:46:34 | shashlick | cross compilation - have a solution for Windows on Linux, but not the other way around |
16:46:42 | shashlick | anything else, please let me know |
16:47:14 | leorize | reproducible builds is unlikely with nimgen I think |
16:48:16 | shashlick | well - nimgen now allows locking upstream to a particular commit/tag so you can fix that |
16:48:38 | leorize | if we could build upon libclang, it can be a decent C -> Nim compiler with all the customization that one could hope for |
16:48:45 | shashlick | i haven't done that for any wrappers so far though |
16:48:50 | shashlick | next is to checkout a particular wrapper commit which is possible with nimble already |
16:49:12 | shashlick | beyond that, user needs to fix their OS, C and Nim compilers |
16:49:48 | shashlick | leorize: I looked into libclang - it is a huge dependency so i've been building on tree-sitter instead |
16:50:06 | shashlick | if I could assume clang is always available, it would be altogether different |
16:50:07 | leorize | yea, but libclang is rather reliable |
16:50:17 | leorize | and capable of parsing any kind of C code you throw at it |
16:51:18 | shashlick | no doubt - if Nim standardizes on clang across all OS, would work for me |
16:51:47 | leorize | libclang and friends can be installed quite easily on every os |
16:52:41 | leorize | the bad thing about libclang is that the ABI breaks ever so frequent |
16:53:22 | shashlick | yes but compare a 250MB clang download vs. a 4mb binary that can be built and installed seamlessly via nimble |
16:55:30 | shashlick | works better for the nimgen model anyway but as you can see, I'm quite committed to that idea 😄 |
16:56:01 | shashlick | anyway, nimterop is still a POC but does look promising |
16:56:47 | shashlick | reality is when end users actually try it out its output |
17:04:06 | * | narimiran quit (Remote host closed the connection) |
17:11:50 | * | nsf quit (Quit: WeeChat 2.3) |
17:20:44 | Araq | > anyway, is it safe to say that your primary concern is that the nimgen approach is more fragile than what you have had so far? |
17:21:05 | Araq | more fragile, yes. also... "more stuff to learn". for me at least. |
17:22:04 | Araq | plus I think Nim programmers enjoy reading Nim code moreso than a complex setup that produces Nim code. |
17:22:28 | Araq | we did the same with Nimscript vs nim.cfg. "Nim all the things!" |
17:24:06 | * | dom96_w quit (Changing host) |
17:24:06 | * | dom96_w joined #nim |
17:25:35 | dom96_w | I'm guessing this is possibly what you guys are discussing, but now that I'm seeing nimgen discussed here I wonder: why not just turn nimgen into a CLI app? |
17:25:55 | leorize | then wouldn't it become c2nim? |
17:26:14 | dom96_w | It would be a wrapper on top of c2nim |
17:26:23 | shashlick | nimgen already has a CLI interface |
17:26:29 | shashlick | it isn't as capable as the cfg file though |
17:26:40 | dom96_w | I do agree with Araq's sentiment that the wrapper Nim code should be committed |
17:27:25 | dom96_w | as cool as it is that nimgen runs during a Nimble package's install process it makes me really nervous :) |
17:27:44 | dom96_w | And I don't see much upside over just running `nimgen` before committing. |
17:28:22 | Araq | dom96_w, you can't run nimgen before committing because you would need to run it for ever OS/CPU combination |
17:28:29 | leorize | nimgen currently generates tailored wrapper |
17:28:42 | shashlick | Araq: you don't need to look at the cfg file as a user - just the generated nim code which is documented |
17:28:58 | dom96_w | Araq: Why? Why doesn't nimgen generate `when` statements for that? |
17:29:02 | shashlick | e.g. http://nimgen.genotrance.com/nimnuklear/ |
17:29:12 | Araq | dom96_w, it doesn't, that's what I've been complaining about |
17:29:39 | shashlick | dom96_w: it runs the preprocessor on the user's system during nimble install prior to generating the wrapper |
17:29:49 | shashlick | so you get user specific wrappers at install time |
17:31:06 | dom96_w | I think you should consider implementing support for generating a single wrapper for all platforms |
17:31:42 | leorize | then it would be c2nim lol |
17:32:32 | shashlick | what is the benefit really? it is a huge effort to ensure that the preprocessor is correctly interpreted without the preprocessor |
17:33:17 | leorize | if you play around with gcc specs, you can configure default definitions however you want |
17:33:26 | shashlick | note that nimgen only automates the wrapper process - it still leverages c2nim thru and thru |
17:34:01 | shashlick | if you want c2nim to process the #defines correctly, you need to make a bunch of edits - change #defines to #def, use #ifndef C2NIM and stuff |
17:34:24 | shashlick | the preprocessor already does all that for you, why recreate it when what you really want is reproducible builds |
17:50:23 | * | leorize quit (Quit: WeeChat 2.2) |
17:54:14 | Araq | because #define is also used to declare constants and macros that belong to the very API you're trying to wrap. |
17:54:40 | Araq | and c2nim has lots of options to mitigate this pain anyway. or more stuff could be added for it |
17:56:19 | shashlick | like I mentioned, I do pull those out in nimgen today and am exploring using gcc -dD |
17:57:13 | Araq | well I answered your question |
17:58:27 | shashlick | so net - if we can get reliable installs, relevant #defines converted to consts, along with reproducible builds, will we meet the basic requirements? |
18:16:14 | Araq | yes, I think that covers all concerns |
18:16:38 | PMunch | dom96_w, did you use a library when you created your snake game? |
18:16:52 | dom96_w | For which part? |
18:17:21 | shashlick | Araq: okay thanks - will aspire for that goal. i think I have reliable installs mostly. other two are WIP |
18:17:27 | PMunch | For the rendering and game loop stuff |
18:17:36 | dom96_w | I wrote my own |
18:17:41 | dom96_w | it's called gamelight |
18:17:56 | Araq | shashlick, yeah, I agree. No rush. |
18:18:32 | Araq | and I'll continue to add features to c2nim :P I like its code base. ;-) |
18:18:51 | PMunch | Ah the classic optimism of a new project "[...] But hopefully with time it will be polished." - 2 years ago :P |
18:19:03 | Araq | I always thought we can do away with the #def vs #define distinction by some clever heuristic |
18:19:09 | shashlick | ok thanks for all the feedback |
18:19:11 | dom96_w | PMunch: Did you answer my question in #nim-offtopic? (Can't check myself because I don't have access to my BNC) |
18:19:25 | PMunch | About where my talk was? |
18:19:35 | * | literal joined #nim |
18:19:36 | PMunch | I didn't quite understand what you asked :P |
18:19:37 | shashlick | i think -dD is working well in my limited tests |
18:19:56 | shashlick | Araq: what i do need is help with fixing all the c2nim issues I've opened over the years |
18:20:00 | * | theelous3_ joined #nim |
18:20:03 | dom96_w | PMunch: someone told me you're giving a lightning talk at FOSDEM |
18:20:11 | dom96_w | (About Nim) |
18:20:36 | PMunch | Well I've submitted it, but they aren't announcing the accepted talks until December 15th |
18:20:49 | dom96_w | Ahh, which devroom? |
18:21:00 | PMunch | Lighting talks don't need a dev room |
18:21:08 | PMunch | They are held in the main auditorium |
18:21:10 | dom96_w | oh. |
18:21:24 | PMunch | "Lighting talks are short — 15 minute long — talks on a wide variety of topics. Anyone who has something interesting to say about an open source or free software topic can apply. We particularly encourage topics that do not fit in any of the developer rooms." |
18:21:32 | FromGitter | <arnetheduck> Araq, shashlick, the first of you that generates a faithful conversion of llvm-c's headers wins a beer from me :) |
18:21:46 | dom96_w | Cool. Pretty sure I've seen some devrooms that have lightning talks too |
18:22:00 | PMunch | Oh yeah probably |
18:22:12 | PMunch | The devrooms are pretty free to make their own program |
18:23:17 | PMunch | It would be cool to organise a "Small languages" or just "Language design" devroom, that could feature some longer talks on a variety of languages |
18:23:39 | PMunch | Went to some of the Ada talks last year it was really interesting |
18:23:54 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:24:31 | shashlick | @arnetheduck: challenge accepted 😄 |
18:26:32 | shashlick | at least the enums seem ordered! |
18:35:22 | * | nsf joined #nim |
18:47:35 | FromGitter | <arnetheduck> wait until you get to the part where they use `#defines` to generate function signatures.. like the ugliest code of nim macro maximalists: public function prototypes generated using macros - totally useless.. oh, and some enums are flags actually, with some enum values being combinations of previous enums (as Araq has pointed out, semantically c enum == nim int, or maybe nim `uint` - in `c` an enum is an integer |
18:47:36 | FromGitter | ... unspecified size that varies between compilers) |
18:50:28 | * | PMunch quit (Remote host closed the connection) |
18:53:56 | * | bitstoppa[m] quit (Remote host closed the connection) |
18:53:56 | * | xomachine[m] quit (Remote host closed the connection) |
18:53:58 | * | petersjt014[m] quit (Remote host closed the connection) |
18:53:59 | * | notbot[m] quit (Remote host closed the connection) |
18:54:01 | * | MrAxilus[m] quit (Write error: Connection reset by peer) |
18:54:02 | * | Demos[m] quit (Write error: Connection reset by peer) |
18:54:05 | * | stisa[m] quit (Remote host closed the connection) |
18:54:05 | * | serialdev[m] quit (Read error: Connection reset by peer) |
18:54:05 | * | zielmicha[m] quit (Read error: Connection reset by peer) |
18:54:05 | * | hohlerde quit (Read error: Connection reset by peer) |
18:54:05 | * | zacharycarter[m] quit (Read error: Connection reset by peer) |
18:54:06 | * | yglukhov[m] quit (Read error: Connection reset by peer) |
18:54:08 | * | syntonym[m] quit (Remote host closed the connection) |
18:54:08 | * | toofly[m] quit (Remote host closed the connection) |
18:54:08 | * | spymasterd[m] quit (Remote host closed the connection) |
18:54:08 | * | blarghz[m] quit (Remote host closed the connection) |
18:54:08 | * | Miguelngel[m] quit (Remote host closed the connection) |
18:54:10 | * | GitterIntegratio quit (Read error: Connection reset by peer) |
18:54:11 | * | gh0st[m] quit (Remote host closed the connection) |
18:54:11 | * | jaens[m] quit (Remote host closed the connection) |
18:54:11 | * | narimiran[m] quit (Remote host closed the connection) |
18:54:11 | * | TheManiac[m] quit (Remote host closed the connection) |
18:54:12 | * | sg-james[m] quit (Read error: Connection reset by peer) |
18:54:12 | * | k0mpjut0r quit (Read error: Connection reset by peer) |
18:54:12 | * | dyce[m] quit (Read error: Connection reset by peer) |
18:54:12 | * | Connor[m] quit (Write error: Connection reset by peer) |
18:54:13 | * | sendell[m] quit (Remote host closed the connection) |
18:54:14 | * | xylef quit (Write error: Connection reset by peer) |
18:54:14 | * | pqflx3[m] quit (Remote host closed the connection) |
18:54:14 | * | exothermic[m] quit (Remote host closed the connection) |
18:54:14 | * | endes[m] quit (Remote host closed the connection) |
18:54:15 | * | monofuel[m] quit (Remote host closed the connection) |
18:54:15 | * | macsek1911[m] quit (Remote host closed the connection) |
18:54:17 | * | ArchieT[m] quit (Remote host closed the connection) |
18:54:17 | * | planetis[m] quit (Read error: Connection reset by peer) |
18:54:18 | * | codevance[m] quit (Remote host closed the connection) |
18:54:18 | * | TheKing[m] quit (Remote host closed the connection) |
18:55:23 | shashlick | Gee thanks for bursting my bubble! |
18:56:08 | shashlick | Yes I have nothing yet for #define function signatures |
18:56:54 | shashlick | But am yet to try the distinct int method for enums |
19:02:59 | * | floppydh quit (Quit: WeeChat 2.3) |
19:11:51 | * | dyce[m] joined #nim |
19:14:23 | * | Trustable quit (Remote host closed the connection) |
19:22:58 | * | Connor[m] joined #nim |
19:22:58 | * | codevance[m] joined #nim |
19:22:58 | * | Demos[m] joined #nim |
19:22:58 | * | TheKing[m] joined #nim |
19:22:58 | * | xylef joined #nim |
19:22:59 | * | ArchieT[m] joined #nim |
19:22:59 | * | GitterIntegratio joined #nim |
19:22:59 | * | sendell[m] joined #nim |
19:22:59 | * | gh0st[m] joined #nim |
19:23:00 | * | serialdev[m] joined #nim |
19:23:00 | * | notbot[m] joined #nim |
19:23:00 | * | k0mpjut0r joined #nim |
19:23:05 | * | Miguelngel[m] joined #nim |
19:23:05 | * | zacharycarter[m] joined #nim |
19:23:05 | * | spymasterd[m] joined #nim |
19:23:05 | * | TheManiac[m] joined #nim |
19:23:05 | * | macsek1911[m] joined #nim |
19:23:05 | * | exothermic[m] joined #nim |
19:23:05 | * | blarghz[m] joined #nim |
19:23:06 | * | bitstoppa[m] joined #nim |
19:23:06 | * | endes[m] joined #nim |
19:23:06 | * | narimiran[m] joined #nim |
19:23:06 | * | syntonym[m] joined #nim |
19:23:06 | * | xomachine[m] joined #nim |
19:23:06 | * | sg-james[m] joined #nim |
19:23:06 | * | pqflx3[m] joined #nim |
19:23:06 | * | toofly[m] joined #nim |
19:23:06 | * | yglukhov[m] joined #nim |
19:23:06 | * | petersjt014[m] joined #nim |
19:23:06 | * | zielmicha[m] joined #nim |
19:23:07 | * | stisa[m] joined #nim |
19:23:07 | * | hohlerde joined #nim |
19:23:07 | * | jaens[m] joined #nim |
19:23:07 | * | MrAxilus[m] joined #nim |
19:23:07 | * | planetis[m] joined #nim |
19:23:07 | * | monofuel[m] joined #nim |
19:24:47 | * | jjido joined #nim |
19:25:56 | * | narimiran joined #nim |
19:37:34 | * | kungtotte quit (Remote host closed the connection) |
19:46:14 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:56:32 | * | syntonym[m] quit (Remote host closed the connection) |
19:56:32 | * | spymasterd[m] quit (Remote host closed the connection) |
19:56:33 | * | hohlerde quit (Remote host closed the connection) |
19:56:33 | * | bitstoppa[m] quit (Remote host closed the connection) |
19:56:33 | * | endes[m] quit (Remote host closed the connection) |
19:56:33 | * | stisa[m] quit (Remote host closed the connection) |
19:56:33 | * | notbot[m] quit (Remote host closed the connection) |
19:56:33 | * | ArchieT[m] quit (Read error: Connection reset by peer) |
19:56:37 | * | xomachine[m] quit (Remote host closed the connection) |
19:56:37 | * | macsek1911[m] quit (Remote host closed the connection) |
19:56:37 | * | exothermic[m] quit (Remote host closed the connection) |
19:56:38 | * | codevance[m] quit (Remote host closed the connection) |
19:56:40 | * | narimiran[m] quit (Remote host closed the connection) |
19:56:40 | * | Miguelngel[m] quit (Remote host closed the connection) |
19:56:40 | * | zacharycarter[m] quit (Remote host closed the connection) |
19:56:42 | * | dyce[m] quit (Remote host closed the connection) |
19:56:44 | * | jaens[m] quit (Remote host closed the connection) |
19:56:46 | * | Connor[m] quit (Write error: Connection reset by peer) |
19:56:47 | * | yglukhov[m] quit (Remote host closed the connection) |
19:56:47 | * | petersjt014[m] quit (Remote host closed the connection) |
19:56:47 | * | serialdev[m] quit (Remote host closed the connection) |
19:56:48 | * | Demos[m] quit (Read error: Connection reset by peer) |
19:56:49 | * | monofuel[m] quit (Read error: Connection reset by peer) |
19:56:52 | * | k0mpjut0r quit (Read error: Connection reset by peer) |
19:56:52 | * | gh0st[m] quit (Read error: Connection reset by peer) |
19:56:52 | * | sendell[m] quit (Remote host closed the connection) |
19:56:52 | * | sg-james[m] quit (Remote host closed the connection) |
19:56:52 | * | TheManiac[m] quit (Remote host closed the connection) |
19:56:52 | * | MrAxilus[m] quit (Remote host closed the connection) |
19:56:52 | * | pqflx3[m] quit (Remote host closed the connection) |
19:56:53 | * | xylef quit (Remote host closed the connection) |
19:56:54 | * | toofly[m] quit (Remote host closed the connection) |
19:56:54 | * | planetis[m] quit (Remote host closed the connection) |
19:56:54 | * | blarghz[m] quit (Remote host closed the connection) |
19:56:54 | * | zielmicha[m] quit (Remote host closed the connection) |
19:56:55 | * | GitterIntegratio quit (Read error: Connection reset by peer) |
19:56:56 | * | TheKing[m] quit (Read error: Connection reset by peer) |
19:59:01 | * | krux02 quit (Remote host closed the connection) |
20:03:16 | * | dyce[m] joined #nim |
20:10:01 | * | kungtotte joined #nim |
20:13:11 | FromGitter | <alehander42> @arnetheduck in principle, there is nothing wrong with using ast macros to generate public functions: you can easily generate sensible documentation too in many cases |
20:14:21 | * | Connor[m] joined #nim |
20:14:21 | * | TheKing[m] joined #nim |
20:14:21 | * | Demos[m] joined #nim |
20:14:21 | * | codevance[m] joined #nim |
20:14:22 | * | xylef joined #nim |
20:14:22 | * | ArchieT[m] joined #nim |
20:14:23 | * | GitterIntegratio joined #nim |
20:14:23 | * | gh0st[m] joined #nim |
20:14:23 | * | sendell[m] joined #nim |
20:14:23 | * | serialdev[m] joined #nim |
20:14:23 | * | notbot[m] joined #nim |
20:14:23 | * | k0mpjut0r joined #nim |
20:14:28 | * | endes[m] joined #nim |
20:14:28 | * | bitstoppa[m] joined #nim |
20:14:28 | * | zacharycarter[m] joined #nim |
20:14:29 | * | hohlerde joined #nim |
20:14:29 | * | TheManiac[m] joined #nim |
20:14:29 | * | xomachine[m] joined #nim |
20:14:29 | * | pqflx3[m] joined #nim |
20:14:29 | * | exothermic[m] joined #nim |
20:14:29 | * | narimiran[m] joined #nim |
20:14:29 | * | yglukhov[m] joined #nim |
20:14:29 | * | zielmicha[m] joined #nim |
20:14:29 | * | Miguelngel[m] joined #nim |
20:14:29 | * | spymasterd[m] joined #nim |
20:14:29 | * | macsek1911[m] joined #nim |
20:14:30 | * | petersjt014[m] joined #nim |
20:14:30 | * | blarghz[m] joined #nim |
20:14:30 | * | syntonym[m] joined #nim |
20:14:30 | * | planetis[m] joined #nim |
20:14:30 | * | jaens[m] joined #nim |
20:14:30 | * | toofly[m] joined #nim |
20:14:30 | * | sg-james[m] joined #nim |
20:14:31 | * | monofuel[m] joined #nim |
20:14:31 | * | MrAxilus[m] joined #nim |
20:14:31 | * | stisa[m] joined #nim |
20:14:45 | * | zachk joined #nim |
20:15:41 | * | zachk quit (Changing host) |
20:15:41 | * | zachk joined #nim |
20:25:36 | FromGitter | <yyyc514> Is this is a repository so I can submit fixes? `https://nim-lang.org/docs/backends.html` ? |
20:26:47 | FromGitter | <GULPF> That file is in the docs folder in the main repo |
20:27:13 | FromGitter | <yyyc514> found it |
20:27:20 | FromGitter | <yyyc514> what is rst hmmm |
20:28:12 | FromGitter | <GULPF> It's restructuredtext. It's like markdown, but harder to remember |
20:31:15 | FromGitter | <alehander42> it's easy to get used to |
20:35:50 | FromGitter | <arnetheduck> @alehander42 "in theory, theory and practice are the same, in practice..." |
20:41:04 | FromGitter | <alehander42> there is a right way and a wrong way to do most things |
20:44:58 | * | jjido joined #nim |
20:46:06 | * | Vladar quit (Remote host closed the connection) |
20:48:20 | * | jjido quit (Client Quit) |
20:54:17 | * | zakora quit (Quit: WeeChat 2.2) |
20:55:09 | * | jjido joined #nim |
21:01:26 | FromGitter | <alehander42> but yeah i get your worry :D |
21:06:06 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
21:06:39 | * | Snircle joined #nim |
21:19:52 | * | nsf quit (Quit: WeeChat 2.3) |
21:25:15 | * | Jesin quit (Quit: Leaving) |
21:28:00 | * | Jesin joined #nim |
21:41:00 | * | narimiran quit (Ping timeout: 252 seconds) |
21:46:29 | * | cozachk joined #nim |
21:48:30 | * | zachk quit (Ping timeout: 252 seconds) |
21:50:16 | FromGitter | <arnetheduck> say I have an array[42] and a seq with at least so many items.. what's the idiomatic way to set the first 40 elements of the array to the first 40 elements in the seq? |
21:54:54 | FromGitter | <kayabaNerve> ```for i in 0 ..< myArr.len: ⏎ myArr[i] = mySeq[i]``` ⏎ ⏎ ? [https://gitter.im/nim-lang/Nim?at=5bfdbd2e8dffd748dbf1c62b] |
22:02:27 | FromGitter | <zetashift> can't you just use toSeq? |
22:03:57 | FromGitter | <kayabaNerve> @zetashift Seq -> Array |
22:04:12 | FromGitter | <kayabaNerve> With seq.len > arr.len |
22:04:33 | def- | Where's the fun in doing it idiomatically? myArr = cast[ptr type(myArr)](addr mySeq[0])[] |
22:04:34 | * | kapil____ quit (Quit: Connection closed for inactivity) |
22:06:31 | def- | or just copyMem(addr myArr[0], addr mySeq[0], sizeof(myArr)) |
22:07:13 | FromGitter | <arnetheduck> was hoping for something more beautiful. oh well. |
22:29:59 | * | cozachk quit (Quit: Leaving) |
22:31:28 | Araq | don't use cast, don't use copyMem, use the for loop. |
22:31:49 | * | stefanos82 quit (Quit: Quitting for now...) |
22:32:03 | Araq | it's 2018, compilers can optimize for loops into copyMem |
22:34:09 | * | zachk joined #nim |
22:36:46 | dom96 | but... for loop is more code than a simple copyMme |
22:36:47 | dom96 | *mem |
22:37:35 | Araq | it's one line that crashes at runtime if you get it wrong |
22:37:57 | Araq | copyMem is one line that crashes eventually, somewhere else if you get it wrong |
22:39:20 | Araq | not to mention that you need a copyMem'able type T for copyMem to work. And usually the "I know better than the stupid Nim compiler" type of programmer doesn't know Nim all that well |
22:40:48 | * | zachk quit (Changing host) |
22:40:48 | * | zachk joined #nim |
22:44:03 | xace | Do we have an equivalent of godbolt.org for nim? |
22:45:13 | dom96 | Don't think so |
22:45:19 | dom96 | It would be really nice to add Nim support there |
22:45:33 | xace | https://github.com/mattgodbolt/compiler-explorer/issues/206 # seems like it has been brought up |
22:45:55 | xace | imho, it would help with these types of things, for example copymem vs forloop etc... and other uncertanties a user might have |
22:59:27 | * | Jesin quit (Quit: Leaving) |
23:07:25 | Araq | https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/Lifetime.pdf this is hot shit |
23:08:23 | Araq | it shows how we can compute useful properties about nim programs without fixpoint iterations |
23:09:01 | Araq | alehander42: this should be interesting for you |
23:10:13 | Araq | how they treat loops is pure genius |
23:15:53 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:24:17 | * | kapil____ joined #nim |
23:49:30 | * | zachk quit (Read error: Connection reset by peer) |
23:49:58 | * | zachk joined #nim |
23:50:32 | * | zachk quit (Changing host) |
23:50:32 | * | zachk joined #nim |