00:01:15 | * | Gustavo6046 quit (Remote host closed the connection) |
00:01:35 | * | Gustavo6046 joined #nim |
00:28:22 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> `var` |
00:30:57 | FromDiscord | <Elegantbeef> The object has to be mutable for that procedure to work |
00:33:16 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> drop the `var` |
00:35:32 | FromDiscord | <Waldecir Santos> I get this error if I do: |
00:35:55 | * | Gustavo6046 quit (Ping timeout: 256 seconds) |
00:36:01 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3RmV |
00:36:12 | FromDiscord | <Elegantbeef> Can i see all your code |
00:37:10 | FromDiscord | <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:18 | FromDiscord | <System64 ~ Flandre Scarlet> Finally finished! https://media.discordapp.net/attachments/371759389889003532/949465595185856572/Tilengine.nim |
00:37:23 | FromDiscord | <Elegantbeef> Did you not export/import the procedure? |
00:37:47 | FromDiscord | <Evrensel Kişilik> is there anyone familiar with Linux firewall? |
00:38:01 | FromDiscord | <Evrensel Kişilik> how can i disable internet access for a specific user? |
00:38:10 | FromDiscord | <Waldecir Santos> It's exported this time I'be checked that 😄 |
00:38:13 | FromDiscord | <Evrensel Kişilik> but it need to be able to communicate to localhost |
00:39:49 | FromDiscord | <Elegantbeef> Well i dont see where the error would appear then |
00:48:09 | * | Gustavo6046_ is now known as Gustavo6046 |
01:05:32 | FromDiscord | <System64 ~ Flandre Scarlet> @ElegantBeef how can I link against a DLL with passL please? |
01:05:47 | FromDiscord | <Elegantbeef> You cant |
01:05:50 | FromDiscord | <Elegantbeef> Atleast not that i know of |
01:06:07 | FromDiscord | <System64 ~ Flandre Scarlet> but I already did ti |
01:06:09 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "ti" => "it" |
01:06:26 | FromDiscord | <Elegantbeef> You can link to static libraries with passL |
01:06:28 | FromDiscord | <Elegantbeef> Well then why do you need me? |
01:06:31 | FromDiscord | <Elegantbeef> Cause i've never linked a library myself |
01:06:42 | FromDiscord | <System64 ~ Flandre Scarlet> I forgot the command :/ |
01:07:09 | FromDiscord | <Elegantbeef> Well look up "GCC link dynamic library" |
01:18:20 | FromDiscord | <System64 ~ Flandre Scarlet> Okay I found the command |
01:18:35 | FromDiscord | <System64 ~ Flandre Scarlet> also that's funny how we can store functions in variables |
01:18:53 | FromDiscord | <Elegantbeef> Funny meaning expected? |
01:19:40 | FromDiscord | <System64 ~ Flandre Scarlet> This is a nice feature↵It reminds me JavaScript |
01:19:43 | FromDiscord | <Rika> Why funny? It’s a feature expected in many modern programming languages |
01:20:15 | FromDiscord | <Rika> If by modern you mean “as old as C” |
01:20:46 | FromDiscord | <Elegantbeef> Did you just mock yourself? |
01:21:13 | FromDiscord | <System64 ~ Flandre Scarlet> I just like functionnal programming (but not the hardcore one like Haskell) |
01:21:22 | FromDiscord | <Rika> I don’t know, my native language doesn’t really pronoun usage as hard as English |
01:21:39 | FromDiscord | <Rika> Doesn’t really have |
01:22:25 | FromDiscord | <huantian> I wanna learn Microsoft Haskell at some point |
01:22:34 | FromDiscord | <Rika> F#? |
01:23:07 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @huantian "I wanna learn Microsoft": I head good things about F# |
01:23:31 | FromDiscord | <System64 ~ Flandre Scarlet> Should try it too |
01:23:34 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) |
01:24:56 | FromDiscord | <huantian> In reply to @Rika "F#?": That’s what it seems like lmao |
01:25:00 | FromDiscord | <huantian> It does look kinda cool |
01:25:17 | FromDiscord | <huantian> It has discriminated unions which c# still doesn’t have |
01:26:33 | FromDiscord | <huantian> Also funny |> |
01:26:44 | FromDiscord | <Elegantbeef> C# doesnt have a lot 😛 |
01:27:07 | FromDiscord | <System64 ~ Flandre Scarlet> C# is a pretty nice language too |
01:34:22 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> If you |
01:35:00 | FromDiscord | <Elegantbeef> 're putting comments to split the module up, just split the module up |
01:36:13 | FromDiscord | <System64 ~ Flandre Scarlet> even the original header there was comments to split it up |
01:36:50 | FromDiscord | <Elegantbeef> So what, that's C |
01:37:27 | FromDiscord | <Elegantbeef> We have modules,, we can split things up so we can do `import tileengine/world` or `import tileengine/[worlds, animations, sequencepacks` |
01:38:15 | FromDiscord | <System64 ~ Flandre Scarlet> and is it possible to ``import Tilengine/`` ? |
01:38:42 | FromDiscord | <Elegantbeef> I'd make a `tilengine.nim` that imports and exports all the modules |
01:38:55 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
01:39:03 | FromDiscord | <Elegantbeef> This way you get selective imports and group exports |
01:39:42 | FromDiscord | <Elegantbeef> group imports\ |
01:39:48 | FromDiscord | <Elegantbeef> Maybe i'll write properly one of these days |
01:46:20 | * | def- quit (Quit: -) |
01:48:31 | * | def- joined #nim |
01:51:51 | FromDiscord | <System64 ~ Flandre Scarlet> it will be easier to maintain |
01:55:26 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> What's the compiler say |
01:55:59 | FromDiscord | <Elegantbeef> also you know you can do `self.r.uint8`? |
01:56:21 | FromDiscord | <System64 ~ Flandre Scarlet> Ah good to know |
01:56:25 | FromDiscord | <System64 ~ Flandre Scarlet> and it says that : https://media.discordapp.net/attachments/371759389889003532/949485502514462760/unknown.png |
01:56:44 | FromDiscord | <Elegantbeef> You didnt export r\` |
01:56:52 | FromDiscord | <Elegantbeef> Color's r should have a `` on it |
01:56:58 | NimEventer | New thread by Mardiyah: Must abruptly exit from a recursive function on efficiency Need , see https://forum.nim-lang.org/t/8979 |
01:57:20 | FromDiscord | <System64 ~ Flandre Scarlet> aaah yeah↵Will do that will all objects |
01:58:49 | FromDiscord | <System64 ~ Flandre Scarlet> Okay now I have another problem |
01:59:09 | FromDiscord | <System64 ~ Flandre Scarlet> My main file https://media.discordapp.net/attachments/371759389889003532/949486192980791296/unknown.png |
01:59:25 | FromDiscord | <Elegantbeef> You didnt import it |
01:59:39 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You didnt import it": but it imports Tilengine which imports everything |
01:59:42 | FromDiscord | <Elegantbeef> Compiler gives all the insight you need there |
01:59:48 | FromDiscord | <Elegantbeef> Did you export everything? |
02:00:05 | FromDiscord | <Elegantbeef> `export moduleName, moduleNameTwo, moduleNameThree` |
02:00:26 | FromDiscord | <System64 ~ Flandre Scarlet> I have to do that in each proc?! |
02:00:30 | FromDiscord | <Elegantbeef> https://github.com/beef331/micros/blob/master/src/micros.nim |
02:00:59 | FromDiscord | <System64 ~ Flandre Scarlet> aaah alright |
02:01:29 | FromDiscord | <System64 ~ Flandre Scarlet> Now it works, thanks |
02:13:36 | FromDiscord | <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:17 | FromDiscord | <Mysterysib> but I'm learning nim right now |
02:14:31 | * | jmdaemon quit (Ping timeout: 256 seconds) |
02:15:13 | FromDiscord | <Rika> who said you cant learn two things at the same time |
02:19:07 | FromDiscord | <Elegantbeef> Time probably |
02:21:34 | * | ltriant joined #nim |
02:21:42 | FromDiscord | <Mysterysib> yeah, I'm also in school |
02:22:03 | FromDiscord | <Rika> ~~just skip shrug~~ |
02:22:13 | FromDiscord | <Rika> disclaimer: i am joking |
02:25:12 | FromDiscord | <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:25 | FromDiscord | <Elegantbeef> return does |
02:26:21 | FromDiscord | <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:08 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rnq |
03:13:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sOkam! "Would it be possible": I like your theme, which theme is it? |
03:15:19 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Rnr |
03:15:56 | FromDiscord | <sOkam!> In reply to @System64 "I like your theme,": material pro darker high contrast |
03:16:27 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sOkam! "material pro darker high": Thanks |
03:19:20 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rnt |
03:19:34 | FromDiscord | <Rika> it isnt mandatory but you must not leave the : |
03:19:44 | FromDiscord | <Rika> its either `): void` or `)` |
03:37:33 | FromDiscord | <System64 ~ Flandre Scarlet> No Switch statement in NiM? |
03:38:03 | * | krux02 quit (Remote host closed the connection) |
03:39:45 | FromDiscord | <demotomohiro> Nim has `case` statement. |
03:40:08 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement |
03:40:48 | FromDiscord | <Rika> first time ive seen someone capitalise nim like that |
03:40:54 | FromDiscord | <Rika> looks cool tbh |
03:41:13 | FromDiscord | <System64 ~ Flandre Scarlet> and I guess I can use it like a Switch statement? |
03:41:20 | FromDiscord | <Rika> it is a switch statement |
03:41:23 | FromDiscord | <Rika> its just a different name |
03:41:49 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
03:47:45 | FromDiscord | <Elegantbeef> We also have case expressions cause we're cool like that |
03:54:04 | FromDiscord | <Bung> is there a way find a proc all local file dependencies ? |
03:54:55 | FromDiscord | <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:09 | FromDiscord | <hector> In reply to @Bung "is there a way": What editor? |
04:08:35 | FromDiscord | <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:06 | nrds | <Prestige99> is it safe to modify a table while iterating over its pairs? |
04:58:13 | * | slowButPresent quit (Quit: leaving) |
04:58:37 | FromDiscord | <Elegantbeef> Safe or should you 😛 |
04:58:42 | FromDiscord | <Elegantbeef> It's safe, but you shouldnt |
04:59:05 | FromDiscord | <loaf> so im getting an ambiguous call error when i try to multiply two numbers |
04:59:11 | termer | I'm having an issue with multithreading and async (fun topic, I know) |
04:59:16 | FromDiscord | <loaf> because it doesnt know if its an int or an int32 |
04:59:29 | FromDiscord | <Elegantbeef> jeez all these questions at once! |
04:59:41 | FromDiscord | <Elegantbeef> convert your int to the type you want |
04:59:47 | FromDiscord | <Elegantbeef> What's the issue termer |
04:59:48 | termer | I'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:10 | termer | is 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:38 | FromDiscord | <Elegantbeef> Async should be dispatched on the core that it originated |
05:00:55 | FromDiscord | <Elegantbeef> So no there isnt afaik |
05:00:58 | termer | I'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:38 | FromDiscord | <loaf> the problem is, the int is coming from a vector2.x from a library im using and that would break compatibility |
05:01:39 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> `myVector2.x.int32`? |
05:01:56 | termer | that makes sense |
05:02:19 | FromDiscord | <Elegantbeef> So you queue up the actions in a pool, then threads grab and create the async off that |
05:02:52 | FromDiscord | <loaf> oh hey that worked lol |
05:02:56 | FromDiscord | <loaf> i didnt know you could do that |
05:03:03 | termer | ElegantBeef good idea, I'll try that |
05:03:06 | termer | thanks a ton |
05:03:15 | termer | this has been pretty difficult to figure out lol |
05:05:33 | FromDiscord | <Elegantbeef> I mean it's just a type conversion loa |
05:05:35 | FromDiscord | <Elegantbeef> loaf\ |
05:05:42 | FromDiscord | <Elegantbeef> It's the same as `int32(myVector2.x)` |
05:10:43 | nrds | <Prestige99> @Elegantbeef why not? |
05:12:11 | FromDiscord | <Elegantbeef> Iterating whilst mutating isnt great, especially if you're removing elements |
05:12:32 | FromDiscord | <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:53 | termer | ElegantBeef Your advice worked |
06:04:57 | termer | everything is working how it should |
06:05:18 | FromDiscord | <Elegantbeef> congrats |
06:05:28 | termer | thanks again for your help |
06:05:41 | FromDiscord | <Elegantbeef> No problem |
06:16:11 | * | Zectbumo joined #nim |
06:40:49 | FromDiscord | <sheldon> Is Svelte similar with nim compiler targets js? |
06:42:05 | FromDiscord | <Elegantbeef> They're similar in that both take in a language and output the web's language |
06:46:22 | FromDiscord | <sheldon> The difference is Svelte becomes popular, karax which uses virtual DOM like React seems out. |
06:47:32 | FromDiscord | <Elegantbeef> Well that's karax, not Nim's JS |
06:47:32 | FromDiscord | <Elegantbeef> You can do the same with Nim i'd reason |
06:47:40 | FromDiscord | <Elegantbeef> Someone just has to implement it |
06:48:12 | * | rockcavera quit (Remote host closed the connection) |
06:48:43 | FromDiscord | <sheldon> nimview is a good candidate. |
06:49:16 | FromDiscord | <sheldon> It targets almost all the regular backends. |
06:53:35 | FromDiscord | <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:11 | FromDiscord | <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:53 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Ro3 |
07:05:05 | FromDiscord | <Rika> Unrelated error |
07:05:13 | FromDiscord | <sOkam!> oh really, what does that mean? |
07:05:24 | FromDiscord | <Elegantbeef> It's an index error |
07:05:28 | FromDiscord | <Rika> Look at the lines eluded in the stack trace |
07:05:37 | FromDiscord | <Rika> 201,194,176… |
07:05:44 | FromDiscord | <Elegantbeef> Off by one i wager |
07:08:28 | FromDiscord | <sOkam!> Might be this you mean? https://media.discordapp.net/attachments/371759389889003532/949564035697889320/unknown.png |
07:08:54 | FromDiscord | <Elegantbeef> `v[0]` |
07:09:01 | FromDiscord | <Elegantbeef> Sequences arent arrays |
07:09:16 | FromDiscord | <Elegantbeef> `var v = @[ver[0], ver[1])` |
07:10:00 | FromDiscord | <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:36 | FromDiscord | <Elegantbeef> `var = @[int32 ver[0], int32 ver[1]]` |
07:10:46 | FromDiscord | <Elegantbeef> cmon i believe in you sokam! |
07:13:17 | FromDiscord | <Elegantbeef> Why you even use the sequence i'll never know |
07:13:17 | FromDiscord | <sOkam!> worked! tyvm @Rika @ElegantBeef |
07:15:05 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> `value: tuple[major: int32, minor: int32]` |
07:16:16 | FromDiscord | <sOkam!> whats diff between tuple and seq? |
07:16:20 | FromDiscord | <Elegantbeef> `(3i32, 3i32)` |
07:16:35 | FromDiscord | <Elegantbeef> Sequences are heap allocated collections, tuples are static sized anonymousu objects |
07:17:16 | FromDiscord | <sOkam!> In reply to @Elegantbeef "`(3i32, 3i32)`": goal is writing `3.3`. instead of all that extra stuff exposed in the frontend |
07:17:22 | FromDiscord | <Elegantbeef> Well you can |
07:20:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/0FT |
07:23:36 | FromDiscord | <sheldon> I've built https://github.com/nim-lang-cn/html2karax |
07:25:03 | FromDiscord | <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:40 | FromDiscord | <Evrensel Kişilik> meow |
08:16:45 | FromDiscord | <Evrensel Kişilik> i made an online debugger |
08:16:47 | FromDiscord | <Evrensel Kişilik> https://debugger.oguzhaneroglu.com/ |
08:27:08 | FromDiscord | <Rika> How many things do you make in a day, Jesus |
08:29:00 | FromDiscord | <sheldon> https://media.discordapp.net/attachments/371759389889003532/949584298741223444/unknown.png |
08:43:51 | NimEventer | New 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:22 | FromDiscord | <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:17 | FromDiscord | <sOkam!> (edit) "legal? can" => "legal?↵can" |
10:50:52 | FromDiscord | <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:03 | FromDiscord | <aph> hi, python user here, what are let and var? |
11:07:33 | FromDiscord | <exelotl> var makes a local variable, let makes a local variable that you can't reassign or modify |
11:07:57 | FromDiscord | <aph> ooh, thanks! gotcha |
11:18:04 | FromDiscord | <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:52 | FromDiscord | <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:52 | FromDiscord | <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:59 | FromDiscord | <carpal> In reply to @sOkam! "is this legal? can": color theme? |
12:45:46 | FromDiscord | <sOkam!> In reply to @carpal "color theme?": material darker hight contrast |
12:47:55 | FromDiscord | <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:09 | FromDiscord | <carpal> this should work with gcc |
12:49:14 | FromDiscord | <carpal> (edit) "this should work with ... gcc" added "nim" |
12:49:39 | FromDiscord | <carpal> if you are using nim clang search for the same flags compatible with clang |
13:00:35 | FromDiscord | <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:49 | FromDiscord | <carpal> did you defined WinMain by your self? |
13:02:31 | FromDiscord | <carpal> by the way I think this is an highly unsafe thing |
13:02:38 | FromDiscord | <carpal> you shouldn't redefine the entry point |
13:02:50 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=3Rpb |
13:03:11 | FromDiscord | <carpal> because the main in nim is used to setup a lot of important stuff to make the environment working correctly |
13:03:18 | FromDiscord | <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:43 | FromDiscord | <carpal> yes you can↵no you shouldn't do it |
13:03:47 | FromDiscord | <carpal> (edit) removed "yes" | "can↵no you" => "can↵you" |
13:04:35 | * | ltriant joined #nim |
13:05:34 | FromDiscord | <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:32 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rpe |
13:39:54 | FromDiscord | <Rika> Export it |
13:40:04 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=3Rpe" => "https://play.nim-lang.org/#ix=3Rpg" |
13:40:06 | FromDiscord | <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:03 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/gGh |
14:00:28 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=3Rpk" => "https://paste.rs/i1J" |
14:01:49 | * | slowButPresent joined #nim |
14:32:56 | FromDiscord | <Rika> yes |
14:33:15 | FromDiscord | <Rika> actually |
14:33:23 | FromDiscord | <Rika> are you going to use inheritance? |
14:33:38 | FromDiscord | <Rika> actually it looks like you will, nothings wrong here then |
14:46:48 | FromDiscord | <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:34 | FromDiscord | <Rika> oh yeah, i forgot |
14:48:02 | FromDiscord | <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:36 | FromDiscord | <sOkam!> Ye, had to mark it with the pragma to inherit |
14:49:05 | FromDiscord | <sOkam!> any benefits to ref instead of obj? (not sure i understand what dynamic dispatch is) |
14:49:29 | FromDiscord | <Rika> dynamic dispatch is "deciding which proc to run depending on runtime data instead of static types" |
14:49:56 | FromDiscord | <Rika> ref actually has more "downsides" for common use than objects do |
14:50:20 | FromDiscord | <Rika> it involves heap allocation and ref semantics, which the latter may or may not be desirable |
14:50:39 | FromDiscord | <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:04 | FromDiscord | <Rika> ref is not a pointer type |
14:51:10 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3Rpu |
14:51:16 | FromDiscord | <auxym> I mean, I know it's GC'd |
14:51:17 | FromDiscord | <Rika> In reply to @sOkam! "Also, trying to figure": is this in a proc? |
14:51:28 | FromDiscord | <sOkam!> In reply to @Rika "is this in a": yep |
14:51:35 | FromDiscord | <Rika> what is the proc signature |
14:51:57 | FromDiscord | <Rika> not of newRenderer but of the proc calling it |
14:52:05 | FromDiscord | <sOkam!> In reply to @Rika "what is the proc": ty, im blind |
14:52:16 | FromDiscord | <sOkam!> its empty tyty 🙈 |
14:52:29 | FromDiscord | <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:37 | FromDiscord | <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:23 | FromDiscord | <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:17 | FromDiscord | <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:20 | FromDiscord | <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:02 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/949682959718420520/unknown.png |
15:03:04 | FromDiscord | <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:03 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/949683717654323210/unknown.png |
15:06:27 | FromDiscord | <sOkam!> missing from the prev types sshot https://media.discordapp.net/attachments/371759389889003532/949684322661695518/unknown.png |
15:08:25 | FromDiscord | <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:47 | FromDiscord | <avently> sent a long message, see http://ix.io/3RpV |
16:17:29 | FromDiscord | <Rika> yes |
16:19:06 | * | vicfred quit (Quit: Leaving) |
16:38:10 | FromDiscord | <demotomohiro> Is that something like case expression in Nim? |
16:46:25 | FromDiscord | <Rika> i assume so, but more like pattern matching |
16:50:55 | FromDiscord | <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:20 | FromDiscord | <avently> In reply to @auxym "yes have a look": Thank you |
17:03:21 | PMunch | @avently, yes something like this https://play.nim-lang.org/#ix=3Rqb |
17:03:42 | PMunch | Note that as I mention in the article this can apply to everything in Nim |
17:05:04 | FromDiscord | <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:30 | FromDiscord | <ajusa> Is https://github.com/haxscramper/hmatching recommended over fusion/matching? |
17:08:08 | PMunch | @ajusa, probably |
17:08:52 | FromDiscord | <haxscramper> it has more recent fixes, and fusion version is completely abandoned unless someone is willing to deal with it's management |
17:09:06 | FromDiscord | <haxscramper> there are zero API changes |
17:09:17 | FromDiscord | <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:18 | PMunch | @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:47 | FromDiscord | <Require Support> anyone experience vscode nim highlighting going to shit when inset cpp code using `{.emit: """ <code> """.}` |
17:12:00 | FromDiscord | <Require Support> (edit) "inset" => "inserting" |
17:14:57 | FromDiscord | <Rika> example? |
17:15:38 | FromDiscord | <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:41 | FromDiscord | <Rika> you'll need to create a new pointer and copy the data |
17:16:42 | PMunch | @System64_~_Flandre_Scarlet, as long as it actually points to a 4 byte memory region you can do: `cast[ptr uint32](myUint8Pointer)[]` |
17:17:00 | FromDiscord | <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:11 | FromDiscord | <planetis> cast[ptr UncheckedArray[uint32](x)[] |
17:17:31 | FromDiscord | <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:06 | FromDiscord | <Rika> `import resource/resource` to https://github.com/khchen/wNim/blob/master/examples/resource/resource.nim |
17:23:12 | FromDiscord | <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:40 | FromDiscord | <Rika> imports are in manual |
17:26:29 | PMunch | @feldharke, it imports this file https://github.com/khchen/wNim/blob/master/examples/resource/resource.nim |
17:26:48 | PMunch | The Nim compiler has some search paths to find modules |
17:27:03 | PMunch | They include the current directory, and the Nimble packages directory |
17:27:31 | PMunch | So that `import resource/resource` import the `resource.nim` file in the `resource` folder next to that example |
17:43:48 | FromDiscord | <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:02 | FromDiscord | <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:54 | FromDiscord | <feldharke> Do not really know if it all should look like this? https://media.discordapp.net/attachments/371759389889003532/949724949889822762/unknown.png |
17:48:51 | FromDiscord | <Rika> you should probably have all of the files in the repository where they should be |
17:51:38 | PMunch | @feldharke, try to just clone the repo, that way you're sure everything is where it's supposed to be |
17:59:53 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqi |
18:00:30 | FromDiscord | <b4mbus> so I have two templates for an Option to make it a lil bit easier to work with |
18:01:21 | FromDiscord | <Rika> that wont work because you cant "return" in templates |
18:01:27 | FromDiscord | <b4mbus> Im not sure, can I not |
18:01:28 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqk |
18:01:29 | FromDiscord | <b4mbus> oh |
18:01:39 | FromDiscord | <Rika> well, you can in some sense |
18:01:53 | FromDiscord | <Rika> okay wait your error is unrelated |
18:01:58 | FromDiscord | <b4mbus> well that's one thing but what about `forNone`? It doesnt return anything, or does it? |
18:01:59 | FromDiscord | <Rika> try |
18:01:59 | FromDiscord | <b4mbus> yeah |
18:02:15 | FromDiscord | <Rika> perhaps |
18:02:22 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Rql |
18:02:41 | FromDiscord | <System64 ~ Flandre Scarlet> wait↵Int is 64 bits in nim?? |
18:03:06 | PMunch | @b4mbus, maybe have a look at optionsutils? |
18:03:21 | PMunch | @System64_~_Flandre_Scarlet, int is the same size of a pointer on your architecture |
18:03:31 | FromDiscord | <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:36 | FromDiscord | <b4mbus> In reply to @PMunch "<@644284217525665793>, maybe have a": no way there's such a thing |
18:03:38 | FromDiscord | <System64 ~ Flandre Scarlet> Aaah alright |
18:03:44 | FromDiscord | <Rika> pmunch made the module |
18:03:54 | FromDiscord | <b4mbus> ah I see |
18:04:00 | FromDiscord | <Rika> third party |
18:04:00 | PMunch | @b4mbus, damn, guess I have to delete my module now.. |
18:04:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @b4mbus "same size as a": same in C? |
18:04:17 | FromDiscord | <b4mbus> uh no |
18:04:22 | FromDiscord | <System64 ~ Flandre Scarlet> AHç |
18:04:23 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "AHç" => "AH!" |
18:04:34 | FromDiscord | <b4mbus> in C `int`s size is not set by the standard |
18:04:43 | FromDiscord | <b4mbus> but it's usually 8 bytes |
18:04:45 | FromDiscord | <b4mbus> (edit) "8" => "4" |
18:04:52 | FromDiscord | <System64 ~ Flandre Scarlet> so 32-bits |
18:04:54 | FromDiscord | <Rika> nim's int and c's int are unrelated |
18:05:00 | FromDiscord | <b4mbus> In reply to @System64 "so 32-bits": yes |
18:05:30 | FromDiscord | <b4mbus> well optionutils docs are dead |
18:05:44 | FromDiscord | <b4mbus> https://media.discordapp.net/attachments/371759389889003532/949729440387182592/unknown.png |
18:06:14 | FromDiscord | <huantian> probably cus of the malformed url |
18:06:27 | FromDiscord | <b4mbus> no, changing to `/` from `//` doesnt work either |
18:06:34 | FromDiscord | <b4mbus> unless you mean something else |
18:06:41 | PMunch | Nah, it's the directory which is broken |
18:06:59 | FromDiscord | <b4mbus> what should it be then? |
18:07:06 | PMunch | You can read the docs here: https://github.com/PMunch/nim-optionsutils/blob/master/src/optionsutils.nim |
18:07:26 | PMunch | I meant the nimble.directory site is broken. So documentation doesn't work |
18:07:27 | FromDiscord | <b4mbus> oh that's nice |
18:07:30 | FromDiscord | <b4mbus> thanks |
18:12:21 | FromDiscord | <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:27 | PMunch | Okay, uploaded it to my own site: https://uploads.peterme.net/htmldocs/optionsutils.html |
18:12:43 | FromDiscord | <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:46 | FromDiscord | <b4mbus> (edit) "synta=x" => "syntax" |
18:13:03 | PMunch | @b4mbus, not quite sure what you mean? |
18:13:47 | FromDiscord | <b4mbus> well I quickly went over your code and I see you prefer doing things like `unsafeGet(option)` instead of `option.unsafeGet()` |
18:14:29 | FromDiscord | <b4mbus> neat |
18:14:30 | FromDiscord | <b4mbus> https://media.discordapp.net/attachments/371759389889003532/949731646121312296/unknown.png |
18:16:19 | PMunch | Not really, I tend to do both but in different scenarios |
18:16:36 | FromDiscord | <b4mbus> alright |
18:16:36 | PMunch | Hmm, what nimble command did you try to run? |
18:16:44 | FromDiscord | <b4mbus> just nimble run |
18:17:03 | PMunch | Nimble run? |
18:17:08 | FromDiscord | <b4mbus> yes |
18:17:10 | PMunch | Oh, on a project which requires the module? |
18:17:16 | FromDiscord | <b4mbus> yeah |
18:17:23 | PMunch | What is your require statement then |
18:17:38 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqo |
18:19:24 | FromDiscord | <b4mbus> ok maybe mire unfo |
18:19:26 | PMunch | There's an s in there |
18:19:33 | PMunch | `optionSutils` |
18:19:38 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqp |
18:20:03 | FromDiscord | <b4mbus> oh nice |
18:20:05 | FromDiscord | <b4mbus> stupid me |
18:20:06 | FromDiscord | <b4mbus> thanks |
18:20:12 | FromDiscord | <b4mbus> now let's see if I use it correctly |
18:26:04 | FromDiscord | <feldharke> In reply to @PMunch "<@813831053923319838>, try to just": Done. That helps me: https://www.youtube.com/watch?v=NiGU3Q-7iXw&t |
18:32:32 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqr |
18:32:36 | FromDiscord | <b4mbus> (edit) "https://play.nim-lang.org/#ix=3Rqr" => "https://play.nim-lang.org/#ix=3Rqs" |
18:35:01 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rqt |
18:35:27 | FromDiscord | <b4mbus> probably because you are shifting by 10? |
18:35:42 | FromDiscord | <b4mbus> FF00FF is 3 bytes |
18:35:44 | FromDiscord | <b4mbus> 24 bits |
18:36:55 | PMunch | @b4mbus, your error says `MyEnym`, did you misspell something? |
18:37:09 | PMunch | Oh, you edited it |
18:37:18 | PMunch | You need to export the enum |
18:37:26 | PMunch | With a * after the name of the enum |
18:37:28 | PMunch | MyEnum* |
18:37:52 | FromDiscord | <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:01 | FromDiscord | <b4mbus> In reply to @PMunch "You need to export": yeah exactly |
18:38:16 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @b4mbus "probably because you are": it should shift by 10 bits, right? |
18:38:37 | FromDiscord | <b4mbus> yes, and your value is 111111110000000011111111 |
18:38:53 | PMunch | It seems like you want shr 16? |
18:38:59 | FromDiscord | <b4mbus> ^ |
18:39:21 | FromDiscord | <System64 ~ Flandre Scarlet> ah, it's that, thanks |
18:39:23 | PMunch | @b4mbus, we get edits, just as separate messages |
18:39:29 | PMunch | But no deletes |
18:40:03 | FromDiscord | <b4mbus> ph |
18:40:05 | FromDiscord | <b4mbus> (edit) "ph" => "oh" |
18:40:28 | FromDiscord | <b4mbus> I thought Nim's bitops would have some kind of `getByte` |
18:40:34 | FromDiscord | <b4mbus> (edit) "`getByte`" => "`getByte(LE/BE)`" |
18:42:33 | PMunch | It's easy enough to make a template for that |
18:42:57 | FromDiscord | <b4mbus> well a lot of Nim's stdlib features are simple enough to be selfmade |
18:44:37 | PMunch | Fair |
18:46:11 | FromDiscord | <b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3Rqw |
18:46:45 | FromDiscord | <b4mbus> `utils.tryGetEnv` returns an `Option[string]` |
18:46:58 | PMunch | Your misunderstanding the concept of either |
18:47:23 | PMunch | You're |
18:47:31 | FromDiscord | <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:49 | FromDiscord | <b4mbus> (edit) "`some`" => "`some`s value" |
18:47:58 | PMunch | Throw an exception |
18:47:59 | FromDiscord | <b4mbus> (edit) "`some`s" => "`some`'s" |
18:48:01 | PMunch | I think that should work |
18:48:28 | FromDiscord | <b4mbus> but I want it to be logged |
18:48:49 | PMunch | So set up a try block? |
18:49:14 | FromDiscord | <b4mbus> but that would be ugly and using exceptions for control flow which is bad practice |
18:49:19 | FromDiscord | <b4mbus> and I wanted it to be a neat oneliner |
18:49:32 | FromDiscord | <b4mbus> I guess Ill just do it above instead of inside `newDiscordClient` |
18:50:14 | PMunch | What are you talking about, exceptions are a control flow mechanism |
18:53:42 | FromDiscord | <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:02 | PMunch | Something like this: https://play.nim-lang.org/#ix=3Rqz |
18:54:34 | FromDiscord | <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:03 | PMunch | You mean something like not having a valid token for the service you're going to use? |
18:55:45 | PMunch | If you do "log and exit" that is essentially the same as just throwing an exception |
18:56:31 | PMunch | Only 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:40 | FromDiscord | <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:57 | FromDiscord | <b4mbus> In this exact situation since it's not really deep in the program it doesn't matter that much tho, yes\ |
18:59:15 | FromDiscord | <b4mbus> nims driving me crazy really |
18:59:19 | FromDiscord | <b4mbus> 'invalid indentation' |
19:00:21 | * | Zectbumo joined #nim |
19:02:58 | FromDiscord | <Require Support> how would one use `readgsqword` or `readfsdword` functions in nim |
19:06:25 | FromDiscord | <Require Support> https://docs.microsoft.com/en-us/cpp/intrinsics/readgsbyte-readgsdword-readgsqword-readgsword |
19:19:57 | * | ltriant joined #nim |
19:21:46 | FromDiscord | <mratsim> `proc readgsqword(offset: culong): int64 {.importc: "readgsqword", nodecl.}` |
19:21:55 | FromDiscord | <mratsim> @Require Support |
19:22:37 | * | Gustavo6046 joined #nim |
19:22:53 | FromDiscord | <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:24 | PMunch | @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:18 | PMunch | Hmm, is there a way to get the nimble path on runtime? |
21:23:05 | PMunch | I see there is `nimblepath="$home/.nimble/pkgs"` in the default nim.cfg file, and also references to a NIMBLE_PATH environment setting |
21:23:22 | PMunch | Along with `/opt/nimble/pkgs` on Linux systems |
21:23:41 | PMunch | Can someone on Windows tell me where their nimble path is? |
21:23:52 | PMunch | And is NIMBLE_PATH set on Windows? |
21:35:30 | FromDiscord | <System64 ~ Flandre Scarlet> why is this illegal?? https://media.discordapp.net/attachments/371759389889003532/949782228244758568/unknown.png |
21:36:32 | PMunch | You can't create cdecl procs anywhere but top-level |
21:36:52 | FromDiscord | <System64 ~ Flandre Scarlet> what does it mean? What should I do then? |
21:36:58 | PMunch | Well 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:32 | PMunch | You 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:38 | PMunch | Or something along those lines |
21:38:51 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:38:59 | PMunch | You know how many callback systems in C has a void* argument? This is why |
21:40:20 | FromDiscord | <System64 ~ Flandre Scarlet> Ah I see, interesting |
21:41:55 | * | wyrd quit (Ping timeout: 240 seconds) |
21:44:31 | * | jmdaemon joined #nim |
21:45:20 | FromDiscord | <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:40 | PMunch | Well, there is the {.global.} pragma |
21:45:50 | PMunch | But you probably don't want to make it a global.. |
21:45:53 | FromDiscord | <auxym> but that behaves closer to `static` in C |
21:47:19 | FromDiscord | <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:40 | FromDiscord | <System64 ~ Flandre Scarlet> and are global vars cleaned by the GC? |
21:50:08 | PMunch | Well, they live as long as your program lives, so not really |
21:52:03 | FromDiscord | <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:59 | PMunch | What is the signature of the C procedure? |
21:53:20 | FromDiscord | <System64 ~ Flandre Scarlet> wait a mintute, I'll show you |
21:54:04 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rrv |
21:54:26 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Rrw |
21:57:53 | FromDiscord | <System64 ~ Flandre Scarlet> there is no userdata |
22:03:25 | PMunch | Ah, so you're only ever supposed to have one callback set |
22:04:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Ah, so you're only": yeah exactly |
22:05:14 | PMunch | So 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:52 | FromDiscord | <System64 ~ Flandre Scarlet> so what should I do? |
22:07:01 | PMunch | Exactly what I just told you to do |
22:08:07 | FromDiscord | <System64 ~ Flandre Scarlet> I didn't really understood :/ |
22:09:51 | PMunch | Something like this: https://play.nim-lang.org/#ix=3RrF |
22:10:51 | FromDiscord | <System64 ~ Flandre Scarlet> and this way I can pass any data? |
22:11:46 | PMunch | Yup, because the `nimRasterCallback` is now a Nim procedure |
22:12:00 | PMunch | I guess you might have to set it as `{.closure.}` though |
22:12:12 | FromDiscord | <System64 ~ Flandre Scarlet> okay I'll try this |
22:14:16 | FromDiscord | <System64 ~ Flandre Scarlet> and my userdata should go in my setRasterCallback, not cRasterCallback? |
22:14:56 | PMunch | Well I mean this way you can do it like before |
22:15:06 | PMunch | So 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:36 | FromDiscord | <System64 ~ Flandre Scarlet> I don't think I understood very well :/ https://media.discordapp.net/attachments/371759389889003532/949793832499826708/unknown.png |
22:26:20 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrI |
22:28:08 | FromDiscord | <loaf> how do you get the size of a list |
22:28:10 | PMunch | Well obviously.. |
22:28:15 | PMunch | @loaf, len |
22:28:48 | PMunch | @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:26 | FromDiscord | <System64 ~ Flandre Scarlet> Ah yeah it works! |
22:29:38 | PMunch | Great :) |
22:29:51 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrJ |
22:30:08 | PMunch | Ah.. |
22:30:11 | PMunch | Not quite.. |
22:30:19 | PMunch | Why do you have setRasterCallback2? |
22:30:31 | PMunch | You don't need data as a global |
22:30:37 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Why do you have": to avoir conflicts with the original one |
22:30:40 | FromDiscord | <System64 ~ Flandre Scarlet> It's not global |
22:30:50 | FromDiscord | <System64 ~ Flandre Scarlet> I'm in my main proc |
22:30:52 | PMunch | You don't need another one |
22:31:01 | PMunch | Take your original code |
22:31:10 | PMunch | Delete setRasterCallback |
22:31:19 | PMunch | Copy in the snippet I sent you in its place |
22:31:26 | PMunch | Voila |
22:31:49 | PMunch | No setRasterCallback2, no passing in a user argument as an argument |
22:32:11 | PMunch | Just the exact code you had earlier, with palette defined in your procedure, and the callback using that defined right after |
22:32:15 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrK |
22:32:33 | PMunch | Exactly |
22:32:59 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright, and how can I allow any type of data? |
22:33:18 | PMunch | By capturing it in your callback as a closure |
22:33:27 | PMunch | Like you did in your original code |
22:33:42 | PMunch | The one that gave you illegal capture errors |
22:33:51 | PMunch | With this that capture is now legal |
22:34:03 | FromDiscord | <System64 ~ Flandre Scarlet> okay I'll redo that, wait a few minutes |
22:36:31 | FromDiscord | <System64 ~ Flandre Scarlet> Ah it works! |
22:36:50 | PMunch | Hooray :) |
22:36:55 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/949797688583548968/unknown.png |
22:37:44 | PMunch | Nice! |
22:37:49 | FromDiscord | <System64 ~ Flandre Scarlet> so it works with anonymous functions↵But does it work with normal functions? |
22:37:54 | PMunch | By the way, Nim typically uses 2 spaces for indentation |
22:38:04 | PMunch | @System64_~_Flandre_Scarlet, yeah that should work just fine |
22:39:10 | FromDiscord | <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:40 | PMunch | Should be a fairly simple setting to set it to 2 spaces for .nim and .nims files :) |
22:40:44 | FromDiscord | <System64 ~ Flandre Scarlet> yeah it works for normal functions |
22:40:50 | FromDiscord | <System64 ~ Flandre Scarlet> gotta update it then |
22:42:02 | PMunch | Are you still using Futhark by the way, for the low-level stuff? |
22:42:41 | FromDiscord | <System64 ~ Flandre Scarlet> Yeah |
22:42:46 | FromDiscord | <System64 ~ Flandre Scarlet> it works so well! |
22:43:16 | PMunch | Great to hear :) |
22:43:29 | PMunch | Sorry you had so much trouble getting it set up though |
22:43:51 | PMunch | I've been surprised myself actually by how well it works :P |
22:44:10 | FromDiscord | <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:22 | FromDiscord | <System64 ~ Flandre Scarlet> Btw, tried to update, doesn't work https://media.discordapp.net/attachments/371759389889003532/949799558265860106/unknown.png |
22:45:38 | PMunch | That's because you're trying to recursively run setRasterCallback |
22:45:50 | PMunch | Line 61 should be TLN_SetRasterCallback |
22:46:25 | FromDiscord | <System64 ~ Flandre Scarlet> ah now it works! |
22:48:17 | FromDiscord | <System64 ~ Flandre Scarlet> yeaaaah https://media.discordapp.net/attachments/371759389889003532/949800547492442172/unknown.png |
22:48:58 | PMunch | Nice, looks like a broken TV :P |
22:49:21 | FromDiscord | <System64 ~ Flandre Scarlet> This graphics engine is so powerful! |
22:49:31 | * | kayabaNerve quit (Ping timeout: 245 seconds) |
22:50:09 | FromDiscord | <System64 ~ Flandre Scarlet> Btw is the method you provided safe? (I meant, no memory leaks or smth) |
22:50:52 | PMunch | Yup, should be perfectly safe |
22:51:10 | FromDiscord | <System64 ~ Flandre Scarlet> Aaaah nice! |
22:51:19 | PMunch | As long as the C code is doing something horrendous |
22:51:24 | PMunch | isn't* |
22:51:51 | FromDiscord | <System64 ~ Flandre Scarlet> In this case it should be the Engine's faumt |
22:51:54 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "faumt" => "fault" |
22:52:25 | NimEventer | New thread by Joekillian: Here is a Svelte + F# - Sutil., see https://forum.nim-lang.org/t/8981 |
22:53:50 | FromDiscord | <System64 ~ Flandre Scarlet> I also wrote a color converter |
22:55:16 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3RrO |
22:58:05 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Are you still using": https://github.com/WohlSoft/SDL-Mixer-X↵I should Futhark that |
22:59:11 | FromDiscord | <System64 ~ Flandre Scarlet> 'cause I think this library is a MONSTER |
22:59:18 | PMunch | Futhark ALL the things! |
23:01:22 | FromDiscord | <System64 ~ Flandre Scarlet> this lib support a ton of formats! even Chiptunes such as VGM, SPC, NSF, ... |
23:09:15 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/WohlSoft/SDL-Mixer-X/blob/master/include/SDL_mixer.h↵I guess I just need that |
23:20:31 | FromDiscord | <Schelz> I got a question if I use {.passC: "-I" &"/imgui-master/backends" & " -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1".} |
23:21:23 | FromDiscord | <Schelz> when using header in a proc does the string need "/" at the start ? |
23:22:15 | FromDiscord | <Schelz> for example proc thisfunc(smth: bool): bool {.importcpp: "newfunc", header: "thisheader".} |
23:22:28 | FromDiscord | <Schelz> (edit) "proc" => "``proc" | ""thisheader".}" => ""thisheader".}``" |
23:23:24 | FromDiscord | <Schelz> cause the compile doesnt through any error with and without the "/" for the header |
23:25:27 | FromDiscord | <demotomohiro> That header pragma generate `#include "thisheader"`. Nim doesn't show error, but back end C++ compiler can. |
23:26:11 | FromDiscord | <Schelz> you mean nim cpp "file.nim" ? |
23:26:19 | FromDiscord | <demotomohiro> Why do you add "/" at the start? |
23:26:50 | FromDiscord | <Schelz> because i its one level up in a folder |
23:27:00 | FromDiscord | <Schelz> (edit) removed "i" |
23:27:38 | FromDiscord | <demotomohiro> yes. You are using `importcpp` so that means you are using c++ header file, isnt it? |
23:27:55 | FromDiscord | <Schelz> your right that was a dumb question nvm |
23:29:30 | FromDiscord | <demotomohiro> Then, I think you need to write `header:"../thisheader"` or add `--passC:../` compiler option. |
23:29:53 | FromDiscord | <Schelz> for ``{.passC: "-I" & "/some/folder".} `` needs "/" at the end ? |
23:29:57 | PMunch | Hmm, 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:08 | FromDiscord | <Schelz> In reply to @Schelz "for ``{.passC: "-I" &": with this question i should have started |
23:30:22 | FromDiscord | <demotomohiro> `--passC:-I../` |
23:31:09 | FromDiscord | <Schelz> i use in the code not in the compile command |
23:31:24 | FromDiscord | <Schelz> (edit) "i use ... in" added "it" |
23:34:22 | FromDiscord | <demotomohiro> I don't think `{.passC:"-I"&"/some/folder".} needs "/" at the end. |
23:38:22 | FromDiscord | <demotomohiro> `-I` gcc option always takes directory. |
23:46:40 | * | krux02 quit (Remote host closed the connection) |