00:00:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/H30 |
00:04:50 | FromDiscord | <Saint> Ohh |
00:04:56 | FromDiscord | <Saint> That makes a lot of sense, thanks |
00:04:58 | FromDiscord | <Saint> (edit) "thanks" => "thanks!" |
01:15:32 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
01:42:40 | * | krux02 quit (Remote host closed the connection) |
02:03:19 | * | argonica quit (Remote host closed the connection) |
02:04:16 | FromDiscord | <DUO Labs> When trying to turn off case insensitivity, I get this\: \`Warning\: 'cs' is deprecated, now a noop [Deprecated]\`. Is there an agreed way of disabling case insensitivity (so that \`FOO\` and \`foo\` refer to different variables)? |
02:04:51 | FromDiscord | <huantian> `FOO` and `foo` should already be different variables↵but I don't think there's a way to turn it off entirely? |
02:06:26 | FromDiscord | <amadan> `--styleCheck:error --styleCheck:usages` should do it iirc |
02:07:41 | FromDiscord | <DUO Labs> That's what I thought at first, but if I export a variable FOO in filea.nim and a variable foo in fileb.nim, and import them both in filec.nim, then try to use \`foo\`, I get \`ambiguous identifier\: 'foo'\` |
02:08:31 | FromDiscord | <DUO Labs> `test` |
02:08:49 | FromDiscord | <DUO Labs> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1065452454940004462): That's what I thought at first, but if I export a variable FOO in filea.nim and a variable foo in fileb.nim, and import them both in filec.nim, then try to use `foo`, I get `ambiguous identifier: 'foo'\` |
02:09:00 | FromDiscord | <DUO Labs> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1065452454940004462): That's what I thought at first, but if I export a variable FOO in filea.nim and a variable foo in fileb.nim, and import them both in filec.nim, then try to use `foo`, I get `ambiguous identifier: 'foo'` |
02:09:00 | FromDiscord | <huantian> In reply to @amadan "`--styleCheck:error --styleCheck:usages` should do": that causes an error if you have different cases, but doesn't actually allow you to use different casings |
02:09:17 | FromDiscord | <DUO Labs> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1065451596722475068): When trying to turn off case insensitivity, I get this\: `Warning: 'cs' is deprecated, now a noop [Deprecated\]`. Is there an agreed way of disabling case insensitivity (so that `FOO` and `foo` refer to different variables)? |
02:10:46 | FromDiscord | <amadan> Having those three files works for me, you didn't name any of the files foo did you? |
02:12:48 | * | argonica joined #nim |
02:13:23 | FromDiscord | <DUO Labs> No |
02:17:52 | FromDiscord | <DUO Labs> sent a code paste, see https://play.nim-lang.org/#ix=4lCR |
02:18:06 | FromDiscord | <Rika> Well that’s counted as the same |
02:18:29 | FromDiscord | <Rika> Style insensitivity doesn’t include the first letter case so Foo and foo aren’t the same but Foo and FOO are the same |
02:19:31 | FromDiscord | <Rika> No you cannot make them different, best you can do is disallow the different styles or disambiguate the use by prefixing with the module |
02:19:52 | FromDiscord | <Rika> So use "utils.LOGGER" or so instead |
02:21:20 | * | beholders_eye quit (Ping timeout: 246 seconds) |
02:23:44 | FromDiscord | <DUO Labs> I just got around it by just using `debug, info,...` instead (since I only have on logger) |
02:36:44 | FromDiscord | <DUO Labs> I'm trying to save a class `Foo` to variable `bar`, then making an instance with `bar(var1: foo1, var2: foo2,...)`, but this fails with `Error: type expected`. |
02:37:22 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4lCU |
02:37:29 | FromDiscord | <DUO Labs> sent a code paste, see https://play.nim-lang.org/#ix=4lCV |
02:38:08 | FromDiscord | <DUO Labs> Oh, I see. |
02:48:53 | * | arkurious quit (Quit: Leaving) |
02:59:53 | FromDiscord | <T0lk1en> Yo yo |
03:02:07 | FromDiscord | <T0lk1en> I’m working on a reverse shell rn. The shell works fine but my problem is that when run I can only interact with the folder that the program is run in. I was thinking about adding the program to path and then running the command in C folder but this seems overly complicated. I know this isn’t directly related to nim but was hoping someone had some insight |
03:02:28 | FromDiscord | <T0lk1en> https://github.com/ko-mill/mill-shell |
03:02:38 | FromDiscord | <T0lk1en> Code for those wondering^^ |
03:07:17 | FromDiscord | <pyolyokh> by "I can only interact with the folder that the program is run in", you mean that since you're spawning a new shell for each command that the working directory of a previous command (like "cd ..") is lost? |
03:07:44 | FromDiscord | <T0lk1en> Yeah that sounds correct |
03:07:49 | FromDiscord | <pyolyokh> that doesn't actually prevent you from working with the rest of the filesystem. It's just less pleasant. |
03:08:39 | FromDiscord | <T0lk1en> How would you have a peristaltic shell without spawning a new shell every time a command is ran |
03:08:46 | FromDiscord | <T0lk1en> Persistent |
03:09:07 | FromDiscord | <pyolyokh> the two tactics that I see in the wild are (of PHP shells): they never call out to bash or cmd.exe or anything, but just implement a subset of commands and maintain their own state, and (of perl, python, c reverse shells): they spawn a shell once per connection, not once per command, and they just connect the socket and the shell together by pipes. that's just some dup2 calls |
03:10:06 | FromDiscord | <T0lk1en> Wdym buy that last part. From they - calls |
03:10:52 | FromDiscord | <Elegantbeef> You spawn a shell handler which takes in data from a socket or stdin, and sends it to a persistent shell |
03:11:09 | FromDiscord | <T0lk1en> Hmm |
03:11:40 | FromDiscord | <T0lk1en> I’ll have to put in some more work. Thanks for the answers guys. |
03:11:59 | FromDiscord | <pyolyokh> for BSD sockets, certain syscalls care in some ways if it's actually a socket or not, but most I/O doesn't. Write to a file, write to a socket, it works the same. So you receive a connection, fork, set up stdin/stdout/stderr to point to the socket with dup2(), then exec the shell, which then reads and writes from the socket without knowing there's anything special about it. |
03:12:51 | FromDiscord | <T0lk1en> Stderr? |
03:13:02 | FromDiscord | <pyolyokh> a search for 'perl reverse shell' brings up `open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S")` pretty quickly. That's Perl's version of what I just said. |
03:13:11 | FromDiscord | <T0lk1en> Gotcha |
03:13:23 | FromDiscord | <T0lk1en> Ty |
03:14:19 | FromDiscord | <T0lk1en> While your here can I get some advice on making a listener. I’m currently using net cat but would like to make my own |
03:16:01 | FromDiscord | <pyolyokh> if you're not doing any kind of concurrency, and you're probably not with a reverse shell, there's nothing to it. Just use <https://nim-lang.org/docs/net.html> , maybe read beej's guide if you don't understand the terms |
03:17:02 | FromDiscord | <T0lk1en> Gotcha |
03:54:32 | * | argonica quit (Quit: Leaving) |
03:55:00 | * | argonica joined #nim |
04:12:08 | FromDiscord | <T0lk1en> Yo was looking at os library for something that can execute cmd commands but Al those do is return a string of what the executed command would have looked like. Is there a library that actually does cmd commands |
04:24:29 | FromDiscord | <pyolyokh> "would have looked like"? it's not speculating, it actually runs the command and collects its output |
04:24:47 | FromDiscord | <pyolyokh> and right next to that command are others that spawn the process and let it run independently |
04:25:14 | FromDiscord | <pyolyokh> ah actually, maybe os only has simple stuff. I'd always gone directly to <https://nim-lang.org/docs/osproc.html> |
04:25:42 | FromDiscord | <pyolyokh> startProcess in that module is good one to start wtih |
04:34:38 | FromDiscord | <T0lk1en> How come these have to return something. Why can’t they just be alone. What I mean by this is I always get the error must be used or discarded. Why must I do something |
04:35:48 | FromDiscord | <pyolyokh> they don't have to return something. They do because the returns are extremely useful. |
04:39:23 | * | argonica quit (Quit: Leaving) |
04:40:57 | FromDiscord | <pyolyokh> and the language wanting you to very rarely add an explicit `discard` to throw away a useful return value, that's just a deliberate design choice. It's not common a design, but it's not a big deal either. |
04:45:57 | FromDiscord | <pyolyokh> sent a long message, see http://ix.io/4lD8 |
04:46:25 | FromDiscord | <T0lk1en> So even though I discard something it still runs it? |
04:46:41 | FromDiscord | <pyolyokh> yes, you're just not using the return |
04:47:21 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lD9 |
04:47:48 | FromDiscord | <T0lk1en> Ab gotcha |
04:47:50 | FromDiscord | <T0lk1en> Ah |
04:49:36 | FromDiscord | <T0lk1en> Weird |
05:23:49 | * | TakinOver quit (Ping timeout: 260 seconds) |
05:27:22 | FromDiscord | <pyryrin> Wrapping c libraries to nim is hard |
05:28:19 | FromDiscord | <T0lk1en> What’s the purpose of doing that. Additional finctionality? |
05:28:29 | FromDiscord | <T0lk1en> Functionality? |
05:34:32 | FromDiscord | <Elegantbeef> What? |
05:39:39 | FromDiscord | <Leftbones> choosenim automatically installed the amd64 version on my m1 mac, how could I make it install the arm64 version? |
05:39:56 | FromDiscord | <Elegantbeef> Nope dont think it works with arm yet |
05:40:03 | FromDiscord | <Rika> In reply to @T0lk1en "What’s the purpose of": Catches bugs |
05:40:49 | FromDiscord | <Leftbones> In reply to @Elegantbeef "Nope dont think it": A year ago in this thread it was stated that the next major verison would support it, did that never happen? https://forum.nim-lang.org/t/7823 |
05:41:05 | FromDiscord | <Leftbones> Otherwise I'll just try the method in that thread, I was just hesitant in case it was outdated now. |
05:41:10 | FromDiscord | <Elegantbeef> Nim does choosenim doesnt afaik |
05:41:10 | * | rockcavera quit (Remote host closed the connection) |
05:41:22 | FromDiscord | <Leftbones> Oh gotcha |
05:41:29 | FromDiscord | <Leftbones> So I have to build from source |
05:47:24 | FromDiscord | <Leftbones> Aaaand that method no longer works. Rip. |
05:53:17 | FromDiscord | <Leftbones> Ehhh, just running the build_all.sh doesn't seem to be doing it, is there something else I have to do? (choosenim won't let me remove the installed version if that matters?) |
05:56:37 | * | argonica joined #nim |
05:58:18 | FromDiscord | <Elegantbeef> what's going wrong? |
05:58:29 | FromDiscord | <Elegantbeef> After `./build_all.sh` there should be a `nim` inside `bin` |
06:05:27 | FromDiscord | <Leftbones> Hang on I'm deleting both choosenim and Nim and starting over, I think I screwed something up |
06:10:03 | FromDiscord | <Leftbones> After running the script, I try to check the version in the bin folder but it is looking for an installation in the choosenim folder, which doesn't exist |
06:10:12 | FromDiscord | <Leftbones> `~/.choosenim` doesn't exist, I mean |
06:10:35 | FromDiscord | <Leftbones> And I'm not trying to use choosenim anyways because it doesn't support m1 |
06:15:12 | FromDiscord | <Elegantbeef> I dont know what to tell you after building you need to move it to your path or add it to your path |
06:16:07 | FromDiscord | <Leftbones> Installing from --HEAD on brew worked. |
06:17:24 | FromDiscord | <Leftbones> In reply to @Elegantbeef "I dont know what": I know that, what I mean is even just running `nim --version` gives an error about how it can't find an installation at `~/.choosnim/whatever` but either way I'm going to bed. Idk if the version I got from brew is up to date but I'll check on that tomorrow. |
06:23:40 | FromDiscord | <pyolyokh> that'l be your shell complaining, not nim |
06:23:57 | FromDiscord | <pyolyokh> new mac uses zsh, which has odd caching rules by default |
06:24:19 | FromDiscord | <pyolyokh> the simplest solution's to open a new terminal |
06:45:02 | * | azimut quit (Ping timeout: 255 seconds) |
07:17:19 | FromDiscord | <htac> does anyone know what happened to @timotheecour ? He was a vital dev on Nim once, putting an enormous effort in it, and worked on some elaborate ideas to further its development, in my humble opinion |
07:23:02 | FromDiscord | <Elegantbeef> Think he got a different job and disappeared |
07:25:54 | FromDiscord | <ringabout> I suppose his new job is busy. https://www.linkedin.com/in/timothee-cour-b249378 |
07:26:29 | FromDiscord | <ringabout> (edit) "I suppose ... hisjob." added "he is busy at" | "job is busy." => "job." |
07:26:54 | FromDiscord | <htac> damn you, Amazon! 😊 |
07:27:22 | FromDiscord | <htac> thank you, @ElegantBeef and @ringabout |
07:35:07 | * | om3ga quit (Quit: Bye) |
07:42:08 | FromDiscord | <htac> especially for your contributions, the two of you |
07:42:23 | FromDiscord | <htac> (edit) "contributions," => "contributions to Nim dev," |
07:50:06 | * | PMunch joined #nim |
08:38:14 | * | jjido joined #nim |
08:51:09 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
11:28:38 | * | beholders_eye joined #nim |
11:42:18 | * | om3ga joined #nim |
11:58:38 | * | om3ga quit (Quit: Bye) |
12:00:19 | * | om3ga joined #nim |
12:23:44 | * | beholders_eye quit (Ping timeout: 246 seconds) |
13:05:02 | * | argonica quit (Quit: Leaving) |
13:37:35 | FromDiscord | <turbo> What's the recommended way to share static, read-only data between threads? On startup I'd like to allocate a large map (string -> float array) and all threads should be able to read from it at the same time. |
13:38:32 | FromDiscord | <turbo> In reply to @Leftbones "choosenim automatically installed the": I wrote up a guide on that here: https://summarity.com/nim-2-m1 |
13:40:37 | FromDiscord | <mratsim> In reply to @turbo "What's the recommended way": use a barrier |
13:41:27 | FromDiscord | <mratsim> lift the implementation here: https://github.com/status-im/nim-taskpools/tree/stable/taskpools/primitives |
15:07:42 | * | arkurious joined #nim |
15:11:54 | * | PMunch quit (Quit: Leaving) |
15:12:00 | * | rockcavera joined #nim |
15:18:48 | * | nmz joined #nim |
15:22:31 | nmz | Hello, I've decided to learn nim, I usually start coding by reimplementing unix tools like cat and so on, has anyone tried done this already (like busybox) in nim? |
15:22:37 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i make a parent based nodetree, so instead of each parent containg children each child refers to a parent |
15:24:25 | Amun-Ra | nmz: I usually start writing my own crypto function implementations |
15:28:25 | nmz | hmm, closest I've come to that is a rot13, but maybe I should start by doing project euler or advent of code or something |
15:55:16 | FromDiscord | <auxym> pretty sure Amun-Ra was being sarcastic (because a s rule of thumb you should pretty much never roll your own crypto). |
15:55:48 | FromDiscord | <auxym> Anyways, I'm not aware of Nim implementations of standard unix cli commands, except maybe ttop which is like top/htop |
15:56:36 | FromDiscord | <auxym> Write whatever interests you, that's the most important part (aoc is fun though, IMO, and I could never get into PE much, too much mathy) |
15:59:37 | FromDiscord | <Leftbones> In reply to @turbo "I wrote up a": Thank you! This installed the same version as brew did, by the way. |
15:59:46 | FromDiscord | <Leftbones> So, more steps, but good for those who don't like using package managers. |
16:01:14 | * | azimut joined #nim |
16:24:49 | FromDiscord | <Require Support> I hope someone with more experience can give me a solution to how to implement this or if it's even possible. I would like to have a main thread running that downloads data from HTTP server periodically and when it gets specific data I would like to pass it to another thread that is also running, the other thread receives the data from the main thread and processes it. No return value from the second thread. |
16:25:59 | FromDiscord | <Require Support> (edit) "I hope someone with more experience can give me" => "sent" | "solution to how to implement this or if it's even possible. I would like to have a main thread running that downloads data from HTTP server periodically and when it gets specific data I would like to pass it to another thread that is also running, the other thread receives the data from the main thread and processes it. No return value from the second thread." |
16:33:16 | FromDiscord | <turbo> You can create a thread and use channels with (try)recv to communicate. Keep the thread alive with periodic sleeping (or use recv to block until new data is available) |
16:34:03 | FromDiscord | <Require Support> In reply to @turbo "You can create a": yeah I was looking at the channels example, would the channel need to be a global variable amongst all threads? |
16:36:03 | FromDiscord | <turbo> In reply to @Require Support "yeah I was looking": Yeah, see the example: https://nim-lang.org/docs/channels_builtin.html |
16:37:07 | FromDiscord | <turbo> I'm using the same pattern in a server where I have one thread dedicated to SQLite writes to prevent BUSY issues. |
16:40:29 | FromDiscord | <Require Support> nice, what if I don't know how many channels I'd need at compile time? The user can generally create as many threads as they need. Is there a way to dynamically spin up these channels when the secondary thread is created? Sorry if these questions seem dumb, im new to this |
16:40:55 | FromDiscord | <turbo> Hm, that seems like a better use case for `spawn` |
16:41:19 | FromDiscord | <turbo> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn-spawn-statement |
16:42:31 | FromDiscord | <turbo> Otherwise you'd have to somehow multiplex that coordination using one persistent channel. There may be other ways I don't know about. |
16:43:14 | FromDiscord | <Require Support> that is what im using right now, but im running into problems with SMB pipes when multiple threads try to act on the same pipe, even after checking and waiting. So was looking to see if I can create one thread on user request and let it process data to the pipe until user is done with it. |
16:43:29 | FromDiscord | <Require Support> (edit) "that" => "`spawn`" |
16:45:12 | FromDiscord | <enthus1ast> @Require Support\: i would use createThread |
16:45:27 | FromDiscord | <enthus1ast> i felt spawn was somehow buggy or strange |
16:45:35 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/threads.html |
16:45:43 | FromDiscord | <turbo> Why are you creating one thread per request? If you need to prepare data before flushing it to the pipe you could use spawn _and_ create one SMB writer thread, the spawned procs put their data into the channel for the writer to flush |
16:46:33 | FromDiscord | <turbo> Otherwise all threads will block anyway and you'll run into contention (if I understand your setup correctly) |
16:48:31 | FromDiscord | <Require Support> In reply to @turbo "Why are you creating": that's a nice setup, I'll give it a try |
16:48:59 | FromDiscord | <Require Support> In reply to @enthus1ast "<@710108871724761128>\: i would use": This might be cause my issues, I'll try createThread |
16:52:58 | FromDiscord | <enthus1ast> you could prepare a array with eg 128 threads, and another one with 128 channels, then spawn them accordingly, could work |
16:53:32 | FromDiscord | <turbo> aren't you basically implementing the spawn threadpool at that point 😄 |
16:53:41 | FromDiscord | <enthus1ast> maybe |
16:57:44 | FromDiscord | <Dexterdy> sent a code paste, see https://play.nim-lang.org/#ix=4lGa |
16:58:01 | FromDiscord | <Dexterdy> (edit) |
16:59:46 | FromDiscord | <Array in ∀ Matrix> whats a good way to check or sanitize user input |
17:00:15 | FromDiscord | <Array in ∀ Matrix> for example to check if a certain input is actually an int or float |
17:04:39 | FromDiscord | <turbo> There's https://planety.github.io/prologue/plugin/validater/validater.html |
17:04:40 | FromDiscord | <Phil> In reply to @Dexterdy "Hi there. Could someone": Your type must either be concrete or generic.↵Concrete type declarations must also have concrete types in all their fields.↵Currently it is a concrete type, because GlobalInfo doesn't have a generic "parameter" |
17:06:41 | FromDiscord | <Phil> GlobalInfo must be turned into a generic type declaration given how you wrote that code.↵Because while it may not seem like it, "Module" is a generic-type with mostly some restrictions as defined by your concept. |
17:06:55 | FromDiscord | <Phil> Now let me look up how generic type declarations worked again because I haven't done that much work with generic types |
17:07:33 | FromDiscord | <Dexterdy> So I add a generic parameter T to the GlobalInfo? What's the syntax for specifying-. Yeah that :) |
17:09:31 | FromDiscord | <Array in ∀ Matrix> thank you↵(@turbo) |
17:10:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lGf |
17:11:00 | FromDiscord | <Dexterdy> thank you! |
17:11:32 | FromDiscord | <Phil> In reply to @Dexterdy "thank you!": Oh! and `GlobalInfo[Module] = object` if you want to export |
17:12:16 | FromDiscord | <Phil> It works pretty much identical to how it works in generic procs:↵<name><exportsymbol><genericparams>....other stuff... |
17:17:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lGh |
17:18:55 | FromDiscord | <Dexterdy> aaah, like so. That's why I can't seem to make regular local variables of such a type |
17:19:16 | FromDiscord | <Phil> Aye, it's also why you can't ever have a seq that contains both strings and ints |
17:19:25 | FromDiscord | <Dexterdy> (edit) "local" => "global" |
17:19:37 | FromDiscord | <Phil> You can have a seq that can contain strings or ints, but not both at the same time, unless you use object variants |
17:19:49 | FromDiscord | <Dexterdy> hmhm |
17:20:23 | FromDiscord | <Phil> (edit) "variants" => "variants, because the second nim gets to the first time you explicitly state which type it uses in the generics place, it'll use that." |
17:21:39 | FromDiscord | <Phil> And yeah, one global object that can contain all different types isn't going to work ^^↵If you have a limited amount of types you can try to use an object variant |
17:22:40 | FromDiscord | <Phil> Alternatively you could try for OOP and make use of dynamic dispatch, have a base-class that you put in that type thing, then have all child-classes implement the same methods |
17:23:26 | FromDiscord | <Dexterdy> yeah, that's what I'll use. That or regular enums. I'm not much of a fan of OOP, tbh |
17:23:45 | FromDiscord | <Phil> Me neither, I tend to dislike how it obscures control flow |
17:30:33 | FromDiscord | <auxym> In reply to @Require Support "`spawn` is what im": spawn is known to be pretty bad, consider using taskpools or weave from nimble for something like that |
17:33:27 | FromDiscord | <Require Support> 😦 why is the standard library like this |
17:42:56 | * | azimut quit (Ping timeout: 255 seconds) |
17:45:00 | * | azimut joined #nim |
17:48:08 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > How would i make a parent based nodetree, so instead of each parent containg children each child refers to a parent↵Anyone know? I tried just using ref objects but kept on getting Attempting to read from nil errors, i think the gc is eating them |
17:53:54 | * | jjido joined #nim |
18:03:41 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lGm |
18:03:57 | FromDiscord | <jtv> Since the 70's, polymorphism has been broken up into 4 different kinds, ad hoc, coercion, inclusion and parametric. They all have their place to some degree, and most languages have all 4. Template / generic mechanisms are parametric polymorphism, which is all resolvable statically. Inclusion polymorphism is generally inheritance, which is NOT typically resolvable statically. Coercion == casting, and ad hoc are type rules built into and a |
18:04:31 | FromDiscord | <jtv> So Nim's not significantly different here from many, many other languages |
18:08:19 | FromDiscord | <Phil> I assume this is more directed and me and my statement that OOP obscures control flow? |
18:09:31 | FromDiscord | <jtv> Oh, no, more felt that the impression was that Nim's generics were unusual in not being able to declare something to be a type that doesn't have a runtime resolution. That's inclusion polymorphism, whether you use inheritance for it or not. Modeled as sets |
18:09:56 | FromDiscord | <jtv> I 100% agree w/ you on OOP obscuring control flow, I came to that conclusion in 1996 or so 🙂 |
18:10:03 | FromDiscord | <Phil> In reply to @jtv "Oh, no, more felt": Ohhhhh check. |
18:10:26 | FromDiscord | <Phil> In reply to @jtv "I 100% agree w/": To be fair, I was a toddler at that time, there's no way I could've had smarter thoughts like this ! |
18:10:29 | FromDiscord | <Phil> 😄 |
18:10:42 | FromDiscord | <jtv> I am pretty old, for sure 🙂 |
18:11:14 | FromDiscord | <Phil> Whenever I want to feel old I just look at when GameBoy Advacned or Lotr came out |
18:11:22 | FromDiscord | <Phil> And remember that that was "the new shit" |
18:11:31 | FromDiscord | <Phil> (edit) ""the" => ""the" |
18:12:04 | FromDiscord | <jtv> I played Pong at my great uncle's house when I was a kid |
18:12:24 | FromDiscord | <jtv> 👴 |
18:12:37 | FromDiscord | <Phil> Ah, so you look up when they released Pong to feel old |
18:13:02 | FromDiscord | <jtv> I just watched a documentary on it a few nights ago. Old people watch documentaries |
18:13:27 | FromDiscord | <Phil> I wanted to write "That's not true" because I occassionally watch some over various topics |
18:14:07 | FromDiscord | <Phil> But then I remembered again that I play Dnd with some folks that are literally barely out of highschool and was forced to shut up |
18:15:07 | FromDiscord | <jtv> I remember when my stepmother bought home dungeons and dragons in like 1980... pre-AD&D even. |
18:15:17 | FromDiscord | <Phil> `could not load: (libmysqlclient|libmariadbclient).so(|.20|.19|.18|.17|.16|.15)` Yay, hunting packages for who contains this SO file |
18:18:55 | FromDiscord | <jtv> I assume there's a way for me to prototype something in one module I implement in another, correct? Can't remember seeing it tho, and not picking it up via google. Would really be useful for cross-module dependencies. Right now, I'm basically having to go through contortions to avoid recursive imports |
18:20:35 | FromDiscord | <Phil> prototype as in do a type declaration that states "this type must be able to do X"? |
18:20:39 | FromDiscord | <Phil> Because that'd be a concept |
18:20:43 | FromDiscord | <Phil> (edit) "concept" => "`concept`" |
18:21:07 | FromDiscord | <Phil> If you want something like a module interface, there's nothing built in I don't think |
18:21:09 | FromDiscord | <jtv> No, be able to say, "proc f()" without the =, but have f be defined in an external module |
18:21:28 | FromDiscord | <jtv> Works in C quite well :). |
18:21:32 | FromDiscord | <Phil> There's packages, but they affect how you structure your code |
18:22:29 | FromDiscord | <jtv> And most languages don't need it, because they're better about such things. Nim's going to get there soon it looks like, but for now I'm not enjoying organizing my code :/ |
18:22:30 | FromDiscord | <Phil> https://github.com/planetis-m/protocoled↵https://github.com/itsumura-h/nim-interface-implements↵Would be candidates |
18:23:27 | FromDiscord | <jtv> No, I don't want interfaces, I want the prototype just to tell the compiler to do it's work w/o barfing because it can't find the implementation in that module... it'll find it before long! |
18:24:32 | FromDiscord | <jtv> From X, I want to be able to call a specific concrete function, exported by Y, but still have Y importing X |
18:24:36 | FromDiscord | <Phil> isn't an interface basically just the type/proc/func declaration without the implementation?↵It's "This is what it will be and what it will return", at least the way I use the word |
18:25:07 | FromDiscord | <jtv> Yeah but I have a single implementation I need to call, not something generic based on an object type or what have you |
18:25:19 | FromDiscord | <jtv> It's more that Nim's about the worst at cyclic dependencies |
18:25:32 | FromDiscord | <jtv> C prototypes solve that problem (C is 2nd worst) |
18:26:39 | FromDiscord | <Phil> I worked around the issue of cyclic dependencies by having tiny modules 😅 ↵I can't think of anything high level that I used before that would fulfill this, but that could likely just be because I haven't exposed myself that much to the lower-level side of nim |
18:27:11 | FromDiscord | <jtv> Tiny modules makes it worse. Monolithic would be better for avoiding cycles 🙂 |
18:27:33 | FromDiscord | <jtv> That's the thing, I prefer smaller, but sometimes there are interdependencies |
18:29:07 | FromDiscord | <Phil> Ah, that might just be a code structure thing then, my cyclic dependency issues typically stemmed from module A needing proc B from module B, but module B needed proc C from module A. Thus I just splitted proc C out and that solved my problem.↵Haven't yet had to deal with true interdependencies |
18:29:23 | FromDiscord | <Require Support> i have a point to an object that im passing to the thread. How can I let the thread create a copy of the object to use for its processing? is it as simple as assigning it to a new var? |
18:30:06 | FromDiscord | <Require Support> (edit) "point" => "pointer" |
18:30:17 | FromDiscord | <Phil> I'd explicitly clone because I don't want to trust implicit copy behaviour, especially if I can't be 100% sure it'll remain in the future |
18:31:00 | FromDiscord | <Require Support> In reply to @Isofruit "I'd explicitly clone because": you mean manually create the object and assign everything yourself? |
18:31:15 | FromDiscord | <jtv> Well, for instance, imagine you have a huge app w/ a lot of different config options / info. If every module is importing that, it's basically incapable of calling back into the other modules to calculate what needs to change in one part of the system based on what it got from sone other part of the system. |
18:31:17 | FromDiscord | <Phil> In reply to @Require Support "you mean manually create": I'd look for a clone or copy proc to do that for you |
18:32:24 | FromDiscord | <sOkam!> sent a long message, see http://ix.io/4lGv |
18:32:53 | FromDiscord | <jtv> For cases like that, I have modules registering handlers to avoid the dependency, and then even getting them imported confuses Nim... tells me some of my modules aren't used when they definitely are 🙂 |
18:33:00 | FromDiscord | <jtv> It's super unnatural |
18:34:24 | FromDiscord | <sOkam!> i think about modules and submodules like this↵sure, the end result will do the exact same thing... but the dependency hell will be much more manageable https://media.discordapp.net/attachments/371759389889003532/1065700768369356810/image.png |
18:35:37 | FromDiscord | <Phil> So sort of kind of like a py file or whatever it was in python |
18:35:48 | FromDiscord | <Phil> (edit) "py" => "\_\_py\_\_" |
18:35:50 | FromDiscord | <jtv> My code tend to me more like the rack on the right 🙂 |
18:36:13 | FromDiscord | <Phil> With central access points to the code of a package |
18:36:44 | FromDiscord | <jtv> No, in python a cyclic import definitely works |
18:40:50 | FromDiscord | <sOkam!> In reply to @jtv "My code tend to": i started learning to code by studying quake engine↵After spending months trying to sort the mess... I realized that you are either the left rack, or the right rack... there's no inbetween 🙈 |
18:41:02 | FromDiscord | <sOkam!> (edit) "studying" => "studying/coding with" |
18:45:20 | FromDiscord | <Phil> Okay, am I dumb? Isn't `mysql-client` the debian package containing libmysqlclient, which nim needs for db_mysql? |
18:53:22 | FromDiscord | <Phil> Nope, turns out `default-libmysqlclient-dev` is what I was looking for >_> |
18:53:42 | FromDiscord | <Phil> Linux package names are one of those things where you basically have to know what you're looking for, bleh |
18:54:01 | FromDiscord | <sOkam!> In reply to @Isofruit "Okay, am I dumb?": https://media.discordapp.net/attachments/371759389889003532/1065705706843545751/image.png |
18:54:58 | FromDiscord | <Phil> In reply to @sOkam! "": 🤷 ↵I brute forced my way through the docker image description needed to get my stuff to compile |
18:54:59 | FromDiscord | <sOkam!> In reply to @Isofruit "Linux package names are": that's why the package search option is so good. afaik most distros have it |
18:55:03 | FromDiscord | <Phil> nothing else worked |
18:55:41 | FromDiscord | <Phil> It is at this point that me being on arch but likely using a debian based docker image (nim 1.6.10 is debian based I think, does use apt) screws me |
18:57:48 | FromDiscord | <sOkam!> In reply to @Isofruit "It is at this": what do you mean by nim being debian based? |
18:58:00 | FromDiscord | <Phil> The nim docker image |
18:58:31 | FromDiscord | <sOkam!> why do you use a docker image, instead of choosenim? do you need docker funcionality specifically? |
18:59:17 | FromDiscord | <Phil> For CI/CD pipelines |
19:00:43 | FromDiscord | <Phil> I start up a nim-docker container with my source code and tests and separate from that I start up mysql/postgres containers, all coordinated via docker-compose.↵The nim-docker-container with my package compiles and executes its tests, as part of which it does calls to mysql/postgres/sqlite databases |
19:01:06 | FromDiscord | <Phil> For local development I got choosenim |
19:01:16 | FromDiscord | <sOkam!> ic |
19:01:41 | FromDiscord | <sOkam!> ci/cd sure sounds messy |
19:02:01 | FromDiscord | <Phil> CI/CD in general is a massive pain in my ass, but I'm starting to get better at it, as this is the second time now that I'm properly setting them up |
19:02:17 | FromDiscord | <Phil> And the assurance that my source code actually works is nice |
19:02:49 | FromDiscord | <Phil> So I can actually tell people that e.g. want to use mysql "hey, if you need connection pooling, you can use tinypool"↵etc. |
19:03:33 | FromDiscord | <Phil> Though now I need to rewrite all my SQL statements that I copy pasted from my other tests into sth mysql compatible...gnaaa |
19:24:00 | FromDiscord | <Phil> Heck yeah, for nim 1.6.10 the tests run, now to the next step which is make them work on nim 2.0 with all the db_connector stuff |
20:22:49 | FromDiscord | <Phil> angry sounds in the distance |
20:23:14 | FromDiscord | <Phil> Okay... err... is there no way to install a specific devel version of the compiler? |
20:24:08 | FromDiscord | <Phil> Or is it basically `choosenim <stable version or devel>` ? |
20:24:33 | arkanoid | is myseq.len * myseq.sizeof the right way to get myseq buffer size (for C?) |
20:35:30 | FromDiscord | <hugogranstrom> `myseq[0].sizeof` otherwise O think you get the size of the object with capacity + ptr↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
20:35:54 | FromDiscord | <hugogranstrom> Might be wrong, but this should definitely work at least |
20:36:11 | FromDiscord | <Elegantbeef> Depends on which MM you're using |
20:36:21 | FromDiscord | <Elegantbeef> `sizeof(seq)` on refc is 8, but on orc it's 16 |
20:36:37 | FromDiscord | <Elegantbeef> But yea you're correct that you do `mySeq.len sizeof(mySeq[0])` |
20:38:14 | * | kenran joined #nim |
20:42:04 | FromDiscord | <Phil> Today is the first time where I actually ran into trouble with an ubuntu image, who'da thunk |
20:42:09 | FromDiscord | <Phil> (edit) "who'da" => "who'dve" |
20:42:30 | FromDiscord | <huantian> give up docker join nix gang! |
20:42:50 | FromDiscord | <Phil> In reply to @huantian "give up docker join": Write my github CI/CD pipelines for me and I shall contemplate xP |
20:44:10 | FromDiscord | <Phil> So far I managed to find ways to do github-served package docs as well as test-runs with docker, that was already painful enough.↵Any alternative would need to be a damn sight easier, which I'm not sure it can due to the very nature of the problem |
20:45:58 | FromDiscord | <huantian> lol |
20:56:46 | FromDiscord | <jtv> sent a long message, see http://ix.io/4lHd |
20:57:34 | FromDiscord | <jtv> I get lovely type incompatibility errors that differ only in lock level 0 vs. unknown |
20:58:38 | FromDiscord | <Elegantbeef> Full error? |
20:58:40 | FromDiscord | <Elegantbeef> Or code that demonstrates it |
21:00:13 | FromDiscord | <Elegantbeef> But yea only nimcall can be converted to closure |
21:00:34 | FromDiscord | <jtv> const fptrs = [(304, "writeFile", builtinWriteFile, "f(string, string) -> bool"),↵ (305, "copyFile", builtInCopyFile, "f(string, string) -> bool"),↵ (306, "moveFile", builtinMove, "f(string, string) -> bool"),↵ (307, "rmFile", builtinRm, "f(string)->bool")] |
21:00:36 | FromDiscord | <jtv> those all work |
21:00:55 | FromDiscord | <jtv> But if I add in say this one: (109, "format", builtInFormat, "f(string) -> string"), |
21:01:05 | FromDiscord | <jtv> There's nothing much different about builtinFormat |
21:01:09 | FromDiscord | <jtv> Same signature as all the rest |
21:01:25 | FromDiscord | <Elegantbeef> What's the error? |
21:02:13 | FromDiscord | <jtv> `/ Error: type mismatch: got '(int, (string, BuiltInFn, string))' for '(109, ("format", BuiltInFn(builtInFormat), "f(string) -> string"))' but expected '(int, (string, proc (args: seq[Box], unused1: Con4mScope, unused2: VarStack, unused3: Con4mScope): Option[box.Box]{.locks: 0.}, string))'` |
21:02:57 | FromDiscord | <jtv> All these functions have the exact same signature, and there are plenty of them. Only some small number fail |
21:03:35 | FromDiscord | <Elegantbeef> Does making your `BuiltInFn` have `{.locks: unknown.}` help? |
21:03:41 | FromDiscord | <Elegantbeef> Luckily lock levels are getting removed soon |
21:04:01 | FromDiscord | <jtv> Let me check. I tried that in a cast, but I'll put it in a type decl |
21:05:31 | FromDiscord | <jtv> Where do I put the pragma if I'm using sugar to declare the type? |
21:05:48 | FromDiscord | <jtv> Right now it's ` BuiltInFn = ((seq[Box], Con4mScope, VarStack, Con4mScope) -> Option[Box])` |
21:08:22 | FromDiscord | <jtv> I even can't get the syntax if I rewrite it w/o sugar (this doesn't work): ` BuiltInFn = proc(i0: seq[Box], i1: Con4mScope, i2: VarStack, i3: Con4mScope) : Option[Box] {.locks: unknown.}` |
21:09:27 | FromDiscord | <Elegantbeef> Hmph one cannot use `unknown` apparently 😄 |
21:09:42 | FromDiscord | <jtv> Yay. Putting 0 does not work |
21:11:35 | FromDiscord | <Elegantbeef> Well without a replication i can run i'm not going to be able to help any |
21:12:21 | FromDiscord | <jtv> Let me create a branch and push something broken so you can look at it if you like, one second |
21:14:25 | FromDiscord | <jtv> https://github.com/crashappsec/con4m/tree/borked |
21:15:11 | FromDiscord | <jtv> nimble build will blow up, but comment out the one line of code, it won't. The functions are all defined above in the file, and the type decl you saw is in types.h |
21:16:23 | FromDiscord | <Elegantbeef> Just a quick comment you can just do `VarStack(nil)` |
21:17:51 | FromDiscord | <jtv> Cool thanks. I was def playing 'find the syntax' when I wrote those bits. Was probably early Dec. |
21:18:32 | FromDiscord | <pyolyokh> `nimble build` doesn't blow up for me with that on stable, and in devel it errors out in nimaws, before getting to con4m itself |
21:18:50 | FromDiscord | <jtv> Weird, it does on 3 boxes for me on stable. |
21:18:55 | FromDiscord | <pyolyokh> <https://nim-lang.org/docs/manual_experimental.html#guards-and-locks-lock-levels> `{.locks: "unknown".}` |
21:19:16 | FromDiscord | <jtv> I guess I should try Linux not my macs |
21:19:30 | FromDiscord | <Elegantbeef> It errors on stable with the same thing for me |
21:19:38 | FromDiscord | <pyolyokh> ah, no, I naively assumed that the git clone command that github provides would reflect the current branch |
21:21:29 | FromDiscord | <pyolyokh> ok, type mismatch:, `got {.gcsafe, locks: <unknown>.}, but expected {.locks: 0.}` |
21:22:15 | FromDiscord | <Elegantbeef> do `BuiltInFn myProc` on all of them |
21:22:16 | FromDiscord | <jtv> Right, right. But on the function that fails (and a few more you can see down below), there's nothing significantly different in those procs on the surface. |
21:22:26 | FromDiscord | <Elegantbeef> This will convert to the proper procedure type |
21:23:06 | FromDiscord | <jtv> Ok will give it a shot thanks :). Wish I understood what's going on, I hate when problems seem random |
21:23:25 | FromDiscord | <Elegantbeef> The issue is that inside a definition like this the first procedure sets the type |
21:23:31 | FromDiscord | <Elegantbeef> So if there isnt a matching procedure later on it errors |
21:23:43 | FromDiscord | <Elegantbeef> If you do `BuiltInFn myProc` it converts them all to the same type |
21:23:50 | FromDiscord | <jtv> Sure, but what is causing those procs to be incompatable? |
21:24:09 | FromDiscord | <jtv> I did cast it and put it first in my attempts to fix, and it didn't work. But I'll try, just a second |
21:24:21 | FromDiscord | <Elegantbeef> It worked here doing what i said |
21:24:40 | FromDiscord | <jtv> Excellent |
21:24:47 | FromDiscord | <pyolyokh> what you probably ran into is that you cast only the first one. The second proc is now incompatible with it |
21:25:41 | FromDiscord | <jtv> When it decides to auto-cast a proc and when it doesn't is far from clear. I guess, "not in tuples" is one rule 🙂 |
21:25:42 | FromDiscord | <Elegantbeef> The issue really seems to be locklevels |
21:26:02 | FromDiscord | <Elegantbeef> Well the lock levels differ |
21:26:13 | FromDiscord | <Elegantbeef> You had `0` but attempted to add a `unknown` |
21:26:24 | FromDiscord | <Elegantbeef> Locklevels are a stupid feature, but they're apart of type resolution |
21:26:38 | FromDiscord | <Elegantbeef> A proc with a different lock level is a different type |
21:26:46 | FromDiscord | <Elegantbeef> So you need the conversion to strip that information off |
21:26:59 | FromDiscord | <jtv> Got it, thanks. |
21:27:20 | FromDiscord | <Elegantbeef> You also want to do the conversion to strip `gcsafe` and `noSideEffect`, if Nim inferred that it'd equally say "Type mismatch" |
21:28:08 | FromDiscord | <jtv> Sometime soon I'll find time to take the pain of converting to the devel branch, just that I need fine to build my own aws library, the ones out there are no better than the crap one that clearly breaks when you move forward |
21:28:49 | FromDiscord | <jtv> Really appreciate it though. |
21:32:30 | FromDiscord | <Elegantbeef> perhaps it's just so helpful no one ever needs to write about mismatches now |
21:56:06 | * | kenran quit (Remote host closed the connection) |
22:39:42 | * | argonica joined #nim |