00:00:53 | FromDiscord | <EyeCon> `Exception: (M_BAD_JSON) Content must be a JSON object.` |
00:01:01 | FromDiscord | <EyeCon> Bracing myself for the 3. dumb mistake here |
00:30:11 | FromDiscord | <EyeCon> In reply to @Elegantbeef "dodger.tar.xz": Which `matrix` are you using here exactly? `https://github.com/beef331/matrix-nim-sdk@head`? |
00:39:24 | FromDiscord | <EyeCon> OK, found the problem. Only tandy's repo works properly, the 1000 other existing clones don't |
00:40:06 | FromDiscord | <EyeCon> After 4 hours of doing busywork I can finally login |
00:52:36 | FromDiscord | <Elegantbeef> Yea tandy's is the only good one 😄 |
00:52:56 | FromDiscord | <Elegantbeef> Plus it has my macro to make it supremely easy to work on |
00:53:41 | FromDiscord | <Elegantbeef> It's quite a good API to defend new endpoints but i'm shamelessly saying that cause i made it https://github.com/tandy-1000/matrix-nim-sdk/blob/v1.3/src/matrix/clientserver/clientauth/login.nim#L9-L14 |
00:58:41 | FromDiscord | <!Patitotective> what would be an efficient way to get the last line of a string? iterating it in reverse until \n and crop it there? |
00:59:31 | FromDiscord | <Elegantbeef> `if (let ind = myStr.rFind("\n"); ind) > 0: myStr.toOpenArray(ind, myStr.len).doThing()` |
01:00:15 | FromDiscord | <!Patitotective> :] |
01:00:38 | FromDiscord | <enthus1ast> yeah would work↵(@!Patitotective) |
01:00:59 | FromDiscord | <Elegantbeef> Not slicing the string is the most efficient method 😄 |
01:01:12 | FromDiscord | <enthus1ast> you can store offsets |
01:01:27 | FromDiscord | <Elegantbeef> Yea and you can also use `toOpenArray` |
01:01:38 | FromDiscord | <!Patitotective> i need a string :[ |
01:01:44 | FromDiscord | <Elegantbeef> Do you really? |
01:01:49 | FromDiscord | <enthus1ast> ah rFind |
01:02:17 | FromDiscord | <!Patitotective> well, i want to write the last line of an exception to a string (which is a log) |
01:02:29 | FromDiscord | <Elegantbeef> So why do you need a string? |
01:02:43 | FromDiscord | <!Patitotective> to add it? can i add it without converting it into a stirng? |
01:02:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=485U |
01:02:52 | FromDiscord | <Elegantbeef> Of course you can |
01:02:57 | FromDiscord | <!Patitotective> :p |
01:08:44 | FromDiscord | <yayo> sent a code paste, see https://play.nim-lang.org/#ix=485V |
01:09:03 | FromDiscord | <yayo> (edit) "https://play.nim-lang.org/#ix=485V" => "https://play.nim-lang.org/#ix=485W" |
01:10:13 | FromDiscord | <Elegantbeef> ` var result = newSeq[typeof(init)](len)` |
01:10:25 | FromDiscord | <Elegantbeef> `typeof` by default prefers iterators |
01:10:40 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "`if (let ind =": beef, can i convert this to a procedure (i dont thing they can return openArrays) or some other way to call this with `str.lastLine` |
01:11:06 | FromDiscord | <!Patitotective> (edit) "thing" => "think" |
01:11:21 | FromDiscord | <Elegantbeef> Works fine |
01:11:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=485X |
01:11:29 | FromDiscord | <Elegantbeef> But you also have a terrible for performance implementation |
01:12:13 | FromDiscord | <Elegantbeef> The template uses lazy evaluation so for each element it calls `split(S)` |
01:12:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=485Y |
01:12:32 | FromDiscord | <Elegantbeef> Templates can↵(@!Patitotective) |
01:13:55 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=485Z |
01:14:10 | FromDiscord | <Elegantbeef> You dont have an else |
01:14:35 | FromDiscord | <Elegantbeef> i was only doing that index shortcut to save a codeblock 😄 |
01:15:24 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "You dont have an": what would the else do? empty array would break stringify, right? |
01:15:39 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "i was only doing": heeh |
01:15:45 | FromDiscord | <Elegantbeef> Cmon patito you can use your noggin |
01:16:46 | FromDiscord | <!Patitotective> im so smart |
01:16:48 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4860 |
01:19:55 | FromDiscord | <EyeCon> Aren't we all |
01:21:04 | FromDiscord | <!Patitotective> is there an alternative to `string | openArray[char]` yet? |
01:21:11 | FromDiscord | <EyeCon> I'm bitten yet again by the behavior of nimble of installing the latest tagged version rather than the tip |
01:21:12 | FromDiscord | <Elegantbeef> `openArray[char]` |
01:21:32 | FromDiscord | <!Patitotective> sure? |
01:21:38 | FromDiscord | <Elegantbeef> Yes |
01:21:55 | FromDiscord | <!Patitotective> could be there a type that converts strings to openarrays automatically :o |
01:22:03 | FromDiscord | <Elegantbeef> `openArray[char]` |
01:22:04 | FromDiscord | <!Patitotective> perhaps a pragma :facer |
01:22:10 | FromDiscord | <!Patitotective> (edit) ":facer" => "🤨" |
01:22:21 | FromDiscord | <!Patitotective> hMmMm |
01:22:46 | FromDiscord | <!Patitotective> smart |
01:23:10 | FromDiscord | <j-james> it's the concept of iterable that openarrays fall a little flat on |
01:23:29 | FromDiscord | <j-james> ex. you have to do `openArray[T] | HashSet[T] | ...` |
01:23:44 | FromDiscord | <Elegantbeef> And then everything falls apart |
01:23:56 | FromDiscord | <Elegantbeef> Cause as soon as you put an openarray in a typeclass it loses implicit conversion |
01:24:28 | FromDiscord | <j-james> mmm fun |
01:24:51 | FromDiscord | <j-james> by the way, i opened an rfc based on someone's good idea in the style insensitivity thread: https://github.com/nim-lang/RFCs/issues/477 |
01:24:55 | FromDiscord | <j-james> for making names enclosed in backticks style sensitive for easier C ffi |
01:25:24 | FromDiscord | <j-james> want to rip it apart / see if there are any glaring mistakes? |
01:25:34 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4862 |
01:25:43 | FromDiscord | <Elegantbeef> Cause you cannot grow openarrays |
01:26:08 | FromDiscord | <!Patitotective> actually adding \n to the string later makes more sense :p |
01:30:43 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/nt4 |
01:35:13 | FromDiscord | <!Patitotective> slicing works :p |
01:35:48 | FromDiscord | <Elegantbeef> Are you calling `getCurrentExceptionMessage`? |
01:36:01 | FromDiscord | <!Patitotective> yes |
01:36:08 | FromDiscord | <Elegantbeef> I mean i hate that you're calling it but show the usage |
01:36:28 | FromDiscord | <!Patitotective> In reply to @Patitotective ":/ https://github.com/Patitotective/ImNimble/blob/m": i put a link here |
01:38:11 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4864 |
01:38:20 | FromDiscord | <Elegantbeef> And what if you dont dumbly do what you're doing and properly use exception handling? |
01:39:15 | FromDiscord | <!Patitotective> you mean catch the exception and use that message? |
01:39:17 | FromDiscord | <!Patitotective> (edit) "you mean catch the exception and use that message? ... " added ":o" |
01:39:18 | FromDiscord | <!Patitotective> (edit) ":o" => ":" |
01:39:19 | FromDiscord | <!Patitotective> (edit) ":" => ":p" |
01:40:17 | FromDiscord | <Elegantbeef> Yea how you should |
01:40:26 | FromDiscord | <Elegantbeef> `getCurrentExceptionMsg` is a code smell |
01:40:39 | FromDiscord | <!Patitotective> i didnt know :p |
01:42:14 | FromDiscord | <Elegantbeef> Well when you fix that tell me if it still errors |
01:42:35 | FromDiscord | <Elegantbeef> Really i dont get why you dont just do `app.addLastLine` which does the check internally |
01:45:08 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Really i dont get": wdym? addLastLine would add a line to the log and check for errors (?) |
01:45:23 | FromDiscord | <Elegantbeef> Do you not think for yourself? |
01:45:40 | FromDiscord | <Elegantbeef> `app.log.addLastLine(myErr.msg)` |
01:46:59 | FromDiscord | <Rainbow Asteroids> In reply to @Elegantbeef "`getCurrentExceptionMsg` is a code": And yet it's in the second tutorial 😔 |
01:47:27 | FromDiscord | <Elegantbeef> Yea i dont get why it even exists really |
01:48:02 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "`app.log.addLastLine(myErr.msg)`": a-..and what check would that do?.... |
01:48:05 | FromDiscord | <Elegantbeef> I guess for in side a finally statement? |
01:48:05 | FromDiscord | <Elegantbeef> It's just.... pointless |
01:48:05 | FromDiscord | <Elegantbeef> Well mostly pointless |
01:48:18 | FromDiscord | <Elegantbeef> Cmon patito you can do 1 + 1 |
01:48:46 | FromDiscord | <Elegantbeef> If the proc is named `addLastLine` and you know how to cheaply find and add the last line |
01:49:13 | FromDiscord | <Elegantbeef> I'll more than happily program it for you at 23CAD/hr |
01:55:00 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4865 |
01:55:16 | FromDiscord | <Elegantbeef> Does it work? |
01:55:55 | FromDiscord | <!Patitotective> was that what you meant? |
01:56:04 | FromDiscord | <Elegantbeef> That's what i meant |
01:56:06 | FromDiscord | <Elegantbeef> But you do you |
01:56:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4866 |
01:56:51 | FromDiscord | <!Patitotective> o |
01:58:01 | FromDiscord | <Elegantbeef> The question still remains, does it compile |
01:58:31 | FromDiscord | <!Patitotective> oh yes |
01:58:56 | FromDiscord | <Elegantbeef> Good, happy to see you reason it for yourself |
01:59:03 | FromDiscord | <Elegantbeef> Keep that up and i might reduce my banter |
02:01:18 | FromDiscord | <!Patitotective> https://media.discordapp.net/attachments/371759389889003532/1010367895257239552/unknown.png |
02:04:33 | * | arkurious quit (Quit: Leaving) |
03:03:51 | FromDiscord | <Rika> Lol |
03:20:24 | FromDiscord | <!Patitotective> i may be crying but https://media.discordapp.net/attachments/371759389889003532/1010387800417374309/ImNimble.mp4 |
03:37:48 | FromDiscord | <hutchinson70> Hello, Are you interested in making $1,500 plus additional $500 for diligence and hardwork in two weeks (legit) by sparing just 15/30 minutes of your time every 48hrs without no start up fee ? If yes get back to me for more details↵↵https://t.me/+rRk2pLTli4AzYjk0 |
03:41:06 | FromDiscord | <j-james> @Moderator |
03:41:54 | FromDiscord | <j-james> also https://github.com/matrix-org/mjolnir |
03:46:31 | FromDiscord | <Rainbow Asteroids> <@&371760044473319454> |
03:46:59 | FromDiscord | <!Patitotective> In reply to @hutchinson70 "Hello, Are you interested": hopefully thanks to this i can hire beef to code for me |
03:49:02 | FromDiscord | <Rika> Beef wouldn’t |
03:57:29 | * | oddish joined #nim |
04:31:28 | madprops | you'd need a beefy salary |
04:48:29 | * | greaser|q joined #nim |
04:49:35 | * | greaser|q quit (Changing host) |
04:49:35 | * | greaser|q joined #nim |
04:49:39 | * | greaser|q is now known as GreaseMonkey |
05:44:44 | FromDiscord | <Phil> Maybe if the project is a game written in nim? |
05:56:52 | FromDiscord | <Bung> https://github.com/bung87/webview2 `nim c .\src\webview2\com.nim` compiles with no out file and error message, any idea ? |
06:00:32 | FromDiscord | <Elegantbeef> Sometimes you can cause the compiler to have a hard crash that doesnt print anything |
06:02:47 | FromDiscord | <Elegantbeef> Cmon now i cant even work on my own games↵(@Phil) |
06:04:00 | FromDiscord | <Elegantbeef> Though today i started reworking my wasm script test idea and am deciding to make it a turnbased AI game |
06:04:11 | FromDiscord | <Phil> Still the best chance they got I'd think 😛 |
06:06:13 | FromDiscord | <Bung> In reply to @Elegantbeef "Cmon now i cant": do you know in what condition? |
06:20:58 | * | kenran joined #nim |
06:21:10 | FromDiscord | <Bung> oh , it's code like this ` ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerInvoke = proc (i: ptr ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerInvoke; p:HRESULT;createdEnvironment:ptr ICoreWebView2Environment)↵` |
06:24:09 | FromDiscord | <voidwalker> Are there any pacakge managers I can use to keep download/extract/install/update random binary utilities that go in my project folder, that I want to have bundled with my program? I looked at jitter but it seems to be oriented towards git for source. Nifty does not seem to have extrac function. I need something where I can define for each pacakge how to check if there is an update. |
06:24:27 | FromDiscord | <voidwalker> (edit) "extrac" => "extract" |
06:36:51 | FromDiscord | <Sabena Sema> I mean "how to check if there's an update" is like 75% of what a package manager si |
06:36:53 | FromDiscord | <Sabena Sema> (edit) "si" => "is" |
06:37:19 | FromDiscord | <Sabena Sema> There's some infra for update checking in fedora/debian |
06:37:25 | FromDiscord | <Sabena Sema> maybe you could use the same scripts |
06:45:37 | * | kenran quit (Quit: WeeChat info:version) |
06:49:50 | FromDiscord | <voidwalker> I mean I thought of it as a bool proc to define and assign somewhere at the package manager init inside the program |
06:50:45 | FromDiscord | <voidwalker> ideally it would be some sort of script to be interpreted at runtime |
07:29:53 | * | derpydoo joined #nim |
07:55:08 | FromDiscord | <Sabena Sema> yeah you could write a nimscript to do it |
08:24:21 | FromDiscord | <Sabena Sema> how do I do optional strings, I used to just be able to use nil with strings but apparently that's an error now (options is not sufficient because it looks like an option[string] is going to be (string, bool) |
08:24:43 | FromDiscord | <Elegantbeef> `str.len != 0`? |
08:25:22 | FromDiscord | <Elegantbeef> The literal `""` is nil with arc/orc iirc |
08:25:44 | FromDiscord | <Elegantbeef> If you want to be even more explicit https://github.com/beef331/nimtrest/blob/master/sentinels.nim |
08:27:56 | FromDiscord | <Sabena Sema> oh, string just doesn't have a nil state anymore? |
08:28:19 | FromDiscord | <Elegantbeef> `""` does make it a nil internally but correct |
08:29:29 | FromDiscord | <Elegantbeef> !eval var a = ""; echo cast[int](a) |
08:29:32 | NimBot | 0 |
08:43:18 | FromDiscord | <Rika> strings and sequences do not have a nil state anymore, yes; you cannot escape adding a byte to indicate a difference between empty-container and "nothing" |
08:43:51 | FromDiscord | <Rika> if empty-container is unused for you, then good |
09:18:44 | * | rockcavera quit (Remote host closed the connection) |
09:23:04 | * | void09_ quit () |
09:23:40 | * | void09 joined #nim |
09:27:43 | FromDiscord | <Sabena Sema> goddamn seqs too! |
09:28:08 | FromDiscord | <Sabena Sema> ugh I liked that they used to have nil states |
09:29:46 | FromDiscord | <Phil> Personally I like it, but mostly since I never had to avoid optionals |
09:30:20 | FromDiscord | <Sabena Sema> I guess people kept forgetting to initialize them |
09:31:07 | FromDiscord | <Sabena Sema> but idk if optional won’t actually take advantage of the pointers inside the data-structure its kinda just worse |
09:31:22 | FromDiscord | <Sabena Sema> it just needs a change to options tho |
09:31:47 | FromDiscord | <aruZeta> about seqs, ik about `newSeq[type](len)`, but can I appart from that limit the capacity like `newSeqOfCap[T](cap)` does? I want to do both |
09:32:06 | FromDiscord | <aruZeta> (edit) "`newSeqOfCap[T](cap)`" => "`newSeqOfCap[type](cap)`" |
09:32:34 | FromDiscord | <Sabena Sema> doesn’t newseqofcap just set the initial capacity? it does not limit anything |
09:32:44 | FromDiscord | <aruZeta> oh it does? |
09:32:59 | FromDiscord | <aruZeta> https://media.discordapp.net/attachments/371759389889003532/1010481565375135774/unknown.png |
09:33:14 | FromDiscord | <Sabena Sema> yes |
09:33:18 | FromDiscord | <aruZeta> it says "with length zero" |
09:33:23 | FromDiscord | <Sabena Sema> if you go over that capacity it will reallocate |
09:33:49 | FromDiscord | <aruZeta> oh well I could just .setLen |
09:33:55 | FromDiscord | <Sabena Sema> do you want to make a new seq of a given capacity then partially initialize it |
09:34:02 | FromDiscord | <Sabena Sema> (edit) "it" => "it?" |
09:34:09 | FromDiscord | <aruZeta> yh |
09:34:16 | FromDiscord | <aruZeta> its just a seq of int |
09:34:33 | FromDiscord | <aruZeta> i would use an array, but since the size is known at runtime |
09:35:06 | FromDiscord | <aruZeta> so yh, I could just newSeqOfCap, and then .setLen it |
09:35:14 | FromDiscord | <aruZeta> (edit) "newSeqOfCap," => "`newSeqOfCap`," | ".setLen" => "`.setLen`" |
09:35:54 | FromDiscord | <Sabena Sema> yeah, that should be just as good, you are saving like one store |
09:37:54 | FromDiscord | <aruZeta> idk how seq actually works under the hood, but I guess by specifying the cap, it won't leave some space to fill it if necessary, right? |
09:38:13 | FromDiscord | <aruZeta> (edit) "necessary," => "necessary (when using `.add`)," |
09:40:03 | FromDiscord | <Phil> In reply to @Sabena Sema "but idk if optional": You'd need to elaborate on that for me, why worse?↵It makes the nil-check explicitly where nil makes it implicit. I guess it might take up more memory and thus not be all that suited for data structures, but e.g. for ref-types an optional does not actually store an additional boolean (except for strings and seqs but those are "hidden" ref-types |
09:40:06 | FromDiscord | <Phil> (edit) "ref-types" => "ref-types)" |
09:40:44 | FromDiscord | <Sabena Sema> In reply to @aruZeta "idk how seq actually": it will leave however much space you say, thats the point |
09:41:11 | FromDiscord | <aruZeta> nice then |
09:43:37 | FromDiscord | <Sabena Sema> In reply to @Isofruit "You'd need to elaborate": right, I want implicit with flow dependent checking in the compiler, instead of explicit where you need to change the type after checking |
09:44:58 | FromDiscord | <Sabena Sema> its not a huge deal, but just general grumpiness around stuff like this being more trouble than it’s worth |
09:45:40 | FromDiscord | <Sabena Sema> in any event I’ll prob either just use an empty string sentinel or make a pr to fix options |
09:52:40 | FromDiscord | <Rika> i believe options used to exploit pointer nil but i think it was removed for issues with it |
09:54:26 | FromDiscord | <Rika> In reply to @Sabena Sema "in any event I’ll": i dont think you can |
09:54:33 | FromDiscord | <Rika> how would it be implemented? |
09:55:13 | * | derfflinger joined #nim |
10:01:38 | * | derfflinger quit (Read error: Connection reset by peer) |
10:10:27 | * | derfflinger joined #nim |
10:11:41 | * | derfflinger quit (Client Quit) |
10:13:29 | * | derfflinger joined #nim |
10:14:45 | * | xet7 joined #nim |
10:47:30 | * | derfflinger quit (Ping timeout: 248 seconds) |
11:06:19 | FromDiscord | <Bung> `{.importc: "syscall", header: "syscall.h",discardable.}`↵ fatal error: syscall.h: No such file or director |
11:06:41 | FromDiscord | <Bung> where it is on windows? |
11:16:08 | FromDiscord | <EyeCon> Syscall on Windows? I don't think that's a thing. Or rather, that's kind of a thing, but abstracted away with the Win API |
11:31:54 | FromDiscord | <Bung> I dont understand, the project is for windows |
11:32:16 | FromDiscord | <enthus1ast> syscalls on windows is what the ntdll calls |
11:32:41 | FromDiscord | <enthus1ast> (and what all the malware writers want, to avoid ntdll hooks) |
11:33:26 | FromDiscord | <Bung> so the go lang package syscall on windows has its own wrappers ? |
11:33:55 | FromDiscord | <enthus1ast> windows syscalls change all the time, so they must be extracted from the ntdll |
11:33:56 | FromDiscord | <Bung> it's not like unix call directly to syscall |
11:34:32 | FromDiscord | <Bung> okay, I understand, thanks~ |
11:42:00 | FromDiscord | <Bung> ah , someone have done this https://github.com/S3cur3Th1sSh1t/NimGetSyscallStub |
11:56:00 | FromDiscord | <enthus1ast> Elegantbeef\: Are you interested in helping me to to build runtime evaluation of nimja templates? What i currently have is (thanks to haxscramper ) is a nimja nodes to PNodes compiler, but i must admit the compiler api is way over my head, and also the parameter conversion from and to vmtypes... |
11:59:50 | FromDiscord | <enthus1ast> I want to use the nim compiler as a library, generate PNodes from nimja nodes (this already works and i quite understand it), one challenge for me is the parameter conversion; then the compiler is run to evaluate the PNodes, and return a string, which is the result of the template evaluation |
12:30:01 | * | vsantana joined #nim |
12:35:05 | * | xet7 quit (Quit: Leaving) |
12:46:06 | FromDiscord | <untoreh> how do I override the linker? the flags I am passing do not seem to apply |
12:49:12 | FromDiscord | <untoreh> I do `--passC="-Wl,--dynamic-linker=..."` and `--passC="-B=..."` |
12:50:03 | FromDiscord | <Ras> that _should_ work |
12:52:39 | FromDiscord | <Ras> In reply to @untoreh "how do I override": oh, wait |
12:52:46 | FromDiscord | <Ras> there's a dedicated `--passL` flag |
13:01:41 | * | kenran joined #nim |
13:07:59 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
13:09:14 | * | ehmry joined #nim |
13:11:41 | * | jmdaemon quit (Ping timeout: 256 seconds) |
13:20:26 | FromDiscord | <Bloss> can someone give konsumlamm collaborator permissions on nim-lang/bigints? |
13:22:01 | FromDiscord | <Bloss> it seems like only narimiran has been merging PRs there |
13:22:52 | FromDiscord | <Bloss> maybe others could have permissions too |
13:23:35 | * | vsantana quit (Ping timeout: 256 seconds) |
13:26:58 | FromDiscord | <Bloss> dlesnoff for example |
13:33:21 | FromDiscord | <Bung> https://github.com/S3cur3Th1sSh1t/NimGetSyscallStub am looking into this lib, the need pass function name as string, while in the go project, the go package syscall called with interface method, any idea?↵` r, _, err := syscall.Syscall(b.view.VTBL.GetSettings, 2, uintptr(unsafe.Pointer(b.view)), uintptr(unsafe.Pointer(&settings)), 0)↵` |
13:33:36 | FromDiscord | <Bung> (edit) "the need" => "itneed" |
13:33:42 | FromDiscord | <Bung> (edit) "itneed" => "it need" |
13:34:29 | FromDiscord | <enthus1ast> whats the question? |
13:36:35 | FromDiscord | <enthus1ast> the GetSyscallStub opens the ndll, and searches for the function |
13:36:41 | FromDiscord | <enthus1ast> in its exports |
13:37:28 | FromDiscord | <Bung> you see the go code it call with the interface method not function name |
13:37:41 | FromDiscord | <enthus1ast> you must define the function yourself i guess |
13:38:09 | * | vsantana joined #nim |
13:38:19 | FromDiscord | <enthus1ast> see https://github.com/S3cur3Th1sSh1t/NimGetSyscallStub/blob/main/ShellcodeInject.nim |
13:38:19 | * | PMunch joined #nim |
13:38:25 | FromDiscord | <enthus1ast> type myNtOpenProcess = proc(ProcessHandle\: PHANDLE, DesiredAccess\: ACCESS\_MASK, ObjectAttributes\: POBJECT\_ATTRIBUTES, ClientId\: PCLIENT\_ID)\: NTSTATUS {.stdcall.} |
13:38:37 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=488D |
13:40:11 | FromDiscord | <Bung> have no idea, in your case all need is pass "NtOpenProcess" as first param, in my case call with interface method , I dont know how |
13:40:21 | FromDiscord | <enthus1ast> ah |
13:40:23 | FromDiscord | <enthus1ast> ok |
13:40:47 | FromDiscord | <enthus1ast> so which function do you wanna call? |
13:42:02 | * | arkurious joined #nim |
13:42:28 | FromDiscord | <Bung> like the go code does https://media.discordapp.net/attachments/371759389889003532/1010544350578610176/unknown.png |
13:42:56 | FromDiscord | <Bung> they all call with dll's interface |
13:43:47 | FromDiscord | <Bung> in this way , I dont need wrap all methods ? that's the author's intention ? |
13:44:14 | FromDiscord | <enthus1ast> idk, but when you want to call a function, you must define it first |
13:44:44 | FromDiscord | <Ras> are you writing windows malware @Bung |
13:44:46 | FromDiscord | <enthus1ast> and the NimGetSyscallStub provides a pointer |
13:45:00 | FromDiscord | <enthus1ast> so you need to define the function in nim, and cast the pointer to this |
13:45:14 | FromDiscord | <enthus1ast> so it depends on what function you wanna call |
13:45:38 | FromDiscord | <Bung> my thought is the author just wrap all methods as pointer it will map dll memory then call method with pointer |
13:45:56 | FromDiscord | <enthus1ast> you cannot just call "a pointer" |
13:46:17 | FromDiscord | <enthus1ast> you need to know, the return types, the parameters, the calling convention etc |
13:46:33 | FromDiscord | <Bung> In reply to @Ras "are you writing windows": no, am trying to use webview2 without compile c++ code |
13:47:19 | FromDiscord | <Bung> In reply to @enthus1ast "you need to know,": yeah, I can know these but dont need define these in code , right ? |
13:47:33 | FromDiscord | <enthus1ast> mh then "syscalls" is the wrong thing i guess↵(@Bung) |
13:48:04 | FromDiscord | <enthus1ast> the only thing this actually does, is to try to avoid ntdll hooks |
13:48:15 | FromDiscord | <Bung> https://github.com/mattpodraza/webview2 this project does this way |
13:49:43 | FromDiscord | <Ras> https://github.com/mattpodraza/webview2/blob/main/pkg/user32/user32.go it seems to call and cast specifically according to the windows specifications |
13:49:54 | FromDiscord | <Ras> you would need to reimplement all of this in nim |
13:50:08 | FromDiscord | <enthus1ast> since antivirus etc could sometimes hook the functions in the ntdll, so if the malware just calls the functions in its loaded ntdll, it would call into the antivirus, so the idea is to open a fresh copy of ntdll, parse the headers, find the procs (or just syscall numbers), then call directly into the ntkernel |
13:51:00 | FromDiscord | <Bung> In reply to @Ras "https://github.com/mattpodraza/webview2/blob/main/p": this part is done by winim |
13:51:12 | FromDiscord | <Ras> yeah, which is why i thought they were writing malware enthus1ast |
13:52:22 | FromDiscord | <Bung> these parts are only thing I intrested. https://media.discordapp.net/attachments/371759389889003532/1010546838887219270/unknown.png |
13:52:39 | FromDiscord | <enthus1ast> imho this does not translate to nim |
13:52:44 | FromDiscord | <enthus1ast> but i've no clue about go |
13:52:59 | FromDiscord | <enthus1ast> do you have a msdn link? |
13:53:22 | FromDiscord | <Bung> link of what ? |
13:53:39 | FromDiscord | <enthus1ast> this right? https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/overview-features-apis?tabs=dotnetcsharp |
13:54:14 | FromDiscord | <Bung> yeah, I've read these, it will guide me write c++ code |
13:54:29 | FromDiscord | <enthus1ast> yes, so you need to wrap c++ code |
13:54:37 | FromDiscord | <enthus1ast> with importcpp |
13:54:53 | FromDiscord | <Ras> yeah you can use cpp code with nim as well, as long as you use the cpp backend |
13:57:12 | FromDiscord | <Bung> in this way I need compile to cpp backend or compile c++ part code and link it to nim program in c backend, that's why I search https://github.com/mattpodraza/webview2/ |
13:57:25 | * | derfflinger joined #nim |
14:02:01 | FromDiscord | <Bung> I've porting all go code except syscall part , that's hard than I think . I thought just like unix that use syscall directly. |
14:02:43 | FromDiscord | <enthus1ast> what does go syscall actually does? |
14:03:40 | FromDiscord | <Bung> it just call interface methods |
14:04:10 | FromDiscord | <enthus1ast> it looks like nim's posix + winim combined |
14:04:29 | * | vsantana quit (Ping timeout: 252 seconds) |
14:04:31 | FromDiscord | <enthus1ast> and nativenet |
14:06:24 | FromDiscord | <Bung> like I said , in this way it does not need map interface methods https://media.discordapp.net/attachments/371759389889003532/1010550369564237855/2022-08-20_220525.png |
14:09:49 | FromDiscord | <enthus1ast> i think what you must do is to importcpp the procs you need to call from your nim code https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs |
14:10:14 | FromDiscord | <enthus1ast> you must not wrap all of them, but the ones you call from nim |
14:10:57 | FromDiscord | <enthus1ast> or, if you want to use the c backend, you can emulate the cpp calling somehow |
14:11:14 | FromDiscord | <enthus1ast> but i'm just guessing ehre |
14:11:16 | FromDiscord | <enthus1ast> here |
14:11:25 | FromDiscord | <Bung> I have no idea, I've never compile to cpp backend |
14:12:10 | FromDiscord | <Bung> dont know dependent libs will compile success in cpp backend or not |
14:12:19 | FromDiscord | <enthus1ast> in theory a cpp method is a c struct with pointers to functions that take the obj as their first param, but i think there are many special cases |
14:12:27 | FromDiscord | <enthus1ast> quite as nim does it |
14:14:25 | FromDiscord | <Bung> anyway thanks! am gonna lay on bed play with my phone |
14:18:56 | * | kenran quit (Quit: WeeChat info:version) |
14:31:55 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=488R |
14:31:58 | FromDiscord | <4zv4l> (edit) |
14:33:01 | FromDiscord | <enthus1ast> it depends |
14:33:17 | FromDiscord | <enthus1ast> already works |
14:33:20 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=488S |
14:33:38 | FromDiscord | <enthus1ast> this is a feature, the last parameter of a proc can be filled like so |
14:33:39 | FromDiscord | <4zv4l> but I mean, it's a function ? what is it ? what's the name of this ? xD |
14:34:18 | FromDiscord | <4zv4l> so it's the same as↵`routes(get("/"))` ? |
14:34:27 | FromDiscord | <aruZeta> In reply to @4zv4l "but I mean, it's": it's a macro |
14:34:39 | FromDiscord | <4zv4l> I didn't learn that yet, is it hard ? |
14:35:05 | FromDiscord | <aruZeta> abstract if you never used them |
14:35:07 | FromDiscord | <enthus1ast> i think it depends what you wanna use it for |
14:35:22 | FromDiscord | <enthus1ast> you can do these kind of stuff withouth macros |
14:35:32 | FromDiscord | <enthus1ast> but some stuff needs you to use macros |
14:35:54 | FromDiscord | <4zv4l> what are macro used for ? what's their advantages compared to proc ? |
14:36:11 | FromDiscord | <4zv4l> cause I know C macro but since I don't use them a lot idk |
14:36:27 | FromDiscord | <aruZeta> macros/templates are "functions" which are run at compiletime to edit your code |
14:36:44 | FromDiscord | <enthus1ast> a parameter of a macro is the nim ast |
14:36:50 | FromDiscord | <4zv4l> In reply to @aruZeta "macros/templates are "functions" which": like `comptime` in zig ? |
14:37:01 | FromDiscord | <aruZeta> have not used zig, sry |
14:37:13 | FromDiscord | <enthus1ast> so you transform and or generate the nim ast |
14:37:16 | FromDiscord | <aruZeta> they are not the same as values calculated at compiletime |
14:37:20 | FromDiscord | <4zv4l> you can put comptime before a variable or a function call to do it at compile time |
14:37:57 | FromDiscord | <enthus1ast> you can try it yourself |
14:38:08 | * | rockcavera joined #nim |
14:38:08 | * | rockcavera quit (Changing host) |
14:38:08 | * | rockcavera joined #nim |
14:38:37 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=488V |
14:39:09 | FromDiscord | <aruZeta> (it won't compile since you are not doing anything with `2 + 3`, you would have to `discard` it |
14:39:11 | FromDiscord | <aruZeta> (edit) "it" => "it)" |
14:39:58 | FromDiscord | <aruZeta> a macro is a bit more complex than a template, since you are playing with the AST and thus make more complex stuff |
14:40:01 | FromDiscord | <4zv4l> oh it's like `inline` in C ? |
14:40:08 | FromDiscord | <4zv4l> template is similar to `inline` ? |
14:40:43 | FromDiscord | <aruZeta> idk |
14:41:19 | FromDiscord | <aruZeta> > Inline Function are those function whose definitions are small and be substituted at the place where its function call is happened. Function substitution is totally compiler choice.↵Seems like smth like that yh |
14:42:45 | FromDiscord | <aruZeta> I love templates since you can use them to deduplicate code |
14:42:54 | FromDiscord | <4zv4l> what do you mean ? |
14:43:19 | FromDiscord | <Generic> also another thing about inline functions is that you don't need to worry about double evaluation and things like this |
14:43:25 | FromDiscord | <4zv4l> (btw is this good to understand macro ? https://dev.to/beef331/demystification-of-macros-in-nim-13n8) |
14:43:44 | FromDiscord | <4zv4l> In reply to @Generic "also another thing about": double evaluation ? |
14:45:08 | FromDiscord | <aruZeta> In reply to @aruZeta "I love templates since": and what's best, with 0 abstraction cost |
14:45:13 | * | derpydoo quit (Quit: derpydoo) |
14:45:38 | FromDiscord | <Generic> In reply to @4zv4l "double evaluation ?": e.g. if you have `myProc(procWithSideEffects())` |
14:45:53 | FromDiscord | <Generic> it will evaluate the parameter once and pass that value in |
14:46:10 | FromDiscord | <aruZeta> In reply to @4zv4l "(btw is this good": there is also this https://nim-lang.org/docs/tut3.html |
14:46:16 | FromDiscord | <Generic> with a template every reference of the template parameter will be replaced by what's given at call site |
14:46:26 | FromDiscord | <Generic> (edit) "reference" => "occurence" |
14:46:27 | FromDiscord | <4zv4l> In reply to @Generic "it will evaluate the": during compile time right ? |
14:46:31 | FromDiscord | <Generic> no |
14:46:45 | FromDiscord | <4zv4l> alright I don't totally get it xD |
14:46:45 | FromDiscord | <Generic> let me give a more complete example |
14:48:08 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/GQo |
14:48:41 | FromDiscord | <enthus1ast> @4zv4l a macros example https://play.nim-lang.org/#ix=488X |
14:48:44 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=488Y |
14:49:18 | FromDiscord | <Generic> sent a code paste, see https://play.nim-lang.org/#ix=4890 |
14:49:24 | FromDiscord | <aruZeta> what a template does is write it's body literally, just changing the variables passed to their value |
14:49:49 | FromDiscord | <4zv4l> In reply to @enthus1ast "<@329196212282458112> a macros example": that's like so long, I don't get all those node and stuff with the syntax tree 😢 |
14:50:09 | FromDiscord | <enthus1ast> this is what dumpAstGen returns |
14:50:11 | FromDiscord | <aruZeta> In reply to @4zv4l "that's like so long,": yh, macros are more complex than templates since they touch the AST |
14:51:09 | FromDiscord | <enthus1ast> run it in your editor, the echo repr result show what the macro generates |
14:51:57 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/Ghu |
14:52:04 | FromDiscord | <4zv4l> In reply to @aruZeta "yh, macros are more": yeah I see that it's more complex T-T |
14:52:08 | FromDiscord | <aruZeta> here another template example: https://play.nim-lang.org/#ix=4891 |
14:52:16 | FromDiscord | <aruZeta> you could use just a regular proc |
14:53:07 | FromDiscord | <aruZeta> but templates have 0 cost abstraction |
14:53:10 | FromDiscord | <Generic> In reply to @4zv4l "additionTemplate isn't used right": sorry copy paste error |
14:53:17 | FromDiscord | <4zv4l> template is basically putting the 'proc' code instead of calling a function right ? |
14:53:22 | FromDiscord | <Generic> yes |
14:53:27 | FromDiscord | <aruZeta> yes |
14:53:36 | FromDiscord | <4zv4l> so why would there be cost abstraction ? |
14:53:53 | FromDiscord | <aruZeta> instead of running it at runtime, the actual code is copied and pasted |
14:54:08 | FromDiscord | <4zv4l> only the code that will be ran from the template right ? |
14:54:09 | FromDiscord | <aruZeta> In reply to @4zv4l "so why would there": when you call a proc there is some cost |
14:54:31 | FromDiscord | <aruZeta> while a template is just substituting your code, so at runtime there are no calls |
14:54:46 | FromDiscord | <4zv4l> yeah I see so literally `inline` |
14:54:48 | FromDiscord | <4zv4l> get it |
14:55:03 | FromDiscord | <aruZeta> nice :) |
14:55:11 | FromDiscord | <4zv4l> I'll try to get how macro works then xD |
14:55:19 | FromDiscord | <tandy> if you have issues pm me\:) im away but il try answer↵(@EyeCon) |
14:55:21 | FromDiscord | <4zv4l> but so would it be better to always use template ? |
14:55:32 | FromDiscord | <Generic> your instruction cache only fits so and so much data |
14:55:40 | FromDiscord | <aruZeta> In reply to @4zv4l "but so would it": no |
14:55:49 | FromDiscord | <aruZeta> depends on what you doing |
14:56:24 | FromDiscord | <Generic> unless you know what you're doing, don't replace procs my templates for performance reasons |
14:56:33 | FromDiscord | <aruZeta> as a rule of thumb, unless you know what you doing, use proc |
14:57:27 | FromDiscord | <aruZeta> and always remember, templates and macros DONT run at runtime |
14:57:54 | FromDiscord | <aruZeta> so you cant feed a template/macro with user input, for example |
14:58:10 | FromDiscord | <4zv4l> wait what |
14:58:16 | FromDiscord | <4zv4l> why not |
14:58:28 | FromDiscord | <4zv4l> if template is copy pasting the proc code into the function that calls it |
14:58:30 | FromDiscord | <aruZeta> because they are run at compiletime |
14:58:31 | FromDiscord | <4zv4l> why not user input ? |
14:58:52 | FromDiscord | <aruZeta> and when is user input known? |
14:59:03 | FromDiscord | <Generic> I think a distinction needs to be made here |
14:59:24 | FromDiscord | <4zv4l> if you put a `readline(stdin)` in the template |
14:59:26 | FromDiscord | <4zv4l> what happen ? |
14:59:30 | FromDiscord | <Generic> you can feed runtime variables into macros and templates (and you do that almost always) |
14:59:41 | FromDiscord | <matkuki> Anyone know the details of the `nimx` library? I am trying to make a custom control, but am not sure where to begin. Any good examples for this? |
14:59:49 | FromDiscord | <aruZeta> maybe I didn't rly explain well what I meant |
14:59:57 | FromDiscord | <Generic> but what you feed into them is not the value, but whatever will hold the value during runtime |
15:00:30 | FromDiscord | <aruZeta> let's take a parser, it gets a string and gives you an array of words, ok? |
15:00:31 | FromDiscord | <Generic> so e.g. if you pass a variable to a template, you're not passing the value of the variable to the template, you're passing the variable itself to the template |
15:00:43 | FromDiscord | <aruZeta> you can make that a proc, but not a template/macro |
15:01:00 | FromDiscord | <4zv4l> why not ? |
15:01:01 | FromDiscord | <aruZeta> In reply to @Generic "so e.g. if you": the "name" of the variable |
15:01:28 | FromDiscord | <aruZeta> In reply to @4zv4l "why not ?": because the template/macro doesn't know the values of var nor let (it does from const) |
15:02:10 | FromDiscord | <aruZeta> (edit) "const)" => "const, which is known at compiletime)" |
15:02:26 | FromDiscord | <4zv4l> so it's not just copy pasting the code from the template to the call right ? |
15:02:41 | FromDiscord | <aruZeta> In reply to @aruZeta "this is a example:": just take a look at here |
15:02:51 | FromDiscord | <aruZeta> it does not write 5 into the source code |
15:03:01 | FromDiscord | <aruZeta> it writes a+b |
15:03:08 | FromDiscord | <4zv4l> yeah copy pasting the code itself |
15:03:12 | FromDiscord | <aruZeta> yes |
15:03:13 | FromDiscord | <4zv4l> not the executed part |
15:03:21 | FromDiscord | <aruZeta> exactly |
15:03:25 | FromDiscord | <4zv4l> so why prevent it from copy pasting `readline(stdin)` ? |
15:03:30 | FromDiscord | <4zv4l> (edit) "why" => "what" |
15:03:36 | FromDiscord | <aruZeta> because that is known at runtime |
15:03:41 | FromDiscord | <aruZeta> not compiletime |
15:03:56 | FromDiscord | <aruZeta> when you are running your code, it is not nim code anymore, it is machine code |
15:04:13 | FromDiscord | <aruZeta> machine code does not know what the f is a macro/template |
15:05:33 | FromDiscord | <4zv4l> I don't get that |
15:05:42 | FromDiscord | <aruZeta> lemme make a example |
15:11:40 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=489i |
15:12:10 | FromDiscord | <aruZeta> this macro takes something, gets it's string value and returns "Val: " and the value concatenated |
15:12:49 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=489l |
15:13:11 | FromDiscord | <aruZeta> now, what would happen if I call `foo(stdin.readLine())`? |
15:13:34 | FromDiscord | <aruZeta> It would not compile |
15:15:08 | FromDiscord | <aruZeta> because the concatenation of "Val: " and the string is done at COMPILETIME |
15:19:59 | FromDiscord | <aruZeta> (there is a workaround to this which would be actually returning a call to `&` with both params) |
15:21:31 | FromDiscord | <demotomohiro> That macro `foo` takes the expreesion `stdin.readLine()` as AST. It is `NimNode` type. |
15:22:10 | FromDiscord | <aruZeta> yh |
15:22:36 | FromDiscord | <aruZeta> In reply to @aruZeta "(there is a workaround": you can actually do this |
15:22:56 | FromDiscord | <aruZeta> if you wanted it to work at runtime |
15:23:27 | FromDiscord | <aruZeta> my lib tagger does something like that |
15:30:00 | NimEventer | New thread by Enjoysmath: When do we use pass & return by ref if everything behind the scenes is by-pointer anyway?, see https://forum.nim-lang.org/t/9394 |
15:38:10 | * | derfflinger quit (Ping timeout: 248 seconds) |
15:45:22 | FromDiscord | <Bung> https://stackoverflow.com/questions/60034725/how-and-where-is-syscall-syscall-defined-for-windows-specific-system-calls-in it seems syscall.Syscall() is for c and go interop, not just for system level function calls |
15:52:12 | FromDiscord | <!Patitotective> In reply to @Rika "Beef wouldn’t": https://discord.com/channels/371759389889003530/371759389889003532/1010364850318344253 |
16:08:07 | * | wallabra_ joined #nim |
16:09:03 | * | wallabra quit (Ping timeout: 256 seconds) |
16:09:58 | FromDiscord | <4zv4l> this works |
16:10:02 | * | wallabra_ is now known as wallabra |
16:10:07 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=489z |
16:10:46 | * | derfflinger joined #nim |
16:11:16 | * | derfflinger_ joined #nim |
16:11:43 | FromDiscord | <aruZeta> yh |
16:11:52 | FromDiscord | <4zv4l> alright, I'll try to learn macros now xD |
16:14:42 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=489C |
16:15:01 | * | derfflinger quit (Ping timeout: 252 seconds) |
16:15:12 | FromDiscord | <4zv4l> yeah |
16:15:14 | FromDiscord | <4zv4l> gotcha |
16:21:40 | * | krux02 joined #nim |
16:33:59 | * | derfflinger_ quit (Ping timeout: 256 seconds) |
16:41:55 | * | wallabra quit (Ping timeout: 256 seconds) |
16:42:18 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=489L |
16:43:25 | FromDiscord | <enthus1ast> you can use dumpAstGen |
16:43:31 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=489N |
16:43:38 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=489N" => "https://play.nim-lang.org/#ix=489O" |
16:44:06 | FromDiscord | <4zv4l> I'll try to read it tomorrow when being more energic xD |
16:45:02 | * | wallabra joined #nim |
16:45:23 | FromDiscord | <enthus1ast> when you want to transform stuff, use dumpAstGen for the syntax you wanna implement, and dumpAstGen for the syntax you wanto to transform this in, then you write the macro that reads the first and outputs the second |
16:48:12 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=489Q |
16:48:17 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=489Q" => "https://play.nim-lang.org/#ix=489R" |
16:48:27 | FromDiscord | <4zv4l> oooooh okok |
16:49:39 | FromDiscord | <aruZeta> its common to use an acronym as a prefix for enum values |
16:50:02 | FromDiscord | <aruZeta> type myEnum = enum↵ meVal1 |
16:50:15 | FromDiscord | <aruZeta> (edit) "type myEnum = enum↵ meVal1" => "sent a code paste, see https://play.nim-lang.org/#ix=489T" |
16:50:32 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=489T" => "https://paste.rs/xyw" |
16:51:09 | FromDiscord | <4zv4l> yeah, sounds obvious now xD |
16:51:15 | * | wallabra quit (Ping timeout: 248 seconds) |
16:51:45 | * | wallabra joined #nim |
16:58:43 | * | kenran joined #nim |
17:11:22 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48ah |
17:12:31 | FromDiscord | <!Patitotective> macros always return a nim node |
17:12:35 | FromDiscord | <!Patitotective> use a template instead |
17:13:07 | FromDiscord | <!Patitotective> actually dont know if you can use `->` for macros |
17:13:22 | FromDiscord | <4zv4l> https://nim-lang.org/blog/2018/06/07/create-a-simple-macro.html |
17:13:25 | FromDiscord | <4zv4l> he does it |
17:13:57 | FromDiscord | <!Patitotective> you should read the tutorial https://nim-lang.org/docs/tut3.html#introduction-generating-code :p |
17:14:06 | FromDiscord | <!Patitotective> In reply to @4zv4l "he does it": he doesnt return `Pays` |
17:14:12 | FromDiscord | <!Patitotective> he returns a nim node |
17:14:13 | FromDiscord | <4zv4l> oh no yeah |
17:14:22 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48aj |
17:14:28 | FromDiscord | <4zv4l> this doesn't work either because "Idk" is before the -> |
17:14:34 | FromDiscord | <4zv4l> with a space I guess |
17:16:15 | FromDiscord | <demotomohiro> I think all `city` and `capital` in your template is replaced with arguments. |
17:16:43 | FromDiscord | <4zv4l> what do you mean ? |
17:17:36 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/08t |
17:17:40 | FromDiscord | <enthus1ast> but you do not need a template for this, proc works as well |
17:17:42 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/4E6 |
17:17:51 | FromDiscord | <!Patitotective> ⬆️ |
17:18:25 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48ak |
17:18:38 | FromDiscord | <enthus1ast> , is missing |
17:18:51 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48al |
17:18:57 | FromDiscord | <4zv4l> alright, I thought because of indentation no need of `,` |
17:19:01 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48am |
17:19:18 | FromDiscord | <!Patitotective> In reply to @4zv4l "alright, I thought because": that would be 💀 |
17:19:33 | FromDiscord | <aruZeta> In reply to @aruZeta "Firstly, take a look": this is what you have to return, a ObjConstr |
17:20:39 | FromDiscord | <4zv4l> In reply to @aruZeta "this is what you": alright |
17:20:48 | FromDiscord | <4zv4l> well I'll learn more about macro tomorrow then |
17:20:53 | FromDiscord | <4zv4l> I don't see when I would need them for now |
17:21:14 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48an |
17:21:20 | FromDiscord | <!Patitotective> macros are useful to manipulate the AST |
17:21:24 | FromDiscord | <!Patitotective> you're not doing it |
17:23:19 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48ao |
17:23:46 | FromDiscord | <!Patitotective> yes |
17:23:53 | FromDiscord | <!Patitotective> (edit) "yes" => "yes, you cant" |
17:24:06 | FromDiscord | <!Patitotective> because you're creating a varaible definition |
17:24:11 | FromDiscord | <!Patitotective> (edit) "because you're creating a varaible definition ... " added "from a non variable definition" |
17:26:38 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48ap |
17:26:39 | FromDiscord | <aruZeta> this is how it would look |
17:27:38 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48aq |
17:28:00 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48aq" => "https://play.nim-lang.org/#ix=48ar" |
17:29:02 | FromDiscord | <!Patitotective> its much simpler using a procedure |
17:29:33 | FromDiscord | <aruZeta> In reply to @Patitotective "actually dont know if": well seems like you can |
17:29:51 | FromDiscord | <aruZeta> i even discovered you can use `[]=` with 4 params |
17:30:07 | FromDiscord | <aruZeta> and I guess any amount |
17:31:58 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=48au |
17:32:45 | FromDiscord | <aruZeta> and DSLs |
17:38:04 | FromDiscord | <4zv4l> Wait what xD |
17:38:11 | FromDiscord | <4zv4l> I didn't get the DSLs and the render |
17:38:40 | FromDiscord | <4zv4l> In reply to @enthus1ast "<@329196212282458112>\: see what you": If true is useless no ? |
17:38:56 | FromDiscord | <enthus1ast> yes |
17:41:41 | FromDiscord | <aruZeta> In reply to @4zv4l "I didn't get the": a DSL is a Domain Specific Language |
17:44:48 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48az |
17:45:14 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48az" => "https://play.nim-lang.org/#ix=48aA" |
17:45:23 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48aA" => "https://play.nim-lang.org/#ix=48aB" |
17:46:00 | FromDiscord | <aruZeta> (both contacts and contact are macros) |
17:46:09 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48aC |
17:46:35 | FromDiscord | <aruZeta> `createTag` is a template which creates the macros `contacts` and `contact` |
18:22:31 | FromDiscord | <!Patitotective> is splitting a string by \n the best way to iterate through a its lines? there doesnt seem to be a lines iterator that doesnt expect a file |
18:23:09 | FromDiscord | <!Patitotective> actually https://nim-lang.org/docs/strutils.html#splitLines.i%2Cstring :p |
18:40:22 | * | kenran quit (Quit: WeeChat info:version) |
19:23:00 | FromDiscord | <EyeCon> In reply to @tandy "if you have issues": Thanks a lot, will do! |
19:24:33 | FromDiscord | <4zv4l> In reply to @aruZeta "`createTag` is a template": oooh gotcha, why need to create it ? |
19:45:55 | FromDiscord | <Sabena Sema> why does c2nim use a shrunken version of the nim compiler instead of the macros module? |
19:46:27 | FromDiscord | <Sabena Sema> I wanna use it as a library to generate a vulkan / opengl binding from the registry |
19:46:47 | FromDiscord | <Sabena Sema> and for that I need to parse little snippets of C code, including the macro thing that c2nim does |
19:58:37 | FromDiscord | <auxym> to parse C, maybe you could use libclang, like futhark does? |
20:03:35 | * | CyberTailor quit (Remote host closed the connection) |
20:05:10 | * | CyberTailor joined #nim |
20:09:57 | * | krux02 quit (Remote host closed the connection) |
20:13:37 | * | jmdaemon joined #nim |
20:34:58 | * | kenran joined #nim |
20:35:26 | * | derfflinger joined #nim |
20:35:36 | FromDiscord | <Sabena Sema> I kinda want c2nim's ability to parse little fragments |
20:35:39 | FromDiscord | <demotomohiro> In reply to @Sabena Sema "why does c2nim use": I wrote OpenGL binding generator before.↵It downloads and reads the OpenGL Registry XML file and generates a OpenGL wrapper:↵https://github.com/demotomohiro/nim-4k-intro-sample/tree/master/tools/openGL4kGen↵And it doesn't read C code. |
20:35:42 | FromDiscord | <Sabena Sema> and also to parse C macros into nim |
20:36:38 | FromDiscord | <Sabena Sema> yeah, you just statically define all the stuff that really requires c parsing (callback procs, version macros) |
20:37:05 | FromDiscord | <!Patitotective> In reply to @4zv4l "oooh gotcha, why need": if you see their code they first create the `contacts` and `contact` tags macros so they can later use them as seen in `myContacts` definition↵those macros didnt exist until `createTag` was called |
20:38:02 | FromDiscord | <Sabena Sema> like vulkan has way more `<type></type>`s than opengl |
20:38:09 | FromDiscord | <Sabena Sema> most of them you can muddle along through |
20:39:05 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48b9 |
20:39:06 | FromDiscord | <Sabena Sema> also, c2nim is nim, which means I can do this whole dance at compile time without gorge if I want |
20:39:19 | FromDiscord | <Sabena Sema> or building the libffi enabled nim |
20:41:52 | FromDiscord | <Sabena Sema> how do nimblepaths work? |
20:43:19 | * | derfflinger quit (Ping timeout: 256 seconds) |
20:47:49 | FromDiscord | <aruZeta> In reply to @Patitotective "if you see their": thats how it works, yh |
20:49:14 | FromDiscord | <aruZeta> (edit) "In reply to @Patitotective "if you see their": ... thatsworks" added "yh," | "works, yh" => "works" |
20:59:43 | FromDiscord | <Elegantbeef> I can help, but no clue what you want |
21:00:42 | FromDiscord | <enthus1ast> one thing i want to do is to pass variables to the vm |
21:01:13 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim 😄 |
21:01:45 | FromDiscord | <Elegantbeef> To have the VM access variables you need to emit setters/getters which nimscripter emits(no clue if you're using it) |
21:01:59 | FromDiscord | <enthus1ast> no not yet |
21:02:20 | FromDiscord | <Elegantbeef> The VM conversion module should handle all conversions to/from PNodes |
21:03:45 | FromDiscord | <Elegantbeef> Well the way to expose variables to the VM is to emit a template that calls a procedure |
21:03:46 | FromDiscord | <enthus1ast> look at this hot mess https://github.com/enthus1ast/nimja/blob/dynamicAgainAgain/playground/dynamicAgain/dynamic2.nim |
21:04:22 | FromDiscord | <Elegantbeef> I can one up you https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim#L138-L210 |
21:06:11 | * | kenran quit (Quit: WeeChat info:version) |
21:06:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/HP0 |
21:07:03 | FromDiscord | <Elegantbeef> You have to manually call `setA` or similar, but it's really all you can do |
21:08:30 | FromDiscord | <enthus1ast> and when its a more complex type eg\: seq[someObj] ? |
21:08:40 | FromDiscord | <enthus1ast> withouth refs |
21:08:54 | FromDiscord | <Elegantbeef> Same thing |
21:09:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/mHK |
21:10:22 | FromDiscord | <Elegantbeef> VM conversion handles everything but procs |
21:10:34 | FromDiscord | <Elegantbeef> Cause we cannot send procs across the barrier |
21:10:35 | FromDiscord | <Elegantbeef> It doesnt share it copies |
21:10:46 | FromDiscord | <enthus1ast> how would the vm stubs then look? |
21:11:08 | FromDiscord | <Elegantbeef> The same as the int but `seq[T]` instead |
21:11:16 | FromDiscord | <enthus1ast> mh ok |
21:11:42 | FromDiscord | <Elegantbeef> Even if you dont want to use nimscripter, write some code with it and pass `-d:debugScript` it'll show the generated code |
21:12:01 | FromDiscord | <enthus1ast> i mean, its not that i do not want to use nimscripter |
21:12:16 | FromDiscord | <Elegantbeef> Whatever the reason is you arent using it i mean |
21:12:34 | FromDiscord | <Elegantbeef> I dont really care to be frank, just saying it's easier to see the code i make if you use it |
21:12:43 | FromDiscord | <Elegantbeef> Ah whoops i accidently `echo` additions |
21:12:59 | FromDiscord | <Elegantbeef> I'm supposed to write them to a file 😛 |
21:14:01 | FromDiscord | <enthus1ast> its a good tip to use functions to get vars |
21:14:13 | FromDiscord | <enthus1ast> i was trying to actually convert the vars somehow |
21:14:36 | FromDiscord | <Elegantbeef> Yea the NimVM isnt made to work with pointers or anything like that, so you really have to convert to/from |
21:14:46 | FromDiscord | <Elegantbeef> It's not great for performance of course |
21:15:06 | FromDiscord | <enthus1ast> i actually does not care for performance in this case |
21:15:16 | FromDiscord | <enthus1ast> i just want to make it work somehow \:) |
21:15:27 | FromDiscord | <enthus1ast> do |
21:18:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=48ca is what's generated from https://github.com/beef331/nimscripter/blob/master/tests/tgeneral.nim#L171-L207 |
21:18:19 | FromDiscord | <Elegantbeef> I realise now i dont generate setters.... hmph |
21:39:09 | FromDiscord | <!&luke> Do you know where I can get the Nim logo as an svg, preferably just the crown, and with no background |
21:39:37 | FromDiscord | <Elegantbeef> https://nim-lang.org/assets/img/logo.svg |
21:42:40 | FromDiscord | <!&luke> Ah thx |
21:50:17 | FromDiscord | <!&luke> That one has text, is there one with a crown only |
21:50:59 | FromDiscord | <!&luke> Nvm found it |
21:51:01 | FromDiscord | <!Patitotective> its an svg, you should be able to separate them |
21:51:15 | FromDiscord | <!&luke> In reply to @Patitotective "its an svg, you": I found one with just the crown so it's ok |
21:51:36 | FromDiscord | <!Patitotective> but its an svg, thats the point :[ |
21:51:51 | FromDiscord | <!&luke> In reply to @Patitotective "but its an svg,": Yea |
21:52:06 | FromDiscord | <!&luke> But there's already one without it, why do more work lmao |
21:52:08 | FromDiscord | <aruZeta> In reply to @Patitotective "its an svg, you": just remove this bad guy https://media.discordapp.net/attachments/371759389889003532/1010667580178042900/unknown.png |
21:52:27 | FromDiscord | <!Patitotective> In reply to @aruZeta "just remove this bad": lol |
21:52:49 | FromDiscord | <!&luke> In reply to @aruZeta "just remove this bad": There is literally one without it lmao |
21:53:05 | FromDiscord | <aruZeta> which is actually the same as doing that if you don't find |
21:53:10 | FromDiscord | <aruZeta> that's the point of an svg |
21:53:18 | FromDiscord | <!&luke> In reply to @aruZeta "which is actually the": Yea |
21:53:20 | FromDiscord | <aruZeta> (edit) "which is actually the same as doing that if you don't find ... " added "it" |
21:54:29 | FromDiscord | <aruZeta> In reply to @Patitotective "lol": years of experience of ~stealing~ asking for svgs |
21:54:32 | FromDiscord | <aruZeta> (edit) "~stealing~" => "~~stealing~~" |
21:55:58 | FromDiscord | <!Patitotective> literally just open inkscape lol |
21:56:22 | FromDiscord | <aruZeta> yh |
21:57:09 | FromDiscord | <aruZeta> In reply to @aruZeta "just remove this bad": or just remove it like that/with a text editor |
21:59:43 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48cw |
21:59:55 | FromDiscord | <aruZeta> `addOrAdd` you mean? |
22:00:24 | FromDiscord | <!Patitotective> `addOrAdd` i mean |
22:00:28 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=48cw" => "https://play.nim-lang.org/#ix=48cy" |
22:00:43 | FromDiscord | <aruZeta> `maybeAdd` ? :troll_face: |
22:00:55 | FromDiscord | <!Patitotective> In reply to @aruZeta "`maybeAdd` ? :troll_face:": :troll: |
22:01:05 | FromDiscord | <aruZeta> :troll_cara: |
22:01:26 | FromDiscord | <aruZeta> anyway, ig maybeAdd sounds better xd |
22:01:51 | FromDiscord | <!Patitotective> but it always add it, not sometimes 🤨 |
22:02:04 | FromDiscord | <aruZeta> ahh |
22:02:21 | FromDiscord | <aruZeta> i didn't rly read the code of what it does my bad |
22:02:30 | FromDiscord | <Rika> Set or append |
22:02:36 | FromDiscord | <Rika> Set or add |
22:02:41 | FromDiscord | <Rika> Nim doesn’t use append I forgot |
22:02:42 | FromDiscord | <aruZeta> append |
22:02:45 | FromDiscord | <Elegantbeef> Make it `joinWith` and pass in a `seq` instead of `T` |
22:02:50 | FromDiscord | <aruZeta> In reply to @Rika "Nim doesn’t use append": yh, then add |
22:03:08 | FromDiscord | <Elegantbeef> `myTable.joinWith("a", @[1])` makes more sense to me |
22:03:21 | FromDiscord | <!Patitotective> :] |
22:03:23 | FromDiscord | <Elegantbeef> perhaps `keyJoinWith` or something like that |
22:03:48 | FromDiscord | <aruZeta> what about `myTable[key] += val` |
22:04:04 | FromDiscord | <!Patitotective> bit cryptic |
22:04:08 | FromDiscord | <Elegantbeef> That doesnt work if the key doesnt exist |
22:04:27 | FromDiscord | <aruZeta> even if you overload it with the proc he made? |
22:04:38 | FromDiscord | <aruZeta> never used a table so idk |
22:04:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48cz |
22:04:58 | FromDiscord | <Elegantbeef> You cannot overload `[]+=` |
22:05:08 | FromDiscord | <Elegantbeef> That's two operators not one |
22:05:16 | FromDiscord | <aruZeta> my bad, that's right |
22:05:37 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48cB |
22:05:43 | FromDiscord | <Elegantbeef> What? |
22:06:07 | FromDiscord | <Elegantbeef> `hasKeyOrPut` sets the value if it fails |
22:06:07 | FromDiscord | <!Patitotective> wait |
22:06:22 | FromDiscord | <Elegantbeef> By fail i mean lacks the key |
22:08:58 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48cC |
22:10:59 | FromDiscord | <Elegantbeef> Sure |
22:11:08 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48cD |
22:16:57 | FromDiscord | <Elegantbeef> It doesnt add it twice |
22:17:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48cF |
22:18:42 | FromDiscord | <!Patitotective> just realized Lol |
22:23:46 | * | Figworm joined #nim |
22:36:12 | * | PMunch quit (Quit: leaving) |
22:53:14 | FromDiscord | <Sabena Sema> using header always implies the header will get included |
22:53:24 | FromDiscord | <Sabena Sema> I can't turn that off if I don't need the checking |
22:53:28 | FromDiscord | <Sabena Sema> context: windows.h everywhere |
22:57:16 | * | xet7 joined #nim |
23:17:31 | FromDiscord | <bun> yo im trying to write a cli program with little external libraries: if possible, how would i clear the terminal using just standard libraries? terminal.clearScreen just pushes the previous outputs up and makes a flickering effect when doing many clears... thx |
23:18:11 | FromDiscord | <Elegantbeef> The best way to clear terminals is generally to write over, so `setCursor(0, 0)` then write each line |
23:22:06 | FromDiscord | <bun> wow that looks a lot better thanks! |
23:22:34 | FromDiscord | <Elegantbeef> Though i'd still say to use illwill and make your life just better 😛 |
23:22:54 | FromDiscord | <bun> still get a little bit of a flicker with the cursor position when using the vscode terminal but works perfect in a real one so its all good |
23:23:11 | FromDiscord | <bun> trying to reduce my use of external libraries while im starting out |
23:23:15 | FromDiscord | <bun> illwill looks really cool tho |
23:23:15 | FromDiscord | <Sabena Sema> huh, does the compiler always compile with checkABI? if so can I stop that? |
23:23:18 | FromDiscord | <Rika> You can’t escape the flicker issue, that depends on how fast the terminal is |
23:23:23 | FromDiscord | <bun> ah |
23:23:55 | FromDiscord | <Elegantbeef> `--checkABI:off` should disale it↵(@Sabena Sema) |
23:23:56 | FromDiscord | <Elegantbeef> I dont think it always does |
23:24:20 | FromDiscord | <Sabena Sema> In reply to @Elegantbeef "`--checkABI:off` should disale it": it's a define not an option... |
23:24:57 | FromDiscord | <Sabena Sema> I'm just confused because the generated C for the nim compiler has includes for relevant headers, whereas I can't reproduce that outside nim |
23:25:05 | FromDiscord | <Elegantbeef> I'm fairly certain it's not on by default |
23:25:17 | FromDiscord | <Sabena Sema> I want to turn it off because it interferes with `--dynlibOverride:kernel32` |
23:25:46 | FromDiscord | <Elegantbeef> If you're overriding a library you should pass a static library to link and it should find the symbols |
23:26:22 | FromDiscord | <Sabena Sema> that's not the problem |
23:26:38 | FromDiscord | <Sabena Sema> obviously you don't need to link anything to access kernel32 symbols |
23:27:02 | FromDiscord | <Elegantbeef> Not obvious to me |
23:30:22 | FromDiscord | <Sabena Sema> but winlean (and a few other places) importc windows functions with "incorrect" signatures |
23:30:28 | FromDiscord | <Sabena Sema> like `int` instead of handle |
23:30:35 | FromDiscord | <Sabena Sema> int is always pointer size so this is mostly fine |
23:30:58 | FromDiscord | <Sabena Sema> but they also import with `{.dynlib:"kernel32".}` which hides the issue under checkABI (I think) |
23:32:00 | FromDiscord | <bulan2> sent a code paste, see https://play.nim-lang.org/#ix=48cO |
23:34:12 | NimEventer | New thread by Elcritch: Ideas for useful/cute little GUI programs?, see https://forum.nim-lang.org/t/9395 |