00:16:04 | FromDiscord | <luteva> it is just horrible, when you try/want/need to wrap it.... |
00:20:25 | FromDiscord | <luteva> it took me days to get a simple "press this"-QButton working with the qt lib wrapped in nim. |
00:23:14 | FromDiscord | <Prestige> It's a shame it's such a pain, makes me not want to work with any c++ related libraries |
00:24:17 | FromDiscord | <Elegantbeef> Make C apis great again |
00:24:59 | FromDiscord | <Prestige> even that's not fun tbh |
00:25:07 | FromDiscord | <Prestige> unless futhark can just do it for you |
00:27:14 | FromDiscord | <Elegantbeef> It can just do it for you |
00:27:15 | FromDiscord | <Elegantbeef> I mean you have to wrap it after for idiomatic feeling |
00:27:15 | FromDiscord | <Elegantbeef> But you cant get better than https://github.com/beef331/miniaudio/blob/master/src/miniaudio.nim#L4-L18 |
00:27:15 | FromDiscord | <Elegantbeef> The entire C api jusst imported with like 10 loc |
00:27:17 | FromDiscord | <Elegantbeef> It's like Zig levels of magic |
00:29:25 | FromDiscord | <luteva> In reply to @Avahe "It's a shame it's": same for me. it is not ment to be wrapped. So throw it away. you also have this "unknown memory layout"-problem for inheritance in c++. |
00:29:57 | FromDiscord | <Elegantbeef> Yea i mean people try to shoehorn nim into existing game engines from like 20 years ago |
00:30:41 | FromDiscord | <Elegantbeef> Like it's technically possible but it's a fools errand |
00:36:15 | FromDiscord | <luteva> there are of course c++ libraries that are ment to be integrated into other languages, like xapian e.g.↵if you find a list of at leat a handful language bindings on the projects page, then chances are that it won't be too hard 🙂 |
00:39:43 | FromDiscord | <Elegantbeef> A lot of libraries do have a C-api so it makes life better |
00:40:04 | FromDiscord | <Elegantbeef> There arent many languages that can actually interop with C++ like Nim/D can so it's a understandable hell |
01:20:43 | * | sagax quit (Excess Flood) |
01:27:51 | * | sagax joined #nim |
03:50:40 | * | arkurious quit (Quit: Leaving) |
05:34:23 | * | rockcavera quit (Remote host closed the connection) |
05:36:20 | NimEventer | New thread by Jasonfi: HN post for Mastering Nim, see https://forum.nim-lang.org/t/9275 |
05:39:08 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
06:48:53 | FromDiscord | <Elegantbeef> > There's 3 languages in the same class. Julia, Nim and Crystal.↵Man hackernews makes me laugh |
06:50:47 | FromDiscord | <Prestige> Yeah, thought that was an odd statement |
06:51:01 | FromDiscord | <Prestige> I thought they were going to say nim, rust, and go. Lol |
06:51:26 | FromDiscord | <Elegantbeef> Also @Phil you've misrepresented compile time procedures, any procedure that is just nim code and doesnt rely on lowlevel operations are compile time! |
06:51:46 | FromDiscord | <Rika> can be compile time |
06:52:04 | FromDiscord | <Elegantbeef> Yea what you said |
06:53:23 | FromDiscord | <Elegantbeef> Yea prestige it's an odd statement nim and crystal are both system languages iirc so it's not a bad comparison, but julia is a super odd one |
06:54:07 | FromDiscord | <Elegantbeef> It's a weird scripting language but not but is |
06:56:09 | FromDiscord | <Rika> But not but is? |
06:56:22 | FromDiscord | <Elegantbeef> Yea you get it |
07:01:32 | FromDiscord | <Rika> Yeah I don’t |
07:02:19 | FromDiscord | <Elegantbeef> it's kinda like C# in that it's not low level but it's not super high level, it can be AOT'd but it can also be JIT'd |
07:02:51 | FromDiscord | <jmgomez> hey guys, is there a way to invoke a macro in runtime? I dont want to change the actual ast code but to emit nim code, from data that I get at runtime, into a file (via repr). I know I could save it in a intermediate format (i.e. json) and read it at compile time, but I wonder if I can save that extra step |
07:03:00 | FromDiscord | <Elegantbeef> It also uses multiple dispatch is it's fucking crazy |
07:03:18 | FromDiscord | <Elegantbeef> You could embed the NimVM and use that |
07:03:28 | FromDiscord | <Rika> I still don’t understand multiple dispatch tbh |
07:04:07 | FromDiscord | <Elegantbeef> You use runtime information of every parameter to reason which procedure to call instead of just the first parameter |
07:04:53 | FromDiscord | <Rika> It doesn’t sound too bad |
07:05:02 | FromDiscord | <Rika> Caveats are? Other than performance |
07:05:12 | FromDiscord | <Elegantbeef> So in the case of collision with two shapes `circle` and `square` you can have `collide(circle, circle)` `collide(circle, square)` `collide(square, circle)` `collide(square, square)` |
07:05:19 | FromDiscord | <Elegantbeef> It's tremendously difficult to reason what's being called |
07:05:21 | FromDiscord | <jmgomez> In reply to @Elegantbeef "You could embed the": is that referring to my question? if so, any direction on how to do it? |
07:05:35 | FromDiscord | <Elegantbeef> Nimscripter will be the easiest way |
07:05:53 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/tree/master/examples/macrorepl i have an example similar to what you're doing |
07:06:17 | FromDiscord | <jmgomez> cool, thank you! |
07:06:33 | FromDiscord | <Elegantbeef> For each new type you add you add yet another possible overload to a method call |
07:06:56 | FromDiscord | <Elegantbeef> So multipile dispatch is notorious difficult to reason about |
07:09:05 | FromDiscord | <jmgomez> talking about dispatchers, its mentioned that nim dispatcher works with ref objects, which makes sense. Any chance they do work with ptr too? |
07:09:23 | FromDiscord | <Elegantbeef> Methods or static dispatch? |
07:09:41 | FromDiscord | <jmgomez> methods |
07:09:47 | FromDiscord | <Elegantbeef> For native nim objects the type information is there so i dont see why not |
07:11:03 | FromDiscord | <jmgomez> I mean, for bound ptrs |
07:11:24 | FromDiscord | <d4rckh> what's nimscript? |
07:11:27 | FromDiscord | <Elegantbeef> You mean imported objects? |
07:11:39 | FromDiscord | <jmgomez> yes |
07:11:53 | FromDiscord | <Elegantbeef> No it will not it lacks the type information |
07:12:05 | FromDiscord | <jmgomez> no way you can provide it? |
07:12:05 | FromDiscord | <Elegantbeef> Nimscript is a subset of Nim that runs on the NimVm and is used for static evaluation and macros |
07:12:21 | FromDiscord | <Elegantbeef> No it's the first field of a type a pointer to the Nim type information |
07:12:23 | FromDiscord | <Prestige> Is it still very slow? |
07:12:36 | FromDiscord | <Elegantbeef> I dont know how slow it is |
07:12:41 | FromDiscord | <Elegantbeef> I've never really benchmarked it |
07:12:52 | FromDiscord | <Rika> Most people say it’s “at least faster than Python” |
07:13:03 | FromDiscord | <Elegantbeef> Dont know if it's true stiiill |
07:13:21 | FromDiscord | <Prestige> I heard it's slower than python by a good bit |
07:13:44 | FromDiscord | <Prestige> but I heard that like maybe 8 months ago |
07:13:55 | FromDiscord | <Elegantbeef> I dont think it's speed is really a concern |
07:14:26 | FromDiscord | <Prestige> Yeah true |
07:14:34 | FromDiscord | <Prestige> it's not like people are using python for speed anyway |
07:14:52 | FromDiscord | <Elegantbeef> I mean i'm very much of the view "use wasm if you want to script a program from your language of choice" |
07:15:07 | FromDiscord | <Elegantbeef> Nimscript is really good for quickly interoping with a program or for things like a config |
07:16:04 | FromDiscord | <Prestige> I don't really know why python is used so much other than its historical usage |
07:16:40 | FromDiscord | <Rika> Because it’s easy in both syntax and batteries included |
07:17:22 | FromDiscord | <Prestige> is it really batteries included? It seems to have a lot of libraries people could use, but I thought they're 3rd party |
07:17:41 | FromDiscord | <Prestige> I could see (compiled) nim actually being a great replacement |
07:18:01 | FromDiscord | <Rika> The standard library is sizeable so yes |
07:18:18 | FromDiscord | <Rika> I don’t see Nim as a replacement until the ecosystem expands in size xd |
07:18:26 | FromDiscord | <Elegantbeef> the downside is nim isnt hacker friendly |
07:18:55 | FromDiscord | <Prestige> What does that mean? |
07:19:21 | FromDiscord | <Elegantbeef> You can open up python code with any text editor change nothing and have it run on your system without having to get any thing on most distros |
07:19:39 | FromDiscord | <Elegantbeef> "change nothing" ah yes brain that makes sense |
07:19:42 | FromDiscord | <Prestige> ah, yeah. Systems coming with python helps |
07:19:42 | FromDiscord | <Elegantbeef> change something |
07:20:54 | FromDiscord | <Rika> Well it’s either static linking (ala Go) or VM (ala a lot of other languages out there) |
07:21:09 | * | xet7 quit (Remote host closed the connection) |
07:21:21 | FromDiscord | <Rika> And the first doesn’t even help for other operating systems |
07:21:47 | NimEventer | New post on r/nim by mids106: Book: Mastering Nim – A complete guide to the programming language, see https://reddit.com/r/nim/comments/vo2chj/book_mastering_nim_a_complete_guide_to_the/ |
07:26:12 | FromDiscord | <Prestige> the more I think about it, the more I like static linking |
07:27:17 | FromDiscord | <Elegantbeef> With modern internet and storage it's less of an issue that prior but it does have the downside of security are more annoying |
07:28:00 | FromDiscord | <Rika> I like having both options available |
07:28:08 | FromDiscord | <Rika> I don’t want to be stuck with one or the other |
07:29:26 | * | sagax quit (Excess Flood) |
07:40:58 | * | ltriant quit (Ping timeout: 240 seconds) |
07:46:40 | FromDiscord | <soundmodel> Anyone have theory as to why there are so many langs that are trying something similar to Nim, but possibly not as good? |
07:47:03 | FromDiscord | <soundmodel> (edit) "Anyone have theory as to why there are so many langs that are trying something similar to Nim, but ... possibly" added "are" |
07:47:13 | FromDiscord | <Elegantbeef> There have always been many languages, just now there are a bunch more programmers that want specific things |
07:47:15 | FromDiscord | <Rika> People are afraid of change |
07:47:16 | FromDiscord | <soundmodel> (edit) "Anyone have theory as to why there are so many langs that are trying something similar to Nim, but ... are" added "that" |
07:47:43 | FromDiscord | <Rika> Also risk and effort of changing things |
07:47:59 | FromDiscord | <Rika> Especially true in enterprise of course |
07:48:45 | FromDiscord | <soundmodel> But I mean, considering Nim makes e.g. D, Vala, Zig and V totally interesting to me |
07:49:30 | FromDiscord | <Prestige> Funny enough I found Nim on accident. Was trying to look up Zig but forgot the name, ended up finding nim instead and dove in |
07:49:56 | FromDiscord | <Elegantbeef> Comically is i think that's a common occurrence for people to confuse zig for nim |
07:49:57 | FromDiscord | <soundmodel> (edit) "interesting" => "uninteresting" |
07:50:23 | FromDiscord | <Elegantbeef> Different strokes for different folks and all that↵(@soundmodel) |
07:50:36 | FromDiscord | <Elegantbeef> There is a reason so many languages exist the developers/designers think they can do better |
07:50:42 | FromDiscord | <Prestige> I looked up a list of programming languages with 3 letters, cuz that's all I could remember |
07:50:50 | FromDiscord | <soundmodel> In reply to @Elegantbeef "Different strokes for different": It should say uninteresting |
07:51:03 | FromDiscord | <soundmodel> (edit) "uninteresting" => "uninteresting, I typoed" |
07:51:10 | FromDiscord | <Elegantbeef> I know |
07:51:35 | FromDiscord | <Elegantbeef> Oh odd the reply doesnt show the edit |
07:53:40 | FromDiscord | <soundmodel> Zig and D seemed to have more authentic C experience, but Nim's c interop seems to achieve essentially the same goals |
07:53:56 | FromDiscord | <soundmodel> (edit) "c" => "C" |
07:55:20 | FromDiscord | <locria> How to run a command when installing nim library |
07:55:38 | FromDiscord | <Elegantbeef> Well Odin and Zig are the most C-like |
07:55:40 | FromDiscord | <locria> I need to run custom build script when installing nim library with `nimble install` |
07:56:34 | FromDiscord | <soundmodel> C-likeness is not even a good goals, interfacing with C is |
07:56:51 | FromDiscord | <soundmodel> (edit) "goals," => "goal," |
07:57:07 | FromDiscord | <locria> Interfacing with C++ is hell for anyone |
07:57:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41gu |
07:57:31 | FromDiscord | <locria> In reply to @Elegantbeef "you might be able": in nimble file? |
07:57:33 | FromDiscord | <locria> (edit) "nimble" => ".nimble" |
07:57:38 | FromDiscord | <Elegantbeef> Yes |
07:57:44 | FromDiscord | <Elegantbeef> I dont know if it'll work |
07:57:44 | FromDiscord | <Elegantbeef> It might |
07:59:35 | FromDiscord | <locria> Is there `cd` in Nim? |
07:59:50 | FromDiscord | <Elegantbeef> Nim or nimble's nimscript? |
08:00:13 | FromDiscord | <locria> Nim |
08:02:27 | FromDiscord | <locria> Can I run nimscript with `nim r ...` ? |
08:07:09 | FromDiscord | <Elegantbeef> `setCurrentDir` |
08:07:28 | FromDiscord | <Elegantbeef> Do not know |
08:13:29 | FromDiscord | <S3cur3Th1sSh1t> Hi Guys,↵I'm trying to use special characters in a Nim DLL for the export function, but they are never escaped correctly. Do you have some ideas on how to escape it?↵↵`proc funcname(): BOOL {.stdcall,exportc: "^/??@".} =` |
08:14:58 | FromDiscord | <demotomohiro> At least, it should be valid C function name, isn't it? |
08:15:01 | FromDiscord | <S3cur3Th1sSh1t> sent a code paste, see https://play.nim-lang.org/#ix=41gA |
08:15:52 | FromDiscord | <S3cur3Th1sSh1t> Well I found some DLL's using function names with theese characters, so it should be possible https://media.discordapp.net/attachments/371759389889003532/991980377252044830/unknown.png |
08:16:39 | FromDiscord | <S3cur3Th1sSh1t> `?` can be escaped with `qmark` for example, but this is not done when using `exportc`. Also opened an issue about that https://github.com/nim-lang/Nim/issues/19945 |
08:17:21 | FromDiscord | <Elegantbeef> Are you attempting to escape `?`? |
08:17:42 | FromDiscord | <xflywind> write a macro to escape exported names. |
08:19:02 | FromDiscord | <demotomohiro> These function names looks like unmangled C++ function name. |
08:22:25 | FromDiscord | <apahl> Hi, is someone aware of a Nim library that can read TIFF files and allows basic pixel manipulation? |
08:24:07 | FromDiscord | <S3cur3Th1sSh1t> In reply to @demotomohiro "These function names looks": Possible. I don't know to be honest. But I'm looking for a way to export functions like those.↵ This screenshot shows, that it's done correctly without `ecportc`. So I'm assuming, that this should also be possible when using it. https://media.discordapp.net/attachments/371759389889003532/991982451989676062/unknown.png |
08:26:08 | FromDiscord | <locria> In reply to @S3cur3Th1sSh1t "Possible. I don't know": `{.extern: "namehere", exportc.}` |
08:26:22 | FromDiscord | <locria> `{.extern: "namehere", exportcpp.}` |
08:27:04 | FromDiscord | <locria> They generate C source code , so you can't use invalid C-identifier |
08:28:27 | FromDiscord | <demotomohiro> In reply to @apahl "Hi, is someone aware": https://nimble.directory/search?query=image |
08:29:31 | FromDiscord | <locria> You should ask the C linker to use another name |
08:29:56 | FromDiscord | <xflywind> In reply to @S3cur3Th1sSh1t "Possible. I don't know": Write your own escape macros. |
08:30:11 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=41gF |
08:30:33 | FromDiscord | <S3cur3Th1sSh1t> In reply to @locria "You should ask the": Some link on how to do that? |
08:30:49 | FromDiscord | <locria> don't know |
08:31:05 | FromDiscord | <demotomohiro> Nim automatically convert function name to valid c-identifier when you declare proc `^/??@"`. But `exportc: "^/??@"` asks Nim to generate C function with specified name. |
08:31:06 | FromDiscord | <apahl> In reply to @demotomohiro "https://nimble.directory/search?query=image": Yes, thank you, I did that. But AFAIK none of those projects can read TIFF files. |
08:32:08 | FromDiscord | <locria> search for how to make a C function use a different name in symbol table |
08:32:57 | FromDiscord | <demotomohiro> In reply to @apahl "Yes, thank you, I": There is a plan to add TIFF support to pixie: https://github.com/treeform/pixie/issues/429 |
08:33:44 | FromDiscord | <apahl> Oh, that is neat. I will follow the issue. Thank you. |
08:40:53 | FromDiscord | <Phil> In reply to @Elegantbeef "Also <@180601887916163073> you've misrepresented": I don't think I'm understanding this one.↵So the compiler infers at time whether he can just automatically make a proc purely compile-time without having a compile-time-pragma ? |
08:41:42 | FromDiscord | <Phil> Or is that where the "can be compiletime" comment from Rika comes in and you do need the compile-time-pragma?↵At which point I'm just confused |
08:46:28 | FromDiscord | <demotomohiro> https://wandbox.org/permlink/eXc5OpeqohBO6Q5p↵In this code, proc `foo` can be used at both runtime and compile time. |
08:51:38 | FromDiscord | <locria> Can I use pixie with OpenGL? |
09:00:42 | FromDiscord | <demotomohiro> This code uses pixie with OpenGL: https://gist.github.com/demotomohiro/6ae8baf1e40fffae3858c2ff01a8d241 |
09:02:34 | FromDiscord | <demotomohiro> It uses `glDrawPixels` just for simplicity. It is a deprecated OpenGL function. |
09:05:11 | FromDiscord | <Elegantbeef> Pixie is cpu based so yes |
09:11:53 | * | pro joined #nim |
09:23:17 | FromDiscord | <jmgomez> Any idea how to get around this? Error: VM does not support 'cast' from tyUInt64 to tyEnum |
09:23:53 | FromDiscord | <Elegantbeef> Dont cast do `uint64` or `MyEnum(myInt)` |
09:24:18 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=41gL |
09:24:33 | FromDiscord | <jmgomez> It's the or there. Any other suggestion for doing bitor over them? |
09:25:14 | FromDiscord | <Elegantbeef> I mean use Nim's sets |
09:25:30 | FromDiscord | <jmgomez> unfortunately they dont support uint64 |
09:25:40 | FromDiscord | <Elegantbeef> What? |
09:26:44 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=41gM |
09:26:49 | FromDiscord | <jmgomez> (edit) "https://play.nim-lang.org/#ix=41gM" => "https://play.nim-lang.org/#ix=41gN" |
09:27:16 | FromDiscord | <Elegantbeef> The issue isnt the uint64 the issue is the enum values |
09:27:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41gO |
09:28:45 | FromDiscord | <jmgomez> yeah, I know, but I need it to be uint64 |
09:28:46 | FromDiscord | <Elegantbeef> But eitherway you should be able to do `name(uint64(ord(a)) or uint64(ord(a)))` |
09:28:57 | FromDiscord | <jmgomez> okay! |
09:29:02 | FromDiscord | <Elegantbeef> Why does it need to be though? |
09:29:18 | FromDiscord | <jmgomez> because that's the size of their counterpart on cpp |
09:29:28 | FromDiscord | <Elegantbeef> It's fixed size so the C compiler doesnt care if you pass it to as uint64 |
09:30:23 | FromDiscord | <jmgomez> and how it will be holding the values if they are large? |
09:30:44 | FromDiscord | <Elegantbeef> The issue is if you need specific values for the enuum |
09:31:06 | FromDiscord | <Elegantbeef> If it's just 0..63 bits it's fine but if you have flags with more than 1 bit you have issues |
09:31:07 | FromDiscord | <jmgomez> yeah, I do |
09:31:57 | FromDiscord | <Elegantbeef> Ah i guess with larger sets it does need a typecast |
09:32:33 | FromDiscord | <jmgomez> In reply to @Elegantbeef "But eitherway you should": this seemed to work, thanks! |
09:35:48 | FromDiscord | <Elegantbeef> I guess you dont need to convert it into a uint64 if you're just doing a bitwise op |
09:48:50 | FromDiscord | <arnetheduck> In reply to @jmgomez "if you try to": keep in mind that nim `enum`:s are not the same as `c` enums - if you have something enum-like in C, you're likely better off with `const` in nim to represent it, using the same type as `c` (`uint64`) in your case |
09:49:29 | FromDiscord | <enthus1ast> this is what always annoys me when dealing with c apis↵(@arnetheduck) |
09:50:31 | FromDiscord | <arnetheduck> well, there's many c features that don't have an equivalent in nim, and vice versa - this is just one more, though I guess the fact that they share keyword makes it worse |
09:50:52 | FromDiscord | <jmgomez> Does that applies to C++ too? |
09:51:11 | FromDiscord | <jmgomez> I mean, dont know in c but in cpp you can specify the underlaying type |
09:52:06 | FromDiscord | <arnetheduck> it applies even more strongly to C++ 😉 |
09:53:21 | FromDiscord | <arnetheduck> it's not the underlying type that is the problem really, but rather the surrounding semantics (handling of holes, multiple values with the same ordinal, random `Defect` on the nim side crashing your application etc) |
09:54:06 | FromDiscord | <retkid> arrayfire's nim page is archived |
09:54:07 | FromDiscord | <retkid> is uh |
09:54:15 | FromDiscord | <retkid> this for any reason i should be worried about |
09:55:50 | FromDiscord | <jmgomez> ok, thanks for the heads up! Will revisit and change them to const |
10:01:13 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/992006890701733978/unknown.png |
10:01:14 | FromDiscord | <retkid> pain |
10:03:24 | FromDiscord | <enthus1ast> wait \:\: is a c++ namespace or? |
10:04:00 | FromDiscord | <enthus1ast> and youre compiling with gcc |
10:04:43 | FromDiscord | <enthus1ast> afaik it should be g++ not gcc |
10:05:00 | FromDiscord | <retkid> how do i change that I've never done c++ with nim only gcc |
10:05:06 | FromDiscord | <retkid> its a c++ lib |
10:05:11 | FromDiscord | <enthus1ast> nim cpp |
10:05:12 | FromDiscord | <retkid> so it should be g++ |
10:05:33 | FromDiscord | <retkid> https://tenor.com/view/chefs-kiss-french-chef-perfect-dish-excellent-food-perfection-gif-20341505 |
10:05:44 | FromDiscord | <retkid> i never knew you had to change to cpp if you use cpp libraries |
10:06:00 | FromDiscord | <retkid> but that makes... more than a little sense |
10:06:15 | FromDiscord | <enthus1ast> at least worth a try \:) |
10:26:46 | * | wallabra quit (Ping timeout: 272 seconds) |
10:40:11 | * | ltriant joined #nim |
10:46:26 | FromDiscord | <jmgomez> I have a macro-pragma that emits a body in a proc. In another macro, Im emitting a proc signature only with that pragma. Should that work? |
10:47:19 | FromDiscord | <jmgomez> (I mean, I can use the first one by hand) |
10:56:32 | * | pro quit (Remote host closed the connection) |
11:09:09 | FromDiscord | <rb3.nim> Hey guys, is it possible to use spawn/spawnX from std/threadpool in nimscript? I just want to build some nim dlls in parallel |
11:10:02 | FromDiscord | <Andreas> In reply to @rb3.nim "Hey guys, is it": yes, with examples : http://mirroronet.pl/pub/mirrors/video.fosdem.org/2022/D.nim/nim_concurrency.webm |
11:11:27 | FromDiscord | <rb3.nim> In reply to @Andreas "yes, with examples :": I meant from nimscript, as in a .nims file |
11:11:48 | FromDiscord | <rb3.nim> I want to make a build task that does this |
11:11:57 | FromDiscord | <Andreas> In reply to @rb3.nim "I meant from nimscript,": sry, my bad.. |
11:12:40 | FromDiscord | <demotomohiro> In reply to @rb3.nim "Hey guys, is it": If you want to run nim commands in parallel, I think you need to run multiple processes, not run multi-threads. |
11:13:44 | FromDiscord | <rb3.nim> In reply to @Andreas "sry, my bad..": No worries. Just asking in case its possible. I don't think it is |
11:14:09 | FromDiscord | <demotomohiro> I think this is what you need but I don't know if it works on nimscript: https://nim-lang.org/docs/osproc.html#execProcesses,openArray%5Bstring%5D,proc(int),proc(int,Process) |
11:14:16 | FromDiscord | <rb3.nim> In reply to @demotomohiro "If you want to": My idea was to spawn processes via `exec` from the threads so I could join them. |
11:14:28 | FromDiscord | <rb3.nim> since `exec` blocks |
11:14:44 | FromDiscord | <rb3.nim> ohhh |
11:15:13 | FromDiscord | <rb3.nim> In reply to @demotomohiro "I think this is": Nice Ill take a look at this. Thanks! |
11:19:50 | FromDiscord | <rb3.nim> Damn, it looks like it uses FFI, so it can't run in the VM |
11:21:40 | FromDiscord | <demotomohiro> Maybe you can write a nim code that calls `osproc.execProcesses` and run that code from your nimscript. |
11:22:32 | FromDiscord | <rb3.nim> Ya that was gonna be my "hack". Nimscript will build the thing that builds the other thing 😂 was hoping it was gonna be simpler |
11:22:39 | FromDiscord | <rb3.nim> Thanks! |
12:18:10 | FromDiscord | <Forest> Hm, I'm planning on implementing a JVM backend for Nim, but I'm wondering on some of the difficulties I'll encounter while doing this |
12:18:51 | FromDiscord | <Forest> I'm planning on having this generate Java source code, it may not be readable but it should compile to bytecode |
12:18:55 | FromDiscord | <Rika> The fact that a good amount of libraries depend on C interoperability? |
12:19:09 | FromDiscord | <Rika> It’s prolly better to directly do bytecode no? |
12:19:14 | FromDiscord | <Forest> A big issue I'm thinking about is generating multiple java files to classes |
12:19:57 | FromDiscord | <Forest> In reply to @Rika "It’s prolly better to": Most likely yeah, but if someone wants to make it output a certain line of java code, that should be doable imo for easier intergration, especially if writing something like a Minecraft plugin |
12:20:36 | FromDiscord | <Forest> In reply to @Rika "The fact that a": Eh, main goal is getting the syntax working, it's kinda like how the JS backend is for the web specifically |
12:20:48 | FromDiscord | <Forest> JVM backend is just so we can use Nim on the JVM |
12:22:10 | FromDiscord | <Forest> Also, if I'm able to make one backend, what's stopping me from making more 👀 |
12:22:49 | FromDiscord | <Rika> Well nothing |
12:23:02 | FromDiscord | <Rika> If you’re willing to put in the effort then there’s nothing really stopping you |
12:23:19 | FromDiscord | <Forest> Though my 'backends' would be more like building onto the compiler instead of my own fork |
12:24:07 | FromDiscord | <Forest> Since iirc it's possible to import passes.nim, right? No idea what it is for yet tho so gotta do some reading, especially if wanting to make my own backend |
12:25:47 | * | xet7 joined #nim |
12:26:19 | FromDiscord | <Forest> My main reason for doing this is because i hate Java syntax and other languages don't fill the gap imo |
12:26:23 | FromDiscord | <arnetheduck> https://github.com/oracle/graal/blob/master/docs/reference-manual/llvm/README.md - you can run `nlvm`-generated code straight on a JVM |
12:26:32 | FromDiscord | <Forest> Oh? |
12:26:45 | FromDiscord | <arnetheduck> "in theory" at least 😉 |
12:26:59 | FromDiscord | <Forest> Aah, yeah but my issue is that i want to be able to interop with Java almost seamlessly |
12:27:31 | FromDiscord | <Forest> So importing classes, hell even making Java packages in Nim, would be interesting |
12:27:43 | FromDiscord | <arnetheduck> well, there are two parts to that,: the language instructions and the runtime - the latter is probably the bigger problem in terms of work |
12:28:21 | FromDiscord | <arnetheduck> it's similar to wasm for example: it's easy to generate wasm bytecode - much more work to also support wasi |
12:28:38 | FromDiscord | <Forest> Fair |
12:28:44 | FromDiscord | <luteva> is there an "index-engine" lib in nim? I mean something that builds up an index for incremental search/filter/tagging on the input given? |
12:29:35 | * | xet7 quit (Remote host closed the connection) |
12:30:38 | * | xet7 joined #nim |
12:51:51 | FromDiscord | <voidwalker> what do you use for fast search, strings, in a few hundre MB data set ? |
12:53:52 | FromDiscord | <enthus1ast> @luteva\: i've build a toy index search |
12:54:00 | FromDiscord | <enthus1ast> just for fun |
12:54:34 | FromDiscord | <enthus1ast> https://github.com/enthus1ast/nimBooks/blob/master/bookSearch.nim |
12:54:53 | FromDiscord | <enthus1ast> but its just a toy |
12:56:16 | FromDiscord | <aph> does `std/re` have group matches? i couldn't find it, or should i use another lib? |
12:57:38 | FromDiscord | <enthus1ast> std/re needs pcre library, we also have a pure nim regex lib btw\: https://github.com/nitely/nim-regex |
12:58:53 | FromDiscord | <aph> oic, thanks |
13:00:58 | FromDiscord | <d4rckh> how could i debug a unserialization? |
13:01:07 | FromDiscord | <d4rckh> i keep getting `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` when deserializing a sequence |
13:01:17 | FromDiscord | <d4rckh> if it has 1 element it works just fine. add another one and it crashes |
13:01:52 | FromDiscord | <enthus1ast> maybe one of the elements has an uninitialized ref |
13:02:01 | FromDiscord | <enthus1ast> ref/ptr |
13:02:17 | FromDiscord | <d4rckh> i cant have refs set to null? |
13:02:39 | FromDiscord | <d4rckh> its actually a ref obejct |
13:02:41 | FromDiscord | <d4rckh> (edit) "obejct" => "object" |
13:02:51 | FromDiscord | <d4rckh> i set it to null before serializing and i restore it at unserialization |
13:04:02 | FromDiscord | <enthus1ast> i don't know, depends on the serializer i guess |
13:04:33 | FromDiscord | <enthus1ast> checking for nil is a thing |
13:05:37 | FromDiscord | <d4rckh> i think i will do like |
13:05:45 | FromDiscord | <d4rckh> a raw version of the same type |
13:06:01 | FromDiscord | <d4rckh> without any refs |
13:08:13 | FromDiscord | <enthus1ast> what serializer do you use? |
13:08:37 | FromDiscord | <d4rckh> std/marshal |
13:08:44 | FromDiscord | <michaelb.eth> I'm having a problem in a test suite setup/teardown where I want to create a dir before each test and delete that dir and all its contents after each test. It works as expected on Linux and macOS, but on Windows the OS is insisting one/more of the files in the dir is still in use and the deletion fails with an exception. I've double-checked that resources are being closed on the Nim side, so it seems like I need to somehow else convi |
13:16:37 | * | xet7 quit (Remote host closed the connection) |
13:18:20 | FromDiscord | <d4rckh> https://media.discordapp.net/attachments/371759389889003532/992056492326912050/unknown.png |
13:18:27 | FromDiscord | <d4rckh> it sometimes happens and it sometimes doesnt lol |
13:18:29 | FromDiscord | <d4rckh> its pretty annoying |
13:21:09 | FromDiscord | <Tuatarian> Why is my custom operator not working as an operator? |
13:21:47 | FromDiscord | <Tuatarian> If I wrap a func/proc in backticks it doesn't seem to work as an operator unless I'm overloading something |
13:22:00 | FromDiscord | <Tuatarian> Can you not do custom operators? |
13:22:31 | FromDiscord | <whisper> I am trying to call some winapi with winim and I get this on nim 1.7.1 with arc |
13:22:34 | FromDiscord | <whisper> expression cannot be cast to LPDWORD=ptr DWORD |
13:25:06 | * | xet7 joined #nim |
13:36:16 | FromDiscord | <enthus1ast> @whisper\: can you share some code? |
13:37:56 | FromDiscord | <enthus1ast> @d4rckh\: i had this error a few times before; i do not know exactly what happened as well, can you try different gc for fun? eg --gc\:orc↵(@d4rckh) |
13:39:04 | FromDiscord | <enthus1ast> @whisper\: a LPDWORD is a long pointer to a DWORD,↵so you should do stuff like\:someFunc(addr myDword) |
13:39:05 | FromDiscord | <d4rckh> 🤞🏽 |
13:39:12 | FromDiscord | <d4rckh> its compiling |
13:39:33 | FromDiscord | <enthus1ast> @d4rckh\: would be interesting if it crashes on another place |
13:39:37 | FromDiscord | <enthus1ast> or crashes at all |
13:39:46 | FromDiscord | <d4rckh> nope |
13:39:55 | FromDiscord | <d4rckh> https://media.discordapp.net/attachments/371759389889003532/992061928065224847/unknown.png |
13:41:06 | FromDiscord | <enthus1ast> @d4rckh\: mhh; just guessing, but do you mix release and debug somehow ? |
13:41:22 | FromDiscord | <enthus1ast> eg loading a debug dll in a release host or the other way around? |
13:41:28 | FromDiscord | <d4rckh> i have -d:debug |
13:41:58 | FromDiscord | <enthus1ast> or mixing default gc with arc/orc? |
13:42:08 | FromDiscord | <d4rckh> if i simply compile it it still crashes lol |
13:42:12 | FromDiscord | <enthus1ast> can remeber that i had issues with this once |
13:42:19 | FromDiscord | <d4rckh> no |
13:45:55 | FromDiscord | <enthus1ast> @d4rckh\: can you compile with "-d\:useSysAssert -d\:useGcAssert" and see if the error changes? |
13:46:07 | FromDiscord | <enthus1ast> https://github.com/nim-lang/Nim/issues/2507 |
13:47:46 | * | xet7 quit (Ping timeout: 268 seconds) |
13:50:35 | FromDiscord | <d4rckh> https://media.discordapp.net/attachments/371759389889003532/992064610888855572/unknown.png |
13:50:36 | FromDiscord | <d4rckh> hm |
13:55:16 | * | vicecea quit (Remote host closed the connection) |
13:55:46 | * | vicecea joined #nim |
13:57:05 | FromDiscord | <xflywind> See also https://github.com/nim-lang/Nim/issues/16496 |
13:58:44 | FromDiscord | <d4rckh> Ouch |
13:58:53 | FromDiscord | <d4rckh> Well what can I do about it? |
13:58:57 | FromDiscord | <d4rckh> Use another serializer? |
14:00:04 | FromDiscord | <xflywind> Report the issue and use something like https://github.com/status-im/nim-json-serialization |
14:00:41 | FromDiscord | <xflywind> https://github.com/status-im/nim-serialization |
14:01:05 | FromDiscord | <xflywind> (edit) "https://github.com/status-im/nim-serialization" => "https://github.com/status-im?q=serialization+&type=all&language=&sort=" |
14:01:30 | FromDiscord | <d4rckh> oh pretty cool |
14:01:33 | FromDiscord | <d4rckh> are there any docs? |
14:02:19 | FromDiscord | <xflywind> https://github.com/status-im/nim-serialization#introduction |
14:07:37 | FromDiscord | <d4rckh> `fatal error: Failed to convert to JSON an unsupported type: proc (x: Time): ZonedTime{.closure, ↵gcsafe, locks: 0.}` 🤔 |
14:07:56 | FromDiscord | <d4rckh> it lacks some types |
14:09:48 | FromDiscord | <enthus1ast> sent a long message, see http://ix.io/41hD |
14:11:03 | FromDiscord | <xflywind> concat? https://nim-lang.org/docs/sequtils.html#concat%2Cvarargs%5Bseq%5BT%5D%5D |
14:11:23 | FromDiscord | <enthus1ast> yeah for seq i know |
14:11:40 | FromDiscord | <enthus1ast> but was wondering if we have some stuff for arrays as well |
14:11:48 | * | arkurious joined #nim |
14:11:48 | * | xet7 joined #nim |
14:12:06 | FromDiscord | <xflywind> I don't there is because array is fixed size which is needed at compile time. |
14:12:13 | FromDiscord | <xflywind> (edit) "fixed size" => "fixed-size" |
14:12:21 | FromDiscord | <Rika> that doesnt matter though no? |
14:13:40 | FromDiscord | <enthus1ast> sent a long message, see http://ix.io/41hE |
14:13:42 | FromDiscord | <Rika> `proc &[ASize: static int, BSize: static int, Type](a: array[ASize, Type], b: array[BSize, Type]): array[ASize + BSize, Type]`↵should be a valid proc signature no? |
14:14:05 | FromDiscord | <enthus1ast> i could just do copyMem sure, or cast uint64 to array[8,byte] |
14:14:19 | FromDiscord | <enthus1ast> but it seems we do not have such a syntax yet |
14:15:49 | FromDiscord | <demotomohiro> !eval echo [1, 2, 3] & [4, 5, 6] |
14:16:47 | FromDiscord | <xflywind> nim playground seems to be down |
14:16:48 | FromDiscord | <enthus1ast> & is only for seq |
14:16:49 | NimBot | Compile failed: <no output> |
14:23:58 | * | xet7 quit (Remote host closed the connection) |
14:25:51 | * | averell joined #nim |
14:31:23 | FromDiscord | <demotomohiro> @enthus1ast You can overload `&` for array: https://wandbox.org/permlink/RcHmLSj66zvj9hAA |
14:31:42 | FromDiscord | <enthus1ast> \:D |
14:31:47 | FromDiscord | <enthus1ast> i'm just doing that |
14:31:55 | FromDiscord | <enthus1ast> but you where faster \:) |
14:32:47 | FromDiscord | <enthus1ast> this is very clever\: array[I + J |
14:37:21 | FromDiscord | <enthus1ast> yeah yours is better |
14:38:08 | FromDiscord | <enthus1ast> thats mine https://paste.debian.net/1245755/ |
14:47:08 | FromDiscord | <Rika> 😦 i provided the idea |
14:47:38 | FromDiscord | <enthus1ast> thank you as well Rika |
14:47:52 | FromDiscord | <enthus1ast> var result = [0x49.byte, 0xBA] & cast[array[sizeof(address), byte]](address) & [0x41, 0xff, 0xe2]this is now valid |
14:53:26 | FromDiscord | <PyryTheBurger> how do i have a proc as an argument of a proc and call that argument proc? |
14:54:14 | FromDiscord | <Rika> `..., argument: proc(argument: type, argument: type): rettype, ...` |
14:55:45 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41hQ |
14:55:48 | FromDiscord | <PyryTheBurger> how can i have varargs of any type |
14:57:04 | FromDiscord | <enthus1ast> afaik they all must be the same type |
14:57:11 | FromDiscord | <PyryTheBurger> oh damn |
14:57:15 | FromDiscord | <PyryTheBurger> sucks |
14:58:45 | FromDiscord | <enthus1ast> but you still have some options |
14:59:01 | FromDiscord | <enthus1ast> depending on what you wanna do |
15:00:27 | FromDiscord | <PyryTheBurger> how do i completely remove something from a seq |
15:01:45 | FromDiscord | <enthus1ast> sent a long message, see http://ix.io/41i1 |
15:03:54 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=41i4 |
15:04:21 | FromDiscord | <Shinyzenith> (edit) "https://play.nim-lang.org/#ix=41i4" => "https://play.nim-lang.org/#ix=41i5" |
15:05:46 | FromDiscord | <enthus1ast> this is a nim channel \:) |
15:05:55 | FromDiscord | <Shinyzenith> Yeah it's a nim question |
15:06:02 | FromDiscord | <Rika> i think they want to convert it to nim |
15:06:03 | FromDiscord | <enthus1ast> void pointer ? |
15:06:23 | FromDiscord | <Shinyzenith> In reply to @Rika "i think they want": No no I wrote it in nim, I'm just more comfortable with explaining the idea in C |
15:06:30 | FromDiscord | <Rika> idgi then |
15:06:43 | FromDiscord | <Shinyzenith> In reply to @enthus1ast "void pointer ?": won't that break the type system? |
15:06:48 | FromDiscord | <enthus1ast> sure |
15:07:12 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=41i6 |
15:07:18 | FromDiscord | <enthus1ast> yes imho it should |
15:07:28 | FromDiscord | <Rika> then i dont get the problem |
15:07:34 | FromDiscord | <Shinyzenith> I'll try that and get back to you |
15:07:43 | FromDiscord | <Rika> must be in the same file + same block |
15:07:49 | FromDiscord | <enthus1ast> yes |
15:08:26 | FromDiscord | <Shinyzenith> oh same block |
15:08:27 | FromDiscord | <Shinyzenith> I didn't do that |
15:08:54 | FromDiscord | <PyryTheBurger> how do i convert a string to int |
15:09:13 | FromDiscord | <enthus1ast> import strutils↵echo parseInt("123") |
15:09:28 | FromDiscord | <Shinyzenith> In reply to @Shinyzenith "I didn't do that": Yep it no longer complains about the types, thanks \@enthus1ast and @Rika |
15:09:36 | FromDiscord | <Shinyzenith> (edit) "\@enthus1ast" => "@\enthus1ast" |
15:10:00 | FromDiscord | <Shinyzenith> Any particular reason why defining B in another type block doesn't work? |
15:10:05 | FromDiscord | <Rika> because it doesnt |
15:10:11 | FromDiscord | <Rika> just a limitation of the compiler rn |
15:10:18 | FromDiscord | <Rika> i dont know why |
15:10:21 | FromDiscord | <Shinyzenith> Huh That's interesting |
15:10:34 | FromDiscord | <enthus1ast> maybe this gets addressed when we have incremental compilation |
15:10:38 | FromDiscord | <Shinyzenith> what if I were to split it into two files because the current one will grow a lot↵↵what would I do in that case? |
15:10:39 | FromDiscord | <enthus1ast> but idk |
15:10:47 | FromDiscord | <enthus1ast> yes thats the thing |
15:11:03 | FromDiscord | <Shinyzenith> That's messy 😔 |
15:11:27 | FromDiscord | <enthus1ast> you can do i kinda like c headers work and put the typedefs in one file |
15:11:43 | FromDiscord | <Shinyzenith> yeah I was thinking of making a types file or so |
15:11:47 | FromDiscord | <Shinyzenith> kinda like c headers |
15:16:48 | FromDiscord | <enthus1ast> @PyryTheBurger\: i can recommend https://nim-lang.org/docs/theindex.html there you can quickly search through the stdlib |
15:17:37 | FromDiscord | <PyryTheBurger> why is my varargs not working tho |
15:18:18 | FromDiscord | <Rika> ? |
15:18:56 | FromDiscord | <PyryTheBurger> bruh it saying my function is a void even tho its supposed to be a proc like what |
15:19:14 | FromDiscord | <enthus1ast> ? |
15:19:18 | FromDiscord | <!Patitotective> ? |
15:19:23 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41i8 |
15:21:01 | FromDiscord | <enthus1ast> sounds like missing return type↵(@PyryTheBurger) |
15:21:17 | FromDiscord | <enthus1ast> but the error message would help |
15:21:52 | FromDiscord | <PyryTheBurger> sent a long message, see http://ix.io/41i9 |
15:22:10 | FromDiscord | <enthus1ast> yes |
15:22:16 | FromDiscord | <enthus1ast> you call finished |
15:22:44 | FromDiscord | <enthus1ast> if you want to give the proc itself to the newTimer do not call it |
15:22:56 | FromDiscord | <PyryTheBurger> what do you mean |
15:23:11 | FromDiscord | <enthus1ast> finished($i) is a function call |
15:23:30 | FromDiscord | <enthus1ast> i guess finished($i) does not return another proc right? |
15:23:30 | FromDiscord | <PyryTheBurger> but how do i pass an argument to it |
15:23:42 | FromDiscord | <Rika> you do it in the function you pass the function into |
15:23:52 | FromDiscord | <enthus1ast> or wrap it in another proc |
15:24:05 | FromDiscord | <PyryTheBurger> what |
15:24:31 | FromDiscord | <Rika> can you give your code |
15:25:17 | FromDiscord | <PyryTheBurger> not really sorry |
15:25:25 | FromDiscord | <PyryTheBurger> ill try to fix it myself |
15:35:07 | FromDiscord | <enthus1ast> you basically wrap your procs |
15:35:08 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/2yv |
15:35:13 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41ic |
15:35:45 | FromDiscord | <PyryTheBurger> cool but i already figured out a more flexible way: just turn finished into a bool |
15:37:03 | FromDiscord | <enthus1ast> if this works for you then yes \:) |
15:44:46 | FromDiscord | <federico3> at $149 it's a good deal!↵(@Prestige) |
16:12:43 | * | Goodbye_Vincent quit (Quit: Ping timeout (120 seconds)) |
16:13:13 | * | Goodbye_Vincent joined #nim |
16:15:24 | * | Goodbye_Vincent quit (Client Quit) |
16:16:20 | * | Goodbye_Vincent joined #nim |
16:28:49 | * | Goodbye_Vincent quit (Quit: Ping timeout (120 seconds)) |
16:30:28 | * | Goodbye_Vincent joined #nim |
16:38:23 | FromDiscord | <Zeantar> sent a code paste, see https://play.nim-lang.org/#ix=41ip |
16:39:33 | FromDiscord | <!Patitotective> can you show your `[]` call |
16:42:12 | FromDiscord | <!Patitotective> In reply to @Zeantar "Hello. I'm new to": are you sure you are importing `std/tables` in the module you're accessing the table? |
16:43:48 | FromDiscord | <Zeantar> I didn't do it. Thank you. I got it now. |
16:57:14 | * | Amun-Ra quit (Quit: Gdyby mi się chciało tak jak mi się nie chce...) |
16:59:41 | * | Amun-Ra joined #nim |
17:22:13 | FromDiscord | <Prestige> federico3: I'm actually looking to get the pinephone pro, it's a bit more pricey but I think I'll do it. I'll try to just write apps for anything I need |
17:59:35 | FromDiscord | <d4rckh> any std/marshal alternatives that can convert most types of the std libraries? |
17:59:41 | FromDiscord | <d4rckh> (edit) "alternatives" => "alternative" |
17:59:58 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
18:03:09 | FromDiscord | <d4rckh> i think i will just write my own 'serializers' |
18:03:40 | * | Lord_Nightmare joined #nim |
18:06:01 | FromDiscord | <d4rckh> is it possible to convert a DateTime to a timestamp that i can later convert it back to a DateTime object? |
18:09:52 | FromDiscord | <!Patitotective> In reply to @d4rckh "is it possible to": https://nim-lang.org/docs/times.html#fromUnix%2Cint64↵https://nim-lang.org/docs/times.html#toUnix%2CTime↵(?) |
18:10:17 | FromDiscord | <d4rckh> i was looking at the same thing but that takes a Time 🤔 |
18:10:53 | FromDiscord | <!Patitotective> https://nim-lang.org/docs/times.html#toTime%2CDateTime (?) |
18:11:16 | Amun-Ra | d4rckh: dt.toTime.toUnix |
18:11:18 | FromDiscord | <d4rckh> yeah i found that too just now |
18:11:27 | FromDiscord | <d4rckh> i thought theres a better way haha |
18:11:34 | FromDiscord | <d4rckh> i dont really like chaining functions like that |
18:12:12 | FromDiscord | <d4rckh> can you convert it back to a DateTime? |
18:12:22 | FromDiscord | <d4rckh> (edit) "it" => "the Time" |
18:12:27 | Amun-Ra | if you look at Time.toUnix there's not much to it |
18:12:42 | Amun-Ra | Time is just a distinct int64 |
18:13:00 | Amun-Ra | toUnix is jut a cast |
18:17:33 | * | krux02 joined #nim |
18:29:51 | FromDiscord | <voidwalker> can't find example, what is the syntax for adding a new item to a sequence of objects, by specifying the literal values? |
18:30:44 | FromDiscord | <voidwalker> ` movies.add(id:33,ptitle:"a",otitle:"b",year:1,runtime:1,rating:1)` |
18:31:04 | FromDiscord | <voidwalker> this doesn't work, it needs a `proc add[T](x: var seq[T]; y: openArray[T])` |
18:31:30 | FromDiscord | <enthus1ast> you need to create the object |
18:31:54 | FromDiscord | <d4rckh> if i assigned strings to my enum values can i easily convert a string to an enum value? |
18:32:31 | FromDiscord | <voidwalker> doesn't add create it ? |
18:32:51 | FromDiscord | <enthus1ast> eg\:↵movies.add Movie(id\: 33) |
18:33:27 | FromDiscord | <enthus1ast> no, the seq add justs adds an object to a seq↵(@voidwalker) |
18:34:05 | FromDiscord | <voidwalker> movies.add Movie(id: 33) - what is this ? |
18:34:40 | FromDiscord | <enthus1ast> Movie(id\: 33, ptitle\: "a", etc..) |
18:35:20 | FromDiscord | <enthus1ast> yes, use parseEnum from strutils↵(@d4rckh) |
18:36:00 | FromDiscord | <voidwalker> @enthus1ast ok, so that is an object.. you mean I can add it to the sequence if i put movie( ) before its members? |
18:36:21 | FromDiscord | <enthus1ast> when your object is called Movie then yes |
18:36:53 | FromDiscord | <voidwalker> object type is called movie, yes. and movies is seq[movie] |
18:37:16 | FromDiscord | <voidwalker> and i do not have a variable declared to store a single movie instance |
18:37:43 | FromDiscord | <enthus1ast> you don't need to, you can create one and directly add it to the seq |
18:38:14 | FromDiscord | <voidwalker> movies.add(movie(id:33,ptitle:"a",otitle:"b",year:1,runtime:1,rating:1)) |
18:38:15 | FromDiscord | <voidwalker> this works |
18:38:42 | FromDiscord | <enthus1ast> i would recommend that you name your object types with a captical first letter |
18:38:43 | FromDiscord | <enthus1ast> like Movie |
18:41:07 | FromDiscord | <enthus1ast> this is more or less a convention, also also has the benefit that you still can use movie as a variable |
18:42:02 | FromDiscord | <voidwalker> yep, i stopped learning nim for almost a month, and now I forgot most of what I learned :\ |
18:42:36 | FromDiscord | <enthus1ast> keep on going, its worth learning \:) |
18:42:36 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=41iU |
18:42:56 | FromDiscord | <voidwalker> how do i force it to return uint32 ? |
18:43:00 | FromDiscord | <voidwalker> I also knew this but forgot :\ |
18:43:30 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41iW |
19:05:09 | FromDiscord | <voidwalker> yep, that works. Thanks. Now I got a case where there's no valid int to be parsed, but a "\N". Is there no way to get a 0 returned on parseUInt error instead of an exception ? |
19:06:12 | FromDiscord | <voidwalker> also, is this doc out of date, cause I only see parseint taking a var where to store the result of conversion, and the return value is number of processed chars |
19:06:15 | FromDiscord | <voidwalker> https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint |
19:26:50 | FromDiscord | <PyryTheBurger> if i have some object, which has a int variable that grows all the time, when it gets to a certain number how do i completely remove that object from memory? |
19:50:06 | FromDiscord | <soundmodel> Any input as to how much benefit does Nim with C interop offer compared to just C |
19:50:36 | FromDiscord | <soundmodel> I'm interested in doing some Requested Libraries, but I'm confused as to whether the effort towards the bindings is worth it compared to just writing C |
19:54:59 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=41jc |
19:55:35 | * | jmdaemon joined #nim |
19:55:49 | FromDiscord | <voidwalker> ohh it seems that's what I was using already |
19:55:55 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=41jc" => "https://play.nim-lang.org/#ix=41jd" |
19:56:09 | FromDiscord | <voidwalker> didn't notice it's a different unit |
19:56:20 | FromDiscord | <huantian> also, unless you really need that extra bit or you need uint for compatibility, I'd use a range instead |
19:56:26 | FromDiscord | <voidwalker> any idea how to build code for release instead of debug, in vscodium ? |
19:56:38 | FromDiscord | <huantian> are you using a buidl task? |
19:56:44 | FromDiscord | <voidwalker> i am using f6 |
19:57:03 | FromDiscord | <Forest> How would i make a backend without modifying the Nim source? |
19:57:32 | FromDiscord | <huantian> if you wanna build for release, you either wanna make a build task that uses `-d:release`, or just run the command yourself: `nim c -d:release file.nim`, or if you're using nimble `nimble build -d:release` |
19:57:39 | * | wallabra joined #nim |
19:57:57 | FromDiscord | <Forest> Is it possible to make it so when the outputted binary is ran, it'll call the options like how it's done in the built-in backends? |
19:58:54 | FromDiscord | <voidwalker> where do i make that build task to use -d:release? |
19:59:09 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=41jf |
19:59:18 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=41jf" => "https://play.nim-lang.org/#ix=41jg" |
20:00:13 | FromDiscord | <voidwalker> what's wrong with using uint though ? |
20:00:24 | FromDiscord | <voidwalker> no, I do not really need that extra bit |
20:00:53 | FromDiscord | <voidwalker> but there's a lot of data and i wanted to use the smallest types to accomodate it |
20:01:51 | FromDiscord | <huantian> In reply to @voidwalker "where do i make": check out <https://code.visualstudio.com/docs/editor/tasks>↵you wanna make a file at `.vscode/tasks.json` that runs a command, with `"group": "build"`↵then Ctrl + Shift + B to run it |
20:03:36 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=41jj |
20:04:01 | FromDiscord | <huantian> this is mine for example https://media.discordapp.net/attachments/371759389889003532/992158587478622298/tasks.json |
20:04:53 | FromDiscord | <voidwalker> @huantian found 'Nim: Build Command' in nim extension settings in vscodium |
20:04:58 | FromDiscord | <voidwalker> that will work |
20:05:14 | FromDiscord | <huantian> In reply to @voidwalker "what's wrong with using": they talk about it here ↵https://nim-lang.org/docs/tut1.html#advanced-types-subranges |
20:08:03 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:08:14 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix= |
20:08:24 | FromDiscord | <voidwalker> wraps around ? |
20:13:59 | * | wallabra joined #nim |
20:14:51 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=41jl |
20:18:18 | FromDiscord | <voidwalker> oh, you mean they get back to 0 after reaching their maxint.. that's expected, no ? |
20:19:00 | FromDiscord | <Andreas> yes, uint8 goes from 9 to 255 and then wraps to 0 and goes on |
20:19:07 | FromDiscord | <Andreas> (edit) "9" => "0" |
20:20:48 | FromDiscord | <voidwalker> I don't see a problem with that, if you know your data cannot cause it to go over |
20:20:54 | FromDiscord | <Andreas> (edit) "on" => "on.↵seems, many don't expect this and AFAIK this is the reason for int-type is the index-type to use in Nim. Which is a 'defensive' decision, but as obviously many ppl got this wrong, it is like so.." |
20:24:39 | FromDiscord | <Professor Actual Factual> sent a long message, see http://ix.io/41jo |
20:25:08 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=41jp |
20:32:42 | FromDiscord | <voidwalker> well. i tried recompiling with uint( uint64) instead of uint8 and uint16, and +200MB RAM, and a few percent slower runtime ? |
20:36:49 | FromDiscord | <voidwalker> the RAM usage makes sense, since it's a 1.5GB tsv I'm loading into memory, but the slightly faster execution ? |
20:41:01 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=41js |
20:41:07 | FromDiscord | <voidwalker> no, just release, and --opt:speed |
20:41:44 | * | rockcavera joined #nim |
20:41:44 | * | rockcavera quit (Changing host) |
20:41:44 | * | rockcavera joined #nim |
20:42:02 | FromDiscord | <voidwalker> oh wow real improvement, from 9 sec to 8sec |
20:42:10 | FromDiscord | <Forest> In reply to @Forest "Is it possible to": :p |
20:42:29 | FromDiscord | <Forest> Don't really understand how I'd do this part, or if I'd need to write that part myself completely |
20:52:41 | FromDiscord | <soundmodel> In reply to @Professor Actual Factual "Depends on the library": Thank you. But shouldn't this also motivate some guidelines for understand "good C practices for Nim interop"? So that one could gauge beforehand, how feasible a binding will be? |
20:59:45 | FromDiscord | <soundmodel> In reply to @soundmodel "Thank you. But shouldn't": I'm thinking of doing this in Nim: https://github.com/mbrucher/PyVST/tree/master/pyvst |
21:00:04 | FromDiscord | <soundmodel> So now I'd wonder e.g. that if it maps to Python, then will it also map to Nim? |
21:03:33 | FromDiscord | <Professor Actual Factual> In reply to @soundmodel "Thank you. But shouldn't": Please note im not a C expert.↵↵Its true that documentation is somewhat lacking here. The only real C guidelines I can give you are. 1 Dont use macros/preprocessor, 2 keep external dependencies to a minimum, 3 ideally the C final API should a single header/C file, 4 try to stick to default builders like Make. |
21:04:39 | FromDiscord | <Professor Actual Factual> (edit) "Make." => "Make (this is nimterop specific or for generating a dynlib)." |
21:04:49 | FromDiscord | <soundmodel> a lot of well-used libraries aren't single-header libs |
21:05:18 | FromDiscord | <soundmodel> but this shouldn't cause a problem, if they're able to create JNI bindings and whatever, right? |
21:07:25 | FromDiscord | <Professor Actual Factual> sent a long message, see http://ix.io/41jx |
21:08:04 | FromDiscord | <Professor Actual Factual> Single header files are useful IMO because they are easier to bind to using the available interop tools. They are in no way a requirement. |
21:08:31 | FromDiscord | <Professor Actual Factual> (edit) "http://ix.io/41jx" => "http://ix.io/41jy" |
21:09:29 | FromDiscord | <soundmodel> I wonder if one can use 2. if the lib itself builds a lib |
21:09:36 | FromDiscord | <soundmodel> like VST does |
21:11:28 | FromDiscord | <Professor Actual Factual> sent a long message, see http://ix.io/41jz |
21:12:35 | FromDiscord | <Professor Actual Factual> C2nim does just that translates C files or h files to nim.↵Nimterop does all that, has more features, and allows you to script to install the dynlib. Think of it like the setup.py equivalent for nim. |
21:13:17 | FromDiscord | <soundmodel> it builds a .dll from the C code |
21:13:26 | FromDiscord | <soundmodel> so I wonder what it means for a binding language |
21:15:13 | FromDiscord | <voidwalker> If I do ` for movie in movies:`, where movie is an object, and movies is a seq[movie], how do I get the id of the current item iterated ? |
21:15:39 | FromDiscord | <voidwalker> or do I have to count it manually |
21:18:07 | FromDiscord | <soundmodel> In reply to @Professor Actual Factual "If thats the case": No I meant that the code builds a .dll from the code (creates a VST plug-in) |
21:18:35 | FromDiscord | <soundmodel> (edit) "plug-in)" => "plug-in), so essentially what has been written in the Nim bindings must go into that .dll" |
21:18:48 | FromDiscord | <soundmodel> (edit) "in" => "using" |
21:19:14 | FromDiscord | <huantian> In reply to @voidwalker "or do I have": check out https://nim-lang.org/docs/enumerate.html |
21:19:40 | FromDiscord | <Elegantbeef> You can also just do `for i, movie in movies` |
21:20:06 | FromDiscord | <soundmodel> In reply to @soundmodel "No I meant that": and I'm confused now between whether the bindings will first translate to C and then build normally or whether one needs to use the Nim compiler to "produce a .dll" |
21:20:56 | FromDiscord | <Elegantbeef> Nim always compiles to another language |
21:21:10 | FromDiscord | <soundmodel> I don't even understand how PyVST builds the .dll |
21:21:15 | FromDiscord | <Elegantbeef> I guess unless you talk about the nimvm where it's interpreted |
21:21:27 | FromDiscord | <Professor Actual Factual> In reply to @soundmodel "and I'm confused now": Im getting a bit confused here. Just to check we're on the same page. I'm assuming you are talking about going from C to Nim (and not the other away around) |
21:21:43 | FromDiscord | <soundmodel> In reply to @Professor Actual Factual "Im getting a bit": yes |
21:24:42 | FromDiscord | <Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=41jB |
21:28:54 | FromDiscord | <Professor Actual Factual> You can always follow this tutorial to learn: https://gist.github.com/zacharycarter/846869eb3423e20af04dea226b65c18f↵Albeit its not the best tutorial |
21:31:19 | FromDiscord | <ezquerra> @Impostor, I found a “missing character” in my copy of your book, page 51 https://media.discordapp.net/attachments/371759389889003532/992180556823543808/IMG_1315.jpg |
21:32:34 | FromDiscord | <ezquerra> That was meant for Araq |
21:32:57 | FromDiscord | <ezquerra> (edit) "@Impostor," => "@Araq ," |
21:33:33 | FromDiscord | <Elegantbeef> Just ping everyone that starts with A you're bound to get him |
21:39:46 | FromDiscord | <voidwalker> ask for refund |
21:40:38 | FromDiscord | <voidwalker> I wish he'd made an ebook :\ I mean I'd buy the physical book but it's $70 in europe with shipping for me :\ |
21:45:54 | FromDiscord | <Professor Actual Factual> In reply to @voidwalker "I wish he'd made": Im canada based and got free shipping. Whats up with that |
21:46:08 | FromDiscord | <voidwalker> in Europe it's 62 EUR + shipping |
21:47:47 | FromDiscord | <Professor Actual Factual> In reply to @voidwalker "in Europe it's 62": 80 CAD + free shipping |
21:48:23 | FromDiscord | <Elegantbeef> Where did it ship from domestic or US? |
21:51:36 | FromDiscord | <Professor Actual Factual> In reply to @Elegantbeef "Where did it ship": Bolton Ontario Canada. Low volume book sales are usually made on demand, therefore can be made locally. Hence the high price |
21:58:54 | FromDiscord | <soundmodel> In reply to @Professor Actual Factual "Ok I can give": Ehh, but how does it produce the api.dll? |
21:59:15 | FromDiscord | <Elegantbeef> It doesnt you compile libraries seperate to code that relies on them |
21:59:45 | FromDiscord | <soundmodel> but VSTs are shipped only by giving the user a .dll |
21:59:56 | FromDiscord | <soundmodel> so I don't understand how it can work if one's now required to give api.nim as well |
21:59:58 | FromDiscord | <Elegantbeef> Oh you're talking about generating a dll for a program |
22:00:02 | FromDiscord | <soundmodel> yes |
22:00:08 | FromDiscord | <soundmodel> DAW programs load a .dll |
22:00:11 | FromDiscord | <Elegantbeef> You export the required code then build with `--app:lib` |
22:00:51 | FromDiscord | <Elegantbeef> programs that load dlls look for specific procedure names that take specific arguments |
22:01:16 | FromDiscord | <Elegantbeef> You export your Nim procedures that match what it's looking for and it will just work |
22:06:41 | FromDiscord | <whisper> In reply to @enthus1ast "<@740841107117834330>\: a LPDWORD is": let buffer = newMString(256)↵ let pBuffer = cast[LPSTR](&buffer)↵ GetUserNameA(pBuffer, cast[LPDWORD](buffer))↵ result = cast[string](buffer) |
22:07:20 | FromDiscord | <soundmodel> In reply to @Elegantbeef "You export the required": What does "You export the required code" mean? |
22:07:46 | FromDiscord | <Elegantbeef> You give Nim `exportC` pragmas and a desired unmangled name for the procedure |
22:24:30 | * | oprypin quit (Quit: Bye) |
22:24:40 | * | oprypin joined #nim |
22:41:36 | * | syl_ quit (Quit: ZNC 1.8.2 - https://znc.in) |
22:42:22 | * | syl joined #nim |
22:53:34 | FromDiscord | <retkid> soooooooooooo |
22:53:45 | FromDiscord | <retkid> does anyone have a source for these common gpu functions |
22:53:51 | FromDiscord | <retkid> so i can learn all of them |
22:54:02 | FromDiscord | <Elegantbeef> "common gpu functions" |
22:54:15 | FromDiscord | <retkid> im writing the ones I SEE |
22:54:16 | FromDiscord | <retkid> aaa |
22:54:22 | FromDiscord | <retkid> well more array manipulation functions |
22:54:30 | FromDiscord | <Elegantbeef> What? |
22:55:13 | FromDiscord | <retkid> afa() msum() sum_as_int() |
22:55:42 | FromDiscord | <retkid> i wish i had a word for situations like this |
22:56:09 | FromDiscord | <Elegantbeef> Well i've never seen those operations in my life so... yea |
22:56:41 | FromDiscord | <retkid> ¯\_(ツ)_/¯ |
22:56:42 | FromDiscord | <retkid> ok then |
22:56:57 | FromDiscord | <retkid> well it would be cool if this library had docs |
22:57:06 | FromDiscord | <Elegantbeef> What library? |
22:58:56 | * | wallabra_ joined #nim |
23:00:18 | * | wallabra quit (Ping timeout: 268 seconds) |
23:00:18 | * | wallabra_ is now known as wallabra |
23:15:19 | FromDiscord | <retkid> if i didn't like the name of a libraries proc is there anyway to change it? |
23:15:37 | FromDiscord | <Elegantbeef> Fork it and rename them |
23:15:41 | FromDiscord | <Elegantbeef> use `patchFile` |
23:15:52 | FromDiscord | <Elegantbeef> Make a file that imports it and exports aliased procedures |
23:20:41 | FromDiscord | <retkid> In reply to @Elegantbeef "Fork it and rename": i dont wanna be useful for this community |
23:22:00 | FromDiscord | <Elegantbeef> recuses himself from further conversation |