00:21:09 | FromDiscord | <Alea> take a perf hit for including the var in the loop? |
00:21:10 | FromDiscord | <Alea> sent a code paste, see https://play.nim-lang.org/#ix=3VFc |
00:21:20 | FromDiscord | <Elegantbeef> Nope |
00:23:47 | FromDiscord | <Elegantbeef> Procedures grow the stack when they're called for all their parameters |
00:24:45 | FromDiscord | <Alea> Also, why do int64 and int literal have to be a type mismatch ↵seems so unnecessary https://media.discordapp.net/attachments/371759389889003532/966494664335179776/unknown.png |
00:25:19 | FromDiscord | <Elegantbeef> you want `div` |
00:26:13 | FromDiscord | <Elegantbeef> I could be wrong though i guess |
00:26:57 | FromDiscord | <Elegantbeef> The reason it's ambiguous though is cause it's a specified `int64` and there are `float` overloads |
00:27:13 | FromDiscord | <Elegantbeef> It cannot be reasoned which is the most accurate |
00:27:17 | FromDiscord | <Elegantbeef> It's a weird dispatch thing in nim but it's not like `i64` is the end of the world |
00:27:47 | FromDiscord | <huantian> I don't think it works with two int64s either? |
00:27:55 | FromDiscord | <Elegantbeef> Yea there is one defined |
00:28:19 | FromDiscord | <Elegantbeef> !eval echo 10i64 / 3i64 |
00:28:21 | NimBot | Compile failed: /usercode/in.nim(1, 12) Error: type mismatch: got <int64, int64> |
00:28:42 | FromDiscord | <Elegantbeef> Oh sorry it's `int / int` |
00:28:44 | FromDiscord | <Elegantbeef> Lol |
00:28:52 | FromDiscord | <huantian> silly beef |
00:29:11 | FromDiscord | <Elegantbeef> it's purely for things like `2 / 3` |
00:34:33 | FromDiscord | <Elegantbeef> Fuck i've hit a really werid closure bug |
00:37:29 | FromDiscord | <Elegantbeef> It might just be a bug i made |
00:39:31 | FromDiscord | <Elegantbeef> Yep it's just a me bug, nice! |
00:45:32 | FromDiscord | <Elegantbeef> How the hell is sequtils faster than a closure iterator |
00:46:32 | FromDiscord | <huantian> dang i guess iterators were a bad idea |
00:46:39 | FromDiscord | <huantian> lazy evaluation is dead |
00:47:00 | FromDiscord | <Elegantbeef> The worst part is i'm doing everything possible to increase performance |
00:48:24 | FromDiscord | <huantian> what exactly causes the slwodown? |
00:49:14 | FromDiscord | <Elegantbeef> I'm, thinking with nested closures it's copying the data |
00:49:24 | FromDiscord | <Elegantbeef> instead of moving it |
00:49:38 | FromDiscord | <Elegantbeef> That's like the only reason i can think that it's twice as slow as an inline iterator |
00:49:58 | FromDiscord | <Elegantbeef> I have to test something now to see that hypothesis |
00:50:05 | FromDiscord | <huantian> can you just slap a sink somewhere that's what I've gotten from the like one talk I watched on affine types |
00:50:48 | FromDiscord | <Elegantbeef> Perhaps |
00:55:21 | FromDiscord | <ajusa> are you still counting words? |
00:55:34 | FromDiscord | <Elegantbeef> Nope |
00:55:39 | FromDiscord | <Elegantbeef> I won that in 3 seconds and carried on |
00:55:58 | FromDiscord | <ajusa> what are you optimizing then? |
00:56:07 | FromDiscord | <Elegantbeef> Closure iterators |
00:56:21 | FromDiscord | <ajusa> also V is faster than Nim according to techempower benchmarks |
00:56:35 | FromDiscord | <Elegantbeef> Cool i can also do dumb shit in V |
00:57:03 | FromDiscord | <ajusa> (granted the v implementation is just wrapping two C libraries from another framework in the top 20) |
00:57:37 | FromDiscord | <Elegantbeef> Basically i'm writting closure functionality and as such want to get closest to pure inline as i can |
00:57:48 | FromDiscord | <ajusa> ah okay |
00:57:49 | FromDiscord | <Elegantbeef> Right now i'm \~2x slower but much faster than otherwise possible |
01:00:09 | FromDiscord | <Elegantbeef> Perhaps it's the pointer procs that's the issue |
01:00:30 | FromDiscord | <Elegantbeef> Or maybe not, just took 1ms off by making the iterator functions take a `sink` and moved manually |
01:00:40 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/966503706814193674/image.png |
01:00:43 | FromDiscord | <Elegantbeef> Yes this is ideal iterator code |
01:02:15 | FromDiscord | <huantian> how much is 1ms out of the total time? |
01:02:33 | FromDiscord | <Elegantbeef> It's around 12ms presently |
01:05:19 | FromDiscord | <Elegantbeef> And you cannot return a `var iterator` |
01:05:21 | FromDiscord | <Elegantbeef> So fuck yea! |
01:08:59 | FromDiscord | <Elegantbeef> https://github.com/beef331/slicerator/blob/master/benchmarks/closures.nim#L37-L82 this is the highly sophisticated benchmark if curious |
01:14:47 | * | neurocyte8614492 quit (Ping timeout: 240 seconds) |
01:21:42 | FromDiscord | <Elegantbeef> Seems clang really hates moving closures |
01:22:01 | FromDiscord | <huantian> nice the ix fix seems to work I won't have to copy my code before I share to ix now |
01:22:41 | FromDiscord | <Elegantbeef> You know you could just hit ctrl + z? |
01:22:48 | FromDiscord | <huantian> wait that works? |
01:22:55 | FromDiscord | <Elegantbeef> Yes that does |
01:23:07 | FromDiscord | <Elegantbeef> And it worked properly with the bad upload |
01:31:55 | FromDiscord | <ajusa> I can't figure out how to benchmark httpbeast using hottie - if I kill the program, hottie never outputs |
01:32:06 | FromDiscord | <ajusa> and httpbeast doesn't have a way to kill itself |
01:32:13 | FromDiscord | <Elegantbeef> You need to terminate the program internally |
01:32:26 | FromDiscord | <Elegantbeef> make a request that calls a `quit(1)` |
01:32:54 | FromDiscord | <ajusa> that doesn't work, httpbeast just keeps on running I believe |
01:33:14 | FromDiscord | <Elegantbeef> What the fuck |
01:33:46 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3VFp |
01:34:05 | FromDiscord | <ajusa> https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L553 |
01:34:54 | FromDiscord | <Elegantbeef> I dont know what to say, try callgrind instead |
01:36:22 | * | xet7 quit (Remote host closed the connection) |
01:37:10 | FromDiscord | <ajusa> ok |
01:37:33 | * | xet7 joined #nim |
01:40:37 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
01:45:56 | * | vicfred quit (Quit: Leaving) |
01:52:39 | FromDiscord | <ajusa> that worked fine, though it didn't really help me find places to optimize |
01:53:02 | FromDiscord | <ajusa> majority of the time is spent in syscalls and allocation seems like |
01:53:14 | FromDiscord | <Elegantbeef> Well there you go |
01:53:22 | FromDiscord | <Elegantbeef> Remove allocations 😛 |
01:53:50 | FromDiscord | <ajusa> "an extra alloc is death" |
01:54:00 | FromDiscord | <ajusa> - disruptek |
01:55:24 | FromDiscord | <Elegantbeef> If it uses string slice replace with `toOpenArray` if possible |
01:55:50 | FromDiscord | <Elegantbeef> Also did you run the profiler on release with arc? |
02:12:25 | FromDiscord | <ajusa> I did not, I probably should do that |
02:23:31 | FromDiscord | <ajusa> apparently https://github.com/dom96/httpbeast/blob/5202b4c67ad2ed86346e2c35ae168f6f7af30e57/src/httpbeast.nim#L252-L253 is fairly expensive |
02:26:15 | FromDiscord | <leorize> have you profiled the thing? |
02:29:16 | FromDiscord | <Elegantbeef> That's quite an elaborate `.add` |
02:30:08 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/strbasics.html#add%2Cstring%2CopenArray%5Bchar%5D replace with this and it's less ugly atleast |
02:31:14 | FromDiscord | <ajusa> yes leorize, looking at it in kcachegrind now |
02:31:21 | FromDiscord | <ajusa> though I'm not that experienced with this tool |
02:31:30 | FromDiscord | <leorize> I'd recommend `perf` |
02:32:50 | FromDiscord | <leorize> cachegrind (if you turn all the tracing on), is simply too slow to meaningfully capture contested location accurately |
02:33:59 | FromDiscord | <ajusa> well I'll try it, haven't used perf in a few years |
02:34:05 | FromDiscord | <leorize> for example, if a certain processing is insanely fast when not traced and your wait mostly ended up on the scheduler, then cachegrind might mask that away by delaying the processing just enough that the wait on scheduler become negliable |
02:35:09 | FromDiscord | <leorize> https://profiler.firefox.com/docs/#/./guide-perf-profiling |
02:36:49 | FromDiscord | <leorize> when dealing with Nim apps, I recommend passing `--call-graph dwarf` (assuming `--debugger:native` is set during compilation) to get a meaningful graph |
02:38:25 | FromDiscord | <ajusa> should I be able to use the firefox profiler? I get some sort of json parsing error when trying to upload the file |
02:39:23 | FromDiscord | <ajusa> also wow with that call graph option I went from 1mb of data to 200mb |
02:39:52 | FromDiscord | <ajusa> but there appears to be a lot more detail in the report |
02:39:52 | FromDiscord | <leorize> don't forget the conversion step \:P |
02:40:16 | FromDiscord | <leorize> and yes, the firefox profiler should be usable to visualize the data |
02:40:16 | FromDiscord | <ajusa> I did run that step, the file size went up so I assumed it worked |
02:41:39 | FromDiscord | <ajusa> yeah, the output is plain text but for some reason the firefox profiler expects json? not sure if I'm messing this up somehow |
02:43:26 | FromDiscord | <ajusa> huh now it works for some reason |
02:45:28 | * | arkurious quit (Quit: Leaving) |
02:50:01 | FromDiscord | <ajusa> this just tells me which functions are called the most though, which is hard to trace back to the most expensive calls |
02:50:08 | FromDiscord | <ajusa> (edit) "calls" => "lines" |
02:53:25 | FromDiscord | <leorize> it will help you figure out where to focus on in your cachegrind data, though |
03:10:00 | FromDiscord | <ajusa> wow there's a lot of stuff that seems to be popping out other than just moving memory around. looks like there's some overhead to parsing the http method into an option rather than an enum as well |
03:12:06 | FromDiscord | <grubarb> Hello, is there a good way to convert a string to seq[byte]? |
03:13:24 | FromDiscord | <Elegantbeef> you can `cast[seq[byte]](myString)` or do `toOpenArrayByte` |
03:14:38 | FromDiscord | <grubarb> Thanks 👍 |
03:50:06 | * | wyrd quit (Quit: leaving) |
04:15:45 | * | slowButPresent quit (Quit: leaving) |
04:19:57 | * | vicecea quit (Remote host closed the connection) |
04:20:26 | * | vicecea joined #nim |
04:49:08 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/19736 this is funny |
04:49:51 | FromDiscord | <Yardanico> due to nim not rejecting when it should C compilers also compile this code (they do emit a warning, but nim disables most C warnings) |
04:49:53 | FromDiscord | <Yardanico> but then it's UB |
04:50:20 | FromDiscord | <Yardanico> so due to the fact that it's int and float, the float that was the argument for the function just gets treated as the return value (if I read assembly the right way) |
04:50:24 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/966561518554587147/unknown.png |
04:50:31 | FromDiscord | <Yardanico> ah wait not this code |
04:50:47 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/966561614197305354/unknown.png |
04:51:23 | FromDiscord | <Yardanico> testVal returns the value in `eax` but 6.0 is in `xmm0` and since we expect the function to return a double we treat our argument xmm0 as our return value |
04:54:31 | rockcavera | Yardanico, it returns in eax as the return value of testval is int |
04:54:40 | FromDiscord | <Yardanico> I know |
04:55:16 | FromDiscord | <Yardanico> I was just confused as to why it was printing out 6.0 as it was the argument, but after checking the assembly I understood it |
04:58:06 | FromDiscord | <huantian> so you should have to say `() => 5.0` instead of `() => 5` |
04:58:10 | FromDiscord | <Yardanico> yes |
04:58:18 | FromDiscord | <Yardanico> but the compiler should've rejected it |
04:58:26 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/16906 found the older issue about the same thing so closed it as duplicate |
04:59:17 | FromDiscord | <leorize> something you can do is to reduce memory overhead. That code you have is very syscall-heavy, so every memory fetch after will be very slow due to cache being partially-flushed↵(@ajusa) |
05:00:04 | FromDiscord | <leorize> so reduce syscall (if possible), then reduce the amount of memory you'd have to recall from RAM is a good bet, even if it results in more processing, as processing is always faster than RAM |
05:27:14 | FromDiscord | <treeform> In reply to @Patitotective "https://github.com/treeform/pixie/issues/412 👀": I answered you in the issue. |
05:28:51 | FromDiscord | <treeform> In reply to @spoon "ive had to use": I am glad pixie worked fast for you! |
05:32:10 | * | fowl6 joined #nim |
05:33:55 | * | fowl quit (Ping timeout: 256 seconds) |
05:33:56 | * | fowl6 is now known as fowl |
05:35:25 | FromDiscord | <treeform> In reply to @Alea "treeform hasn't made a": you can always just `git clone` and `nimble devel` to get most recent or very specific version. |
05:40:41 | FromDiscord | <treeform> In reply to @Patitotective "is it worth? 🤔": Zstd is cool, but no native nim implementation. I would recommend Supersnappy, with Zippy only if you want compatibility with some thing. Also some inputs will really like some compression methods but not others. Its a important to bench with varied set of input files. |
05:42:09 | FromDiscord | <Rika> Some people don’t care too much about whether it is native Nim or not |
05:45:19 | FromDiscord | <treeform> I hate it when I `nimble install somelib`, then run it and it says `"somelib.dll not found"` - good luck hunting the right dll on windows. Not not as easy as `apt-get install somelib-dev`... |
05:46:38 | FromDiscord | <Yardanico> In reply to @treeform "I hate it": well, it's not always as bad |
05:46:45 | FromDiscord | <Yardanico> for things like zstd you can link it, and that package just links it by default |
05:46:53 | FromDiscord | <Yardanico> so even if it's not "native nim" it's not really that bad |
05:46:59 | FromDiscord | <Yardanico> but yeah, pure-nim is preferred of course |
05:47:07 | FromDiscord | <Yardanico> unless it's much more inferior to the other choices |
05:48:11 | FromDiscord | <treeform> If somelib included the C sources its usually fine. |
05:49:09 | FromDiscord | <treeform> I also like the idea of snappy - its such a simple algorithm |
05:49:22 | FromDiscord | <treeform> zstd is massive! huge! |
05:50:06 | FromDiscord | <treeform> There is just this simplicity that attracts me to snappy and makes we run a way from zstd... |
05:50:18 | FromDiscord | <treeform> (edit) "we" => "me" |
06:12:51 | NimEventer | New Nimble package! cppclass - Syntax sugar which helps to define C++ classes from Nim., see https://github.com/sls1005/NimCPPClass |
06:13:20 | * | rockcavera quit (Remote host closed the connection) |
06:27:00 | * | jjido joined #nim |
06:42:29 | FromDiscord | <JSONBash> is there a way I can prevent a copy using ARC/ORC? |
06:42:43 | FromDiscord | <Elegantbeef> make `=copy` an error |
06:43:40 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-nimeqcopy-hook |
06:43:45 | FromDiscord | <JSONBash> thank you thats what I was looking for |
07:01:42 | * | PMunch joined #nim |
07:03:19 | * | gsalazar joined #nim |
07:30:28 | PMunch | treeform, I was actually looking at zippy yesterday |
07:30:57 | PMunch | Have to do some compression for work |
07:31:25 | PMunch | I'm looking into pre-shared dictionary compression |
07:32:15 | PMunch | And I was toying with the idea of a compression algorithm where the dictionary was never sent, but computed independently and on the fly by each side |
07:32:50 | PMunch | The model could of course then be much bigger than normal, which creates an interesting situation |
07:32:52 | FromDiscord | <Rika> Isn’t that just LZ |
07:33:58 | PMunch | @Rika, I don't think so? |
07:34:53 | PMunch | This is what I've been using thus far: https://github.com/gtoubassi/femtozip |
07:36:15 | FromDiscord | <luteva> is it possible to use a proc as a parameter in a template? (i think this is possible?!?) any link to an example?↵or do i have to use something like 'statemens: untyped'? |
07:36:35 | FromDiscord | <Elegantbeef> you can do `templateParam: name` |
07:36:54 | PMunch | It works pretty well, but it's slow to regenerate a new model, meaning that you need some complicated heuristic for when to do it |
07:37:54 | PMunch | @luteva, what have you tried? IIRC this is pretty straight forward to do |
07:39:00 | FromDiscord | <luteva> i just need an easy example to have a look at. |
07:39:35 | FromDiscord | <Elegantbeef> `template doThing(a: proc()) = a()` |
07:40:33 | FromDiscord | <luteva> thanks! |
07:40:47 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
07:41:20 | * | fredrikhr joined #nim |
07:50:34 | * | jjido joined #nim |
07:53:21 | * | jjido quit (Client Quit) |
08:01:37 | Yardanico | PMunch: by the way, is there a reason why you chose to convert all C names into lowercase + capitalized string? |
08:02:03 | PMunch | I assume you're talking about Futhark? |
08:02:06 | Yardanico | yeah |
08:02:23 | PMunch | Well it goes through a renaming scheme |
08:03:18 | PMunch | The reason is just that not all C names are valid Nim names, and there are multiple C names that can point to the same Nim name. So I normalize the C names to ensure that I can detect Nim-name collisions and rename the C name to something else |
08:03:43 | PMunch | Not quite sure what you mean by capitalized string though |
08:03:53 | Yardanico | ah yeah that was just my mistake, I see you just preserve the original casing |
08:04:20 | PMunch | Oh for the importc statements, yeah those have to keep the original casing |
08:04:41 | Yardanico | but I wonder if something can be done to make the generated nim names a bit more readable |
08:04:46 | PMunch | This is essentially the name sanitizer: https://github.com/PMunch/futhark/blob/master/src/futhark.nim#L48-L67 |
08:05:06 | PMunch | Well most of them should be possible to write the same way as the C names |
08:05:35 | FromDiscord | <Elegantbeef> I dont recall pmunch do you allow manual namespace overrides? 😄 |
08:05:47 | PMunch | namespace overrides? |
08:06:01 | FromDiscord | <Elegantbeef> yea remove the dumb C namespacing |
08:06:08 | PMunch | You can pass your own `renameCallback` |
08:06:19 | FromDiscord | <Elegantbeef> Ah ok |
08:06:30 | PMunch | I've used this in the past to strip the C library name off-of the procedures |
08:06:57 | PMunch | You could also write something more complex so that it removes type names as well, and just use overloading |
08:07:30 | PMunch | The rename callback is ran before the sanitizer by the way, so if you return an invalid name it will still fix it for you |
08:07:38 | Yardanico | PMunch: yeah I know, i was just talking about how autosuggestions (e.g. nimsuggest) will use the default casing |
08:07:52 | Yardanico | because even though nim is partially case insensitive, no tools take advantage of that :( |
08:07:52 | PMunch | Yeah that's a bit annoying.. |
08:08:17 | PMunch | Also the documentation and such shows everything with the numbers.. |
08:08:22 | FromDiscord | <Yardanico> yeah |
08:08:29 | FromDiscord | <Yardanico> by the way, does anyone know the reason why `dec` and `inc` are implemented as magics in the compiler? |
08:08:45 | FromDiscord | <Yardanico> so the backends implement them separately from normal arithmetics |
08:08:46 | FromDiscord | <Elegantbeef> I dont know why 99% of the magics are magic |
08:09:00 | * | jjido joined #nim |
08:09:23 | PMunch | I'm planning a "don't do the type rewrites" mode which could be used if you're prepared to possibly do some more manual work, but would yield a prettier output |
08:09:35 | FromDiscord | <Yardanico> ooh, nice |
08:16:33 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:19:07 | PMunch | The original reason for those indirect types where simply that I wasn't sure how well Futhark would work, and I was tired of having to learn how to rewrite definitions in the other C-wrapping libraries. So I decided that if I can just type out the definition myself, and then have Futhark grab it automatically that would be the easiest solution |
08:20:37 | PMunch | Turns out Futhark works really well and the feature isn't nearly as necessary as I thought it would be. In fact the only times recently where I've felt the need to use it I couldn't because it was a type that depended on another type |
08:20:48 | PMunch | So maybe I should just rethink the whole system |
08:21:18 | PMunch | Pass in definitions inside the importc block and then splice them in instead of just emitting a bunch of `when` statements and weird type aliases |
08:24:49 | FromDiscord | <Yardanico> by the way, found another issue, although it doesn't affect me as I don't use the related functions |
08:25:00 | FromDiscord | <Yardanico> but it seems like futhark doesn't understand "#define SOMENAME long" as a type alias |
08:25:25 | FromDiscord | <Yardanico> so for "#define LRESULT long" it made `long` a distinct object and then defined Lresult as a type alias to that |
08:25:38 | PMunch | Ah.. |
08:25:47 | PMunch | Yeah the #define support is a bit lackluster.. |
08:26:42 | PMunch | It checks if the right hand side is a type, but long isn't a type in Nim. I guess I'll need a rewrite rule for built-in C types |
08:27:52 | FromDiscord | <Yardanico> yeah, apparently sciter also does this for double |
08:28:03 | FromDiscord | <Yardanico> "#define FLOAT_VALUE double" heh |
08:29:14 | FromDiscord | <Yardanico> but anyway, no rush in fixing these :) just wanted to share things i found |
08:29:35 | PMunch | Would you mind creating a GitHub issue so I don't forget? |
08:29:49 | FromDiscord | <Yardanico> yeah sure |
08:31:40 | FromDiscord | <Yardanico> should I also open an issue about `ptr` for procedure pointers? |
08:32:08 | PMunch | Sure |
08:32:42 | PMunch | That's still weird to me, I distinctly remember fixing that.. |
08:32:53 | PMunch | Maybe it's some edge-case |
08:33:33 | FromDiscord | <Yardanico> @PMunch maybe because those are inside of structs? |
08:33:43 | FromDiscord | <Yardanico> e.g. sciter has a struct that has a lot of function pointer fields |
08:34:01 | FromDiscord | <Yardanico> and some of these functions have functions in their arguments |
08:34:14 | PMunch | I have a similar thing in another project which works fine |
08:34:14 | FromDiscord | <Yardanico> i guess I can just test by writing my own header |
08:34:41 | PMunch | A dynamic library where I pass a structure with function pointers |
08:37:56 | FromDiscord | <Yardanico> @PMunch hmm, then maybe because the ones that still have `ptr` are defined as separate C types? |
08:38:19 | PMunch | Oh, that's possible |
08:38:38 | PMunch | If you could create a minimal example that'd be perfect |
08:39:01 | FromDiscord | <Yardanico> https://github.com/PMunch/futhark/issues/30 |
08:40:06 | PMunch | Perfect |
08:43:13 | FromDiscord | <Phil> As someone who has no idea whatsoever on the more lower levels of languages talking to one another, can there even be such a thing as languages talking to one another without going through C interfaces or the like?↵In what order of magnitude would you be in terms of effort? |
08:43:29 | FromDiscord | <Yardanico> it's not about "C interfaces" |
08:43:35 | FromDiscord | <Yardanico> it's all about calling conventions, ABIs and such |
08:43:55 | FromDiscord | <Phil> I don't have any explicit plans, just reading through articles made me wonder how difficult it would be to ditch... ah, huh |
08:43:56 | FromDiscord | <Yardanico> it's just a set of agreements on registers are used for arguments, how is data stored (what order), etc |
08:43:58 | FromDiscord | <Elegantbeef> The C ffi is more just a generalize language |
08:44:19 | FromDiscord | <Yardanico> for example the main ABI for Linux is https://wiki.osdev.org/System_V_ABI |
08:44:36 | FromDiscord | <Elegantbeef> It's a descriptor of what to expect, you use pretty much any language if you really wanted to as long as you abide by the aforementioned ABI |
08:44:50 | FromDiscord | <Phil> Is that the type of thing of which there are like 100+ different ones? |
08:45:22 | FromDiscord | <Elegantbeef> Though in the case you use Nim's C ffi that compiles a file it's pretty important it's C 😛 |
08:46:26 | FromDiscord | <Elegantbeef> Also yes two languages talking to eachother can happen with sockets 😛 |
08:46:43 | FromDiscord | <Elegantbeef> Not that it makes it overly useful, but pedantry is pedantry |
08:47:33 | FromDiscord | <Yardanico> i mean RPC is a thing and it's quite popular nowadays in languages like Go |
08:48:04 | FromDiscord | <Elegantbeef> "Use my library it'll require a socket" isnt something i'd overly advertise |
08:48:20 | * | Zectbumo quit (Remote host closed the connection) |
08:48:44 | FromDiscord | <Elegantbeef> The latency for a proc call would be quite comical |
08:49:22 | FromDiscord | <Yardanico> but but microservices!! |
08:49:43 | FromDiscord | <Elegantbeef> I'm sorry to hear that |
08:49:56 | FromDiscord | <Yardanico> lol |
08:50:58 | NimEventer | New thread by Jasonfi: Problems with DB connections using db_postgres, see https://forum.nim-lang.org/t/9120 |
09:05:25 | * | xet7 quit (Remote host closed the connection) |
09:06:32 | * | xet7 joined #nim |
09:09:03 | NimEventer | New thread by Daef: Brogrammer uptick, see https://forum.nim-lang.org/t/9121 |
09:09:39 | FromDiscord | <Yardanico> wat |
09:10:00 | FromDiscord | <Elegantbeef> People are using bro |
09:14:42 | PMunch | I've noticed that in this live chat as well |
09:14:54 | PMunch | Maybe Nim is finally taking off in America |
09:14:55 | FromDiscord | <Elegantbeef> Bro |
09:15:14 | FromDiscord | <Elegantbeef> I hope not that place is full of idiots |
09:15:21 | PMunch | Or maybe "bro" has spread to Europe *shudders* |
09:17:21 | FromDiscord | <Yardanico> apparently @hmmm has been doing most "bro"s in the chat recently :P |
09:17:29 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
09:22:26 | PMunch | Someone do the same "bro" search through the IRC logs: https://irclogs.nim-lang.org/21-04-2022.json |
09:23:02 | FromDiscord | <Yardanico> yeah, time to update my ircdb :P |
09:40:36 | PMunch | Hmm, I wonder if I could create something with autotemplates that does automatic callbacks |
09:40:42 | PMunch | I think it should be possible |
09:46:02 | FromDiscord | <dom96> In reply to @ajusa "wow there's a lot": I really admire the passion to optimise httpbeast even further. But I think what we need more is a fast async DB library. Httpbeast is so close to the top that you will just be optimising for CPU differences and so your impact to effort ratio will be much worse than making Nim fast across the other benchmark types in techempower. |
09:46:22 | FromDiscord | <dom96> also calling `quit` should work just fine for httpbeast |
09:47:37 | FromDiscord | <dom96> another thing to try is to play V at their own game and wrap pico to create pico.nim 😄 |
09:49:25 | FromDiscord | <SirElephant> ok so installing nim isn't working and i wat to start fresh but idk how to uninstall it |
09:50:04 | FromDiscord | <dom96> latest results show httpbeast 1.5pp off pico.v: https://www.techempower.com/benchmarks/#section=test&runid=af8b082a-7b14-4c5d-a040-a87ac1242054&hw=ph&test=json&a=2. So not sure it's even worthwhile to try and get a better result, it's likely depending on environment you will see httpbeast being faster. |
09:50:09 | FromDiscord | <SirElephant> how do i do dis? |
09:50:21 | FromDiscord | <dom96> In reply to @SirElephant "ok so installing nim": how did you install it? |
09:50:32 | FromDiscord | <SirElephant> In reply to @dom96 "how did you install": finish.exe |
09:50:43 | FromDiscord | <SirElephant> but nim is not recognised blah blah |
09:50:46 | FromDiscord | <dom96> in that case I have no idea 🙂 |
09:51:09 | FromDiscord | <dom96> As the author of choosenim I'd recommend it, but maybe you've tried it already and it didn't work? |
09:51:26 | FromDiscord | <SirElephant> wut is choosenim? |
09:52:04 | FromDiscord | <dom96> https://github.com/dom96/choosenim/#installation |
09:52:48 | FromDiscord | <dom96> note that Nim gets flagged by many anti-viruses on Windows, so that could be a source of your problems |
09:52:59 | FromDiscord | <dom96> (these flags are false positives) |
09:53:11 | FromDiscord | <SirElephant> bruh i am new to nim and haven't even written a line in it. idk what's going on here |
09:53:29 | FromDiscord | <SirElephant> In reply to @dom96 "note that Nim gets": thatsthereason |
09:53:47 | FromDiscord | <SirElephant> i want to "re-download" it |
09:54:00 | FromDiscord | <SirElephant> but to "re-download" in need to "de-download" |
09:54:42 | FromDiscord | <dom96> just try following the instructions I linked |
09:55:02 | FromDiscord | <dom96> if you're willing to use WSL as well, it makes this much easier |
09:55:41 | FromDiscord | <System64 ~ Flandre Scarlet> When I do↵something.anArray = myArray↵Does it copy the entire array? |
09:56:25 | FromDiscord | <frobnicate> @SirElephant what's the name of your windows user? I've had issues if my path has extended characters in it like æøå |
09:56:38 | FromDiscord | <SirElephant> In reply to @frobnicate "<@856412455507984404> what's the name": nope |
09:56:49 | FromDiscord | <SirElephant> its only in simple letters |
09:57:20 | FromDiscord | <frobnicate> Alright, then I'd try choosenim, like dom suggested. It handles everything |
09:58:01 | FromDiscord | <SirElephant> In reply to @frobnicate "Alright, then I'd try": but the problem is, windows defender only deleted nim.exe but not nimble and other stuff |
09:58:21 | FromDiscord | <SirElephant> so i can use nimble but not nim |
09:59:13 | FromDiscord | <SirElephant> so i haveto uninstall everything for it to work right? |
09:59:18 | FromDiscord | <SirElephant> (edit) "haveto" => "have to" |
09:59:48 | FromDiscord | <dom96> feel free to just delete the folder that nimble.exe resides in as well as the folder containing the Nim sources |
09:59:58 | FromDiscord | <SirElephant> hmmmm |
10:00:17 | FromDiscord | <dom96> finish.exe shouldn't create any entries in Windows' registry or anything like that, so deleting files should be fine |
10:00:42 | FromDiscord | <SirElephant> great it's workign |
10:00:45 | FromDiscord | <SirElephant> thenks |
10:00:59 | FromDiscord | <SirElephant> and can we install choosenim with chocolatey? |
10:01:28 | FromDiscord | <frobnicate> I usually just get the zip |
10:01:42 | FromDiscord | <dom96> maybe, but I wouldn't. If you've got chocolatey couldn't you just install Nim using it? |
10:01:55 | FromDiscord | <SirElephant> beeg brain |
10:02:33 | FromDiscord | <frobnicate> I still prefer choosenim for switching between versions |
10:03:29 | FromDiscord | <SirElephant> In reply to @frobnicate "I still prefer choosenim": no i am just starting to learn nim. So i don't think i should worry about the versions rn |
10:03:40 | FromDiscord | <frobnicate> Alright |
10:04:00 | FromDiscord | <SirElephant> In reply to @frobnicate "I still prefer choosenim": thenks for the suggestion tho |
10:04:41 | FromDiscord | <dom96> chocolatey will likely install nim just fine but might give you an older version |
10:04:49 | FromDiscord | <dom96> should be good enough though |
10:04:52 | FromDiscord | <SirElephant> In reply to @dom96 "chocolatey will likely install": nope it's 1.6.4 |
10:05:04 | FromDiscord | <dom96> nice |
10:05:36 | FromDiscord | <hmmm> In reply to @Yardanico "apparently <@887269570765791243> has been": you all my bros ❤️ |
10:08:33 | FromDiscord | <SirElephant> thanks guys i can use nim now |
10:08:45 | FromDiscord | <SirElephant> https://tenor.com/view/olsen-twins-thank-you-you-da-best-you-are-the-best-blow-kiss-gif-16197521 |
10:14:24 | FromDiscord | <dom96> awesome. We're here to help if you run into any other problems 🙂 |
10:17:54 | * | ehmry quit (Ping timeout: 276 seconds) |
10:21:44 | * | jmdaemon quit (Ping timeout: 248 seconds) |
10:24:13 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3VGn |
10:27:06 | * | ehmry joined #nim |
10:27:10 | FromDiscord | <Rika> No |
10:27:14 | FromDiscord | <Rika> Arrays are not pointers |
10:31:15 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "Arrays are not pointers": Ah alright↵And if I do↵var anArray = anotherArray↵Does it copy the entire array into anArray? |
10:32:37 | FromDiscord | <Rika> If it’s an array only yes I believe so, though lent and sink might change that soon |
10:32:44 | FromDiscord | <Rika> I’m not too familiar with lent and sink |
11:00:12 | FromDiscord | <ajusa> In reply to @dom96 "latest results show httpbeast": I wasn't aware of later benchmarks, thanks for the link. I'll still spend a bit of time to see if there are any easy things to optimize, just for learning purposes |
11:02:31 | FromDiscord | <dom96> these benchmarks are always running, but you saw my message after our optimisations were merged right? https://discord.com/channels/371759389889003530/764946138109050893/925891916090982411 |
11:11:31 | FromDiscord | <ajusa> Oh yes, but I forgot about it 😆 |
11:12:57 | FromDiscord | <ajusa> In reply to @dom96 "another thing to try": Also I think that would require reimplementing async, since picoev is basically equivalent to Nim's selectors |
11:53:55 | PMunch | Hmm, I'm thinking about my autorouter concept. Basically I want a macro which takes some path like "/user/@id" and a procedure. The macro would then check the implementation of the procedure and look at the arguments it requires. In this case the procedure would require a User object. The macro would then find a procedure that can turn a Request into a User and call that before calling the procedure. |
11:56:05 | PMunch | So far so good, but I also want to support something like "/user/@id/posts" and a procedure that then takes Client and seq[Post]. But I don't want the procedure that is supposed to look up posts to have to get the ID from the request all over again. So I also want to look for a procedure that takes a Client and returns seq[Post] |
11:56:37 | PMunch | Now the problem is how I'm going to do the procedure discovery |
11:57:15 | PMunch | I could have them called the same and then do some funky generic magic to pick the correct one |
11:57:27 | PMunch | Or I could require the getters to have a pragma set on them |
11:57:54 | PMunch | So you could call them whatever you like, but must attach that pragma for them to be recognised |
11:57:58 | PMunch | That's definitely the easiest |
11:58:13 | FromDiscord | <ajusa> Yeah, if you have identical type signatures you'll need additional stuff to tell them apart |
11:58:32 | PMunch | But there is no way in Nim to just give me all procedures that returns a specific type right? |
11:58:39 | PMunch | @ajusa, of course |
12:00:39 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3VGO |
12:01:12 | FromDiscord | <ajusa> We'll similar in the sense that it's running code based on a route and filling in a type. |
12:02:13 | PMunch | Oh nice |
12:04:04 | PMunch | I want to fill in the getter procedures automatically so that taking a User type could read the request, get the user ID from whatever scheme you want, do a database lookup and return the result serialised to an object. And then define that logic once and not have to think about it later |
12:17:19 | PMunch | Hmm, so Nim doesn't appear to have any way to get all procedures or similar.. |
12:20:14 | PMunch | Well, there are some cursed ways of doing this.. |
12:20:23 | PMunch | `nim jsondoc` comes to mind :P |
12:20:37 | PMunch | Or even something like `macros.parseStmt(readFile("module.nim"))` |
12:25:20 | * | slowButPresent joined #nim |
12:41:22 | * | duuude joined #nim |
12:41:52 | duuude | hi, nim looks cool, have these been fixed? https://gradha.github.io/articles/2015/02/goodbye-nim-and-good-luck.html |
12:43:18 | FromDiscord | <Yardanico> The GC part - yes, Nim has ARC and ORC now, and they can share memory between threads (although you need to ensure the safety yourself), also threads can move ownership of data from one to another without copying |
12:44:50 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/3bF |
12:45:04 | FromDiscord | <Knedlik> I've been trying to fix this for about an hour now |
12:45:31 | FromDiscord | <Rika> did you read https://github.com/jjv360/nim-classes |
12:45:35 | FromDiscord | <Knedlik> yes |
12:45:49 | FromDiscord | <Yardanico> are you sure? :) |
12:45:50 | FromDiscord | <Rika> then have you noticed how your code is wrong? |
12:46:03 | FromDiscord | <Yardanico> The example in the readme doesn't have a type statement |
12:46:05 | PMunch | @Knedlik, methods need to have a `=` before the body |
12:46:19 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/zvm |
12:46:29 | FromDiscord | <Knedlik> So types can't be a part of classes? |
12:46:31 | FromDiscord | <Yardanico> Also what pmunch said |
12:46:32 | PMunch | Oh, and maybe some other stuff |
12:46:48 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/c5c |
12:46:53 | FromDiscord | <Yardanico> In reply to @Knedlik "So types can't be": That library is just syntactic sugar for defining types |
12:47:03 | FromDiscord | <Yardanico> just define your types outside of the "class" statement |
12:47:26 | FromDiscord | <Yardanico> "class" isn't an actual keyword, it's just a macro made by that library |
12:47:29 | FromDiscord | <Knedlik> And in the example there are methods with : before the body btw |
12:47:30 | FromDiscord | <Rika> you're not supposed to define the type `T` if you're doing `class T` i believe |
12:47:40 | FromDiscord | <Knedlik> hmmm |
12:47:52 | FromDiscord | <Yardanico> In reply to @Knedlik "And in the example": that's where they have return values |
12:48:03 | FromDiscord | <Knedlik> ooooh |
12:48:04 | FromDiscord | <Rika> `method calculateSize(): float = return 0`↵` return val^` |
12:48:04 | FromDiscord | <Yardanico> I suggest you read Nim basics or tut1 for procedure syntax |
12:48:06 | FromDiscord | <Knedlik> makes sense |
12:48:34 | FromDiscord | <Knedlik> I did read the beginner tutorial |
12:48:34 | FromDiscord | <Yardanico> https://narimiran.github.io/nim-basics/#_declaring_a_procedure |
12:49:03 | FromDiscord | <Yardanico> this syntax is the same for all Nim routines |
12:49:26 | FromDiscord | <Yardanico> procedures, functions, methods, templates, macros, iterators |
12:49:46 | FromDiscord | <Knedlik> Although it's possible I forgot a bit... Also, if class is just another syntax for a type, does that mean I can just pass `this` instead of passing the type? I'm not sure if they can extend a type tho... |
12:50:48 | FromDiscord | <Yardanico> not sure what you mean by "this" |
12:51:41 | FromDiscord | <Knedlik> `this.function`, or pass the object currently running the method as the parameter, when type is expected |
12:51:43 | FromDiscord | <dom96> In reply to @ajusa "Also I think that": how would it? pico implements it for you, just wrap it lol |
12:55:26 | FromDiscord | <dom96> In reply to @Yardanico "The GC part -": afaik smartptrs is what's supposed to be used for safe shared memory across threads |
12:55:53 | FromDiscord | <Yardanico> you can also just use locks, but of course it depends on the specific use case |
12:56:35 | FromDiscord | <dom96> you need something to manage the memory you are allocating as "shared" |
12:56:36 | FromDiscord | <dom96> that is the key |
12:59:32 | FromDiscord | <Yardanico> In reply to @dom96 "you need something to": not sure what you mean, with arc you literally can use create a global seq and use it from multiple threads with locks |
12:59:53 | FromDiscord | <Yardanico> With --threads:on all ref objects and stuff are allocated on the shared heap |
13:00:02 | FromDiscord | <Yardanico> (with arc) |
13:00:46 | FromDiscord | <dom96> hm, are you sure? Is there an example that does this? |
13:01:24 | FromDiscord | <dom96> You're likely right though. I haven't had a chance to play with arc/orc in depth yet. |
13:01:38 | FromDiscord | <Yardanico> yes I'm sure, I tested it before, it just works |
13:01:52 | FromDiscord | <Yardanico> don't know if there are examples, but it's easy to test |
13:05:22 | FromDiscord | <Yardanico> well, I forgot to mention that you need to mark the block of code as gcsafe as the compiler doesn't realise that it's actually safe |
13:05:25 | FromDiscord | <Yardanico> that's a known issue |
13:07:10 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3VH0 |
13:07:11 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/0Dd |
13:07:34 | FromDiscord | <Yardanico> In reply to @Knedlik "Okay, issue from before": can you show the full error message the compiler gives you? |
13:07:52 | FromDiscord | <Yardanico> errors shown in the editor can sometimes be incomplete as multiple lines get cut |
13:08:35 | FromDiscord | <Knedlik> hmmm, so it doesn't have a problem with it actually... how weird |
13:19:46 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/ubN |
13:20:39 | FromDiscord | <dom96> You passed a variable whose type is `title` |
13:20:42 | FromDiscord | <dom96> it wants `Scene` |
13:20:49 | FromDiscord | <Yardanico> In reply to @Knedlik "okay, what the hell": `game.scene=` expects something of a Scene type while you passed a `title` |
13:21:07 | FromDiscord | <dom96> If that's a type you declared: you should capitalise the first letter |
13:21:41 | FromDiscord | <dom96> (probably won't solve your problem, just a nit) |
13:21:53 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3VH3 |
13:22:08 | FromDiscord | <Knedlik> (edit) "https://play.nim-lang.org/#ix=3VH3" => "https://play.nim-lang.org/#ix=3VH4" |
13:22:39 | FromDiscord | <Yardanico> `discard` is not for returning stuff |
13:22:43 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/ARj |
13:22:47 | FromDiscord | <Yardanico> it's the same as just "discarding" the value, throwing it away |
13:22:52 | FromDiscord | <Knedlik> Yes |
13:22:53 | FromDiscord | <Yardanico> maybe what you want is `return`? |
13:22:56 | FromDiscord | <Yardanico> in your `init` |
13:23:20 | FromDiscord | <Knedlik> I can try |
13:23:39 | FromDiscord | <Yardanico> wait, why do you even have `init` and `create` separately in your class |
13:24:04 | FromDiscord | <Yardanico> shouldn't you just have `init` ? that's the way nim-classes package does it for `class` |
13:24:29 | FromDiscord | <Knedlik> `init` is for class init, `create` is for scene creation |
13:25:01 | FromDiscord | <Knedlik> Altho I guess I could merge it |
13:26:39 | FromDiscord | <Knedlik> Okay, but still doesn't remove the error |
13:26:59 | FromDiscord | <Knedlik> OH WAIT |
13:27:52 | * | arkurious joined #nim |
13:27:58 | FromDiscord | <Solitude> stop writing java in nim |
13:29:05 | FromDiscord | <Knedlik> what? |
13:29:26 | PMunch | @Knedlik, @Solitude has a point, if you're new to Nim it's probably a better idea to write idiomatic Nim instead of forcing it to be OO |
13:29:36 | FromDiscord | <Knedlik> I guess |
13:29:50 | FromDiscord | <Knedlik> Yeah, you're right |
13:31:56 | * | duuude quit (Ping timeout: 250 seconds) |
13:32:08 | * | duuude joined #nim |
13:32:09 | FromDiscord | <Yardanico> In reply to @Knedlik "Yeah, you're right": in nim you don't have to write OO in order for your code to look like OO code since Nim has MCS (also called UFCS) |
13:32:22 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
13:40:25 | FromDiscord | <Knedlik> uhhh |
13:41:26 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/lAX |
13:42:10 | FromDiscord | <Yardanico> you should export newTitleScene |
13:42:21 | FromDiscord | <Yardanico> but I don't know if that class library does that |
13:42:31 | FromDiscord | <Knedlik> I don't use classes anymore |
13:42:52 | FromDiscord | <Yardanico> In reply to @Knedlik "I don't use classes": oh, then for exporting you just add `` to your routine definition |
13:43:03 | FromDiscord | <Yardanico> e.g. `proc test(args)` or `method test(args)` |
13:43:18 | FromDiscord | <Knedlik> makes sense, thanks |
13:43:29 | FromDiscord | <Knedlik> Man, being a beginner sucks |
13:44:41 | * | PMunch quit (Quit: Leaving) |
13:50:42 | FromDiscord | <Rika> 🤔 LTO breaks pixie |
13:52:52 | FromDiscord | <Knedlik> Okay, got it to build... |
13:53:12 | FromDiscord | <Knedlik> Thought it would end there?↵`could not load: SDL2.dll` |
13:55:07 | FromDiscord | <Yardanico> In reply to @Knedlik "Thought it would end": well, you need SDL2.dll, either get it from the official website or from the nim distribution |
13:55:16 | FromDiscord | <Yardanico> In reply to @Rika "🤔 LTO breaks pixie": nice, have a code snippet? |
13:55:21 | FromDiscord | <Yardanico> also does it break just with gcc or both gcc and clang? |
13:56:10 | FromDiscord | <Knedlik> In reply to @Yardanico "well, you need SDL2.dll,": Like in my game? |
13:56:38 | FromDiscord | <Yardanico> ? nimgame2 uses SDL2 for actual rendering/input/etc stuff |
13:56:52 | FromDiscord | <Yardanico> you need to have it either: 1) in your PATH 2) next to your game executable |
13:57:02 | FromDiscord | <Yardanico> by 1 i mean in a folder that's in your PATH |
13:57:02 | FromDiscord | <Knedlik> Oh, that makes sense |
13:57:28 | FromDiscord | <Knedlik> Tbh I will rather package it with my game, it's better than users having to have it in their path |
14:02:51 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3VHc |
14:04:54 | FromDiscord | <Yardanico> In reply to @Rika "just load a png": wow nice, lemme try |
14:05:27 | FromDiscord | <Rika> i'm not sure if its an issue with my png, but without LTO it works? |
14:06:13 | FromDiscord | <Yardanico> In reply to @Rika "i'm not sure if": yeah it can either be that Nim compiled to invalid C code that got misoptimized with LTO, or it's just a GCC bug (or clang if you're using it) |
14:06:40 | * | duuude quit (Ping timeout: 246 seconds) |
14:10:00 | * | duuude joined #nim |
14:10:35 | FromDiscord | <Knedlik> Hmm, guys any idea where I could get prebuilt runtime libs of SDL GFX? |
14:14:44 | FromDiscord | <Yardanico> In reply to @Knedlik "Hmm, guys any idea": https://www.libsdl.org/download-2.0.php |
14:15:07 | FromDiscord | <Yardanico> ah gfx |
14:15:37 | * | Guest97 joined #nim |
14:16:35 | FromDiscord | <Knedlik> It's quite a bit of chaos, I found SDL2-gfx 1.0.4 and I also found SDL-gfx 2.0.25, none of which built or with a script to build |
14:16:59 | * | kayabaNerve quit (Remote host closed the connection) |
14:18:28 | FromDiscord | <Knedlik> Oh, there's a thing linked by Nimgame, with all this stuff :facepalm: |
14:19:43 | FromDiscord | <Knedlik> which still is just a wrapper and doesn't include the dlls... |
14:19:46 | * | Guest97 quit (Client Quit) |
14:22:09 | FromDiscord | <Knedlik> YES https://github.com/Vladar4/sdl2_nim/blob/master/LINKS.md |
14:24:03 | * | fredrikhr quit (Quit: Disconnecting) |
14:26:32 | FromDiscord | <jay79> I use a plain text editor to learn nim in Linux but it does not have a format for nim code. Any recommendations for a good text editor for nim. |
14:28:32 | * | vicfred joined #nim |
14:29:00 | FromDiscord | <Knedlik> I personally use Visual Studio Code, has great extension for it |
14:29:56 | FromDiscord | <Knedlik> And even tho I think it's a bit of a meme, I downloaded tabnine as an extension, and it is great so far |
14:30:21 | reversem3[m] | Is there a module to verify an xml format? Like using the dtd to verify the format of an xlm file? |
14:31:04 | FromDiscord | <Knedlik> Guys does anyone have experience with↵`Error: unhandled exception: cannot dispatch; dispatcher is nil [NilAccessDefect]`? |
14:31:19 | FromDiscord | <Knedlik> I'm like so close to launching my game... |
14:31:39 | reversem3[m] | Kind of like jingtrng https://pypi.org/project/jingtrang/ |
14:33:57 | * | Knedlik joined #nim |
14:37:46 | FromDiscord | <enthus1ast> @Knedlik\: at least there is a test for this |
14:37:47 | FromDiscord | <enthus1ast> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/tests/method/tnildispatcher.nim |
14:38:35 | Knedlik | what even is that? |
14:38:45 | FromDiscord | <enthus1ast> also this https://github.com/nim-lang/Nim/issues/5599 |
14:40:45 | Knedlik | I don't think it's in my code |
14:41:11 | Knedlik | The entire program runtime is |
14:41:12 | Knedlik | C:\Users\knedl\Documents\GitHub\Beyond-the-Sphere>"out/debug/bts.exe" |
14:41:12 | Knedlik | C:\Users\knedl\Documents\GitHub\Beyond-the-Sphere\src\nim\Main.nim(4) Main |
14:41:13 | Knedlik | C:\Users\knedl\Documents\GitHub\Beyond-the-Sphere\src\nim\engineInit.nim(10) initEngine |
14:41:13 | Knedlik | C:\Users\knedl\Desktop\nimgame2-#devel\nimgame2\nimgame.nim(535) run |
14:41:14 | Knedlik | C:\Users\knedl\.choosenim\toolchains\nim-#devel\lib\system\chcks.nim(100) event |
14:41:14 | Knedlik | C:\Users\knedl\.choosenim\toolchains\nim-#devel\lib\system\fatal.nim(53) sysFatal |
14:41:15 | Knedlik | Error: unhandled exception: cannot dispatch; dispatcher is nil [NilAccessDefect] |
14:41:19 | FromDiscord | <enthus1ast> i think the issue in this code is that its a ref object but no initialisation |
14:41:42 | FromDiscord | <Yardanico> yes |
14:41:45 | FromDiscord | <Yardanico> i think so too |
14:41:49 | Knedlik | hmmm |
14:42:02 | FromDiscord | <Tanguy> Yes, it means you call a method on a nil ref object |
14:43:22 | Knedlik | Would anyone of you be nice enough to look at it if I pushed the current version to github? |
14:44:14 | FromDiscord | <enthus1ast> what happens here\: engineInit.nim(10) initEngine ? |
14:44:19 | FromDiscord | <Tanguy> I can tell you that on line 535 of nimgame.nim, you call a method on something which is nil |
14:45:02 | Knedlik | line 10 on engineinit is game.run |
14:45:16 | FromDiscord | <enthus1ast> is game nil? |
14:45:28 | Knedlik | game is equal to newGame(), as per nimgame docs |
14:45:45 | Knedlik | Hope you're not getting annoyed at my noob questions lol |
14:46:07 | FromDiscord | <enthus1ast> never used nimGame unfortunately |
14:48:40 | FromDiscord | <enthus1ast> https://github.com/Vladar4/nimgame2/blob/1fbfb9b2b927acafa9e85d8cb58a657d5afed0cb/nimgame2/nimgame.nim#L535↵ game.fScene.event(event) |
14:49:47 | FromDiscord | <enthus1ast> and scene is↵ Scene\ = ref object of RootObj |
14:49:53 | FromDiscord | <enthus1ast> so maybe your scene is nil |
14:50:24 | Knedlik | I do have game.scene = newTitleScene() |
14:50:52 | FromDiscord | <enthus1ast> newTitleScene() is your code? |
14:50:57 | Knedlik | proc newTitleScene*(): TitleScene = |
14:50:57 | Knedlik | init(new TitleScene) |
14:51:30 | Knedlik | Yes, it's in my titleScene.nim file |
14:52:08 | FromDiscord | <enthus1ast> sent a long message, see https://paste.rs/AR6 |
14:52:37 | Knedlik | where? |
14:52:50 | FromDiscord | <enthus1ast> instead of init(new TitleScene) |
14:53:42 | Knedlik | type mismatch: got 'typedesc[TitleScene]' for 'TitleScene' but expected 'TitleScene = ref TitleScene:ObjectType' |
14:53:56 | FromDiscord | <enthus1ast> TitleScene() ? |
14:54:00 | FromDiscord | <enthus1ast> () ? |
14:54:03 | Knedlik | yes |
14:54:09 | Knedlik | no |
14:54:45 | Knedlik | Now it works, but outputs just a black window, so I assume it didn't init the scene |
14:55:00 | FromDiscord | <enthus1ast> is init also your code? |
14:55:04 | Knedlik | yes |
14:55:15 | Knedlik | proc init(scene: TitleScene) = |
14:55:15 | Knedlik | Scene(scene).initScene() |
14:55:16 | Knedlik | scene.background = newTextureGraphic() |
14:55:16 | Knedlik | discard scene.background.load("data/gfx/BtS-Background.png") |
14:55:19 | FromDiscord | <enthus1ast> then maybe do\:↵↵result = TitleScene()↵init(result) |
14:55:58 | Knedlik | still the same |
14:56:35 | Knedlik | hmm I have an idea |
14:56:46 | Knedlik | I could render the scene |
14:58:34 | Knedlik | Still nope |
14:59:23 | FromDiscord | <enthus1ast> but at least it does not crash any more |
15:00:38 | FromDiscord | <enthus1ast> you discard the scene.background.load, does it maybe return an error or something? |
15:00:57 | Knedlik | i can try echo it |
15:01:29 | Knedlik | returns true |
15:01:36 | Knedlik | So I assume it's okay |
15:04:58 | * | perro quit (Ping timeout: 260 seconds) |
15:13:15 | Knedlik | I didn't implement method show()... well atleast I'm a lot closer |
15:13:24 | Knedlik | Thank you for your help |
15:13:30 | * | Knedlik quit (Quit: Client closed) |
15:24:09 | * | kenran joined #nim |
15:45:55 | duuude | how much nim is used in serious production? should I worry about it vanishing into air 10 years later? |
15:50:16 | duuude | is it easy to link a function written in nim to C? |
15:57:54 | FromDiscord | <huantian> Not too hard |
16:10:49 | FromDiscord | <tandy> a good amount is used in production↵(<@709044657232936960_duuude=5b=49=52=43=5d>) |
16:11:03 | FromDiscord | <tandy> nims governance raises some questions about its longevity, but nimskull is an active fork that also exists now |
16:11:34 | * | kenran quit (Quit: WeeChat info:version) |
16:12:56 | * | kenran joined #nim |
16:13:10 | * | kenran quit (Client Quit) |
16:13:23 | * | kenran joined #nim |
16:20:29 | * | vicfred quit (Quit: Leaving) |
16:24:59 | * | Gustavo6046 joined #nim |
16:25:34 | FromDiscord | <SirOlaf> Pretty unhelpful error https://play.nim-lang.org/#ix=3VHL |
16:26:09 | * | duuude quit (Ping timeout: 256 seconds) |
16:26:22 | * | Gustavo6046 quit (Max SendQ exceeded) |
16:26:56 | FromDiscord | <SirOlaf> Tried calling .toDeque on something and got that error |
16:27:45 | FromDiscord | <treeform> In reply to @PMunch "And I was toying": Yeah that can create amazing compression for text, this one uses massive dictionary and AI predictive powers: https://bellard.org/libnc/gpt2tc.html |
16:28:49 | FromDiscord | <treeform> Future of compression might be... you train a Neural network "dictionary" on your specific data. |
16:29:17 | FromDiscord | <treeform> For both lossless and lossy compression |
16:29:27 | * | Gustavo6046 joined #nim |
16:35:38 | FromDiscord | <enthus1ast> imho zstd can use a precomputed dicitonary |
16:36:06 | FromDiscord | <enthus1ast> zstd --train |
16:36:38 | * | duuude joined #nim |
16:36:40 | FromDiscord | <enthus1ast> i can imagine that this makes sense for lot of small datasets |
16:37:08 | FromDiscord | <enthus1ast> ah and lz4 can aswell |
16:59:35 | FromDiscord | <Solitude> In reply to @SirOlaf "Pretty unhelpful error https://play.nim-lang.org/#i": concepts are broken in random places |
17:14:21 | * | kenran quit (Quit: WeeChat info:version) |
17:20:00 | FromDiscord | <Phil> And that's why I just wrote compile time procs with asserts (for now) instead of concepts |
17:20:20 | FromDiscord | <Phil> (edit) "wrote" => "write" |
17:24:39 | FromDiscord | <hvs_013> Is nim good for mobile game dev |
17:24:39 | FromDiscord | <hvs_013> like |
17:24:39 | FromDiscord | <hvs_013> porting |
17:24:40 | FromDiscord | <hvs_013> games to made with nim |
17:24:40 | FromDiscord | <hvs_013> to android |
17:24:43 | FromDiscord | <hvs_013> games to made innim |
17:24:43 | FromDiscord | <hvs_013> games to made in nim |
17:27:12 | * | pro joined #nim |
17:27:24 | * | pro quit (Client Quit) |
17:30:37 | FromDiscord | <Yardanico> it depends |
17:30:48 | FromDiscord | <Yardanico> if you just want to make a mobile game, nim is far from the easiest choice |
17:31:19 | FromDiscord | <hvs_013> like |
17:31:25 | FromDiscord | <hvs_013> nim |
17:31:25 | FromDiscord | <hvs_013> compiles |
17:31:29 | FromDiscord | <hvs_013> to c/c++ |
17:31:31 | FromDiscord | <hvs_013> so |
17:31:32 | FromDiscord | <hvs_013> well |
17:31:35 | FromDiscord | <hvs_013> i can |
17:31:39 | FromDiscord | <hvs_013> use it in android studio |
17:31:41 | FromDiscord | <hvs_013> kinda |
17:31:47 | FromDiscord | <hvs_013> I am beginner |
17:31:48 | FromDiscord | <hvs_013> in nim |
17:32:00 | FromDiscord | <hvs_013> and sorry for my english |
17:32:03 | FromDiscord | <Yardanico> can you please take a bit of time to write your messages so you don't spam the chat :) |
17:32:21 | FromDiscord | <hvs_013> ok↵(@Yardanico) |
17:32:22 | FromDiscord | <hvs_013> sorry |
17:32:38 | * | vicfred joined #nim |
17:33:35 | FromDiscord | <Yardanico> In reply to @hvs_013 "use it in android": you can, but it's not really beginner friendly. You certainly can make mobile games in nim and some people have already done that, but it'll be harder than in mainstream game engines or even with Java + Android Studio |
17:38:47 | FromDiscord | <hvs_013> Are there any android games made in nim published on google play store |
17:40:12 | FromDiscord | <Solitude> In reply to @hvs_013 "Are there any android": super netwalk deluxe |
17:40:58 | FromDiscord | <hvs_013> made in game |
17:40:58 | FromDiscord | <hvs_013> it's a game↵(@Solitude) |
17:41:09 | FromDiscord | <hvs_013> plz send link |
17:42:40 | FromDiscord | <Yardanico> https://play.google.com/store/apps/details?id=net.impbox.nico&hl=en&gl=US |
17:42:45 | FromDiscord | <Yardanico> it's made with https://github.com/ftsf/nico |
17:42:59 | FromDiscord | <Yardanico> there are also two mobile games made with godot + nim |
17:43:13 | FromDiscord | <Yardanico> https://frayhem.com/en/ https://summonage.com/en/ |
17:43:47 | FromDiscord | <hvs_013> thanks and have a nice day |
17:49:13 | * | neceve joined #nim |
18:27:03 | * | Figworm joined #nim |
18:28:33 | * | Figworm quit (Client Quit) |
18:39:21 | * | duuude quit (Ping timeout: 248 seconds) |
18:47:51 | * | kayabaNerve joined #nim |
18:48:06 | * | kayabaNerve quit (Remote host closed the connection) |
18:48:31 | * | kayabaNerve joined #nim |
18:50:54 | * | kayabaNerve quit (Remote host closed the connection) |
18:55:23 | * | kayabaNerve joined #nim |
19:12:51 | * | jmdaemon joined #nim |
19:48:55 | NimEventer | New post on r/nim by hiikion: Is it possible to make windows kernel mode drivers in nim?, see https://reddit.com/r/nim/comments/u8vwh0/is_it_possible_to_make_windows_kernel_mode/ |
19:50:56 | FromDiscord | <Ayy Lmao> Is there a way to lazy initialize global vars? |
19:51:40 | nrds | <Prestige99> if it's a var you can change it any time, do you want it to be a const or something? |
19:52:45 | FromDiscord | <Ayy Lmao> In reply to @nrds "<Prestige> if it's a": My use case is something like: I want a default texture and shader for a module that is shared among instances, but it needs to be initialized after opengl and an opengl context is made. |
19:54:18 | nrds | <Prestige99> sounds like it'll have to be a var, then |
19:54:30 | FromDiscord | <Ayy Lmao> I'm just wondering if there is some slick way of doing that without lazily initializing them myself by making them vars and checking if they are initialized |
19:58:44 | FromDiscord | <Ayy Lmao> I guess it's not too bad to just have a function underneath the globals that I can call to initialize them. |
19:58:52 | FromDiscord | <Elegantbeef> The way I do this is with subscribing to a load callback which is called on initialisation, not fancy but works↵(@Ayy Lmao) |
20:01:23 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "The way I do": That sounds like a good solution. |
20:03:17 | * | Guest15 joined #nim |
20:05:36 | * | Kiori joined #nim |
20:05:47 | * | Guest15 quit (Client Quit) |
20:08:14 | * | Kiori quit (Client Quit) |
20:08:42 | * | Kiori joined #nim |
20:21:44 | * | Kiori quit (Ping timeout: 248 seconds) |
20:22:16 | * | Gustavo6046 quit (Remote host closed the connection) |
20:23:16 | * | Gustavo6046 joined #nim |
20:36:21 | * | neurocyte8614492 joined #nim |
20:45:29 | FromDiscord | <!Patitotective> In reply to @treeform "I answered you in": 👍 |
20:52:39 | * | neceve quit (Ping timeout: 240 seconds) |
21:11:54 | * | rockcavera joined #nim |
21:11:54 | * | rockcavera quit (Changing host) |
21:11:54 | * | rockcavera joined #nim |
21:16:50 | * | Kiori joined #nim |
21:33:38 | FromDiscord | <b4mbus> how would I go about clearing a sequence? |
21:33:53 | FromDiscord | <b4mbus> there's no `clear`, right? I'd have to `del` every item or assign an empty sequence? |
21:33:56 | FromDiscord | <Elegantbeef> `setLen` or reseting all entries to default? |
21:34:14 | FromDiscord | <b4mbus> clearing like clearing, deleting all items |
21:34:17 | FromDiscord | <b4mbus> so setLen I suppose |
21:35:09 | FromDiscord | <Elegantbeef> yep |
21:35:26 | FromDiscord | <Elegantbeef> clearing is kinda ambiguous talking about growable arrays to be fair |
21:44:08 | * | zgasma quit (Remote host closed the connection) |
21:55:47 | Kiori | setlen might have issues: https://github.com/nim-lang/Nim/issues/19728 |
21:56:49 | FromDiscord | <Elegantbeef> Yea but in this case we're talking about `setLen(0)` then growing which reuses the allocation and is generally preferred\\ |
22:15:12 | FromDiscord | <Arathanis> Is there any known issues with making nim dlls? getting segfaults on code that otherwise runs just fine when compiled directly to an executable |
22:23:07 | FromDiscord | <exelotl> are you using --gc:arc / orc? |
22:24:20 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3VKj |
22:24:37 | FromDiscord | <Arathanis> large values of X and/or Y can cause segfaults |
22:25:50 | FromDiscord | <Recruit_main707> you need to call `NimMain()` manually so that gc is started, i guess thats the issue here |
22:26:01 | FromDiscord | <Arathanis> and lengths are not what you expect, if you dedent he echo of the sequence length you will not get the value you expect when compiled as a `.so` file |
22:26:18 | FromDiscord | <exelotl> In reply to @Recruit_main707 "you need to call": ah yeah that'd be it |
22:26:24 | FromDiscord | <Arathanis> In reply to @Recruit_main707 "you need to call": Oh? is that something I need to import? |
22:26:58 | FromDiscord | <Arathanis> or I nede to call that from the dll? |
22:27:35 | FromDiscord | <Recruit_main707> i dont remember how you did it, but NimMain is a function the compiler automatically generates |
22:27:49 | FromDiscord | <Recruit_main707> but it is not called since it is a dll |
22:28:09 | FromDiscord | <Arathanis> well hot damn, that worked |
22:28:29 | FromDiscord | <Recruit_main707> was it exported? nice, i didnt remember |
22:28:30 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3VKl |
22:28:41 | FromDiscord | <Arathanis> thank you |
22:28:43 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=3VKl" => "https://play.nim-lang.org/#ix=3VKm" |
22:29:07 | FromDiscord | <Arathanis> now i need to figure out if I can statically link nimrtl... |
22:29:16 | FromDiscord | <Arathanis> or just ignore it but that seems like a not good idea |
22:29:20 | FromDiscord | <Arathanis> even though it wworks w/o |
22:29:52 | FromDiscord | <exelotl> if you use `--gc:arc` (or orc) you shouldn't need nimrtl, I think |
22:30:31 | FromDiscord | <Arathanis> ok |
22:31:42 | rockcavera | Aranthanis see this https://forum.nim-lang.org/t/8897 |
22:32:07 | FromDiscord | <Elegantbeef> Damn the matrix bridge died yet again |
22:32:33 | FromDiscord | <Elegantbeef> At this point i should yell at tandy to make one 😄 |
22:34:06 | FromDiscord | <Arathanis> `NimMain` seems Idempotent too |
22:34:40 | rockcavera | as far as i know, there is no need to call NimMain, as when loading the dll, NimMain is already executed. |
22:34:55 | rockcavera | at least on Windows |
22:35:10 | FromDiscord | <Arathanis> In reply to @rockcavera "as far as i": in linux it absolutely does not work correctly if I don't call it first |
22:35:19 | FromDiscord | <Elegantbeef> I think you're still supposed to call it, it might be wrappedin `once` |
22:35:36 | rockcavera | orc also seems to need NimMain to work correctly with cyclic references |
22:36:32 | FromDiscord | <Elegantbeef> I dont recall if that's true for orc |
22:36:44 | FromDiscord | <Elegantbeef> You should call it anyway for any toplevel statements |
22:39:20 | FromDiscord | <Arathanis> now i need to figure out if there is a way to call nimmain from inside the dll or something like that |
22:39:45 | rockcavera | nimrtl as far as I understand there can only be one instance running. Better not link statically. |
22:40:10 | FromDiscord | <Elegantbeef> Dont think so since the main proc is generated after all the code |
22:40:39 | FromDiscord | <Arathanis> In reply to @rockcavera "nimrtl as far as": just sucks to have to ship with a dependency |
22:40:55 | FromDiscord | <Elegantbeef> > My advice is to compile with --gc\:orc -d\:useMalloc, you don't need to worry about cycles and you don't need nimrtl.dll |
22:41:00 | FromDiscord | <Arathanis> which as far as I can tell needs to be in /usr/lib/ |
22:41:25 | rockcavera | araq hinted that orc/arc doesn't need nimrtl |
22:41:48 | FromDiscord | <Arathanis> In reply to @Elegantbeef "> My advice is": brilliant, this works. dont even need to call `NimMain` |
22:42:07 | rockcavera | =) |
22:42:08 | FromDiscord | <Elegantbeef> On linux you can use `rpath` or make an appimage like it's 2022 |
22:42:37 | FromDiscord | <Elegantbeef> Well you need to call nim main if any of your dependancies have top level statements |
22:42:55 | FromDiscord | <Arathanis> Current job uses some C and C++ and I'd like to try introducing a language with a little less... character noise |
22:50:25 | * | henistein joined #nim |
22:53:49 | * | henistein left #nim (#nim) |
22:59:48 | FromDiscord | <Recruit_main707> defining a main function for the dll and then calling NimMain there wouldnt work? |
23:00:13 | FromDiscord | <Recruit_main707> its been so long since i messed with dlls x) |
23:00:16 | FromDiscord | <Elegantbeef> IIRC nim main is created after all other code is declared so the C compiler wont like it |
23:01:08 | FromDiscord | <Recruit_main707> i have done similar stuff with dll injection for sure, i think that would work |
23:02:09 | FromDiscord | <Elegantbeef> Well i've never made a Nim system library so do not know |
23:02:39 | FromDiscord | <Arathanis> yeah NimMain doesnt seem to be available inside the nim file |
23:03:04 | FromDiscord | <Recruit_main707> you need to declare it manually |
23:03:06 | FromDiscord | <Recruit_main707> yeah |
23:03:21 | FromDiscord | <Arathanis> but beef's suggestion fo using `--gc:orc --d:useMalloc` obviates me from needing to call NimMain or link to nimrtl |
23:03:41 | FromDiscord | <Elegantbeef> Well that was a quote of araq in that forum post, dont look at me |
23:04:14 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3VKq |
23:21:20 | nrds | <Prestige99> What's the modulus operator for floats? |
23:21:37 | FromDiscord | <Recruit_main707> `mod` iirc |
23:21:45 | FromDiscord | <Recruit_main707> nvm |
23:22:00 | FromDiscord | <Elegantbeef> `import std/math` |
23:29:31 | FromDiscord | <Recruit_main707> `HINSTANCE = "int" in nim`↵`LPVOID = "pointer" in nim`↵`DWORD = "uint32" in nim`↵`WINBOOL = "int32" in nim` |
23:31:02 | nrds | <Prestige99> Why am I not seeing that for floats? |
23:31:37 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/math.html#mod%2Cfloat32%2Cfloat32 |
23:32:09 | nrds | <Prestige99> huh, weird |
23:41:03 | * | Kiori quit (Quit: Leaving) |