00:08:23 | FromDiscord | <Elegantbeef> Presently it's just cause seqs/strings have the same internal representation, if either one changes it stops working |
00:11:46 | * | rockcavera quit (Remote host closed the connection) |
00:15:20 | * | rockcavera joined #nim |
00:40:14 | nrds | <Prestige99> Elegantbeef I have an interesting question for you, if you have a min to look. Has to do with that animation macro |
00:40:54 | nrds | <Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/commit/39443345601dfd2b750b829db9aa4880cf5ec8dd/src/shadepkg/game/animation.nim#L165 this assignment can't be done with a proc/template in the `foo=` form, but I'd like it to. Would I need a special case for it? |
00:41:31 | nrds | <Prestige99> Curious if I could just generate an AST that'd be parsed in the same way as writing "foo = 5" where `foo=` is a proc |
00:47:39 | FromDiscord | <Elegantbeef> properties only work applied on a symbol |
00:48:58 | FromDiscord | <Elegantbeef> Unless you use accquotes as such https://play.nim-lang.org/#ix=3B3w |
00:55:23 | nrds | <Prestige99> hmm |
00:57:29 | FromDiscord | <Elegantbeef> I suppose if you had foo be `proc foo=(a: typedesc[void], val: int)` you could do `void.foo = val` 😛 |
00:58:23 | nrds | <Prestige99> atm I have method `scale=`*(this: Node, scale: DVec2) - thoughts? |
00:58:40 | nrds | <Prestige99> Maybe I've coded myself into a corner.. didn't expect this to break down with the animation system |
00:58:45 | FromDiscord | <Elegantbeef> Use a macro to check if it's a property |
00:59:48 | nrds | <Prestige99> Like to see if it's a proc ending with = ? |
00:59:55 | FromDiscord | <Elegantbeef> Yes |
01:01:21 | FromDiscord | <Elegantbeef> Also this compiles? https://git.einheit.tech/EinheitTechnologies/shade/src/commit/39443345601dfd2b750b829db9aa4880cf5ec8dd/src/shadepkg/game/animation.nim#L151 shouldnt it be `isnot` |
01:01:36 | nrds | <Prestige99> it works yeah |
01:01:46 | FromDiscord | <Elegantbeef> Odd |
01:03:09 | nrds | <Prestige99> https://git.einheit.tech/EinheitTechnologies/shade/src/commit/39443345601dfd2b750b829db9aa4880cf5ec8dd/examples/basic/animationplayer_example.nim#L42 is the particular case I'm having an issue with |
01:03:26 | nrds | <Prestige99> I'm passing in `king.scale` so I don't think the macro can see it's a proc? |
01:04:52 | FromDiscord | <Elegantbeef> Where is scale? |
01:05:12 | FromDiscord | <Elegantbeef> Ah i've found it |
01:05:18 | FromDiscord | <Elegantbeef> you're passing the setter #1 |
01:05:33 | nrds | <Prestige99> Right |
01:05:42 | FromDiscord | <Elegantbeef> so you'll need to do \`\`\` `scale=`(king)\`\`\`\` |
01:05:44 | FromDiscord | <Elegantbeef> I mean getter |
01:05:51 | nrds | <Prestige99> oh |
01:06:33 | FromDiscord | <Elegantbeef> it's a typed macro so with that you can get if it's a property |
01:06:58 | FromDiscord | <Elegantbeef> I dont quite get why this is a macro |
01:07:31 | FromDiscord | <Elegantbeef> You're using 0 introspection, so i think this'd work as a template |
01:08:37 | nrds | <Prestige99> But it'll need to be one to check if it's a property vs a setter yeah? |
01:09:07 | FromDiscord | <Elegantbeef> Not really since you can make a macro that does it for you 😀 |
01:09:44 | nrds | <Prestige99> I wish I could just pretend it's a property when I pass it into the macro/template 🤔 |
01:09:53 | nrds | <Prestige99> instead of scale=(king) or w/e |
01:10:35 | FromDiscord | <Elegantbeef> You can do `king.scale` check if it's a proc/method if so add a `=` |
01:13:17 | FromDiscord | <gnu+linux user> In reply to @รєคɭ๓๏שє "haven't seen any Hacktoberfest": what does it have to do with me |
01:21:10 | FromDiscord | <Elegantbeef> Prestige for instance this https://play.nim-lang.org/#ix=3B3I |
01:22:26 | FromDiscord | <Elegantbeef> that `newLit(10)` should be whatever you feed into the value, this can just be called inside the proc |
02:01:26 | * | krux02 quit (Remote host closed the connection) |
02:01:37 | NimEventer | New thread by Rb3: How to use memory leak detection tools on Windows with --gc:arc and -d:useMalloc?, see https://forum.nim-lang.org/t/8483 |
02:08:35 | FromDiscord | <Varriount> @PMunch Can futhark handle Windows API headers? |
02:14:02 | FromDiscord | <NullCode> for windows api, use `winim` |
02:14:17 | FromDiscord | <NullCode> https://github.com/khchen/winim/ |
02:14:18 | nrds | <R2D299> itHub: 7"Nim's Windows API and COM Library" |
02:14:23 | FromDiscord | <NullCode> it's just better |
02:16:08 | * | Zevv joined #nim |
02:23:17 | * | arkurious quit (Quit: Leaving) |
02:51:49 | nrds | <Prestige99> Is there a place that defines what all the nim node kinds are? |
02:55:39 | FromDiscord | <impbox [ftsf]> it's an enum so i guess so |
02:56:06 | nrds | <Prestige99> I meant like, documentation |
02:56:20 | FromDiscord | <impbox [ftsf]> https://github.com/nim-lang/Nim/blob/devel/lib/core/macros.nim#L26 |
02:57:20 | FromDiscord | <impbox [ftsf]> I think that's all you get, the names are mostly easy to figure out, but if you've got questions |
02:57:37 | FromDiscord | <impbox [ftsf]> I guess you can also just create some and look at their repr |
02:57:44 | nrds | <Prestige99> Thanks |
02:59:25 | FromDiscord | <SirFozz> Is there any difference between `%%` and `mod`? |
03:00:24 | FromDiscord | <impbox [ftsf]> yep! |
03:01:37 | FromDiscord | <impbox [ftsf]> https://play.nim-lang.org/#ix=3B42 |
03:01:49 | FromDiscord | <SirFozz> Wait I believe I found it |
03:02:10 | FromDiscord | <SirFozz> `%%` Can only accept ints as arguments |
03:02:31 | FromDiscord | <impbox [ftsf]> they have different behaviours for negatives |
03:02:42 | FromDiscord | <SirFozz> Oh really |
03:02:55 | FromDiscord | <impbox [ftsf]> check the output of that example i posted |
03:02:55 | FromDiscord | <SirFozz> I'll check that link out |
03:02:58 | FromDiscord | <SirFozz> Yeah |
03:04:02 | FromDiscord | <SirFozz> I though it was just redundancy at first, but that's neat |
03:04:06 | FromDiscord | <SirFozz> Thank you for the help |
03:05:05 | FromDiscord | <impbox [ftsf]> probably we should add in runnable examples for %% like mod has |
03:05:44 | FromDiscord | <impbox [ftsf]> %% is implemented as `cast[int](cast[uint](x) mod cast[uint](y))` |
03:06:15 | FromDiscord | <Rika> How fun |
03:06:18 | FromDiscord | <impbox [ftsf]> hmm weird, i thought it would convert them rather than cast |
03:09:13 | FromDiscord | <impbox [ftsf]> seems the result is the same shrug |
03:51:49 | NimEventer | New thread by Alexeypetrushin: Question about algorithm.upperBound, see https://forum.nim-lang.org/t/8484 |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:31 | * | supakeen joined #nim |
04:39:54 | * | xet7 quit (Remote host closed the connection) |
04:40:57 | * | xet7 joined #nim |
05:00:03 | * | rockcavera quit (Remote host closed the connection) |
05:55:51 | FromDiscord | <NullCode> https://media.discordapp.net/attachments/371759389889003532/895549963512201226/unknown.png |
05:55:56 | FromDiscord | <NullCode> if there are more than 1 defer |
05:56:04 | FromDiscord | <NullCode> which one's executed last? |
05:56:10 | FromDiscord | <impbox [ftsf]> did you check? |
05:56:20 | FromDiscord | <NullCode> docs? |
05:56:27 | FromDiscord | <impbox [ftsf]> try it out and see what happens |
05:56:30 | FromDiscord | <Elegantbeef> first in last out |
05:56:47 | FromDiscord | <NullCode> oh so first one's executed last |
05:56:48 | FromDiscord | <NullCode> gotchu |
05:56:54 | FromDiscord | <NullCode> In reply to @impbox "try it out and": well it's not clear |
05:56:59 | FromDiscord | <Elegantbeef> well it defers everything after the body |
05:57:17 | FromDiscord | <Elegantbeef> so after everything below it is ran the defer body is ran |
05:57:31 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3B4B |
05:57:44 | FromDiscord | <NullCode> In reply to @Elegantbeef "so after everything below": yeah |
05:57:49 | FromDiscord | <Elegantbeef> FILO 😛 |
05:58:04 | FromDiscord | <NullCode> but since i was told `defer` does stuff at the very end |
05:58:08 | FromDiscord | <Elegantbeef> Impbox that isnt getting nicoscripter running, how dare you not work 24/7 on it |
05:58:17 | FromDiscord | <impbox [ftsf]> i'm at work atm =p |
05:58:36 | FromDiscord | <impbox [ftsf]> will get back to nicoscripter this evening |
05:58:39 | FromDiscord | <NullCode> (edit) "end" => "end↵i was wondering what starts first after ending last" |
05:58:42 | FromDiscord | <Elegantbeef> I mean if it did it any other way it'd not be defered |
05:58:50 | FromDiscord | <impbox [ftsf]> though i'm kind of at a loss as to how to proceed with it |
06:00:32 | FromDiscord | <Elegantbeef> Yea like i said i can always take a look if you want |
06:00:52 | FromDiscord | <impbox [ftsf]> yeah, gotta sort out some stuff before i can send since i had to change stuff in nico |
06:00:58 | FromDiscord | <Elegantbeef> Ah |
06:01:06 | FromDiscord | <Elegantbeef> sorry 😛 |
06:02:22 | FromDiscord | <Elegantbeef> But the NimVM ran the code fine if you didnt reload? |
06:02:26 | FromDiscord | <impbox [ftsf]> nah |
06:02:38 | FromDiscord | <impbox [ftsf]> it compiles it, but errors on invoke |
06:02:55 | FromDiscord | <Elegantbeef> Did the code work in a native build? |
06:02:59 | FromDiscord | <impbox [ftsf]> yep |
06:03:13 | FromDiscord | <impbox [ftsf]> (i better check it still works) |
06:04:02 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3B4F |
06:04:08 | * | vicfred quit (Quit: Leaving) |
06:04:14 | FromDiscord | <Elegantbeef> If it does perhaps a emscripten issue with the nimvm, making the nimscript just `echo "Hello world"` with no additions, imports, or anything is where we should start i guess |
06:04:28 | FromDiscord | <impbox [ftsf]> no error if the functions are just discard |
06:04:44 | FromDiscord | <Elegantbeef> Guess i should go copy treeforms emscripten example and do some tests with just a console app |
06:04:49 | FromDiscord | <impbox [ftsf]> no error if just echoing |
06:04:56 | FromDiscord | <impbox [ftsf]> i'll tar up now and send to you |
06:09:13 | FromDiscord | <impbox [ftsf]> @ElegantBeef https://github.com/ftsf/nico/tree/nicoscripter https://github.com/ftsf/nico/tree/nicoscripter/examples/nicoscripter |
06:09:26 | FromDiscord | <impbox [ftsf]> can run `nimble webr` from examples/nicoscripter to build for web |
06:09:38 | FromDiscord | <Elegantbeef> ok thanks! |
06:10:09 | FromDiscord | <impbox [ftsf]> assuming you have emscripten installed |
06:10:18 | FromDiscord | <Elegantbeef> Yea i do |
06:13:46 | * | neurocyte0132889 joined #nim |
06:13:46 | * | neurocyte0132889 quit (Changing host) |
06:13:46 | * | neurocyte0132889 joined #nim |
06:20:27 | FromDiscord | <Rika> isnt it in the docs how defers are run |
06:21:19 | FromDiscord | <Elegantbeef> Odd emscripten errors with a python error, lovely |
06:22:13 | FromDiscord | <impbox [ftsf]> @Rika doesn't seem like it's in the manual |
06:22:17 | FromDiscord | <impbox [ftsf]> D: |
06:22:21 | FromDiscord | <Rika> i remember it being documented |
06:22:31 | FromDiscord | <impbox [ftsf]> yeah sounds familiar too |
06:22:32 | FromDiscord | <Rika> because i know the order before having tried |
06:26:30 | FromDiscord | <Elegantbeef> I really wish software just worked |
06:26:40 | FromDiscord | <impbox [ftsf]> that'd be nice |
06:31:27 | FromDiscord | <Rika> i wish software is sound as soon as i write it |
06:31:36 | FromDiscord | <Rika> a world where tests arent needed xddd |
06:33:47 | FromDiscord | <Elegantbeef> Ah issue was emcc was expecting llvm11 but i gave it 12 it seems |
06:34:38 | FromDiscord | <impbox [ftsf]> you monster |
06:35:18 | FromDiscord | <Elegantbeef> How dare i have multiple llvm versions 😛 |
06:35:52 | FromDiscord | <Elegantbeef> `Aborted(No EM_ASM constant found at address 169128)` much more interesting error |
06:37:30 | FromDiscord | <retkid> whats the fastest way to do threading |
06:37:42 | FromDiscord | <retkid> do i just spawn all the tasks i need to do whenever? |
06:37:58 | FromDiscord | <retkid> well i take that back |
06:38:09 | FromDiscord | <retkid> does anyone have a good write up on threading in nim? |
06:40:11 | FromDiscord | <Rika> uh |
06:40:15 | FromDiscord | <Rika> i feel like we do |
06:40:19 | FromDiscord | <Rika> but i dont recall where |
06:40:24 | FromDiscord | <retkid> I looked for a little bit |
06:40:34 | FromDiscord | <retkid> threadpools doesn't have anything on the manual |
06:40:37 | FromDiscord | <Rika> gumberrrrrrrrr your lectures are needed |
06:40:37 | FromDiscord | <retkid> threads does tho |
06:41:13 | FromDiscord | <retkid> how about instead of him lecture, he add it to the manual...↵↵i was reading one of the nim guides on it, and half way it turned into german and i was like "alrighty then" |
06:44:33 | * | jjido joined #nim |
06:46:37 | FromDiscord | <impbox [ftsf]> if you have nim-in-action it has a section on threads |
06:46:46 | FromDiscord | <retkid> its not too extensive |
06:47:07 | FromDiscord | <retkid> and nothing on pools |
06:47:25 | FromDiscord | <impbox [ftsf]> chapter 6.2.2 is about thread pools |
06:47:28 | FromDiscord | <retkid> ooo |
06:47:31 | FromDiscord | <retkid> maybe i mssed |
06:47:33 | FromDiscord | <retkid> (edit) "mssed" => "missed" |
06:48:11 | FromDiscord | <impbox [ftsf]> i haven't read the threads stuff much so i dunno how useful it is, but it seems to have a fair chunk of content |
06:48:43 | FromDiscord | <impbox [ftsf]> in general i'd recommend the book though |
06:49:09 | FromDiscord | <retkid> my initial instinct is the pool should be equal to the amount of threads available to the cpu, and instructions get sent in, each one sent to each thread |
06:49:26 | FromDiscord | <retkid> and each instruction must wait for the next avalible slot |
06:49:28 | FromDiscord | <retkid> (edit) "avalible" => "available" |
06:49:36 | FromDiscord | <retkid> (edit) "and each instruction must wait for the next available slot ... " added "of 3" |
06:49:37 | FromDiscord | <retkid> (edit) "3" => "4" |
06:49:39 | FromDiscord | <Elegantbeef> Well i cannot get nico to run with wasm so that's fun |
06:49:39 | FromDiscord | <retkid> (edit) "4" => "x" |
06:49:56 | FromDiscord | <Elegantbeef> your project does not run for me ☹️ |
06:50:00 | FromDiscord | <impbox [ftsf]> D: |
06:50:03 | FromDiscord | <retkid> D: |
06:50:05 | FromDiscord | <retkid> BAD |
06:50:19 | FromDiscord | <impbox [ftsf]> does it build? |
06:50:33 | FromDiscord | <Elegantbeef> It builds but aborts on initing nico |
06:50:57 | FromDiscord | <Rika> oh man job scheduling |
06:51:06 | FromDiscord | <Rika> In reply to @retkid "and each instruction must": job scheduling is relatively complex |
06:52:59 | FromDiscord | <retkid> In reply to @Rika "job scheduling is relatively": Yea i want to know about that but cant find muhc |
06:53:04 | FromDiscord | <retkid> (edit) "muhc" => "much" |
06:53:12 | FromDiscord | <retkid> suppose thats overkill for what im doing |
06:53:17 | FromDiscord | <Rika> because its not exactly beginner level |
06:53:23 | FromDiscord | <Rika> rather |
06:53:35 | FromDiscord | <Rika> not many people write beginner level content on job scheduling |
06:53:40 | FromDiscord | <retkid> Is it a thing where you probably learned it somewhere else |
06:53:50 | FromDiscord | <retkid> and can apply the concepts to nim |
06:53:54 | FromDiscord | <Rika> yes |
06:54:13 | FromDiscord | <retkid> coolio |
06:54:14 | FromDiscord | <retkid> well |
06:54:44 | * | PMunch joined #nim |
06:54:45 | FromDiscord | <Elegantbeef> Ah seems llvm12 fucked stuff up |
06:54:51 | FromDiscord | <retkid> I've never done multi threading before so I suppose i will continue to dig or I'll learn it in Kotlin |
06:54:58 | FromDiscord | <retkid> if kotlin can even do trhat |
06:55:01 | FromDiscord | <retkid> (edit) "trhat" => "that" |
06:55:37 | FromDiscord | <Rika> it can afaik |
06:57:03 | PMunch | Hmm, that reminds me, I should write my multi-threading in Nim article soon |
06:57:28 | FromDiscord | <Elegantbeef> Indeed you should |
06:57:34 | FromDiscord | <Elegantbeef> Get at it, best be done by tomorrow |
06:57:57 | PMunch | But I'm busy.. |
06:58:11 | FromDiscord | <impbox [ftsf]> bebestdonebtomoryrow |
06:58:50 | FromDiscord | <Elegantbeef> Sorry we dont speak australian |
07:05:49 | * | max22- joined #nim |
07:07:22 | FromDiscord | <Elegantbeef> I might be wrong impbox but the issue seems possibly caused by the last line's odd indentation in the html |
07:08:04 | FromDiscord | <impbox [ftsf]> o_O |
07:08:05 | FromDiscord | <Elegantbeef> Or not |
07:08:21 | FromDiscord | <impbox [ftsf]> the problem I was having? or the problem you're having? |
07:08:50 | FromDiscord | <Elegantbeef> Yours, but i was wrong |
07:11:09 | PMunch | What's the issue? |
07:11:40 | FromDiscord | <Elegantbeef> The Vm isnt playing well with the iterative calling in wasm |
07:11:49 | FromDiscord | <Elegantbeef> Update/draw are where the issue occurs |
07:12:33 | FromDiscord | <Elegantbeef> Actually it's any proc that's implemented |
07:12:37 | FromDiscord | <Elegantbeef> Odd |
07:14:20 | FromDiscord | <Elegantbeef> ponders if it's a 32bit issue or an emscripten issue |
07:21:18 | FromDiscord | <Elegantbeef> Actually it could be a me problem with implemented routines |
07:21:58 | * | neurocyte0132889 quit (Read error: Connection reset by peer) |
07:23:12 | * | neurocyte0132889 joined #nim |
07:23:13 | * | neurocyte0132889 quit (Changing host) |
07:23:13 | * | neurocyte0132889 joined #nim |
07:29:58 | FromDiscord | <impbox [ftsf]> feel free to blame my code too |
07:30:18 | FromDiscord | <impbox [ftsf]> maybe we should test with something less crazy |
07:31:01 | FromDiscord | <impbox [ftsf]> export just some simpler procs |
07:31:23 | FromDiscord | <Elegantbeef> Indeed |
07:31:41 | FromDiscord | <Elegantbeef> Though i have a feeling they'll not work |
07:41:10 | FromDiscord | <NullCode> i wonder if i should wrap a 7z library |
07:41:13 | FromDiscord | <NullCode> to understand how this works |
07:42:47 | * | neurocyte0132889 quit (Read error: Connection reset by peer) |
07:43:12 | * | neurocyte0132889 joined #nim |
07:43:12 | * | neurocyte0132889 quit (Changing host) |
07:43:12 | * | neurocyte0132889 joined #nim |
07:54:38 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:05:50 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
09:02:39 | PMunch | @hotdog are you around? |
09:03:11 | PMunch | I added a rename callback, but I wanted to see what you thought of it before I merged it into master: https://github.com/PMunch/futhark/pull/2 |
09:09:28 | PMunch | Hmm, this is an interesting bug: https://play.nim-lang.org/#ix=3B54 |
09:12:23 | PMunch | It seems like it isn't able to see the NilLit as a valid proc.. |
09:27:28 | FromDiscord | <qb> Does nim have pbkdf2 somewhere? |
09:29:09 | FromDiscord | <qb> To be more precise im looking for https://docs.python.org/3/library/hashlib.html#hashlib.pbkdf2_hmac |
09:33:04 | FromDiscord | <enthus1ast> @qb\: this? https://github.com/cheatfate/nimcrypto/blob/master/nimcrypto/pbkdf2.nim |
09:57:52 | FromDiscord | <Clonkk> What's the rules when using C++ type that already have move / copy rules and destructor defined with `=sink` / `=copy` / `=destroy` ? |
09:59:13 | FromDiscord | <haxscramper> Unknown |
09:59:26 | FromDiscord | <haxscramper> This is an open question how this should be mapped to the Nim code |
09:59:28 | FromDiscord | <Clonkk> That explains why I didn't know how it worked then \:D |
10:00:12 | FromDiscord | <haxscramper> Cxx destructor is invoked unconditionally, though if you are using ref T with placement new you might want to call it explicitly in the finalizer |
10:00:40 | FromDiscord | <haxscramper> Non-copyable objects might be mapped to =copy {.error.} |
10:00:58 | FromDiscord | <haxscramper> Better to have nim errors than cxx codegen failures |
10:01:06 | FromDiscord | <hotdog> In reply to @PMunch "<@472459996068839424> are you around?": Hey I'm here |
10:01:18 | FromDiscord | <hotdog> In reply to @PMunch "I added a rename": Thanks! I'll have a look |
10:01:23 | FromDiscord | <haxscramper> Non default-constructible can be mapped to {. requiresinit.} |
10:01:36 | FromDiscord | <Clonkk> The issue is getting stuff lke std\:\:unique\_ptr to work with Nim object |
10:01:40 | FromDiscord | <haxscramper> =sink - no idea |
10:01:59 | FromDiscord | <Clonkk> Currently, the Nim `=destroy` hooks do not get called |
10:02:04 | FromDiscord | <haxscramper> You mean ref object? |
10:02:10 | FromDiscord | <Clonkk> Same for pushing objetc into a std\:\:vector from Nim bindings |
10:02:30 | FromDiscord | <haxscramper> For impprtcpp objects or for nim ones? |
10:03:12 | FromDiscord | <Clonkk> Potentially, it's a generic type T. Shouldn't matter though; any object type can have `=destroy` hook and `=sink` hook that sould be called when performing operation on C++ containers |
10:03:48 | FromDiscord | <haxscramper> Oh, is see. Yes, this is a problem really. |
10:04:08 | FromDiscord | <haxscramper> You work with c++ containers on the C++ side or on nim side? |
10:04:22 | FromDiscord | <Clonkk> https://github.com/Clonkk/nim-cppstl/issues/15 |
10:05:07 | FromDiscord | <Clonkk> The setting is Nim binding to C++ class (std\:\:vector, std\:\:unique\_ptr, std\:\:shared\_ptr). From Nim side you have `CppVector` which is a binding to std\:\:vector |
10:05:57 | FromDiscord | <Clonkk> Ideally pushing a Nim object in a `CppVector` should keep the memory consistent during Move / copy / destroy |
10:06:18 | FromDiscord | <Clonkk> The issue will arise with any C++ library that uses containers or smart pointer (or worse custom smart pointers / custom containers) |
10:07:46 | FromDiscord | <haxscramper> Another pain point that has to be solved I guess |
10:08:30 | FromDiscord | <haxscramper> Right now I don't think I have any concrete ideas about how to solve this, at least without digging into codegen and examining all interactions |
10:11:45 | FromDiscord | <haxscramper> But generally speaking I'm not sure if this can be achieved without making some very strange codegen and emit hacks, or making some sort of NimAcceptor cxx object that manages lifetime by calling destructors, moves and so on. |
10:12:07 | FromDiscord | <haxscramper> Right now this is just a hypothesis |
10:17:58 | FromDiscord | <Clonkk> Right, so I don't know anything about codegen in the compiler. My gut feeling (probably wrong) is that Nim `=sink` / `=copy` / `=destroy` is very similar to the "rule of 3" in C++, so I would assume managing lifetime of a C++ object through Nim's hooks is do-able |
10:18:13 | FromDiscord | <Clonkk> So it should be, at the very least, "mappable" |
10:19:07 | FromDiscord | <Clonkk> Then there's also the issue of copy assignment being deleted in C++ causing all sort of codegen bugs |
10:20:07 | FromDiscord | <Clonkk> If Nim handles copy by calling the C++ version of the `=copy` hooks for instance, you'd avoid the codegen error (and most likely having a `=copy` that's not an error if copy assignment is deleted is a bug) |
10:20:52 | FromDiscord | <Clonkk> Currently, if `=copy` is declared as a {.error.}, the codegen can still generate C++ copy assignmet \:) (which of course doesn't compile) |
10:22:50 | FromDiscord | <haxscramper> Wait what |
10:24:02 | FromDiscord | <haxscramper> We can double down on dirty hacks and put emit everywhere, maybe it will provide a solution that is at least correct wrt. to runtime behavior |
10:24:13 | * | krux02 joined #nim |
10:25:21 | FromDiscord | <haxscramper> Sink is an optimization, while in cxx move constructor is guaranteed to be called, something like that |
10:25:36 | FromDiscord | <haxscramper> Nim uses sink optionally |
10:25:49 | FromDiscord | <haxscramper> I don't know how reliable the rules are |
10:26:17 | FromDiscord | <haxscramper> For example when passing to a function, depending on the further uses of a given object it might be either a copy or a sink |
10:26:18 | FromDiscord | <haxscramper> And so on |
10:26:35 | FromDiscord | <haxscramper> We are talking about assignment, but even in this case behavior is unclear to me |
10:27:45 | FromDiscord | <Clonkk> I thought the difference was that C++ gives you a syntax to explicitly do one of the other (i.e. DYI solution) while Nim estimates based on memory ownership, size of object (and maybe other heuristics) whether it can move or should copy ? |
10:28:27 | FromDiscord | <Clonkk> If it's optionnal then I don't understand sink parameters in function |
10:29:34 | FromDiscord | <haxscramper> Well, sink is an optimization, it cannot make your code more correct |
10:30:16 | FromDiscord | <haxscramper> So cxx might use it for unique pointers and other things to explicitly transfer ownership, I don't think nim can do this |
10:30:55 | FromDiscord | <haxscramper> I need to write some basic test suite that shows these differences, I'm not really sure myself how they are handled |
10:35:12 | FromDiscord | <Clonkk> Okay |
10:35:32 | FromDiscord | <Clonkk> This probably also means that mapping `=destroy` to the object destructor is actually wrong |
10:35:53 | FromDiscord | <Clonkk> You then have a Nim hoo kthat explicitly calls a C++ destructor when C++ destructor would already be called |
10:36:14 | FromDiscord | <Clonkk> (which can still work if Nim generate hooks in the right place, but there'sn oguarantee) |
10:45:49 | FromDiscord | <haxscramper> It would be much better if nim had precise tools to manage object lifetimes, like default or explicit construction, "require moved argument", "disallow copy" and so on |
11:11:17 | FromDiscord | <tandy> what would `sizeof(MD5Buffer = array[0..63, uint8])` output? 63? |
11:11:36 | FromDiscord | <enthus1ast> 64 |
11:11:44 | FromDiscord | <tandy> ok ty |
11:12:07 | FromDiscord | <enthus1ast> at least array[0..63, uint8] is 64 byte |
11:12:25 | FromDiscord | <enthus1ast> not sure if you can assign in sizeof |
11:21:57 | FromDiscord | <tandy> does this look right? |
11:21:57 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3B5G |
11:22:12 | FromDiscord | <tandy> i took code from nimSetMem |
11:22:50 | FromDiscord | <hotdog> @PMunch should I test this in my wrapper? Or is it in progress? I've set up your branch but can't figure out how to add the callback |
11:22:52 | FromDiscord | <tandy> sent a code paste, see https://paste.rs/rbb |
11:23:04 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3B5H |
11:24:35 | PMunch | @hotdog, please do :) Here is an example on how the callback can be added: https://github.com/PMunch/futhark/pull/3/files |
11:25:23 | PMunch | With line 13 obviously not commented out :P |
11:27:47 | FromDiscord | <hotdog> @PMunch ah I think it's just picking up the cached version, even though the callback has changed |
11:28:11 | FromDiscord | <hotdog> Is there a flag to ignore the cache? |
11:28:21 | PMunch | Ah yes, you need to reset your futhark cache for the callback to be called again. I guess I should add that to the README.. |
11:28:44 | PMunch | No flag as of right now, simply delete the futhark_<hash>.nim file from your nimcache directory |
11:29:27 | PMunch | I wanted to have it ignore the cache when -f was passed. But I couldn't figure out how |
11:31:18 | FromDiscord | <hotdog> Gotcha |
11:32:18 | FromDiscord | <hotdog> Might be worth hashing the callback proc and using that in the cache too. Not sure if there's something in stdlib |
11:33:58 | PMunch | Hmm, yes that would be a good idea.. |
11:34:17 | PMunch | Not entirely sure I can cache a proc though |
11:34:25 | PMunch | Or hash a proc rather |
11:34:40 | PMunch | Added a switch to master now that prevents cache usage |
11:35:15 | PMunch | `git fetch --all && git rebase master` should bring them into the branch you're on |
11:36:03 | FromDiscord | <hotdog> @PMunch never used it, but this may work - https://nim-lang.org/docs/macros.html#symBodyHash%2CNimNode |
11:36:17 | PMunch | I also force pushed it over the branch now |
11:36:34 | FromDiscord | <hotdog> In reply to @PMunch "Added a switch to": Cool |
11:36:58 | PMunch | Question is just if I actually get the proc as a symbol |
11:38:26 | FromDiscord | <hotdog> Ah |
11:44:33 | PMunch | Yeah I just get an error saying that `renameCallback` is of type RenameCallback while it expects a NimNode |
11:54:25 | * | Vladar joined #nim |
12:00:19 | * | max22- quit (Ping timeout: 265 seconds) |
12:04:14 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:30 | * | supakeen joined #nim |
12:07:57 | * | neurocyte0132889 joined #nim |
12:07:57 | * | neurocyte0132889 quit (Changing host) |
12:07:57 | * | neurocyte0132889 joined #nim |
12:10:39 | FromDiscord | <hotdog> @PMunch in the rename callback do I need to handle name collisions? Or will Futhark still do that with the output of the rename cb? |
12:11:32 | PMunch | Futhark will still run it through it's renaming scheme |
12:11:38 | PMunch | its* |
12:11:42 | FromDiscord | <hotdog> Ok cool |
12:12:10 | PMunch | So first your callback is run, then it removes _ and __, normalizes the identifier, and adds kind and hash if there are collisions |
12:12:25 | FromDiscord | <hotdog> I see |
12:12:57 | FromDiscord | <hotdog> I get an error now, on an enum type that does not get renamed by my callback: `futhark.nim(612, 22) Error: type expected, but symbol 'Jackoptionsenum' has no type.` |
12:13:34 | FromDiscord | <hotdog> Removing the callback stops the error, but the callback does not modify that name at all |
12:15:13 | PMunch | Hmm, do you return the "name" argument in your callback? |
12:15:23 | FromDiscord | <hotdog> Yeah |
12:15:29 | PMunch | Try simply running the compiler again |
12:15:34 | PMunch | Without making any changes to your file |
12:15:40 | FromDiscord | <hotdog> Same each time |
12:16:00 | PMunch | Without the futharkReload flag |
12:16:13 | FromDiscord | <hotdog> If I don't clear the cache, I get `futhark_F7EB25CF51BFC97C.nim(171, 5) Error: undeclared identifier: 'Jackoptionsenum_18930414'` |
12:16:14 | PMunch | futharkRebuild* |
12:16:19 | PMunch | Ah okay |
12:16:27 | PMunch | So it's not the weird bug I saw earlier |
12:16:46 | PMunch | Can you share your wrapper? |
12:17:23 | FromDiscord | <hotdog> Yeah let me clean it up and I'll push it |
12:17:24 | FromDiscord | <hotdog> 2m |
12:18:55 | PMunch | Just pushed a small commit that adds the hash of the callback to the file, thanks for that suggestion! |
12:19:22 | FromDiscord | <hotdog> Oh cool! |
12:19:36 | PMunch | Figured out a way to do it :) |
12:20:23 | FromDiscord | <hotdog> Yeah I just had a look to see how you did it |
12:20:36 | FromDiscord | <hotdog> Good macro wrangling |
12:23:57 | PMunch | Haha, that's my jam :P |
12:28:48 | * | NeoCron joined #nim |
12:30:22 | FromDiscord | <hotdog> Can I pass a dynamic path for the headers? |
12:30:43 | FromDiscord | <hotdog> If so I'll stick the headers I've got in the repo so you can test the same ones I'm using |
12:31:36 | FromDiscord | <hotdog> Oh ignore that, I was doing something dumb |
12:33:19 | * | jjido joined #nim |
12:35:31 | FromDiscord | <hotdog> @PMunch https://github.com/geotre/jack/blob/main/src/jack.nim |
12:39:43 | * | arkurious joined #nim |
12:54:37 | PMunch | Hmm, after adding the path to my C library files I get an Error: Unknown kind in findAlias: {"kind":"invalid","value":"invalid?"} error |
12:55:03 | PMunch | Could you share your opir output in a paste? |
12:56:59 | * | rockcavera joined #nim |
12:56:59 | * | rockcavera quit (Changing host) |
12:56:59 | * | rockcavera joined #nim |
12:57:38 | PMunch | It seems like it goofes on a packed pragma |
12:57:44 | PMunch | goofs* |
12:57:52 | PMunch | Have you seen similar issues? |
12:59:00 | FromDiscord | <hotdog> If I remove the renamecallback, it compiles fine |
12:59:04 | FromDiscord | <hotdog> Do you get the same? |
12:59:34 | FromDiscord | <hotdog> In reply to @PMunch "Hmm, after adding the": I haven't seen this error |
13:00:01 | PMunch | Nope I just get that error |
13:00:06 | PMunch | But what C sources are you using? |
13:00:22 | FromDiscord | <hotdog> What do you mean? |
13:00:48 | PMunch | Just compiling the code you uploaded gives me an error from Opir: Fatal: 'stddef.h' file not found |
13:01:07 | PMunch | To fix that I must give a path to either clang or GCC C sources |
13:02:37 | PMunch | What platform are you on? |
13:02:47 | FromDiscord | <hotdog> Ah it's an ubuntu container |
13:03:10 | FromDiscord | <hotdog> with libjack-dev |
13:03:30 | PMunch | Hmm |
13:03:41 | PMunch | Which C compiler? |
13:03:47 | PMunch | And is it using musl? |
13:04:04 | FromDiscord | <hotdog> gcc |
13:04:06 | FromDiscord | <hotdog> No musl |
13:04:23 | PMunch | Which GCC version? |
13:04:34 | FromDiscord | <hotdog> 9.3.0 |
13:05:12 | PMunch | And Jack version? |
13:06:23 | FromDiscord | <hotdog> 0.125.0 I think |
13:08:52 | PMunch | Uhm, mine is 1.9.19 |
13:08:58 | PMunch | According to pacman |
13:09:07 | FromDiscord | <hotdog> Interesting |
13:09:12 | PMunch | That's jack2 |
13:26:10 | FromDiscord | <tandy> is it posible to make https://github.com/nim-lang/Nim/lib/system/memory.nim work on js backend? |
13:27:53 | PMunch | Okay, implemented packed structures now @hotdog. It compiles, but using the rename callback gives me the same error you got |
13:28:26 | FromDiscord | <hotdog> In reply to @PMunch "Okay, implemented packed structures": Cool |
13:29:21 | FromDiscord | <hotdog> The renamer that runs after the callback should handle any collisions, so in theory no renaming should cause an error as long as it's a valid nim identifier right? |
13:29:44 | FromDiscord | <hotdog> I am poking around the futhark code a bit to try and understand |
13:30:13 | PMunch | Hmm, I think I see what has happened |
13:31:23 | PMunch | So you rename jack_options_t to JackOptions, this would normally be called jackoptionst by the renamer. Then JackOptions from the C code gets renamed to JackOptions_enum since it now collides with this identifier. But somewhere in the code this gets lost |
13:32:02 | PMunch | As you can see the enum JackOptions is created in the futhark output, it should be called JackOptions_enum |
13:34:16 | PMunch | Easy fix, it was simply that enum names was never passed through the name sanitizer |
13:35:50 | * | max22- joined #nim |
13:41:57 | FromDiscord | <tandy> https://github.com/tandy-1000/Nim/commit/b6eba2850ec79e41c4fc6ee6b5f57be365adc2f0 |
13:42:01 | FromDiscord | <tandy> is this completely stupid |
13:45:20 | krux02 | yes |
13:45:26 | FromDiscord | <Rika> imo define the xxmem proc bodies in the respective procs of memory.nim (behind defined(js)) |
13:45:29 | FromDiscord | <Rika> no need to change md5 |
13:45:46 | FromDiscord | <Rika> i have no idea whether what your procs do what they actually do in js |
13:46:15 | FromDiscord | <tandy> me neither↵(@Rika) |
13:46:26 | FromDiscord | <Rika> then that is stupid |
13:47:07 | FromDiscord | <tandy> i was thinkin about doing that↵(@Rika) |
13:47:19 | FromDiscord | <tandy> but i realised there must be a reason why that wasnt done already |
13:47:25 | krux02 | any pointer type casting that isn't just base-class child-class casting is doomed to fail on js |
13:47:32 | FromDiscord | <Rika> yes, because how does xxmem work in js??? |
13:47:49 | FromDiscord | <tandy> hmm |
13:48:01 | krux02 | what is xxmem? |
13:48:12 | FromDiscord | <tandy> copyMem, zeroMem |
13:48:15 | FromDiscord | <tandy> setMem |
13:48:18 | krux02 | it doesn't |
13:48:37 | FromDiscord | <tandy> how the heck do i make this work then \:x |
13:48:46 | FromDiscord | <Rika> best just reimplement them |
13:49:02 | krux02 | you have to find workarounds that don' use copyMem, zeroMem etc |
13:49:03 | FromDiscord | <Rika> or wrap, though i doubt youd get that in the stdlib that way |
13:49:19 | FromDiscord | <tandy> hmm |
13:49:26 | FromDiscord | <tandy> how do i go about doin that |
13:49:26 | krux02 | js has a very different memory layout than tha C backend |
13:49:34 | FromDiscord | <tandy> its hard also cos u cant easily test js stuff |
13:49:45 | krux02 | why not? |
13:49:50 | FromDiscord | <Rika> you can? just run it in a browser |
13:50:06 | FromDiscord | <tandy> tru i gues↵(@Rika) |
13:50:07 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:50:55 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3B6i |
13:51:04 | FromDiscord | <tandy> in streams they do this |
13:52:50 | FromDiscord | <Rika> that looks wrong |
13:52:53 | krux02 | tandy: you can set elements to 0 with a loop |
13:53:00 | krux02 | insdead of useing zeroMem |
13:53:51 | FromDiscord | <tandy> i think @dom96 did it |
13:53:59 | FromDiscord | <tandy> thats what i do↵(<@709044657232936960_krux02=5b=49=52=43=5d>) |
13:54:18 | FromDiscord | <tandy> well what memory.nim does |
13:54:27 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=3B6j |
13:55:37 | PMunch | @hotdog, not sure if you saw, but I updated the PR with a fix for your issue |
13:55:58 | PMunch | Thanks for finding it, pretty trivial bug that should never have been added |
13:56:01 | FromDiscord | <Rika> dont pass pointers in js |
13:56:54 | * | kinkinkijkin quit (Remote host closed the connection) |
13:58:31 | krux02 | tandy instead of zeroMem you can use `reset` |
13:58:36 | * | pch joined #nim |
13:58:42 | FromDiscord | <tandy> hm il try that |
13:58:54 | * | pch quit (Remote host closed the connection) |
13:59:27 | * | pch joined #nim |
14:00:32 | FromDiscord | <tandy> need to get rid of the copyMemJs stuff to make it compile now |
14:01:08 | FromDiscord | <hotdog> @PMunch I'm back just saw it! Nice one |
14:01:33 | PMunch | Hopefully it'll work for you now :) |
14:01:45 | krux02 | tandy, you also need to get rid of the `cstring` + `len` arguments and convert it to an openarray[byte] somehow |
14:01:59 | krux02 | `cstring` + `len` doesn't work on js |
14:02:07 | PMunch | But I have to run, so just leave your feedback on the issue if anything else comes up :) |
14:02:08 | * | PMunch quit (Quit: Leaving) |
14:02:50 | FromDiscord | <hotdog> In reply to @PMunch "Hopefully it'll work for": Just rewriting my code that uses the lib to see if it all works |
14:03:03 | FromDiscord | <hotdog> In reply to @PMunch "But I have to": Will do! Cheers |
14:03:11 | krux02 | cstring used to be a string for the c backend, but smartassery development thought, hey cstring can mean `compatible string` not `c string` and it is whatever the backend things a string is. |
14:03:33 | krux02 | that ends up in code that is written for one backend in mind, that is completely broken on the other |
14:04:11 | * | rockcavera quit (Remote host closed the connection) |
14:06:28 | FromDiscord | <Rika> why the hell does cstring not work on js |
14:06:35 | FromDiscord | <Rika> if its "meant" to mean compat string |
14:09:20 | FromDiscord | <tandy> omg↵(<@709044657232936960_krux02=5b=49=52=43=5d>) |
14:09:27 | FromDiscord | <tandy> maybe i just need to a wrap cryptojs |
14:09:40 | FromDiscord | <tandy> this is more effort than i thought |
14:12:21 | FromDiscord | <tandy> why the heck does lastfm api even need md5 bruh |
14:27:21 | FromDiscord | <Rika> thats strange ngl |
14:27:23 | krux02 | Rike: it is not that cstring doesn't work on js. The problem is that it is something completely different on js |
14:27:33 | FromDiscord | <Rika> what is it on js? |
14:27:35 | krux02 | @Rika, ^ |
14:27:40 | FromDiscord | <Rika> yes im hee |
14:27:42 | FromDiscord | <Rika> here |
14:27:43 | krux02 | is is a javascript string |
14:27:56 | FromDiscord | <Rika> whats the issue with that? |
14:27:59 | krux02 | not the nim-string |
14:28:08 | krux02 | as I explained |
14:28:25 | krux02 | code written with c string usually expects to deal with a string from the C world |
14:28:34 | krux02 | and that is something completeld different than a javascript string |
14:28:39 | krux02 | not compatible at all |
14:28:48 | FromDiscord | <Rika> ah lol |
14:30:15 | krux02 | you should convert everything to work with `openarray[byte]` and `array[byte]` instead of `cstring` |
14:30:30 | krux02 | then things might work in the JS world. |
14:41:25 | FromDiscord | <tandy> hmm↵(<@709044657232936960_krux02=5b=49=52=43=5d>) |
14:50:51 | FromDiscord | <haxscramper> https://github.com/haxscramper/hcparse/issues/13 [Clonkk](https://matrix.to/#/@rf.c:matrix.org) |
14:51:00 | krux02 | I looked a bit into md5 and tried to fix some of the copyMem stuff |
14:51:27 | krux02 | the problem is there is some code that reinterprets an array uint8 as an array of uint32 |
14:51:32 | krux02 | that is tough in the js world |
14:51:57 | FromDiscord | <haxscramper> Maybe I wrote incorrect C++ or nim code for this example, so maybe they actually work the same way |
14:52:26 | FromDiscord | <haxscramper> But maybe not, which means we have more problems |
14:59:27 | * | dukester joined #nim |
15:01:24 | * | dukester left #nim (#nim) |
15:28:49 | * | crem quit (Ping timeout: 252 seconds) |
15:31:07 | * | crem joined #nim |
15:42:18 | FromDiscord | <retkid> i think im doing typing wrong |
15:42:37 | FromDiscord | <retkid> all my types have fields which are non mandatory and i have to type the name of the key to make it |
15:42:47 | FromDiscord | <retkid> i assume you use functions to make it smoother |
15:43:01 | FromDiscord | <retkid> like for example |
15:43:09 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3B7j |
15:54:42 | FromDiscord | <Rika> what do you mean |
15:54:57 | FromDiscord | <retkid> `im afraid im doing this wrong |
15:55:00 | FromDiscord | <retkid> and theres a better way |
15:55:14 | FromDiscord | <Rika> we cant tell you whats wrong because we dont have context |
15:56:07 | FromDiscord | <retkid> theres nothng wrong |
15:56:15 | FromDiscord | <retkid> i just want to define a type with constructors |
15:56:32 | FromDiscord | <retkid> it has constructors but none are mandatory and when i create it i need to add the key |
15:56:40 | FromDiscord | <retkid> ie newtype(name : "xyz) |
15:56:49 | FromDiscord | <retkid> (edit) "newtype(name" => "``newtype(name" | ""xyz)" => ""xyz")``" |
15:56:57 | FromDiscord | <retkid> is this just how it is? or am i using the wrong tool |
15:57:10 | FromDiscord | <Rika> common practice is to make a proc |
15:57:18 | FromDiscord | <Rika> `initType(params here): Type` |
15:57:56 | FromDiscord | <retkid> I've done that for annoying types |
15:58:14 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/895701555666358293/unknown.png |
15:58:21 | FromDiscord | <retkid> I just feel kinda guilty about making them |
15:58:23 | FromDiscord | <retkid> i dunno |
15:58:40 | FromDiscord | <Rika> is there any reason you're making methos |
15:58:42 | FromDiscord | <Rika> (edit) "methos" => "methods" |
15:58:55 | FromDiscord | <retkid> oh those were the wrong procs |
15:59:25 | FromDiscord | <retkid> theres a reason but i decided not to comment my code so i dont know off the top of my head 🤡 |
15:59:29 | FromDiscord | <retkid> (edit) "theres a reason but i decided not to comment my code so i dont know off the top of my head ... 🤡" added "" |
15:59:41 | FromDiscord | <retkid> by decided i meant neglected |
16:00:49 | FromDiscord | <retkid> the code in this file is uh |
16:00:54 | FromDiscord | <retkid> (edit) "uh" => "uh, not a quality I'm proud of" |
16:01:05 | FromDiscord | <haxscramper> if you need mandatory field init you can use `{.requiresinit.}` |
16:01:23 | FromDiscord | <retkid> Thank you! |
16:01:26 | FromDiscord | <haxscramper> But common approach is to make a code |
16:01:44 | FromDiscord | <retkid> I dunno if i got this from Java's oop |
16:01:53 | FromDiscord | <retkid> but i like to write things for other people who are maintaing my code |
16:01:56 | FromDiscord | <retkid> (edit) "maintaing" => "maintaining" |
16:02:22 | FromDiscord | <retkid> restricting certain things which shouldn't be done is good |
16:02:24 | FromDiscord | <haxscramper> Well, there is nothing wrong with the idea of requiring some fields to be explicitly initialized |
16:03:31 | FromDiscord | <retkid> oh god i gotta do database code |
16:03:39 | FromDiscord | <retkid> the pasta i will unleash upon my future self |
16:04:07 | FromDiscord | <retkid> im probably gonna use SQLite because thats the only one i vaguely understood |
16:05:17 | FromDiscord | <Rika> In reply to @retkid "restricting certain things which": its good to a point, if you can make something optional easily then do so |
16:07:24 | * | asd quit (Ping timeout: 245 seconds) |
16:08:19 | * | koltrast_ quit (Quit: ZNC - http://znc.in) |
16:09:22 | * | koltrast joined #nim |
16:09:23 | * | asd joined #nim |
16:16:37 | * | NeoCron quit (Remote host closed the connection) |
16:17:10 | * | pro joined #nim |
16:18:19 | * | koltrast quit (Ping timeout: 252 seconds) |
16:18:53 | * | bkay joined #nim |
16:19:14 | * | NeoCron joined #nim |
16:19:25 | * | beshr quit (Ping timeout: 252 seconds) |
16:21:41 | * | systemds1cks quit (Ping timeout: 264 seconds) |
16:21:55 | * | systemdsucks joined #nim |
16:26:31 | * | koltrast joined #nim |
17:13:30 | * | pro quit (Quit: WeeChat 3.3) |
17:20:27 | FromDiscord | <reilly> I'm trying to work with NimGL/IMGUI, but I'm missing `cimgui.dylib`. Where would be the best place to get this/How can I build this myself? |
17:21:06 | FromDiscord | <enthus1ast> from imgui site/repo ? |
17:21:43 | FromDiscord | <enthus1ast> could be that this is a c wrapper of their c++ api |
17:21:59 | FromDiscord | <Yardanico> In reply to @reilly "I'm trying to work": you can 1) use the C++ backend, then you won't need cimgui at all |
17:22:16 | FromDiscord | <Yardanico> 2) compile cimgui - it's actually referenced as a submodule of the nimgl/imgui repo, but you can build it yourself |
17:22:23 | FromDiscord | <Yardanico> https://github.com/nimgl/cimgui |
17:22:25 | nrds | <R2D299> itHub: 7"c-api for imgui (https://github.com/ocornut/imgui)" |
17:23:56 | FromDiscord | <gerwy> does nim has unions? or something like that |
17:25:07 | FromDiscord | <Yardanico> In reply to @Life Sucks "does nim has unions?": it does, but why do you need them? they're really only useful for C FFI |
17:25:08 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#foreign-function-interface-union-pragma |
17:25:31 | FromDiscord | <Yardanico> you should use object variants in Nim instead |
17:26:18 | FromDiscord | <gerwy> im rewriting one python lib, i didn't understood all the code yet so i just wanted to rewrite the basics of it as true to the original as possible |
17:27:10 | FromDiscord | <Yardanico> can you show the python code? |
17:27:30 | FromDiscord | <Yardanico> python's union typehints are a quite different thing, you should've clarified that :P |
17:28:07 | FromDiscord | <Yardanico> if you mean https://docs.python.org/3/library/typing.html#typing.Union, to replicate that in Nim you need to use object variants or some modules that add some sugar to that as https://github.com/alaviss/union |
17:28:10 | nrds | <R2D299> itHub: 7"Anonymous unions in Nim" |
17:28:41 | FromDiscord | <gerwy> In reply to @Yardanico "can you show the": `def _getValue(self, source: dict, path: List[str]) -> Union[str, int, dict, None]:` |
17:28:47 | FromDiscord | <Yardanico> yes, as I said |
17:29:05 | FromDiscord | <Yardanico> but with 4 values like that you'll certainly need an object variant |
17:29:32 | FromDiscord | <Yardanico> ah actually no, alaviss' union still supports that (kind of) |
17:29:47 | FromDiscord | <gerwy> hmmm |
17:29:57 | FromDiscord | <Yardanico> but really you shouldn't try to translate this code as-is, it's pretty dynamic as that single _getValue function can return 4 different types (that's what "Union" typehint in Python means) |
17:30:10 | FromDiscord | <Yardanico> so this python _getValue can return either a str, an int, a dict, or None |
17:31:10 | FromDiscord | <Rika> You should refactor the api |
17:32:00 | FromDiscord | <gerwy> no no i its just for me to get the base, i know it wont work i just want to get grasp of it |
17:32:07 | FromDiscord | <gerwy> also its a method of class |
17:32:47 | FromDiscord | <gerwy> In reply to @Yardanico "so this python _getValue": yeah i know that, but idk how to do the same thing in Nim |
17:33:10 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-object-variants |
17:33:14 | FromDiscord | <haxscramper> `dict` is another can-return-anything |
17:33:23 | FromDiscord | <haxscramper> there is no `dict` in nim |
17:33:37 | FromDiscord | <haxscramper> no dict equivalent\ |
17:33:44 | FromDiscord | <Yardanico> yeah, that's true as well |
17:33:52 | FromDiscord | <Elegantbeef> It's dynamism you can only approximate it in Nim or use generics |
17:34:05 | FromDiscord | <gerwy> In reply to @haxscramper "there is no `dict`": i thought of using Table |
17:34:42 | FromDiscord | <Rika> not equal |
17:34:48 | FromDiscord | <Rika> you dont know what values are stored in that dict |
17:35:03 | FromDiscord | <Rika> unless you do, since you have the code |
17:35:47 | FromDiscord | <Yardanico> In reply to @Life Sucks "i thought of using": yeah, as others told, in Python dict is not limited to 1:1 type mapping |
17:37:55 | ehmry | is compile time iteration possible? I want to do `for i in 0..<tupleLen(tuple): f(tuple[i])` |
17:37:57 | * | jjido joined #nim |
17:38:38 | FromDiscord | <gerwy> hmm i mean i use this github repo as reference |
17:38:39 | FromDiscord | <gerwy> https://media.discordapp.net/attachments/371759389889003532/895726829900554240/unknown.png |
17:38:42 | FromDiscord | <haxscramper> `std/typetraits` |
17:38:57 | FromDiscord | <Yardanico> In reply to @Life Sucks "": again, as I said, this is not official and not of it is correct info |
17:39:02 | FromDiscord | <Elegantbeef> Do you mean loop unrolling or just iterating over at compile time? |
17:39:05 | FromDiscord | <haxscramper> https://nim-lang.org/docs/typetraits.html↵(<@709044657232936960_ehmry=5b=49=52=43=5d>) |
17:39:42 | FromDiscord | <haxscramper> Also there is a `fieldPairs` that works with enums as well |
17:39:55 | FromDiscord | <Yardanico> (edit) "In reply to @Life Sucks "": again, as I said, this is not official and not ... of" added "all" |
17:39:56 | ehmry | Elegantbeef: loop unrolling, so that my `i` is const |
17:40:05 | FromDiscord | <gerwy> In reply to @Yardanico "again, as I said,": yeah hmm, i prob need like a list of types of python and nim alternatives |
17:40:18 | FromDiscord | <Yardanico> In reply to @Life Sucks "yeah hmm, i": there's no direct alternative to dict in Nim as others said |
17:40:32 | FromDiscord | <Yardanico> but if you debug your python program to know what types it stores in the dict you can find out how many of them it uses |
17:40:53 | FromDiscord | <Yardanico> but yeah, that code looks like it's pretty dynamic so you really should try adopting it to Nim from the start instead of doing 1:1 translation |
17:40:54 | ehmry | I need to modify the tuple fields, the typetrait iterators don't seem to do that |
17:41:17 | FromDiscord | <Elegantbeef> you can do `for x in tuple.fields` |
17:41:30 | FromDiscord | <Elegantbeef> Which already unrolls it |
17:41:39 | FromDiscord | <Rika> doesnt that give strings of the names of fields |
17:41:47 | FromDiscord | <Rika> what use is that in this case |
17:41:50 | FromDiscord | <Elegantbeef> Nope that's fieldpairs |
17:42:10 | ehmry | but are the field pairs modifiable? |
17:42:24 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3B7X |
17:43:34 | FromDiscord | <Elegantbeef> fields gives you a mutable reference to the fields of the object/tuple |
17:44:08 | FromDiscord | <Elegantbeef> And due to how this needs to work it's already unrolled afaik |
17:45:26 | ehmry | yea, that seems to work, thanks |
17:46:27 | FromDiscord | <sealmove> In reply to @richard stallmen(crazy GNU guy) "what does it have": nothing, just greeting the greek guy |
17:50:53 | * | max22- quit (Ping timeout: 246 seconds) |
18:01:27 | * | rockcavera joined #nim |
18:01:27 | * | rockcavera quit (Changing host) |
18:01:27 | * | rockcavera joined #nim |
18:02:19 | ehmry | ugh, avoid `when compiles(…)` if you can |
18:02:54 | ehmry | its not fun to figure out what did or did not silently fail to compile |
18:10:09 | FromDiscord | <reilly> In reply to @Yardanico "you can 1) use": Last time I tried using the C++ backend, I could have sworn I needed a certain compiler flag in order for it to build correctly. In any case, with just `nim cpp gui.nim`, the build fails with the following message: `error: invalid argument '-std=gnu++14' not allowed with 'Objective-C'`↵I can also give you the whole command it was using if you want. |
18:10:20 | FromDiscord | <Yardanico> wait, objective c? |
18:10:26 | FromDiscord | <Yardanico> why is there objective c |
18:10:29 | FromDiscord | <reilly> Yeah, that's what I was thinking! |
18:10:41 | FromDiscord | <reilly> I'm doing `nim cpp gui.nim`, exactly like that. |
18:10:47 | FromDiscord | <Yardanico> idk, it works just fine for me |
18:11:29 | FromDiscord | <reilly> I can't imagine that it'd have anything to do with me being on MacOS, right? |
18:13:06 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3B8c |
18:15:47 | FromDiscord | <Yardanico> In reply to @reilly "I can't imagine that": most probably yes |
18:16:40 | FromDiscord | <Yardanico> @reilly i think it has to do with you using macOS specific stuff like cocoa |
18:16:45 | FromDiscord | <Yardanico> maybe you can't link C++ and Objective C code together |
18:17:32 | FromDiscord | <Yardanico> but yeah, then you have to use the C backend with cimgui |
18:18:04 | FromDiscord | <reilly> Well, I'm happy as long as I can get it working. |
18:18:48 | FromDiscord | <reilly> In reply to @Yardanico "most probably yes": I asked the wrong question, though. A better question would have been "Is this a NimGL, IMGUI, or Nim compiler thing?" |
18:19:13 | FromDiscord | <Yardanico> it's a macOS thing :) |
18:20:01 | FromDiscord | <Yardanico> see e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=1420165 |
18:20:10 | FromDiscord | <Yardanico> In reply to @reilly "The command it's running": can you try cleaning the Nim cache? |
18:20:14 | FromDiscord | <Yardanico> and compiling with C++ |
18:20:17 | FromDiscord | <Yardanico> backend |
18:20:39 | FromDiscord | <Yardanico> hm, what's nimgl/private/glfw/src/cocoa_init.m |
18:21:23 | FromDiscord | <Yardanico> ohh those .m files in nimgl are objective c |
18:22:30 | FromDiscord | <Yardanico> so yeah, sorry, I can't really help with that exact problem as I don't have macOS, but probably clang is not happy when you try to compile C++ together with Objective C code |
18:23:03 | FromDiscord | <reilly> I'll just build cimgui and call it a day. |
18:23:43 | FromDiscord | <reilly> The dylib just needs to be in the same directory as the executable, right? |
18:25:01 | FromDiscord | <reilly> Yay, a window! I don't even know if I'll need this, but I'm glad I have it. |
18:25:13 | * | max22- joined #nim |
18:37:19 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3B8r |
18:38:19 | FromDiscord | <haxscramper> 10^9 IQ moment, I forgot I can just do `when (expr is proc)` |
19:25:42 | FromDiscord | <retkid> is there any large examples of sqllite |
19:25:46 | FromDiscord | <retkid> in any repo |
19:26:10 | FromDiscord | <Yardanico> not sure what exactly do you want to learn with that - sqlite's interface is pretty simple |
19:26:15 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
19:26:16 | FromDiscord | <Yardanico> for example nimforum uses it https://github.com/nim-lang/nimforum |
19:26:18 | nrds | <R2D299> itHub: 7"Lightweight alternative to Discourse written in Nim" |
19:26:44 | FromDiscord | <retkid> i dont know sqllite specifically and the docs are kinda bad |
19:26:49 | FromDiscord | <retkid> so i just want a working example |
19:26:54 | FromDiscord | <Yardanico> you don't have to know sqlite specifically |
19:26:56 | FromDiscord | <Yardanico> it's just SQL |
19:27:01 | FromDiscord | <retkid> well i dont know any SQL |
19:27:03 | FromDiscord | <retkid> (edit) "well i dont know any SQL ... " added "at all" |
19:27:15 | FromDiscord | <Yardanico> then you can just search examples for SQL |
19:27:40 | FromDiscord | <retkid> that is very cool thought it had different syntax |
19:27:41 | FromDiscord | <retkid> thank you |
19:28:01 | FromDiscord | <zidsal> has anyone managed to solve the windows issue where using choosenim 0.8.2 returns a 0 byte zip if you try and install 1.6? |
19:33:55 | FromDiscord | <zidsal> nevermind found the chat in internal, I was picking the wrong version, althought it still errors for other reasons which I shall investimigate |
19:34:24 | FromDiscord | <reilly> Compiling with the default C backend while wrapping a C++ library probably doesn't work... Right? |
19:44:56 | * | Figworm joined #nim |
19:48:47 | FromDiscord | <Jakes1403> Is there a way to get Nim Playground to not truncate console output? |
19:48:57 | FromDiscord | <Jakes1403> I think that's really stupid |
19:50:21 | FromDiscord | <Yardanico> In reply to @Jakes1403 "Is there a way": as in? |
19:50:42 | FromDiscord | <Yardanico> ah I see what you mean |
19:51:01 | FromDiscord | <Yardanico> well I think it's actually ok as you really rarely need very long output on the playground |
19:51:12 | FromDiscord | <Yardanico> you can try https://wandbox.org to see if it's better for you |
19:51:23 | FromDiscord | <Jakes1403> I'm messing around rn bc I don't have a PC lol |
19:51:30 | FromDiscord | <Yardanico> well you don't need a PC for Nim |
19:51:36 | FromDiscord | <Yardanico> if you're on android you can install it in termux |
19:51:54 | FromDiscord | <Yardanico> it's not ideal, but certainly better than doing nim in nim playground on mobile |
19:57:44 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:04:53 | * | vicfred joined #nim |
20:09:27 | FromDiscord | <Jakes1403> I'll try that |
21:00:42 | FromDiscord | <Ale_S> xnim |
21:09:40 | * | Gustavo6046 is now known as Several |
21:09:44 | * | Several is now known as Gustavo6046 |
21:20:09 | * | Figworm quit (Quit: Figworm) |
21:23:49 | * | LyndsySimon quit (Ping timeout: 250 seconds) |
21:23:55 | * | robertmeta quit (Ping timeout: 268 seconds) |
21:24:32 | * | notchris quit (Ping timeout: 268 seconds) |
21:24:45 | * | euantorano_ joined #nim |
21:24:46 | * | ormiret quit (Ping timeout: 260 seconds) |
21:24:56 | * | euantorano quit (Ping timeout: 268 seconds) |
21:24:56 | * | euantorano_ is now known as euantorano |
21:25:37 | * | ormiret joined #nim |
21:28:50 | * | robertmeta joined #nim |
21:29:42 | * | notchris joined #nim |
21:29:58 | * | LyndsySimon joined #nim |
21:37:42 | * | Vladar quit (Remote host closed the connection) |
21:50:31 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
22:02:10 | * | jjido joined #nim |
22:11:34 | * | Gustavo6046 joined #nim |
22:35:06 | * | stkrdknmibalz joined #nim |
22:44:59 | * | pch quit (Remote host closed the connection) |
22:46:59 | * | pch joined #nim |
22:47:34 | * | pch quit (Remote host closed the connection) |
22:58:41 | * | max22- quit (Remote host closed the connection) |
23:22:46 | * | pch joined #nim |
23:47:24 | * | stkrdknmibalz quit (Ping timeout: 245 seconds) |