<< 20-08-2022 >>

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