00:09:15 | FromDiscord | <Bubblie> Honestly if there was more documentation on making backends id appreciate that 💀 |
00:10:37 | FromDiscord | <Bubblie> Definitely want to make a java backend so I dont have to use java anymore LMFAOOO but I dont know where to start with it honestly |
00:12:47 | FromDiscord | <leorize> while a jvm backend is probably not on the table anytime soon, jnim exists to let you interface with java from Nim \:p |
00:19:25 | FromDiscord | <Forest> Bub means to implement one ourselves |
00:19:41 | FromDiscord | <Forest> Just need better documentation (I'm gonna try making my backend for Cyo and Nim, see the differences-) |
00:20:34 | FromDiscord | <Prestige> It would be awesome to have, if it were to work properly |
00:20:38 | FromDiscord | <Bubblie> yes |
00:20:46 | FromDiscord | <Bubblie> Nim on the jvm would be a dream come true honestly |
00:20:57 | FromDiscord | <Forest> Oh absolutely |
00:21:56 | FromDiscord | <Forest> In reply to @Avahe "It would be awesome": I have ideas on multiple ways of implementation, what matters is how would we take advantage of the fact Java has classes and interfaces |
00:40:13 | FromDiscord | <Elegantbeef> Cause a ref count overhead is actually something significat?↵(@Tuatarian) |
00:40:28 | * | krux02 quit (Remote host closed the connection) |
00:41:58 | FromDiscord | <Bubblie> https://hastebin.com/ixenuledit.less im unsure as to what is happening in this error, it seems to be the only error im getting? |
00:45:57 | FromDiscord | <Tuatarian> In reply to @Elegantbeef "Cause a ref count": I mean, it could be, especially on old weak hardware |
00:46:13 | FromDiscord | <SaAnd> note\: it is not an atomic refcount |
00:52:27 | FromDiscord | <Tuatarian> Oh |
00:53:31 | FromDiscord | <Tuatarian> So that's the main difference vs swift then? |
00:58:24 | FromDiscord | <foobar-85> Howdy all. I am reading the nim book, well done btw, and I would like to ask, from the expressiveness point of view, why decorating the code with .async. pragmas and async, await, keywords are helpful? I understand why languages do that from the technical PoV, but to me it feels like a big blow to expressiveness. |
00:58:55 | FromDiscord | <Elegantbeef> Well all code isnt async so you need to explicitly state what is async |
00:59:07 | FromDiscord | <Elegantbeef> Otherwise you dont know where to give your cpu up |
01:00:33 | FromDiscord | <Elegantbeef> I dont know how you do it otherwise |
01:03:07 | FromDiscord | <Tuatarian> Async is rarely the default way to write a piece of code, so it makes sense that it's not the default for the language, if that's what you're asking |
01:10:50 | FromDiscord | <treeform> In reply to @xcodz-dot "I was looking through": Just `import pixie/fileformats/png` and use the `decodePng` function that gives you a `Png` object that has `.data` as non straight-alpha data. |
01:11:04 | FromDiscord | <treeform> (edit) removed "non" |
01:11:40 | FromDiscord | <treeform> You can access extra information about images by using their pixie/fileformats png, jpeg, gif files. |
01:11:55 | FromDiscord | <treeform> Like straight alpha, number of channels, animate gifs etc... |
01:13:07 | FromDiscord | <treeform> See more here about the png stuff: https://nimdocs.com/treeform/pixie/pixie/fileformats/png.html |
01:13:43 | FromDiscord | <foobar-85> Well, async is implicit when a Future is returned, I guess that the the pragma could be deduced at compile time, and async keyword injected at compile time as well. |
01:14:15 | FromDiscord | <Prestige> Interesting idea |
01:14:41 | FromDiscord | <foobar-85> Unless async decorations add to expressiveness for some reason… |
01:14:42 | FromDiscord | <!Patitotective> i think using the async pragma is clearer |
01:15:50 | FromDiscord | <Prestige> It doesn't really make a difference but having something like `async foo() = ...` would be nice. I suppose that could be done |
01:16:40 | FromDiscord | <Elegantbeef> well foobar that requires having async support in the compiler |
01:16:49 | FromDiscord | <Elegantbeef> Which is a bit ehhh |
01:16:55 | FromDiscord | <Elegantbeef> Nim is supposed to be a small language extended in user space |
01:17:15 | FromDiscord | <!Patitotective> i agree, that just adds another keyword that can just be a pragma |
01:17:19 | FromDiscord | <Elegantbeef> No clue if it's true that all Futures are asyncable procedures either |
01:17:53 | FromDiscord | <!Patitotective> yea, you can return an async proc future through a sync proc |
01:18:28 | FromDiscord | <Elegantbeef> The async pragma is a macro that transforms the AST of the procedure, it's not just a marker |
01:18:41 | FromDiscord | <foobar-85> Can’t await be deduced from the call chain? |
01:19:05 | FromDiscord | <Prestige> What if you don't want to await the procedure though? |
01:19:29 | FromDiscord | <foobar-85> You can’t call it without await, can you? |
01:20:03 | FromDiscord | <foobar-85> (Thinking of Python here, haven’t tried Nim’s yet) |
01:20:20 | FromDiscord | <Elegantbeef> you can do `waitfor` which turns an async into a blocking op |
01:20:27 | FromDiscord | <Elegantbeef> And how you call async code from non async |
01:20:34 | FromDiscord | <Elegantbeef> Or one way |
01:21:53 | FromDiscord | <Prestige> I think you could call it without await, and would just get a Future |
01:22:51 | FromDiscord | <Elegantbeef> Indeed |
01:22:52 | FromDiscord | <Elegantbeef> Nim calling semantics dont change |
01:23:00 | FromDiscord | <Elegantbeef> It's completely to call a future and hold onto it to finish it later |
01:23:10 | FromDiscord | <Elegantbeef> call to get a future |
01:23:25 | FromDiscord | <SaAnd> Swift\: ARC = Atomic Reference Counting↵Nim\: ARC = Automatic Reference Counting↵(@Tuatarian) |
01:24:31 | FromDiscord | <SaAnd> see\: https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |
01:25:17 | FromDiscord | <huantian> In reply to @foobar-85 "(Thinking of Python here,": python also allows you to not await things right? |
01:25:52 | FromDiscord | <foobar-85> IIRC nop. But I could be wrong. |
01:26:42 | FromDiscord | <Prestige> python be weird |
01:27:10 | FromDiscord | <huantian> https://media.discordapp.net/attachments/371759389889003532/1007097815610167356/unknown.png |
01:27:19 | FromDiscord | <Prestige> Nice |
01:28:33 | FromDiscord | <foobar-85> I see, thanks for all the answers. I have this personal taste against the async syntax, but it could be me alone. |
01:30:13 | FromDiscord | <Prestige> what would you prefer, `async proc foo()` ? |
01:30:14 | FromDiscord | <Elegantbeef> I think it's a needed syntax |
01:32:31 | FromDiscord | <foobar-85> In my ideal world it would be deduced and defaulted to no keyword for the most common usage. Omitting `await` on calls would default to an await, unless otherwise requested to not await and get the future. ↵I’d attempt to deduce the pragma async too. |
01:32:41 | FromDiscord | <huantian> In reply to @Elegantbeef "No clue if it's": yeah for example, the all function <https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D> |
01:33:17 | FromDiscord | <Prestige> I mean the compiler can't deduce if you want to await the code or not |
01:33:32 | FromDiscord | <huantian> though you probably could do it with async? |
01:34:42 | FromDiscord | <Bubblie> can I post my issue again it seemed to have been burried in chat, its okay if im not allowed |
01:35:05 | FromDiscord | <Prestige> Go for it |
01:35:41 | FromDiscord | <Bubblie> https://hastebin.com/ixenuledit.less im not even sure if I can call this much of an error since nim isn't giving me much information except this? |
01:36:02 | FromDiscord | <Bubblie> ive been having a hard time trying to decipher what is wrong |
01:37:37 | FromDiscord | <foobar-85> In reply to @Elegantbeef "I think it's a": Due to expressiveness or implementation details? |
01:37:47 | FromDiscord | <Elegantbeef> Due to a requirement of logic |
01:38:20 | FromDiscord | <foobar-85> Humm, mind expanding? |
01:39:11 | FromDiscord | <Elegantbeef> I think it's unwise to infer async and whether to await as it hides whether the code runs blocking or not |
01:40:00 | FromDiscord | <Prestige> And also, how is the program supposed to know if the programmer intended to block or not? |
01:40:26 | FromDiscord | <Elegantbeef> defaults to `await` on procs that return `Future` |
01:41:17 | FromDiscord | <Prestige> But then you can't _not_ block, can you? |
01:41:27 | FromDiscord | <foobar-85> In reply to @Bubblie "https://hastebin.com/ixenuledit.less im not even": Do you have `-` in your filename? |
01:41:47 | FromDiscord | <Elegantbeef> You'd do `waitfor myAsync()` |
01:41:56 | FromDiscord | <Bubblie> In reply to @foobar-85 "Do you have `-`": sorry? |
01:41:59 | FromDiscord | <Bubblie> I mean |
01:42:01 | FromDiscord | <Bubblie> in the folder |
01:42:03 | FromDiscord | <Elegantbeef> The default would be to await, the major issue is you cannot hold onto a future to finish later |
01:42:06 | FromDiscord | <Bubblie> where the nim file is located |
01:42:11 | FromDiscord | <Bubblie> its ngpu-example |
01:42:18 | FromDiscord | <Bubblie> would that cause issues? |
01:42:23 | FromDiscord | <Bubblie> the nim file itself is |
01:42:25 | FromDiscord | <Bubblie> triangle.nim |
01:42:49 | FromDiscord | <Prestige> In reply to @Elegantbeef "The default would be": Yeah that's my point |
01:42:59 | FromDiscord | <foobar-85> Not sure if it is allowed in folder name. Dash is not allowed in filename. |
01:43:38 | FromDiscord | <foobar-85> In reply to @Elegantbeef "The default would be": You can have a `skipAwait` keyword for the less common usage |
01:43:41 | FromDiscord | <Bubblie> I understand that for file names, just folder names hmmm |
01:43:47 | FromDiscord | <Bubblie> let me try changing it |
01:44:18 | FromDiscord | <Bubblie> yeah same issue |
01:45:16 | FromDiscord | <Bubblie> these are wgpu bindings so im unsure if I need to specify a backend since wgpu is a graphics api that runs on top of existing ones |
01:45:20 | FromDiscord | <Elegantbeef> The way i see it all this async stuff requires compiler support, and i really dont think the compiler needs to be concerned with async |
01:45:21 | FromDiscord | <Bubblie> like vulkan, opengl, etc. |
01:45:48 | FromDiscord | <Bubblie> thats probably it |
01:45:57 | FromDiscord | <Bubblie> ill keep continuing and see if I can set this up properly... |
01:46:18 | FromDiscord | <Bubblie> I chose a very annoying project to do 💀 |
01:46:29 | FromDiscord | <foobar-85> Plus, holding to futures feel anti-expressive to me. I’d make this usage more verbose and facilitate the awaiting style. ↵I see the point about the compiler, I’d agree. |
01:47:17 | FromDiscord | <Elegantbeef> holding onto futures is a totally valid thing though, and actually used for some things |
01:47:33 | FromDiscord | <foobar-85> True. It is valid. |
01:47:33 | FromDiscord | <Elegantbeef> It's not the typical usage but sometimes you just make a bunch of futures then want to do things with them |
01:49:56 | FromDiscord | <foobar-85> In current implementation holding to futures is the easy style, wrt expressiveness. It is just types and functions. No special macro or keywords. The async/await is the verbose style. But which is the most common one from the expected usage? |
01:51:12 | FromDiscord | <foobar-85> Anyways, I just wanted to bring this into thinking. I don’t have a decently elaborated proposal. Sorry for the questioning and thanks for the responses. |
01:51:30 | FromDiscord | <huantian> I mean it's a pretty logical question to ask tbh |
01:58:10 | FromDiscord | <SaAnd> beef, is it possible for a macro to work on the callsite, since this is the sort of thing foobar brings up? |
01:58:35 | FromDiscord | <Elegantbeef> you mean like `await` and `waitfor`? 😄 |
01:58:46 | FromDiscord | <Elegantbeef> There are term rewriting macros |
01:59:03 | FromDiscord | <Elegantbeef> But they're not meant for this |
02:12:56 | FromDiscord | <Forest> In reply to @Bubblie "these are wgpu bindings": Probably do tbh |
02:13:18 | FromDiscord | <Forest> Let me see if it's actually defined in the header file |
02:17:24 | FromDiscord | <Forest> Uh @Bubblie, the actual implementation doesn't have a way to define it I don't think- |
02:17:26 | FromDiscord | <Forest> The backend- |
02:18:02 | FromDiscord | <Forest> Uhhhhhhhhhhhhh how do you define stuff for Futhark then- |
02:36:32 | FromDiscord | <Forest> Ah nvm |
02:38:22 | * | arkurious quit (Quit: Leaving) |
02:39:48 | FromDiscord | <Forest> How do i compile C code without defining a new file, is that possible?- |
02:41:15 | FromDiscord | <!Patitotective> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma ? |
02:41:47 | FromDiscord | <Forest> Yup that's it! Thanks! |
02:53:22 | FromDiscord | <Forest> Checking real quick |
02:53:39 | FromDiscord | <Forest> Is `#define WGPU_IMPLEMENTATION WGPUBackendType.WGPUBackendType_OpenGL` valid C? |
02:55:34 | FromDiscord | <Forest> It is- |
03:44:12 | * | xcodz-dot joined #nim |
04:01:05 | * | xcodz-dot Rolls a 6 sided dice and gets 5 |
04:04:10 | FromDiscord | <Elegantbeef> Congrats you win $100 dollars! |
04:18:26 | FromDiscord | <Tuatarian> Roll d6? |
04:18:41 | FromDiscord | <Elegantbeef> Use ARC you ingrate. |
04:19:47 | xcodz-dot | what? |
04:19:58 | xcodz-dot | I was just messing up with IRC |
04:20:06 | xcodz-dot | and there seems to be this command to roll a dive |
04:20:08 | xcodz-dot | dice* |
04:20:48 | FromDiscord | <huantian> I always forget about my lmgty command |
04:20:50 | FromDiscord | <huantian> I need to use that more |
04:21:03 | xcodz-dot | lol, what is lmgty btw? |
04:21:45 | FromDiscord | <huantian> forgot an f, lmgtfy |
04:21:54 | FromDiscord | <huantian> <https://lmgtfy.com/?q=&s=l> |
04:21:59 | FromDiscord | <huantian> wow it broke |
04:22:59 | xcodz-dot | K, now I really understand what it is |
04:23:15 | xcodz-dot | a few seconds of googling and now I am updated with all that info |
04:27:20 | * | xcodz-dot quit (Quit: Connection closed) |
04:40:03 | * | rockcavera quit (Remote host closed the connection) |
04:59:55 | FromDiscord | <Girvo> Hi all! |
05:00:44 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=47fE |
05:17:23 | FromDiscord | <Girvo> Also, `intptr_t` is just `int` right? At least thats how `kqueue.nim` uses it |
05:19:56 | FromDiscord | <Elegantbeef> `multi_heap_info = ptr object` is also valid i think |
05:20:07 | FromDiscord | <Girvo> Okay I think thats clearer |
05:20:08 | FromDiscord | <Girvo> Cheers |
05:20:15 | FromDiscord | <Elegantbeef> And yea `intptr_t` is just an int the size of a pointer |
05:20:22 | FromDiscord | <Girvo> Sweet 🙂 |
06:15:27 | FromDiscord | <Girvo> Anyone used transfer-encoding: chunked responses on the Nim side? I have the fun job of trying to tie it to some specific memory allocated in a weird way, to basically grab a megabyte of data 1KB at a time, and not sure the best way to go about it, short of parsing the headers and handling the `recv` myself, basically |
06:18:03 | FromDiscord | <Elegantbeef> This sounds like a job of a closure iterator or stream |
06:29:09 | FromDiscord | <noiryuh> how do i change linker exe |
06:29:48 | FromDiscord | <noiryuh> sent a code paste, see https://play.nim-lang.org/#ix=47g2 |
06:30:02 | FromDiscord | <Elegantbeef> think it's `clang.linker.exe` |
06:31:16 | FromDiscord | <noiryuh> i added `--clang.linker.exe:zig-cc`↵Nim still passed `clang -shared -o ...` |
06:31:35 | FromDiscord | <Elegantbeef> might be `linkerExe` |
06:32:01 | FromDiscord | <noiryuh> 👍 |
06:32:06 | FromDiscord | <noiryuh> it's `linkerExe` |
06:32:12 | FromDiscord | <noiryuh> thanks you |
06:32:56 | FromDiscord | <noiryuh> (edit) "thanks" => "thank" |
07:02:24 | FromDiscord | <noiryuh> humn |
07:02:40 | FromDiscord | <noiryuh> seems like Nim doesn't generate `.lib` file |
07:02:58 | FromDiscord | <Elegantbeef> `--app:staticlib`? |
07:03:42 | FromDiscord | <noiryuh> why doesn't `--app:lib` generate `.lib` file too↵isn't it required for linking dynamic library? |
07:03:48 | FromDiscord | <Elegantbeef> No |
07:04:15 | FromDiscord | <Elegantbeef> `.lib` is a static library |
07:04:20 | FromDiscord | <Elegantbeef> `.dll` is a dynamic library |
07:05:04 | FromDiscord | <noiryuh> yeah, but for linking with dynamic library↵during building, i need a `.lib` file, then build it, then shipping the exe with `.dll` file |
07:05:05 | FromDiscord | <noiryuh> no? |
07:05:27 | FromDiscord | <Elegantbeef> Dont think so |
07:05:50 | FromDiscord | <enthus1ast> @noiryuh\: under the hood nim loads the dll then call getProcAddr |
07:06:37 | FromDiscord | <Elegantbeef> I dont use windows but i know for linux atleast you dont need a `.a` and `.so` one or the other suffices |
07:06:42 | FromDiscord | <enthus1ast> its the same on linux |
07:06:56 | FromDiscord | <Elegantbeef> What? |
07:07:04 | FromDiscord | <Elegantbeef> Is it coffee time for you? 😄 |
07:07:11 | FromDiscord | <enthus1ast> yeah \:) |
07:08:29 | FromDiscord | <enthus1ast> i think c often needs a static lib file for using dlls(so) because they do exactly that (loading dll then getting the proc's address) |
07:08:46 | FromDiscord | <enthus1ast> but nim can do this withouth a static lib |
07:09:49 | FromDiscord | <Elegantbeef> Yea i dont know enough here i assumed if the library is on your system and you dont dynamically link it using `dlopen` the C compiler can open it up and find the symbols it needs |
07:10:52 | FromDiscord | <noiryuh> In reply to @Elegantbeef "Yea i dont know": oh, it does |
07:11:07 | FromDiscord | <noiryuh> i have to specify `-target x86_64-windows-gnu` |
07:11:13 | FromDiscord | <noiryuh> at least on `zig-cc` |
07:11:35 | FromDiscord | <noiryuh> (edit) "at least on `zig-cc` ... " added "(which is `clang` underhood)" |
07:15:29 | FromDiscord | <!&luke> In reply to @Elegantbeef "`.dll` is a dynamic": Yea it literally stands for dynamically linked library |
07:15:50 | FromDiscord | <Elegantbeef> Unless it's a C# dll 😛 |
07:16:33 | FromDiscord | <Prestige> 🤔 |
07:17:07 | FromDiscord | <Elegantbeef> MS in their infinite wisdom allow shipping C# libraries as `.dll`s but they're not system libraries they're C# code that can only be used if you know it's C# code |
07:17:35 | FromDiscord | <Prestige> Is it even CIL or whatever it's called, or straight up c# source code? |
07:17:47 | FromDiscord | <Elegantbeef> It's compiled C# code |
07:18:04 | FromDiscord | <Prestige> Nice |
07:18:15 | FromDiscord | <Prestige> Remind me again to stay away from windows |
07:18:54 | FromDiscord | <Elegantbeef> Instead of doing something like `csdll` or similar they just went for `dll` to confuse many developers |
07:20:44 | FromDiscord | <Elegantbeef> The even more fun part is that the Mono compiler can produce cross platform executable if you have the runtime, and on linux the files still are generated with `.exe` extensions |
07:21:05 | FromDiscord | <Elegantbeef> So there are cross platform executables that have 0 indication that they're cross platform 😄 |
07:21:34 | FromDiscord | <Elegantbeef> It's not a big deal but these also can load said dlls of course |
07:23:20 | FromDiscord | <enthus1ast> Technically they still are dlls |
07:23:27 | FromDiscord | <Tuatarian> Can we do custom allocators in ARC/orc? |
07:23:46 | FromDiscord | <enthus1ast> https://stackoverflow.com/questions/2259375/what-are-the-exact-differences-between-net-dll-and-a-normal-dll |
07:24:15 | FromDiscord | <Prestige> @tandy is https://matrix.to/#/#matrix-nim-sdk:newcircuit.io still valid? |
07:24:29 | FromDiscord | <Prestige> Maybe I just can't figure out how to join rooms |
07:24:32 | FromDiscord | <Elegantbeef> That's dylan's matrix space, so probably not |
07:24:40 | FromDiscord | <Prestige> rip |
07:24:44 | FromDiscord | <Tuatarian> Araq on the forum says compile with `-d:useMalloc` and override malloc normally, but what if we want some, not all, allocations to use our allocator? |
07:24:53 | FromDiscord | <Elegantbeef> Go to #embedded |
07:24:58 | FromDiscord | <Elegantbeef> Look at the last thing i posted |
07:24:58 | FromDiscord | <Prestige> Was trying to find out if there were any docs on how to use https://github.com/tandy-1000/matrix-nim-sdk or if I should just read all the source code |
07:25:16 | FromDiscord | <Elegantbeef> I have a toy client and tandy has a client |
07:25:23 | FromDiscord | <Elegantbeef> https://github.com/tandy-1000/simple-matrix-client/ for tandy's |
07:26:55 | FromDiscord | <Prestige> Thanks |
07:28:30 | FromDiscord | <Elegantbeef> @Tuatarian\: hopefully you found you way and that allocation API make sense to you |
07:31:39 | * | gsalazar joined #nim |
07:39:17 | * | gsalazar quit (Ping timeout: 268 seconds) |
07:40:48 | * | gsalazar joined #nim |
07:41:16 | * | rockcavera joined #nim |
07:41:16 | * | rockcavera quit (Changing host) |
07:41:16 | * | rockcavera joined #nim |
07:41:27 | FromDiscord | <Prestige> Looks like his client is outdated |
07:41:34 | FromDiscord | <Prestige> eh I'll try again some other day |
07:41:43 | FromDiscord | <Elegantbeef> The api is lacking a lot of endpoints |
07:42:25 | NimEventer | New thread by Jasonfi: Best websocket library?, see https://forum.nim-lang.org/t/9360 |
07:46:12 | FromDiscord | <enthus1ast> @Prestige\: the basic matrix is quite simple |
07:46:23 | FromDiscord | <enthus1ast> Matrix protocol I mean |
07:46:41 | FromDiscord | <Elegantbeef> Yea plus our the API has a nice macro for writing endpoints now |
07:47:12 | FromDiscord | <enthus1ast> Elegantbeef\: started a matrix client? |
07:47:16 | FromDiscord | <Prestige> I'll mess around with it later I guess |
07:47:31 | FromDiscord | <Prestige> I just want to send and read messages from my terminal, basically |
07:48:39 | FromDiscord | <Elegantbeef> I was toying with the idea, but mostly just playing with the API |
07:48:39 | FromDiscord | <Elegantbeef> As such we now have https://github.com/tandy-1000/matrix-nim-sdk/blob/main/src/matrix/clientserver/clientauth/login.nim |
07:48:39 | FromDiscord | <Elegantbeef> Get making endpoints people! |
07:49:11 | FromDiscord | <enthus1ast> Please focus your hacking on encryption \:p |
07:49:35 | FromDiscord | <Elegantbeef> Lol i'm not writing any of the code yet 😄 |
07:50:48 | FromDiscord | <Elegantbeef> I also dont think i use any of the encrypted rooms, so not very high priority |
07:50:50 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=47gd |
07:50:54 | FromDiscord | <Girvo> So I know `func parseHeader` says its used internally, and I shouldn't use it... but can I? lol |
07:51:20 | FromDiscord | <Elegantbeef> It might disappear so if it does it's on you |
07:51:26 | * | rockcavera quit (Remote host closed the connection) |
07:52:14 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=47ge |
07:52:53 | FromDiscord | <flywind> (edit) "https://play.nim-lang.org/#ix=47ge" => "https://play.nim-lang.org/#ix=47gf" |
07:54:07 | FromDiscord | <Bung> so I better avoid use unsafeNew I guess |
07:58:39 | FromDiscord | <Bung> with different internal representation how to cast it to pointer , I get `expression cannot be cast to pointer` |
07:59:31 | * | xet7 quit (Ping timeout: 268 seconds) |
08:03:21 | FromDiscord | <Bung> nvm |
08:13:27 | FromDiscord | <enthus1ast> @Girvo\: I also use parseHeader in my code, I vote for it to stay |
08:52:42 | FromDiscord | <Freakwill (William Song)> how do I define a function/type for vectors with arbitrary dim?\`\`\`nim |
08:53:15 | FromDiscord | <Elegantbeef> you just did |
08:53:49 | FromDiscord | <Freakwill (William Song)> sent a long message, see http://ix.io/47gw |
08:54:29 | FromDiscord | <Freakwill (William Song)> sent a code paste, see https://play.nim-lang.org/#ix=47gx |
08:54:50 | FromDiscord | <Elegantbeef> Basis is a generic and `@[]` doesnt give it a type |
08:55:05 | FromDiscord | <Elegantbeef> Basis is generic due to the fact `Vector` is a generic |
08:55:37 | FromDiscord | <Freakwill (William Song)> It related generic arguments which I am not familiar with |
08:56:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47gz |
08:56:45 | FromDiscord | <Elegantbeef> Ok so `Vector` is a generic typeclass which means it can take any `Vector` specialization |
08:56:53 | * | hexeme quit (Quit: co'o ro do) |
08:57:11 | FromDiscord | <Freakwill (William Song)> wow, thanks a lot |
08:57:26 | FromDiscord | <Elegantbeef> as such `@[]` does not specify the type, but `@[a]` says "this is a seq of typeof(a)\` |
08:57:32 | FromDiscord | <Elegantbeef> I really need to get my quotes right |
08:58:15 | * | hexeme joined #nim |
09:00:06 | FromDiscord | <Freakwill (William Song)> It woks well with func f(a, t\:Vector)\:Basis =↵ result.add a↵ result.add t |
09:00:25 | FromDiscord | <Elegantbeef> Ah yea makes sense, type can be inferred in that case |
09:00:27 | FromDiscord | <Freakwill (William Song)> while a.L will throw an error |
09:00:35 | FromDiscord | <Elegantbeef> Could just do `func f(a, b: Vector): Basis = @[a, b]` |
09:01:37 | FromDiscord | <Freakwill (William Song)> Yes. But in fact, I shall cope with many Vectors |
09:12:17 | FromDiscord | <Freakwill (William Song)> sent a code paste, see https://play.nim-lang.org/#ix=47gC |
09:12:45 | FromDiscord | <Elegantbeef> `n: static int = 3` |
09:13:00 | FromDiscord | <Elegantbeef> `Vector[n]` |
09:13:18 | FromDiscord | <Elegantbeef> `for val in result.mitems: val = rand(1)` |
09:13:30 | FromDiscord | <Freakwill (William Song)> sent a code paste, see https://play.nim-lang.org/#ix=47gD |
09:14:38 | FromDiscord | <Freakwill (William Song)> wow, thanks so much |
09:14:51 | FromDiscord | <tandy> whats the issue?↵(@Prestige) |
09:16:59 | FromDiscord | <Prestige> I think client.sendMessage |
09:17:52 | FromDiscord | <tandy> maybe @dom96 |
09:19:17 | FromDiscord | <tandy> ? one thing that u might be noticing is that spec support is all over the place, i think i should probably created a v1.3 branch and try support that first↵(@Prestige) |
09:20:42 | * | xet7 joined #nim |
09:22:02 | FromDiscord | <jmgomez> can you somehow mark a function that has side effects (controlled) as one that doesnt? So you can keep using funcs when calling it? |
09:22:22 | FromDiscord | <Elegantbeef> `{.cast(noSideEffect).}:` |
09:22:28 | FromDiscord | <Elegantbeef> On the code that has a side effect |
09:25:22 | FromDiscord | <jmgomez> cool, didnt know about cast. Thanks! |
09:34:19 | FromDiscord | <Prestige> In reply to @tandy "? one thing that": Idk if that function was supposed to exist in the matrix lib but it doesn't, but your client is using it somewhere. I didn't investigate, writing other code atm |
09:36:44 | FromDiscord | <LaughingBubba> Is there anyone here who can look at a PR for me? |
09:37:10 | FromDiscord | <tandy> cool, il try get things working with beefs macro and do the branch strategy↵(@Prestige) |
09:46:48 | FromDiscord | <Freakwill (William Song)> sent a code paste, see https://play.nim-lang.org/#ix=47gM |
09:49:41 | FromDiscord | <Rika> Please use a paste service |
09:53:15 | FromDiscord | <enthus1ast> Freakwill (William Song)\: ↵https://play.nim-lang.org/#ix=47gN |
09:57:39 | FromDiscord | <enthus1ast> could be that i misunderstand your goal |
09:57:57 | FromDiscord | <enthus1ast> but its easy to fix \:) |
09:59:59 | * | xet7 quit (Remote host closed the connection) |
10:08:12 | FromDiscord | <Phil> In reply to @Freakwill (William Song) "New question. It is": All I'm seeing is a lot of HTML |
10:19:03 | FromDiscord | <Bung> am using webgui , any idea threadpool spawn cause stuck, even sometimes it response, it does not get my task proc done |
10:19:48 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=47gS |
10:32:23 | FromDiscord | <dom96> In reply to @tandy "maybe <@132595483838251008>": huh? I need more context than that |
10:59:12 | FromDiscord | <Freakwill (William Song)> sent a long message, see http://ix.io/47gZ |
11:06:58 | FromDiscord | <enthus1ast> Freakwill (William Song)\: you can use https://play.nim-lang.org/ to share code blocks |
11:11:57 | FromDiscord | <planetis> rand_vector pbl needs a generic argument |
11:12:18 | FromDiscord | <enthus1ast> @Bung\: when i use threads with nim, i usually go with channels |
11:13:13 | FromDiscord | <planetis> I am getting ahead though, what's the error? |
11:13:43 | FromDiscord | <Bung> I use it too, I just want write less code do the task |
11:13:48 | FromDiscord | <enthus1ast> is this not working? |
11:18:44 | FromDiscord | <Freakwill (William Song)> any idea? |
11:18:58 | FromDiscord | <enthus1ast> i feel ignored |
11:20:15 | FromDiscord | <Freakwill (William Song)> https://play.nim-lang.org/#ix=47h3 |
11:20:35 | FromDiscord | <enthus1ast> i already send you the solution |
11:20:47 | FromDiscord | <enthus1ast> a few hours ago ;) |
11:21:01 | FromDiscord | <Freakwill (William Song)> my aim is to generate vectors (of array type) in arbitrary dim |
11:22:15 | FromDiscord | <Freakwill (William Song)> Elegantbeef helped me. but I meet with new issue |
11:22:38 | FromDiscord | <Freakwill (William Song)> hi |
11:22:51 | FromDiscord | <enthus1ast> This right? ↵@[[1, 0, 1, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0], [1, 0, 0, 0, 1], [1, 0, 1, 0, 1]] |
11:22:51 | FromDiscord | <domosokrat> maybe the gitter/matrix bridge is semi-broken and only works one-way 😑 |
11:23:09 | FromDiscord | <enthus1ast> domosokrat\: or i'am just ignored haha |
11:24:09 | FromDiscord | <domosokrat> enthus1ast\: yeah that's also a possibility \:) |
11:24:15 | FromDiscord | <Freakwill (William Song)> ye |
11:24:21 | FromDiscord | <enthus1ast> yes |
11:24:26 | FromDiscord | <enthus1ast> then you got your solution |
11:25:24 | FromDiscord | <enthus1ast> domosokrat\: nobody expects bots to solve programming errors, but this one can sometimes |
11:25:39 | FromDiscord | <Freakwill (William Song)> My ambition is to generate vectors with different dims. for i in 1..10\:↵ const n=i↵ echo rand\_vector(n) # n-dim vector |
11:25:49 | FromDiscord | <Freakwill (William Song)> Is it possible? |
11:27:02 | FromDiscord | <Rika> On compile time |
11:27:13 | FromDiscord | <Freakwill (William Song)> yes |
11:28:54 | FromDiscord | <Rika> Same code except put it under a “static:” block |
11:30:24 | FromDiscord | <Phil> Curiosity question, why use the `block` bit?↵It's useful when you want to scope variables but don't want to open up a new proc, right? ↵When is that?↵I'm pretty sure there's a good usecase for it, I'm just not quite seeing it yet |
11:31:01 | FromDiscord | <Rika> What are you talking about |
11:32:26 | FromDiscord | <enthus1ast> @Phil\: i use it often for tests, where i just copy and paste it |
11:33:04 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=47h8 |
11:33:18 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47h9 |
11:36:01 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47ha |
11:36:16 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=47ha" => "https://play.nim-lang.org/#ix=47hb" |
11:36:55 | FromDiscord | <enthus1ast> yeah, for this i use them quite often |
11:38:50 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=47hd |
11:39:41 | FromDiscord | <flywind> It also shadow the global variables which is convenient for tests too. |
11:41:42 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=47he |
11:41:50 | FromDiscord | <vestel> How do I statically link openssl? |
11:42:18 | FromDiscord | <enthus1ast> build it as a static lib, use dynlib override |
11:42:32 | FromDiscord | <enthus1ast> BUT its quite a hassle |
11:42:51 | FromDiscord | <enthus1ast> if you just wanna fetch some data from a website you can use puppy |
11:42:54 | FromDiscord | <vestel> cause I have some weird errors with dynamic linking on win11, but its works on win10 |
11:43:01 | FromDiscord | <Phil> Just be prepared for openssl to statically link you'll be compiling for an hour |
11:43:02 | FromDiscord | <Phil> maybe 2 |
11:44:44 | FromDiscord | <enthus1ast> maybe open issues in the github tracker↵(@vestel) |
11:45:57 | FromDiscord | <flywind> A known issue https://github.com/nim-lang/Nim/issues/15220 |
11:46:05 | FromDiscord | <planetis> You can't have a seq with items of different size |
11:46:40 | FromDiscord | <planetis> you need refs and shit |
11:47:02 | FromDiscord | <planetis> (edit) "shit" => "dynamic dispatch" |
12:15:10 | FromDiscord | <Freakwill (William Song)> I just generate a vector/array in a random size↵(@planetis) |
12:15:19 | FromDiscord | <Freakwill (William Song)> sent a code paste, see https://play.nim-lang.org/#ix=47hn |
12:17:07 | FromDiscord | <Phil> Same issue as before with it all coming out as HTML Freakwill, try to use play nim lang ? |
12:18:55 | FromDiscord | <enthus1ast> @Phil\: looks good on matrix |
12:19:21 | FromDiscord | <planetis> you can't have a collection of different sized arrays, they are different types |
12:19:35 | FromDiscord | <planetis> use a seq for vector or oop |
12:20:32 | FromDiscord | <enthus1ast> do we have a list of bridges; wo operates them, and repos? |
12:21:48 | FromDiscord | <tandy> how can i run `nimble test` for a specific backend?↵(@dom96) |
12:21:57 | FromDiscord | <tandy> it uses the c backend by default |
12:22:00 | FromDiscord | <tandy> `nimble test --d:js` doesnt work |
12:22:14 | FromDiscord | <tandy> neither does nimble test --backend\:js |
12:42:17 | FromDiscord | <Freakwill (William Song)> sent a long message, see http://ix.io/47hx |
12:43:12 | FromDiscord | <Freakwill (William Song)> some idea? https://play.nim-lang.org/#ix=47hz |
12:43:44 | FromDiscord | <Freakwill (William Song)> ok↵(@Phil) |
13:01:37 | * | xet7 joined #nim |
13:08:32 | FromDiscord | <foobar-85> When I realized I can chain function calls without parentheses 🤯🤪 |
13:09:26 | * | CyberTailor quit (Remote host closed the connection) |
13:11:13 | * | CyberTailor joined #nim |
13:15:58 | * | CyberTailor quit (Remote host closed the connection) |
13:17:39 | * | CyberTailor joined #nim |
13:17:57 | FromDiscord | <4zv4l> I don't get the error |
13:17:59 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47hO |
13:18:06 | FromDiscord | <4zv4l> the while seem to make an issue |
13:18:18 | FromDiscord | <4zv4l> I use `illwill` |
13:19:35 | FromDiscord | <4zv4l> so I don't see what's wrong |
13:19:36 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47hQ |
13:20:27 | FromDiscord | <dom96> In reply to @tandy "how can i run": I don't think you can. Best workaround is to define your own `testjs` task and run the tests manually |
13:20:58 | * | xet7 quit (Remote host closed the connection) |
13:21:02 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=47hR |
13:21:09 | FromDiscord | <Rika> nim does not do "assignments as expressions" |
13:21:19 | FromDiscord | <4zv4l> so, how can I do that ? |
13:21:27 | FromDiscord | <Rika> `(c = getKey(); c)` |
13:21:43 | FromDiscord | <4zv4l> hmmm |
13:22:04 | FromDiscord | <4zv4l> alright |
13:22:07 | FromDiscord | <4zv4l> I think I get it |
13:46:08 | FromDiscord | <4zv4l> I don't see how I can convert a `Key` to a `char` to be able to print it correctly |
13:46:41 | FromDiscord | <4zv4l> but it doesn't seem to work |
13:46:43 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47i2 |
13:49:15 | FromDiscord | <MagPhi> Is the nim gc more efficient than allocating memory by hand? |
13:52:04 | FromDiscord | <4zv4l> good manual memory handling will always be better than gc |
13:52:25 | FromDiscord | <4zv4l> (edit) "always" => "--always--" |
13:53:15 | FromDiscord | <4zv4l> (edit) "--always--" => "~~always~~" |
13:55:10 | FromDiscord | <MagPhi> only if the person is good at it? |
13:55:12 | FromDiscord | <MagPhi> right |
13:55:55 | FromDiscord | <enthus1ast> $Key should work @4zv4l |
13:56:35 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1007286410979573821/unknown.png |
13:56:36 | FromDiscord | <4zv4l> it prints like this |
13:56:44 | FromDiscord | <4zv4l> Space rather than " " |
13:57:51 | FromDiscord | <MagPhi> Can I do functional programming in nim? |
13:58:02 | FromDiscord | <4zv4l> In reply to @MagPhi "Can I do functional": of course you can |
13:58:47 | FromDiscord | <4zv4l> In reply to @enthus1ast "$Key should work": or is there any other function from a lib I can use to read from keyboard ? Because then that lib would support utf-8 |
13:59:12 | FromDiscord | <Rika> In reply to @MagPhi "only if the person": That’s why he said “good” yes |
14:00:32 | FromDiscord | <enthus1ast> I've done it like so afaik this was working https://github.com/enthus1ast/illwillWidgets/blob/04f507cfd651df430b1421403b3a70cb061c4624/src/illwillWidgets.nim#L507 |
14:00:38 | FromDiscord | <enthus1ast> @4zv4l\: |
14:00:43 | FromDiscord | <MagPhi> so what if I write some code in nim compile it to c translate that to zig do memory management and then compile it back to c or binary |
14:01:32 | * | jmdaemon quit (Ping timeout: 268 seconds) |
14:01:34 | FromDiscord | <Rika> Have fun |
14:01:37 | FromDiscord | <Rika> High effort |
14:01:48 | FromDiscord | <Rika> Could just use ARC memory management |
14:07:12 | FromDiscord | <enthus1ast> The gc discussions all the time are quite funny imho, see what manual memory management brought us\: alot of zero days |
14:07:24 | FromDiscord | <enthus1ast> But still these discussions 😁 |
14:11:20 | * | gsalazar quit (Ping timeout: 268 seconds) |
14:11:55 | FromDiscord | <domosokrat> I think most know only stop-the-world gc or reference-counted interpreted language implementations. |
14:12:12 | * | arkurious joined #nim |
14:13:48 | * | gsalazar joined #nim |
14:14:03 | * | jmdaemon joined #nim |
14:17:59 | FromDiscord | <4zv4l> In reply to @enthus1ast "I've done it like": I can't make my textbox to work, it's my first time doing tui T-T |
14:24:29 | FromDiscord | <MagPhi> Wait can I do manual memory allocation in nim |
14:25:38 | FromDiscord | <enthus1ast> alloc() / dealloc() etc https://nim-lang.org/docs/system.html#alloc.t%2CNatural |
14:32:36 | FromDiscord | <Phil> In reply to @MagPhi "Wait can I do": There's a compiler flag to turn GC off |
14:32:59 | FromDiscord | <Rika> you can do manual memory management without turning the GC off |
14:32:59 | FromDiscord | <MagPhi> will nim protect me from segmentation faults when doing manual memory allocation |
14:33:13 | FromDiscord | <Rika> no |
14:33:16 | FromDiscord | <Rika> manual means manual |
14:33:26 | FromDiscord | <MagPhi> k theb |
14:33:27 | FromDiscord | <MagPhi> (edit) "theb" => "then" |
14:33:44 | FromDiscord | <MagPhi> i can use js libs with nim right |
14:33:59 | FromDiscord | <Rika> if you compile to js, which means you cant control memory anyway |
14:35:04 | FromDiscord | <Rika> im not sure why you want manual memory management |
14:35:57 | FromDiscord | <MagPhi> bc i like to shoot myself in the foot |
14:36:05 | FromDiscord | <MagPhi> In reply to @MagPhi "i can use js": ? |
14:36:43 | FromDiscord | <Phil> Rika gave you an answer for that |
14:37:10 | FromDiscord | <Phil> (edit) "that" => "whether you can use js libs" |
14:40:07 | FromDiscord | <MagPhi> In reply to @Rika "if you compile to": i cant really understand from this like is it a yes or a no |
14:40:24 | FromDiscord | <MagPhi> I know I can compile to js but I want to use js libs in nim before translating to js |
14:40:44 | FromDiscord | <Rika> you can use js libs in nim if you are using the js backend |
14:41:03 | FromDiscord | <MagPhi> So I can reference it before compiling to js? |
14:41:12 | FromDiscord | <MagPhi> (edit) "reference" => "import" |
14:41:20 | FromDiscord | <Rika> yes |
14:41:30 | FromDiscord | <Rika> i dont know how, i dont use the js backend |
14:41:48 | FromDiscord | <MagPhi> alright |
14:42:30 | FromDiscord | <Phil> Hotdog is one of the people I always recall when it comes to people using js backend (or karax) |
14:43:01 | FromDiscord | <Phil> If you want to ask further general questions and need somebody to talk to |
14:44:14 | FromDiscord | <4zv4l> is that normal that global string variable doesn't work ? or it's just my code ? |
14:44:47 | FromDiscord | <flywind> Code? |
14:46:15 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47in |
14:46:29 | FromDiscord | <4zv4l> handleMsg change the Buffer variable↵and handOut print the Buffer variable |
14:46:31 | FromDiscord | <flywind> It depends how you write it. It known that the {.global.} pragma doesn't work with string well in ARC/ORC. |
14:47:08 | FromDiscord | <4zv4l> I don't specify the gc |
14:47:10 | FromDiscord | <MagPhi> Since LLVM based languages seem to be fast is nlvm faster than nim? |
14:47:16 | FromDiscord | <4zv4l> is ORC the default now ? |
14:47:30 | FromDiscord | <flywind> No, it isn't. |
14:47:54 | FromDiscord | <4zv4l> then idk |
14:47:58 | FromDiscord | <4zv4l> when I print the Buffer it shows |
14:48:08 | FromDiscord | <4zv4l> https://media.discordapp.net/attachments/371759389889003532/1007299382602903632/unknown.png |
14:48:08 | FromDiscord | <4zv4l> lot of yyyyyyyyyyyyyyy |
14:48:49 | FromDiscord | <enthus1ast> write is a macro and a little wonky |
14:48:52 | FromDiscord | <4zv4l> I thought maybe it's because when I do↵`Buffer = ""`↵it changes the pointer to another addr in memory rather than cleaning or doing whatever idk |
14:49:07 | FromDiscord | <4zv4l> idk how strings are handled in nim so |
14:49:43 | FromDiscord | <enthus1ast> ohh \:) |
14:49:54 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=47iu |
14:50:02 | FromDiscord | <enthus1ast> you also add Key.None to the buffer |
14:50:09 | FromDiscord | <4zv4l> ooooh yeah |
14:50:11 | FromDiscord | <4zv4l> my bad |
14:50:18 | FromDiscord | <4zv4l> thanks !!! |
14:50:37 | FromDiscord | <Phil> In reply to @MagPhi "Since LLVM based languages": Generally languages like zig, c,c++, rust, Nim tend to have the same performance potential,. It's mostly a matter of how familiar you are with your chosen language. There's not really a "faster", you can have slow code in any of these languages |
14:51:08 | FromDiscord | <4zv4l> In reply to @enthus1ast "ohh \:)": also that's weird, when I quit using ctrl-c (bad way) my terminal keep the cursor, but when I use Escape as it's in my code, my cursor disappear, how come ? |
14:51:27 | FromDiscord | <Rika> doesnt illwill also have something you have to call before exiting |
14:51:42 | FromDiscord | <Rika> illwill probably inserts this function to the ctrlc handler |
14:52:24 | FromDiscord | <domosokrat> you don't call your exitProc when pressing Escape |
14:52:28 | FromDiscord | <enthus1ast> mh try to also call showCursor()() |
14:52:29 | FromDiscord | <4zv4l> I break from main |
14:52:33 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47iv |
14:52:40 | FromDiscord | <4zv4l> and it gives the exirProc |
14:53:07 | FromDiscord | <4zv4l> setControlCHook(exitProc)↵↵this means it will call this proc at the end of the proc right ? |
14:53:28 | FromDiscord | <domosokrat> no, only when pressing Ctrl-C |
14:54:20 | FromDiscord | <4zv4l> ooooh alright |
14:54:24 | FromDiscord | <4zv4l> thanks |
14:55:03 | FromDiscord | <enthus1ast> trying your app, i can recommend that you do some kind of "text refresh widget" that clears a whole line |
14:56:11 | FromDiscord | <4zv4l> what do you mean ? which line ? |
14:56:15 | FromDiscord | <enthus1ast> i think i've called such a widget "newInfoBox" in illwillWidgets |
14:56:26 | FromDiscord | <4zv4l> to print the Buffer ? |
14:56:48 | FromDiscord | <enthus1ast> because you print a long line, then replace the line with a short line, then you still see the artefacts of the long line |
15:00:44 | FromDiscord | <4zv4l> alright, I'll check that ^^ Thanks ! |
15:02:15 | FromDiscord | <enthus1ast> also if you wanna see a bigger illwill project\:↵https://github.com/enthus1ast/muk/blob/master/src/muk.nim↵and a smaller one\:↵https://github.com/enthus1ast/trainingThing/blob/master/src/training.nim |
15:39:09 | FromDiscord | <jmgomez> In reply to @MagPhi "So I can import": take a look at this: https://nim-lang.org/docs/jsffi.html↵I dont have much experience with the js backend, just did a quick test a few days but it seems to me that JsObject is similar to any in TS and for importing libraries you can just use importjs (I think importc also work) but if you look in the sources for importjs you will see a lot of examples. It's quite handy once you get hang of it |
15:49:06 | FromDiscord | <tandy> sad↵(@dom96) |
15:51:08 | FromDiscord | <dom96> would be a simple PR if you're interested in contributing |
16:15:55 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/47j0 |
16:18:24 | * | gsalazar quit (Ping timeout: 268 seconds) |
16:29:04 | FromDiscord | <enthus1ast> @4zv4l\: yeah I struggled with this a bit aswell |
16:29:26 | FromDiscord | <enthus1ast> But keeping them in memory is a good first step |
16:29:53 | FromDiscord | <enthus1ast> Do you want to scroll up again manually later? |
16:30:08 | FromDiscord | <4zv4l> oh no, the mouse will be prohibited |
16:30:12 | FromDiscord | <4zv4l> only keyboard |
16:30:15 | FromDiscord | <4zv4l> only sending messages |
16:30:33 | FromDiscord | <enthus1ast> But do you wanna go up? |
16:30:37 | FromDiscord | <4zv4l> for now I can send messages so, already a good step xD↵now I need to handle the receive messages |
16:30:53 | FromDiscord | <4zv4l> In reply to @enthus1ast "But do you wanna": like when the screen is full of messages, the oldest one go up yeah |
16:31:03 | FromDiscord | <4zv4l> but the user won't be able to scroll |
16:31:17 | FromDiscord | <enthus1ast> Ok then it's quite easy |
16:31:33 | FromDiscord | <4zv4l> or idk yet about that, I'll see |
16:31:34 | FromDiscord | <4zv4l> xD |
16:31:43 | FromDiscord | <4zv4l> for now I already wanna succeed the send/recv |
16:31:47 | FromDiscord | <enthus1ast> Figure out how many lines you can draw den just draw the last x from your buffer |
16:32:02 | FromDiscord | <4zv4l> yeah |
16:32:05 | FromDiscord | <4zv4l> that's the idea of now |
16:32:19 | FromDiscord | <4zv4l> what is not so cool for now is that with the textbox I still can't send utf-8 char |
16:32:29 | FromDiscord | <enthus1ast> Yes |
16:32:48 | FromDiscord | <4zv4l> and also the going back and forth with arrow make the string weird |
16:32:58 | FromDiscord | <4zv4l> I have to write it right the first try |
16:33:07 | FromDiscord | <enthus1ast> Illwill cannot do this |
16:33:11 | FromDiscord | <4zv4l> it's because of the way I keep the char in my buffer I think |
16:33:36 | FromDiscord | <enthus1ast> Not yet at least |
16:33:40 | FromDiscord | <enthus1ast> I have two pr's for exactly this issue lying around somewhere |
16:34:10 | FromDiscord | <enthus1ast> Think maybe you also add these chars? |
16:38:05 | FromDiscord | <enthus1ast> Do you call handleKey() ? |
16:38:28 | FromDiscord | <enthus1ast> If yes then it might be a bug in the widgets library |
16:39:15 | FromDiscord | <4zv4l> like this |
16:39:16 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47j8 |
16:39:29 | FromDiscord | <4zv4l> so I insert every key to the buffer which isnt the best way I guess |
16:41:16 | FromDiscord | <enthus1ast> you can get the buffer from the TextBox |
16:41:36 | FromDiscord | <4zv4l> oooh |
16:41:42 | FromDiscord | <4zv4l> how that |
16:41:52 | FromDiscord | <enthus1ast> txtb.text |
16:42:14 | FromDiscord | <enthus1ast> and also\: ## if this function return "true" the textbox lost focus by enter |
16:42:34 | FromDiscord | <4zv4l> omg yeah |
16:42:40 | FromDiscord | <enthus1ast> https://github.com/enthus1ast/illwillWidgets/blob/04f507cfd651df430b1421403b3a70cb061c4624/examples/demo.nim#L116 |
16:42:44 | FromDiscord | <4zv4l> In reply to @enthus1ast "and also\: ": yeah I saw that |
16:42:59 | FromDiscord | <enthus1ast> in the demo all widgets are used |
16:43:01 | FromDiscord | <4zv4l> but since there is no mouse in my program it never lose the focus |
16:43:51 | FromDiscord | <enthus1ast> mh yeah the description is quite bad to be honest |
16:44:10 | FromDiscord | <enthus1ast> it returns true if you hit enter |
16:44:49 | FromDiscord | <4zv4l> ooooh |
16:45:28 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47jb |
16:45:37 | FromDiscord | <enthus1ast> yes |
16:45:49 | FromDiscord | <4zv4l> alright !↵thanks ! |
16:47:41 | FromDiscord | <4zv4l> how do I give an array of string to a function ? but it's not an array is a `@[]` ? |
16:47:56 | FromDiscord | <enthus1ast> a sequence |
16:48:08 | FromDiscord | <enthus1ast> proc foo(se\: seq[string]) |
16:48:23 | FromDiscord | <enthus1ast> foo(@["baa", "baz"]) |
16:48:31 | FromDiscord | <4zv4l> alright perfect, I think I can do something with the receive |
16:48:36 | FromDiscord | <4zv4l> super thanks ! |
16:59:51 | * | \u is now known as meowray |
16:59:58 | * | meowray quit (Changing host) |
16:59:58 | * | meowray joined #nim |
17:04:03 | FromDiscord | <4zv4l> also for now the widgets code is in my source code folder because I couldn't install it with nimble, is that normal or I'm supposed to be able to install it ? |
17:04:55 | FromDiscord | <enthus1ast> could be that i've not added it to the nimble directory |
17:05:09 | FromDiscord | <enthus1ast> but you can install every nim module that has a nimble file directly from git |
17:05:19 | FromDiscord | <enthus1ast> nimble install https://github.com/enthus1ast/illwillWidgets |
17:06:36 | FromDiscord | <tandy> i am, il make an issue where we can discuss it↵(@dom96) |
17:06:51 | FromDiscord | <4zv4l> In reply to @enthus1ast "nimble install https://github.com/enthus1ast/illwil": works great, thanks ! |
17:10:28 | FromDiscord | <4zv4l> I don't get how to make a nim script to build my program automatically |
17:12:13 | FromDiscord | <EyeCon> There's something that bugs me about the need for indentation and/or commas in some contexts. Why is that we need to separate the elements of an indented `import` block with commas (and optionally newlines), but we write an indented block without the commas for e.g. an object declaration? It seems that there's no source for confusion if the import block could also be separated by only newlines. |
17:12:23 | FromDiscord | <EyeCon> Or is there something I'm not seeing? |
17:13:40 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47jo |
17:14:34 | FromDiscord | <gibson> Yeah, that's inconsistent. I would expect it to work without commas. |
17:14:37 | FromDiscord | <Rika> because you can do `import a, b` but not `const a = "", b = 19230` |
17:15:02 | FromDiscord | <Prestige> In reply to @4zv4l "I don't get how": You can make a run task in your nimble file |
17:15:26 | FromDiscord | <Rika> the import with newlines works as a side effect of nim's leniency with newline placement, i'd say |
17:16:11 | FromDiscord | <Rika> In reply to @Rika "because you can do": technically you can do `const (a,b) = ("", 91273)` but thats besides the point ig |
17:17:14 | FromDiscord | <EyeCon> In reply to @Rika "the import with newlines": I get that, but is this something we want? That's a potential stumbling block for newcomers. On the other hand, I have no specific proposal which is completely consistent and have no drawbacks |
17:17:18 | FromDiscord | <dom96> In reply to @tandy "i am, il make": awesome, thank you! |
17:18:24 | FromDiscord | <Rika> In reply to @EyeCon "I get that, but": i have no opinion; it will have to wait for nim 2 in any case |
17:20:20 | FromDiscord | <Prestige> Having no commas required between imports would be cool |
17:20:48 | * | neceve joined #nim |
17:22:02 | FromDiscord | <gibson> sent a code paste, see https://play.nim-lang.org/#ix=47jq |
17:22:30 | FromDiscord | <EyeCon> Wait, how does that error |
17:23:39 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47jr |
17:24:16 | FromDiscord | <gibson> My mental model of how nim works is incorrect, because I thought the above would work. So I'd like to figure out what is actually happening. |
17:25:02 | FromDiscord | <EyeCon> Not that I'm an expert in Nim, but I have difficulties imagining how it would fail |
17:25:17 | * | rockcavera joined #nim |
17:25:17 | * | rockcavera quit (Changing host) |
17:25:17 | * | rockcavera joined #nim |
17:25:43 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47js |
17:26:00 | FromDiscord | <EyeCon> Which makes the error message even more surprising |
17:26:51 | FromDiscord | <EyeCon> We need a guru here |
17:28:34 | FromDiscord | <Rika> `proc sum(a: SomeNumber; b: distinct SomeNumber): float =` |
17:28:36 | FromDiscord | <domosokrat> sent a code paste, see https://paste.rs/Edb |
17:28:52 | FromDiscord | <Forest> What's a good image manipulation library for Nim? |
17:28:56 | FromDiscord | <Rika> pixie |
17:29:07 | FromDiscord | <Forest> I need to be able to create an image, apply a mask, and colour it |
17:29:13 | FromDiscord | <Forest> Ooh looking into it now |
17:29:14 | FromDiscord | <Rika> `proc sum(a: SomeNumber; b: SomeNumber): float =` -> `proc sum[T: SomeNumber](a, b: T): float =` |
17:29:25 | FromDiscord | <Prestige> Pixie is amazing |
17:29:35 | FromDiscord | <domosokrat> I think if you do `proc sum (a: SomeNumber; b: SomeNumber)` both have to refer to the same type |
17:29:43 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#generics-implicit-generics |
17:29:45 | FromDiscord | <Rika> documented here |
17:29:45 | FromDiscord | <Forest> Ooh looks cool |
17:29:58 | FromDiscord | <Rika> `By default, during overload resolution, each named type class will bind to exactly one concrete type. We call such type classes bind once types.` |
17:30:32 | FromDiscord | <Phil> At some point some of treeforms libs will just be in every project out there and he'll have ultimate control! |
17:30:32 | FromDiscord | <domosokrat> Thanks, I knew that I saw it somewhere |
17:32:31 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=47jt |
17:32:55 | FromDiscord | <Rika> In reply to @Rika "`By default, during overload": read this |
17:33:06 | FromDiscord | <Rika> a "SomeFloat = float|float32|float64" is a "named type class" |
17:33:45 | FromDiscord | <EyeCon> That is hell of a gotcha if I have ever seen one |
17:33:52 | FromDiscord | <4zv4l> so what should be change to make it works ? I don't get it |
17:34:04 | FromDiscord | <Rika> In reply to @Rika "`proc sum(a: SomeNumber; b:": here |
17:34:11 | FromDiscord | <Rika> read this part of the manual https://nim-lang.org/docs/manual.html#generics-implicit-generics |
17:35:46 | FromDiscord | <4zv4l> > Alternatively, the distinct type modifier can be applied to the type class to allow each param matching the type class to bind to a different type. Such type classes are called bind many types.↵alright, thanks ! |
17:35:52 | FromDiscord | <leorize> the main problem is in this sentence\:↵> By default, during overload resolution, each named type class will bind to exactly one concrete type |
17:36:54 | FromDiscord | <EyeCon> The error message is misleading as hell too |
17:37:22 | FromDiscord | <enthus1ast> @Rika\: did not know about the `distinct` in this case, thank you |
17:37:42 | FromDiscord | <Rika> In reply to @EyeCon "The error message is": it doesnt help, thats for sure |
17:40:20 | FromDiscord | <Phil> Oh right I likely should do an SO for myself for the error of calling compile time procs at runtime |
17:40:55 | FromDiscord | <gibson> Is it true that specifying `(typeclass|otherTypeclass)` implies distinct? _Seems_ to be the case. |
17:41:31 | FromDiscord | <leorize> not really, the gist of it is, each typeclass will be bound once |
17:41:45 | FromDiscord | <leorize> if you have two of those I'd imagine bound-once happens to them |
17:42:18 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47jy |
17:42:33 | FromDiscord | <Rika> "By default, during overload resolution, each named type class will bind to exactly one concrete type. We call such type classes bind once types." |
17:42:59 | FromDiscord | <Rika> just to point out if you're wondering why that works |
17:43:12 | FromDiscord | <EyeCon> In reply to @Rika "just to point out": Not me, just wanted to demonstrate |
17:43:21 | FromDiscord | <leorize> yea, also that example you declared a `sum()` proc but you didn't call it \:P |
17:43:27 | FromDiscord | <gibson> sent a code paste, see https://play.nim-lang.org/#ix=47jz |
17:44:00 | FromDiscord | <EyeCon> In reply to @leorize "yea, also that example": Yeah, just noticed that 😄 |
17:44:43 | FromDiscord | <Phil> In reply to @gibson "Strangely, I can't get": I assume both times you're going down the route of some integer, the first value determined that for this proc some integer is i8 and then the second one comes in being i16 which conflicts with that |
17:45:07 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47jA |
17:45:13 | FromDiscord | <gibson> (edit) "https://play.nim-lang.org/#ix=47jz" => "https://play.nim-lang.org/#ix=47jB" |
17:45:21 | FromDiscord | <Phil> There a and b aren't connected in any way |
17:45:40 | FromDiscord | <EyeCon> So after reading the manual again, it is clear why it doesn't work, but this is very confusing for newcomers too |
17:46:01 | FromDiscord | <EyeCon> Is it worth to have these "bind-once" types, in spite of all this difficulty? |
17:46:51 | FromDiscord | <Phil> I'd say it depends, this made perfect sense to me when I first ran into it.↵Having that is valuable to be able to express that 2 variables in some circumstances should absolutely be the same type |
17:47:32 | FromDiscord | <leorize> I think bind once is an artifact of supporting the expression\: `proc foo(a, b: SomeNumber): float` |
17:48:03 | FromDiscord | <EyeCon> In reply to @Isofruit "I'd say it depends,": But isn't that expressible by something like `proc sum3[T](a: T, b: T): float`? |
17:48:37 | FromDiscord | <gibson> Specificity is very useful, though. |
17:48:43 | FromDiscord | <Phil> In reply to @EyeCon "But isn't that expressible": Depends if there are more complex interactions between a and b |
17:49:03 | FromDiscord | <leorize> an overwhelming pattern in Nim is that `a, b: something` is the same as `a: something, b: something` |
17:49:03 | FromDiscord | <EyeCon> Or even `proc sum3[T: SomeFloat](a: T, b: T): float` |
17:50:58 | FromDiscord | <Phil> There can be type relationships where you might absolutely want types to be enforced as the same type of float if they're both floats, expressing that 2 types should be independently determined via distinct is also pretty nice IMO |
17:51:38 | FromDiscord | <gibson> sent a code paste, see https://play.nim-lang.org/#ix=47jE |
17:52:16 | FromDiscord | <gibson> Thanks all, this was very useful. |
17:52:19 | FromDiscord | <Phil> Makes sense to me, each of the numbers get their own some number type |
18:02:06 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=47jI |
18:04:43 | FromDiscord | <Phil> That looks like the field width is not being exported |
18:04:52 | FromDiscord | <Phil> Is that your own type? |
18:05:42 | FromDiscord | <Phil> If not, does pixie provide a proc that indirectly allows accessing width? |
18:06:18 | FromDiscord | <Forest> Nope, it's Pixie |
18:06:20 | FromDiscord | <Forest> Let me see |
18:07:53 | FromDiscord | <Forest> Oh looks like i don't get to get the width since i can base the dimensions off of the older image |
18:08:50 | FromDiscord | <Phil> Aha! I am too tired to compute what that means but it sounds you understood the problem and are able to progress |
18:09:13 | FromDiscord | <Forest> I can't do that nevermind |
18:09:18 | FromDiscord | <Forest> In reply to @Isofruit "If not, does pixie": Doesn't look like it |
18:14:45 | * | kenran joined #nim |
18:14:52 | * | kenran quit (Client Quit) |
18:14:55 | FromDiscord | <guzba> In reply to @Forest "Doesn't look like it": `Image` has width and height properties: https://nimdocs.com/treeform/pixie/pixie/common.html#Image |
18:17:21 | FromDiscord | <Forest> In reply to @guzba "`Image` has width and": Yeah that's what I'm using, it fails to compile |
18:18:05 | FromDiscord | <voidwalker> Is there a special way to express an empty char literal ? I want to delete a char in a string with replace. |
18:19:36 | * | CyberTailor quit (Read error: Connection reset by peer) |
18:21:07 | FromDiscord | <domosokrat> No, but you can there is a replace taking string |
18:21:09 | * | CyberTailor joined #nim |
18:21:41 | FromDiscord | <voidwalker> Ah ok, I did this before, I thought I don't know how to |
18:21:49 | FromDiscord | <voidwalker> (edit) "Ah ok, I did this before, I thought I don't know how to ... " added "do it with char" |
18:21:54 | FromDiscord | <domosokrat> So `s.replace($c, "")` |
18:22:45 | FromDiscord | <guzba> In reply to @Forest "Yeah that's what I'm": is `pixie` imported? if so, perhaps you don't have an Image, since i can't see the code, what do you get if you echo the thing youre trying to access `.width` on? |
18:24:24 | FromDiscord | <Forest> In reply to @guzba "is `pixie` imported? if": Yup it is actually |
18:24:29 | FromDiscord | <Forest> In reply to @guzba "is `pixie` imported? if": Let me try rn |
18:26:25 | FromDiscord | <Forest> I managed to fix it |
18:26:34 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=47jR |
18:28:15 | * | neceve quit (Remote host closed the connection) |
18:31:44 | FromDiscord | <Forest> How do i make the mask apply a colour to the image? |
18:51:12 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=47k2 |
18:51:33 | FromDiscord | <voidwalker> what is `[N: static[int]]` supposed to mean here? |
18:52:23 | FromDiscord | <domosokrat> N has to be an int known at compile time |
18:54:40 | FromDiscord | <voidwalker> https://github.com/status-im/nim-stew/blob/master/stew/byteutils.nim#L173 |
18:54:57 | FromDiscord | <voidwalker> Why did they define 2 versions, one with N known at compile time, and one without ? |
19:20:58 | FromDiscord | <voidwalker> What is the most efficient way to a string of the from `d09e16dbab564012947a89da49558d15` to `d09e16db-ab56-4012-947a-89da49558d15` ? 8-4-4-4-12 |
19:25:40 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=47kd |
19:25:41 | FromDiscord | <Generic> I'm too lazy to write the rest |
19:25:53 | FromDiscord | <Generic> though it should only allocate once |
19:26:43 | FromDiscord | <Generic> you can probably do some clever templating to make this less ugly |
19:28:02 | FromDiscord | <voidwalker> Ah I meant in the least number of lines (prefferably 1), using the std lib procs.. |
19:28:20 | FromDiscord | <voidwalker> there should be an insert that takes an openarray as positions |
19:29:53 | FromDiscord | <Fish-Face> Something in my program is using more memory than I expected. Any tips? Can I view the reserved size of a hashset? are there easy to use memory profilers? |
19:30:36 | FromDiscord | <leorize> strformat.fmt"{input[0..\<8]}-{input[8..\<12]}-{input[12..\<16]}-{input[16..\<24]}"↵(@voidwalker) |
19:30:37 | FromDiscord | <Fish-Face> (edit) "Something in my program is using more memory than I expected. Any tips? Can I view the reserved size of a hashset? are there easy to use memory profilers? ... " added "Can I just straightforwardly and recursively get how much memory is allocated for an object? (Without cycles...)" |
19:31:45 | FromDiscord | <voidwalker> huh I guess I should learn strformat , been doing it all with & so far |
19:32:56 | FromDiscord | <leorize> unfortunately there's no way to see how much memory is allocated for an object↵(@Fish-Face) |
19:33:43 | FromDiscord | <leorize> if you look into GC stats then you can see how much memory is allocated in total, though |
19:33:58 | FromDiscord | <Fish-Face> mm, I can get that from the OS though 😛 |
19:34:34 | FromDiscord | <leorize> well, you can do some math to figure a rough estimate \:p |
19:38:59 | FromDiscord | <leorize> here's an insight to help you optimize\: seq will expand to 1.5 times it's current size every add once a certain threshold is reached |
19:40:10 | FromDiscord | <Fish-Face> do you know the behaviour for `HashSet`? I thought it was doubling but that's not true. I'm also interested in any overhead that scales, let's say at least linearly, with the number of items |
19:44:08 | FromDiscord | <munchii2> does anyone know why i cant reassign an object instances field? i get this error `Error: 'vault3.title' cannot be assigned to` |
19:45:29 | NimEventer | New Nimble package! qwatcher - Monitor TCP connections and diagnose buffer and connectivity issues on Linux machines related to input and output queues, see https://github.com/pouriyajamshidi/qwatcher |
19:45:44 | FromDiscord | <Prestige> @munchii2 Needs to be a `var` to be mutable |
19:45:48 | FromDiscord | <Prestige> or a `ref object` |
19:46:36 | FromDiscord | <munchii2> In reply to @Avahe "<@555284165348818944> Needs to be": oh okay thanks |
19:48:48 | FromDiscord | <Forest> In reply to @Forest "How do i make": Quick bump because i couldn't figure it out ^^ |
19:49:20 | FromDiscord | <leorize> given this\: https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sets.nim#L59-L67 you can expect a growth rate similar to seq↵(@Fish-Face) |
19:49:51 | FromDiscord | <Prestige> In reply to @Forest "Quick bump because i": Did you see https://github.com/treeform/pixie#masking ? |
19:50:01 | FromDiscord | <Fish-Face> mmm. Clearly something is storing a lot more than I am expecting. It's not my code; I need to understand it better. |
19:50:27 | FromDiscord | <leorize> you'll have an `8 + padding` bytes worth of overhead per set entry, so take note of that |
19:50:47 | FromDiscord | <munchii2> sent a code paste, see https://play.nim-lang.org/#ix=47km |
19:51:05 | FromDiscord | <Forest> I did but i think i typed it wrong |
19:51:07 | FromDiscord | <munchii2> (edit) "https://play.nim-lang.org/#ix=47km" => "https://play.nim-lang.org/#ix=47kn" |
19:51:27 | FromDiscord | <munchii2> (edit) "https://play.nim-lang.org/#ix=47kn" => "https://play.nim-lang.org/#ix=47ko" |
19:53:22 | FromDiscord | <leorize> if you want to not use ref, switch to `var seq[T]`↵(@munchii2) |
19:54:25 | FromDiscord | <munchii2> oh okay. thanks |
19:56:10 | FromDiscord | <munchii2> still doesnt seem to work |
19:56:24 | FromDiscord | <munchii2> oh |
19:56:25 | FromDiscord | <munchii2> wait |
19:56:28 | FromDiscord | <munchii2> i forgot to remove ref |
19:56:56 | FromDiscord | <munchii2> now i get `but expression '@[vault, vault2, vault3]' is immutable, not 'var'` |
19:57:28 | FromDiscord | <leorize> yea, those are immutable, what are you trying to do? |
19:57:43 | FromDiscord | <leorize> like, only modify the array in the proc itself without affecting the one outside or? |
20:01:54 | FromDiscord | <munchii2> well the whole problem started when i tried to reassign a field on an object that was already defined. but i suppose thats because it was defined as a `let`. but if i define it as a `var` then the code breaks again. i suppose the easiest fix would be to just create a new object |
20:02:57 | FromDiscord | <munchii2> nvm |
20:03:45 | FromDiscord | <munchii2> sent a code paste, see https://play.nim-lang.org/#ix=47kt |
20:08:11 | FromDiscord | <EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47ku |
20:08:35 | FromDiscord | <EyeCon> (edit) "https://play.nim-lang.org/#ix=47ku" => "https://play.nim-lang.org/#ix=47kv" |
20:09:10 | FromDiscord | <voidwalker> yeah that makes sense. I was going to do an insert.insert.insert.. but the string fmt looks better |
20:09:55 | FromDiscord | <EyeCon> If that's on a hot path it would make sense to profile+optimize, else whatever is most readable to you |
20:10:42 | FromDiscord | <leorize> building a new string is generally faster for this |
20:11:51 | FromDiscord | <Phil> I mean, we got benchy, let's benchmark |
20:12:17 | FromDiscord | <Phil> Eyecon, the hyphen position is always compile-time known? |
20:12:34 | FromDiscord | <EyeCon> In reply to @Isofruit "Eyecon, the hyphen position": Not my problem, @voidwalker? |
20:13:01 | FromDiscord | <voidwalker> yes, the position is constant |
20:13:26 | FromDiscord | <voidwalker> At least I hope so, will have to run a decode(encode()) on all db items to check if I got it right |
20:18:29 | FromDiscord | <Tuatarian> Is there a way to do memory arenas |
20:18:48 | FromDiscord | <Tuatarian> Ie block allocate a bunch of memory and dole it out manually |
20:20:11 | FromDiscord | <leorize> there is fusion/pools iirc |
20:23:07 | FromDiscord | <Phil> Dang, kinda wish I could tell benchy to do sth more than 1000 times |
20:23:45 | FromDiscord | <leorize> you can also just create a bunch of executables then use `hyperfine` to benchmark them |
20:24:02 | FromDiscord | <Phil> but leorize |
20:24:04 | FromDiscord | <Phil> I am lazy |
20:24:39 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/cj5 |
20:25:03 | FromDiscord | <leorize> so basically it doesn't matter \:P |
20:25:17 | FromDiscord | <Phil> I may have fucked up the implementations, but generally to me it appears that just inserting seems somewhat faster |
20:25:19 | FromDiscord | <Forest> In reply to @Avahe "Did you see https://github.com/treeform/pixie#maski": Okay issue with this example is i need to make the mask also apply a colour to the image |
20:25:34 | FromDiscord | <Phil> Tbh I could only be able to tell if I could tell benchy to run this 100.000 times rather than just 1000 |
20:26:00 | FromDiscord | <Forest> Like, this was made from a white sheep and a mask (someone made it in JS), i wanna do it with Pixie https://media.discordapp.net/attachments/371759389889003532/1007384410221449217/unknown-1-1.png |
20:26:23 | FromDiscord | <Phil> Can somebody generate me a seq of 100 random strings with 50 characters ? |
20:26:37 | FromDiscord | <Forest> A sequence? Sure |
20:27:11 | FromDiscord | <Phil> I'm so brainbroken atm post sport and hard workday I can barely code a benchmark |
20:28:54 | FromDiscord | <leorize> your string builder is unoptimal, though |
20:29:15 | FromDiscord | <leorize> you're copying the guid, then concating them by pieces |
20:29:20 | FromDiscord | <Phil> I'll gladly take contributions! |
20:29:28 | FromDiscord | <Phil> To give voidwalker the perfect benchmark |
20:29:49 | FromDiscord | <Forest> https://haste.powercord.dev/naxexobobi |
20:29:54 | FromDiscord | <Forest> (edit) "https://haste.powercord.dev/naxexobobi" => "https://haste.powercord.dev/naxexobobi.json" |
20:30:02 | FromDiscord | <Forest> Wait do you mean with your thing? |
20:30:14 | FromDiscord | <Forest> I just generated this in python lmao |
20:30:28 | FromDiscord | <Phil> That's fine, I just need to copypaste it as base data |
20:30:33 | FromDiscord | <Forest> Oh sweet |
20:31:33 | FromDiscord | <Forest> In reply to @Forest "Like, this was made": But yeah, struggling with this, using the white sheep as the base, the image of retina burning as the mask https://media.discordapp.net/attachments/371759389889003532/1007385802893955102/mask.png https://media.discordapp.net/attachments/371759389889003532/1007385803225313372/mob.png |
20:31:38 | FromDiscord | <Forest> But i need to make the sheep coloured |
20:32:14 | FromDiscord | <Phil> In reply to @leorize "you're copying the guid,": you mean just the initial copy of `result=guid`? Or is the entire approach flawed? |
20:32:18 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=47kE |
20:33:49 | NimEventer | New thread by Dwin: Memory leak when embedding nimscript, see https://forum.nim-lang.org/t/9361 |
20:34:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47kG |
20:36:30 | FromDiscord | <leorize> the entire approach, for a builder approach, you you want to retrieve sized pieces of the streams to add into your result↵(@Phil) |
20:36:40 | FromDiscord | <leorize> lemme code one up real quick |
20:36:56 | FromDiscord | <Phil> Thank, I tried an enumerate over the string but that was even worse than my second proc |
20:37:09 | FromDiscord | <voidwalker> Oh man, you didn't have to go through all this trouble. I have a clusterfuck of the whole decode/encode code to optimize coming up : D |
20:37:22 | FromDiscord | <Phil> It is too late voidwalker |
20:37:26 | FromDiscord | <Phil> I'm in too deep now |
20:38:04 | FromDiscord | <Phil> If this piece of code isn't gonna be among the fastest lines of code you can have with provable benchmarks I shall be disappointed in myself! Or sleepy! Or Hungry! maybe all of those... I should make dinner |
20:40:11 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#ix=47kF |
20:43:44 | FromDiscord | <Phil> Hmmmm somehow I'm running into problems |
20:45:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47kK |
20:45:44 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=47kK" => "https://play.nim-lang.org/#ix=47kL" |
20:46:02 | FromDiscord | <Phil> How does it get to 50? Wha? |
20:46:03 | FromDiscord | <Elegantbeef> There's not check that `start + i < guid.len` |
20:46:46 | FromDiscord | <Phil> for do an if first? |
20:46:52 | FromDiscord | <Phil> before the result add? |
20:47:05 | FromDiscord | <domosokrat> eorize's solution wants the part length, not offsets |
20:47:59 | FromDiscord | <domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=47kO |
20:48:17 | FromDiscord | <voidwalker> What is this, 5th grade CS olympiad ? : D |
20:48:29 | FromDiscord | <Elegantbeef> 4.5th\ |
20:49:04 | FromDiscord | <voidwalker> This is what I'm trying to do: |
20:49:24 | FromDiscord | <voidwalker> https://play.nim-lang.org/#ix=47kP |
20:50:15 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=47kP" => "https://play.nim-lang.org/#ix=47kN" |
20:50:47 | FromDiscord | <Phil> In reply to @domosokrat "I removed some loops": Hmmm still breaks with `Error: unhandled exception: index 50 not in 0 .. 49 [IndexDefect]` though on line ` result.add guid[start..start+count]` |
20:50:49 | FromDiscord | <voidwalker> I know that optimally it should return a byte array, not a seq[array], but for now it appears to work on a few samples |
20:52:06 | FromDiscord | <domosokrat> @Phil\: Are you still calling it with `[20, 16, 12, 8] ` for the positions? |
20:52:31 | FromDiscord | <domosokrat> Instead of `[8, 4, 4, 4]`? |
20:52:58 | FromDiscord | <leorize> In an ideal world, this would be as fast as my solution\: `fmt"{hexstr[0..<8]}-{hexstr[8..<12]}-{hexstr[12..<16]}-{hexstr[16..<20]}-{hexstr[20..^1]}"` |
20:54:03 | FromDiscord | <Phil> In reply to @domosokrat "<@180601887916163073>\: Are you still": Aye... wait did that change? |
20:54:29 | FromDiscord | <leorize> but ofc, this is not and `[range]` allocates a copy of the slice |
20:54:48 | FromDiscord | <leorize> maybe it will be ideal in rust |
20:56:33 | FromDiscord | <domosokrat> would the view type rfc help, if it gets implemented? |
20:57:18 | FromDiscord | <leorize> maybe |
20:59:00 | FromDiscord | <Phil> Wait... demosokrat 's solution works with 8,4,4,4... i will not question, I will just code |
20:59:44 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
20:59:59 | FromDiscord | <Phil> The final score! |
21:00:00 | FromDiscord | <domosokrat> leos version does work the same |
21:00:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47kS |
21:00:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=47kU |
21:00:50 | FromDiscord | <Phil> The others I called as before |
21:01:09 | FromDiscord | <Phil> Essentially, dang leorize |
21:02:43 | FromDiscord | <Phil> @voidwalker There you go, leo's version is the fastest, thought he indices are... different from before, I think it translated from just the numbers to the differences between the numbers in inverted order to the original array of positions? |
21:02:46 | FromDiscord | <domosokrat> I would have expected less difference between leorize' and mine… |
21:03:18 | FromDiscord | <Phil> Could be I messed something up? Keep in mind I did manipulate the signature to keep it equal between all participating procs |
21:04:52 | FromDiscord | <domosokrat> ah, I think I know. My version does a copy for the slices |
21:06:29 | * | ehmry joined #nim |
21:06:56 | FromDiscord | <Phil> Anyway, now void has blazingly fast code, I am satisfied, time to make dinner |
21:21:40 | FromDiscord | <voidwalker> I will be more careful with the word "optimal" from now on : ) |
21:31:01 | FromDiscord | <Phil> Sidenote for the SO question about to be posted here:↵It's a self-answered one so I can google that damn error next time I faceplant into it |
21:31:08 | FromDiscord | <Phil> (edit) "here:↵It's" => "here by automod:↵It's" |
21:31:32 | FromDiscord | <Phil> (edit) "automod:↵It's" => "bot:↵It's" |
21:32:22 | NimEventer | New question by Philipp Doerner: `Error: request to generate code for .compileTime proc`, see https://stackoverflow.com/questions/73327072/error-request-to-generate-code-for-compiletime-proc |
21:32:50 | FromDiscord | <Elegantbeef> Cmon phil |
21:33:03 | FromDiscord | <Elegantbeef> `echo static(isObject(A))` |
21:34:09 | FromDiscord | <Phil> I know what static does in general, but why is that valid? |
21:34:19 | FromDiscord | <Elegantbeef> Why wouldnt it be |
21:34:29 | FromDiscord | <Phil> static generally just means "the following is now compiletime", at least htat's how I interpreted it |
21:34:44 | FromDiscord | <Elegantbeef> It says "Statically evaluate the statement" |
21:35:07 | FromDiscord | <Phil> Ah, so at runtime that line breaks down to `echo true` |
21:35:40 | FromDiscord | <Elegantbeef> Correct, the real question is why are you annotating the procedure to be compiletime |
21:36:44 | FromDiscord | <Phil> The original usecase, which this question doesn't have anything to do with, for the compiletime proc was my parsing of a db_sqlite `Row` (well, ndb, but that's a fork of db_sqlite so that's almost the same) into a ref object type |
21:37:01 | FromDiscord | <Elegantbeef> Ok but `isObject` is evaluated statically |
21:37:03 | FromDiscord | <Phil> In there I have a couple "when" statements where I check "is the type of the field on my ref object itself an object" |
21:37:16 | FromDiscord | <Elegantbeef> You do not need `{.compileTime.}` in most cases |
21:37:29 | FromDiscord | <Elegantbeef> That's valid |
21:37:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47l4 |
21:37:38 | FromDiscord | <Elegantbeef> And it is the same as `echo static(int.isObject)` |
21:37:41 | FromDiscord | <Phil> squint but how do I know that this is compiletime when I absolutely positively want it to be compiletime |
21:38:08 | FromDiscord | <Elegantbeef> You look at the code you're running and if it's 100% static it's the compiler will do it at compile time |
21:38:19 | FromDiscord | <Elegantbeef> Plus in Nim types only exist at compile time |
21:38:59 | FromDiscord | <Elegantbeef> Ah shit i'm wrong 😄 |
21:39:24 | FromDiscord | <Elegantbeef> `T2_ = isObjecttest50_6();` oh noes a call to return false! |
21:39:40 | FromDiscord | <Phil> But even if it doesn't do stuff, having the compiletime annotation gives me the ability to communicate that I intentionally want this thing to be compile-time and not that it's a happenstance that it's compiletime |
21:39:58 | FromDiscord | <Elegantbeef> Eh you do you |
21:40:06 | FromDiscord | <Elegantbeef> I dont see that as a benefit really |
21:40:39 | FromDiscord | <Phil> And given that I have the memory of a very wise goldfish (meaning stuff sticks around my head for 5 days instead of 5 minutes) I need to plan ahead to communicate with future me |
21:40:52 | FromDiscord | <Elegantbeef> It's surprising that Nim doesnt statically evaluate this though |
21:40:59 | FromDiscord | <Elegantbeef> given that it statically evaluates other things |
21:43:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47l5 |
21:44:04 | FromDiscord | <Elegantbeef> Compile time error |
21:44:45 | FromDiscord | <Elegantbeef> I guess the difference is the procedure could do stuff at runtime as such it needs it |
21:45:10 | FromDiscord | <Forest> Yeah can't figure out how to fix this, did a bit of tinkering for the last 30 or so minutes, and every time it's either a coloured pic of the mask, or a flat coloured pic https://hastebin.com/ubalilipeg.nim |
21:45:27 | FromDiscord | <Elegantbeef> So in the case you turned that into a `template isObject(a: typedesc): bool = a is (object or ref object)` you'd get static evaluation |
21:47:10 | FromDiscord | <Phil> That mostly just loses out to my general rule to use a proc when a proc can do it and only a template when a proc makes no sense.↵And evaluating A to B is a perfect proc usecase |
21:55:36 | * | CyberTailor quit (Remote host closed the connection) |
21:58:29 | * | CyberTailor joined #nim |
22:09:25 | * | CyberTailor quit (Remote host closed the connection) |
22:10:54 | * | CyberTailor joined #nim |
22:14:23 | FromDiscord | <MagneticSpark> I started learning nim today, and I noticed there were multiple vscode extensions available. One of them has more downloads, but it's not the one linked in the official "Nim basics tutorial". Which one is the "official"? |
22:14:59 | FromDiscord | <huantian> Then one by saem |
22:15:16 | FromDiscord | <MagneticSpark> Ok, I'll get that one then, thanks! |
22:18:13 | * | CyberTailor quit (Remote host closed the connection) |
22:19:50 | * | CyberTailor joined #nim |
22:30:15 | FromDiscord | <dom96> There is no "official" one |
22:30:56 | FromDiscord | <dom96> only different preferences among the Nim devs |
22:35:09 | FromDiscord | <Generic> the developement on the pragmatic one is basically dead though |
22:36:44 | FromDiscord | <Generic> and the other one/s are iirc mostly oriented around PMunch's lsp server |
22:37:12 | FromDiscord | <Generic> so for most people it's definitely the best choice |
22:38:24 | FromDiscord | <Generic> (full disclosure I'm was a contributor to the pragmatic one until it died and made since then several PRs to the seam one) |
22:38:49 | FromDiscord | <Generic> (edit) "I'm" => "I" | "seam" => "saem" |
22:39:44 | FromDiscord | <dom96> I don't need much to be happy: just syntax highlighting really. Everything else just gets in my way, so the pragmatic one is just fine |
22:40:11 | FromDiscord | <Generic> the saem one has even a few fixes for that |
22:40:21 | FromDiscord | <dom96> what other features do you use? |
22:40:46 | FromDiscord | <Generic> I use nimsuggest in smaller projects and linting via `nim check` |
22:41:10 | FromDiscord | <Generic> both also received fixes in the saem extension |
22:48:56 | FromDiscord | <Phil> Is there a way I can say "accept an object, but not one with inheritance"? |
22:49:03 | FromDiscord | <Phil> For a generic proc param |
22:49:21 | FromDiscord | <Rainbow Asteroids> why? |
22:50:22 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=47lh |
22:50:37 | FromDiscord | <Prestige> You don't need to set the alpha if you don't want to, either |
22:50:48 | * | rockcavera quit (Remote host closed the connection) |
22:51:10 | FromDiscord | <Phil> In reply to @Rainbow Asteroids "why?": I'm parsing `Row` into the passed object type and I can't properly guarantee field order with inheritance. |
22:51:36 | FromDiscord | <Phil> As in, I'm relying on the columns on row to be in the order of the fields on the type |
22:51:51 | FromDiscord | <Phil> Like, first field on the type is to be filled with the first column of data on the row |
22:57:21 | FromDiscord | <Forest> sent a code paste, see https://play.nim-lang.org/#ix=47li |
22:57:21 | FromDiscord | <Forest> Simpler |
22:57:23 | FromDiscord | <Forest> Thanks! |
23:01:09 | FromDiscord | <Prestige> No prob 🙂 |
23:11:15 | FromDiscord | <Prestige> I have a bit of duplicate code I'm hoping I could reduce using templates (maybe will require a macro, hoping not): https://play.nim-lang.org/#ix=47ll↵Basically, I'm doing the same exact thing as this function but with "height" instead of "width". The only thing that really needs to happen, in substituting out `child.width` for `child.height`. Is there a simple way to sub out those calls with a template or something? |
23:12:32 | FromDiscord | <Elegantbeef> Cconcept + Macro↵(@Phil) |
23:13:31 | FromDiscord | <Elegantbeef> https://github.com/beef331/oopsie/blob/master/src/oopsie.nim#L11-L33 i think works, dont recall how tested it is |
23:18:38 | FromDiscord | <Phil> In reply to @Elegantbeef "Cconcept + Macro (<@180601887916163073>)": So inherits macro and in the concept assert that type.inherits is false |
23:18:42 | FromDiscord | <Phil> Nice to know! Thanks! |
23:25:25 | FromDiscord | <Prestige> In reply to @Avahe "I have a bit": Figured out a way |
23:26:04 | FromDiscord | <Elegantbeef> You used a template and the world was better |
23:26:55 | FromDiscord | <Prestige> Yeah, was trying to the whole time, but took me a bit to figure out how |
23:27:02 | FromDiscord | <Prestige> Well, I used a template inside a proc |
23:34:04 | * | rockcavera joined #nim |
23:34:04 | * | rockcavera quit (Changing host) |
23:34:04 | * | rockcavera joined #nim |
23:35:02 | FromDiscord | <Prestige> Okay it didn't work, it just stopped showing errors. weird |
23:53:00 | FromDiscord | <leorize> beef, iirc you made an interface vtable macro thingy, right? |