00:08:54 | FromDiscord | <auxym> yeah, but nimx seems pretty active, latest commit 3 days ago |
00:17:19 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4oQG |
00:17:59 | FromDiscord | <Patitotective> found it, its called clamp :[ |
00:18:01 | FromDiscord | <Patitotective> (edit) ":[" => ":]" |
01:13:22 | NimEventer | New thread by yalexr: How to declare array (of unknown size) of floats for a webaudio wrapper function signature?, see https://forum.nim-lang.org/t/9925 |
01:29:14 | FromDiscord | <Dudugz> Any recommended MySQL drivers to use in a project? |
01:30:35 | FromDiscord | <Dudugz> Oh nvm I didn't see that ``std/db_mysql`` existed |
01:42:54 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
01:43:13 | * | jmdaemon joined #nim |
02:05:09 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4oQW |
02:07:06 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4oQX |
02:08:04 | FromDiscord | <Elegantbeef> It's likely your `Transform[T]()` |
02:12:07 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4oQY |
02:12:24 | FromDiscord | <Elegantbeef> Like i said it's `Transform[T]()` |
02:12:29 | FromDiscord | <Elegantbeef> I do not think that works |
02:12:47 | FromDiscord | <Elegantbeef> `T` is not instantiated so it attempts to do `Transform[T]` with an unistantiated T |
02:13:04 | FromDiscord | <sOkam!> it has worked before without the type being a ref, but maybe its due to the ref 🤔 |
02:13:24 | FromDiscord | <sOkam!> or maybe it wasn't a generic |
02:14:19 | FromDiscord | <Elegantbeef> Likely best to just make an overload |
02:15:41 | FromDiscord | <sOkam!> what do you mean? |
02:16:02 | FromDiscord | <Elegantbeef> `proc newRenderBody[T]()`↵`proc newRenderBody[T](mdl: RenderModel)`↵... |
02:17:11 | FromDiscord | <sOkam!> oh you mean having two separate versions of the proc without allowing the default value |
02:17:18 | FromDiscord | <sOkam!> didn't think about that |
02:19:06 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/Kzx |
02:19:09 | * | xet7 joined #nim |
02:23:08 | FromDiscord | <sOkam!> wait, LSP is saying "no parameters allowed for TransformEuler" 🤔 ↵is the generic definition wrong in some way? |
02:49:23 | FromDiscord | <Hourglass [She/Her]> I'll probably implement packets manually as I go, trying to auto-generate them is just causing me a headache and burning me out, and I'd like to get a semi-functional product eventually aha |
02:54:24 | * | void09_ quit (Ping timeout: 248 seconds) |
02:54:49 | * | void09 joined #nim |
03:01:07 | FromDiscord | <Dudugz> https://docs.github.com/en/actions/automating-builds-and-tests↵↵Is it possible to have automatic builds for Nim? If yes, could you show an example? I wish I could just commit and then have Github build the artifact |
03:05:10 | FromDiscord | <Hourglass [She/Her]> Yeah it's possible, you just need to create a GitHub Action that compiles the code and uploads the binary, I don't have any code for it though |
03:26:38 | FromDiscord | <Dudugz> Got it, good for now I'll focus on my project and later I'll see if I make a github action that compiles |
03:26:53 | FromDiscord | <Dudugz> (edit) "Got it, good for now I'll focus on my project and later I'll see if I make a github action that compiles ... " added "and upload the artifact" |
03:27:59 | FromDiscord | <amadan> There is an example here but its a bit complex↵https://github.com/nim-lang/langserver/blob/master/.github/workflows/binaries.yml |
03:28:00 | FromDiscord | <Hourglass [She/Her]> Good luck! I recommend testing in a private repo, it isn't that hard after you figure out how GH Actions work really |
03:28:28 | FromDiscord | <huantian> this is the actions i use for buidling <https://github.com/huantianad/levelsync/blob/master/.github/workflows/main.yml> |
03:28:35 | FromDiscord | <Dudugz> Thx guys i'll take a look |
03:28:59 | FromDiscord | <huantian> probably more complex than necessary but it has cool graph so worth https://media.discordapp.net/attachments/371759389889003532/1077794103514890401/image.png |
03:35:27 | FromDiscord | <asgeralstrup> Hi, does anyone know if there is an e-graph library for nim? I.e. like https://egraphs-good.github.io/ for Rust? |
03:37:21 | FromDiscord | <Iliketwertles> how could i translate `int uname(struct utsname buf);` ↵to `let kernel = syscall(UNAME)` |
03:37:51 | FromDiscord | <Iliketwertles> trying to use the syscall uname with syscall |
04:12:29 | * | azimut quit (Ping timeout: 255 seconds) |
04:20:31 | FromDiscord | <Hourglass [She/Her]> Is it possible to mark a template as async? Since my template should will call an async proc so i want to ensure any user using my api uses await on it |
04:21:21 | FromDiscord | <Elegantbeef> Just make the return type a future and carry on |
04:22:33 | FromDiscord | <Hourglass [She/Her]> Sweet thanks! |
04:29:25 | * | arkurious quit (Quit: Leaving) |
06:22:08 | FromDiscord | <ajusa> Is there a way to pass multiple untyped blocks to a template in Nim? |
06:24:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oRr |
06:25:15 | FromDiscord | <ajusa> Oh interesting, didn't know I could use `do` like that. I assume there isn't a way to have named blocks that are passed in? |
06:25:35 | FromDiscord | <Elegantbeef> A macro can use all the normal `of` `else` and firends |
06:25:43 | FromDiscord | <Elegantbeef> You cannot use arbitrary named blocks though |
06:26:12 | FromDiscord | <ajusa> gotcha, thanks! I'll probably just adjust my template to take in certain arguments as a string rather than doing everything in a DSL |
06:26:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oRs |
06:27:31 | * | ltriant quit (Ping timeout: 268 seconds) |
06:27:57 | * | xet7 quit (Ping timeout: 255 seconds) |
06:31:41 | FromDiscord | <gogolxdong> https://github.com/status-im/nim-graphql |
06:31:55 | FromDiscord | <gogolxdong> /home/ubuntu/nim-graphql/playground/swserver.nim(11, 23) Error: cannot open file: chronos |
06:32:18 | FromDiscord | <gogolxdong> nimble ethereum with/without nimble.lock |
06:32:53 | FromDiscord | <gogolxdong> (edit) "nimble ethereum with/without nimble.lock ... " added "with chronos installed." |
06:50:18 | FromDiscord | <amadan> Think Nim doesn't know how to read pkgs2?↵When I update the task to call nimble instead like `nimble c -r -d:release playground/swserver` it can compile fine |
06:52:39 | FromDiscord | <gogolxdong> yes, I tried on another server , it compiles instead, the difference is the one errors had choosenim installed, not sure it's relevant. |
06:58:32 | FromDiscord | <ajusa> Has anyone tried a couple of the filesystem monitoring packages? I want to detect when a file is changed and run some code accordingly - I tried using https://github.com/paul-nameless/nim-fswatch but that maxed out my CPU |
06:59:53 | FromDiscord | <Elegantbeef> I'd say make an issue fswatch |
06:59:53 | FromDiscord | <Elegantbeef> Or look at the code yourself 😄 |
07:00:14 | FromDiscord | <Gumbercules> I've had good luck wrapping: https://github.com/septag/dmon |
07:06:37 | FromDiscord | <gogolxdong> oh, not only that, I was updating Nim while compiling nimble etheruem , from Feb. 1 to latest and it errors again on another server. |
07:06:56 | FromDiscord | <gogolxdong> In reply to @amadan "Think Nim doesn't know": what's your nim build info |
07:09:31 | FromDiscord | <amadan> Basically the same↵nim: devel 1.9.1 (2023-02-21)↵nimble: 0.14.2 ↵choosenim: 0.8.4 |
07:14:24 | FromDiscord | <gogolxdong> it compiles after rename nimble.lock to some else. |
07:17:04 | FromDiscord | <amadan> How did you install nimble? |
07:20:03 | FromDiscord | <gogolxdong> build from source ./build_all.sh |
07:21:37 | FromDiscord | <4zv4l> is there a better way I can format this line ?↵`let default = (regex: "^Hello$", location: getEnv("PROGRAMDATA")/"evidence", box_title: "warning", box_content: "invalid data went into the clipboard", blame: 10, save: false)` |
07:21:52 | FromDiscord | <4zv4l> because it's quite long |
07:23:21 | FromDiscord | <amadan> In reply to @gogolxdong "build from source ./build_all.sh": looking at koch.nim it seems to install an older version of nimble than 0.14.2 (Whats the git hash for `nimble --version`?)↵I don't think you have the latest nimble which has some fixes for lock files |
07:23:34 | FromDiscord | <Rika> make an object, something that large shouldnt be a tupole |
07:23:37 | FromDiscord | <Rika> (edit) "tupole" => "tuple" |
07:24:30 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4oRy |
07:28:26 | FromDiscord | <4zv4l> looks alright ? |
07:28:28 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4oRz |
07:28:39 | FromDiscord | <4zv4l> not sure for the final return |
07:29:21 | FromDiscord | <4zv4l> or instead of making another object, I could modify directly the `default` one ? |
07:31:40 | FromDiscord | <Rika> make a constructor so you dont have a default config var |
07:32:00 | FromDiscord | <Rika> move all the parsing to procs for the object and stuff |
07:32:18 | FromDiscord | <Elegantbeef> Remove useless variables |
07:32:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oRB |
07:32:44 | FromDiscord | <Elegantbeef> Whoops commas required at the end of each field |
07:34:22 | FromDiscord | <gogolxdong> https://media.discordapp.net/attachments/371759389889003532/1077855854101020753/image.png |
07:34:50 | FromDiscord | <gogolxdong> It seems that 0.14.2 change the behaviour with nimble.lock file |
07:34:58 | FromDiscord | <gogolxdong> (edit) "change" => "changes" |
07:36:06 | FromDiscord | <gogolxdong> yes, build from source gets 0.14.0, 0.14.2 is download installed. |
07:36:19 | FromDiscord | <gogolxdong> (edit) "yes, build from source gets 0.14.0, ... 0.14.2" added " my" |
07:36:27 | FromDiscord | <4zv4l> In reply to @Elegantbeef "This can be rewritten": will try this, looks better indeed |
07:39:33 | FromDiscord | <Arathanis> How come functions can raise Exceptions? surely that is considered a side effect |
07:39:36 | FromDiscord | <Arathanis> (edit) "effect" => "effect." |
07:39:43 | FromDiscord | <Arathanis> (edit) "Exceptions?" => "exceptions?" |
07:39:51 | FromDiscord | <Arathanis> (edit) "surely" => "Surely" |
07:41:14 | FromDiscord | <Rika> it is tracked as a separate kind of effect |
07:41:41 | FromDiscord | <Arathanis> Not sure I understand what that means |
07:41:44 | FromDiscord | <Rika> if you want to enforce no catchables are thrown use `{.raises: [].}` |
07:41:47 | FromDiscord | <Arathanis> It just doesn't count? |
07:42:07 | FromDiscord | <Elegantbeef> It's not a side effect in Nim's mind |
07:42:08 | FromDiscord | <Rika> its tracked by a different system |
07:42:22 | FromDiscord | <Elegantbeef> You can argue all day about what a side effect is, Nim has specific ideas of what one is |
07:42:28 | FromDiscord | <Rika> side effects are strictly non-local variable access |
07:42:50 | FromDiscord | <Arathanis> I am not trying to argue, just seeking to understand what is and is not considered a side effect for the purposes of functions |
07:43:02 | FromDiscord | <Arathanis> Trying to improve my skill with the language. |
07:43:03 | FromDiscord | <Elegantbeef> hey you can grow the stack or heap allocate inside a function |
07:43:29 | FromDiscord | <Rika> beef is just tired of certain other people arguing about what a side effect is |
07:43:33 | FromDiscord | <Rika> forgive him for being so wary |
07:43:34 | FromDiscord | <Arathanis> Are there any other "side effects" I should be aware of that are allowed in functions? |
07:43:58 | FromDiscord | <Arathanis> Certain people don't want to admit haskell is only interesting academically 😎 |
07:44:01 | FromDiscord | <Elegantbeef> Nim's default side effect tracking is "mutating any value type that isnt passed in as a `var` |
07:44:24 | FromDiscord | <Elegantbeef> Stricfuncs in 2.0+ disallow mutating any reference inside a func |
07:44:27 | FromDiscord | <Rika> any function that does `{.cast(nosideeffect).}: ...` will be treated as no side effect, up to your interpretation whether you agree or not |
07:44:42 | FromDiscord | <Rika> i forgot if thats the real syntax |
07:44:48 | FromDiscord | <Rika> but its to the tune of what i wrote |
07:45:01 | FromDiscord | <Elegantbeef> `{.noSideEffect.}:` |
07:45:02 | FromDiscord | <Elegantbeef> Do not think it requires a cast oddly |
07:45:13 | FromDiscord | <Elegantbeef> I might be misremembering |
07:45:18 | FromDiscord | <Elegantbeef> I use funcs so seldomly |
07:45:25 | FromDiscord | <Rika> ah yes the two of us not remembering |
07:45:29 | FromDiscord | <Rika> what a great scenario |
07:45:35 | FromDiscord | <Elegantbeef> ` {.cast(noSideEffect).}:` |
07:45:37 | FromDiscord | <Elegantbeef> That's correct |
07:46:02 | FromDiscord | <Arathanis> ok i understand now |
07:46:03 | FromDiscord | <Rika> what would you consider as a side effect arathanis |
07:46:12 | FromDiscord | <Arathanis> in large part func means it wont mutate global state |
07:46:13 | FromDiscord | <Rika> just so we can say if it is considered by nim or not |
07:46:15 | FromDiscord | <Rika> yes |
07:46:17 | FromDiscord | <Arathanis> or thread local state |
07:46:24 | FromDiscord | <Rika> not sure about that one |
07:46:36 | FromDiscord | <Arathanis> im reading the docs on noSideEffect |
07:46:38 | FromDiscord | <Rika> anything that isnt accessible by the parameters of the function |
07:46:46 | FromDiscord | <Arathanis> it says it cant access globals or threadlocals |
07:50:55 | * | PMunch joined #nim |
07:52:12 | FromDiscord | <Gumbercules> https://media.discordapp.net/attachments/371759389889003532/1077860343134564403/fps_camera_demo.gif |
07:52:51 | FromDiscord | <Gumbercules> tessellation and LODing via compute shader |
07:52:57 | * | kenran joined #nim |
07:53:06 | FromDiscord | <Elegantbeef> I appreciate the hmm.nim |
07:53:15 | FromDiscord | <Gumbercules> \o/ |
07:53:38 | FromDiscord | <Gumbercules> at this point it's basically a port of handmade math |
07:53:47 | FromDiscord | <Gumbercules> although I only have the SSE2 implementations ported |
07:54:14 | FromDiscord | <Elegantbeef> Oh i take it back, i thought it was just a dummy file of you toying with something |
07:54:25 | FromDiscord | <Gumbercules> nah |
07:54:31 | FromDiscord | <Arathanis> it stands for heavy macro mutation |
07:54:38 | FromDiscord | <Gumbercules> if only |
07:54:43 | FromDiscord | <Gumbercules> I think now it's time to do some shadow mapping |
07:55:29 | FromDiscord | <Gumbercules> that or more brushes now that I have this tessellation + picking thing sorted out |
08:46:40 | * | Notxor joined #nim |
08:59:43 | * | kenran quit (Remote host closed the connection) |
09:22:34 | * | jmdaemon quit (Ping timeout: 246 seconds) |
09:38:57 | PMunch | Ooh, the error I was facing with rewriting `echo` actually didn't have anything to do with that part |
09:39:03 | PMunch | It's just a random ORC bug |
09:39:33 | PMunch | So httpbeast doesn't work on devel |
09:44:16 | FromDiscord | <Elegantbeef> cry with `--mm:refc` |
09:44:43 | * | NimEventer quit (Remote host closed the connection) |
09:44:57 | * | NimEventer joined #nim |
09:46:30 | PMunch | Aha, it's actually a `--threads:on --gc:orc` bug |
09:46:52 | FromDiscord | <I have 50GB of nothing on my PC> will variable overloading be implemented anywhere in the near future? |
09:46:54 | PMunch | With `--threads:off --gc:orc` or `--threads:on --gc:refc` everything works fine |
09:47:04 | FromDiscord | <I have 50GB of nothing on my PC> sent a code paste, see https://play.nim-lang.org/#ix=4oS5 |
09:47:04 | FromDiscord | <I have 50GB of nothing on my PC> this kind |
09:47:06 | PMunch | @I_have_50GB_of_nothing_on_my_PC, variable overloading? |
09:47:23 | FromDiscord | <Elegantbeef> Nim already has shadowing in scopes |
09:47:25 | PMunch | I highly doubt it, and personally would be against it |
09:47:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oS6 |
09:48:06 | FromDiscord | <Elegantbeef> Anything other than scope based is just awful |
09:48:29 | FromDiscord | <I have 50GB of nothing on my PC> I respectfully disagree |
09:48:54 | FromDiscord | <Elix> Hey, i having some issues.↵I cant get an output when using echo, am i doing something wrong? https://media.discordapp.net/attachments/371759389889003532/1077889713307930674/image.png |
09:49:00 | PMunch | Why do you think that would be a desirable feature? |
09:49:02 | FromDiscord | <Elegantbeef> Templates/macros could introduce variables with the same name as a variable already declared and you wouldnt know that you now have a string |
09:49:29 | FromDiscord | <Rika> In reply to @Elix "Hey, i having some": What’s the source? |
09:49:35 | PMunch | @Elix, kinda hard to tell what's wrong without any code |
09:49:57 | FromDiscord | <Elix> just ``echo "Hello World"``lol |
09:50:40 | FromDiscord | <Rika> Did you save the file after making it |
09:50:52 | FromDiscord | <Rika> Check using cat |
09:50:54 | PMunch | Yeah that sounds incorrect |
09:51:09 | FromDiscord | <Rika> You mean the behaviour is incorrect |
09:51:13 | FromDiscord | <Rika> The code is right |
09:51:25 | FromDiscord | <Elix> In reply to @Rika "Did you save the": omg, that was the issue |
09:51:31 | FromDiscord | <Elix> first time using vs code |
09:51:32 | FromDiscord | <Rika> Haha |
09:51:45 | FromDiscord | <Rika> Yeah no auto save by default |
09:51:49 | FromDiscord | <Rika> Gotta turn it on iirc |
09:52:14 | FromDiscord | <I have 50GB of nothing on my PC> sent a code paste, see https://play.nim-lang.org/#ix=4oSb |
09:52:24 | FromDiscord | <I have 50GB of nothing on my PC> btw should I paste code blocks here, given IRC doesn't support those well? |
09:52:31 | FromDiscord | <Rika> Why are your stacks all different types? |
09:52:38 | FromDiscord | <Rika> It’s fine |
09:52:47 | FromDiscord | <Rika> The bot translates them into abetter format for IRC |
09:52:53 | FromDiscord | <Rika> (edit) "abetter" => "a better" |
09:52:54 | PMunch | Yeah, the bridge bot creates links out of them :) |
09:53:10 | PMunch | Unfortunately it's not smart enough to extract mentions.. |
09:53:29 | FromDiscord | <Rika> Replies more of |
09:53:32 | PMunch | So if you reply to people on IRC you should put their mention in a separate message |
09:57:17 | PMunch | @I_have_50GB_of_nothing_on_my_PC, well it helps if you structure your code a bit better: https://play.nim-lang.org/#ix=4oSd |
09:59:24 | PMunch | Or if you want to keep your structure and not pollute your namespace with a bunch of variables (and keep `stack` immutable): https://play.nim-lang.org/#ix=4oSf |
10:11:05 | NimEventer | New thread by shirleyquirk: Ffi: how to pass a value to c?, see https://forum.nim-lang.org/t/9926 |
10:12:49 | FromDiscord | <Rika> Oh cool someone trying to run Nim on an FPGA |
10:25:00 | FromDiscord | <Tanguy> Or properly name your variables↵stack2 -> formattedStack↵stack3 -> stackAsString↵Or whatever |
10:26:25 | FromDiscord | <Elegantbeef> I personally name my variables `variablei` where `i` is a constantly incrementing value that i keep track of |
10:27:17 | FromDiscord | <Elegantbeef> Fuck that's a fantastic troll language feature 😄 |
10:27:24 | FromDiscord | <Rika> Just name them single letters though |
10:27:26 | FromDiscord | <Tanguy> That's too clear, you are giving the fact that it's a variable, just `v1`, `v2`, etc |
10:27:36 | FromDiscord | <ieltan> random library that doesnt work with devel :/ |
10:27:43 | FromDiscord | <Elegantbeef> `Error: Expected a v3, but got v5` |
10:27:44 | FromDiscord | <ieltan> i hope v2 comes soon |
10:27:49 | FromDiscord | <Rika> Which |
10:28:01 | FromDiscord | <Rika> Oh you mean a random number library? |
10:28:17 | FromDiscord | <ieltan> no |
10:28:24 | FromDiscord | <ieltan> db_common import |
10:28:33 | FromDiscord | <ieltan> (edit) "db_common" => "std/db_common" |
10:28:42 | FromDiscord | <ieltan> which got its own nimble package now |
10:28:54 | FromDiscord | <ieltan> and libraries using it naturally wont compile |
10:28:56 | FromDiscord | <Elegantbeef> So what's the issue? |
10:29:02 | FromDiscord | <Elegantbeef> Ah |
10:29:11 | FromDiscord | <ieltan> nothing i just switched to 1.6.10 |
10:29:38 | FromDiscord | <ieltan> i was just saying that i hope v2 comes soon so that libraries can finally support it |
10:29:40 | FromDiscord | <ieltan> :p |
10:29:40 | FromDiscord | <Elegantbeef> I'd say make a PR |
10:29:48 | FromDiscord | <Elegantbeef> Libraries can presently support it |
10:30:15 | FromDiscord | <ieltan> it already has a pr i think |
10:30:17 | FromDiscord | <ieltan> https://github.com/xzfc/ndb.nim/pull/23 |
10:30:32 | FromDiscord | <ieltan> dead project ? 😢 |
10:30:51 | FromDiscord | <ieltan> the author also have low activity |
10:30:56 | FromDiscord | <ieltan> welp cant be helped |
10:32:33 | FromDiscord | <ieltan> by author i mean the repo maintainer |
10:32:37 | FromDiscord | <ieltan> had to specify that |
10:33:01 | FromDiscord | <ieltan> oh, seems like the reviewer is quite active |
10:47:40 | * | xet7 joined #nim |
10:49:05 | * | advesperacit joined #nim |
10:50:14 | FromDiscord | <amadan> lowdb is a fork of it that works with devel |
10:50:34 | FromDiscord | <amadan> https://github.com/PhilippMDoerner/lowdb |
10:52:19 | NimEventer | New thread by sgmoore: How do I detect/guess the encoding used in a text file?, see https://forum.nim-lang.org/t/9927 |
10:56:09 | FromDiscord | <Phil> Pretty much, I contribute to norm occassionally and the fact that ndb wasn't nim 2.0 compatible was really grating on me, as that meant norm wasn't nim 2.0 compatible which I needed because I was using it in a project that required nim 2.0 |
10:56:19 | FromDiscord | <Phil> Thus the fork, norm will soon-ish follow suite |
10:59:30 | FromDiscord | <ieltan> yeah, i used yesterday norm and thats how i found out ndb doesnt support 2.0 |
11:00:36 | FromDiscord | <Phil> If you want to have a 2.0 compatible norm version now I have a fork I currently use |
11:00:38 | FromDiscord | <ieltan> eventually switched to ponairi because it's too awesome of a library for me to use for what im doing but ended up importing ndb anyways because the db connector function doesnt support mariadb's so i rolled my own with it |
11:01:37 | FromDiscord | <ieltan> In reply to @Isofruit "If you want to": well i dont need it a 2.0 compatible norm just a ndb one |
11:01:39 | FromDiscord | <Phil> https://github.com/PhilippMDoerner/norm/tree/nim2↵There, my private fork I currently use that eventually will get bumped into norm when I can find the time |
11:01:44 | FromDiscord | <Phil> Ah, in that case just use lowdb |
11:01:46 | FromDiscord | <ieltan> but thanks i will keep it in mind |
11:01:52 | FromDiscord | <ieltan> alright |
11:01:55 | FromDiscord | <ieltan> thanks man |
11:01:59 | FromDiscord | <Phil> 👍 |
11:02:06 | FromDiscord | <ieltan> btw |
11:02:24 | FromDiscord | <ieltan> Is it good practice to use `include` ? |
11:02:29 | FromDiscord | <Phil> NO! |
11:02:31 | FromDiscord | <ieltan> I have to cope with my |
11:02:37 | FromDiscord | <ieltan> ide screwing up |
11:02:37 | FromDiscord | <Phil> Avoid, steer clear, do not use unless necessary |
11:02:53 | FromDiscord | <ieltan> Well here's my answer 😂 |
11:03:05 | FromDiscord | <Phil> Include is basically copy-pasting code, but in a sense that any copy does not recognize another copy |
11:03:27 | FromDiscord | <Phil> As in, if you define `type A = object` in a file and include it, you now have 2 `type A = object` definitions that are not compatible with one another |
11:03:35 | FromDiscord | <ieltan> I wasn't sure why my IDE was screwing basic hover informations |
11:03:44 | FromDiscord | <ieltan> In reply to @Isofruit "As in, if you": what about function overloading |
11:04:07 | FromDiscord | <ieltan> because it's kind of the reason why i needed the include |
11:04:11 | FromDiscord | <Phil> Include is a way to split files that otherwise would be gargantuan into smaller source files and combine them all in a single file that includes all the smaller files and then you just import this "combiner" file |
11:04:18 | FromDiscord | <Phil> But I have yet to encounter a usecase where that would actually be necessary |
11:05:16 | FromDiscord | <Phil> In reply to @ieltan "what about function overloading": there's a lot of overloading you can do.↵Do you mean you want to have 2 procs with the same name and the same parameters? |
11:05:23 | NimEventer | New thread by sls1005: Garbage Collectors and Shared Libraries, see https://forum.nim-lang.org/t/9928 |
11:06:19 | FromDiscord | <ieltan> In reply to @Isofruit "there's a lot of": actually i am not sure if its overloading, basically i am making a discord bot with `dimscord` and `dimscmd` and theres lots of `cmd.addChat()` and it uses `do` notation |
11:06:29 | FromDiscord | <ieltan> dont really know what it does |
11:06:41 | FromDiscord | <Phil> I still don't know where you want to go 😛 |
11:06:46 | FromDiscord | <ieltan> but thats not important, i want to organize my code |
11:06:50 | FromDiscord | <ieltan> yeah i am getting to that |
11:08:45 | FromDiscord | <ieltan> i have a feature folder at the root of my project where each file implement a command and everything related to it so for example i have `feature/ping.nim`, i put in a `cmd.addChat("ping")` blablabla |
11:09:27 | FromDiscord | <ieltan> at the root of my project i have `discordbot.nim`, i want it to be the main file |
11:10:15 | FromDiscord | <ieltan> i want to "import ping", so that its like its part of `discordbot.nim` but if i just use a bare `import` it says 'import not used' or something |
11:11:16 | FromDiscord | <ieltan> if i use `include` instead it doesnt say it but the price for this is total obliteration of my IDE and potentially lots of 'multiple import' warnings |
11:11:47 | FromDiscord | <ieltan> so is there a clean solution to my problem or do i have to cope with a gigormous `discordbot.nim` |
11:11:49 | FromDiscord | <ieltan> ? |
11:15:32 | * | ltriant joined #nim |
11:27:29 | FromDiscord | <ieltan> looks like my beginner comprehension of Nim is showing up, i imagined a problem where there was actually none https://media.discordapp.net/attachments/371759389889003532/1077914520443424788/image.png |
11:28:15 | FromDiscord | <ieltan> seems like i could ignore the warnings |
11:28:23 | FromDiscord | <ieltan> i'll run tests and see |
11:36:13 | FromDiscord | <Phil> While semi distracted at work I can fundamentally not get the issue.↵I only see at a glance that you never typically just use a blank `import`, it's always `import <package/module>` |
12:13:14 | * | Notxor quit (Remote host closed the connection) |
12:13:40 | * | Notxor joined #nim |
12:29:53 | * | azimut joined #nim |
12:38:44 | FromDiscord | <ieltan> In reply to @Isofruit "While semi distracted at": it's okay i got it |
12:38:56 | FromDiscord | <ieltan> err on the other hand my nimsuggest has completely died |
12:39:56 | FromDiscord | <ieltan> no more linting even though i should have blatant errors |
12:40:31 | FromDiscord | <ieltan> turned one of my `const` to `consté` and yup, nothing |
12:41:47 | FromDiscord | <Phil> I will admit that I don't use nimsuggest... I think |
12:41:55 | FromDiscord | <Phil> Honestly I never get how people even notice it's on |
12:42:04 | FromDiscord | <Phil> The compiler finds my naming problems |
12:43:23 | FromDiscord | <ieltan> i think having linting ahead of compile is pretty nice but i could just compile, yeah |
12:43:57 | FromDiscord | <ieltan> i mean, it's kinda annoying to compile everytime i want to check something now |
12:44:20 | FromDiscord | <ieltan> it worked minutes ago |
12:44:34 | FromDiscord | <ieltan> why did it die on me, trying pkill doesnt work it seems 😢 |
12:50:47 | FromDiscord | <4zv4l> can I include a dll inside of my nim program ?↵so I don't need to give the dll with it ? |
12:52:35 | FromDiscord | <demotomohiro> How about to use static link library instead of dll in that case? |
12:53:10 | FromDiscord | <4zv4l> because it seems that most `.lib` I find out there don't have the function label so I can't use them correctly |
12:56:11 | FromDiscord | <demotomohiro> If you can get source code and right build tools you can build `.lib` file that can be statically linked. |
12:57:30 | FromDiscord | <Phil> In reply to @ieltan "i mean, it's kinda": I have not known another way, I just always compile on save.↵With nimsuggest my experience was that I was always waiting anyway, with the compile-always approach I at least got proper text in the terminal telling me the error ^^ |
12:57:37 | FromDiscord | <4zv4l> but I don't have visual studio↵so if I can use the `.lib` would be nice |
12:57:50 | FromDiscord | <4zv4l> how would I do to compile with the ´.lib´ ? |
12:58:14 | FromDiscord | <4zv4l> `{.passL="mylib.lib".}` ?↵and the proc imported↵`{.importc.}` ? |
13:01:43 | FromDiscord | <Hourglass [She/Her]> https://github.com/JorySchossau/bitset gonna be using the library because it looks simple and does what I need |
13:02:49 | FromDiscord | <demotomohiro> In reply to @4zv4l "but I don't have": I wrote an article about how to use C static library from NIm:↵https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html |
13:03:50 | FromDiscord | <Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "https://github.com/JorySchossau/bitset gonna be usi": Actually nvm |
13:08:04 | FromDiscord | <4zv4l> In reply to @demotomohiro "I wrote an article": well I quickly read it↵I get an error like in your article with `undefined reference`↵but there is no order to give since there is only my `.nim` and the `.lib` |
13:10:37 | FromDiscord | <4zv4l> now I'm trying with `vcc` since I had more luck with this one↵but it takes ages to compile |
13:11:20 | FromDiscord | <4zv4l> what happened before is that↵with `gcc`: didn't compile due to `undefined reference`↵with `vcc`: compiled but segfault when calling function from the lib |
13:12:11 | FromDiscord | <theSherwood> Is there a way to get the signature of closure as a runtime value? And is there a simpler way to do that than writing a custom macro? |
13:12:44 | FromDiscord | <demotomohiro> Nim add passL options after compiled Nim code so you can call C functions in static libraries from Nim. |
13:13:54 | PMunch | @theSherwood, this question sounds like you're doing something wrong. What are you actually trying to do? |
13:14:12 | FromDiscord | <4zv4l> I saw this from a stackoverflow post about `another` static library↵> open your static library (soloud_static_x64.lib) with some text/hex editor and search for "Soloud_create". i guess you will not find anything. so why is that? because for some reason author decided to not include "C interfacing" in a static library project. so it contains only C++ symbols and not pure C symbols that are needed for our solouddotnim.nim module.↵maybe th |
13:14:52 | FromDiscord | <demotomohiro> There are two kind of `.lib` files on windows, one for static link and another is for link dll.↵Maybe you are trying to link `.lib` file for dll, not for static link. |
13:15:07 | FromDiscord | <4zv4l> I am making a dll indeed |
13:15:21 | FromDiscord | <4zv4l> but I wanna use the function from the `.lib` in my dll |
13:15:37 | FromDiscord | <theSherwood> @PMunch I want to be able to write commands that a user can dispatch by string and see the signature when they do so as to decide which arguments to pass. Sort of a user-programming thing. |
13:17:06 | FromDiscord | <4zv4l> In reply to @4zv4l "but I wanna use": that's a problem ? 🥹 |
13:17:13 | FromDiscord | <Nerve> Is the author of the `docopt` package in this Discord? |
13:17:31 | FromDiscord | <demotomohiro> In reply to @4zv4l "I am making a": Do you making a dll that call functions in other dll?↵And you want to link statically these dlls in your dll? |
13:18:28 | FromDiscord | <4zv4l> a process will call my dll↵my dll shouldn't require another dll except kernel32 |
13:18:41 | FromDiscord | <4zv4l> I wanna use code from the `.lib` |
13:18:43 | FromDiscord | <4zv4l> in my dll |
13:19:02 | PMunch | @theSherwood, I see, what I would do is generate an array indexed by an enum of your procs which holds the signatures and proc pointer. Of course the easiest would be to generate it from a macro |
13:19:38 | PMunch | Something similar to what I did in this article: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
13:19:53 | PMunch | But instead of hard-coded explanations grab the signature |
13:20:32 | FromDiscord | <theSherwood> That sounds like what I had in mind. Thanks for the examples |
13:20:38 | PMunch | To answer your original question, no there is no way of getting the type information at runtime. Nim throws away this information during compilation. What you need to do is tell Nim to keep it somehow through the use of a macro |
13:21:16 | PMunch | It's a bit unfamiliar if you're coming from a dynamic language, but it makes sense once you get used to it |
13:21:24 | FromDiscord | <theSherwood> That's what I figured. I wanted to double-check if there was some ready-made reflection tooling or if I needed to write something myself. |
13:21:55 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/4oTn |
13:23:10 | FromDiscord | <theSherwood> In reply to @PMunch "It's a bit unfamiliar": The codebase is currently javascript/typescript. I'm considering rewriting bits in a piecemeal fashion in Nim, and compiling to modules to javascript until the whole thing is ported over. |
13:23:29 | FromDiscord | <theSherwood> (edit) "to" => "the Nim" |
13:23:54 | PMunch | Ah I see, sounds fun |
13:24:08 | FromDiscord | <theSherwood> Yeah. Thanks for your help |
13:24:32 | PMunch | I'm not aware of any reflection libraries unfortunately. But there seems to be some demand for it, so if you want to give it a go it should become a fairly popular library |
13:25:57 | FromDiscord | <demotomohiro> In reply to @4zv4l "a process will call": If you want to link `.lib` file statically, these `.lib` files must be compiled from C/C++ code and linked with `ar` in binutils or `lib` in vcc to generate static link library. |
13:26:46 | FromDiscord | <demotomohiro> You cannot link `.lib` file statically if it was built to link a dll file. |
13:30:31 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4oTr |
13:31:24 | FromDiscord | <demotomohiro> Is `NtHookEngine.lib` is a `.lib` file for static link or dynamic link? |
13:31:24 | FromDiscord | <4zv4l> I have to compile my Nim lib to object file↵then use `ar` to link them together `.o` with `.lib` ? |
13:31:39 | FromDiscord | <4zv4l> In reply to @demotomohiro "Is `NtHookEngine.lib` is a": how can I see that ? |
13:31:54 | FromDiscord | <4zv4l> https://github.com/raigorx/nthookengine |
13:31:59 | FromDiscord | <4zv4l> NtHookEngine my bad |
13:32:23 | FromDiscord | <demotomohiro> `ar` command is used for generating static link library. |
13:32:31 | FromDiscord | <4zv4l> oh |
13:32:34 | FromDiscord | <4zv4l> then vcc ? |
13:34:44 | FromDiscord | <demotomohiro> https://github.com/raigorx/nthookengine/tree/main/nthookengine_modified/NtHookEngine/x64/Release↵There are `.dll` and `.lib`. That `.lib` file probably for dynamic link. |
13:35:14 | FromDiscord | <4zv4l> I thought `dll` was for dynamic link↵and `lib` for static link |
13:35:29 | FromDiscord | <demotomohiro> In reply to @4zv4l "oh": You probably need to open `.sln` file with vcc and build static link library. |
13:35:45 | FromDiscord | <4zv4l> so I cannot avoid using visual studio right ? |
13:36:00 | FromDiscord | <demotomohiro> There are two kind of .lib files on windows, one for static link and another is for link dll. |
13:36:20 | FromDiscord | <4zv4l> so that's a parameter to give when compiling the `.lib` ? |
13:39:07 | FromDiscord | <demotomohiro> For example, C programs that use functions in kernel32.dll links kernel32.lib. That program links kernel32.dll at runtime and cannot run without kernel32.dll. |
13:39:18 | FromDiscord | <Hourglass [She/Her]> I'm loading Nim shared libraries in Nim, and I'm wondering if it'd be possible to use the async pragma on them, anything that could cause issues? |
13:39:23 | FromDiscord | <4zv4l> In reply to @demotomohiro "For example, C programs": yes right |
13:39:34 | FromDiscord | <4zv4l> oh wait |
13:39:49 | FromDiscord | <4zv4l> why `kernel32.lib` ? |
13:40:05 | * | crem joined #nim |
13:40:20 | FromDiscord | <demotomohiro> In reply to @4zv4l "so that's a parameter": If I remember correctly, you can add configurations for building static library on vcc ide. |
13:41:51 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/4oTt |
13:42:31 | FromDiscord | <4zv4l> In reply to @demotomohiro "If I remember correctly,": alright and if I can give the `.lib` with my dll, is it easier ? |
13:43:07 | FromDiscord | <4zv4l> I just don't understand why the program load my dll the hook works↵but when I inject it, it doesn't work |
13:43:11 | FromDiscord | <4zv4l> so many questions |
13:43:12 | FromDiscord | <4zv4l> xD |
13:43:26 | FromDiscord | <jmgomez> Bare in mind that .lib can also contain "weak symbols" for your dll and you will need it at link time |
13:43:47 | FromDiscord | <4zv4l> In reply to @jmgomez "Bare in mind that": link time is no issue↵what about runtime ? |
13:44:03 | FromDiscord | <4zv4l> I can even give the `.lib` with my dll if that's easier |
13:44:08 | FromDiscord | <4zv4l> I just want it to work at this point xD |
13:44:15 | FromDiscord | <jmgomez> no need for lib at runtime |
13:44:54 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/zRF |
13:44:58 | FromDiscord | <jmgomez> how are you using it? Take a look at this: https://github.com/jmgomez/NimForUE/blob/master/src/nimforue/ffinimforue.nim |
13:45:30 | FromDiscord | <jmgomez> why not just pass the library to the nim compiler? |
13:45:47 | FromDiscord | <demotomohiro> In reply to @4zv4l "I just don't understand": This document might help you to understand about dlls:↵https://learn.microsoft.com/en-us/windows/win32/dlls/about-dynamic-link-libraries |
13:45:51 | FromDiscord | <jmgomez> anyways, if the c/cpp linker doesnt complain you should be fine |
13:46:22 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4oTy |
13:46:34 | FromDiscord | <4zv4l> In reply to @jmgomez "how are you using": I'll check that |
13:46:38 | FromDiscord | <4zv4l> In reply to @demotomohiro "This document might help": and that |
13:47:09 | FromDiscord | <demotomohiro> On windows, both static link library and import library have same extension `.lib` that makes confusions for beginers. |
13:47:54 | FromDiscord | <jmgomez> Yes.. |
13:48:05 | PMunch | Ugh, there BareExcept warnings are spamming my output.. |
13:48:30 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4oTA |
13:48:32 | FromDiscord | <jmgomez> I dont get what are you trying to do, long story short there are two ways of using a dynamic library, with the pragma or loading it explicitally with loadLib |
13:48:40 | FromDiscord | <4zv4l> In reply to @demotomohiro "On windows, both static": I don't know import library |
13:48:54 | FromDiscord | <4zv4l> I just know about library you use at runtime dynamically↵and static that you include in your code directly |
13:48:55 | FromDiscord | <jmgomez> the pragma works for exporting and importing |
13:49:38 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4oTC |
13:49:50 | FromDiscord | <4zv4l> so for that I need to compile using their library↵so it is included in my dll |
13:50:11 | FromDiscord | <4zv4l> so I import them |
13:50:23 | FromDiscord | <jmgomez> I dont think this is the correct way to hook the library. Either use dynlib or loadlib |
13:50:38 | FromDiscord | <4zv4l> I don't wanna hook the library |
13:50:44 | FromDiscord | <4zv4l> I wanna use the library to hook a program |
13:50:55 | FromDiscord | <jmgomez> Then how do you expect to call the library from Nim? |
13:51:13 | FromDiscord | <4zv4l> the library contains code that allows to hook functions |
13:51:18 | FromDiscord | <4zv4l> I try to use that library in my dll |
13:51:24 | FromDiscord | <4zv4l> to do the hook part |
13:51:40 | FromDiscord | <4zv4l> since `nimhook`/`minhook` nim library didn't work |
13:51:56 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/4oTE |
13:53:48 | FromDiscord | <4zv4l> so it's not like a `.o` file that I can link with my dll and the code is all included inside of it ? |
13:54:15 | FromDiscord | <4zv4l> I need to give `clib.dll` and `clib.lib`↵and when the `clib.dll` will be loaded↵it will search for `clib.lib` ? |
13:55:04 | FromDiscord | <4zv4l> it is so confusing |
13:56:16 | FromDiscord | <demotomohiro> https://learn.microsoft.com/en-us/windows/win32/dlls/load-time-dynamic-linking |
13:57:30 | FromDiscord | <4zv4l> that is how dll are loaded when the program starts right ? |
13:59:00 | FromDiscord | <demotomohiro> When you write a program that uses `clib.dll` in "load-time dynamic linking", you specify `clib.lib` to a linker to build your program.↵When you run that program, OS automatically search for `clib.dll` and link to the program.↵`clib.lib` is used only when build that program, not used at runtime. |
14:00:15 | FromDiscord | <4zv4l> alright, the dll is not load-time dynamic linking |
14:00:32 | FromDiscord | <4zv4l> I inject it to the process↵creating a thread and calling `LoadLibrary()` |
14:01:49 | NimEventer | New thread by jhgalino: New vs object literal for ref objects, see https://forum.nim-lang.org/t/9929 |
14:03:52 | FromDiscord | <Hourglass [She/Her]> Is it possible to check if a function is asynchronous? The way i can access it is via the pointer |
14:06:31 | FromDiscord | <Dudugz> https://luau-lang.org/↵Does anyone know if there are any bindings being developed for Nim? I would like to implement Luau in a project in the future, but for what I'm going to have to create the bindings myself. |
14:06:51 | FromDiscord | <Dudugz> (edit) "https://luau-lang.org/↵Does anyone know if there are any bindings being developed for Nim? I would like to implement Luau in a project in the future, but for what ... I'm" added "i saw" |
14:07:38 | FromDiscord | <Dudugz> The issue is that Luau is safer than Lua due to several factors besides being typeable. |
14:08:09 | FromDiscord | <Dudugz> (edit) "issue" => "thing" |
14:08:51 | * | Notxor quit (Remote host closed the connection) |
14:15:19 | FromDiscord | <4zv4l> how do I get the type of a proc ? |
14:15:27 | FromDiscord | <4zv4l> so it easier to cast pointer to function pointer |
14:16:56 | FromDiscord | <Phil> In reply to @4zv4l "how do I get": In what sense?↵Like how do you do the type annotation easily? |
14:17:35 | FromDiscord | <4zv4l> I cannot like `cast[tye(myProc)](fptr)(3)` |
14:17:42 | FromDiscord | <4zv4l> if the proc is `proc (x: int)` |
14:17:58 | FromDiscord | <4zv4l> (edit) "`cast[tye(myProc)](fptr)(3)`" => "`cast[type(myProc)](fptr)(3)`" |
14:18:00 | FromDiscord | <Phil> So you have a pointer and you want to cast it to something executable? |
14:18:10 | FromDiscord | <4zv4l> to a function yes |
14:18:53 | FromDiscord | <Phil> Generally I'd write the proc-type out by hand.↵So `cast[proc(x: int)](fptr)(3)` |
14:19:02 | FromDiscord | <4zv4l> but that's a long type proc |
14:19:04 | FromDiscord | <Phil> Though for readability I recommend always throwing proc types behind alias |
14:19:19 | FromDiscord | <4zv4l> `(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT): int32{.stdcall.}` |
14:19:22 | FromDiscord | <4zv4l> that is the proc type lol |
14:19:26 | FromDiscord | <Phil> Yeah, alias that shit |
14:19:49 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4oTJ |
14:19:50 | FromDiscord | <Phil> And that for your long-ass super-proc |
14:21:03 | FromDiscord | <Phil> I make copious usage of type aliasing whenever I start using procs as variables that can be passed around |
14:22:39 | FromDiscord | <4zv4l> I'm gonna ↵break my head jeez |
14:23:12 | FromDiscord | <4zv4l> would be much simpler if `rdpclip` was using `GetMessage` |
14:29:07 | FromDiscord | <I have 50GB of nothing on my PC> how to show the user fzf in an interactive way? |
14:29:25 | FromDiscord | <I have 50GB of nothing on my PC> I think my script just doesn't show the output from fzf |
14:32:42 | PMunch | poParentStreams I believe |
14:33:45 | FromDiscord | <4zv4l> anyone knows why a hooked function would segfault when it's injected using thread↵meanwhile when the program directly load it using `LoadLibrary` the hook works ? |
14:34:58 | FromDiscord | <Airbus5717> if i have a string and ↵i want to make a ref to it↵how do i do it? |
14:35:09 | PMunch | You can't |
14:35:18 | PMunch | Well, you'd have to create a ref string and then copy it over |
14:35:38 | PMunch | But it does sound like you're doing things incorrectly, what are you trying to do? |
14:37:14 | FromDiscord | <Airbus5717> i read a file |
14:37:26 | FromDiscord | <Airbus5717> and i want an object to hold a reference to it |
14:38:22 | FromDiscord | <Rika> to what? the file or the contents? |
14:39:40 | FromDiscord | <Airbus5717> contents |
14:48:58 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4oTU |
14:49:33 | FromDiscord | <Rika> `nums[1..^1]` will make a copy |
14:49:40 | FromDiscord | <Dudugz> Thx ^^ |
14:49:59 | FromDiscord | <Rika> it is likely better to use delete or so, but i guess that would also shift all elemetns anyway |
14:50:33 | FromDiscord | <Dudugz> No need, the seq will be discarded as I am using concat |
15:09:56 | * | PMunch quit (Quit: Leaving) |
15:09:58 | FromDiscord | <Airbus5717> In reply to @Rika "to what? the file": if i assign a string to another variable ↵will it reference it or copy? |
15:10:03 | FromDiscord | <Rika> copy |
15:10:34 | FromDiscord | <Rika> strings and seqs use value semantics, but i dont recall if they are copy-on-write (i think they are?) |
15:10:44 | FromDiscord | <Rika> but they will copy nonetheless |
15:10:48 | FromDiscord | <Airbus5717> is there any way to pass a reference? |
15:11:00 | FromDiscord | <Rika> make a reference and put the string in there, then use only that reference |
15:21:12 | FromDiscord | <I have 50GB of nothing on my PC> what do when `p.errorStream.atEnd` makes for an infinite loop? |
15:26:38 | FromDiscord | <I have 50GB of nothing on my PC> when I try tog et the position: `cannot retrieve file position` |
15:26:51 | FromDiscord | <I have 50GB of nothing on my PC> how do i at least check if my stream is fucked |
15:28:29 | FromDiscord | <I have 50GB of nothing on my PC> juding by error code, the stream was closed because of oom |
15:28:53 | FromDiscord | <I have 50GB of nothing on my PC> ok, but how do i check that, other than knowing the code beforehand |
15:29:13 | FromDiscord | <Gumbercules> show us some code |
15:29:15 | * | azimut quit (Remote host closed the connection) |
15:29:43 | * | azimut joined #nim |
15:30:59 | * | rez joined #nim |
15:34:35 | * | arkurious joined #nim |
15:35:39 | * | Notxor joined #nim |
15:41:55 | FromDiscord | <4zv4l> will `warn` from `std/logging` raise an error if it fails writing to the file or it will just skip it ? |
15:43:43 | * | rez quit (Quit: much snoozes...) |
16:11:20 | FromDiscord | <Dudugz> ``could not load: (libmysql.dll|libmariadb.dll)``↵I have mysql server installed so why was it not able to find the dlls? Do I need to have libmysql.dll in the project folder? |
16:16:27 | FromDiscord | <Hourglass [She/Her]> In reply to @Dudugz "``could not load: (libmysql.dll|libmariadb.dll)``": Is it in the file path? Also what's the exact code? |
16:17:22 | FromDiscord | <Hourglass [She/Her]> (edit) "in the" => "on" |
16:17:35 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4oUg |
16:17:43 | FromDiscord | <Hourglass [She/Her]> Ah |
16:17:45 | FromDiscord | <Dudugz> I'm running ``nimble run`` |
16:18:20 | FromDiscord | <Hourglass [She/Her]> Hm then I'm not sure, only thing I think it could be is related to the path, but I'm not a windows user so maybe something funky happening there? |
16:18:58 | FromDiscord | <Dudugz> Hm, maybe it's because Nim is installed on D:? My system is on C: and MySQL didn't give me the option to install on D: |
16:19:30 | FromDiscord | <Dudugz> Or maybe the dll needs to be linked when using nimble run |
16:21:11 | FromDiscord | <Hourglass [She/Her]> sorry, maybe ask in a forum post? ¯\\_(ツ)\_/¯ |
16:21:21 | FromDiscord | <Dudugz> 😅 |
16:22:29 | FromDiscord | <Hourglass [She/Her]> Or on reddit, or even both |
16:22:38 | FromDiscord | <Hourglass [She/Her]> Someone is bound to see it in one of the locations :p |
16:22:42 | FromDiscord | <Dudugz> https://github.com/nim-lang/Nim/issues/15720↵↵Old but yea, i think i must put libmysql.dll on the project folder |
16:23:25 | FromDiscord | <Hourglass [She/Her]> Yeah it talks about the path, that must be an issue, but putting it into the project folder should work yeah |
16:24:12 | FromDiscord | <Dudugz> Hm... I think i got it |
16:24:22 | FromDiscord | <Dudugz> MySQL path is not on the environment variables |
16:24:27 | FromDiscord | <Dudugz> Maybe that's it |
16:25:28 | FromDiscord | <Hourglass [She/Her]> Yeah, try that |
16:27:30 | * | Notxor quit (Remote host closed the connection) |
16:29:07 | * | rez joined #nim |
16:30:20 | FromDiscord | <demotomohiro> If you want to learn how windows search dll: https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order |
16:30:22 | FromDiscord | <Dudugz> It worked, the mysql installer had not added the mysql lib folder which is where the dll is |
16:30:45 | FromDiscord | <Dudugz> (edit) "It worked, the mysql installer had not added the mysql lib folder ... which" added "to the path env" |
16:32:47 | FromDiscord | <Hourglass [She/Her]> Neat! |
16:34:34 | FromDiscord | <Hourglass [She/Her]> If I'm inheriting from a ref object, do I need to do `ref object of MyRefType`? |
16:39:47 | FromDiscord | <demotomohiro> In reply to @Hourglass, When the Hour Strikes "Neat!": Sample code from Nim manual:↵https://nim-lang.org/docs/manual.html#methods |
16:43:53 | FromDiscord | <Hourglass [She/Her]> Ah alright then |
17:17:27 | FromDiscord | <Dudugz> sent a long message, see http://ix.io/4oUx |
17:24:05 | FromDiscord | <enthus1ast> the nimble develop ist completely broken in devel |
17:24:27 | FromDiscord | <enthus1ast> it does not work as advertised nor does the old style work correctly |
17:33:19 | FromDiscord | <demotomohiro> @Dudugz https://nim-lang.org/docs/strutils.html |
17:41:40 | FromDiscord | <Coachonko> Thought of the day: I think Nim overuses `:` |
17:41:58 | FromDiscord | <ieltan> Is there a runtime `fmt`? |
17:42:34 | * | jmdaemon joined #nim |
17:42:38 | FromDiscord | <Phil> Yes |
17:43:06 | FromDiscord | <Phil> STD/strformat I assume you're already using? |
17:43:13 | FromDiscord | <ieltan> Yes |
17:46:19 | FromDiscord | <Phil> That also works at runtime, do you have errors with it,? |
17:47:21 | FromDiscord | <ieltan> Yeah :/ I don't have my laptop with me right now I'll show you later |
17:48:29 | FromDiscord | <Phil> I'm on phone anyway so I can only try later too 😄 |
17:49:30 | FromDiscord | <Rika> In reply to @Coachonko "Thought of the day:": Why is that |
17:50:19 | FromDiscord | <Phil> In reply to @Coachonko "Thought of the day:": Now I'm curious |
17:51:50 | FromDiscord | <Dudugz> In reply to @demotomohiro "<@265937132886032407> https://nim-lang.org/docs/str": I didn't find anything useful... I need a proc that extracts a substring as exemplified |
17:52:50 | FromDiscord | <Dudugz> Normally in other languages I would use regexp but here re.match doesn't return the substring and group doesn't seem to contain the fetched text but rather the boundaries |
17:56:59 | FromDiscord | <demotomohiro> @ieltan↵This works for runtime strings https://nim-lang.org/docs/strutils.html#%25%2Cstring%2CopenArray%5Bstring%5D |
17:57:07 | FromDiscord | <Zoom> You examples are not substrings, you're building a new string there. So just iterate and filter.↵(@Dudugz) |
17:57:49 | FromDiscord | <ieltan> In reply to @Isofruit "That also works at": according to https://nim-lang.org/docs/strformat.html, it seems like everything `fmt` is marked as `static` except the `&` operator, so I suppose this is what I should use right? |
17:58:19 | FromDiscord | <Phil> I use it for runtime string interpolation all the time, I'd say it's fine |
17:59:14 | FromDiscord | <ieltan> In reply to @demotomohiro "<@256520101015060480> This works for": Oh. This. That's good. |
17:59:18 | FromDiscord | <demotomohiro> @Dudugz You can iterate each char of a string like seq[char] and you can add it to another string with `add` proc like seq[char]. |
17:59:20 | FromDiscord | <ieltan> Thanks for the heads up |
18:00:02 | FromDiscord | <Dudugz> Sure |
18:06:02 | FromDiscord | <Hourglass [She/Her]> In reply to @Coachonko "Thought of the day:": Examples? |
18:06:15 | FromDiscord | <Hourglass [She/Her]> I don't think it overuses it, just is different from other langs |
18:10:08 | FromDiscord | <Zoom> May be don't limit yourself to one thought per day and all will be swell |
18:14:19 | FromDiscord | <Phil> The approach of not thinking much has served me well, how dare you question it! 😄 |
18:25:27 | FromDiscord | <enthus1ast> @ieltan\: this or that\: https://github.com/enthus1ast/formatja |
18:45:48 | FromDiscord | <enthus1ast> what is the concept syntax for testing if the concept has a `+`(MyConcept, MyConcept)\: MyConcept ? |
18:46:26 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4oV3 |
18:46:32 | FromDiscord | <enthus1ast> but this brings the compiler in an endless loop |
18:52:42 | FromDiscord | <enthus1ast> so for example this |
18:52:42 | FromDiscord | <enthus1ast> https://play.nim-lang.org/#ix=4oV6 |
19:18:12 | FromDiscord | <Rika> In reply to @enthus1ast "https://play.nim-lang.org/#ix=4oV6": It kinda doesn’t make sense that you define a + for the concept when the concept itself requires that it already has + defined |
19:18:22 | FromDiscord | <Rika> Which is prolly why the nesting problem happens |
19:18:32 | * | Notxor joined #nim |
19:32:03 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to use C++ libraries on Nim? |
19:33:37 | FromDiscord | <demotomohiro> Yes |
19:34:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "Yes": Oh alright↵https://github.com/thedmd/imgui-node-editor↵So would it work on Nim? |
19:35:34 | FromDiscord | <4zv4l> any idea why `warn` from `logging` doesn't add newline on Windows ? |
19:35:40 | FromDiscord | <4zv4l> it put everything on the same line |
19:38:42 | FromDiscord | <demotomohiro> @System64 ~ Flandre Scarlet Nim can use most of C++'s template classes and functions but I dont know if Nim supports all C++ features. C++ is complicated language. |
19:39:02 | FromDiscord | <Nerve> In reply to @System64 "Is it possible to": Yes, and I've done it quite easily with C. All you need is a compiler flag and a pragma'd proc definition for any given function call. |
19:39:45 | FromDiscord | <Nerve> Also keep in mind, when you see `cint` and `string`, etc., these are not C language types per se. The c stands for "compatible" |
19:39:55 | FromDiscord | <Nerve> (edit) "`string`," => "`cstring`," |
19:40:04 | FromDiscord | <Nerve> (edit) ""compatible"" => ""compatible"." |
19:40:18 | FromDiscord | <Nerve> These are used in all the foreign language interfaces. |
19:40:42 | FromDiscord | <Nerve> (edit) "In reply to @System64 "Is it possible to": Yes, and I've done it quite easily with C. All you need is a ... compilerflag," added "single" | "flag" => "flag," | "any" => "each" |
19:41:23 | FromDiscord | <demotomohiro> There is Nim Bindings for C++ STL: https://github.com/Clonkk/nim-cppstl |
19:42:04 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright!↵And in my case, how can I port this node editor to Nim? |
19:45:40 | * | PMunch joined #nim |
19:52:04 | FromDiscord | <demotomohiro> Learn how to use `importcpp` pragma: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma |
19:53:01 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, good to know↵Does Futhark also work with CPP? |
19:53:14 | PMunch | No, unfortunately not |
19:53:52 | PMunch | There's no reason why it shouldn't be possible to make it work, I just haven't gotten around to wrap all the C++ features to Nim features yet |
19:54:31 | FromDiscord | <jmgomez> Start by importing the bare minimum and build from there, if you see somewhere the API exposed, try to use it as a source and generate code from it |
19:55:20 | FromDiscord | <enthus1ast> Yes I had a misconception about how they work↵(@Rika) |
19:56:30 | FromDiscord | <jmgomez> In reply to @PMunch "There's no reason why": I know a few guys outside the Nim community that tried in the past to use clang tooling and it fails hard in projects that heavily use templates/macros |
19:56:37 | FromDiscord | <jmgomez> bare in mind templates are turing complete |
19:56:49 | PMunch | Oh really? |
19:57:13 | PMunch | That's one of the big benefits of using libclang over c2nim or the other one |
19:57:33 | PMunch | Basically clang is able to figure out the macros for me, so I don't have to |
19:57:40 | FromDiscord | <jmgomez> yeah, in order to fully parse them you need to get around the halting problem |
19:58:03 | FromDiscord | <jmgomez> but for sure you can go far with it, with manual tweaking here and there |
19:58:28 | PMunch | Hmm, I mean for the projects I've used Futhark on I haven't had any issues with it |
19:58:53 | FromDiscord | <jmgomez> yeah, but there arent templates in C |
19:58:56 | PMunch | Sure they would halt if you put a broken macro in there, but most header files don't do that for obvious reasons :P |
19:59:06 | PMunch | Oh, C++ templates :P |
20:00:12 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
20:01:25 | * | ehmry joined #nim |
20:03:15 | FromDiscord | <jtv> Parsing templates is not an undecidable problem. That doesn't make sense. |
20:05:36 | FromDiscord | <jtv> And, even I didn't understand the context well enough, with undecidable problems, or np-hard problems, it is often relatively easy to solve all practical instances, or at least provide approximate answers that are going to work well for anything that isn't intentionally trying to f with the algorithm. |
20:06:10 | FromDiscord | <jmgomez> It's a form of the halt problem I didnt said it cant be parsed I said clang doesnt provide the info that you need in order to make automatic bindings from it |
20:06:28 | FromDiscord | <jtv> For instance, I once wrote a static analysis tool for C that computed all the constraints in the preprocessor, so it could analyze each possible build. Never found a piece of real-world software where it wasn't efficient. |
20:07:23 | FromDiscord | <jmgomez> they can expand indefinitely if you want to be complete about them |
20:09:00 | FromDiscord | <jtv> Yup and that's true with lots of things like, evaluating prolog predicates. Yet, stack-depth heuristics for those kinds of issues have been good enough for like 60 years 🙂 |
20:11:14 | Zevv | PMunch: I nimmed a new toy https://github.com/zevv/memgraph |
20:13:09 | PMunch | Oooh, nice |
20:13:26 | PMunch | It uses something like LD_PRELOAD to slip the dynamic library in there? |
20:13:26 | FromDiscord | <Airbus5717> what is the fastest way to check if a string matches a specific string in seq |
20:14:26 | Zevv | PMunch: yes, exactly that. it's nothing fancy, but the colors are nice |
20:15:22 | FromDiscord | <jtv> @zevv You know there's a pretty big name collision there, yes? https://memgraph.com/ |
20:15:55 | PMunch | @Airbus5717, quickest as in to type the code, or quickest as in fastest |
20:16:16 | FromDiscord | <jtv> It's basically an up-and-coming Neo4J competitor |
20:16:22 | PMunch | Zevv, yeah it looks neat. I'm going to try it out on something |
20:16:24 | Zevv | jtv: nah who cares, this is just my personal toy. given a big enough world, collisions are inevitable |
20:16:44 | Zevv | PMunch: results might vary; let me know if it explodes in your face |
20:16:47 | FromDiscord | <jtv> That's cool |
20:17:07 | FromDiscord | <Airbus5717> In reply to @PMunch "<@792407211620040705>, quickest as in": fast |
20:17:26 | FromDiscord | <Airbus5717> gotta go fast |
20:17:37 | FromDiscord | <Airbus5717> 😏 |
20:18:07 | FromDiscord | <jtv> It is a super cool util though... does "fairly recent" include 1.6.10 or just development branches? |
20:18:21 | Zevv | i have no clue, i'm always on devel |
20:18:31 | Zevv | but i think I didnt use anything fancy |
20:18:37 | Zevv | let me know if it barfs on older nims |
20:19:13 | Zevv | also i didn't test the .nimble because my nimble has been broken for weeks |
20:19:54 | FromDiscord | <jtv> Will do |
20:20:03 | Zevv | ty |
20:25:46 | * | vsantana joined #nim |
20:26:05 | * | vsantana left #nim (#nim) |
20:27:21 | FromDiscord | <carsonfarmer> sent a long message, see http://ix.io/4oVp |
20:27:26 | FromDiscord | <carsonfarmer> (edit) "http://ix.io/4oVp" => "http://ix.io/4oVq" |
20:30:08 | FromDiscord | <carsonfarmer> I don't really want to have all implementations to derive from some base class, as they'll likely have very little logic in common. And since I don't know ahead of time all the variants, the object variant pattern doesn't quite seem right? But it is possible that my Typescript and Go experience is clouding my judgement? |
20:31:36 | Zevv | Well, lack of traityness or protocoliness is a bit of a hiatus in num |
20:33:48 | PMunch | Zevv, did you see my latest experiment? https://github.com/pmunch/echooverride |
20:33:55 | PMunch | Finally a way to grab all echo statements :) |
20:35:16 | FromDiscord | <jtv> If you want something more like traditional interfaces, then I think there is a good third party interface lib, but generally there's plenty of code / data separation in nim already, the only time you might need to use interfaces is if you really need to keep an array of items that only implement the interface that you then are going to HAVE to cast back to their actual type to be able to call them if you don't use objects, since you're onl |
20:36:12 | FromDiscord | <jtv> It's generally preferable for your routines to be generic and try to not do that... but to each his own |
20:36:27 | Zevv | PMunch: but what does it *do* :) |
20:38:04 | FromDiscord | <jtv> Though you could have them pass you functions to call with their object if you really want to kludge it. I assume that's what any interface library is likely to wrapper |
20:38:51 | PMunch | Zevv, in uses `--import` and term rewriting macros to rewrite every echo and write (to stdout) in your program |
20:39:01 | Zevv | yeah, it's nitfy |
20:39:05 | Zevv | i never used term rewrites |
20:39:13 | Zevv | but using the --import like that is smart |
20:39:27 | PMunch | Yeah it felt pretty clever :) |
20:39:55 | PMunch | Seems to work pretty well, planning on using it in my superlog-based logging library |
20:40:00 | Zevv | it could be of use for CPS I think |
20:40:09 | FromDiscord | <Elegantbeef> Hey this is already what i've suggested for linting! |
20:40:24 | Zevv | too bad, PMunch just won and you lost |
20:40:25 | PMunch | For linting? |
20:40:37 | FromDiscord | <Elegantbeef> Yes you can use TRM for linting |
20:40:42 | FromDiscord | <Elegantbeef> In the same manner you did |
20:41:03 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/9739#64098 |
20:41:46 | FromDiscord | <Elegantbeef> TRMs really are the best linters now that `noRewrite` works |
20:42:07 | FromDiscord | <Elegantbeef> You can use AST matching in Nim to make Nim errors without having to use your own parser |
20:45:14 | PMunch | Aah I see |
20:45:19 | PMunch | That's pretty neat |
20:45:55 | FromDiscord | <Hourglass [She/Her]> I need to rewrite my code for parsing bytes from the socket directly into parsing bytes one at a time |
20:46:06 | FromDiscord | <Hourglass [She/Her]> I am annoyed |
20:49:46 | * | Notxor quit (Remote host closed the connection) |
20:51:36 | * | Notxor joined #nim |
21:00:09 | FromDiscord | <jtv> @PMunch I like that. Basically have wanted something more AOP-like where I can externally specify how to transform modules... would love a first class feature to do stuff like this personally |
21:03:37 | PMunch | @jtv, hmm not quite sure what kind of stuff you're thinking about |
21:13:33 | FromDiscord | <jtv> Well, for instance, we see people here frequently using detours on windows for observability, instrumentation, etc. Never mind to enhance the behavior of 3rd party code w/ extra error checking or output manipulation. But in the AOP paradigm, you can basically say, "change all my echos to this", or "wrap any socket calls with a logging function" |
21:14:11 | FromDiscord | <jtv> Without having to worry about being able to add a decorator to each function you want to wrap or anything like that. |
21:14:46 | PMunch | Aah, I see what you mean |
21:14:55 | PMunch | Yeah this approach could definitely be used to do that |
21:16:21 | FromDiscord | <jtv> I did a C AOP extension like 25 years ago that added bounds checking to array accesses if my static analyzer couldn't prove it didn't need it 🙂 |
21:23:31 | FromDiscord | <Elegantbeef> I'd also love something like `import std/strutils[string: MyString]` |
21:23:37 | FromDiscord | <Elegantbeef> Where it replaces all instances of `string` with MyString |
21:25:01 | FromDiscord | <Elegantbeef> But that only works if it was more generic friendly |
21:25:53 | PMunch | I believe that would be possible |
21:29:36 | FromDiscord | <ieltan> This is probably a noob question but I need my discord bot to restart if it crashes or if given a command, like a daemonizer or something, any tips? |
21:29:40 | FromDiscord | <Elegantbeef> It's only possible in a hacky world |
21:31:52 | FromDiscord | <Elegantbeef> There are a multitude of tools depending on your OS |
21:32:08 | FromDiscord | <ieltan> Linux |
21:32:35 | FromDiscord | <ieltan> I never did that so I'm not sure how to approach this |
21:32:49 | FromDiscord | <Elegantbeef> Just search "Linux restart process if it dies" |
21:32:53 | FromDiscord | <Elegantbeef> This is unrelated to Nim really |
21:33:17 | FromDiscord | <ieltan> Alright, thanks for the pointers and sorry |
21:33:46 | FromDiscord | <Elegantbeef> I wasnt being a dick, just saying it's not something you really do inside Nim 😄 |
21:35:15 | * | advesperacit quit (Ping timeout: 268 seconds) |
21:35:38 | FromDiscord | <carsonfarmer> In reply to @jtv "If you want something": Ok, this seems reasonable, and this works for most usage patterns I currently have. So what should I do if I _do_ need to keep an array or table of items that aren't all the same concrete/base type? |
21:35:59 | FromDiscord | <Elegantbeef> Use inheritance or object variants |
21:36:23 | FromDiscord | <Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark |
21:36:32 | * | advesperacit joined #nim |
21:37:01 | FromDiscord | <carsonfarmer> ok yeh figured, that's _probably_ going to be fine, because my primary usecase for the table setup described above is tests... which i don't mind doing that way |
21:37:22 | FromDiscord | <jtv> Yeah, it's possible to get crazy w/ it but simpler is better |
21:39:32 | FromDiscord | <Hourglass [She/Her]> I know sequences can't directly be casted to a type like an integer, but could arrays be casted using `cast[uint16]([255'u8, 255])`? |
21:40:03 | FromDiscord | <carsonfarmer> In reply to @Elegantbeef "https://internet-of-tomohiro.netlify.app/nim/faq.en": I like that boxed type example, very simple and easy to work with for my case |
21:40:04 | FromDiscord | <carsonfarmer> cheers! |
21:42:22 | FromDiscord | <Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "I know sequences can't": Okay that works |
21:42:56 | FromDiscord | <Hourglass [She/Her]> But now how would I create an array at runtime lmao |
21:43:05 | FromDiscord | <Elegantbeef> Just for performance sake remember that `ref` is a pointer so doing that will cause more cache fragmentation |
21:43:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oVE |
21:44:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oVF |
21:48:23 | FromDiscord | <huantian> In reply to @Elegantbeef "I wasnt being a": That’s a first |
21:48:39 | FromDiscord | <huantian> I just assumed that was part of your personality |
21:49:14 | FromDiscord | <Elegantbeef> y'know just for that, fuck you! |
22:00:06 | * | rez quit (Quit: much snoozes...) |
22:00:37 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4oVI |
22:00:58 | FromDiscord | <Hourglass [She/Her]> While I could use a sequence, an array would make casting a bit nicer |
22:01:01 | FromDiscord | <Elegantbeef> `seq[byte]` |
22:01:26 | FromDiscord | <Hourglass [She/Her]> byte yeah not bytes, but yeah what i said above |
22:01:42 | FromDiscord | <Elegantbeef> Of course it's not possible |
22:01:54 | FromDiscord | <Elegantbeef> Types cannot be created at runtime, and one should not use stack allocate |
22:02:10 | FromDiscord | <Hourglass [She/Her]> Alright then thanks anyway |
22:02:18 | FromDiscord | <Hourglass [She/Her]> Code will be a bit more tedious now f |
22:03:07 | * | advesperacit quit (Ping timeout: 246 seconds) |
22:03:32 | * | PMunch quit (Quit: leaving) |
22:03:43 | * | advesperacit joined #nim |
22:05:12 | FromDiscord | <Elegantbeef> It shouldnt be much more tedious |
22:06:29 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4oVJ |
22:06:43 | FromDiscord | <Hourglass [She/Her]> I may or may not be committing warcrimes with my horrid code |
22:06:58 | FromDiscord | <Elegantbeef> It should be the exact same code except instead of the array address it's the element of the first element |
22:07:23 | FromDiscord | <Hourglass [She/Her]> What? |
22:07:35 | FromDiscord | <Hourglass [She/Her]> Wait I have all this code already in my original attempt for the server software |
22:07:50 | FromDiscord | <Elegantbeef> Like how does the seq make this much more tedious |
22:07:58 | FromDiscord | <Elegantbeef> It's a `newSeq[byte](size)` |
22:08:43 | FromDiscord | <Hourglass [She/Her]> Hold on |
22:09:35 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4oVK |
22:09:44 | FromDiscord | <Hourglass [She/Her]> That's what I had before |
22:09:53 | FromDiscord | <Elegantbeef> So nothing much changes |
22:11:09 | FromDiscord | <Hourglass [She/Her]> How so? Casting a sequence to a number type doesn't exactly play nice because of how sequences work |
22:11:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oVL |
22:11:40 | FromDiscord | <Hourglass [She/Her]> I need to remove the use of the socket completely |
22:12:21 | FromDiscord | <Hourglass [She/Her]> I'm reading the bytes from a sequence instead of changing the container that `data` is stored in |
22:12:31 | FromDiscord | <Elegantbeef> It's the same shit |
22:12:39 | FromDiscord | <Elegantbeef> You just move the index |
22:14:55 | FromDiscord | <Hourglass [She/Her]> Yeah my brain isn't comprehending that, I'm gonna rewrite that anyway so I'll figure out what you mean like that |
22:15:07 | FromDiscord | <Hourglass [She/Her]> My brain is worse than a brick wall currently |
22:15:26 | FromDiscord | <Elegantbeef> Just use `std/stream` |
22:15:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4oVN |
22:16:03 | FromDiscord | <Hourglass [She/Her]> Aaah |
22:16:18 | FromDiscord | <Hourglass [She/Her]> I completely forgot about the existence of streams :p |
22:16:35 | FromDiscord | <Hourglass [She/Her]> Thanks beef for putting up with the mess called my brain :p |
22:19:21 | FromDiscord | <Hourglass [She/Her]> `s.readData` instead of `s.readInto` |
22:25:18 | FromDiscord | <Hourglass [She/Her]> Assuming I should just cast `seq[byte]` into a string and use it as a StringStream |
22:25:35 | FromDiscord | <Elegantbeef> Or just read it as a string |
22:26:05 | FromDiscord | <Hourglass [She/Her]> Yeah I can do that too, probably better :p |
22:26:32 | FromDiscord | <Elegantbeef> Well there is a non zero chance you accidentally deallocate memory you do not own with the cast |
22:27:04 | FromDiscord | <Elegantbeef> Actually nevermind that's not a problem |
22:27:08 | * | advesperacit quit () |
22:27:19 | FromDiscord | <Elegantbeef> Forgot how allocators worked for a second |
22:30:31 | FromDiscord | <Hourglass [She/Her]> :p |
22:30:46 | FromDiscord | <Yepoleb> In reply to @ieltan "This is probably a": i recommend using a systemd unit https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6 |
22:31:48 | FromDiscord | <Hourglass [She/Her]> I have decided to just make it so instead of returning a stream, i should just have a stream for each packet of data i need to read myself |
22:32:07 | FromDiscord | <Hourglass [She/Her]> (edit) removed "myself" |
22:32:18 | FromDiscord | <Hourglass [She/Her]> I am clearly sleep deprived because i barely understand what i just said |
22:40:38 | FromDiscord | <Hourglass [She/Her]> How would i cast a datatype to a string? |
22:41:49 | FromDiscord | <Elegantbeef> I'm going to say you dont |
22:42:01 | FromDiscord | <Elegantbeef> But i'm also going to say `StringStream` exists |
22:44:11 | FromDiscord | <Hourglass [She/Her]> Ah just saw this https://nim-lang.org/docs/streams.html#write%2CStream%2CT |
22:44:21 | FromDiscord | <Hourglass [She/Her]> I didn't see it until i scrolled a bit further :p |
22:45:13 | FromDiscord | <ieltan> In reply to @Elegantbeef "I wasnt being a": It's alright bro i didnt take it badly lol |
22:45:32 | FromDiscord | <ieltan> In reply to @Yepoleb "i recommend using a": yeah i went with that but thanks ! |
22:54:38 | FromDiscord | <Iliketwertles> anyone here have knowledge with illwill? |
22:55:01 | FromDiscord | <Iliketwertles> i want to make a fullscreen thing but the text and everything is displayed in the middle instead of the top left |
23:03:48 | FromDiscord | <Iliketwertles> like i kinda want all the text here in the middle with a box around it https://media.discordapp.net/attachments/371759389889003532/1078089755541123213/screenshot_2023-02-22-180310.png |
23:11:19 | FromDiscord | <Elegantbeef> Doesnt it allow setting the cursor? |
23:20:06 | FromDiscord | <Iliketwertles> In reply to @Elegantbeef "Doesnt it allow setting": yea i think |
23:20:17 | FromDiscord | <Elegantbeef> Well there you go |
23:20:42 | FromDiscord | <Iliketwertles> how does that help me put it in the center of the terminal tho? |
23:20:56 | FromDiscord | <Elegantbeef> `terminalWidth` and `terminalHeight` exist |
23:21:08 | FromDiscord | <Hourglass [She/Her]> For cleaner API use I may need to make a distinct but the semantics are all the same as the original type |
23:21:47 | FromDiscord | <Iliketwertles> In reply to @Elegantbeef "`terminalWidth` and `terminalHeight` exist": right but `var tb = newTerminalBuffer(terminalWidth(), terminalHeight())` |
23:22:11 | FromDiscord | <Elegantbeef> Ok so you now can figure out where centre is and how long your lines are |
23:22:20 | FromDiscord | <Iliketwertles> ohhh |
23:22:24 | FromDiscord | <Iliketwertles> i think i get it? |
23:23:42 | FromDiscord | <Iliketwertles> so for example, lets say its 10x10 for simplicity ↵`tb.write(2, 1, fgWhite, "What we doin?")` -- takes 2 and 1 from height and width right? |
23:23:54 | FromDiscord | <Elegantbeef> RTFM |
23:23:57 | FromDiscord | <Iliketwertles> so middle would then be 5 5 |
23:24:02 | * | Notxor quit (Remote host closed the connection) |
23:42:04 | FromDiscord | <Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4oW3 |
23:51:50 | FromDiscord | <Nilts> I want to get the similarity between to sentences (strings) using an arraymancer neural network, i found some code to turn strings into tensors but beyond that i am lost. Please help and ping on reply :) |
23:54:30 | FromDiscord | <Hourglass [She/Her]> https://nim-lang.org/docs/streams.html#read%2CStream%2CT doesn't seem to support reading a string with a size param? |
23:54:40 | FromDiscord | <Hourglass [She/Her]> Nvm |
23:54:44 | FromDiscord | <Hourglass [She/Her]> It's `readStr` |