<< 21-04-2022 >>

00:21:09FromDiscord<Alea> take a perf hit for including the var in the loop?
00:21:10FromDiscord<Alea> sent a code paste, see https://play.nim-lang.org/#ix=3VFc
00:21:20FromDiscord<Elegantbeef> Nope
00:23:47FromDiscord<Elegantbeef> Procedures grow the stack when they're called for all their parameters
00:24:45FromDiscord<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:19FromDiscord<Elegantbeef> you want `div`
00:26:13FromDiscord<Elegantbeef> I could be wrong though i guess
00:26:57FromDiscord<Elegantbeef> The reason it's ambiguous though is cause it's a specified `int64` and there are `float` overloads
00:27:13FromDiscord<Elegantbeef> It cannot be reasoned which is the most accurate
00:27:17FromDiscord<Elegantbeef> It's a weird dispatch thing in nim but it's not like `i64` is the end of the world
00:27:47FromDiscord<huantian> I don't think it works with two int64s either?
00:27:55FromDiscord<Elegantbeef> Yea there is one defined
00:28:19FromDiscord<Elegantbeef> !eval echo 10i64 / 3i64
00:28:21NimBotCompile failed: /usercode/in.nim(1, 12) Error: type mismatch: got <int64, int64>
00:28:42FromDiscord<Elegantbeef> Oh sorry it's `int / int`
00:28:44FromDiscord<Elegantbeef> Lol
00:28:52FromDiscord<huantian> silly beef
00:29:11FromDiscord<Elegantbeef> it's purely for things like `2 / 3`
00:34:33FromDiscord<Elegantbeef> Fuck i've hit a really werid closure bug
00:37:29FromDiscord<Elegantbeef> It might just be a bug i made
00:39:31FromDiscord<Elegantbeef> Yep it's just a me bug, nice!
00:45:32FromDiscord<Elegantbeef> How the hell is sequtils faster than a closure iterator
00:46:32FromDiscord<huantian> dang i guess iterators were a bad idea
00:46:39FromDiscord<huantian> lazy evaluation is dead
00:47:00FromDiscord<Elegantbeef> The worst part is i'm doing everything possible to increase performance
00:48:24FromDiscord<huantian> what exactly causes the slwodown?
00:49:14FromDiscord<Elegantbeef> I'm, thinking with nested closures it's copying the data
00:49:24FromDiscord<Elegantbeef> instead of moving it
00:49:38FromDiscord<Elegantbeef> That's like the only reason i can think that it's twice as slow as an inline iterator
00:49:58FromDiscord<Elegantbeef> I have to test something now to see that hypothesis
00:50:05FromDiscord<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:48FromDiscord<Elegantbeef> Perhaps
00:55:21FromDiscord<ajusa> are you still counting words?
00:55:34FromDiscord<Elegantbeef> Nope
00:55:39FromDiscord<Elegantbeef> I won that in 3 seconds and carried on
00:55:58FromDiscord<ajusa> what are you optimizing then?
00:56:07FromDiscord<Elegantbeef> Closure iterators
00:56:21FromDiscord<ajusa> also V is faster than Nim according to techempower benchmarks
00:56:35FromDiscord<Elegantbeef> Cool i can also do dumb shit in V
00:57:03FromDiscord<ajusa> (granted the v implementation is just wrapping two C libraries from another framework in the top 20)
00:57:37FromDiscord<Elegantbeef> Basically i'm writting closure functionality and as such want to get closest to pure inline as i can
00:57:48FromDiscord<ajusa> ah okay
00:57:49FromDiscord<Elegantbeef> Right now i'm \~2x slower but much faster than otherwise possible
01:00:09FromDiscord<Elegantbeef> Perhaps it's the pointer procs that's the issue
01:00:30FromDiscord<Elegantbeef> Or maybe not, just took 1ms off by making the iterator functions take a `sink` and moved manually
01:00:40FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/966503706814193674/image.png
01:00:43FromDiscord<Elegantbeef> Yes this is ideal iterator code
01:02:15FromDiscord<huantian> how much is 1ms out of the total time?
01:02:33FromDiscord<Elegantbeef> It's around 12ms presently
01:05:19FromDiscord<Elegantbeef> And you cannot return a `var iterator`
01:05:21FromDiscord<Elegantbeef> So fuck yea!
01:08:59FromDiscord<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:42FromDiscord<Elegantbeef> Seems clang really hates moving closures
01:22:01FromDiscord<huantian> nice the ix fix seems to work I won't have to copy my code before I share to ix now
01:22:41FromDiscord<Elegantbeef> You know you could just hit ctrl + z?
01:22:48FromDiscord<huantian> wait that works?
01:22:55FromDiscord<Elegantbeef> Yes that does
01:23:07FromDiscord<Elegantbeef> And it worked properly with the bad upload
01:31:55FromDiscord<ajusa> I can't figure out how to benchmark httpbeast using hottie - if I kill the program, hottie never outputs
01:32:06FromDiscord<ajusa> and httpbeast doesn't have a way to kill itself
01:32:13FromDiscord<Elegantbeef> You need to terminate the program internally
01:32:26FromDiscord<Elegantbeef> make a request that calls a `quit(1)`
01:32:54FromDiscord<ajusa> that doesn't work, httpbeast just keeps on running I believe
01:33:14FromDiscord<Elegantbeef> What the fuck
01:33:46FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3VFp
01:34:05FromDiscord<ajusa> https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L553
01:34:54FromDiscord<Elegantbeef> I dont know what to say, try callgrind instead
01:36:22*xet7 quit (Remote host closed the connection)
01:37:10FromDiscord<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:39FromDiscord<ajusa> that worked fine, though it didn't really help me find places to optimize
01:53:02FromDiscord<ajusa> majority of the time is spent in syscalls and allocation seems like
01:53:14FromDiscord<Elegantbeef> Well there you go
01:53:22FromDiscord<Elegantbeef> Remove allocations 😛
01:53:50FromDiscord<ajusa> "an extra alloc is death"
01:54:00FromDiscord<ajusa> - disruptek
01:55:24FromDiscord<Elegantbeef> If it uses string slice replace with `toOpenArray` if possible
01:55:50FromDiscord<Elegantbeef> Also did you run the profiler on release with arc?
02:12:25FromDiscord<ajusa> I did not, I probably should do that
02:23:31FromDiscord<ajusa> apparently https://github.com/dom96/httpbeast/blob/5202b4c67ad2ed86346e2c35ae168f6f7af30e57/src/httpbeast.nim#L252-L253 is fairly expensive
02:26:15FromDiscord<leorize> have you profiled the thing?
02:29:16FromDiscord<Elegantbeef> That's quite an elaborate `.add`
02:30:08FromDiscord<Elegantbeef> https://nim-lang.org/docs/strbasics.html#add%2Cstring%2CopenArray%5Bchar%5D replace with this and it's less ugly atleast
02:31:14FromDiscord<ajusa> yes leorize, looking at it in kcachegrind now
02:31:21FromDiscord<ajusa> though I'm not that experienced with this tool
02:31:30FromDiscord<leorize> I'd recommend `perf`
02:32:50FromDiscord<leorize> cachegrind (if you turn all the tracing on), is simply too slow to meaningfully capture contested location accurately
02:33:59FromDiscord<ajusa> well I'll try it, haven't used perf in a few years
02:34:05FromDiscord<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:09FromDiscord<leorize> https://profiler.firefox.com/docs/#/./guide-perf-profiling
02:36:49FromDiscord<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:25FromDiscord<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:23FromDiscord<ajusa> also wow with that call graph option I went from 1mb of data to 200mb
02:39:52FromDiscord<ajusa> but there appears to be a lot more detail in the report
02:39:52FromDiscord<leorize> don't forget the conversion step \:P
02:40:16FromDiscord<leorize> and yes, the firefox profiler should be usable to visualize the data
02:40:16FromDiscord<ajusa> I did run that step, the file size went up so I assumed it worked
02:41:39FromDiscord<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:26FromDiscord<ajusa> huh now it works for some reason
02:45:28*arkurious quit (Quit: Leaving)
02:50:01FromDiscord<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:08FromDiscord<ajusa> (edit) "calls" => "lines"
02:53:25FromDiscord<leorize> it will help you figure out where to focus on in your cachegrind data, though
03:10:00FromDiscord<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:06FromDiscord<grubarb> Hello, is there a good way to convert a string to seq[byte]?
03:13:24FromDiscord<Elegantbeef> you can `cast[seq[byte]](myString)` or do `toOpenArrayByte`
03:14:38FromDiscord<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:08FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/19736 this is funny
04:49:51FromDiscord<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:53FromDiscord<Yardanico> but then it's UB
04:50:20FromDiscord<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:24FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/966561518554587147/unknown.png
04:50:31FromDiscord<Yardanico> ah wait not this code
04:50:47FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/966561614197305354/unknown.png
04:51:23FromDiscord<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:31rockcaveraYardanico, it returns in eax as the return value of testval is int
04:54:40FromDiscord<Yardanico> I know
04:55:16FromDiscord<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:06FromDiscord<huantian> so you should have to say `() => 5.0` instead of `() => 5`
04:58:10FromDiscord<Yardanico> yes
04:58:18FromDiscord<Yardanico> but the compiler should've rejected it
04:58:26FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/16906 found the older issue about the same thing so closed it as duplicate
04:59:17FromDiscord<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:04FromDiscord<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:14FromDiscord<treeform> In reply to @Patitotective "https://github.com/treeform/pixie/issues/412 👀": I answered you in the issue.
05:28:51FromDiscord<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:25FromDiscord<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:41FromDiscord<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:09FromDiscord<Rika> Some people don’t care too much about whether it is native Nim or not
05:45:19FromDiscord<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:38FromDiscord<Yardanico> In reply to @treeform "I hate it": well, it's not always as bad
05:46:45FromDiscord<Yardanico> for things like zstd you can link it, and that package just links it by default
05:46:53FromDiscord<Yardanico> so even if it's not "native nim" it's not really that bad
05:46:59FromDiscord<Yardanico> but yeah, pure-nim is preferred of course
05:47:07FromDiscord<Yardanico> unless it's much more inferior to the other choices
05:48:11FromDiscord<treeform> If somelib included the C sources its usually fine.
05:49:09FromDiscord<treeform> I also like the idea of snappy - its such a simple algorithm
05:49:22FromDiscord<treeform> zstd is massive! huge!
05:50:06FromDiscord<treeform> There is just this simplicity that attracts me to snappy and makes we run a way from zstd...
05:50:18FromDiscord<treeform> (edit) "we" => "me"
06:12:51NimEventerNew 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:29FromDiscord<JSONBash> is there a way I can prevent a copy using ARC/ORC?
06:42:43FromDiscord<Elegantbeef> make `=copy` an error
06:43:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-nimeqcopy-hook
06:43:45FromDiscord<JSONBash> thank you thats what I was looking for
07:01:42*PMunch joined #nim
07:03:19*gsalazar joined #nim
07:30:28PMunchtreeform, I was actually looking at zippy yesterday
07:30:57PMunchHave to do some compression for work
07:31:25PMunchI'm looking into pre-shared dictionary compression
07:32:15PMunchAnd 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:50PMunchThe model could of course then be much bigger than normal, which creates an interesting situation
07:32:52FromDiscord<Rika> Isn’t that just LZ
07:33:58PMunch@Rika, I don't think so?
07:34:53PMunchThis is what I've been using thus far: https://github.com/gtoubassi/femtozip
07:36:15FromDiscord<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:35FromDiscord<Elegantbeef> you can do `templateParam: name`
07:36:54PMunchIt 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:54PMunch@luteva, what have you tried? IIRC this is pretty straight forward to do
07:39:00FromDiscord<luteva> i just need an easy example to have a look at.
07:39:35FromDiscord<Elegantbeef> `template doThing(a: proc()) = a()`
07:40:33FromDiscord<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:37YardanicoPMunch: by the way, is there a reason why you chose to convert all C names into lowercase + capitalized string?
08:02:03PMunchI assume you're talking about Futhark?
08:02:06Yardanicoyeah
08:02:23PMunchWell it goes through a renaming scheme
08:03:18PMunchThe 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:43PMunchNot quite sure what you mean by capitalized string though
08:03:53Yardanicoah yeah that was just my mistake, I see you just preserve the original casing
08:04:20PMunchOh for the importc statements, yeah those have to keep the original casing
08:04:41Yardanicobut I wonder if something can be done to make the generated nim names a bit more readable
08:04:46PMunchThis is essentially the name sanitizer: https://github.com/PMunch/futhark/blob/master/src/futhark.nim#L48-L67
08:05:06PMunchWell most of them should be possible to write the same way as the C names
08:05:35FromDiscord<Elegantbeef> I dont recall pmunch do you allow manual namespace overrides? 😄
08:05:47PMunchnamespace overrides?
08:06:01FromDiscord<Elegantbeef> yea remove the dumb C namespacing
08:06:08PMunchYou can pass your own `renameCallback`
08:06:19FromDiscord<Elegantbeef> Ah ok
08:06:30PMunchI've used this in the past to strip the C library name off-of the procedures
08:06:57PMunchYou could also write something more complex so that it removes type names as well, and just use overloading
08:07:30PMunchThe 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:38YardanicoPMunch: yeah I know, i was just talking about how autosuggestions (e.g. nimsuggest) will use the default casing
08:07:52Yardanicobecause even though nim is partially case insensitive, no tools take advantage of that :(
08:07:52PMunchYeah that's a bit annoying..
08:08:17PMunchAlso the documentation and such shows everything with the numbers..
08:08:22FromDiscord<Yardanico> yeah
08:08:29FromDiscord<Yardanico> by the way, does anyone know the reason why `dec` and `inc` are implemented as magics in the compiler?
08:08:45FromDiscord<Yardanico> so the backends implement them separately from normal arithmetics
08:08:46FromDiscord<Elegantbeef> I dont know why 99% of the magics are magic
08:09:00*jjido joined #nim
08:09:23PMunchI'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:35FromDiscord<Yardanico> ooh, nice
08:16:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:19:07PMunchThe 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:37PMunchTurns 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:48PMunchSo maybe I should just rethink the whole system
08:21:18PMunchPass 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:49FromDiscord<Yardanico> by the way, found another issue, although it doesn't affect me as I don't use the related functions
08:25:00FromDiscord<Yardanico> but it seems like futhark doesn't understand "#define SOMENAME long" as a type alias
08:25:25FromDiscord<Yardanico> so for "#define LRESULT long" it made `long` a distinct object and then defined Lresult as a type alias to that
08:25:38PMunchAh..
08:25:47PMunchYeah the #define support is a bit lackluster..
08:26:42PMunchIt 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:52FromDiscord<Yardanico> yeah, apparently sciter also does this for double
08:28:03FromDiscord<Yardanico> "#define FLOAT_VALUE double" heh
08:29:14FromDiscord<Yardanico> but anyway, no rush in fixing these :) just wanted to share things i found
08:29:35PMunchWould you mind creating a GitHub issue so I don't forget?
08:29:49FromDiscord<Yardanico> yeah sure
08:31:40FromDiscord<Yardanico> should I also open an issue about `ptr` for procedure pointers?
08:32:08PMunchSure
08:32:42PMunchThat's still weird to me, I distinctly remember fixing that..
08:32:53PMunchMaybe it's some edge-case
08:33:33FromDiscord<Yardanico> @PMunch maybe because those are inside of structs?
08:33:43FromDiscord<Yardanico> e.g. sciter has a struct that has a lot of function pointer fields
08:34:01FromDiscord<Yardanico> and some of these functions have functions in their arguments
08:34:14PMunchI have a similar thing in another project which works fine
08:34:14FromDiscord<Yardanico> i guess I can just test by writing my own header
08:34:41PMunchA dynamic library where I pass a structure with function pointers
08:37:56FromDiscord<Yardanico> @PMunch hmm, then maybe because the ones that still have `ptr` are defined as separate C types?
08:38:19PMunchOh, that's possible
08:38:38PMunchIf you could create a minimal example that'd be perfect
08:39:01FromDiscord<Yardanico> https://github.com/PMunch/futhark/issues/30
08:40:06PMunchPerfect
08:43:13FromDiscord<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:29FromDiscord<Yardanico> it's not about "C interfaces"
08:43:35FromDiscord<Yardanico> it's all about calling conventions, ABIs and such
08:43:55FromDiscord<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:56FromDiscord<Yardanico> it's just a set of agreements on registers are used for arguments, how is data stored (what order), etc
08:43:58FromDiscord<Elegantbeef> The C ffi is more just a generalize language
08:44:19FromDiscord<Yardanico> for example the main ABI for Linux is https://wiki.osdev.org/System_V_ABI
08:44:36FromDiscord<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:50FromDiscord<Phil> Is that the type of thing of which there are like 100+ different ones?
08:45:22FromDiscord<Elegantbeef> Though in the case you use Nim's C ffi that compiles a file it's pretty important it's C 😛
08:46:26FromDiscord<Elegantbeef> Also yes two languages talking to eachother can happen with sockets 😛
08:46:43FromDiscord<Elegantbeef> Not that it makes it overly useful, but pedantry is pedantry
08:47:33FromDiscord<Yardanico> i mean RPC is a thing and it's quite popular nowadays in languages like Go
08:48:04FromDiscord<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:44FromDiscord<Elegantbeef> The latency for a proc call would be quite comical
08:49:22FromDiscord<Yardanico> but but microservices!!
08:49:43FromDiscord<Elegantbeef> I'm sorry to hear that
08:49:56FromDiscord<Yardanico> lol
08:50:58NimEventerNew 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:03NimEventerNew thread by Daef: Brogrammer uptick, see https://forum.nim-lang.org/t/9121
09:09:39FromDiscord<Yardanico> wat
09:10:00FromDiscord<Elegantbeef> People are using bro
09:14:42PMunchI've noticed that in this live chat as well
09:14:54PMunchMaybe Nim is finally taking off in America
09:14:55FromDiscord<Elegantbeef> Bro
09:15:14FromDiscord<Elegantbeef> I hope not that place is full of idiots
09:15:21PMunchOr maybe "bro" has spread to Europe *shudders*
09:17:21FromDiscord<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:26PMunchSomeone do the same "bro" search through the IRC logs: https://irclogs.nim-lang.org/21-04-2022.json
09:23:02FromDiscord<Yardanico> yeah, time to update my ircdb :P
09:40:36PMunchHmm, I wonder if I could create something with autotemplates that does automatic callbacks
09:40:42PMunchI think it should be possible
09:46:02FromDiscord<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:22FromDiscord<dom96> also calling `quit` should work just fine for httpbeast
09:47:37FromDiscord<dom96> another thing to try is to play V at their own game and wrap pico to create pico.nim 😄
09:49:25FromDiscord<SirElephant> ok so installing nim isn't working and i wat to start fresh but idk how to uninstall it
09:50:04FromDiscord<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:09FromDiscord<SirElephant> how do i do dis?
09:50:21FromDiscord<dom96> In reply to @SirElephant "ok so installing nim": how did you install it?
09:50:32FromDiscord<SirElephant> In reply to @dom96 "how did you install": finish.exe
09:50:43FromDiscord<SirElephant> but nim is not recognised blah blah
09:50:46FromDiscord<dom96> in that case I have no idea 🙂
09:51:09FromDiscord<dom96> As the author of choosenim I'd recommend it, but maybe you've tried it already and it didn't work?
09:51:26FromDiscord<SirElephant> wut is choosenim?
09:52:04FromDiscord<dom96> https://github.com/dom96/choosenim/#installation
09:52:48FromDiscord<dom96> note that Nim gets flagged by many anti-viruses on Windows, so that could be a source of your problems
09:52:59FromDiscord<dom96> (these flags are false positives)
09:53:11FromDiscord<SirElephant> bruh i am new to nim and haven't even written a line in it. idk what's going on here
09:53:29FromDiscord<SirElephant> In reply to @dom96 "note that Nim gets": thatsthereason
09:53:47FromDiscord<SirElephant> i want to "re-download" it
09:54:00FromDiscord<SirElephant> but to "re-download" in need to "de-download"
09:54:42FromDiscord<dom96> just try following the instructions I linked
09:55:02FromDiscord<dom96> if you're willing to use WSL as well, it makes this much easier
09:55:41FromDiscord<System64 ~ Flandre Scarlet> When I do↵something.anArray = myArray↵Does it copy the entire array?
09:56:25FromDiscord<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:38FromDiscord<SirElephant> In reply to @frobnicate "<@856412455507984404> what's the name": nope
09:56:49FromDiscord<SirElephant> its only in simple letters
09:57:20FromDiscord<frobnicate> Alright, then I'd try choosenim, like dom suggested. It handles everything
09:58:01FromDiscord<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:21FromDiscord<SirElephant> so i can use nimble but not nim
09:59:13FromDiscord<SirElephant> so i haveto uninstall everything for it to work right?
09:59:18FromDiscord<SirElephant> (edit) "haveto" => "have to"
09:59:48FromDiscord<dom96> feel free to just delete the folder that nimble.exe resides in as well as the folder containing the Nim sources
09:59:58FromDiscord<SirElephant> hmmmm
10:00:17FromDiscord<dom96> finish.exe shouldn't create any entries in Windows' registry or anything like that, so deleting files should be fine
10:00:42FromDiscord<SirElephant> great it's workign
10:00:45FromDiscord<SirElephant> thenks
10:00:59FromDiscord<SirElephant> and can we install choosenim with chocolatey?
10:01:28FromDiscord<frobnicate> I usually just get the zip
10:01:42FromDiscord<dom96> maybe, but I wouldn't. If you've got chocolatey couldn't you just install Nim using it?
10:01:55FromDiscord<SirElephant> beeg brain
10:02:33FromDiscord<frobnicate> I still prefer choosenim for switching between versions
10:03:29FromDiscord<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:40FromDiscord<frobnicate> Alright
10:04:00FromDiscord<SirElephant> In reply to @frobnicate "I still prefer choosenim": thenks for the suggestion tho
10:04:41FromDiscord<dom96> chocolatey will likely install nim just fine but might give you an older version
10:04:49FromDiscord<dom96> should be good enough though
10:04:52FromDiscord<SirElephant> In reply to @dom96 "chocolatey will likely install": nope it's 1.6.4
10:05:04FromDiscord<dom96> nice
10:05:36FromDiscord<hmmm> In reply to @Yardanico "apparently <@887269570765791243> has been": you all my bros ❤️
10:08:33FromDiscord<SirElephant> thanks guys i can use nim now
10:08:45FromDiscord<SirElephant> https://tenor.com/view/olsen-twins-thank-you-you-da-best-you-are-the-best-blow-kiss-gif-16197521
10:14:24FromDiscord<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:13FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3VGn
10:27:06*ehmry joined #nim
10:27:10FromDiscord<Rika> No
10:27:14FromDiscord<Rika> Arrays are not pointers
10:31:15FromDiscord<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:37FromDiscord<Rika> If it’s an array only yes I believe so, though lent and sink might change that soon
10:32:44FromDiscord<Rika> I’m not too familiar with lent and sink
11:00:12FromDiscord<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:31FromDiscord<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:31FromDiscord<ajusa> Oh yes, but I forgot about it 😆
11:12:57FromDiscord<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:55PMunchHmm, 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:05PMunchSo 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:37PMunchNow the problem is how I'm going to do the procedure discovery
11:57:15PMunchI could have them called the same and then do some funky generic magic to pick the correct one
11:57:27PMunchOr I could require the getters to have a pragma set on them
11:57:54PMunchSo you could call them whatever you like, but must attach that pragma for them to be recognised
11:57:58PMunchThat's definitely the easiest
11:58:13FromDiscord<ajusa> Yeah, if you have identical type signatures you'll need additional stuff to tell them apart
11:58:32PMunchBut there is no way in Nim to just give me all procedures that returns a specific type right?
11:58:39PMunch@ajusa, of course
12:00:39FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3VGO
12:01:12FromDiscord<ajusa> We'll similar in the sense that it's running code based on a route and filling in a type.
12:02:13PMunchOh nice
12:04:04PMunchI 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:19PMunchHmm, so Nim doesn't appear to have any way to get all procedures or similar..
12:20:14PMunchWell, there are some cursed ways of doing this..
12:20:23PMunch`nim jsondoc` comes to mind :P
12:20:37PMunchOr even something like `macros.parseStmt(readFile("module.nim"))`
12:25:20*slowButPresent joined #nim
12:41:22*duuude joined #nim
12:41:52duuudehi, nim looks cool, have these been fixed? https://gradha.github.io/articles/2015/02/goodbye-nim-and-good-luck.html
12:43:18FromDiscord<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:50FromDiscord<Knedlik> sent a code paste, see https://paste.rs/3bF
12:45:04FromDiscord<Knedlik> I've been trying to fix this for about an hour now
12:45:31FromDiscord<Rika> did you read https://github.com/jjv360/nim-classes
12:45:35FromDiscord<Knedlik> yes
12:45:49FromDiscord<Yardanico> are you sure? :)
12:45:50FromDiscord<Rika> then have you noticed how your code is wrong?
12:46:03FromDiscord<Yardanico> The example in the readme doesn't have a type statement
12:46:05PMunch@Knedlik, methods need to have a `=` before the body
12:46:19FromDiscord<Rika> sent a code paste, see https://paste.rs/zvm
12:46:29FromDiscord<Knedlik> So types can't be a part of classes?
12:46:31FromDiscord<Yardanico> Also what pmunch said
12:46:32PMunchOh, and maybe some other stuff
12:46:48FromDiscord<Rika> sent a code paste, see https://paste.rs/c5c
12:46:53FromDiscord<Yardanico> In reply to @Knedlik "So types can't be": That library is just syntactic sugar for defining types
12:47:03FromDiscord<Yardanico> just define your types outside of the "class" statement
12:47:26FromDiscord<Yardanico> "class" isn't an actual keyword, it's just a macro made by that library
12:47:29FromDiscord<Knedlik> And in the example there are methods with : before the body btw
12:47:30FromDiscord<Rika> you're not supposed to define the type `T` if you're doing `class T` i believe
12:47:40FromDiscord<Knedlik> hmmm
12:47:52FromDiscord<Yardanico> In reply to @Knedlik "And in the example": that's where they have return values
12:48:03FromDiscord<Knedlik> ooooh
12:48:04FromDiscord<Rika> `method calculateSize(): float = return 0`↵` return val^`
12:48:04FromDiscord<Yardanico> I suggest you read Nim basics or tut1 for procedure syntax
12:48:06FromDiscord<Knedlik> makes sense
12:48:34FromDiscord<Knedlik> I did read the beginner tutorial
12:48:34FromDiscord<Yardanico> https://narimiran.github.io/nim-basics/#_declaring_a_procedure
12:49:03FromDiscord<Yardanico> this syntax is the same for all Nim routines
12:49:26FromDiscord<Yardanico> procedures, functions, methods, templates, macros, iterators
12:49:46FromDiscord<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:48FromDiscord<Yardanico> not sure what you mean by "this"
12:51:41FromDiscord<Knedlik> `this.function`, or pass the object currently running the method as the parameter, when type is expected
12:51:43FromDiscord<dom96> In reply to @ajusa "Also I think that": how would it? pico implements it for you, just wrap it lol
12:55:26FromDiscord<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:53FromDiscord<Yardanico> you can also just use locks, but of course it depends on the specific use case
12:56:35FromDiscord<dom96> you need something to manage the memory you are allocating as "shared"
12:56:36FromDiscord<dom96> that is the key
12:59:32FromDiscord<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:53FromDiscord<Yardanico> With --threads:on all ref objects and stuff are allocated on the shared heap
13:00:02FromDiscord<Yardanico> (with arc)
13:00:46FromDiscord<dom96> hm, are you sure? Is there an example that does this?
13:01:24FromDiscord<dom96> You're likely right though. I haven't had a chance to play with arc/orc in depth yet.
13:01:38FromDiscord<Yardanico> yes I'm sure, I tested it before, it just works
13:01:52FromDiscord<Yardanico> don't know if there are examples, but it's easy to test
13:05:22FromDiscord<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:25FromDiscord<Yardanico> that's a known issue
13:07:10FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3VH0
13:07:11FromDiscord<Knedlik> sent a code paste, see https://paste.rs/0Dd
13:07:34FromDiscord<Yardanico> In reply to @Knedlik "Okay, issue from before": can you show the full error message the compiler gives you?
13:07:52FromDiscord<Yardanico> errors shown in the editor can sometimes be incomplete as multiple lines get cut
13:08:35FromDiscord<Knedlik> hmmm, so it doesn't have a problem with it actually... how weird
13:19:46FromDiscord<Knedlik> sent a code paste, see https://paste.rs/ubN
13:20:39FromDiscord<dom96> You passed a variable whose type is `title`
13:20:42FromDiscord<dom96> it wants `Scene`
13:20:49FromDiscord<Yardanico> In reply to @Knedlik "okay, what the hell": `game.scene=` expects something of a Scene type while you passed a `title`
13:21:07FromDiscord<dom96> If that's a type you declared: you should capitalise the first letter
13:21:41FromDiscord<dom96> (probably won't solve your problem, just a nit)
13:21:53FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3VH3
13:22:08FromDiscord<Knedlik> (edit) "https://play.nim-lang.org/#ix=3VH3" => "https://play.nim-lang.org/#ix=3VH4"
13:22:39FromDiscord<Yardanico> `discard` is not for returning stuff
13:22:43FromDiscord<Knedlik> sent a code paste, see https://paste.rs/ARj
13:22:47FromDiscord<Yardanico> it's the same as just "discarding" the value, throwing it away
13:22:52FromDiscord<Knedlik> Yes
13:22:53FromDiscord<Yardanico> maybe what you want is `return`?
13:22:56FromDiscord<Yardanico> in your `init`
13:23:20FromDiscord<Knedlik> I can try
13:23:39FromDiscord<Yardanico> wait, why do you even have `init` and `create` separately in your class
13:24:04FromDiscord<Yardanico> shouldn't you just have `init` ? that's the way nim-classes package does it for `class`
13:24:29FromDiscord<Knedlik> `init` is for class init, `create` is for scene creation
13:25:01FromDiscord<Knedlik> Altho I guess I could merge it
13:26:39FromDiscord<Knedlik> Okay, but still doesn't remove the error
13:26:59FromDiscord<Knedlik> OH WAIT
13:27:52*arkurious joined #nim
13:27:58FromDiscord<Solitude> stop writing java in nim
13:29:05FromDiscord<Knedlik> what?
13:29:26PMunch@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:36FromDiscord<Knedlik> I guess
13:29:50FromDiscord<Knedlik> Yeah, you're right
13:31:56*duuude quit (Ping timeout: 250 seconds)
13:32:08*duuude joined #nim
13:32:09FromDiscord<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:22FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
13:40:25FromDiscord<Knedlik> uhhh
13:41:26FromDiscord<Knedlik> sent a code paste, see https://paste.rs/lAX
13:42:10FromDiscord<Yardanico> you should export newTitleScene
13:42:21FromDiscord<Yardanico> but I don't know if that class library does that
13:42:31FromDiscord<Knedlik> I don't use classes anymore
13:42:52FromDiscord<Yardanico> In reply to @Knedlik "I don't use classes": oh, then for exporting you just add `` to your routine definition
13:43:03FromDiscord<Yardanico> e.g. `proc test(args)` or `method test(args)`
13:43:18FromDiscord<Knedlik> makes sense, thanks
13:43:29FromDiscord<Knedlik> Man, being a beginner sucks
13:44:41*PMunch quit (Quit: Leaving)
13:50:42FromDiscord<Rika> 🤔 LTO breaks pixie
13:52:52FromDiscord<Knedlik> Okay, got it to build...
13:53:12FromDiscord<Knedlik> Thought it would end there?↵`could not load: SDL2.dll`
13:55:07FromDiscord<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:16FromDiscord<Yardanico> In reply to @Rika "🤔 LTO breaks pixie": nice, have a code snippet?
13:55:21FromDiscord<Yardanico> also does it break just with gcc or both gcc and clang?
13:56:10FromDiscord<Knedlik> In reply to @Yardanico "well, you need SDL2.dll,": Like in my game?
13:56:38FromDiscord<Yardanico> ? nimgame2 uses SDL2 for actual rendering/input/etc stuff
13:56:52FromDiscord<Yardanico> you need to have it either: 1) in your PATH 2) next to your game executable
13:57:02FromDiscord<Yardanico> by 1 i mean in a folder that's in your PATH
13:57:02FromDiscord<Knedlik> Oh, that makes sense
13:57:28FromDiscord<Knedlik> Tbh I will rather package it with my game, it's better than users having to have it in their path
14:02:51FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3VHc
14:04:54FromDiscord<Yardanico> In reply to @Rika "just load a png": wow nice, lemme try
14:05:27FromDiscord<Rika> i'm not sure if its an issue with my png, but without LTO it works?
14:06:13FromDiscord<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:35FromDiscord<Knedlik> Hmm, guys any idea where I could get prebuilt runtime libs of SDL GFX?
14:14:44FromDiscord<Yardanico> In reply to @Knedlik "Hmm, guys any idea": https://www.libsdl.org/download-2.0.php
14:15:07FromDiscord<Yardanico> ah gfx
14:15:37*Guest97 joined #nim
14:16:35FromDiscord<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:28FromDiscord<Knedlik> Oh, there's a thing linked by Nimgame, with all this stuff :facepalm:
14:19:43FromDiscord<Knedlik> which still is just a wrapper and doesn't include the dlls...
14:19:46*Guest97 quit (Client Quit)
14:22:09FromDiscord<Knedlik> YES https://github.com/Vladar4/sdl2_nim/blob/master/LINKS.md
14:24:03*fredrikhr quit (Quit: Disconnecting)
14:26:32FromDiscord<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:00FromDiscord<Knedlik> I personally use Visual Studio Code, has great extension for it
14:29:56FromDiscord<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:21reversem3[m]Is there a module to verify an xml format? Like using the dtd to verify the format of an xlm file?
14:31:04FromDiscord<Knedlik> Guys does anyone have experience with↵`Error: unhandled exception: cannot dispatch; dispatcher is nil [NilAccessDefect]`?
14:31:19FromDiscord<Knedlik> I'm like so close to launching my game...
14:31:39reversem3[m]Kind of like jingtrng https://pypi.org/project/jingtrang/
14:33:57*Knedlik joined #nim
14:37:46FromDiscord<enthus1ast> @Knedlik\: at least there is a test for this
14:37:47FromDiscord<enthus1ast> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/tests/method/tnildispatcher.nim
14:38:35Knedlikwhat even is that?
14:38:45FromDiscord<enthus1ast> also this https://github.com/nim-lang/Nim/issues/5599
14:40:45KnedlikI don't think it's in my code
14:41:11KnedlikThe entire program runtime is
14:41:12KnedlikC:\Users\knedl\Documents\GitHub\Beyond-the-Sphere>"out/debug/bts.exe"
14:41:12KnedlikC:\Users\knedl\Documents\GitHub\Beyond-the-Sphere\src\nim\Main.nim(4) Main
14:41:13KnedlikC:\Users\knedl\Documents\GitHub\Beyond-the-Sphere\src\nim\engineInit.nim(10) initEngine
14:41:13KnedlikC:\Users\knedl\Desktop\nimgame2-#devel\nimgame2\nimgame.nim(535) run
14:41:14KnedlikC:\Users\knedl\.choosenim\toolchains\nim-#devel\lib\system\chcks.nim(100) event
14:41:14KnedlikC:\Users\knedl\.choosenim\toolchains\nim-#devel\lib\system\fatal.nim(53) sysFatal
14:41:15KnedlikError: unhandled exception: cannot dispatch; dispatcher is nil [NilAccessDefect]
14:41:19FromDiscord<enthus1ast> i think the issue in this code is that its a ref object but no initialisation
14:41:42FromDiscord<Yardanico> yes
14:41:45FromDiscord<Yardanico> i think so too
14:41:49Knedlikhmmm
14:42:02FromDiscord<Tanguy> Yes, it means you call a method on a nil ref object
14:43:22KnedlikWould anyone of you be nice enough to look at it if I pushed the current version to github?
14:44:14FromDiscord<enthus1ast> what happens here\: engineInit.nim(10) initEngine ?
14:44:19FromDiscord<Tanguy> I can tell you that on line 535 of nimgame.nim, you call a method on something which is nil
14:45:02Knedlikline 10 on engineinit is game.run
14:45:16FromDiscord<enthus1ast> is game nil?
14:45:28Knedlikgame is equal to newGame(), as per nimgame docs
14:45:45KnedlikHope you're not getting annoyed at my noob questions lol
14:46:07FromDiscord<enthus1ast> never used nimGame unfortunately
14:48:40FromDiscord<enthus1ast> https://github.com/Vladar4/nimgame2/blob/1fbfb9b2b927acafa9e85d8cb58a657d5afed0cb/nimgame2/nimgame.nim#L535↵ game.fScene.event(event)
14:49:47FromDiscord<enthus1ast> and scene is↵ Scene\ = ref object of RootObj
14:49:53FromDiscord<enthus1ast> so maybe your scene is nil
14:50:24KnedlikI do have game.scene = newTitleScene()
14:50:52FromDiscord<enthus1ast> newTitleScene() is your code?
14:50:57Knedlikproc newTitleScene*(): TitleScene =
14:50:57Knedlik    init(new TitleScene)
14:51:30KnedlikYes, it's in my titleScene.nim file
14:52:08FromDiscord<enthus1ast> sent a long message, see https://paste.rs/AR6
14:52:37Knedlikwhere?
14:52:50FromDiscord<enthus1ast> instead of init(new TitleScene)
14:53:42Knedliktype mismatch: got 'typedesc[TitleScene]' for 'TitleScene' but expected 'TitleScene = ref TitleScene:ObjectType'
14:53:56FromDiscord<enthus1ast> TitleScene() ?
14:54:00FromDiscord<enthus1ast> () ?
14:54:03Knedlikyes
14:54:09Knedlikno
14:54:45KnedlikNow it works, but outputs just a black window, so I assume it didn't init the scene
14:55:00FromDiscord<enthus1ast> is init also your code?
14:55:04Knedlikyes
14:55:15Knedlikproc init(scene: TitleScene) =
14:55:15Knedlik  Scene(scene).initScene()
14:55:16Knedlik  scene.background = newTextureGraphic()
14:55:16Knedlik  discard scene.background.load("data/gfx/BtS-Background.png")
14:55:19FromDiscord<enthus1ast> then maybe do\:↵↵result = TitleScene()↵init(result)
14:55:58Knedlikstill the same
14:56:35Knedlikhmm I have an idea
14:56:46KnedlikI could render the scene
14:58:34KnedlikStill nope
14:59:23FromDiscord<enthus1ast> but at least it does not crash any more
15:00:38FromDiscord<enthus1ast> you discard the scene.background.load, does it maybe return an error or something?
15:00:57Knedliki can try echo it
15:01:29Knedlikreturns true
15:01:36KnedlikSo I assume it's okay
15:04:58*perro quit (Ping timeout: 260 seconds)
15:13:15KnedlikI didn't implement method show()... well atleast I'm a lot closer
15:13:24KnedlikThank you for your help
15:13:30*Knedlik quit (Quit: Client closed)
15:24:09*kenran joined #nim
15:45:55duuudehow much nim is used in serious production? should I worry about it vanishing into air 10 years later?
15:50:16duuudeis it easy to link a function written in nim to C?
15:57:54FromDiscord<huantian> Not too hard
16:10:49FromDiscord<tandy> a good amount is used in production↵(<@709044657232936960_duuude=5b=49=52=43=5d>)
16:11:03FromDiscord<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:34FromDiscord<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:56FromDiscord<SirOlaf> Tried calling .toDeque on something and got that error
16:27:45FromDiscord<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:49FromDiscord<treeform> Future of compression might be... you train a Neural network "dictionary" on your specific data.
16:29:17FromDiscord<treeform> For both lossless and lossy compression
16:29:27*Gustavo6046 joined #nim
16:35:38FromDiscord<enthus1ast> imho zstd can use a precomputed dicitonary
16:36:06FromDiscord<enthus1ast> zstd --train
16:36:38*duuude joined #nim
16:36:40FromDiscord<enthus1ast> i can imagine that this makes sense for lot of small datasets
16:37:08FromDiscord<enthus1ast> ah and lz4 can aswell
16:59:35FromDiscord<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:00FromDiscord<Phil> And that's why I just wrote compile time procs with asserts (for now) instead of concepts
17:20:20FromDiscord<Phil> (edit) "wrote" => "write"
17:24:39FromDiscord<hvs_013> Is nim good for mobile game dev
17:24:39FromDiscord<hvs_013> like
17:24:39FromDiscord<hvs_013> porting
17:24:40FromDiscord<hvs_013> games to made with nim
17:24:40FromDiscord<hvs_013> to android
17:24:43FromDiscord<hvs_013> games to made innim
17:24:43FromDiscord<hvs_013> games to made in nim
17:27:12*pro joined #nim
17:27:24*pro quit (Client Quit)
17:30:37FromDiscord<Yardanico> it depends
17:30:48FromDiscord<Yardanico> if you just want to make a mobile game, nim is far from the easiest choice
17:31:19FromDiscord<hvs_013> like
17:31:25FromDiscord<hvs_013> nim
17:31:25FromDiscord<hvs_013> compiles
17:31:29FromDiscord<hvs_013> to c/c++
17:31:31FromDiscord<hvs_013> so
17:31:32FromDiscord<hvs_013> well
17:31:35FromDiscord<hvs_013> i can
17:31:39FromDiscord<hvs_013> use it in android studio
17:31:41FromDiscord<hvs_013> kinda
17:31:47FromDiscord<hvs_013> I am beginner
17:31:48FromDiscord<hvs_013> in nim
17:32:00FromDiscord<hvs_013> and sorry for my english
17:32:03FromDiscord<Yardanico> can you please take a bit of time to write your messages so you don't spam the chat :)
17:32:21FromDiscord<hvs_013> ok↵(@Yardanico)
17:32:22FromDiscord<hvs_013> sorry
17:32:38*vicfred joined #nim
17:33:35FromDiscord<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:47FromDiscord<hvs_013> Are there any android games made in nim published on google play store
17:40:12FromDiscord<Solitude> In reply to @hvs_013 "Are there any android": super netwalk deluxe
17:40:58FromDiscord<hvs_013> made in game
17:40:58FromDiscord<hvs_013> it's a game↵(@Solitude)
17:41:09FromDiscord<hvs_013> plz send link
17:42:40FromDiscord<Yardanico> https://play.google.com/store/apps/details?id=net.impbox.nico&hl=en&gl=US
17:42:45FromDiscord<Yardanico> it's made with https://github.com/ftsf/nico
17:42:59FromDiscord<Yardanico> there are also two mobile games made with godot + nim
17:43:13FromDiscord<Yardanico> https://frayhem.com/en/ https://summonage.com/en/
17:43:47FromDiscord<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:55NimEventerNew 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:56FromDiscord<Ayy Lmao> Is there a way to lazy initialize global vars?
19:51:40nrds<Prestige99> if it's a var you can change it any time, do you want it to be a const or something?
19:52:45FromDiscord<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:18nrds<Prestige99> sounds like it'll have to be a var, then
19:54:30FromDiscord<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:44FromDiscord<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:52FromDiscord<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:23FromDiscord<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:29FromDiscord<!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:38FromDiscord<b4mbus> how would I go about clearing a sequence?
21:33:53FromDiscord<b4mbus> there's no `clear`, right? I'd have to `del` every item or assign an empty sequence?
21:33:56FromDiscord<Elegantbeef> `setLen` or reseting all entries to default?
21:34:14FromDiscord<b4mbus> clearing like clearing, deleting all items
21:34:17FromDiscord<b4mbus> so setLen I suppose
21:35:09FromDiscord<Elegantbeef> yep
21:35:26FromDiscord<Elegantbeef> clearing is kinda ambiguous talking about growable arrays to be fair
21:44:08*zgasma quit (Remote host closed the connection)
21:55:47Kiorisetlen might have issues: https://github.com/nim-lang/Nim/issues/19728
21:56:49FromDiscord<Elegantbeef> Yea but in this case we're talking about `setLen(0)` then growing which reuses the allocation and is generally preferred\\
22:15:12FromDiscord<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:07FromDiscord<exelotl> are you using --gc:arc / orc?
22:24:20FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3VKj
22:24:37FromDiscord<Arathanis> large values of X and/or Y can cause segfaults
22:25:50FromDiscord<Recruit_main707> you need to call `NimMain()` manually so that gc is started, i guess thats the issue here
22:26:01FromDiscord<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:18FromDiscord<exelotl> In reply to @Recruit_main707 "you need to call": ah yeah that'd be it
22:26:24FromDiscord<Arathanis> In reply to @Recruit_main707 "you need to call": Oh? is that something I need to import?
22:26:58FromDiscord<Arathanis> or I nede to call that from the dll?
22:27:35FromDiscord<Recruit_main707> i dont remember how you did it, but NimMain is a function the compiler automatically generates
22:27:49FromDiscord<Recruit_main707> but it is not called since it is a dll
22:28:09FromDiscord<Arathanis> well hot damn, that worked
22:28:29FromDiscord<Recruit_main707> was it exported? nice, i didnt remember
22:28:30FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3VKl
22:28:41FromDiscord<Arathanis> thank you
22:28:43FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=3VKl" => "https://play.nim-lang.org/#ix=3VKm"
22:29:07FromDiscord<Arathanis> now i need to figure out if I can statically link nimrtl...
22:29:16FromDiscord<Arathanis> or just ignore it but that seems like a not good idea
22:29:20FromDiscord<Arathanis> even though it wworks w/o
22:29:52FromDiscord<exelotl> if you use `--gc:arc` (or orc) you shouldn't need nimrtl, I think
22:30:31FromDiscord<Arathanis> ok
22:31:42rockcaveraAranthanis see this https://forum.nim-lang.org/t/8897
22:32:07FromDiscord<Elegantbeef> Damn the matrix bridge died yet again
22:32:33FromDiscord<Elegantbeef> At this point i should yell at tandy to make one 😄
22:34:06FromDiscord<Arathanis> `NimMain` seems Idempotent too
22:34:40rockcaveraas far as i know, there is no need to call NimMain, as when loading the dll, NimMain is already executed.
22:34:55rockcaveraat least on Windows
22:35:10FromDiscord<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:19FromDiscord<Elegantbeef> I think you're still supposed to call it, it might be wrappedin `once`
22:35:36rockcaveraorc also seems to need NimMain to work correctly with cyclic references
22:36:32FromDiscord<Elegantbeef> I dont recall if that's true for orc
22:36:44FromDiscord<Elegantbeef> You should call it anyway for any toplevel statements
22:39:20FromDiscord<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:45rockcaveranimrtl as far as I understand there can only be one instance running. Better not link statically.
22:40:10FromDiscord<Elegantbeef> Dont think so since the main proc is generated after all the code
22:40:39FromDiscord<Arathanis> In reply to @rockcavera "nimrtl as far as": just sucks to have to ship with a dependency
22:40:55FromDiscord<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:00FromDiscord<Arathanis> which as far as I can tell needs to be in /usr/lib/
22:41:25rockcaveraaraq hinted that orc/arc doesn't need nimrtl
22:41:48FromDiscord<Arathanis> In reply to @Elegantbeef "> My advice is": brilliant, this works. dont even need to call `NimMain`
22:42:07rockcavera=)
22:42:08FromDiscord<Elegantbeef> On linux you can use `rpath` or make an appimage like it's 2022
22:42:37FromDiscord<Elegantbeef> Well you need to call nim main if any of your dependancies have top level statements
22:42:55FromDiscord<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:48FromDiscord<Recruit_main707> defining a main function for the dll and then calling NimMain there wouldnt work?
23:00:13FromDiscord<Recruit_main707> its been so long since i messed with dlls x)
23:00:16FromDiscord<Elegantbeef> IIRC nim main is created after all other code is declared so the C compiler wont like it
23:01:08FromDiscord<Recruit_main707> i have done similar stuff with dll injection for sure, i think that would work
23:02:09FromDiscord<Elegantbeef> Well i've never made a Nim system library so do not know
23:02:39FromDiscord<Arathanis> yeah NimMain doesnt seem to be available inside the nim file
23:03:04FromDiscord<Recruit_main707> you need to declare it manually
23:03:06FromDiscord<Recruit_main707> yeah
23:03:21FromDiscord<Arathanis> but beef's suggestion fo using `--gc:orc --d:useMalloc` obviates me from needing to call NimMain or link to nimrtl
23:03:41FromDiscord<Elegantbeef> Well that was a quote of araq in that forum post, dont look at me
23:04:14FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3VKq
23:21:20nrds<Prestige99> What's the modulus operator for floats?
23:21:37FromDiscord<Recruit_main707> `mod` iirc
23:21:45FromDiscord<Recruit_main707> nvm
23:22:00FromDiscord<Elegantbeef> `import std/math`
23:29:31FromDiscord<Recruit_main707> `HINSTANCE = "int" in nim`↵`LPVOID = "pointer" in nim`↵`DWORD = "uint32" in nim`↵`WINBOOL = "int32" in nim`
23:31:02nrds<Prestige99> Why am I not seeing that for floats?
23:31:37FromDiscord<ElegantBeef> https://nim-lang.org/docs/math.html#mod%2Cfloat32%2Cfloat32
23:32:09nrds<Prestige99> huh, weird
23:41:03*Kiori quit (Quit: Leaving)