<< 05-03-2022 >>

00:01:15*Gustavo6046 quit (Remote host closed the connection)
00:01:35*Gustavo6046 joined #nim
00:28:22FromDiscord<Waldecir Santos> I've an object and I've created a `proc `$`(obj: var MyObject): string =` and it works fine if the object is declared with `var` but it dosen't work if the object is declared with `let` what am I missing ?
00:30:51FromDiscord<Elegantbeef> `var`
00:30:57FromDiscord<Elegantbeef> The object has to be mutable for that procedure to work
00:33:16FromDiscord<Waldecir Santos> I mean how can I implement `$` for an object be "echoable" if it's defined with `let` ?
00:34:16*Gustavo6046_ joined #nim
00:34:31FromDiscord<Elegantbeef> drop the `var`
00:35:32FromDiscord<Waldecir Santos> I get this error if I do:
00:35:55*Gustavo6046 quit (Ping timeout: 256 seconds)
00:36:01FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3RmV
00:36:12FromDiscord<Elegantbeef> Can i see all your code
00:37:10FromDiscord<Waldecir Santos> It's splitted n multiple files now :/ and it's not published yet, let me see if I can create a small one to reproduce it
00:37:18FromDiscord<System64 ~ Flandre Scarlet> Finally finished! https://media.discordapp.net/attachments/371759389889003532/949465595185856572/Tilengine.nim
00:37:23FromDiscord<Elegantbeef> Did you not export/import the procedure?
00:37:47FromDiscord<Evrensel Kişilik> is there anyone familiar with Linux firewall?
00:38:01FromDiscord<Evrensel Kişilik> how can i disable internet access for a specific user?
00:38:10FromDiscord<Waldecir Santos> It's exported this time I'be checked that 😄
00:38:13FromDiscord<Evrensel Kişilik> but it need to be able to communicate to localhost
00:39:49FromDiscord<Elegantbeef> Well i dont see where the error would appear then
00:48:09*Gustavo6046_ is now known as Gustavo6046
01:05:32FromDiscord<System64 ~ Flandre Scarlet> @ElegantBeef how can I link against a DLL with passL please?
01:05:47FromDiscord<Elegantbeef> You cant
01:05:50FromDiscord<Elegantbeef> Atleast not that i know of
01:06:07FromDiscord<System64 ~ Flandre Scarlet> but I already did ti
01:06:09FromDiscord<System64 ~ Flandre Scarlet> (edit) "ti" => "it"
01:06:26FromDiscord<Elegantbeef> You can link to static libraries with passL
01:06:28FromDiscord<Elegantbeef> Well then why do you need me?
01:06:31FromDiscord<Elegantbeef> Cause i've never linked a library myself
01:06:42FromDiscord<System64 ~ Flandre Scarlet> I forgot the command :/
01:07:09FromDiscord<Elegantbeef> Well look up "GCC link dynamic library"
01:18:20FromDiscord<System64 ~ Flandre Scarlet> Okay I found the command
01:18:35FromDiscord<System64 ~ Flandre Scarlet> also that's funny how we can store functions in variables
01:18:53FromDiscord<Elegantbeef> Funny meaning expected?
01:19:40FromDiscord<System64 ~ Flandre Scarlet> This is a nice feature↵It reminds me JavaScript
01:19:43FromDiscord<Rika> Why funny? It’s a feature expected in many modern programming languages
01:20:15FromDiscord<Rika> If by modern you mean “as old as C”
01:20:46FromDiscord<Elegantbeef> Did you just mock yourself?
01:21:13FromDiscord<System64 ~ Flandre Scarlet> I just like functionnal programming (but not the hardcore one like Haskell)
01:21:22FromDiscord<Rika> I don’t know, my native language doesn’t really pronoun usage as hard as English
01:21:39FromDiscord<Rika> Doesn’t really have
01:22:25FromDiscord<huantian> I wanna learn Microsoft Haskell at some point
01:22:34FromDiscord<Rika> F#?
01:23:07FromDiscord<System64 ~ Flandre Scarlet> In reply to @huantian "I wanna learn Microsoft": I head good things about F#
01:23:31FromDiscord<System64 ~ Flandre Scarlet> Should try it too
01:23:34FromDiscord<System64 ~ Flandre Scarlet> (edit)
01:24:56FromDiscord<huantian> In reply to @Rika "F#?": That’s what it seems like lmao
01:25:00FromDiscord<huantian> It does look kinda cool
01:25:17FromDiscord<huantian> It has discriminated unions which c# still doesn’t have
01:26:33FromDiscord<huantian> Also funny |>
01:26:44FromDiscord<Elegantbeef> C# doesnt have a lot 😛
01:27:07FromDiscord<System64 ~ Flandre Scarlet> C# is a pretty nice language too
01:34:22FromDiscord<System64 ~ Flandre Scarlet> Btw I need an advice↵↵Should I separate this into multiple modules? https://media.discordapp.net/attachments/371759389889003532/949479957275508796/Tilengine.nim
01:34:47FromDiscord<Elegantbeef> If you
01:35:00FromDiscord<Elegantbeef> 're putting comments to split the module up, just split the module up
01:36:13FromDiscord<System64 ~ Flandre Scarlet> even the original header there was comments to split it up
01:36:50FromDiscord<Elegantbeef> So what, that's C
01:37:27FromDiscord<Elegantbeef> We have modules,, we can split things up so we can do `import tileengine/world` or `import tileengine/[worlds, animations, sequencepacks`
01:38:15FromDiscord<System64 ~ Flandre Scarlet> and is it possible to ``import Tilengine/`` ?
01:38:42FromDiscord<Elegantbeef> I'd make a `tilengine.nim` that imports and exports all the modules
01:38:55FromDiscord<System64 ~ Flandre Scarlet> ah alright
01:39:03FromDiscord<Elegantbeef> This way you get selective imports and group exports
01:39:42FromDiscord<Elegantbeef> group imports\
01:39:48FromDiscord<Elegantbeef> Maybe i'll write properly one of these days
01:46:20*def- quit (Quit: -)
01:48:31*def- joined #nim
01:51:51FromDiscord<System64 ~ Flandre Scarlet> it will be easier to maintain
01:55:26FromDiscord<System64 ~ Flandre Scarlet> Why do I have an error if I imported the right file? https://media.discordapp.net/attachments/371759389889003532/949485252856926279/unknown.png
01:55:56FromDiscord<Elegantbeef> What's the compiler say
01:55:59FromDiscord<Elegantbeef> also you know you can do `self.r.uint8`?
01:56:21FromDiscord<System64 ~ Flandre Scarlet> Ah good to know
01:56:25FromDiscord<System64 ~ Flandre Scarlet> and it says that : https://media.discordapp.net/attachments/371759389889003532/949485502514462760/unknown.png
01:56:44FromDiscord<Elegantbeef> You didnt export r\`
01:56:52FromDiscord<Elegantbeef> Color's r should have a `` on it
01:56:58NimEventerNew thread by Mardiyah: Must abruptly exit from a recursive function on efficiency Need , see https://forum.nim-lang.org/t/8979
01:57:20FromDiscord<System64 ~ Flandre Scarlet> aaah yeah↵Will do that will all objects
01:58:49FromDiscord<System64 ~ Flandre Scarlet> Okay now I have another problem
01:59:09FromDiscord<System64 ~ Flandre Scarlet> My main file https://media.discordapp.net/attachments/371759389889003532/949486192980791296/unknown.png
01:59:25FromDiscord<Elegantbeef> You didnt import it
01:59:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You didnt import it": but it imports Tilengine which imports everything
01:59:42FromDiscord<Elegantbeef> Compiler gives all the insight you need there
01:59:48FromDiscord<Elegantbeef> Did you export everything?
02:00:05FromDiscord<Elegantbeef> `export moduleName, moduleNameTwo, moduleNameThree`
02:00:26FromDiscord<System64 ~ Flandre Scarlet> I have to do that in each proc?!
02:00:30FromDiscord<Elegantbeef> https://github.com/beef331/micros/blob/master/src/micros.nim
02:00:59FromDiscord<System64 ~ Flandre Scarlet> aaah alright
02:01:29FromDiscord<System64 ~ Flandre Scarlet> Now it works, thanks
02:13:36FromDiscord<Mysterysib> In reply to @System64 "I just like functionnal": I bought myself a book on Haskell but I'm only 10 pages in and it's been a few months 😢
02:14:17FromDiscord<Mysterysib> but I'm learning nim right now
02:14:31*jmdaemon quit (Ping timeout: 256 seconds)
02:15:13FromDiscord<Rika> who said you cant learn two things at the same time
02:19:07FromDiscord<Elegantbeef> Time probably
02:21:34*ltriant joined #nim
02:21:42FromDiscord<Mysterysib> yeah, I'm also in school
02:22:03FromDiscord<Rika> ~~just skip shrug~~
02:22:13FromDiscord<Rika> disclaimer: i am joking
02:25:12FromDiscord<Mysterysib> Hey, does anyone know a statement like break but instead of breaking out of the loop, you break out of the entire function? Does "return" do it?
02:25:25FromDiscord<Elegantbeef> return does
02:26:21FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/TED
02:30:42*ltriant quit (Ping timeout: 272 seconds)
02:49:30*jmdaemon joined #nim
02:50:37*neurocyte0917090 quit (Ping timeout: 240 seconds)
03:12:08FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rnq
03:13:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @sOkam! "Would it be possible": I like your theme, which theme is it?
03:15:19FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Rnr
03:15:56FromDiscord<sOkam!> In reply to @System64 "I like your theme,": material pro darker high contrast
03:16:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @sOkam! "material pro darker high": Thanks
03:19:20FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rnt
03:19:34FromDiscord<Rika> it isnt mandatory but you must not leave the :
03:19:44FromDiscord<Rika> its either `): void` or `)`
03:37:33FromDiscord<System64 ~ Flandre Scarlet> No Switch statement in NiM?
03:38:03*krux02 quit (Remote host closed the connection)
03:39:45FromDiscord<demotomohiro> Nim has `case` statement.
03:40:08FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement
03:40:48FromDiscord<Rika> first time ive seen someone capitalise nim like that
03:40:54FromDiscord<Rika> looks cool tbh
03:41:13FromDiscord<System64 ~ Flandre Scarlet> and I guess I can use it like a Switch statement?
03:41:20FromDiscord<Rika> it is a switch statement
03:41:23FromDiscord<Rika> its just a different name
03:41:49FromDiscord<System64 ~ Flandre Scarlet> ah alright
03:47:45FromDiscord<Elegantbeef> We also have case expressions cause we're cool like that
03:54:04FromDiscord<Bung> is there a way find a proc all local file dependencies ?
03:54:55FromDiscord<Bung> so I dont click its calls in editor for tracing
04:06:02*supakeen quit (Quit: WeeChat 3.4)
04:06:32*supakeen joined #nim
04:08:09FromDiscord<hector> In reply to @Bung "is there a way": What editor?
04:08:35FromDiscord<Bung> vscode
04:16:59*arkurious quit (Quit: Leaving)
04:18:03*def- quit (Quit: -)
04:20:12*def- joined #nim
04:49:30*ltriant joined #nim
04:53:57*ltriant quit (Ping timeout: 240 seconds)
04:58:06nrds<Prestige99> is it safe to modify a table while iterating over its pairs?
04:58:13*slowButPresent quit (Quit: leaving)
04:58:37FromDiscord<Elegantbeef> Safe or should you 😛
04:58:42FromDiscord<Elegantbeef> It's safe, but you shouldnt
04:59:05FromDiscord<loaf> so im getting an ambiguous call error when i try to multiply two numbers
04:59:11termerI'm having an issue with multithreading and async (fun topic, I know)
04:59:16FromDiscord<loaf> because it doesnt know if its an int or an int32
04:59:29FromDiscord<Elegantbeef> jeez all these questions at once!
04:59:41FromDiscord<Elegantbeef> convert your int to the type you want
04:59:47FromDiscord<Elegantbeef> What's the issue termer
04:59:48termerI've deduced that because I have a therad pool that complete futures from a different thread, it's causing a future that's being awaited to complete on the thread pool thread
05:00:10termeris there some way to complete a future that originated on the main thread from a worker thread without causing code to continue using that worker thread
05:00:38FromDiscord<Elegantbeef> Async should be dispatched on the core that it originated
05:00:55FromDiscord<Elegantbeef> So no there isnt afaik
05:00:58termerI'm thinking I may need something running on the main thread to complete the future, and the thread pool will need to just put the result in a shared queue or something
05:01:38FromDiscord<loaf> the problem is, the int is coming from a vector2.x from a library im using and that would break compatibility
05:01:39FromDiscord<Elegantbeef> If you want an async to be made on the main thread but done on a worker, you probably need to produce it from the main thread
05:01:54FromDiscord<Elegantbeef> `myVector2.x.int32`?
05:01:56termerthat makes sense
05:02:19FromDiscord<Elegantbeef> So you queue up the actions in a pool, then threads grab and create the async off that
05:02:52FromDiscord<loaf> oh hey that worked lol
05:02:56FromDiscord<loaf> i didnt know you could do that
05:03:03termerElegantBeef good idea, I'll try that
05:03:06termerthanks a ton
05:03:15termerthis has been pretty difficult to figure out lol
05:05:33FromDiscord<Elegantbeef> I mean it's just a type conversion loa
05:05:35FromDiscord<Elegantbeef> loaf\
05:05:42FromDiscord<Elegantbeef> It's the same as `int32(myVector2.x)`
05:10:43nrds<Prestige99> @Elegantbeef why not?
05:12:11FromDiscord<Elegantbeef> Iterating whilst mutating isnt great, especially if you're removing elements
05:12:32FromDiscord<Elegantbeef> If you want to iterate a collection whilst removing you generally start at the tail and iterate to the head
05:53:47*Guest33 joined #nim
05:54:43*Guest33 quit (Client Quit)
05:55:01*Guest33 joined #nim
06:00:36*Guest33 quit (Quit: Client closed)
06:04:53termerElegantBeef Your advice worked
06:04:57termereverything is working how it should
06:05:18FromDiscord<Elegantbeef> congrats
06:05:28termerthanks again for your help
06:05:41FromDiscord<Elegantbeef> No problem
06:16:11*Zectbumo joined #nim
06:40:49FromDiscord<sheldon> Is Svelte similar with nim compiler targets js?
06:42:05FromDiscord<Elegantbeef> They're similar in that both take in a language and output the web's language
06:46:22FromDiscord<sheldon> The difference is Svelte becomes popular, karax which uses virtual DOM like React seems out.
06:47:32FromDiscord<Elegantbeef> Well that's karax, not Nim's JS
06:47:32FromDiscord<Elegantbeef> You can do the same with Nim i'd reason
06:47:40FromDiscord<Elegantbeef> Someone just has to implement it
06:48:12*rockcavera quit (Remote host closed the connection)
06:48:43FromDiscord<sheldon> nimview is a good candidate.
06:49:16FromDiscord<sheldon> It targets almost all the regular backends.
06:53:35FromDiscord<sheldon> It targets Svelte as well, it reminds me Nim when I look at Svelte's awkward control flow keywords which mixes Vue and anti-intuition syntax.
06:55:11FromDiscord<sheldon> Flutter uses Dart to unify any screen developments, which I conceived couples of years ago with Nim.
06:55:30*vicfred joined #nim
07:04:53FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Ro3
07:05:05FromDiscord<Rika> Unrelated error
07:05:13FromDiscord<sOkam!> oh really, what does that mean?
07:05:24FromDiscord<Elegantbeef> It's an index error
07:05:28FromDiscord<Rika> Look at the lines eluded in the stack trace
07:05:37FromDiscord<Rika> 201,194,176…
07:05:44FromDiscord<Elegantbeef> Off by one i wager
07:08:28FromDiscord<sOkam!> Might be this you mean? https://media.discordapp.net/attachments/371759389889003532/949564035697889320/unknown.png
07:08:54FromDiscord<Elegantbeef> `v[0]`
07:09:01FromDiscord<Elegantbeef> Sequences arent arrays
07:09:16FromDiscord<Elegantbeef> `var v = @[ver[0], ver[1])`
07:10:00FromDiscord<sOkam!> In reply to @Elegantbeef "`var v = @[ver[0],": that results in `seq[int]`, but i need int32↵didn't know how to create an int32 directly
07:10:36FromDiscord<Elegantbeef> `var = @[int32 ver[0], int32 ver[1]]`
07:10:46FromDiscord<Elegantbeef> cmon i believe in you sokam!
07:13:17FromDiscord<Elegantbeef> Why you even use the sequence i'll never know
07:13:17FromDiscord<sOkam!> worked! tyvm @Rika @ElegantBeef
07:15:05FromDiscord<sOkam!> In reply to @Elegantbeef "Why you even use": I always try to keep the user-facing syntax super concise and categorized↵there is surely a better way, just didn't think of any better way to get those two version values working nicely without having them as separate fields https://media.discordapp.net/attachments/371759389889003532/949565702375895120/unknown.png
07:15:48FromDiscord<Elegantbeef> `value: tuple[major: int32, minor: int32]`
07:16:16FromDiscord<sOkam!> whats diff between tuple and seq?
07:16:20FromDiscord<Elegantbeef> `(3i32, 3i32)`
07:16:35FromDiscord<Elegantbeef> Sequences are heap allocated collections, tuples are static sized anonymousu objects
07:17:16FromDiscord<sOkam!> In reply to @Elegantbeef "`(3i32, 3i32)`": goal is writing `3.3`. instead of all that extra stuff exposed in the frontend
07:17:22FromDiscord<Elegantbeef> Well you can
07:20:48FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/0FT
07:23:36FromDiscord<sheldon> I've built https://github.com/nim-lang-cn/html2karax
07:25:03FromDiscord<sheldon> works with karax.
07:34:29*ltriant joined #nim
07:39:11*ltriant quit (Ping timeout: 256 seconds)
07:48:15*wyrd quit (Ping timeout: 240 seconds)
07:53:43*wyrd joined #nim
08:16:40FromDiscord<Evrensel Kişilik> meow
08:16:45FromDiscord<Evrensel Kişilik> i made an online debugger
08:16:47FromDiscord<Evrensel Kişilik> https://debugger.oguzhaneroglu.com/
08:27:08FromDiscord<Rika> How many things do you make in a day, Jesus
08:29:00FromDiscord<sheldon> https://media.discordapp.net/attachments/371759389889003532/949584298741223444/unknown.png
08:43:51NimEventerNew thread by ErikWDev: Just open sourced "easyess", an Entity Component System in Nim, see https://forum.nim-lang.org/t/8980
08:49:28*Gustavo6046 quit (Quit: Leaving)
09:06:51*TechAspirer quit (Remote host closed the connection)
09:21:16*kayabaNerve joined #nim
09:41:22*Zectbumo quit (Remote host closed the connection)
10:21:39*ltriant joined #nim
10:26:58*ltriant quit (Ping timeout: 272 seconds)
10:47:22FromDiscord<sOkam!> is this legal? can a type and a variable have the same name, or is nim case sensitive? https://media.discordapp.net/attachments/371759389889003532/949619123787268126/unknown.png
10:48:17FromDiscord<sOkam!> (edit) "legal? can" => "legal?↵can"
10:50:52FromDiscord<vindaar> Nim identifiers (i.e. any "name", be it variable, field, type, etc.) are case sensitive on the first character. So what you write there is perfectly valid.↵Duplicate identifiers are valid in certain contexts (cannot have two variables of the same name in the same scope for example)
11:05:03FromDiscord<aph> hi, python user here, what are let and var?
11:07:33FromDiscord<exelotl> var makes a local variable, let makes a local variable that you can't reassign or modify
11:07:57FromDiscord<aph> ooh, thanks! gotcha
11:18:04FromDiscord<haoliang> In reply to @aph "hi, python user here,": take a look at [this wiki page](https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#variables)
11:18:52FromDiscord<aph> In reply to @haoliang "take a look at": thanks!
12:06:02*supakeen quit (Quit: WeeChat 3.4)
12:06:32*supakeen joined #nim
12:10:52FromDiscord<Require Support> try to replicate some code in C to nim to learn more about nim.. how would someone convert this pragma into nim `#pragma comment(linker, "/entry:WinMain")`↵↵tried --nomain and --passL but not sure if its possible or not
12:11:32*ozzz joined #nim
12:37:59FromDiscord<carpal> In reply to @sOkam! "is this legal? can": color theme?
12:45:46FromDiscord<sOkam!> In reply to @carpal "color theme?": material darker hight contrast
12:47:55FromDiscord<carpal> In reply to @Require Support "try to replicate some": try with `{. compile: "-nostartfiles --entry=WinMain" .}` but if you want to define WinMain manually you have to do it like this `proc winMain() {. exportc: "WinMain" .}`
12:49:09FromDiscord<carpal> this should work with gcc
12:49:14FromDiscord<carpal> (edit) "this should work with ... gcc" added "nim"
12:49:39FromDiscord<carpal> if you are using nim clang search for the same flags compatible with clang
13:00:35FromDiscord<Require Support> In reply to @carpal "try with `{. compile:": ` error: conflicting types for 'WinMain'; have 'NI(void)' {aka 'long long int(void)'}` conflitct with winmain in windows.h file
13:01:49FromDiscord<carpal> did you defined WinMain by your self?
13:02:31FromDiscord<carpal> by the way I think this is an highly unsafe thing
13:02:38FromDiscord<carpal> you shouldn't redefine the entry point
13:02:50FromDiscord<Require Support> sent a code paste, see https://play.nim-lang.org/#ix=3Rpb
13:03:11FromDiscord<carpal> because the main in nim is used to setup a lot of important stuff to make the environment working correctly
13:03:18FromDiscord<Require Support> In reply to @carpal "you shouldn't redefine the": ye i realize this but im just curious if its actually possible to do with nim, and just playing around with something i wont ever use
13:03:43FromDiscord<carpal> yes you can↵no you shouldn't do it
13:03:47FromDiscord<carpal> (edit) removed "yes" | "can↵no you" => "can↵you"
13:04:35*ltriant joined #nim
13:05:34FromDiscord<Require Support> `error: conflicting types for 'WinMain'; have 'NI(NI, NI, char , NI)' {aka 'long long int(long long int, long long int, char , long long int)'}↵ 992 | N_LIB_PRIVATE N_NIMCALL(NI, WinMain)(NI hInstance, NI hPrevInstance, NCSTRING lpCmdLine, NI nShowCmd)`
13:09:35*ltriant quit (Ping timeout: 256 seconds)
13:10:36*PMunch joined #nim
13:11:17*xaltsc joined #nim
13:39:32FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rpe
13:39:54FromDiscord<Rika> Export it
13:40:04FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=3Rpe" => "https://play.nim-lang.org/#ix=3Rpg"
13:40:06FromDiscord<sOkam!> oh true, the
13:43:33*jmdaemon quit (Ping timeout: 256 seconds)
13:43:34*rockcavera joined #nim
13:43:34*rockcavera quit (Changing host)
13:43:34*rockcavera joined #nim
13:43:54*ozzz is now known as om3ga
13:59:03FromDiscord<sOkam!> sent a code paste, see https://paste.rs/gGh
14:00:28FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=3Rpk" => "https://paste.rs/i1J"
14:01:49*slowButPresent joined #nim
14:32:56FromDiscord<Rika> yes
14:33:15FromDiscord<Rika> actually
14:33:23FromDiscord<Rika> are you going to use inheritance?
14:33:38FromDiscord<Rika> actually it looks like you will, nothings wrong here then
14:46:48FromDiscord<auxym> You might want to just use `type RenderProg = ref RenderObj` though. `of` is for inheritance and dynamic dispatch. And I don't think you can inherit from a plain `object` unless you mark it inheritable with a pragma (or make it inherit from `RootObj`
14:47:34FromDiscord<Rika> oh yeah, i forgot
14:48:02FromDiscord<Rika> In reply to @auxym "You might want to": i didnt say the first sentence because of the inheritance question
14:48:04*arkurious joined #nim
14:48:36FromDiscord<sOkam!> Ye, had to mark it with the pragma to inherit
14:49:05FromDiscord<sOkam!> any benefits to ref instead of obj? (not sure i understand what dynamic dispatch is)
14:49:29FromDiscord<Rika> dynamic dispatch is "deciding which proc to run depending on runtime data instead of static types"
14:49:56FromDiscord<Rika> ref actually has more "downsides" for common use than objects do
14:50:20FromDiscord<Rika> it involves heap allocation and ref semantics, which the latter may or may not be desirable
14:50:39FromDiscord<auxym> `ref` is a pointer/reference type. It is allocated on the heap, and you can have many references to the same data. plain `objects` are value types and are copied when they are passed around (well, maybe not for performance reasons, but they use value semantics, so act as if they were copied)
14:51:04FromDiscord<Rika> ref is not a pointer type
14:51:10FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rpu
14:51:16FromDiscord<auxym> I mean, I know it's GC'd
14:51:17FromDiscord<Rika> In reply to @sOkam! "Also, trying to figure": is this in a proc?
14:51:28FromDiscord<sOkam!> In reply to @Rika "is this in a": yep
14:51:35FromDiscord<Rika> what is the proc signature
14:51:57FromDiscord<Rika> not of newRenderer but of the proc calling it
14:52:05FromDiscord<sOkam!> In reply to @Rika "what is the proc": ty, im blind
14:52:16FromDiscord<sOkam!> its empty tyty 🙈
14:52:29FromDiscord<auxym> If you just want a plain type alias, you can simply use `type RenderProg = RenderObj`. The two types will be exactly interchangeable. You can also look into distinct type aliases, depending on what you need
14:52:37FromDiscord<Rika> In reply to @Rika "ref is *not* a": okay, i guess wording is subtle here; it is a pointer type, but it is not a "pointer" that most people think of
14:53:23FromDiscord<Rika> In reply to @auxym "If you just want": instead of us shooting in the dark, do you mind telling us what your intentions are with RenderProg?
14:54:17FromDiscord<auxym> Yeah, didn't mean to confuse, it's similar to a pointer as in they both have reference semantics. But "pointer" in Nim specifically means "manual memory management" while ref is "automatic memory management"
14:54:41*lumidify_ is now known as lumidify
15:00:20FromDiscord<sOkam!> In reply to @Rika "instead of us shooting": I don't know yet. I don't understand OpenGL enough↵What I know is that it will store the shader program that the vertex and fragment shaders will be linked to↵RenderObj is inherited by RenderVert and RenderFrag because they all use 'uint32 indexes in opengl
15:01:02FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/949682959718420520/unknown.png
15:03:04FromDiscord<sOkam!> Any clue what I might be doing wrong here?↵I fixed it before, but changed the structure and something broke but dunno how I fixed it before https://media.discordapp.net/attachments/371759389889003532/949683466109341767/unknown.png
15:04:03FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/949683717654323210/unknown.png
15:06:27FromDiscord<sOkam!> missing from the prev types sshot https://media.discordapp.net/attachments/371759389889003532/949684322661695518/unknown.png
15:08:25FromDiscord<sheldon> https://github.com/NaokiM03/svelte-preprocess-nim
15:50:24*ltriant joined #nim
15:55:00*ltriant quit (Ping timeout: 240 seconds)
16:13:47FromDiscord<avently> sent a long message, see http://ix.io/3RpV
16:17:29FromDiscord<Rika> yes
16:19:06*vicfred quit (Quit: Leaving)
16:38:10FromDiscord<demotomohiro> Is that something like case expression in Nim?
16:46:25FromDiscord<Rika> i assume so, but more like pattern matching
16:50:55FromDiscord<auxym> In reply to @avently "Hello. Kotlin has a": yes have a look at https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html
17:03:20FromDiscord<avently> In reply to @auxym "yes have a look": Thank you
17:03:21PMunch@avently, yes something like this https://play.nim-lang.org/#ix=3Rqb
17:03:42PMunchNote that as I mention in the article this can apply to everything in Nim
17:05:04FromDiscord<avently> In reply to @PMunch "<@811688321683161158>, yes something like": Thanks. Found even a way to do this with Options (by using fusion/matching
17:06:30FromDiscord<ajusa> Is https://github.com/haxscramper/hmatching recommended over fusion/matching?
17:08:08PMunch@ajusa, probably
17:08:52FromDiscord<haxscramper> it has more recent fixes, and fusion version is completely abandoned unless someone is willing to deal with it's management
17:09:06FromDiscord<haxscramper> there are zero API changes
17:09:17FromDiscord<ajusa> Gotcha. Thanks for pulling that out of hmisc by the way hax, I remember you saying you were going to do that
17:10:18PMunch@avently, if you want to work with options you might want to check out optionsutils: https://github.com/PMunch/nim-optionsutils/blob/master/tests/toptionsutils.nim
17:11:47FromDiscord<Require Support> anyone experience vscode nim highlighting going to shit when inset cpp code using `{.emit: """ <code> """.}`
17:12:00FromDiscord<Require Support> (edit) "inset" => "inserting"
17:14:57FromDiscord<Rika> example?
17:15:38FromDiscord<System64 ~ Flandre Scarlet> okay I have a problem↵a C library send me a pointer to an unsigned 8 bits↵How can I convert this pointer to a pointer to unsigned 32 bits please? and dereference it
17:16:41FromDiscord<Rika> you'll need to create a new pointer and copy the data
17:16:42PMunch@System64_~_Flandre_Scarlet, as long as it actually points to a 4 byte memory region you can do: `cast[ptr uint32](myUint8Pointer)[]`
17:17:00FromDiscord<Rika> In reply to @PMunch "@System64_~_Flandre_Scarlet, as long as": or that i guess, but i didnt take the assumption that it does
17:17:11FromDiscord<planetis> cast[ptr UncheckedArray[uint32](x)[]
17:17:31FromDiscord<feldharke> I tried this example↵https://github.com/khchen/wNim/blob/master/examples/frame.nim↵And I get this error: ↵I must admit, I do not understand what happens here. Is resource/resource a file path (to what)? https://media.discordapp.net/attachments/371759389889003532/949717303694590012/unknown.png
17:18:06FromDiscord<Rika> `import resource/resource` to https://github.com/khchen/wNim/blob/master/examples/resource/resource.nim
17:23:12FromDiscord<feldharke> In reply to @Rika "`import resource/resource` to https://github.com/kh": What topic describes this feature of nim (tutorial or so)?
17:23:40FromDiscord<Rika> imports are in manual
17:26:29PMunch@feldharke, it imports this file https://github.com/khchen/wNim/blob/master/examples/resource/resource.nim
17:26:48PMunchThe Nim compiler has some search paths to find modules
17:27:03PMunchThey include the current directory, and the Nimble packages directory
17:27:31PMunchSo that `import resource/resource` import the `resource.nim` file in the `resource` folder next to that example
17:43:48FromDiscord<feldharke> In reply to @PMunch "So that `import resource/resource`": After some further trails. I think I got it. https://media.discordapp.net/attachments/371759389889003532/949723921589088336/unknown.png
17:44:02FromDiscord<feldharke> (edit) "In reply to @PMunch "So that `import resource/resource`": After some further trails. I think I got it. ... https://media.discordapp.net/attachments/371759389889003532/949723921589088336/unknown.png" added "Thanks"
17:47:54FromDiscord<feldharke> Do not really know if it all should look like this? https://media.discordapp.net/attachments/371759389889003532/949724949889822762/unknown.png
17:48:51FromDiscord<Rika> you should probably have all of the files in the repository where they should be
17:51:38PMunch@feldharke, try to just clone the repo, that way you're sure everything is where it's supposed to be
17:59:53FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqi
18:00:30FromDiscord<b4mbus> so I have two templates for an Option to make it a lil bit easier to work with
18:01:21FromDiscord<Rika> that wont work because you cant "return" in templates
18:01:27FromDiscord<b4mbus> Im not sure, can I not
18:01:28FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqk
18:01:29FromDiscord<b4mbus> oh
18:01:39FromDiscord<Rika> well, you can in some sense
18:01:53FromDiscord<Rika> okay wait your error is unrelated
18:01:58FromDiscord<b4mbus> well that's one thing but what about `forNone`? It doesnt return anything, or does it?
18:01:59FromDiscord<Rika> try
18:01:59FromDiscord<b4mbus> yeah
18:02:15FromDiscord<Rika> perhaps
18:02:22FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Rql
18:02:41FromDiscord<System64 ~ Flandre Scarlet> wait↵Int is 64 bits in nim??
18:03:06PMunch@b4mbus, maybe have a look at optionsutils?
18:03:21PMunch@System64_~_Flandre_Scarlet, int is the same size of a pointer on your architecture
18:03:31FromDiscord<b4mbus> In reply to @System64 "wait Int is 64": same size as a pointer so I assume 64bits for x64 and 32bits for x86
18:03:36FromDiscord<b4mbus> In reply to @PMunch "<@644284217525665793>, maybe have a": no way there's such a thing
18:03:38FromDiscord<System64 ~ Flandre Scarlet> Aaah alright
18:03:44FromDiscord<Rika> pmunch made the module
18:03:54FromDiscord<b4mbus> ah I see
18:04:00FromDiscord<Rika> third party
18:04:00PMunch@b4mbus, damn, guess I have to delete my module now..
18:04:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @b4mbus "same size as a": same in C?
18:04:17FromDiscord<b4mbus> uh no
18:04:22FromDiscord<System64 ~ Flandre Scarlet> AHç
18:04:23FromDiscord<System64 ~ Flandre Scarlet> (edit) "AHç" => "AH!"
18:04:34FromDiscord<b4mbus> in C `int`s size is not set by the standard
18:04:43FromDiscord<b4mbus> but it's usually 8 bytes
18:04:45FromDiscord<b4mbus> (edit) "8" => "4"
18:04:52FromDiscord<System64 ~ Flandre Scarlet> so 32-bits
18:04:54FromDiscord<Rika> nim's int and c's int are unrelated
18:05:00FromDiscord<b4mbus> In reply to @System64 "so 32-bits": yes
18:05:30FromDiscord<b4mbus> well optionutils docs are dead
18:05:44FromDiscord<b4mbus> https://media.discordapp.net/attachments/371759389889003532/949729440387182592/unknown.png
18:06:14FromDiscord<huantian> probably cus of the malformed url
18:06:27FromDiscord<b4mbus> no, changing to `/` from `//` doesnt work either
18:06:34FromDiscord<b4mbus> unless you mean something else
18:06:41PMunchNah, it's the directory which is broken
18:06:59FromDiscord<b4mbus> what should it be then?
18:07:06PMunchYou can read the docs here: https://github.com/PMunch/nim-optionsutils/blob/master/src/optionsutils.nim
18:07:26PMunchI meant the nimble.directory site is broken. So documentation doesn't work
18:07:27FromDiscord<b4mbus> oh that's nice
18:07:30FromDiscord<b4mbus> thanks
18:12:21FromDiscord<b4mbus> In reply to @PMunch "I meant the nimble.directory": any reason you prefer to call functions like free functions `something(obj)` instead of what UFCS gives and `obj.something()`?
18:12:27PMunchOkay, uploaded it to my own site: https://uploads.peterme.net/htmldocs/optionsutils.html
18:12:43FromDiscord<b4mbus> (edit) "In reply to @PMunch "I meant the nimble.directory": any reason you prefer to call functions like free functions `something(obj)` instead of what UFCS gives ... and" added "as kinda like object method synta=x"
18:12:46FromDiscord<b4mbus> (edit) "synta=x" => "syntax"
18:13:03PMunch@b4mbus, not quite sure what you mean?
18:13:47FromDiscord<b4mbus> well I quickly went over your code and I see you prefer doing things like `unsafeGet(option)` instead of `option.unsafeGet()`
18:14:29FromDiscord<b4mbus> neat
18:14:30FromDiscord<b4mbus> https://media.discordapp.net/attachments/371759389889003532/949731646121312296/unknown.png
18:16:19PMunchNot really, I tend to do both but in different scenarios
18:16:36FromDiscord<b4mbus> alright
18:16:36PMunchHmm, what nimble command did you try to run?
18:16:44FromDiscord<b4mbus> just nimble run
18:17:03PMunchNimble run?
18:17:08FromDiscord<b4mbus> yes
18:17:10PMunchOh, on a project which requires the module?
18:17:16FromDiscord<b4mbus> yeah
18:17:23PMunchWhat is your require statement then
18:17:38FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqo
18:19:24FromDiscord<b4mbus> ok maybe mire unfo
18:19:26PMunchThere's an s in there
18:19:33PMunch`optionSutils`
18:19:38FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqp
18:20:03FromDiscord<b4mbus> oh nice
18:20:05FromDiscord<b4mbus> stupid me
18:20:06FromDiscord<b4mbus> thanks
18:20:12FromDiscord<b4mbus> now let's see if I use it correctly
18:26:04FromDiscord<feldharke> In reply to @PMunch "<@813831053923319838>, try to just": Done. That helps me: https://www.youtube.com/watch?v=NiGU3Q-7iXw&t
18:32:32FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqr
18:32:36FromDiscord<b4mbus> (edit) "https://play.nim-lang.org/#ix=3Rqr" => "https://play.nim-lang.org/#ix=3Rqs"
18:35:01FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rqt
18:35:27FromDiscord<b4mbus> probably because you are shifting by 10?
18:35:42FromDiscord<b4mbus> FF00FF is 3 bytes
18:35:44FromDiscord<b4mbus> 24 bits
18:36:55PMunch@b4mbus, your error says `MyEnym`, did you misspell something?
18:37:09PMunchOh, you edited it
18:37:18PMunchYou need to export the enum
18:37:26PMunchWith a * after the name of the enum
18:37:28PMunchMyEnum*
18:37:52FromDiscord<b4mbus> oh, you are from an IRC so you dont se edits and removed messages. I removed the message because I realized what's wrong. I had no star in there so the enum was not public
18:38:01FromDiscord<b4mbus> In reply to @PMunch "You need to export": yeah exactly
18:38:16FromDiscord<System64 ~ Flandre Scarlet> In reply to @b4mbus "probably because you are": it should shift by 10 bits, right?
18:38:37FromDiscord<b4mbus> yes, and your value is 111111110000000011111111
18:38:53PMunchIt seems like you want shr 16?
18:38:59FromDiscord<b4mbus> ^
18:39:21FromDiscord<System64 ~ Flandre Scarlet> ah, it's that, thanks
18:39:23PMunch@b4mbus, we get edits, just as separate messages
18:39:29PMunchBut no deletes
18:40:03FromDiscord<b4mbus> ph
18:40:05FromDiscord<b4mbus> (edit) "ph" => "oh"
18:40:28FromDiscord<b4mbus> I thought Nim's bitops would have some kind of `getByte`
18:40:34FromDiscord<b4mbus> (edit) "`getByte`" => "`getByte(LE/BE)`"
18:42:33PMunchIt's easy enough to make a template for that
18:42:57FromDiscord<b4mbus> well a lot of Nim's stdlib features are simple enough to be selfmade
18:44:37PMunchFair
18:46:11FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqw
18:46:45FromDiscord<b4mbus> `utils.tryGetEnv` returns an `Option[string]`
18:46:58PMunchYour misunderstanding the concept of either
18:47:23PMunchYou're
18:47:31FromDiscord<b4mbus> so what would be the correct and idomatic way to achieve: get the `some` or if it's `none` log an error and quit
18:47:49FromDiscord<b4mbus> (edit) "`some`" => "`some`s value"
18:47:58PMunchThrow an exception
18:47:59FromDiscord<b4mbus> (edit) "`some`s" => "`some`'s"
18:48:01PMunchI think that should work
18:48:28FromDiscord<b4mbus> but I want it to be logged
18:48:49PMunchSo set up a try block?
18:49:14FromDiscord<b4mbus> but that would be ugly and using exceptions for control flow which is bad practice
18:49:19FromDiscord<b4mbus> and I wanted it to be a neat oneliner
18:49:32FromDiscord<b4mbus> I guess Ill just do it above instead of inside `newDiscordClient`
18:50:14PMunchWhat are you talking about, exceptions are a control flow mechanism
18:53:42FromDiscord<b4mbus> yes but they are not meant used for typical control flow which can be achieved with structural language features, functional mechanisms or such
18:54:02PMunchSomething like this: https://play.nim-lang.org/#ix=3Rqz
18:54:34FromDiscord<b4mbus> exceptions should be used purely for "I have a situation I cannot deal with and I have no way for signalizing that because that doesnt happen very often, that is really an exceptional situation"
18:55:03PMunchYou mean something like not having a valid token for the service you're going to use?
18:55:45PMunchIf you do "log and exit" that is essentially the same as just throwing an exception
18:56:31PMunchOnly difference is that now you can't use it as a library with a `try: initialiseLibrary() except DiscordError: <guess we have to do something else>`
18:56:40FromDiscord<b4mbus> In reply to @PMunch "You mean something like": No, that is something that can happen. I don't consider it as an exceptional situation that cannot be avoided. I would just prefer to prompt that a token wasnt found
18:57:57FromDiscord<b4mbus> In this exact situation since it's not really deep in the program it doesn't matter that much tho, yes\
18:59:15FromDiscord<b4mbus> nims driving me crazy really
18:59:19FromDiscord<b4mbus> 'invalid indentation'
19:00:21*Zectbumo joined #nim
19:02:58FromDiscord<Require Support> how would one use `readgsqword` or `readfsdword` functions in nim
19:06:25FromDiscord<Require Support> https://docs.microsoft.com/en-us/cpp/intrinsics/readgsbyte-readgsdword-readgsqword-readgsword
19:19:57*ltriant joined #nim
19:21:46FromDiscord<mratsim> `proc readgsqword(offset: culong): int64 {.importc: "readgsqword", nodecl.}`
19:21:55FromDiscord<mratsim> @Require Support
19:22:37*Gustavo6046 joined #nim
19:22:53FromDiscord<Require Support> In reply to @mratsim "<@!710108871724761128>": ❤️
19:24:43*Gustavo6046 quit (Read error: Connection reset by peer)
19:24:57*Gustavo6046 joined #nim
19:25:18*ltriant quit (Ping timeout: 272 seconds)
19:43:24PMunch@b4mbus, that means you have the indentation wrong somewhere
19:48:23*krux02 joined #nim
20:35:09*ltriant joined #nim
20:39:48*ltriant quit (Ping timeout: 240 seconds)
20:46:11*neurocyte0917090 joined #nim
20:50:09*jjido joined #nim
21:01:18PMunchHmm, is there a way to get the nimble path on runtime?
21:23:05PMunchI see there is `nimblepath="$home/.nimble/pkgs"` in the default nim.cfg file, and also references to a NIMBLE_PATH environment setting
21:23:22PMunchAlong with `/opt/nimble/pkgs` on Linux systems
21:23:41PMunchCan someone on Windows tell me where their nimble path is?
21:23:52PMunchAnd is NIMBLE_PATH set on Windows?
21:35:30FromDiscord<System64 ~ Flandre Scarlet> why is this illegal?? https://media.discordapp.net/attachments/371759389889003532/949782228244758568/unknown.png
21:36:32PMunchYou can't create cdecl procs anywhere but top-level
21:36:52FromDiscord<System64 ~ Flandre Scarlet> what does it mean? What should I do then?
21:36:58PMunchWell I guess you can, but it can't capture any variables as that would make it a closure, a feature which isn't available in C
21:38:32PMunchYou either need to define `palette` as a global variable and define myRaster on top-level, or you need to do some magic in `setRasterCallback` to register a cdecl callback to the low-level api which will actually just call a Nim procedure which picks the Nim callback to call.
21:38:38PMunchOr something along those lines
21:38:51*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:38:59PMunchYou know how many callback systems in C has a void* argument? This is why
21:40:20FromDiscord<System64 ~ Flandre Scarlet> Ah I see, interesting
21:41:55*wyrd quit (Ping timeout: 240 seconds)
21:44:31*jmdaemon joined #nim
21:45:20FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "You either need to": and is it possible to make a variable global when you're in a proc?
21:45:40PMunchWell, there is the {.global.} pragma
21:45:50PMunchBut you probably don't want to make it a global..
21:45:53FromDiscord<auxym> but that behaves closer to `static` in C
21:47:19FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "But you probably don't": the thing is I have to pass this callback proc to a C libray
21:48:49*wyrd joined #nim
21:49:40FromDiscord<System64 ~ Flandre Scarlet> and are global vars cleaned by the GC?
21:50:08PMunchWell, they live as long as your program lives, so not really
21:52:03FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Well, they live as": Humm, so I don't know what I can do, especially I can't pass user data
21:52:59PMunchWhat is the signature of the C procedure?
21:53:20FromDiscord<System64 ~ Flandre Scarlet> wait a mintute, I'll show you
21:54:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rrv
21:54:26FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rrw
21:57:53FromDiscord<System64 ~ Flandre Scarlet> there is no userdata
22:03:25PMunchAh, so you're only ever supposed to have one callback set
22:04:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Ah, so you're only": yeah exactly
22:05:14PMunchSo what you do is have a proc which is cdecl and declared on top level, the only thing this procedure does is check that `not nimCallback.isNil` where `nimCallback` is a global variable. Then in your callback setter you set the nimCallback to whatever Nim proc you want, and give the C library the dummy procedure.
22:06:52FromDiscord<System64 ~ Flandre Scarlet> so what should I do?
22:07:01PMunchExactly what I just told you to do
22:08:07FromDiscord<System64 ~ Flandre Scarlet> I didn't really understood :/
22:09:51PMunchSomething like this: https://play.nim-lang.org/#ix=3RrF
22:10:51FromDiscord<System64 ~ Flandre Scarlet> and this way I can pass any data?
22:11:46PMunchYup, because the `nimRasterCallback` is now a Nim procedure
22:12:00PMunchI guess you might have to set it as `{.closure.}` though
22:12:12FromDiscord<System64 ~ Flandre Scarlet> okay I'll try this
22:14:16FromDiscord<System64 ~ Flandre Scarlet> and my userdata should go in my setRasterCallback, not cRasterCallback?
22:14:56PMunchWell I mean this way you can do it like before
22:15:06PMunchSo the userdata is just captured from the scope
22:16:33*ltriant joined #nim
22:21:30*ltriant quit (Ping timeout: 256 seconds)
22:21:36FromDiscord<System64 ~ Flandre Scarlet> I don't think I understood very well :/ https://media.discordapp.net/attachments/371759389889003532/949793832499826708/unknown.png
22:26:20FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrI
22:28:08FromDiscord<loaf> how do you get the size of a list
22:28:10PMunchWell obviously..
22:28:15PMunch@loaf, len
22:28:48PMunch@System64_~_Flandre_Scarlet, if you take the code you first posted a screenshot of. And then you copy in the exact thing I posted to you. It should all work
22:29:26FromDiscord<System64 ~ Flandre Scarlet> Ah yeah it works!
22:29:38PMunchGreat :)
22:29:51FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrJ
22:30:08PMunchAh..
22:30:11PMunchNot quite..
22:30:19PMunchWhy do you have setRasterCallback2?
22:30:31PMunchYou don't need data as a global
22:30:37FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Why do you have": to avoir conflicts with the original one
22:30:40FromDiscord<System64 ~ Flandre Scarlet> It's not global
22:30:50FromDiscord<System64 ~ Flandre Scarlet> I'm in my main proc
22:30:52PMunchYou don't need another one
22:31:01PMunchTake your original code
22:31:10PMunchDelete setRasterCallback
22:31:19PMunchCopy in the snippet I sent you in its place
22:31:26PMunchVoila
22:31:49PMunchNo setRasterCallback2, no passing in a user argument as an argument
22:32:11PMunchJust the exact code you had earlier, with palette defined in your procedure, and the callback using that defined right after
22:32:15FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrK
22:32:33PMunchExactly
22:32:59FromDiscord<System64 ~ Flandre Scarlet> ah alright, and how can I allow any type of data?
22:33:18PMunchBy capturing it in your callback as a closure
22:33:27PMunchLike you did in your original code
22:33:42PMunchThe one that gave you illegal capture errors
22:33:51PMunchWith this that capture is now legal
22:34:03FromDiscord<System64 ~ Flandre Scarlet> okay I'll redo that, wait a few minutes
22:36:31FromDiscord<System64 ~ Flandre Scarlet> Ah it works!
22:36:50PMunchHooray :)
22:36:55FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/949797688583548968/unknown.png
22:37:44PMunchNice!
22:37:49FromDiscord<System64 ~ Flandre Scarlet> so it works with anonymous functions↵But does it work with normal functions?
22:37:54PMunchBy the way, Nim typically uses 2 spaces for indentation
22:38:04PMunch@System64_~_Flandre_Scarlet, yeah that should work just fine
22:39:10FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "By the way, Nim": Ah good to know↵My IDE is set up to 4 Spaces
22:39:40PMunchShould be a fairly simple setting to set it to 2 spaces for .nim and .nims files :)
22:40:44FromDiscord<System64 ~ Flandre Scarlet> yeah it works for normal functions
22:40:50FromDiscord<System64 ~ Flandre Scarlet> gotta update it then
22:42:02PMunchAre you still using Futhark by the way, for the low-level stuff?
22:42:41FromDiscord<System64 ~ Flandre Scarlet> Yeah
22:42:46FromDiscord<System64 ~ Flandre Scarlet> it works so well!
22:43:16PMunchGreat to hear :)
22:43:29PMunchSorry you had so much trouble getting it set up though
22:43:51PMunchI've been surprised myself actually by how well it works :P
22:44:10FromDiscord<System64 ~ Flandre Scarlet> yeah I had an hard time↵But yeah, when the setup is done it works well, but the setup is hard
22:44:22FromDiscord<System64 ~ Flandre Scarlet> Btw, tried to update, doesn't work https://media.discordapp.net/attachments/371759389889003532/949799558265860106/unknown.png
22:45:38PMunchThat's because you're trying to recursively run setRasterCallback
22:45:50PMunchLine 61 should be TLN_SetRasterCallback
22:46:25FromDiscord<System64 ~ Flandre Scarlet> ah now it works!
22:48:17FromDiscord<System64 ~ Flandre Scarlet> yeaaaah https://media.discordapp.net/attachments/371759389889003532/949800547492442172/unknown.png
22:48:58PMunchNice, looks like a broken TV :P
22:49:21FromDiscord<System64 ~ Flandre Scarlet> This graphics engine is so powerful!
22:49:31*kayabaNerve quit (Ping timeout: 245 seconds)
22:50:09FromDiscord<System64 ~ Flandre Scarlet> Btw is the method you provided safe? (I meant, no memory leaks or smth)
22:50:52PMunchYup, should be perfectly safe
22:51:10FromDiscord<System64 ~ Flandre Scarlet> Aaaah nice!
22:51:19PMunchAs long as the C code is doing something horrendous
22:51:24PMunchisn't*
22:51:51FromDiscord<System64 ~ Flandre Scarlet> In this case it should be the Engine's faumt
22:51:54FromDiscord<System64 ~ Flandre Scarlet> (edit) "faumt" => "fault"
22:52:25NimEventerNew thread by Joekillian: Here is a Svelte + F# - Sutil., see https://forum.nim-lang.org/t/8981
22:53:50FromDiscord<System64 ~ Flandre Scarlet> I also wrote a color converter
22:55:16FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrO
22:58:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Are you still using": https://github.com/WohlSoft/SDL-Mixer-X↵I should Futhark that
22:59:11FromDiscord<System64 ~ Flandre Scarlet> 'cause I think this library is a MONSTER
22:59:18PMunchFuthark ALL the things!
23:01:22FromDiscord<System64 ~ Flandre Scarlet> this lib support a ton of formats! even Chiptunes such as VGM, SPC, NSF, ...
23:09:15FromDiscord<System64 ~ Flandre Scarlet> https://github.com/WohlSoft/SDL-Mixer-X/blob/master/include/SDL_mixer.h↵I guess I just need that
23:20:31FromDiscord<Schelz> I got a question if I use {.passC: "-I" &"/imgui-master/backends" & " -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1".}
23:21:23FromDiscord<Schelz> when using header in a proc does the string need "/" at the start ?
23:22:15FromDiscord<Schelz> for example proc thisfunc(smth: bool): bool {.importcpp: "newfunc", header: "thisheader".}
23:22:28FromDiscord<Schelz> (edit) "proc" => "``proc" | ""thisheader".}" => ""thisheader".}``"
23:23:24FromDiscord<Schelz> cause the compile doesnt through any error with and without the "/" for the header
23:25:27FromDiscord<demotomohiro> That header pragma generate `#include "thisheader"`. Nim doesn't show error, but back end C++ compiler can.
23:26:11FromDiscord<Schelz> you mean nim cpp "file.nim" ?
23:26:19FromDiscord<demotomohiro> Why do you add "/" at the start?
23:26:50FromDiscord<Schelz> because i its one level up in a folder
23:27:00FromDiscord<Schelz> (edit) removed "i"
23:27:38FromDiscord<demotomohiro> yes. You are using `importcpp` so that means you are using c++ header file, isnt it?
23:27:55FromDiscord<Schelz> your right that was a dumb question nvm
23:29:30FromDiscord<demotomohiro> Then, I think you need to write `header:"../thisheader"` or add `--passC:../` compiler option.
23:29:53FromDiscord<Schelz> for ``{.passC: "-I" & "/some/folder".} `` needs "/" at the end ?
23:29:57PMunchHmm, I tried to use fileExists in a nimscript file but I'm only getting this error: Script Error: /home/peter/.choosenim/toolchains/nim-1.6.4/lib/pure/os.nim:812:16 undeclared identifier: 'cmpic'
23:30:08FromDiscord<Schelz> In reply to @Schelz "for ``{.passC: "-I" &": with this question i should have started
23:30:22FromDiscord<demotomohiro> `--passC:-I../`
23:31:09FromDiscord<Schelz> i use in the code not in the compile command
23:31:24FromDiscord<Schelz> (edit) "i use ... in" added "it"
23:34:22FromDiscord<demotomohiro> I don't think `{.passC:"-I"&"/some/folder".} needs "/" at the end.
23:38:22FromDiscord<demotomohiro> `-I` gcc option always takes directory.
23:46:40*krux02 quit (Remote host closed the connection)