00:05:09 | FromGitter | <Clyybber> test |
00:05:16 | FromDiscord | <Clyybber> ok |
00:11:57 | * | endragor joined #nim |
00:13:37 | * | abm quit (Quit: Leaving) |
00:14:00 | * | endragor quit (Remote host closed the connection) |
00:14:37 | * | endragor joined #nim |
00:31:21 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
00:31:53 | * | endragor quit (Remote host closed the connection) |
00:36:15 | * | krux02 joined #nim |
00:41:29 | FromGitter | <Asc2011> hey, i'm looking for some detailed docs that describe the usage of nimsuggest - maybe the VS-Code-thinggy ? |
00:48:26 | * | krux02_ joined #nim |
00:52:29 | * | krux02 quit (Ping timeout: 265 seconds) |
01:04:44 | * | krux02_ quit (Remote host closed the connection) |
01:33:34 | * | njoseph quit (Ping timeout: 265 seconds) |
01:43:00 | FromGitter | <Asc2011> ΓΆok, another question: Is the idetools-integrations dead ? [https://nim-lang.org/docs/idetools.html] |
01:45:10 | FromGitter | <Asc2011> is Britney Spears around here ? |
01:47:52 | rayman22201 | only Christina Aguilera XP |
01:48:05 | rayman22201 | nimsuggest is idetools. They are the same |
01:48:39 | rayman22201 | for VS code, you probably want to check out this: https://github.com/PMunch/nimlsp |
01:49:33 | rayman22201 | or this: https://github.com/pragmagic/vscode-nim |
01:51:30 | FromGitter | <Asc2011> rayman22201, thx, i looked at the VS-Code implementation, but i don't use VS-Code. Somehow i 'm not a VS-Code user. My editor-support uses the older idetools-protokol and that does not work too good at the moment. And now i'm wondering : there seems to be a version-1-protokol for nimsuggest, which is probably what i need - but it's not documented.. |
01:52:31 | FromGitter | <Asc2011> BTW i'm on atom, so its the atom-nim-pack - which is a nice codebase. |
01:53:18 | FromGitter | <Asc2011> what do you mean they are the same ? the outputs are the same ? |
01:53:34 | * | endragor joined #nim |
01:55:52 | leorize | @Asc2011 I'd glad to answer any question about nimsuggest |
01:56:07 | leorize | Also, if you understand vimscript, you can take a look at my plugin: https://github.com/alaviss/nim.nvim |
01:57:43 | * | endragor_ joined #nim |
01:59:36 | FromGitter | <Asc2011> @leorize : thx, i'm just wondering if i need to update the Atom-implementation (current idetools) to nimsuggest or if i can get away with some cheaper efforts ?-) U know Britney writes here [ https://nim-lang.org/docs/idetools.html ] in 2019 that the idetolls-stuff should work :-)) |
02:01:36 | * | endragor quit (Ping timeout: 265 seconds) |
02:05:21 | FromGitter | <Asc2011> @FromIRC leorize, nice video :-) |
02:10:48 | leorize | @Asc2011 you'll have to update things to nimsuggest |
02:10:51 | leorize | idetools is dead |
02:14:05 | * | njoseph joined #nim |
02:18:13 | FromGitter | <cndkhuong> idetools not found |
02:20:44 | * | njoseph quit (Ping timeout: 276 seconds) |
02:24:49 | FromGitter | <Asc2011> May somebody point me to the place where the old idetools-protocol is described. invocation-switches etc. that would make it a bit easier ;) thxx.. |
02:25:04 | * | beatmox quit (Ping timeout: 268 seconds) |
02:25:35 | * | beatmox joined #nim |
02:32:34 | * | dddddd quit (Remote host closed the connection) |
03:00:34 | leorize | Asc2011 just look for idetools in the compiler |
03:00:47 | leorize | everything is still there, just disabled |
03:01:00 | leorize | but it's pretty much dead code at this point and no one tested it |
03:01:07 | leorize | you are better off with something that supports nimsuggest |
03:01:21 | disruptek | he speaks from experience. |
03:01:25 | leorize | there's a reason why nimsuggest was created: idetools was too slow it's unusable |
03:03:02 | FromGitter | <Asc2011> hmm, i'm working on it. nimsuggest was already in the package. So it's in the compiler-souce on GitHub, i'll take a look, thx.. |
03:09:34 | * | ponyrider joined #nim |
03:12:22 | * | njoseph joined #nim |
03:12:38 | * | rockcavera quit (Remote host closed the connection) |
03:26:07 | FromGitter | <Asc2011> nimsuggest says : usage: sug|con|def|use|dus|chk|mod|highlight|outline|known file.nim[;dirtyfile.nim]:line:col ?? is there a example ? |
03:26:40 | leorize | https://nim-lang.org/docs/nimsuggest.html |
03:26:54 | FromGitter | <Obround> Hello! How do you do this type of *thing* in nim? (Its hard to describe): β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5df1b37ef1cc6c27ea344c54] |
03:28:14 | leorize | type test = object |
03:28:19 | leorize | meth_val: int |
03:29:10 | leorize | proc init_test(x, y: int): test = result = test(meth_val: result.meth(x, y)) |
03:29:14 | FromGitter | <Asc2011> sry, but thats insufficient ;( , |
03:29:44 | leorize | Obround: Nim don't have any equivalent to `__init__` |
03:29:54 | leorize | the convention is to create an init proc for users to call |
03:30:13 | leorize | @Asc2011: well, just try it |
03:30:45 | leorize | to get suggestions at a position in a file: sug <filename>.nim:<line>:<col> |
03:30:54 | FromGitter | <Obround> Yes, but can't you do something like this: proc initTest(x, y: int):` |
03:32:50 | FromGitter | <Asc2011> nope, "cannot find file" when i add the line/col-info |
03:33:45 | leorize[m] | Asc2011: nimsuggest spawns a shell |
03:33:56 | leorize[m] | you interact with it via that shell |
03:34:14 | FromGitter | <Asc2011> sure,, |
03:35:54 | FromGitter | <Asc2011> "nimsuggest sug test.nim:10:4" fails , "nimsuggest sug test.nim" works ??=)) |
03:39:56 | FromGitter | <Asc2011> thats why examples are so00oo important - try it yourself - nimsuggest is always unhappy and answers with the usage-message, wtf |
03:40:17 | * | kevin joined #nim |
03:40:41 | * | kevin is now known as Guest58692 |
03:47:35 | leorize[m] | do `nimsuggest test.nim`, then the shell will spawn |
03:49:34 | FromGitter | <Asc2011> hmm, the code-base i'm working on tries to get this in one-go. And that simply doesnt work... as advertised ... |
04:05:04 | * | liam_ joined #nim |
04:10:19 | liam_ | sashlick, gogolxdong: So on the topic of the OpenSSL stuff from yesterday, I have written my own wrapper that does stuff with execProcess. It's not pretty, but it works! Obviously a proper wrapper would be faster and more secure, so I'm still looking forward to that. |
04:10:32 | * | Guest58692 quit (Ping timeout: 268 seconds) |
04:12:08 | leorize | I thought there's an openssl wrapper already? |
04:13:19 | liam_ | It only wraps the AES and SHA parts of libcrypto |
04:19:13 | * | Kaynatwo joined #nim |
04:22:48 | * | Kanato quit (Ping timeout: 245 seconds) |
04:40:17 | * | nsf joined #nim |
04:52:39 | * | narimiran joined #nim |
04:55:13 | * | liam_ quit (Ping timeout: 250 seconds) |
04:56:52 | * | chemist69 quit (Ping timeout: 252 seconds) |
04:58:50 | * | chemist69 joined #nim |
04:58:54 | shashlick | Can you share what you have |
05:00:50 | * | madprops gives shashlick a slice of pumpkin pie |
05:07:43 | shashlick | gorgeEx |
06:08:42 | FromGitter | <phillvancejr> Do we have a GUI library that will allow a window to be always on top of others and provide non native controls such that they can have custom styles |
06:16:58 | * | noonien quit (Quit: Connection closed for inactivity) |
06:19:33 | Araq | I think you need to use the windows api directly for "window always on top of others" but it sounds really annoying, don't do that |
06:29:41 | * | ltriant quit (Ping timeout: 250 seconds) |
06:32:27 | Tanger | Hmmm, FileStream.getPosition() is throwing me `index out of bounds, the container is empty [IndexError]` when it's on the very last element of the stream :S |
06:33:03 | Tanger | It's in a not stream.atEnd() loop, surely it wouldn't enter the loop if there's no more data to get? |
06:33:27 | Tanger | Oh, I'm an idiot, disregard that |
06:50:14 | * | solitudesf joined #nim |
07:12:44 | * | ng0 joined #nim |
07:13:38 | * | ganderzz joined #nim |
07:27:39 | * | PMunch joined #nim |
07:34:43 | * | ganderzz quit (Remote host closed the connection) |
07:34:48 | * | Vladar joined #nim |
07:42:59 | * | solitudesf quit (Remote host closed the connection) |
07:43:13 | * | solitudesf joined #nim |
07:48:49 | * | solitudesf quit (Ping timeout: 268 seconds) |
07:50:17 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:04:36 | * | gmpreussner joined #nim |
08:09:54 | * | gour joined #nim |
08:11:06 | Araq | oh my, it's gour. welcome back |
08:14:21 | gour | Araq: congrat for your nim accomplishments!! i'm back seeing that nim-gui worlds is becoming richer and now i'm in position to really start working on desktop gui project...before that i resumed my studies of the subject and some family-related issues are over (loss of family member...) |
08:16:13 | PMunch | Sorry to hear that gour |
08:16:34 | PMunch | (the loss of a family member, not that you're ready to work on your project) |
08:18:17 | gour | PMunch: well, my mother was old, but suffered from dementia and i dedicate myself to take care about her until her final day, so, i guess you can imagine, that in such condition i did not have almost *any* free time during those years... |
08:18:29 | gour | *dedicated |
08:20:40 | PMunch | Oh for sure, that takes up a lot of time/energy |
08:22:06 | gour | otoh, i can say for sure that no language comes close to Nim when it comes to performance, elegant syntax, licensing, features, (probably) community as well |
08:25:09 | PMunch | I can't argue with you there. Now we just need the immense catalogue of libraries that Python has and we're set! |
08:43:27 | gour | how is memory managed in wxnim? |
08:47:13 | Araq | if PMunch didn't change it, it's not managed at all, you translate to C++ and so C++'s regime is used (destructors etc) |
08:47:29 | PMunch | I didn't touch it |
08:48:14 | gour | Araq: it means one has to manually take care about it? |
08:49:02 | Araq | no, the framework does it for you |
08:50:06 | gour | ahh, ok. that's the beauty of C++ vs C? |
08:50:44 | Araq | somewhat |
08:51:11 | Araq | it's also the beauty of "memory management for UIs is not really all that hard to do" |
08:52:03 | PMunch | Hmm, implement a PNG reader for the Nim VM, how hard can that be? |
08:55:15 | PMunch | Ugh, why is the VM only allowed to cast between integers and/or floats of the same size.. |
08:55:34 | PMunch | cast[seq[byte]](staticRead("somefile.png")) doesn't work.. |
08:57:51 | Araq | PMunch: PRs are welcome, the VM got several updates recently |
09:13:47 | * | floppydh joined #nim |
09:33:51 | * | akitoshi joined #nim |
09:42:04 | zedeus | what's the arc alternative to deepCopy? |
09:51:50 | Araq | deepCopy... |
09:52:05 | Araq | I need to port it |
09:52:29 | zedeus | ah ok, wasn't sure |
09:53:49 | Araq | well it's to be decided but it looks like we'll get 100% interop including support for shallowCopy |
09:54:26 | zedeus | I tried arc with some of my advent of code solutions, for some it's 2.5x faster than boehm with ~40% less memory used, and ~10% faster than markAndSweep with 3x less memory used |
09:54:33 | zedeus | future is looking very bright |
09:59:27 | Araq | it just got slower thanks to cycle collection but I think I can optimize it away most of the time |
10:00:02 | Araq | wow these are great results, can you blog about them? |
10:00:06 | Araq | :-) |
10:02:03 | madprops | btw i love the nim logo |
10:02:09 | zedeus | hah, I don't have a blog and they're pretty small programs so probably not too interesting |
10:02:32 | Araq | anyway, the point of arc is not even performance |
10:02:57 | Araq | it's much better interop with "I am doing MM my way, thanks" |
10:03:08 | madprops | huh there's another nim org using the same colors in the logo |
10:04:47 | Araq | mratsim: are there intrinsics for STC and CMC? |
10:09:57 | PMunch | madprops, which one? |
10:11:26 | madprops | http://i.imgur.com/TJ5iaOc.jpg |
10:11:54 | PMunch | Well, not really the same colours |
10:12:01 | PMunch | I don't think anyone will confuse the two :P |
10:22:59 | * | nc-x joined #nim |
10:24:06 | nc-x | Araq: https://irclogs.nim-lang.org/11-12-2019.html#11:02:47 |
10:25:03 | * | nc-x quit (Remote host closed the connection) |
10:25:46 | Araq | > i.e. should I move the other procs too? |
10:26:05 | Araq | I think this means nimscript.nim is beyond repair and should be deprecated altogether |
10:26:37 | Araq | on the other hand, so far paramStr caused the most trouble so lets only fix the reported bug |
10:44:48 | * | lritter joined #nim |
10:48:03 | FromGitter | <zetashift> Shouldn't ARC be compared with the current deferred GC rather than boehm and mark and sweep? |
10:54:13 | FromGitter | <alehander92> Araq, what should `move` do in js: shouldn't it be just a id |
10:54:14 | FromGitter | <alehander92> op |
10:54:18 | FromGitter | <alehander92> (t -> t) |
10:54:40 | FromGitter | <alehander92> or should it directly be a compile error |
11:01:44 | * | abm joined #nim |
11:02:55 | FromDiscord | <Clyybber> Araq: What does STC and CMC mean in this context? |
11:04:42 | FromDiscord | <Clyybber> Carry flag manipulation? |
11:09:59 | Araq | alehander42: it should be a cheap assignment followed by reset() of the source |
11:10:07 | Araq | clyybber: yeah |
11:11:54 | Araq | zetashift: well it should be compared to the "fastest" GC we have, maybe if you ignore latency |
11:14:08 | * | solitudesf joined #nim |
11:24:52 | FromDiscord | <mratsim> it should be compared with the default one as well since 99.9% of the people are using it and would want to know if it's worth being the first debuggers or arc |
11:28:14 | Araq | you will be among the first debuggers no matter what :P |
11:28:36 | Araq | this is beta-quality or maybe alpha |
11:28:55 | Araq | routinely we find terrible bugs |
11:29:34 | Araq | at least you can use valgrind with it though |
11:31:25 | FromGitter | <Asc2011> what exactly is the project-file or main-project-file and how can i make sure that nimsuggest inspects & sees into this very important-file ? Is there any docu that describes a typical project-layouts. I know there are some variations binary/hybrid/js of config-files. Brew has placed a nim-compiler-config-file deep-down in /usr/local/nim/lib. , which i have not touched. But as nimsuggest automagically uses this file, |
11:31:25 | FromGitter | ... so it seems very important. The question comes from a code-base that i'm currently struggling with. This ide-integration-package tries all sorts of wiered things from searching / probing to guessing just to identify "the-project-folder". It even reads the nimble-config-file to figure this out ? Obviously this is n ... [https://gitter.im/nim-lang/Nim?at=5df2250d42784416abd3f20c] |
11:34:11 | FromGitter | <Araq> pass the directory of the file to nimsuggest and let it figure it out itself |
11:39:15 | * | ltriant joined #nim |
11:39:40 | * | ltriant quit (Client Quit) |
11:40:29 | FromGitter | <Asc2011> thats exactly what the code already does and by that it fails -?- nimsuggest quits when i try that in the shell ? nimsuggest --stdin --debug ./src/* !!with a Asterix!! works |
11:41:38 | FromGitter | <Asc2011> why has the author of the atom-package spend 500-loc to figure things out ? |
11:42:16 | * | ng0 joined #nim |
11:48:15 | * | rockcavera joined #nim |
11:49:35 | FromGitter | <Asc2011> @Araq thx, anyhow, that package is a mess and it parses-console-streams which never worked for me. |
11:51:30 | FromDiscord | <mratsim> VS code package is also so-so π |
11:52:39 | * | Hideki_ joined #nim |
11:55:41 | Araq | Asc2011: auto-detection of project files is rather new in nimsuggest |
11:56:11 | FromGitter | <Asc2011> @mratsim and does it in VS-land work on one file or does it inspect many source-files in "a-project" ? looking at import and maybe into the std-lib ? |
11:57:18 | * | lritter quit (Read error: Connection reset by peer) |
11:57:40 | * | lritter joined #nim |
11:58:49 | Araq | you can configure it |
11:59:42 | FromGitter | <Asc2011> @Araq thats good news - so i can kick most of the old-code :-) would you recommend to have one demon per file or one demon for all files open in the editor ? Does nimsuggest follow imports or looks into the std-lib ? |
12:00:08 | Araq | avoid "onde demon per file" at all costs |
12:00:21 | Araq | it's not how nimsuggest was designed |
12:01:46 | FromGitter | <Asc2011> @Araq ahh, have i understood - you say 'better have one nimsuggest-demon for some open files' not a 1:1 solution ? |
12:02:51 | Araq | open nimsuggest once, it's really like the compiler, you don't "compile" module dependencies, do you. the compiler figures it out |
12:06:44 | FromDiscord | <mratsim> unfortunately the VS code plugin spawns one daemon per file |
12:06:57 | FromGitter | <Asc2011> ;-)) right - understood,, how important is it to generate a temp-file and pass this along with the file from the text-buffer ? the atom-modul does that all the time - is the idea to pass a 'working/error-free'-source-file to nimsuggest ? |
12:09:37 | Araq | yes pass it temporary files if they were edited |
12:12:31 | FromGitter | <Asc2011> @mratsim maybe they chat with one another :-) |
12:13:12 | FromDiscord | <mratsim> More like they deide to hog your CPU, RAM or both |
12:13:15 | FromDiscord | <mratsim> decide* |
12:14:43 | FromGitter | <Asc2011> @mratsim this is the new cool - loaded with AI - maybe they observe your typing-pattern :-) |
12:17:00 | * | rockcavera quit (Read error: Connection reset by peer) |
12:17:17 | * | rockcavera joined #nim |
12:17:17 | * | rockcavera quit (Changing host) |
12:17:17 | * | rockcavera joined #nim |
12:23:41 | * | endragor_ quit (Remote host closed the connection) |
12:24:09 | madprops | i think rust is a scheme to make me exercise my fingers |
12:53:47 | PMunch | Crap.. PNG uses the deflate algoritm, which I'm guessing no-one has implemented for the Nim VM yet? |
13:06:18 | FromDiscord | <mratsim> wouldn't nim png work in the VM? |
13:07:13 | PMunch | Doubt it |
13:07:18 | PMunch | Hold on, let me try |
13:08:15 | PMunch | Nope |
13:08:24 | PMunch | Error: cannot 'importc' variable at compile time; fopen |
13:08:39 | PMunch | Or wait |
13:09:52 | PMunch | Nope, even with decodePNG32 I get: Error: cannot call method parseChunk at compile time |
13:10:59 | PMunch | Ah, because the VM doesn't support methods? |
13:26:55 | PMunch | Oooh, but the nimz decompressor works |
13:29:43 | shashlick | PMunch why not build it into an exe and call with gorge instead |
13:29:57 | PMunch | Where's the fun in that? |
13:31:54 | shashlick | Vm isn't very fast comparatively |
13:32:02 | * | pbb quit (Ping timeout: 252 seconds) |
13:32:33 | PMunch | True, but these are very small images |
13:33:14 | shashlick | Of course depends what your requirement is but I have had to be careful with impacting compile time with nimterop |
13:33:22 | * | pbb joined #nim |
13:35:46 | PMunch | Yeah I ran into that with protobuf as well |
13:36:28 | PMunch | The parsing took so long that your editor would noticably hang if nimsuggest was running on the same thread |
13:37:50 | FromGitter | <alehander92> isn't there a simpler way to do all this |
13:38:23 | FromDiscord | <Rika> the algorithm im using for day 12 is making my computer's ram sweat |
13:38:44 | FromGitter | <alehander92> i feel like a background server which just scans for changing lines with signatures/declarations and only parsing them with language-specific parsers |
13:39:04 | FromGitter | <alehander92> should be like enough for most language usages |
13:40:18 | FromGitter | <alehander92> yeah, it doesnt count for some language-specific things like scoping/inheritance |
13:40:29 | FromGitter | <alehander92> but probably thats what editors did before lsp anyway |
13:41:11 | FromGitter | <alehander92> hm, and probably thats what my sublime is doing |
13:57:25 | * | rockcavera quit (Read error: Connection reset by peer) |
13:57:42 | * | rockcavera joined #nim |
13:57:42 | * | rockcavera quit (Changing host) |
13:57:42 | * | rockcavera joined #nim |
14:02:34 | * | krux02 joined #nim |
14:04:56 | FromGitter | <Asc2011> and how do you like the lsp-thing that evbr is talking about ? |
14:07:32 | FromGitter | <alehander92> who is evbr |
14:07:42 | FromGitter | <alehander92> ah everybody |
14:08:13 | FromGitter | <alehander92> i like it, i just feel that its hard to make it defect-free/fast in all cases when its part of compilers |
14:09:56 | FromGitter | <alehander92> afaik some people redesign compilers to act more like server loops these days but i still wonder if its worth it for 80% cases |
14:11:43 | FromGitter | <Asc2011> and the accuracy of lsp while developing - that should be by concept the best support one could get ? |
14:16:26 | * | endragor joined #nim |
14:37:42 | * | nsf quit (Quit: WeeChat 2.6) |
14:41:02 | FromDiscord | <Fern & Simula (They/Them)> i'm trying to use dot operators to create function calls. I've got the following code, but I always get an error message that the compiler can't instantiate `U` |
14:41:05 | FromDiscord | <Fern & Simula (They/Them)> template `.`[T,U](f: (proc(x:T): U), x: T): U = return f(x) |
14:41:08 | * | FromGitter quit (Remote host closed the connection) |
14:41:26 | * | FromGitter joined #nim |
14:41:29 | FromDiscord | <Fern & Simula (They/Them)> is the issue with what i'm writing, or is it just not do-able? |
14:41:47 | PMunch | How are you calling that? |
14:41:57 | FromDiscord | <Fern & Simula (They/Them)> oh sorry, i'll just pastebin the whole thing, one sec |
14:42:24 | FromDiscord | <Fern & Simula (They/Them)> https://pastebin.com/znjY8XkQ |
14:43:25 | PMunch | Any particular reason you don't want to do it in the regular Nim way? https://play.nim-lang.org/#ix=24d7 |
14:44:05 | FromDiscord | <Fern & Simula (They/Them)> yeah, just palying around with dotOperators |
14:44:24 | FromDiscord | <Fern & Simula (They/Them)> i'm most likely gonna use something similar to this for a project in the near future so i wanna figure it all out now |
14:44:53 | PMunch | Well, the problem is that Nim isn't able to figure out what U is supposed to be from your call |
14:45:34 | FromDiscord | <Fern & Simula (They/Them)> well yeah. i figured it would be pretty simple to figure it out, but i guess not |
14:46:11 | PMunch | As you can see you can call it if you specify the parameters: https://play.nim-lang.org/#ix=24da |
14:46:18 | PMunch | Although that's not very pretty :P |
14:47:45 | FromDiscord | <Fern & Simula (They/Them)> huh, interesting |
14:47:55 | FromDiscord | <Fern & Simula (They/Them)> i can also do it with untyped parameters. thanks though, that's very handy! |
14:48:11 | PMunch | Yeah you can do it like this: https://play.nim-lang.org/#ix=24db |
14:48:40 | FromDiscord | <Fern & Simula (They/Them)> oh wow, i can spcify f as just proc? that's even better than what i had lol |
14:48:42 | FromDiscord | <Fern & Simula (They/Them)> thanks! |
14:48:59 | FromDiscord | <Fern & Simula (They/Them)> ~~hacking a dynamic lang with a static lang is really weird~~ |
14:49:05 | PMunch | Yup, but that doesn't stop you from passing only one argument.. |
14:49:21 | PMunch | Err, passing a procedure that takes more than one argument* |
14:50:18 | FromDiscord | <Fern & Simula (They/Them)> it's not client-facing code, it's probably fine lol |
14:50:27 | FromDiscord | <Fern & Simula (They/Them)> err, user-facing |
14:50:39 | FromDiscord | <Fern & Simula (They/Them)> i could also use varargs |
14:54:22 | PMunch | You could also use a concept: https://play.nim-lang.org/#ix=24de |
14:55:38 | PMunch | I mean you would still just get an error when using the proc thing from earlier, since it expands and then realises that it can't actually compile that |
14:59:52 | * | endragor quit (Remote host closed the connection) |
15:00:13 | PMunch | Or if you want to create your own custom error: https://play.nim-lang.org/#ix=24dg |
15:00:40 | * | ng0_ joined #nim |
15:01:11 | * | ng0 quit (Disconnected by services) |
15:01:14 | * | ng0_ is now known as ng0 |
15:05:20 | FromGitter | <alehander92> i guess proc is a typeclass? |
15:05:27 | FromGitter | <alehander92> so i wouldnt say this is dynamic |
15:05:41 | FromGitter | <alehander92> but i am not sure about the proc thing |
15:05:57 | FromGitter | <alehander92> the proc {.} things bited me some times |
15:07:37 | * | NimBot joined #nim |
15:11:43 | * | MarquisdeFalbala joined #nim |
15:15:41 | * | Hideki_ quit (Remote host closed the connection) |
15:16:33 | * | Hideki_ joined #nim |
15:17:10 | * | endragor joined #nim |
15:23:59 | * | Hideki_ quit (Ping timeout: 276 seconds) |
15:24:48 | * | endragor quit (Remote host closed the connection) |
15:28:41 | * | abm quit (Quit: Leaving) |
15:33:29 | FromGitter | <Asc2011> i'm gonna try the nimsuggest-socket version from node/atom - can anybody recommend a socket-lib that does the job best ? or just any plain and simple unix-domain-socket lib ? |
15:35:08 | * | dddddd joined #nim |
15:38:32 | leorize | nimsuggest communicates via tcp sockets |
15:38:47 | leorize | to be fair it'll be faster if you just use nimlsp |
15:39:09 | FromGitter | <Asc2011> ups, tcp not upd |
15:39:55 | leorize | nimlsp does all the logic needed to properly use nimsuggest |
15:40:00 | FromGitter | <Asc2011> and why now nimlsp again ? it's compΓΌlicated |
15:40:28 | leorize | because nimlsp supports LSP, which should be available on editors like atom |
15:41:07 | leorize | configuring an lsp client is much much easier than trying to write a full-fledged nimsuggest client |
15:41:45 | FromGitter | <Asc2011> well, maybe yes, there are things floating around, but i've not tested them yet,, so i count three construction sites on my side plus LSP makes four :-) |
15:43:14 | FromGitter | <Asc2011> i have a idetools/nimsuggest-client, ok a bit outdated, on my hands. I have no idea what LSP is for a beast :-) |
15:44:20 | FromGitter | <Asc2011> i bet you think this one https://github.com/PMunch/nimlsp. ? |
15:44:33 | leorize | https://github.com/atom/atom-languageclient |
15:44:35 | leorize | yep |
15:44:41 | leorize | configuring is rather easy ^ |
15:45:06 | leorize | no need to manually parse nimsuggest's output, no need to write project finding code |
15:45:13 | leorize | it's a major upside, really |
15:45:56 | FromGitter | <Asc2011> the issue-36 says "nimsuggest crashes for specific file in projects" - what is going on here :--) |
15:46:36 | leorize | nimsuggest crashing is super normal by now :P |
15:47:52 | FromGitter | <Asc2011> hehe, well right-said-fred , but why is nimsuggest in the lsp-project in-the-game at all ? |
15:49:46 | leorize | nimlsp is basically strapping lsp support to nimsuggest |
15:49:47 | FromGitter | <Asc2011> is one complementing the other ? how does the info flow operate between IDE<->nimsuggest<->LSP ? |
15:49:57 | leorize | IDE <-> nimlsp |
15:50:10 | leorize | nimlsp uses nimsuggest as a library |
15:51:24 | * | Hideki_ joined #nim |
15:51:36 | FromGitter | <Asc2011> so from the IDE-side of things, i'd configure the LSP-client which talks to nimlsp<- talks-to->nimsuggest ? |
15:53:52 | leorize | ya |
15:54:02 | leorize | you only have to care about the talk to nimlsp part |
15:54:11 | leorize | the rest is automated and non-configurable anyway |
15:55:17 | FromGitter | <Asc2011> i'll think about it .... greets |
16:01:01 | * | floppydh quit (Quit: WeeChat 2.6) |
16:06:23 | PMunch | Not quite |
16:06:32 | PMunch | nimlsp doesn't talk to nimsuggest |
16:06:53 | PMunch | nimsuggest can be compiled into its own program, but it can also be imported as a library |
16:07:20 | PMunch | So nimlsp imports nimsuggest and so it's just calling directly into the nimsuggest procedures |
16:07:38 | PMunch | Instead of communicating with a separate instance of nimsuggest |
16:12:59 | FromGitter | <Asc2011> aha, so protocol-wise its JSON-RPC to-and-from nimlsp<-JRPC->atom-lsp-client while nimlsp spares us anoother socket and loads nimsuggest as a lib :-) sounds interesting and here https://langserver.org is said that neither Nim nor Coffeescript are on the list, wheras COBOL & PHP enjoy full-support :) it's unfair |
16:13:08 | * | PMunch quit (Quit: Leaving) |
16:19:32 | FromDiscord | <mratsim> always assume that Nim is never on the list or on anyone Radar and you would be pleasantly surprised π |
16:20:58 | * | Hideki_ quit (Ping timeout: 265 seconds) |
16:25:56 | FromGitter | <Asc2011> hihi, i get the idea - keeping a low-profile - @PMunch looking at this list https://github.com/atom/ide-csharp/blob/master/package.json of lsp-services - which of these does nimlsp support at the moment ? |
16:27:45 | FromGitter | <Asc2011> and how can one properly address another person which is behind a chat-service-bridge ?=(( |
16:29:51 | Zevv | I just call them all FromGitter |
16:30:09 | Zevv | FromGitter: just like you |
16:30:10 | FromGitter | Zevv, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/nim-lang/Nim |
16:30:21 | Zevv | ha |
16:30:51 | FromGitter | <Asc2011> ;-) |
16:34:21 | FromGitter | <Asc2011> found the info on nimlsp-services |
16:38:43 | leorize | @Asc2011: well just type out the name in the brackets <> manually :p |
16:40:36 | FromGitter | <Asc2011> <PMunch> like so ? nimlsp doesn't compile :-) lets have a compile-party,, |
16:40:52 | leorize | nah, just the name :P |
16:41:02 | leorize | PMunch: <- like this |
16:42:05 | leorize | anyhow, he went offline :p |
16:42:33 | FromGitter | <Asc2011> ic PMunch ? again ? leorize: :-= |
16:55:50 | * | MarquisdeFalbala quit (Ping timeout: 246 seconds) |
17:06:06 | FromGitter | <Varriount> @Araq So, what it the difference between the current GC and ARC? |
17:06:26 | FromDiscord | <Clyybber> Varriount: ARC is deterministic |
17:06:27 | disruptek | more bugs in arc. |
17:06:39 | FromDiscord | <Clyybber> disruptek: I wouldn't be sooo sure |
17:07:33 | FromDiscord | <Clyybber> ok maybe more, but at least not this one: #12273 |
17:07:36 | disbot | https://github.com/nim-lang/Nim/issues/12273 -- 3Memory corruption ; snippet at 12https://play.nim-lang.org/#ix=24dJ |
17:08:07 | disruptek | your cloud is gone. |
17:08:36 | FromDiscord | <Clyybber> βοΈ |
17:08:56 | FromDiscord | <Clyybber> must have turned into dust |
17:25:22 | Araq | Varriount: ARC is reference counting with move semantics |
17:26:21 | Araq | since the reference count values stay precise, you can do copy-on-write reliably |
17:35:44 | FromGitter | <phillvancejr> Does nim call default constructor's of C++ objects by default? I created a c++ class with a default constructor and an overloaded constructor and whenever I create on object of the class in Nim, it calls both constructors and calls the destructor twice. Does anyone have an Idea on what I'm doing wrong? |
17:39:27 | FromDiscord | <mratsim> Aren't constructors are always called in C++? |
17:39:52 | FromDiscord | <mratsim> how did you wrap the constructors? |
17:40:22 | nisstyre | So, if I wanted to treat a string as a File object, the way to do that seems to be use StringStream, but what if I wanted to construct an actual file handle that I could give to a C library function expecting FILE* ? I looked into fmemopen for that, but it sounds like it's not portable |
17:40:56 | FromDiscord | <mratsim> here is an example of wrapping multiple constructors @Phillvancejr: https://github.com/status-im/nim-ttmath/blob/master/src/ttmath.nim#L84-L86 |
17:42:12 | FromDiscord | <mratsim> @nisstyre: https://nim-lang.org/docs/io.html#stdout |
17:43:07 | FromDiscord | <mratsim> now I'm not sure how to transform a string in memory into a file handle |
17:43:20 | nisstyre | mratsim: that's the part I'm wondering about mainly |
17:44:13 | FromDiscord | <mratsim> can you do that in C? |
17:44:19 | nisstyre | my use case for this is actually calling libssl functions related to x.509 that expect files |
17:44:29 | nisstyre | maybe there's a higher level library that allows access to these |
17:44:45 | nisstyre | you can do it in C with fmemopen |
17:44:55 | nisstyre | I just wanted to know if there's a better way |
17:45:00 | nisstyre | it's not very portable |
17:45:12 | nisstyre | there's also open_memstream, but it's a bit tricky |
17:45:19 | nisstyre | you have to actually write to the file stream |
17:45:20 | FromDiscord | <mratsim> I see a bytes API here: https://www.openssl.org/docs/man1.0.2/man3/d2i_X509.html |
17:45:36 | nisstyre | ah maybe that will work |
17:45:39 | nisstyre | I was reading something else |
17:48:18 | nisstyre | the thing is, it's PEM encoded |
17:48:32 | FromGitter | <phillvancejr> @mratsim I used c2nim to generate the nim wrapping then I added importcpp pragmas |
17:49:23 | nisstyre | these might work though |
17:49:40 | FromDiscord | <mratsim> @nisstyre, we use BearSSL for our SSL needs: https://github.com/status-im/nim-bearssl |
17:50:12 | nisstyre | ok d2i_X509 might work for my uses |
17:50:18 | nisstyre | mratsim: I'll look into that, thanks |
17:50:24 | nisstyre | I really just want to parse certificate chains |
17:50:35 | nisstyre | so I'm not tied to openssl |
17:51:01 | FromDiscord | <mratsim> @Phillvancejr mmm, it might need some further edit then. otherwise this might simplify things: https://github.com/fragcolor-xyz/fragments#cpp |
17:54:39 | FromGitter | <phillvancejr> @mratsim it seems like it should be simple. it is a very small class with only a default constructor and one overloaded to take a string. Even if I remove the wrapping for the default constructor and only use the overloaded version, Nim still calls the default constructor. It is very strange. |
17:55:25 | FromDiscord | <mratsim> do you have an example you can post? |
17:58:10 | * | Hideki_ joined #nim |
18:02:35 | * | Hideki_ quit (Ping timeout: 250 seconds) |
18:04:43 | * | rockcavera quit (Remote host closed the connection) |
18:10:25 | * | narimiran quit (Ping timeout: 268 seconds) |
18:10:28 | FromGitter | <phillvancejr> @mratsim β Person.h β β ```Bob says hello! β Phill says hello! β Phill says goodbye! β Phill says goodbye!``` [https://gitter.im/nim-lang/Nim?at=5df28294e72656230131be29] |
18:12:01 | solitudesf | another bot https://forum.nim-lang.org/t/5675 |
18:12:04 | FromGitter | <phillvancejr> Maybe it has to do with C++ move semantics? Maybe an object is being created then passed to the nim function, so there are actually two objects created? |
18:13:04 | FromGitter | <phillvancejr> I thought maybe it was the bycopy pragma, but changing it to byref didn't affect the output |
18:16:27 | * | dddddd quit (Ping timeout: 250 seconds) |
18:19:08 | FromDiscord | <mratsim> very strange bot @solitudesf, it actually replie thank you in the linked reddit thread |
18:20:18 | FromDiscord | <mratsim> mmm I never tried overloading classes, only basic struct and std::string or unique_ptr |
18:21:17 | FromGitter | <phillvancejr> Ah ok, thanks for taking a look. I'll post it in the forum so it doesn't get lost here. Thanks for your time! |
18:21:39 | * | Trustable joined #nim |
18:22:02 | FromDiscord | <mratsim> you're welcome |
18:22:35 | FromDiscord | <mratsim> if you ever need string/vector/unique pointers this is my code: https://github.com/numforge/agent-smith/blob/master/third_party/std_cpp.nim |
18:24:59 | FromGitter | <phillvancejr> oh nice, thanks! |
18:25:11 | FromGitter | <alehander92> hmm |
18:27:23 | FromGitter | <alehander92> ok @phillvancejr |
18:27:39 | FromGitter | <alehander92> i know what is happening |
18:27:54 | FromGitter | <alehander92> you create `object` |
18:28:02 | FromGitter | <alehander92> so in the resulting code its defined like Person p2__QSETErn3Fwo89a6F8hQtQKQ; |
18:28:11 | FromGitter | <alehander92> which i think calls |
18:28:15 | FromGitter | <alehander92> the default constructor |
18:28:25 | FromGitter | <alehander92> (this is a top level definition of the variable) |
18:29:04 | FromGitter | <alehander92> later its called again in the main |
18:29:12 | FromGitter | <alehander92> with the actual constructor call |
18:29:47 | FromGitter | <alehander92> this also happens only on top level it seems |
18:30:40 | * | dddddd joined #nim |
18:32:50 | FromGitter | <alehander92> `var p2: Person` also does this in any situation (which is probably expected |
18:33:43 | FromGitter | <alehander92> so its an interesting bug, and not sure how it can be solved easily |
18:33:52 | FromGitter | <alehander92> even more interesting is that if there is no default one |
18:33:59 | FromGitter | <alehander92> let p2 = constructPerson("Phill") is directly broken |
18:34:06 | FromGitter | <alehander92> var p2: Person as well |
18:34:30 | FromGitter | <alehander92> which is again probably obvious if one uses c++ not sure |
18:38:09 | FromGitter | <alehander92> however this seems to break |
18:38:13 | FromGitter | <alehander92> `default(Person)` |
18:38:30 | FromGitter | <alehander92> maybe thats fine |
18:39:07 | FromGitter | <alehander92> Araq ^ i guess you can clarify those, but the first one (top level let p = Person(..) calling twice seems as a small bug) |
18:39:27 | FromGitter | <alehander92> calling different constructors * |
18:39:36 | FromGitter | <phillvancejr> What is default(Person)? I haven't seen that yet |
18:39:53 | FromGitter | <phillvancejr> Also thank you Alexander for taking the time to look at this |
18:40:05 | FromGitter | <alehander92> well, there is this `default()` builtin that constructs a default value for a type |
18:40:22 | FromGitter | <alehander92> no problem, trying to learn more about c++ constructors myself |
18:40:45 | FromGitter | <phillvancejr> Ah ok, and it takes a type? But don't types in nim default to zero values? or are objects nil? |
18:42:07 | FromGitter | <alehander92> well yeah, but you still need an operation Type -> Value |
18:42:42 | FromGitter | <phillvancejr> The double constructor kind of makes sense if on the C++ side. If I was creating a Person by calling a function that takes a Person and returns a Person, I think this would result in double constructors/destructors because a temporary object is created, but then I would expect the Destructor to be called before the second constructor is called so I don't think that is what Nim is doing |
18:42:43 | FromGitter | <alehander92> ref objects i think are nil, objects should be just zero i guess |
18:43:05 | FromGitter | <alehander92> but this is not a double constructor bug |
18:43:10 | FromGitter | <alehander92> this is a different bug |
18:43:16 | FromGitter | <phillvancejr> I thought so |
18:44:02 | FromGitter | <alehander92> basically nim generates something like β β Person p; // top level if p was top level β ... β ... [https://gitter.im/nim-lang/Nim?at=5df28a7279534b3868787f8d] |
18:44:11 | * | nsf joined #nim |
18:45:02 | FromGitter | <alehander92> not really sure if there is an easy workaround tho |
18:45:13 | FromGitter | <alehander92> for the compiler |
18:45:31 | FromGitter | <alehander92> otherwise for the user, the obvious thing would be to just move this inside a function |
18:49:47 | FromGitter | <phillvancejr> move which part into the function? The construction of a Person is already inside of a function. |
18:50:15 | FromGitter | <alehander92> no |
18:50:18 | FromGitter | <alehander92> you call it on top level |
18:52:42 | FromGitter | <phillvancejr> how so? The only thing at top level is the type declaration right? |
18:58:02 | FromGitter | <alehander92> ok, i am talking about the example |
18:58:08 | FromGitter | <phillvancejr> Actually it looks like the function is the problem. When I create a person at the top level like this: β β ```let p = constructPerson()``` β β This actually results in the double constructors. So actually the function is the problem I think, it is creating two Person objects [https://gitter.im/nim-lang/Nim?at=5df28dc0ac14cc652c712b86] |
19:05:44 | FromGitter | <alehander92> yes |
19:05:49 | FromGitter | <alehander92> you're right! |
19:06:02 | FromGitter | <alehander92> but indeed |
19:06:17 | FromGitter | <alehander92> this is because it directly does p = {}; |
19:07:20 | * | PMunch joined #nim |
19:07:24 | FromGitter | <alehander92> and when its a function |
19:07:35 | FromGitter | <alehander92> it doesnt do it really on top level, but in the NimMainModule |
19:07:50 | FromGitter | <alehander92> if you open |
19:07:53 | FromGitter | <alehander92> the nimcache cpp file |
19:07:57 | FromGitter | <alehander92> youll immediately see |
19:08:01 | FromGitter | <alehander92> what i am talking about |
19:08:05 | FromGitter | <alehander92> no need for guesses |
19:14:01 | FromGitter | <bung87> ```code paste, see link``` β β the r_load is nil, whatβs wrong with the code [https://gitter.im/nim-lang/Nim?at=5df2917955d9392300fca512] |
19:14:52 | FromGitter | <bung87> the go version https://github.com/shirou/gopsutil/blob/master/cpu/cpu_darwin_cgo.go#L86 |
19:16:17 | PMunch | Hmm, it would be nice if choosenim show would show the time of compilation |
19:16:22 | PMunch | Especially for devel |
19:17:41 | FromGitter | <bung87> hmm Iβve read python version and go version, but still have no idea |
19:17:45 | * | abm joined #nim |
19:18:52 | * | njoseph quit (Ping timeout: 268 seconds) |
19:19:04 | disruptek | Araq, shashlick: nimgit2 on windows doesn't support ssh; is that right? |
19:20:57 | FromGitter | <alehander92> @bung87 how is host_cpu_load_info_data_t |
19:20:58 | FromGitter | <alehander92> defined |
19:21:49 | FromGitter | <alehander92> some of your host_statistics definition sseems wrong, i saw a similar stack overflow answer and error |
19:21:58 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5df29355ac14cc652c7153d6] |
19:22:12 | FromGitter | <alehander92> look at go: you need to pass host_info_t |
19:22:16 | FromGitter | <alehander92> not ptr to host_info_t |
19:22:33 | FromGitter | <alehander92> host_info_t itself is a pointer type from what the SO answer said |
19:25:30 | FromGitter | <bung87> casthost_info_t (r_load) , casthost_info_t (r_load.addr), casthost_info_t (r_load.unsafeAddr) I βv tried doest not work |
19:25:57 | * | JustASlacker joined #nim |
19:25:58 | FromGitter | <bung87> r_load , r_load.addr , r_load.unsafeAddr |
19:26:15 | FromGitter | <alehander92> what do you need that fr |
19:26:17 | FromGitter | <alehander92> for* |
19:26:21 | FromGitter | <alehander92> ah, hm, strange |
19:26:47 | FromGitter | <bung87> I change host_info_t to `type host_info_t = ptr cint` right? |
19:27:09 | JustASlacker | hello |
19:27:19 | JustASlacker | how can I convert a HashSet to json |
19:27:25 | FromGitter | <alehander92> dont really know, i dont use mac honestly but |
19:27:44 | FromGitter | <alehander92> maybe overload `%` for it |
19:27:48 | FromGitter | <alehander92> JustASlacker |
19:28:19 | JustASlacker | I tried var jsonout = %* vhosts , vhost being the Hashset |
19:28:46 | FromGitter | <alehander92> yeah, i think defining a proc `%` for HashSet[T] |
19:28:48 | FromGitter | <alehander92> should be ok |
19:28:58 | FromGitter | <alehander92> which e.g. returns an array or a custom object |
19:29:07 | FromGitter | <alehander92> the question is , how would you deserialize it later |
19:29:13 | FromGitter | <alehander92> and know that it was a set |
19:29:25 | JustASlacker | it doesnt need to be a set |
19:29:28 | JustASlacker | it can be a list |
19:29:38 | JustASlacker | its just a set so elemtns are unique |
19:30:07 | * | solitudesf- joined #nim |
19:30:27 | JustASlacker | would it be easier to cast it to array first |
19:30:29 | JustASlacker | or something |
19:30:51 | JustASlacker | not sure I know how to overload % |
19:31:47 | * | solitudesf- quit (Client Quit) |
19:33:34 | FromGitter | <bung87> https://github.com/bung87/psutil-nim/blob/master/src/psutil/psutil_macosx.nim Iβve post it to github , if you would like to help. |
19:34:52 | FromGitter | <phillvancejr> @alehander92 Oh I see what you mean! That is strange. Hopefully that will be fixed. I guess the solution for now is to just create the objects at the top level without using the C++ constructor? |
19:35:05 | FromGitter | <phillvancejr> How do we make a note of this for a bug fix? |
19:36:45 | * | kungtotte quit (Ping timeout: 268 seconds) |
19:39:45 | * | njoseph joined #nim |
19:44:43 | FromGitter | <alehander92> @phillvancejr but .. how can we do that ? is it possible at all in c++? |
19:44:54 | FromGitter | <alehander92> please open a github issue |
19:44:57 | FromGitter | <alehander92> thanks! |
19:45:05 | FromGitter | <alehander92> @bunjg87 sorry no time and i dont use mac |
19:45:12 | FromGitter | <alehander92> but open in the forum maybe? |
19:45:19 | FromGitter | <alehander92> JustASlacker please |
19:45:21 | FromGitter | <alehander92> look at json.nim |
19:45:25 | FromGitter | <alehander92> in the standard library |
19:45:28 | FromGitter | <alehander92> lot of examples |
19:45:30 | FromGitter | <alehander92> Araq |
19:45:39 | FromGitter | <alehander92> Protocol* from posix |
19:45:42 | * | Marquisd_ joined #nim |
19:45:46 | FromGitter | <alehander92> leads to some strange check errors for me |
19:45:52 | FromGitter | <alehander92> because it seems it expects 6 to 23 |
19:45:57 | FromGitter | <alehander92> and IP which is 0 |
19:45:59 | FromGitter | <alehander92> fails it |
19:46:03 | FromGitter | <alehander92> it works with checks:off |
19:46:20 | * | Marquisd_ is now known as Marquisdefalbala |
19:47:08 | FromGitter | <bung87> ok , Iβll post it forum |
19:48:30 | JustASlacker | alehander92 right ho |
19:54:49 | * | narimiran joined #nim |
19:57:12 | * | Vladar quit (Quit: Leaving) |
20:05:08 | * | nsf quit (Quit: WeeChat 2.6) |
20:08:45 | shashlick | disruptek ya I've not added it yet - on Linux, cmake finds libssh2 if it is already installed |
20:09:55 | disruptek | right, that's what i figured. |
20:13:11 | * | solitudesf- joined #nim |
20:14:57 | * | solitudesf quit (Ping timeout: 240 seconds) |
20:19:27 | * | krux02 quit (Remote host closed the connection) |
20:26:08 | shashlick | Unlike nimarchive, I might probably create a libssh2 wrapper and then have nimgit2 depend on it |
20:27:08 | disruptek | might need to sort out where to stash the so first. |
20:30:44 | FromGitter | <phillvancejr> @alehander92 The solution is definitely a hack and won't work with libraries but the way to make it work would be to always define an empty default constructor and destructor in C++. These are both required by Nim even if you aren't using them. Also we shouldn't use RAII in the destructor because otherwise the resource will be freed twice in Nim, even in some cases if you're checking for null. Instead make a |
20:30:44 | FromGitter | ... clean up function that will have to be called explicitly in Nim. β thing.h β β ```new thing! β deleting data! 10``` β ... [https://gitter.im/nim-lang/Nim?at=5df2a3737ce7ea1e35727627] |
20:32:59 | FromGitter | <phillvancejr> I'm definitely not a c++ expert but this is the solution I came up with. Its not great though ha ha, we should probably just not try to use C++ classes in Nim for now |
20:33:14 | * | Hideki_ joined #nim |
20:38:06 | * | Hideki_ quit (Ping timeout: 265 seconds) |
20:38:56 | * | rockcavera joined #nim |
20:41:08 | * | Trustable quit (Remote host closed the connection) |
20:42:29 | * | njoseph quit (Ping timeout: 276 seconds) |
20:42:48 | * | Trustable joined #nim |
20:59:16 | * | letto_ quit (Quit: Konversation terminated!) |
21:01:14 | * | narimiran quit (Ping timeout: 268 seconds) |
21:01:55 | FromGitter | <alehander92> honestly i am not sure |
21:02:24 | FromGitter | <alehander92> i think |
21:02:25 | FromGitter | <alehander92> a github issue |
21:02:51 | FromGitter | <alehander92> might help as i still think this is a bug |
21:02:55 | FromGitter | <alehander92> the let behavior |
21:28:59 | FromDiscord | <Clyybber> branching with a probability is not as easy as it seems (with inclusive ranges) |
21:29:51 | FromDiscord | <Clyybber> I wonder if xoroshiro truly is inclusive though |
21:33:56 | * | njoseph joined #nim |
21:51:08 | * | PMunch quit (Quit: leaving) |
22:02:42 | * | Kanato joined #nim |
22:04:46 | * | luis_ joined #nim |
22:06:36 | * | Kaynatwo quit (Ping timeout: 268 seconds) |
22:12:39 | * | Trustable quit (Remote host closed the connection) |
22:20:04 | * | gour quit (Remote host closed the connection) |
22:21:56 | * | solitudesf- quit (Ping timeout: 276 seconds) |
22:23:52 | * | JustASlacker quit (Ping timeout: 268 seconds) |
22:32:29 | * | clyybber joined #nim |
22:32:39 | * | liam_ joined #nim |
22:35:55 | FromGitter | <phillvancejr> For sure, should be a github issue. I'll upload the examples. It definitely should work as expected |
22:36:38 | liam_ | So I'm using nimongo and json in the same project. I need nimongo's %* macro to create bson for manipulating documents, but I also need to create JsonNode objects for other stuff. Because the json library also uses %* to create it's own objects, I get ambiguity errors. Is there a way to differentiate the macros for use? |
22:37:03 | disruptek | json.%* |
22:38:19 | liam_ | Yeah I tried that but I got the same errors. I'm just now thinking that maybe I have to do json.%* and bson.%* |
22:38:23 | liam_ | Ill try it |
22:39:06 | * | lritter quit (Quit: Leaving) |
22:40:03 | liam_ | Now I'm getting " Error: undeclared identifier: '.%*' " |
22:42:12 | * | clyybber quit (Quit: WeeChat 2.7) |
22:42:23 | disruptek | odd. |
22:42:31 | liam_ | Indeed |
22:42:55 | liam_ | I have double checked my syntax and it looks correct |
22:43:04 | liam_ | As in, no loose '.%*' |
22:43:34 | disruptek | i kinda get why it happens with a macro, but i feel like there should be a workaround. |
22:43:41 | disruptek | ie. in the compiler. |
22:44:40 | liam_ | So do you think this is an issue with how the compiler implements macros? |
22:44:48 | disruptek | nah. |
22:45:22 | disruptek | i just think we should be able to parse the macro symbols. |
22:45:32 | disruptek | ie. tie them to a module. |
22:46:07 | disruptek | you didn't find anything about this on the forum? i think i've heard of this problem before. |
22:47:17 | disruptek | json.`%*` of course. |
22:48:29 | disruptek | coulda sworn it was the first thing i tried. |
22:50:23 | liam_ | If i use json.%* where I want JsonNode objects then errors are raised at the other %* macros, and if I put 'bson.' in front of them then I get that undeclared identifier error |
22:50:28 | liam_ | I'll check the forum |
22:51:03 | disruptek | you need to say json.`%*` because operators need stropping in this context. |
22:52:01 | liam_ | How is that different? |
22:52:16 | disruptek | significantly, it features backquotes. |
22:53:09 | liam_ | Ah I see now |
22:54:30 | liam_ | Nah now I'm getting more errors |
22:55:13 | liam_ | Is there a way to import macros with different identifiers? |
22:55:45 | disruptek | can you put what you have in a paste? i'm not convinced. |
22:56:47 | liam_ | In a paste as in paste it in here on the IRC or in a pastebin (or similar)? |
22:56:56 | disruptek | pastebin, ideally. |
22:57:56 | liam_ | https://pastebin.com/a3cBN2wG |
22:58:53 | disruptek | try a space after the identifier and the data you're passing to it as a first argument. |
22:59:01 | disruptek | that, or wrap the arguments in (). |
22:59:24 | disruptek | json.`%*`({"some":"data"}) should work. |
22:59:39 | disruptek | json.`%*` {"some":"data"} should work, too. |
22:59:55 | liam_ | Same for the bson? |
22:59:59 | disruptek | sure. |
23:00:58 | liam_ | Whey! That worked. |
23:01:00 | liam_ | Thanks |
23:01:11 | disruptek | π |
23:01:41 | liam_ | Could you enlighten me on why that worked? |
23:02:09 | disruptek | function syntax; this"foo" is a proc this() that takes a single argument of a string. |
23:02:26 | disruptek | this("foo") also works. or this "foo". |
23:02:52 | liam_ | I see |
23:02:57 | liam_ | And the backticks? |
23:03:24 | disruptek | operators have to be stropped when you want to refer to them by name, as when you define them. |
23:03:37 | disruptek | otherwise, the compiler thinks you want to evaluate them. |
23:03:58 | disruptek | because . is an operator character, we have to strop the remaining operator characters. |
23:04:51 | liam_ | Ok, got it |
23:07:39 | * | ponyride1 joined #nim |
23:09:30 | * | ponyrider quit (Ping timeout: 268 seconds) |
23:15:26 | FromDiscord | <mratsim> @Clyybber, RNG just gives you uint64 |
23:16:02 | FromDiscord | <mratsim> but rejection sampling that creates an uniform distribution for a range (from a full uint64 RNG) is exclusive |
23:16:24 | FromDiscord | <mratsim> see: https://github.com/mratsim/weave/blob/master/weave/random/rng.nim#L64-L72 |
23:38:51 | * | clyybber joined #nim |
23:43:31 | * | clyybber quit (Client Quit) |
23:44:38 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
23:48:08 | * | luis_ quit (Quit: luis_) |
23:51:38 | * | clyybber joined #nim |
23:54:45 | * | Hideki_ joined #nim |
23:55:16 | FromDiscord | <Clyybber> @mratsim Nice thanks! |
23:57:18 | * | clyybber quit (Quit: WeeChat 2.7) |
23:59:27 | * | Hideki_ quit (Ping timeout: 268 seconds) |