00:00:39 | arkanoid | because of federation? |
00:01:03 | arkanoid | I mean, I think the point is that I can be logged on server X and talk to room that is shared between server X and Y |
00:01:24 | arkanoid | because room doesn't exists on the server but on the federation as a whole |
00:03:10 | FromDiscord | <Elegantbeef> I still think the home server means that even with federation you can have multiple rooms with the same name since there is still information to diferentiate |
00:03:57 | FromDiscord | <Elegantbeef> So yes if you have multiple home servers you may have multiple `X` room but you can join a specific one without confusion afaik |
00:04:31 | arkanoid | well, so the <roomname> doesn't remain constant across federated servers |
00:05:09 | arkanoid | there might be aliases of same room on different servers |
00:05:16 | FromDiscord | <Elegantbeef> Isnt the homeserver apart of the roomname? |
00:05:53 | FromDiscord | <Elegantbeef> Sure |
00:08:45 | arkanoid | well, my matrix server is up, time to reverse proxy |
00:28:28 | FromDiscord | <TryAngle> is there a library to parse math input like↵`sin(4.328) + tan((3/2)pi) - 2e^(4)`↵into a "math expression" that may or may not be modified and then be evaluated? |
00:31:56 | FromDiscord | <Sabena Sema> well std.macros parseExpr can kinda do that |
00:32:01 | FromDiscord | <Sabena Sema> what are you actually trying to do? |
00:32:37 | FromDiscord | <Sabena Sema> if it's the "statement expression" thing that some C++ libraries do that's not really something you need to do in nim |
00:34:28 | FromDiscord | <Rika> https://github.com/Yardanico/nim-mathexpr |
00:34:39 | FromDiscord | <Rika> @TryAngle |
00:37:38 | FromDiscord | <TryAngle> In reply to @Sabena Sema "if it's the "statement": I want to add math support to my discord bot |
00:39:16 | * | src quit (Quit: Leaving) |
00:40:16 | FromDiscord | <TryAngle> In reply to @Rika "https://github.com/Yardanico/nim-mathexpr": not all what I want but enough and looks easy to expand, so a good start, thanks! |
00:40:40 | FromDiscord | <Rika> Why not all? |
00:41:31 | FromDiscord | <TryAngle> mainly linalg and some constants |
00:41:34 | * | vicfred quit (Quit: Leaving) |
00:42:26 | FromDiscord | <Rika> Eh I would have said it’s out of scope |
00:44:57 | FromDiscord | <TryAngle> ah I see, that's what I mean then.↵ofc. I wouldn't expect any library to have 1:1 what I want / need, that would be way too specific XD |
00:46:12 | FromDiscord | <TryAngle> what I like with this one, I only have to add a custom parseFactor procedure and the additions I like and it should all still work 🤔 |
00:50:31 | arkanoid | how can I set a const that is a type? I want a const like "const myType = int64" to use later multiple times like in "cast[myType](...)" |
00:51:40 | FromDiscord | <Rika> `type MyType = int64` |
00:52:33 | arkanoid | yeah I've just found the same and I feel stupid |
00:52:36 | arkanoid | thanks |
00:53:53 | FromDiscord | <TryAngle> what is the recommended way to use a .env file? |
00:54:22 | FromDiscord | <TryAngle> I tried std/os getEnv(<key>), but it seems to not work? |
00:54:54 | FromDiscord | <Sabena Sema> yeah that will only get env vars from the actual environment |
00:55:00 | FromDiscord | <Rika> That’s not for files |
00:55:07 | FromDiscord | <Sabena Sema> use an ini parser type thing |
00:55:27 | FromDiscord | <TryAngle> or wait does a TOML parser exist, I would prefre that actually |
00:55:34 | FromDiscord | <Sabena Sema> environment variables actually don't generally have any format besides "sequence of zero terminated strings" |
00:55:43 | FromDiscord | <Rika> Honestly I don’t understand why no one has made a shim program that loads the environment file and runs the program with the environment |
00:55:56 | FromDiscord | <Sabena Sema> what environment file? |
00:56:07 | FromDiscord | <Sabena Sema> oh, just some environment |
00:56:07 | FromDiscord | <Rika> Or rather why they aren’t popular |
00:56:15 | FromDiscord | <Rika> .env file |
00:57:04 | FromDiscord | <Sabena Sema> well, that's what `env` does |
00:57:33 | FromDiscord | <Sabena Sema> also, the whole reason people use envvars is the parent-to-child inheritance |
00:57:51 | FromDiscord | <Sabena Sema> so running a process with a static, predefined, environment block isn't that useful |
00:58:00 | FromDiscord | <Rika> env can load files? |
00:58:09 | FromDiscord | <Rika> I was under the impression that it did not |
00:58:16 | FromDiscord | <Rika> Ah I guess you can just cat it no |
00:58:21 | FromDiscord | <Rika> Is that safe |
00:58:49 | FromDiscord | <Rika> In reply to @Sabena Sema "so running a process": I was going to say merged but I thought that was already implied |
00:58:51 | FromDiscord | <Sabena Sema> I'm not sure what kind of parsing it does |
00:59:37 | FromDiscord | <Sabena Sema> but if it's merging it has to split the keys from the values (meaning potential problems if you are passing an arbitrary blob that could contain '=') |
01:00:12 | FromDiscord | <TryAngle> tbh TOML with parsetoml is actually pretty decent for envs |
01:00:43 | FromDiscord | <Rika> I don’t think we know what the other means |
01:01:00 | FromDiscord | <Rika> That’s not what I mean and I don’t know what you mean |
01:01:06 | FromDiscord | <Rika> It’s whatever at this point |
01:08:21 | * | krux02 quit (Remote host closed the connection) |
01:12:16 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3Hxz |
01:12:29 | FromDiscord | <Sabena Sema> 10000 bytes is enough for anyone |
01:28:24 | FromDiscord | <TryAngle> I'm trying to run the examples from dimscord but they just error↵using nimble, it tells me -d:ssl is missing, using nim running with -d:ssl, a fatal error occures from asyncfutures where the discord client gets started |
01:29:30 | FromDiscord | <Elegantbeef> It wasnt suggested but https://github.com/PMunch/stacklang does exist if you want to support maths |
01:29:48 | FromDiscord | <Rika> That would require you to use an unconventional syntax |
01:29:56 | FromDiscord | <Rika> In reply to @TryAngle "I'm trying to run": Well what is the error |
01:30:45 | FromDiscord | <TryAngle> In reply to @Rika "Well what is the": https://media.discordapp.net/attachments/371759389889003532/918676072529297458/message.txt |
01:31:38 | FromDiscord | <Rika> Wow helpful exception, probably raised by the library |
01:32:47 | FromDiscord | <TryAngle> this happens with↵`nim r -d:ssl src/kassacord.nim`↵with nimble run I just get "missing -d:ssl error" |
01:33:00 | FromDiscord | <TryAngle> (edit) "r" => "c -r" |
01:33:01 | FromDiscord | <impbox [ftsf]> you'll definitely need -d:ssl |
01:33:19 | FromDiscord | <TryAngle> I get same errors on WSL Ubuntu and Windows |
01:33:22 | FromDiscord | <Elegantbeef> make a `config.nims` with `-d:ssl` in your project's root |
01:33:33 | FromDiscord | <impbox [ftsf]> I have been using dimscord |
01:33:57 | FromDiscord | <impbox [ftsf]> but maybe different version or different nim version |
01:34:26 | FromDiscord | <TryAngle> In reply to @Elegantbeef "make a `config.nims` with": ok now I can run with nimble thanks,↵But sadly I get the same error now as when using nim c -r -d:ssl src/kassacord.nim |
01:34:32 | FromDiscord | <impbox [ftsf]> there is a dimscord discord server you could ask for help in |
01:34:48 | FromDiscord | <impbox [ftsf]> https://discord.gg/paXRAtvn |
01:35:15 | FromDiscord | <TryAngle> ah totally forgot about that, sadly this server looks a bit inactive but I try thanks |
01:45:38 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3HxD |
01:45:45 | FromDiscord | <impbox [ftsf]> any idea what this error means, and how to work around it? |
01:46:28 | FromDiscord | <impbox [ftsf]> why is it trying to evaluate `cursor` at compile time? |
01:49:34 | FromDiscord | <Elegantbeef> Need more code to say |
01:50:10 | arkanoid | what would result in echo type(X) -> "void", what is a void? ptr object? |
01:50:12 | FromDiscord | <Elegantbeef> Nevermind i understand |
01:50:21 | FromDiscord | <Elegantbeef> void is void |
01:50:24 | FromDiscord | <Rika> Void is just void |
01:50:25 | FromDiscord | <Elegantbeef> It means "nothing" |
01:50:35 | arkanoid | is there type "void"? |
01:50:40 | FromDiscord | <Rika> Technically |
01:50:46 | FromDiscord | <Rika> Not really but it “exists” |
01:51:25 | FromDiscord | <impbox [ftsf]> https://play.nim-lang.org/#ix=3HxG |
01:51:40 | arkanoid | running type on this guy results in void https://github.com/yglukhov/nimpy/blob/2f09d0fd934f6c93425f416e9c095608aac2017a/nimpy/py_lib.nim#L133 |
01:52:55 | FromDiscord | <Elegantbeef> What is the second `[]` for impbox? |
01:53:10 | FromDiscord | <impbox [ftsf]> to index the tuple |
01:53:14 | FromDiscord | <impbox [ftsf]> (edit) "to index the ... tuple" added "ChainRow" |
01:53:16 | FromDiscord | <Elegantbeef> There you go |
01:53:25 | FromDiscord | <Elegantbeef> Tuple indexes need to be static |
01:53:45 | FromDiscord | <impbox [ftsf]> ohh |
01:54:03 | FromDiscord | <Elegantbeef> Didnt notice `ChainRow` was a tuple 😀 |
01:54:04 | FromDiscord | <impbox [ftsf]> thanks, dang! |
01:54:22 | FromDiscord | <impbox [ftsf]> I guess I'll make it an array with an enum index or something |
01:55:16 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3HxI |
01:55:24 | FromDiscord | <impbox [ftsf]> it's an operating system thing |
01:55:38 | FromDiscord | <impbox [ftsf]> at runtime |
01:55:50 | FromDiscord | <impbox [ftsf]> on linux an environment variable can be used |
01:55:51 | FromDiscord | <IsaacPaul> bah ok probably some sort of environment variable then? |
01:55:55 | FromDiscord | <impbox [ftsf]> not sure about macos |
01:55:59 | arkanoid | is it possible to get from which module a symbol come from? |
01:56:34 | FromDiscord | <impbox [ftsf]> https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html |
01:57:14 | FromDiscord | <IsaacPaul> I see that's it |
01:57:37 | FromDiscord | <IsaacPaul> thanks.. was getting tunnel vision lol |
01:58:52 | FromDiscord | <impbox [ftsf]> maybe i can cast to array =\ |
01:59:14 | FromDiscord | <impbox [ftsf]> since otherwise tuple behaviour is desired |
02:07:45 | FromDiscord | <Elegantbeef> impbox it's not great but https://play.nim-lang.org/#ix=3HxM |
02:08:04 | FromDiscord | <Elegantbeef> Yes it's possible ark |
02:09:33 | FromDiscord | <Rika> You could just simulate field access with templates and [] on arrays? |
02:09:48 | FromDiscord | <Elegantbeef> You can |
02:10:00 | FromDiscord | <Rika> So I don’t know why you insist on tuples |
02:10:26 | FromDiscord | <Elegantbeef> I hate tuples so i dont i was just showing impbox how one could |
02:11:05 | FromDiscord | <impbox [ftsf]> yeah, ok, i'll just use arrays |
02:11:19 | FromDiscord | <impbox [ftsf]> thanks <3 |
02:11:29 | FromDiscord | <Rika> 👌 |
02:13:47 | arkanoid | how does https://nim-lang.github.io/fusion/src/fusion/smartptrs.html#SharedPtr sharedPtr works in nim? is atomicCounter increased/decreased automatically? |
02:13:57 | arkanoid | I'm working with ARC |
02:17:48 | FromDiscord | <Elegantbeef> Here you go ark https://play.nim-lang.org/#ix=3HxO |
02:19:13 | arkanoid | whoa! seems complicated. Thanks |
02:20:34 | FromDiscord | <Elegantbeef> Though i think there is an issue with overloads |
02:25:35 | * | arkurious quit (Quit: Leaving) |
02:30:21 | FromDiscord | <Sabena Sema> yeah smartpointers basically work like the c++ ones |
02:30:37 | FromDiscord | <Sabena Sema> using a ref is _usually_ better |
02:31:47 | FromDiscord | <Rika> What case would the former be better then |
02:56:50 | FromDiscord | <Sabena Sema> interop comes to mind |
02:57:17 | FromDiscord | <Sabena Sema> more immediate refcount ops / frees |
03:02:29 | FromDiscord | <IsaacPaul> sent a long message, see http://ix.io/3HxZ |
03:03:44 | FromDiscord | <IsaacPaul> (edit) "http://ix.io/3HxZ" => "http://ix.io/3Hy0" |
03:05:44 | FromDiscord | <IsaacPaul> For release apps you will need to provide a proper .app package with the dynamic file inside. |
03:20:16 | arkanoid | what's the advantage of useMalloc or not? |
03:20:46 | arkanoid | I'm using it to enable valgrind profiling, but apart from that, is there a reason why I should use useMalloc? |
03:21:22 | FromDiscord | <Elegantbeef> Embedded is one reason |
03:21:24 | FromDiscord | <Rika> When you’re using a custom allocator that shims malloc? |
03:22:19 | FromDiscord | <hieu.nt> is there any tutorial to upload file to google drive using nim. I found this on nim website https://nim-lang.org/docs/httpclient.html |
03:22:32 | FromDiscord | <hieu.nt> but i dont know how to handle the authentication process with nim |
03:23:04 | FromDiscord | <Elegantbeef> https://github.com/treeform/googleapi/blob/master/src/googleapi/drive.nim |
03:23:34 | FromDiscord | <Elegantbeef> Wait it only has list 😀 |
03:23:56 | FromDiscord | <Elegantbeef> Either way it shows how |
03:25:09 | FromDiscord | <theSherwood> Is there any way to do hot module reloading in nim? |
03:25:38 | FromDiscord | <Elegantbeef> There is https://nim-lang.org/docs/hotcodereloading.html but i hear the experience isnt great |
03:25:57 | FromDiscord | <Elegantbeef> You could also use a plugin system |
03:27:04 | FromDiscord | <theSherwood> Are there any libraries in the ecosystem that can handle that automagically? |
03:27:05 | FromDiscord | <Elegantbeef> I guess teh better thing would be to link https://nim-lang.org/docs/hcr.html |
03:27:44 | FromDiscord | <Elegantbeef> https://nimble.directory/search?query=plugin there are a few plugin systems |
03:28:01 | FromDiscord | <theSherwood> Cheers! |
03:28:03 | FromDiscord | <Elegantbeef> Why are you after hot code reloading if i may ask? |
03:28:31 | FromDiscord | <theSherwood> I'm a web dev and I've grown accustomed to a rapid feedback cycle during development. |
03:29:05 | * | xet7 joined #nim |
03:29:50 | FromDiscord | <Elegantbeef> Well to make it a bit faster you can use TCC to get the c compiler time down |
03:30:16 | * | xet7 quit (Remote host closed the connection) |
03:30:31 | FromDiscord | <theSherwood> Is that a compiler option I can set? |
03:31:00 | FromDiscord | <Elegantbeef> If you have the TCC compiler in your path you can d `--cc:tcc` |
03:31:13 | FromDiscord | <Elegantbeef> Yes i realize `TCC compiler` is redundant |
03:31:29 | FromDiscord | <Elegantbeef> I guess that assumes you're doing C compiled Nim and not JS/C++ compiled |
03:33:53 | FromDiscord | <theSherwood> Yeah, C-compiled-Nim. At the moment I'm just playing around with building a toy terminal editor. |
03:34:48 | FromDiscord | <theSherwood> Thanks for the help, @ElegantBeef |
03:34:55 | FromDiscord | <Elegantbeef> No problem |
03:42:41 | FromDiscord | <hieu.nt> i also want to ask is there a way to share variables between 2 modules or 2 nim file without circular dependency |
03:42:59 | FromDiscord | <hieu.nt> for example partial class in C# |
03:48:27 | FromDiscord | <Elegantbeef> You might be able to if you properly position imports but it requires though to where you import |
03:48:34 | FromDiscord | <Elegantbeef> Generally it's just suggested you dont design code that way |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:07:52 | FromDiscord | <ajusa> In reply to @ajusa "3ds": Just got this working - Nim's sdl bindings lightly tweaked running fine on a 3DS. Going to work on adding =destroy hooks to make the SDL resources get cleaned up automatically. |
04:10:53 | FromDiscord | <IsaacPaul> Awesome. Looking forward to seeing your progress |
04:28:07 | FromDiscord | <ajusa> For some reason I can't get it to work on my computer though lol, the mp3 plays on the 3DS but it doesn't work normally. I'm probably messing up some dynamic library thing with Nim and the existing SDL bindings |
04:30:00 | * | rockcavera quit (Remote host closed the connection) |
04:30:35 | FromDiscord | <Sabena Sema> In reply to @theSherwood "I'm a web dev": you can have a hook that recompiles your code on changes and just restarts the whole thing |
04:30:52 | FromDiscord | <Sabena Sema> doing actual hot code reloading without a jit or interpreter is super hard |
04:31:53 | FromDiscord | <Sabena Sema> In reply to @hieu.nt "i also want to": you can use importc and exportc |
04:35:04 | FromDiscord | <Sabena Sema> actually .... does nim have a way (besides {.emit.}) to get selectany behavior on a symbol, where the linker is told to just throw out all but one |
04:36:38 | FromDiscord | <Sabena Sema> eagh it's so linker / exe format specific I'd expect not |
04:43:40 | FromDiscord | <demotomohiro> In reply to @hieu.nt "i also want to": Just declare variables with export marker `` in a module and import it in a module you want to use the variable:↵https://wandbox.org/permlink/qUkkV1FrZPjoHUX1 |
04:58:22 | FromDiscord | <Michal58> In reply to @ni-max "... continued from our": created a PR: https://github.com/nim-lang/Nim/pull/19233 |
05:02:58 | FromDiscord | <Sabena Sema> why is that even undefined? |
05:03:39 | FromDiscord | <Sabena Sema> like addLast(result, item) where both result and item have types dependent on T should pull in addLast even if it was defined after toDeque |
05:03:46 | FromDiscord | <Sabena Sema> unless my understanding of how generics work is very wrong |
05:17:57 | FromDiscord | <Elegantbeef> It needs to have a valid symbol that matches the signature for it to work |
05:18:05 | FromDiscord | <Elegantbeef> So it's odd that it didnt cause an issue before |
05:18:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Hyq |
05:31:33 | FromDiscord | <Michal58> In reply to @Sabena Sema "like addLast(result, item) where": I don't understand what you are saying |
05:31:40 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3Hyt |
05:34:32 | FromDiscord | <Sabena Sema> In reply to @Michal58 "I don't understand what": typically generics will look up function names where the result of overload resolution could depend on type parameters in the instantiation context |
05:35:14 | FromDiscord | <Michal58> In reply to @Sabena Sema "typically generics will look": I understand that, but don't udnerstand how it is relevant here. |
05:39:38 | FromDiscord | <Schelz> Anyone know how to compile subhook nim file with cpp ? Please ping me.. |
05:48:02 | FromDiscord | <Sabena Sema> In reply to @Michal58 "I understand that, but": well, the result of overload resolution for addLast could well depend on T |
05:48:26 | FromDiscord | <Sabena Sema> oh I see |
05:48:28 | FromDiscord | <Sabena Sema> you need at least one |
07:01:37 | FromDiscord | <Xzight> any users of `dimscord` here? I can't get the quick example from the readme to work lol |
07:03:25 | FromDiscord | <Elegantbeef> What's the issue you're having |
07:03:27 | FromDiscord | <Elegantbeef> That makes life easier |
07:05:02 | FromDiscord | <Xzight> Well I assume the problems are specific to the package but I am getting an "Illformed AST" and "Template/generic instantiation of "event" from here |
07:05:10 | FromDiscord | <Xzight> (edit) "here" => "here"" |
07:07:08 | FromDiscord | <Elegantbeef> remove `some` on line 29 and it solves it |
07:07:22 | FromDiscord | <Elegantbeef> The issue was a type mismatch so the error output says the exact issue |
07:12:39 | FromDiscord | <Xzight> Ohh thank you! |
07:32:14 | * | PMunch_ is now known as PMunch |
07:42:31 | FromDiscord | <retkid> nim is a system lang and this is off topic (?) but i would just like to say that frontend sucks |
07:42:40 | FromDiscord | <retkid> that is all |
07:45:01 | FromDiscord | <Rika> It's harder for regular programmers |
07:45:15 | FromDiscord | <Rika> You'd prolly be closer to a designer for front end to be easy |
08:14:11 | FromDiscord | <valerga> how can I do `for i, m in needed` in reverse? |
08:14:41 | FromDiscord | <valerga> i should be the index of the item |
08:16:53 | FromDiscord | <valerga> do i need to reverse the seq first? |
08:17:35 | FromDiscord | <retkid> In reply to @Rika "You'd prolly be closer": i can make music, i can program, i can make some kinds of art |
08:17:41 | FromDiscord | <retkid> but this kinda just sucks |
08:18:18 | FromDiscord | <retkid> In reply to @valerga "how can I do": so you can do 1 or 2 things: |
08:18:24 | FromDiscord | <retkid> you c an iterate over len()-1 |
08:18:27 | FromDiscord | <retkid> (edit) "c an" => "can" |
08:18:41 | FromDiscord | <retkid> (edit) "len()-1" => "-(len()-1)" |
08:18:45 | FromDiscord | <Rika> Three things actually, you can make a reverse iterator |
08:18:48 | FromDiscord | <retkid> or you can reverse it |
08:18:51 | FromDiscord | <retkid> or make a reverse iterator |
08:18:57 | FromDiscord | <ni-max> In reply to @valerga "how can I do": maybe: `for i in countdown(needed.high, 0)` |
08:19:02 | FromDiscord | <valerga> what about reversed(x) from algorithm? |
08:19:10 | FromDiscord | <Rika> That is reversing the sequence |
08:19:19 | FromDiscord | <retkid> countdown is in the stdlib |
08:19:30 | FromDiscord | <retkid> In reply to @valerga "what about reversed(x) from": well, it that works then do it |
08:19:34 | FromDiscord | <retkid> but |
08:19:39 | FromDiscord | <valerga> reversing the iterator sounds better |
08:20:03 | FromDiscord | <retkid> (edit) "it" => "if" |
08:20:20 | FromDiscord | <retkid> i mean, if you really care, the only differences is readability and speed |
08:20:40 | FromDiscord | <retkid> also guys should i be using .high or be using .len()-1 |
08:21:41 | FromDiscord | <Rika> Speed is pretty important |
08:21:52 | FromDiscord | <Rika> Use high as much as possible if you are using them as indexes |
08:21:58 | FromDiscord | <Rika> Indexes indices whichever the word |
08:22:06 | FromDiscord | <retkid> w3ell |
08:22:09 | FromDiscord | <retkid> (edit) "w3ell" => "well" |
08:22:38 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/918779728045948928/unknown.png |
08:23:02 | FromDiscord | <retkid> theres like another project not on this partition where i did it like 20 times and it caused so many reability problems |
08:23:06 | FromDiscord | <retkid> (edit) "reability" => "readability" |
08:23:19 | FromDiscord | <Rika> That’s why there is high |
08:23:32 | FromDiscord | <Rika> In reply to @ni-max "maybe: `for i in": Also better to use low over 0 haha |
08:23:40 | FromDiscord | <retkid> really |
08:23:41 | FromDiscord | <retkid> why? |
08:23:53 | FromDiscord | <retkid> isn't 0 faster? |
08:24:07 | FromDiscord | <Rika> It’s not always correct |
08:24:21 | FromDiscord | <Rika> Arrays can start at any number |
08:24:32 | FromDiscord | <Rika> That matters if you’re using a generic iterator |
08:24:35 | FromDiscord | <Rika> Or making one |
08:24:43 | FromDiscord | <retkid> i dont usually use arrays |
08:24:44 | FromDiscord | <Rika> If not, I’d still recommend using it |
08:25:07 | FromDiscord | <Rika> Maybe in the future Nim will get sequences that start at arbitrary numbers |
08:25:21 | FromDiscord | <Rika> Less work to fix your code in the future |
08:25:35 | FromDiscord | <retkid> i dont like that |
08:25:52 | FromDiscord | <retkid> i like just doing [0] and getting the first indice |
08:26:19 | FromDiscord | <Rika> Likewise I don’t like that 🙂 |
08:26:36 | FromDiscord | <Rika> Do what you want really |
08:26:42 | FromDiscord | <retkid> we must fight do the death |
08:27:13 | FromDiscord | <Rika> Do you want to fight someone trained in martial arts 😛 I’m joking |
08:27:31 | FromDiscord | <ni-max> 😆 |
08:27:33 | FromDiscord | <Rika> Not about the martial arts thing though |
08:28:27 | FromDiscord | <ni-max> anyone? https://discordapp.com/channels/371759389889003530/371759389889003532/918601071872602152 |
08:29:05 | FromDiscord | <Rika> Didn’t someone reply to you |
08:29:53 | FromDiscord | <ni-max> Micheal opened a pull request for workaround but I'm not sure what's going on here |
08:31:02 | FromDiscord | <ni-max> I think there's some magic with generics causing this |
08:32:21 | FromDiscord | <ni-max> no problem without generics |
08:33:56 | FromDiscord | <ni-max> also compiles if we re import `deques` in `n.nim` |
08:37:46 | FromDiscord | <ni-max> and already merged by Araq in devel branch↵but I'm afraid It will get us again somewhere... |
08:38:15 | * | jjido joined #nim |
08:55:26 | FromDiscord | <Sabena Sema> I still think it' |
09:00:18 | FromDiscord | <Sabena Sema> I still don't quite understand why such a dependent function needs to be declared before the declaration context of the generic |
09:00:35 | FromDiscord | <Sabena Sema> how are you even supposed to declare such a function that you expect users to add more overloads of? |
09:01:20 | FromDiscord | <Sabena Sema> (C++ kinda does this too, wherin qualified dependent functions are not required to have a definition but unqualified ones that resolve via ADL are) |
09:04:44 | FromDiscord | <Sabena Sema> it's likely I just have c++ brainworms tho |
09:05:18 | FromDiscord | <Sabena Sema> oh yeah |
09:05:19 | FromDiscord | <Sabena Sema> I do |
09:06:18 | FromDiscord | <Sabena Sema> wait, so a function has to _actually be overloaded_ for dependent references to it to be open in generics? |
09:06:44 | FromDiscord | <Sabena Sema> or if it's actually overloaded (in the definition context of the generic) then it's open no matter if it's dependent or not |
09:11:05 | FromDiscord | <ni-max> I thinks this is the case, Is it ok? |
09:11:12 | FromDiscord | <ni-max> (edit) "thinks" => "think" |
09:12:45 | FromDiscord | <Sabena Sema> I mean it's unexpected (for me) but is probably fine |
09:13:07 | FromDiscord | <Sabena Sema> it's a little odd that adding a second overload of something before a generic definition can cause symbols to become open |
09:17:41 | FromDiscord | <ni-max> I'm still very new to Nim. Guess I should re-evaluate after I work more with templates/generics in Nim |
09:17:56 | FromDiscord | <n00nehere> how can i use proxy with authentication in nim? |
09:18:02 | FromDiscord | <Sabena Sema> tbh this is just me assuming that nim features have the same semantics as c++ ones |
09:18:09 | FromDiscord | <Sabena Sema> and tbh they do tend to be very close |
09:19:22 | FromDiscord | <Sabena Sema> the overload resolution rules are essentially identical (aside from I think not having partial ordering by constraints I think) |
09:19:26 | FromDiscord | <Sabena Sema> (edit) "constraints I think)" => "constraints)" |
09:20:30 | FromDiscord | <ni-max> In reply to @n00nehere "how can i use": `std/httpclient` has support for http/https proxies: https://nim-lang.org/docs/httpclient.html#autolink-3819 |
09:22:21 | FromDiscord | <ni-max> (edit) "https://nim-lang.org/docs/httpclient.html#autolink-3819" => "https://nim-lang.org/docs/httpclient.html#proxy" |
09:24:33 | FromDiscord | <ni-max> @Sabena Sema oh by the way in this case that addLast func is also a generic function! |
09:24:37 | FromDiscord | <hieu.nt> hi guys |
09:24:44 | FromDiscord | <hieu.nt> so install some package in nim |
09:24:55 | FromDiscord | <hieu.nt> (edit) "nim" => "nimble" |
09:25:27 | FromDiscord | <hieu.nt> but my project doesnt have something like package-lock.json |
09:26:12 | FromDiscord | <hieu.nt> how do other computer get this dependencies when they pull the project |
09:26:30 | FromDiscord | <Sabena Sema> they resolve the dependencies themselves |
09:26:33 | PMunch | If you define them in your .nimble file then `nimble build` will install them |
09:26:38 | FromDiscord | <Sabena Sema> lock files are an insane default imo |
09:27:01 | FromDiscord | <Sabena Sema> you can use `nimble lock` if you really need one |
09:28:35 | FromDiscord | <hieu.nt> In reply to @PMunch "If you define them": so i have to make a .nimble file then commit them along the project right ? Is there any way to create this file automatically |
09:29:14 | FromDiscord | <Sabena Sema> `nimble init` |
09:29:25 | FromDiscord | <Sabena Sema> the nimble file is the metadata file for your project |
09:29:38 | FromDiscord | <Sabena Sema> like `package.json` |
09:30:33 | FromDiscord | <hieu.nt> thanks @Sabena Sema let me try |
09:31:06 | PMunch | You can also define tasks in it |
09:32:36 | FromDiscord | <Sabena Sema> generally you should need to do _much_ less build system scripting than in C/C++, since the compiler itself has built in support for doing most things (and automatically handles dependency info in those cases) but it's there if ya need it |
09:32:51 | PMunch | It's a mix between a project definition, a dependency list, and a makefile |
09:35:03 | FromDiscord | <hieu.nt> I try and it a bit more complex than my need. Really just want a much more simple and straightforward way to list some of the nimble package that i install on my work machine |
09:35:22 | FromDiscord | <Sabena Sema> in that case ... just list them |
09:35:25 | FromDiscord | <hieu.nt> so other machine can auto pull these package when they pull the project |
09:35:37 | FromDiscord | <hieu.nt> (edit) "machine" => "machines" | "package" => "packages" |
09:36:07 | FromDiscord | <Rika> It isn't complex |
09:36:11 | FromDiscord | <Rika> You initialise the project |
09:36:11 | FromDiscord | <hieu.nt> nimble doesnt seem to install the dependencies in the project folder so i cannot commit them as well. |
09:36:18 | FromDiscord | <Rika> You edit the file to have the dependencies |
09:36:20 | FromDiscord | <Rika> Then that's it |
09:36:52 | FromDiscord | <Sabena Sema> if you want something like python's requirements.txt just write someting that looks like it and do: `xargs -a requirements.txt nimble install` or similar |
09:37:34 | FromDiscord | <hieu.nt> In reply to @Sabena Sema "if you want something": its actually a good idea |
09:37:56 | FromDiscord | <Sabena Sema> but ... really just write a .nimble file |
09:38:09 | FromDiscord | <Rika> It's not much different |
09:38:36 | FromDiscord | <Sabena Sema> sidenote: python's requirements.txt thing is _completely_ nuts |
09:38:49 | FromDiscord | <Rika> Why so? I don't remember much about it |
09:38:53 | FromDiscord | <Rika> Tried not to remember |
09:39:29 | FromDiscord | <Sabena Sema> if you have a setuptools package there's no great way to share the dependency info between requirements.txt and the setuptools package, esp if you want to use the setup.cfg/pyproject.toml format |
09:39:54 | FromDiscord | <Sabena Sema> and thus if you are using those formats it's basically impossible to install the dependencies of a project _without_ installing the project itself |
09:40:36 | FromDiscord | <Sabena Sema> the only way to do it "right" is to use setup.py and run `python setup.py egg-info` then you get like `.egg-info/requirements` that you can pass to pip |
09:41:06 | FromDiscord | <Rika> I don't even follow anymore |
09:41:19 | FromDiscord | <Rika> I don't know what some of these terms are |
09:42:42 | FromDiscord | <Sabena Sema> I'm not actually 100% sure if nimble supports installing all the deps of a package without also installing the package itself |
09:42:58 | FromDiscord | <Sabena Sema> but build will do it |
09:43:37 | FromDiscord | <Sabena Sema> and I bet the nimble maintainers would actually accept such a feature, instead of the setuptools maintainers who basically couldn't imagine why that could ever be useful |
09:44:23 | FromDiscord | <Rika> In reply to @Sabena Sema "and I bet the": So it's a maintainer issue, great |
09:44:56 | FromDiscord | <Sabena Sema> The other issue is that it's muddled with requirements.txt |
09:45:15 | FromDiscord | <Sabena Sema> and requirements.txt is _way_ more than just a list of version specifications |
09:45:54 | FromDiscord | <Rika> It is? |
09:46:13 | FromDiscord | <Sabena Sema> yeah |
09:46:23 | FromDiscord | <Sabena Sema> there's a bunch of pip manipulations you can do |
09:46:43 | FromDiscord | <Sabena Sema> like list some deps, then change the install prefix to a different site-packages, then list more deps |
09:46:45 | FromDiscord | <Sabena Sema> that kinda stuf |
09:46:46 | FromDiscord | <Sabena Sema> (edit) "stuf" => "stuff" |
09:46:58 | FromDiscord | <ni-max> In reply to @Sabena Sema "it's a little odd": I found a relative docs: https://nim-lang.org/docs/manual.html#generics-symbol-lookup-in-generics |
09:47:09 | FromDiscord | <Sabena Sema> yeah, I read that but need to play around |
09:47:22 | FromDiscord | <Sabena Sema> also the example for delegated binding might be misleading |
09:48:00 | FromDiscord | <Rika> That's scary, the requirements file one |
09:48:58 | FromDiscord | <Sabena Sema> yeah, it really is basically a list of command line args |
09:49:04 | FromDiscord | <Sabena Sema> and pip's command line interface is really complex |
10:05:03 | FromDiscord | <pmunch> No it's not↵(@hieu.nt) |
10:06:59 | PMunch | Just do it the way the ecosystem you're using expects it to be done. Don't try to force a solution based on something from a different ecosystem when we already have a solution for this. It's bound to just create confusion and headaches for everyone. |
10:08:01 | PMunch | And why would you want to commit all your packages anyways? That's not how you're supposed to do it in any language that I'm aware of |
10:08:21 | FromDiscord | <Elegantbeef> Git submodules goes brr↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:08:51 | FromDiscord | <Elegantbeef> I may or may not have dumbly hit reply on that message |
10:12:45 | PMunch | I don't really see which message you replied to |
10:12:55 | PMunch | I just see @709044657232936960_=50=4dunch=5b=49=52=43=5d |
10:13:52 | FromDiscord | <Elegantbeef> It was your most recent message |
10:14:06 | FromDiscord | <Elegantbeef> I just dumbly clicked reply |
10:38:30 | FromDiscord | <dom96> In reply to @Sabena Sema "if you want something": Yeah. Please don’t do this. |
10:38:50 | FromDiscord | <dom96> Grab the new nimble and help us test the lock files |
10:40:33 | FromDiscord | <Sabena Sema> yeah, it's probably not a good idea but it does what he asked for |
10:41:10 | FromDiscord | <Sabena Sema> I can see it being useful in cases where nimble isn't running the show I guess |
10:41:27 | FromDiscord | <Sabena Sema> OK looking at https://nim-lang.org/docs/manual.html#generics-delegating-bind-statements and the whole section just ... makes no sense |
10:41:59 | FromDiscord | <Sabena Sema> the examples don't compile for unrelated reasons (B doesn't import A, so can't write `genericA(x)` no matter what it does with the `init` symbol |
10:42:24 | FromDiscord | <Sabena Sema> also `init` takes a `var O` and the `T` in `genericB` isn't going to bind to that |
10:42:51 | FromDiscord | <Sabena Sema> if those issues are corrected then the bind statement isn't required to make things work |
10:43:19 | FromDiscord | <Sabena Sema> even if B stops importing C and the type definition for O moves to B things _still_ work |
10:44:00 | FromDiscord | <Sabena Sema> is this just a relic from an era where generic symbol binding was insane or is there a real problem here that I'm not able to see |
10:44:11 | FromDiscord | <Sabena Sema> if the first should this whole section be deleted from the docs? |
10:47:50 | FromDiscord | <Sabena Sema> like this all only makes sense to me if the "instantiation context" of genericA is the "_definition_ context" of genericB, but, because the `genericA(x)` function call is dependent it seems to be open (even though there's no overloading involved here) |
10:48:14 | FromDiscord | <Sabena Sema> and, since it's open you'd think the instantiation context would be in `main` |
11:21:45 | FromDiscord | <Araq> create an issue about it |
11:24:02 | FromDiscord | <Araq> but sometimes the manual tries to explain a concept without giving complete, fully compilable examples |
11:55:52 | FromDiscord | <Sabena Sema> yeah, if the solution was just “its old info” id make a pr removing it too |
11:56:04 | FromDiscord | <Sabena Sema> but it seems like an issue will be helpful |
11:56:26 | FromDiscord | <Sabena Sema> Ill create one tomorrow |
12:03:07 | FromDiscord | <Southern_Cross_Au> In reply to @Southern_Cross_Au "": I've solved the issue with the GCC compiler. turns out I had another language installed that also used the same compiler - I think it was Hax or something. After I cleared those Path bindings and uninstalled NIM is working perfectly |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:15:05 | FromDiscord | <Rika> It shouldn't have matteres |
12:15:07 | FromDiscord | <Rika> Mattered |
12:17:37 | PMunch | Maybe the other language had created a gcc wrapper or something |
12:31:19 | FromDiscord | <hmmm> yo how do I get a seq of all the keys in a std/table |
12:39:30 | FromDiscord | <evoalg> `t.keys.toSeq` ? |
12:53:43 | FromDiscord | <hmmm> seems reasonable |
12:56:19 | NimEventer | New Nimble package! spfun - Special Functions of Stats & Physics, see https://github.com/c-blake/spfun |
13:02:31 | * | lumo_e joined #nim |
13:10:41 | * | rockcavera joined #nim |
13:10:41 | * | rockcavera quit (Changing host) |
13:10:41 | * | rockcavera joined #nim |
13:10:41 | FromDiscord | <gogolxdong (liuxiaodong)> Is while true + async = memory leaks |
13:14:51 | FromDiscord | <gogolxdong (liuxiaodong)> Will cps avoid this, and how? |
13:16:30 | FromDiscord | <hmmm> so I have been wanting to ask for a while...if I keep defining procs with the [T] thingy, how is that even different from writing python |
13:16:57 | FromDiscord | <hmmm> I mean, it's possibly something that shouldn't be done excessively right? |
13:17:19 | FromDiscord | <hmmm> 🤔 |
13:17:40 | FromDiscord | <konsumlamm> what does that have to do with python? |
13:17:49 | FromDiscord | <hmmm> python has no type checks |
13:18:17 | PMunch | Not quite |
13:18:25 | PMunch | I mean the T will get a type at some point |
13:18:43 | PMunch | So you still won't have runtime errors from calling + 10 on a string for example |
13:18:45 | FromDiscord | <hmmm> I mean the entire reason we annotate the types is that we want the compiler to make the checks right |
13:19:16 | FromDiscord | <gogolxdong (liuxiaodong)> memory grows fast |
13:20:08 | PMunch | Sure, but T is essentially a way of saying "this procedure can take many types, if you try a type and it doesn't work you'll get an error from within it". But in general you only use T for things like seq[T] for example |
13:20:31 | FromDiscord | <hmmm> I see yea |
13:20:49 | PMunch | Like `proc add[T](x: var seq[T], y: T)`. That should obviously work for all T's |
13:21:02 | PMunch | You can also constrict T |
13:21:23 | PMunch | `proc test[T: int or string](x: T)` for example |
13:21:27 | FromDiscord | <hugogranstrom> sent a code paste, see https://play.nim-lang.org/#ix=3HAs |
13:22:00 | PMunch | Yes, this ^ |
13:22:01 | FromDiscord | <hmmm> yea yea now I get it, so it's ok to abuse T to make the procs as general as possible when it makes sense |
13:22:13 | PMunch | Of course, that's what it is for |
13:22:24 | FromDiscord | <hmmm> I see 😃 |
13:22:37 | FromDiscord | <vindaar> the "when it makes sense" really is the important bit here |
13:22:43 | PMunch | If you only pass your procedure along to a container or to a procedure for example it's totally fine |
13:23:21 | PMunch | gogolxdong_(liuxiaodong), while true + async isn't inherently memory leaks. But you certainly need to manage your async pool |
13:24:02 | PMunch | Like if you don't want to call `runForever` you need to somehow call the async runtime to make sure your stuff completes |
13:24:23 | PMunch | If you just schedule a bunch of tasks but never let the runtime run it will pile up memory |
13:29:45 | FromDiscord | <gogolxdong (liuxiaodong)> you mean the cps pattern? |
13:40:34 | PMunch | I don't believe so |
13:40:42 | PMunch | What are you currently doing? |
13:41:28 | FromDiscord | <gogolxdong (liuxiaodong)> runing multiple of this process, memory grows fast, wonder how |
13:44:57 | PMunch | Hard to tell without knowing what you're doing |
13:53:04 | * | src joined #nim |
14:04:45 | * | arkurious joined #nim |
14:05:11 | * | terminalpusher joined #nim |
14:16:37 | FromDiscord | <0xc45> sent a code paste, see https://play.nim-lang.org/#ix=3HAP |
14:17:14 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:18:25 | * | CyberTailor joined #nim |
14:19:05 | CyberTailor | i can't build nimble from source :( |
14:19:08 | CyberTailor | sha1hashes.nim(37, 10) Error: undeclared identifier: 'isValidSha1Hash' |
14:22:49 | PMunch | The Nimble devel branch probably requires the Nim devel branch to build |
14:23:01 | PMunch | Try `choosenim devel` |
14:23:43 | PMunch | As you can see `isValidSha1Hash` was introduced to support lock files in Nimble, and I don't think that has been merged into a stable release yet: https://github.com/nim-lang/Nim/blame/46275126b89218e64844eee169e8ced05dd0e2d7/lib/std/sha1.nim#L279 |
14:27:51 | * | terminalpusher quit (Remote host closed the connection) |
14:32:14 | FromDiscord | <gogolxdong (liuxiaodong)> I'm listening on 14 of our accounts to transfer BNB if any available , someone else is trying to charge gas fee to claim our rewards, they can transfer ours if we charge. |
14:36:40 | FromDiscord | <gogolxdong (liuxiaodong)> the most important is processes run steady and could let us sleep tight without worrying OOM, otherwise we will probably lose money. |
14:49:23 | FromDiscord | <gogolxdong (liuxiaodong)> use process instead of thread because the bug post previously. |
14:50:13 | PMunch | That didn't really make it any clearer to me what you're actually doing in your code |
14:55:56 | * | pch quit (Ping timeout: 268 seconds) |
14:59:59 | * | PMunch quit (Quit: Leaving) |
15:02:36 | CyberTailor | PMunch: i've built devel branch of nim, now i get this error: |
15:02:38 | CyberTailor | Error: cannot open file: compiler/nimblecmd |
15:05:11 | * | lumo_e quit (Ping timeout: 268 seconds) |
15:12:01 | arkanoid | I have to cluster a folder of man made text files into groups according to the file header. The headers share some similarities but due to being man made in not possible to just consider it a segnature. Possibly a quasi-signature, or fuzzy signature. How would you tackle this? |
15:13:02 | FromDiscord | <gogolxdong (liuxiaodong)> It generally creates web3 connection and keeps sending transaction . |
15:14:49 | FromDiscord | <gogolxdong (liuxiaodong)> Does it work if replace await with waitFor? |
15:16:54 | FromDiscord | <TryAngle> how do I downgrade nim for a project? |
15:17:03 | FromDiscord | <TryAngle> I would like to use nim 1.5 for one |
15:17:31 | FromDiscord | <Rika> nim 1.5 is not a stable version just fyi |
15:18:12 | FromDiscord | <TryAngle> the dimscord bot seems to not work on 1.6.0 but should work on prior versions as far as I understood |
15:18:40 | FromDiscord | <Rika> use 1.4 then (choosenim 1.4 i think) |
15:18:44 | FromDiscord | <Rika> (edit) "(choosenim 1.4" => "(`choosenim 1.4`" |
15:19:43 | CyberTailor | submitting nimble PR without testing feels wrong, but i can't test it :( |
15:25:03 | FromDiscord | <hmmm> hey boiz since our sqlite module was complaining about not finding sqlite_64.dll I went to the official site and downloaded it. But apparently their dll is named sqlite.dll without the _64 part. I ended up renaming it and slapping it in the folder of my nim file but feels like pretty dumb. Should I just make a dedicated folder and add to the PATH? |
15:25:17 | * | lumo_e joined #nim |
15:26:08 | FromDiscord | <hmmm> or there is an approved way of installing sqlite I don't know of |
15:27:34 | FromDiscord | <gogolxdong (liuxiaodong)> Is there any solution for this code? |
15:43:28 | FromDiscord | <TryAngle> In reply to @Rika "use 1.4 then (`choosenim": ok works ty |
15:51:48 | * | CyberTailor quit (Remote host closed the connection) |
15:52:39 | * | CyberTailor joined #nim |
17:16:26 | FromDiscord | <retkid> is there any convenient way to wasm compile? |
17:44:31 | * | xet7 joined #nim |
18:00:09 | FromDiscord | <TryAngle> what would be the default way to deserialize a type to json? |
18:01:18 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3HCo |
18:46:02 | * | advesperacit joined #nim |
19:08:26 | FromDiscord | <hmmm> woa I was fighting an entire afternoon vs db_sqlite when we have the vastly superior tiny_sqlite. After this and JSON -> jsony, my faith in std is shaken. I heard Araq wants to unbundle all the stuff, I thing he is right, we need to use the fresh stuff 🧐 |
19:12:32 | * | lumo_e quit (Remote host closed the connection) |
19:12:53 | * | lumo_e joined #nim |
19:16:18 | * | krux02 joined #nim |
19:23:41 | * | lumo_e quit (Ping timeout: 250 seconds) |
19:38:40 | NimEventer | New question by Netsu: How to get user ID by username/mention - Telegram bot api, see https://stackoverflow.com/questions/70309590/how-to-get-user-id-by-username-mention-telegram-bot-api |
19:40:42 | FromDiscord | <spotlessapple> sent a code paste, see https://play.nim-lang.org/#ix=3HCM |
19:41:10 | FromDiscord | <spotlessapple> (edit) "https://play.nim-lang.org/#ix=3HCM" => "https://play.nim-lang.org/#ix=3HCN" |
19:42:27 | FromDiscord | <hmmm> maybe this: https://github.com/technicallyagd/unpack |
19:45:45 | FromDiscord | <spotlessapple> In reply to @hmmm "maybe this: https://github.com/technicallyagd/unpac": Thanks @hmmm ! I did see that, but I believe that focuses mainly on destructuring into predefined variables. I'm more looking for the case of passing an unknown number of variables from a sequence as arguments to a proc/func |
19:46:53 | * | PMunch joined #nim |
19:50:57 | FromDiscord | <hmmm> hmm I don't know then. Maybe people more skilled than me can craft a macro for it 😃 |
20:03:02 | FromDiscord | <geekrelief> In reply to @spotlessapple "Thanks <@887269570765791243> ! I": Here's a macro to do it: https://play.nim-lang.org/#ix=3HCU |
20:05:13 | FromDiscord | <geekrelief> actually looks like like there's a bug when I pass in variable that's an array as opposed to a literal |
20:05:29 | advesperacit | is there any way to remove async traceback output? |
20:09:18 | * | terminalpusher joined #nim |
20:19:13 | FromDiscord | <geekrelief> In reply to @spotlessapple "Thanks <@887269570765791243> ! I": This should work now https://play.nim-lang.org/#ix=3HCZ |
20:20:19 | FromDiscord | <spotlessapple> In reply to @geekrelief "This should work now": Excellent, thanks for the help @geekrelief ! |
20:20:44 | FromDiscord | <geekrelief> np, I've been meaning to write this anyway 🙂 I'll put it up on gist |
20:21:53 | FromDiscord | <geekrelief> https://gist.github.com/geekrelief/d786f01f89d20090f30e4d7ef2325a8e |
20:27:14 | * | vicecea quit (Remote host closed the connection) |
20:27:45 | * | vicecea joined #nim |
20:28:14 | FromDiscord | <geekrelief> In reply to @spotlessapple "Excellent, thanks for the": pushed an update to the gist to also handle seq |
20:30:40 | FromDiscord | <geekrelief> ahh.. I should handle tuples too |
20:35:32 | FromDiscord | <hmmm> and suddenly it became a library 😆 |
20:36:15 | FromDiscord | <hmmm> should be named the helping relief 🤔 |
20:36:44 | FromDiscord | <geekrelief> haha yeah |
20:36:48 | FromDiscord | <geekrelief> it handles tuples now |
20:38:23 | FromDiscord | <hmmm> damn macros look hard to write |
20:38:56 | * | krux02 quit (Remote host closed the connection) |
20:39:00 | FromDiscord | <geekrelief> In reply to @hmmm "damn macros look hard": at first, it seems hard, but once you understand the tools to do it, it's addicting |
20:39:20 | nrds | <Prestige99> They're pretty unreadable though |
20:39:24 | FromDiscord | <geekrelief> basically use `dumpAstGen` and `astGenRepr` to figure out the structure of what you want to create |
20:39:29 | PMunch | Yeah macros look tricky, but they're not that hard to write |
20:39:33 | FromDiscord | <geekrelief> In reply to @nrds "<Prestige> They're pretty unreadable": nah |
20:39:40 | PMunch | @geekrelief, glad to see that my tools are actually getting used :) |
20:39:45 | FromDiscord | <geekrelief> anyone comfortable writing macros can read them |
20:39:54 | PMunch | Ehhm |
20:40:06 | PMunch | I can barely even read my own macros :P |
20:40:06 | FromDiscord | <hmmm> what's the absolute novice macro primer on shooting your foot with macros? |
20:40:21 | FromDiscord | <geekrelief> I've jumped into some crazy looking macros in godot-nim |
20:40:34 | FromDiscord | <geekrelief> "readable" to me is debuggable |
20:40:49 | PMunch | @hmmm, I wrote this https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
20:41:05 | FromDiscord | <geekrelief> for the most part if I don't understand something I can drop in an `echo node.astGenRepr` and go from there |
20:41:08 | PMunch | Takes you from a small program, to a small program with macros |
20:41:21 | PMunch | Oh yeah, that's true |
20:42:19 | PMunch | But I mean, look at this and tell me it's readable :P https://github.com/PMunch/protobuf-nim/blob/master/src/protobuf.nim#L555 |
20:43:14 | FromDiscord | <geekrelief> For anyone scared of macros, don't be. Just take it slow. The NimNodes are a tree, each with a `kind` field. From there you just need to know that each kind of node has a certain number of children that expect to be certain kinds of nodes. |
20:43:29 | FromDiscord | <geekrelief> The docs cover it well. |
20:43:39 | FromDiscord | <geekrelief> The rest is experimentaton |
20:43:57 | PMunch | I tried to write macroutils to make macros a bit more readable |
20:44:11 | * | lumo_e joined #nim |
20:44:26 | PMunch | Unfortunately haven't had much of a possibility to use it yet.. |
20:45:06 | FromDiscord | <geekrelief> yeah things could definitely be easier, but I seem to be doing fine without additional utilities. I just use `astGenRepr` everywhere. 🙂 |
20:47:06 | PMunch | To be fair astGenRepr didn't exist when I started out writing macros :P |
20:47:12 | PMunch | Which is why I wrote it :) |
20:47:17 | nrds | <Prestige99> I hardly ever run into cases where I'd want to use a macro |
20:47:41 | PMunch | Prestige, you're just not hooked yet |
20:47:52 | PMunch | Just wait until you get your first macro high, there's no going back |
20:48:01 | FromDiscord | <Solitude> In reply to @geekrelief "yeah things could definitely": i believe in treeRepr supremacy 🙏 |
20:48:28 | FromDiscord | <geekrelief> without macros, some code is just way more painful to write |
20:49:09 | PMunch | Not to mention read |
20:50:57 | nrds | <Prestige99> PMunch I think I'm just not creative enough maybe |
20:54:40 | nrds | <Prestige99> I think i've only ever used a macro once |
20:54:54 | nrds | <Prestige99> and it probably could have been a template lol |
20:55:06 | FromDiscord | <geekrelief> I've been experimenting with this macro lately: https://github.com/geekrelief/genit |
20:56:45 | FromDiscord | <hmmm> oh that's quite nice geeky bro, I like robot code, that's how I write anyway lol |
20:57:10 | PMunch | @geekrelief, oh wow, that looks really neat |
20:57:25 | FromDiscord | <hmmm> give me nice repetitive ordered blocky code and I feel at home |
20:57:41 | PMunch | So many times I've thought "there has to be a better way" for this code of problem. But there are just too many different names |
20:57:45 | FromDiscord | <geekrelief> thanks, guys. I wanted something like a templating language for nim. I feels like something between a template and macro |
20:57:55 | PMunch | But with `something it` you can do it really easily! |
20:58:09 | FromDiscord | <geekrelief> the implementation is a bit of a mess since I was just experimenting |
20:58:19 | FromDiscord | <geekrelief> but I'm planning on rewriting it at some point. |
20:59:45 | FromDiscord | <geekrelief> I want to improve the performance and expand on it more. I'm pretty much using it all over my TM binding. |
21:17:25 | * | terminalpusher quit (Remote host closed the connection) |
21:18:17 | PMunch | Stream is live for day 10 of AoC: https://www.twitch.tv/pmunche |
21:21:17 | * | xet7 quit (Quit: Leaving) |
21:23:17 | * | xet7 joined #nim |
21:31:31 | * | vicfred joined #nim |
21:58:24 | * | vicfred quit (Quit: Leaving) |
21:59:32 | FromDiscord | <Sabena Sema> In reply to @hmmm "yea yea now I": so its not horrible to do this (and nims module system removes some of the codegen spam that can result) using generics everywhere will defer compile errors util the point where you use (instantiate) the generic. this can result in poor diagnostics. Also you cant form a pointer to a generic proc, only a specific instance |
22:01:19 | FromDiscord | <Elegantbeef> You say that like one should be able to have a pointer to a generic proc 😀 |
22:01:25 | * | jjido joined #nim |
22:05:18 | FromDiscord | <Sabena Sema> well there are ways to implement generics that allow stuff lime that in some cases |
22:06:54 | FromDiscord | <Sabena Sema> (edit) "lime" => "like" |
22:07:42 | FromDiscord | <TryAngle> In reply to @hmmm "woa I was fighting": did u make tinysqlite work?↵I don't understand how to filter select |
22:08:32 | * | rockcavera quit (Remote host closed the connection) |
22:09:48 | * | krux02 joined #nim |
22:29:33 | FromDiscord | <Sabena Sema> OK so the docs are actually right on the basics of when symbols are open |
22:30:09 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HDJ |
22:30:11 | FromDiscord | <Sabena Sema> the first prints "4" the second prints "5" |
22:30:23 | FromDiscord | <Sabena Sema> surprising, but a nice simple rule |
22:30:49 | FromDiscord | <Sabena Sema> although.... |
22:31:02 | FromDiscord | <Sabena Sema> I wonder if that happens if `bark(x:float):float` comes from another module |
22:31:16 | FromDiscord | <Sabena Sema> that does seem a bit questionable to me, but also has some nice effects |
22:33:59 | FromDiscord | <Elegantbeef> It should bind properly, assuming it's an open symbol(it should be in a generic) |
22:35:16 | FromDiscord | <Sabena Sema> the point here is that adding the float overload of bark turns bark from a closed to an open symbol in the generic |
22:36:39 | FromDiscord | <Elegantbeef> Yea i'd argue proc calls that depend on something derived from the generic should be always open |
22:36:55 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HDM |
22:37:03 | FromDiscord | <Sabena Sema> yeah, that was my first instinct |
22:37:10 | FromDiscord | <Sabena Sema> but that's not actually true in c++ oddly |
22:37:22 | FromDiscord | <Sabena Sema> a dependent function call _that is fully qualified_ is open |
22:37:31 | FromDiscord | <Sabena Sema> but function calls subject to adl need at lease one overload |
22:37:55 | FromDiscord | <Elegantbeef> But luckily we can just do `mixin bark` |
22:38:17 | FromDiscord | <Sabena Sema> yes |
22:40:38 | FromDiscord | <Sabena Sema> yeah the multi-module one does NOT force the symbol open (which is good, otherwise the openness would depend on import order) |
22:40:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HDO |
22:40:55 | FromDiscord | <Sabena Sema> oh, neat |
22:41:07 | FromDiscord | <Elegantbeef> That makes sense as the symbol openess is based off the declaration site not instantiation |
22:41:18 | FromDiscord | <Elegantbeef> If it was based off instantiation site it'd always be open in most cases |
22:44:14 | FromDiscord | <Elegantbeef> Hmm i feel like having closed symbols if there is only a single overload in the generic scope just wrong |
22:44:26 | FromDiscord | <Elegantbeef> Wonder what breaks if i were to make them all open |
22:45:25 | FromDiscord | <Sabena Sema> anyway https://github.com/nim-lang/Nim/issues/19240 submitted on the "Delegating bind statement" section being nonsense |
22:46:12 | FromDiscord | <Sabena Sema> I think there are advantages to doing it that way (having it closed with only a single overload) |
22:46:42 | FromDiscord | <Elegantbeef> I mean the benefit is you dont export the procedure that it closely bound to |
22:47:08 | FromDiscord | <Sabena Sema> no, the benefit is that random other stuff can't break your code |
22:47:09 | FromDiscord | <Elegantbeef> But in the case it's open and you dont add an override the proc you call should still be that one assuming the override matches |
22:47:29 | FromDiscord | <Elegantbeef> I mean that's what i was eluding to |
22:47:43 | FromDiscord | <Elegantbeef> It binds tightly to that proc so nothing can break 😀 |
22:47:52 | FromDiscord | <Elegantbeef> overload matches\ |
22:48:04 | FromDiscord | <Sabena Sema> also, when the binding is closed the compiler can emit diagnostics immediately |
22:48:14 | FromDiscord | <Sabena Sema> so it makes it easier to write correct generic code |
22:48:31 | FromDiscord | <Elegantbeef> In the case that it's infact supposed to be a closed symbol |
22:49:10 | FromDiscord | <Elegantbeef> Really i'd argue all closed symbols in generics should emit a hint "closedSymbol X bound to Y" |
22:49:54 | FromDiscord | <Elegantbeef> Cause to me a closed symbol is very much the opposite of what you want in most generic code unless it's constrained to a specific type |
22:50:10 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HDT |
22:50:16 | FromDiscord | <Sabena Sema> whereas if you uncomment the float overload the compiler can't emit that error |
22:50:49 | FromDiscord | <Elegantbeef> I personally dont care about early diagnostics for generics |
22:51:11 | FromDiscord | <Elegantbeef> Concepts should be used to constrain generics if they're supposed to match a signature |
22:51:50 | FromDiscord | <Sabena Sema> if you open all symbols than concepts still can't provide diagnostics at the point of definition |
22:51:59 | FromDiscord | <Elegantbeef> Like i said i dont care |
22:52:07 | FromDiscord | <Sabena Sema> because concepts are not exhaustive (it's not like rust, it's like C++) |
22:52:21 | * | krux02 quit (Remote host closed the connection) |
22:52:24 | FromDiscord | <Sabena Sema> I actually kinda like this rule a lot |
22:52:43 | FromDiscord | <Sabena Sema> because it avoids having to deal with what's a "dependent expression" or whatever |
22:52:55 | * | krux02 joined #nim |
22:53:10 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HDU |
22:53:13 | FromDiscord | <Sabena Sema> has the same behavior as before |
22:53:41 | NimEventer | New thread by Cnerd: Httpbeast failed to compile on Android arm device, see https://forum.nim-lang.org/t/8699 |
22:55:31 | FromDiscord | <Elegantbeef> I think most people dont want closed symbols in generics so this causes more issues than it solves |
22:55:55 | FromDiscord | <Elegantbeef> I could be wrong, but i just dont see the benefits being that great |
22:57:17 | FromDiscord | <Elegantbeef> If all generics are forced open by default then closed symbols are explicit `bind` behaviour, which means it's very opaque where you want closed symbols is my view atleast |
22:58:35 | FromDiscord | <Sabena Sema> making all symbols open is a huge nightmare for maintaining anything |
22:59:03 | FromDiscord | <Sabena Sema> (edit) "maintaining anything" => "long term maintenance" |
22:59:25 | FromDiscord | <Elegantbeef> I dont know that i agree simply cause it's generally desired for non constrained types |
23:02:23 | FromDiscord | <Sabena Sema> only for dependent expressions |
23:03:14 | FromDiscord | <Elegantbeef> Thta's what i'm talking about |
23:04:01 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HE1 |
23:04:24 | FromDiscord | <Sabena Sema> (btw I think zig _does_ make literally everything open, and it's one reason why I'm skeptical of doing big projects in zig) |
23:04:31 | FromDiscord | <Sabena Sema> I have to test it out though |
23:04:42 | FromDiscord | <Elegantbeef> I mean i didnt mean literally every symbol |
23:04:53 | FromDiscord | <Elegantbeef> I meant any symbol that depends on the generic type |
23:05:04 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HE2 |
23:05:07 | FromDiscord | <Sabena Sema> but |
23:05:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HE3 |
23:05:52 | FromDiscord | <Elegantbeef> Without `bind bark` and without the float overload it'd shoulbe be an open symbol imo |
23:06:39 | FromDiscord | <Sabena Sema> well, `bark(i)` is not dependent on any generic parameters |
23:06:55 | FromDiscord | <Sabena Sema> so you get this kinda brittle dynamic scoping of functions that leads to lots of breakage over time |
23:07:48 | FromDiscord | <Elegantbeef> I copied the wrong code 😀 |
23:07:49 | FromDiscord | <Sabena Sema> it also means that it's far more likely different instantiations of a generic will result in like, actually different code |
23:07:51 | FromDiscord | <Sabena Sema> which is bad |
23:10:11 | FromDiscord | <Elegantbeef> Like i said `bark(i)` wouldnt be dependant on open/closed symbols it'd be bound to `bark(int or var int)` |
23:10:34 | FromDiscord | <Elegantbeef> I'm not an idiot i just copied the wrong code |
23:10:34 | FromDiscord | <Sabena Sema> so it's closed |
23:10:48 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3HE4 |
23:10:56 | FromDiscord | <Sabena Sema> oh no |
23:11:02 | FromDiscord | <Sabena Sema> you're saying it should be open |
23:11:07 | FromDiscord | <Elegantbeef> It's not dependant on the generic parameters |
23:11:13 | FromDiscord | <Elegantbeef> i'm certainly not |
23:11:22 | FromDiscord | <Sabena Sema> but again, if it binds to int or var int that's what open means |
23:11:32 | FromDiscord | <Elegantbeef> I mean that depends on overloads |
23:11:39 | FromDiscord | <Elegantbeef> Whatever is declared above this generic instantiation it matches |
23:11:44 | FromDiscord | <Sabena Sema> if it's closed it can't bind to the var int one because that function is not declared when the generic is parsed |
23:11:47 | FromDiscord | <Elegantbeef> In this case it'd bind to `bark int` |
23:11:51 | FromDiscord | <Sabena Sema> OK so closed |
23:12:10 | FromDiscord | <Elegantbeef> Well not technically closed but yes |
23:12:16 | FromDiscord | <Elegantbeef> It'd just be a bound symbol in this casee |
23:12:44 | FromDiscord | <Sabena Sema> I mean that's what closed means |
23:13:00 | FromDiscord | <Elegantbeef> No there is actually a difference between closed/sym in the compiler |
23:13:17 | FromDiscord | <Elegantbeef> In this case it'd not be labelled a closed sym but semantically the same thing |
23:13:44 | FromDiscord | <Elegantbeef> Anyway only procedures that derive from generic parameters is what i'm saying should be forced open unless using bind |
23:14:00 | FromDiscord | <Elegantbeef> It makes the most sense i think as closed sym seems to very much be a thing of "I know i want this bound tightly" |
23:14:17 | FromDiscord | <Sabena Sema> bind forces an identifier closed |
23:14:33 | FromDiscord | <Sabena Sema> no, closed symbols should be the default when possible |
23:14:36 | FromDiscord | <Elegantbeef> Can you stop explaining things to me like i dont know what it does thanks |
23:14:46 | FromDiscord | <Sabena Sema> sorry |
23:15:20 | FromDiscord | <Sabena Sema> yeah I think we agree |
23:15:26 | FromDiscord | <Elegantbeef> I'm very much the opposite boat cause i really think in the general case you rarely want closed symbols |
23:15:29 | FromDiscord | <Sabena Sema> dependent calls open, non-dependent closed |
23:15:46 | FromDiscord | <Elegantbeef> Well non dependant cannot be open that makes 0 sense 😛 |
23:15:51 | FromDiscord | <Sabena Sema> no |
23:15:52 | FromDiscord | <Sabena Sema> they can |
23:16:08 | * | advesperacit quit (Quit: advesperacit) |
23:16:14 | FromDiscord | <Elegantbeef> shouldnt\ |
23:17:36 | FromDiscord | <Sabena Sema> yeah, it is sometimes useful to make them open, though |
23:17:53 | FromDiscord | <Sabena Sema> but yeah, I think we basically agree |
23:18:21 | FromDiscord | <Sabena Sema> but, the rules nim uses are much simpler than having to figure out what qualifies as a type dependent (or value dependent) expression |
23:20:40 | FromDiscord | <Elegantbeef> I dont imagine it's that complicated to resolve though, just check everycall if any type has `tyGenericParam` inside it's body and if so make it an openSym if not |
23:20:40 | FromDiscord | <Elegantbeef> if not `bind`ed\ |
23:20:40 | FromDiscord | <Elegantbeef> I mean the mechanism is clearly already there, so just slight switch of logic for more sensible generics |
23:20:54 | FromDiscord | <Elegantbeef> Though since it'd be a breaking change i reason it wont be accept it |
23:23:54 | FromDiscord | <Sabena Sema> I really doubt that's why, this is more subtle than that |
23:25:53 | FromDiscord | <evil> is there a library for dealing with jsonc files? the comments really mess up the std json parser |
23:30:00 | FromDiscord | <Elegantbeef> There is a json5 implementation not the same as jsonc but allows comments |
23:33:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:46:25 | * | src quit (Quit: Leaving) |
23:55:13 | * | src joined #nim |