<< 21-02-2022 >>

00:00:19*tk quit (Quit: Well, this is unexpected.)
00:00:43*tk joined #nim
00:01:24FromDiscord<demotomohiro> Is that means you want to do that without standard library?
00:02:30FromDiscord<Elegantbeef> No clue what that means
00:03:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QeL
00:03:21FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3QeM
00:03:39FromDiscord<Elegantbeef> Mines cooler
00:03:44FromDiscord<Recruit_main707> true :(
00:13:06FromDiscord<huantian> In reply to @demotomohiro "Is that means you": But like, why↵Also you can just look at the source code for strutils.count
00:17:00FromDiscord<Rika> In reply to @Elegantbeef "Mines cooler": Yours is automatically awful for using short variable names smh
00:23:52FromDiscord<Elegantbeef> True
00:23:55FromDiscord<Elegantbeef> Sorry, "true \:("
00:25:56FromDiscord<dom96> using `,` instead of `;` wins all contests in my book
00:27:29FromDiscord<Rika> ? Why
00:28:04FromDiscord<Elegantbeef> Weird contest breaking, given `;` is technically safer
00:28:15FromDiscord<Elegantbeef> I just cant get my fingers to type it naturally
00:33:20FromDiscord<dom96> In reply to @Rika "? Why": No objective reason, I just dislike it in parameter lists
00:33:51FromDiscord<dom96> mainly because it only makes sense to be used for special cases
00:34:46FromDiscord<dom96> so using it for all parameter lists is just meh
01:06:24NimEventerNew question by nonimportant: Error when compiling Nim file with --os:any, see https://stackoverflow.com/questions/71200178/error-when-compiling-nim-file-with-osany
01:22:53FromDiscord<Forest> sent a code paste, see https://paste.rs/cwD
01:23:17FromDiscord<Elegantbeef> manually convert to cstring
01:23:27FromDiscord<Elegantbeef> `cstring myExpression`
01:24:20FromDiscord<Forest> But I'm passing it to JS
01:24:30FromDiscord<Elegantbeef> cstring is "compatible string"
01:24:36FromDiscord<Elegantbeef> You can ignore it on JS afaik
01:25:01FromDiscord<Forest> So the warning doesn't affect JS then?
01:25:07FromDiscord<Forest> And won't in the future?
01:25:29FromDiscord<Elegantbeef> Like i said you can just convert it manually and the warning goes way
01:25:51FromDiscord<Elegantbeef> so you probably should convert it anyway
01:26:07FromDiscord<Elegantbeef> The implicit conversion is a possible unsafe operation which is why that warning exists
01:26:17FromDiscord<Elegantbeef> possible unsafe operation on C/C++\
01:26:26FromDiscord<Forest> But how would i pass it to JS then without using `importjs`?
01:26:38FromDiscord<Elegantbeef> `cstring`
01:26:42FromDiscord<Forest> Since i have to use JS's `new`
01:26:49FromDiscord<Forest> In reply to @Elegantbeef "`cstring`": I don't understand
01:26:56FromDiscord<Elegantbeef> just do `cstring(expression)`
01:27:05FromDiscord<Elegantbeef> where expression is the template or macro you're using
01:27:49FromDiscord<Forest> `proc newFile(parent: JsObject, child: cstring) {.importjs: "new File(@)".}`
01:28:10FromDiscord<Elegantbeef> now where do you call that
01:28:19FromDiscord<Forest> Wait
01:28:25FromDiscord<Forest> Ohhhhh i understand what you mean now
01:28:29FromDiscord<Forest> My brain is dumb
01:29:45FromDiscord<Forest> Thanks!
02:15:30*arkurious quit (Quit: Leaving)
02:35:16NimEventerNew Nimble package! dogapi_cli - Tool to download dogs images, see https://github.com/thexxiv/dogapi-cli
02:36:33FromDiscord<Elegantbeef> an 110 line function with no comments, scary
02:38:35FromDiscord<deech> What is the difference between a HSlice & a tuple?
02:39:44FromDiscord<Elegantbeef> Hslice is an easier type to abstract over imo
02:40:00FromDiscord<Elegantbeef> It's also distinct
02:40:13FromDiscord<Elegantbeef> Not all `(int, int)`s are valid slices
02:42:07FromDiscord<Elegantbeef> Atleast i interpreted it as "Why not use a tuple for slices instead"
02:42:50FromDiscord<deech> Yes that's what I meant.
02:43:42FromDiscord<huantian> In reply to @Elegantbeef "an 110 line function": that's a lot of indentation
02:44:39FromDiscord<Elegantbeef> i'm a bit biased cause i find tuples only useful for return types/unpacking
02:44:47FromDiscord<Elegantbeef> Pretty everywhere else i much prefer static typing
02:46:03FromDiscord<Elegantbeef> `type HSlice[X, Y] = tuple[a: X, b: Y]` is not so weakly typed 😛
02:46:10FromDiscord<Elegantbeef> i guess i should say strong typing
02:48:29FromDiscord<deech> I get why Slice is useful but looking over the codebase the only use of HSlice I'm seeing is [int, BackwardsIndex]. Are there any other compelling use cases?
02:48:48FromDiscord<Elegantbeef> `[a..b]`
02:49:51FromDiscord<Elegantbeef> It's a strongly typed heterogeneous pair of values, it's useful whenever you need a runtime range
02:50:11FromDiscord<Elegantbeef> It's primary use is indexing but i'm sure there are other uses
02:51:08*rockcavera joined #nim
02:51:08*rockcavera quit (Changing host)
02:51:08*rockcavera joined #nim
02:52:49FromDiscord<Elegantbeef> You can do `someFloat in 0d..30d` or similar for your types that implement the operators needed
02:54:58FromDiscord<Elegantbeef> "In this episode of beefs ramblings cause someone to lose conversational interest" 😛
02:59:35FromDiscord<deech> Haven't lost interest just looking over the codebase for uses of HSlice where the types aren't Ordinal.
03:00:28FromDiscord<Elegantbeef> Distincts would be one place
03:00:57FromDiscord<Elegantbeef> I guess that is ordinal 😀
03:01:31FromDiscord<Elegantbeef> User defined numeric types that are not Ordinal based would be something
03:01:39FromDiscord<Elegantbeef> 128bit integers/floats for instance
03:02:42FromDiscord<deech> Why are they not ordinal?
03:03:33FromDiscord<Elegantbeef> Cause ordinal is a hard coded typeclasss
03:06:19FromDiscord<deech> I see. Well looking over `system.nim` it looks like the HSlice is constrained by Ordinal, so even if the user had a non ordinal type they wouldn't be able to use any of that. I guess they could overload `[]` and `[]=` etc.
03:06:56FromDiscord<deech> (edit) "Ordinal," => "Ordinal for useful indexing functions,"
03:07:15FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/945154673923481690/image.png
03:07:16FromDiscord<Elegantbeef> It's not
03:07:40FromDiscord<Elegantbeef> !eval let a = "hello".."world"
03:07:42NimBot<no output>
03:08:38FromDiscord<deech> What could I do with HSlice[string,string]?
03:10:07*jmdaemon quit (Ping timeout: 256 seconds)
03:11:54FromDiscord<Elegantbeef> I mean what ever you want 😛
03:12:44FromDiscord<deech> I guess ... 🙂
03:14:10*jmdaemon joined #nim
03:14:13FromDiscord<deech> Unless I'm missing something there's not much I can do except access `a` and `b`. Even `len` requires Ordinals.
03:14:54FromDiscord<Elegantbeef> That's up to a user implementation you could in theory make `a..b` for string disallow anything outside of that
03:15:31FromDiscord<Rika> Length could mean anything for non ordinals and it’s up to the implementer what it would mean
03:17:14FromDiscord<kiell> whats the difference between object and rootobj?
03:17:15FromDiscord<deech> Yep, so I guess I'd need to redefine all those. I guess custom ranges could be useful.
03:17:33FromDiscord<deech> In any case, going to bed. Thanks!
03:17:34FromDiscord<Elegantbeef> Root object is the root for inheritance↵(@kiell)
03:19:03FromDiscord<kiell> so if i dont plan to use an object for inheritance then rootobj isnt required?
03:19:34FromDiscord<Elegantbeef> Yep
03:19:38FromDiscord<kiell> im just confused why ppl do `type obj = ref object` vs `type obj = ref object of RootObj`
03:19:41FromDiscord<kiell> ok
03:22:33FromDiscord<deech> Boy using negative ranges to slice seqs should be caught at compile time although it would be pretty cool if `@[1,2,3][^1..0]` reversed the seq. https://play.nim-lang.org/#ix=3Qff
03:23:03FromDiscord<Elegantbeef> They want inheritance kiell or dont know what they're doing
03:25:09FromDiscord<Elegantbeef> Well you could do the negative ranges using `static HSlice`
04:05:55FromDiscord<Hamid_Bluri> !eval typeof "hello".."world"
04:05:56NimBotCompile failed: /playground/nim/lib/system/iterators_1.nim(98, 10) Error: type mismatch: got <string>
04:06:02*supakeen quit (Quit: WeeChat 3.4)
04:06:11FromDiscord<Hamid_Bluri> !eval echo typeof "hello".."world"
04:06:12NimBotCompile failed: /playground/nim/lib/system/iterators_1.nim(98, 10) Error: type mismatch: got <string>
04:06:22FromDiscord<Hamid_Bluri> 😕
04:06:22FromDiscord<Elegantbeef> You'll get it eventually
04:06:32*supakeen joined #nim
04:06:35FromDiscord<Hamid_Bluri> hey beef, good mornin
04:06:45FromDiscord<Elegantbeef> the command syntax doesnt play well there
04:06:49FromDiscord<Elegantbeef> It's not morning you liar!
04:06:58FromDiscord<Hamid_Bluri> it's 7:38 AM here
04:07:21FromDiscord<Elegantbeef> I figured it was morning for you, but i have to pretend to be angry
04:07:41nrds<Prestige99> It's almost morning
04:12:25FromDiscord<Elegantbeef> It's 9pm
04:13:23FromDiscord<huantian> no way it's 9pm for me
04:16:16FromDiscord<Elegantbeef> It's not 9pm for you, shame
04:16:25FromDiscord<Hamid_Bluri> lol
04:16:27*rockcavera quit (Remote host closed the connection)
04:41:17*Gustavo6046 quit (Ping timeout: 240 seconds)
04:46:27*Gustavo6046 joined #nim
05:02:30FromDiscord<Arathanis> is there a reason that:↵one works but the other does not? https://media.discordapp.net/attachments/371759389889003532/945183678013800539/unknown.png
05:02:49FromDiscord<Elegantbeef> Nim's sub range type doesnt work with `..<`
05:02:58FromDiscord<Arathanis> ah
05:07:28FromDiscord<tosh [uniware]> In reply to @Elegantbeef "It's 9pm": ru a bot
05:08:36FromDiscord<Elegantbeef> No
05:08:43FromDiscord<Elegantbeef> I sure hope not
05:08:54FromDiscord<Arathanis> thats just what a bot would say 🤔
05:09:09FromDiscord<Elegantbeef> Nah microsofts bots yell racist remarks
05:32:43FromDiscord<tosh [uniware]> In reply to @Elegantbeef "Nah microsofts bots yell": how u got the bot tag
05:36:10FromDiscord<Elegantbeef> I'm on matrix using the bridge to talk to discord
05:39:29FromDiscord<tosh [uniware]> whats matrix
05:39:57FromDiscord<Elegantbeef> A chat protocol
05:40:11FromDiscord<tosh [uniware]> do u know how to get a list of current processes in nim
05:41:30FromDiscord<Elegantbeef> Probably need to use system calls
05:42:41FromDiscord<leorize> depends on the operating system
05:42:45FromDiscord<tosh [uniware]> In reply to @leorize "depends on the operating": windows
05:44:35FromDiscord<leorize> Looks like this is what you need\: https://docs.microsoft.com/en-us/windows/win32/psapi/process-status-helper
05:44:43FromDiscord<leorize> winim should provide wrappers for the API used here
05:46:44FromDiscord<tosh [uniware]> thanks!! 🙂
05:49:53*krux02 quit (Remote host closed the connection)
06:03:28*ltriant quit (Ping timeout: 256 seconds)
06:11:30NimEventerNew Nimble package! variantsugar - utility macros mostly for object variants, see https://github.com/metagn/variantsugar
06:16:13*jmdaemon quit (Read error: Connection reset by peer)
06:17:02*jmdaemon joined #nim
06:23:33*slowButPresent quit (Quit: leaving)
06:48:34*ltriant joined #nim
06:54:56*ltriant quit (Ping timeout: 272 seconds)
07:05:34NimEventerNew Nimble package! cloudbet - Cloudbet Virtual Crypto Casino API Client, see https://github.com/juancarlospaco/cloudbet
07:16:59FromDiscord<tosh [uniware]> In reply to @leorize "Looks like this is": i was looking into it and i come from python and havent used the winapi much, can u tell me how i can do this ?
07:19:17FromDiscord<haolian9 (高浩亮)> hi, i happened to find `std/coro`, but seems std/asyncdispatch did not utilize it, and unable to find any further document on using it; is it just a legacy code?
07:22:43FromDiscord<tosh [uniware]> In reply to @haolian9 (高浩亮) "hi, i happened to": random question, why do u guys use matrix ?
07:23:01FromDiscord<Elegantbeef> I prefer open software
07:23:40FromDiscord<Elegantbeef> To use that api you'd want to install `winim` and then use the api in Nim like the C/C++ does it
07:24:02FromDiscord<Elegantbeef> You'd follow https://docs.microsoft.com/en-us/windows/win32/psapi/enumerating-all-processes
07:24:02FromDiscord<tosh [uniware]> i tried using it but i just couldnt figure it out
07:24:21FromDiscord<haolian9 (高浩亮)> wrong person, i did not ...↵(@tosh [uniware])
07:24:35FromDiscord<Elegantbeef> Gitter is matrix based
07:24:38FromDiscord<tosh [uniware]> In reply to @Elegantbeef "You'd follow https://docs.microsoft.com/en-us/windo": im kinda new to nim so the syntax is a bit to get used to
07:26:14FromDiscord<Elegantbeef> ok what do you have?
07:27:12FromDiscord<tosh [uniware]> In reply to @Elegantbeef "ok what do you": im like mad confused on this syntax so bare with me cuz i fucked up on the first line 🙏
07:28:50FromDiscord<tosh [uniware]> first line
07:28:52FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfR
07:28:52FromDiscord<tosh [uniware]> idk if its right
07:29:02FromDiscord<Elegantbeef> Nope
07:29:11FromDiscord<tosh [uniware]> dam what did i do wrong
07:29:41FromDiscord<tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945220718981971988/unknown.png
07:29:43FromDiscord<tosh [uniware]> this line btw
07:29:53FromDiscord<ShalokShalom> whats the difference between exec and execCmd
07:30:03FromDiscord<ShalokShalom> other than that execCmd doesnt work in NimScript
07:31:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QfS
07:32:14FromDiscord<Elegantbeef> Whoops ` aProcess: array[1024, DWord]`
07:32:42FromDiscord<Elegantbeef> one of them returns the exit code the other the stdout
07:32:49FromDiscord<tosh [uniware]> can u explain what this kinda does cuz im lowk confused
07:33:03FromDiscord<ShalokShalom> In reply to @Elegantbeef "one of them returns": do you mean me?
07:33:22FromDiscord<Elegantbeef> we declare `aProccess` of an array with a size of `1024` and elements of `Dword`
07:33:43FromDiscord<Elegantbeef> We then declare `cbNeeded` and `cProcesses` as DWord and `i` as uint 😛
07:34:22NimEventerNew thread by Mardiyah: Correct way have for-loop iteration up to number of only initialized array elements, see https://forum.nim-lang.org/t/8936
07:34:22FromDiscord<tosh [uniware]> is `aProcess` supposed to be `aProcesses` 🤔
07:34:49FromDiscord<Elegantbeef> Now the fun part is we make an if statement calling `enumerateProcess` with the address of the first element of the array since it wants the first element of a collection, then the size of the array, and the count return
07:34:54FromDiscord<Elegantbeef> Yea it should be
07:36:25FromDiscord<tosh [uniware]> where u learn this
07:36:48FromDiscord<Elegantbeef> I'm self taught so here and there
07:37:01FromDiscord<tosh [uniware]> like what resources tho
07:37:07FromDiscord<Elegantbeef> I've learned a lot of C interop and low level programming due to using Nim
07:37:18FromDiscord<Elegantbeef> I really dont have any resources for this
07:37:39FromDiscord<tosh [uniware]> imma try to do the "PrintProcessNameAndID" function and u tell me if im right
07:41:11FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfT
07:44:25FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/winim/inc/psapi.nim#L175 here is the procedure that uses that
07:44:38FromDiscord<Elegantbeef> The important part is going to be the `LPWSTR` so now we get to figure out how that works
07:47:07FromDiscord<Elegantbeef> The issue is less Nim syntax imo, and more lack of procedure definitions
07:47:47FromDiscord<tosh [uniware]> In reply to @Elegantbeef "The issue is less": shii what can i do to get my process list ive been on dis for so long 😭
07:47:51FromDiscord<Elegantbeef> Cause i'm trying to find the answers but fuck is it tedious
07:47:56FromDiscord<tosh [uniware]> fr
07:48:17FromDiscord<Elegantbeef> Looks like `var szProcessName = T"<unknown>"` might do it
07:48:52FromDiscord<tosh [uniware]> it didnt error and thats farther than i got so imma assume it works 🙏
07:49:10FromDiscord<Elegantbeef> It might error later when it attempts to load names longer than `<unknown>`
07:50:38FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfU
07:50:57FromDiscord<Elegantbeef> look at the definition inside winim
07:51:03FromDiscord<tosh [uniware]> wym
07:51:15FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/winim/inc/winbase.nim#L1962
07:52:39*jjido joined #nim
07:53:38FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfW
07:53:55FromDiscord<Elegantbeef> `PROCESS_QUERY_INFORMATION | PROCESS_VM_READ` will be `PROCESS_QUERY_INFORMATION or PROCESS_VM_READ` in nim i assume
07:54:04FromDiscord<Elegantbeef> bitwise or in Nim is `or`
07:56:54FromDiscord<tosh [uniware]> how we looking so far
07:56:56FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfY
07:57:11FromDiscord<Elegantbeef> Aside from formatting seems fine
07:57:45FromDiscord<tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945227779270664222/unknown.png
07:57:58FromDiscord<tosh [uniware]> i tried to find it in winim with ctrl f and i couldnt
07:57:59FromDiscord<tosh [uniware]> 🤔
07:58:20FromDiscord<Elegantbeef> It's in psapi.nim
07:58:53FromDiscord<Elegantbeef> https://github.com/khchen/winim/blob/master/winim/inc/psapi.nim#L132
08:00:11FromDiscord<tosh [uniware]> thoughts
08:00:15FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfZ
08:00:35FromDiscord<tosh [uniware]> idek what im doing python just go to slow so i like just now download nim 😭
08:00:36FromDiscord<Elegantbeef> I hate the `( value )` 😛
08:00:45FromDiscord<tosh [uniware]> In reply to @Elegantbeef "I hate the `(": naw the spaces look cleaner 😤
08:00:50FromDiscord<Elegantbeef> If it works it works
08:00:56FromDiscord<tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945228583352295424/unknown.png
08:01:00FromDiscord<tosh [uniware]> what is _tprintf
08:01:05*neurocyte0917090 joined #nim
08:01:14FromDiscord<Elegantbeef> a unicode aware print
08:01:16FromDiscord<Elegantbeef> I assume
08:01:32FromDiscord<tosh [uniware]> fuck it just registered sumthing was wrong https://media.discordapp.net/attachments/371759389889003532/945228735169327104/unknown.png
08:01:33FromDiscord<tosh [uniware]> LMAO
08:01:56FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg3
08:03:37FromDiscord<Elegantbeef> Dont know what to say, did you `import winim`?
08:04:57FromDiscord<tosh [uniware]> i fixed that, i had imported `winim/lean`
08:05:06FromDiscord<tosh [uniware]> new error!
08:05:17FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg6
08:05:45FromDiscord<Elegantbeef> `DWord sizeof(hMod)`?
08:06:01FromDiscord<tosh [uniware]> hm?
08:06:42FromDiscord<Elegantbeef> Convert the int into a DWord
08:06:58FromDiscord<tosh [uniware]> how
08:07:15FromDiscord<Elegantbeef> `Dword sizeof(hMod)`
08:07:26FromDiscord<Elegantbeef> Or `DWord(sizeof(hMod))`
08:07:34FromDiscord<tosh [uniware]> ok fixed that, now line 13
08:07:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:07:59FromDiscord<Elegantbeef> Read the compiler error very very well
08:08:00FromDiscord<Elegantbeef> Pleas
08:08:51FromDiscord<tosh [uniware]> i fixed it omg
08:09:04FromDiscord<tosh [uniware]> !!
08:09:29FromDiscord<tosh [uniware]> now to do the main function
08:09:32FromDiscord<tosh [uniware]> ☹️
08:10:20FromDiscord<Elegantbeef> you might be able to print with `import std/strformat` and `echo fmt"{szProcessName} (PID:{processId})`
08:10:24FromDiscord<Elegantbeef> I already gave you the main
08:12:16FromDiscord<tosh [uniware]> ?
08:12:20FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg7
08:12:26FromDiscord<Elegantbeef> Yes they're the same
08:12:29FromDiscord<tosh [uniware]> they looked mad different i didnt even know
08:12:31FromDiscord<tosh [uniware]> 😭
08:12:43FromDiscord<Elegantbeef> Yea one is much cleaner
08:12:55FromDiscord<tosh [uniware]> do u think nim is as good as C or CPP
08:12:57FromDiscord<tosh [uniware]> 🤔
08:13:07FromDiscord<Elegantbeef> It's better
08:13:13FromDiscord<Elegantbeef> It doesnt make me question my sanity
08:15:29FromDiscord<tosh [uniware]> "` Error: type mismatch: got 'int' for 'cbNeeded div 4' but expected 'DWORD = int32'`"
08:15:42FromDiscord<Elegantbeef> same as before
08:15:46FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qga
08:16:16FromDiscord<tosh [uniware]> fixed
08:16:22FromDiscord<tosh [uniware]> now test
08:17:13*gsalazar joined #nim
08:17:43FromDiscord<tosh [uniware]> idek what could have caused this, all of the process names are now "<unknown>"
08:17:51FromDiscord<tosh [uniware]> ex: `"<unknown> (PID:15772)"`
08:19:14*Gustavo6046 quit (Quit: Leaving)
08:20:02FromDiscord<Elegantbeef> I dont know what to say
08:20:12FromDiscord<Elegantbeef> It's something with the process name of course, but no clue
08:21:44FromDiscord<tosh [uniware]> this language so painful
08:21:45FromDiscord<tosh [uniware]> 😭
08:21:57FromDiscord<Elegantbeef> It's not Nim
08:22:04FromDiscord<Elegantbeef> It's winim
08:22:53FromDiscord<tosh [uniware]> from python to low level stuff is quite a jump
08:27:22FromDiscord<mratsim> In reply to @ITR "How would the inner": Continuing on the FSM stuff with @Rika , maybe you can use a rule engine? https://github.com/paranim/pararules see Fosdem talk as well: https://fosdem.org/2022/schedule/event/nim_pararules/
08:34:38*jjido joined #nim
08:37:17FromDiscord<Rika> Cool stuff
08:45:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:54:53*xaltsc quit (Remote host closed the connection)
09:17:02*Schnouki quit (Ping timeout: 240 seconds)
09:19:11*Schnouki joined #nim
09:35:37*jjido joined #nim
09:50:16FromDiscord<Waldecir Santos> Is it possible to have `"named"` varargs I want to mimic python `kwargs`.
09:55:15FromDiscord<Elegantbeef> what's kwargs do again?
09:55:43FromDiscord<Waldecir Santos> kwargs is a dict inside the "proc"
09:55:54FromDiscord<Elegantbeef> Ah then like i said last time use `tuple`
09:56:59FromDiscord<Waldecir Santos> Hmm let me check.
09:57:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qgx
09:58:11FromDiscord<Elegantbeef> You can write a macro to do the introspection better, or use a concept
09:59:28FromDiscord<Elegantbeef> For the concept variant
09:59:30FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/JpN
09:59:50FromDiscord<Waldecir Santos> Yeah I'm trying to avoid the double `((` this looks terrible.
10:00:18FromDiscord<Waldecir Santos> Wow this is the first time I see `concept` awesome
10:00:49FromDiscord<Elegantbeef> I dont get the point of kwargs
10:01:09FromDiscord<Elegantbeef> Just take an optional and or defaults
10:01:20FromDiscord<Waldecir Santos> I need to do some magic to convert it to SQL queries
10:01:52FromDiscord<Waldecir Santos> Like django thoes, e.g: `Entry.objects.filter(pub_dateyear=2006)`
10:02:17FromDiscord<Waldecir Santos> or `Entry.objects.filter(headlinestartswith="What")`
10:02:32FromDiscord<Elegantbeef> Sure you dont need kwargs just make `filter` a macro
10:02:50FromDiscord<Rika> You can get nicer syntax with a macro, even
10:03:18FromDiscord<Waldecir Santos> Sure but this will not work at runtime right ?
10:03:58FromDiscord<Elegantbeef> What do you mean?
10:04:26FromDiscord<Rika> You need your “kwargs” to be runtime modifiable!
10:04:28FromDiscord<Rika> ?
10:04:45FromDiscord<Waldecir Santos> I mean these args can be defined at run time, they cannot be determined at compile time
10:04:50FromDiscord<Waldecir Santos> Yes @Rika
10:05:04FromDiscord<Rika> Runtime defined ain’t runtime modified
10:05:16FromDiscord<Rika> Anyway a macro will do fine with something like that
10:05:55*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
10:06:06FromDiscord<Rika> In reply to @Rika "Runtime defined ain’t runtime": Maybe this is just me being physically tired today though I don’t know
10:06:13FromDiscord<Elegantbeef> If i understood what was desired i'd say what to do but i'm just lost
10:06:14FromDiscord<Rika> But a macro should suffice
10:07:17FromDiscord<Elegantbeef> No waldecir dont talk about django, that doesnt help
10:08:12FromDiscord<Waldecir Santos> @ElegantBeef I need to access a list of params and it's values inside a proc and this list can be anything it will be "generated" at runtime, maybe this is a better explanation
10:08:52FromDiscord<Elegantbeef> so a `Table[string, string]` 😀
10:09:12FromDiscord<Waldecir Santos> Tuple is perfect, but I have the `((` `))` and this looks aweful
10:09:46FromDiscord<Elegantbeef> You could always make a macro for the call then convert it into a tuple and call the proper thing
10:10:10FromDiscord<Waldecir Santos> Yeah I'll play with it, you both helped a lot.
10:10:14FromDiscord<Waldecir Santos> Thank you
10:10:53FromDiscord<Elegantbeef> I've never dealt with this stuff so you asking these questions just makes me question my sanity
10:11:20FromDiscord<Elegantbeef> "I dont understand why anyone in their right mind wants to dynamically make stuff"
10:11:58FromDiscord<Waldecir Santos> Sorry, I'm on the same boat, because I know I'm stretching nim capabilities trying to implement "python" like code
10:12:46*vilhelmbergsoe joined #nim
10:12:52FromDiscord<Waldecir Santos> In reply to @Elegantbeef ""I dont understand why": Same but my goal is just to mimic some parts or django to help web dev in nim, this is maybe not possible, but I'm learning Nim in the process so it worth ! 😄
10:13:08FromDiscord<Elegantbeef> It's 100% possible
10:13:19FromDiscord<Elegantbeef> You just have to know what you need explicitly 😛
10:13:47FromDiscord<Waldecir Santos> Right, that is my problem right now, too much unknowns from my side
10:15:15vilhelmbergsoeHi there, i have a question regarding where, in the development space, nim fits in. Is it more comparable to a language like c or rust in that it is a systems language? or is it also used in networking like go? Might seem like a stupid question, but i'm just trying to get a quick idea of nim :)
10:15:35FromDiscord<Elegantbeef> It's used all over the plcae
10:15:37FromDiscord<Elegantbeef> place\
10:15:53FromDiscord<Elegantbeef> It can be used for everything without much hassle imo
10:16:01FromDiscord<Rika> I would say it leans heavier to system than networking.
10:16:29FromDiscord<Rika> But it is applicable in a lot of areas, just needs work
10:17:16FromDiscord<Elegantbeef> Yea there are some issue with concurrency and parallelism presently i think, but weave/taskpools help there
10:21:43vilhelmbergsoeAlright nice! and thanks :)
10:22:08vilhelmbergsoeI'll take a look at the concurrency model
10:24:02FromDiscord<Elegantbeef> Araq gave a fosdem talk about it if you want to see what's going to happen https://ftp.osuosl.org/pub/fosdem/2022/D.nim/nim_concurrency.mp4
10:26:41*jmdaemon quit (Ping timeout: 256 seconds)
10:28:56*ltriant joined #nim
10:31:06vilhelmbergsoeElegantbeef: Haha yeah, i'm watching it now :)
10:33:35*ltriant quit (Ping timeout: 252 seconds)
10:35:49FromDiscord<ITR> In reply to @mratsim "Continuing on the FSM": ooo, idk, but that would actually have been useful for a few projects from a few years back
10:36:35FromDiscord<ITR> the only rule engines I managed to find didn't work for what i wanted
10:38:37*vilhelmbergsoe quit (Ping timeout: 240 seconds)
10:41:14FromDiscord<ITR> or maybe I was looking for constraint stuff. I haven't slept in a while
11:26:16FromDiscord<ShalokShalom> In reply to @mratsim "Continuing on the FSM": I assume, this has to be supported specifically by game engines?
11:26:28*jjido joined #nim
11:32:12*Vladar joined #nim
11:42:01FromDiscord<Waldecir Santos> @Rika @ElegantBeef your suggestion for doing something like this, right?
11:43:54FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3QgR
11:45:21FromDiscord<Rika> no
11:45:29FromDiscord<Rika> the macro is doThing
11:46:12FromDiscord<Waldecir Santos> Hmm but I'll have the same varargs problem, no ?
11:46:27FromDiscord<Waldecir Santos> Let me try this, macro is really new to me.
11:48:31FromDiscord<mratsim> In reply to @ShalokShalom "I assume, this has": No idea, how do game engines even work? I mean it seems like just a function call with a context object.
11:55:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:55:41FromDiscord<ShalokShalom> I know, that ECS had to be implemented specifically to Godot.
11:56:05FromDiscord<ShalokShalom> Respectively, into GDScript, if I remember correctly now.
11:56:13FromDiscord<Waldecir Santos> @Rika yeah I don't know how to get the `(...)` part inside the macro
11:56:14FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/945287798339039232/unknown.png
11:56:20FromDiscord<Waldecir Santos> This is what I'm receiving
11:57:05FromDiscord<Waldecir Santos> This is what I mean by having the same varargs problem
11:57:20FromDiscord<ShalokShalom> https://github.com/GodotECS/godex#godex
11:57:36FromDiscord<ShalokShalom> So, that means I can use Pararules just like that in Godot?
11:57:46FromDiscord<ShalokShalom> Has anybody tried that?
11:58:09FromDiscord<ShalokShalom> Seems to be suitable, to provide an example in the Readme anyway.
12:00:14*jjido joined #nim
12:06:01*supakeen quit (Quit: WeeChat 3.4)
12:06:31*supakeen joined #nim
12:12:06FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3Qh1
12:12:36FromDiscord<ynfle> To be honest, i'd just use table constructor syntax and then convert to table internally
12:13:14NimEventerNew thread by Drkameleon: Variable has incomplete type: struct..., see https://forum.nim-lang.org/t/8937
12:23:42*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:28:32*Shadow0133 joined #nim
12:39:37*vicecea quit (Remote host closed the connection)
12:40:26*vicecea joined #nim
12:40:34Shadow0133How would i go about crosscompiling to raspberry pi 1 b+ (arm6l, if i'm not mistaken)? Either program or compiler
12:47:27FromDiscord<Waldecir Santos> In reply to @ynfle "These are 2 separate": Oh I see thank you
12:57:49*jjido joined #nim
13:07:53FromDiscord<ynfle> In reply to @Shadow0133 "How would i go": From which platform?
13:08:29Shadow0133debian, x86_64
13:32:02Amun-RaShadow0133: for example https://www.kitware.com/cross-compiling-for-raspberry-pi/
13:38:43*slowButPresent joined #nim
13:39:55FromDiscord<lpha3ch0> I'm not sure if there's already a package for this... I searched last night and didn't find anything so I hacked this together. Sometimes the simplest of things bring me joy. https://media.discordapp.net/attachments/371759389889003532/945313892182159370/2022-02-21_08_33_30-kali-linux-2022.1-vmware-amd64_-_VMware_Workstation.png
13:40:46FromDiscord<lpha3ch0> (edit) "bring" => "make" | "joy." => "happy."
13:41:19FromDiscord<lpha3ch0> (edit) "simplest of" => "simple"
13:43:11*krux02 joined #nim
13:46:56*PMunch joined #nim
13:49:38FromDiscord<auxym> neat, consider publishing it on nimble.directory
13:51:32PMunchlpha3ch0, that is pretty neat. I guess it could become part of termstyle :)
13:53:15FromDiscord<lpha3ch0> In reply to @PMunch "<@275045322705862656>, that is pretty": I was just starting to work on pushing this to termstyle. Should be a quick addition. 🙂
13:55:08PMunchI'd prefer it though if it was done in a similar way to the rest of termstyle. Declare the symbols as constants which can be used without calling the procedure and then have convenience wrappers that do it for you
13:59:04*arkurious joined #nim
14:00:05*rockcavera joined #nim
14:00:05*rockcavera quit (Changing host)
14:00:05*rockcavera joined #nim
14:06:02*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:09:47*ltriant joined #nim
14:15:03*ltriant quit (Ping timeout: 256 seconds)
14:26:56FromDiscord<lpha3ch0> In reply to @PMunch "I'd prefer it though": I submitted the merge request. Thanks for creating termstyle and everything you do to make Nim great.
14:28:25PMunchThanks for the kind words, glad you enjoy my work :)
14:29:57FromDiscord<lpha3ch0> Unfortunately, while this looks great in the Linux terminal, the symbols are ugly in the Windows terminal.
14:31:25FromDiscord<lpha3ch0> That's just Windows displaying unicode thing. I printed the same symbols in the Windows terminal without using termstyle, only the unicode and it's ugly. But what else should we expect from Windows. LoL
14:35:10PMunchYeah the Windows terminal isn't great..
14:35:18PMunchPowershell is apparently a bit better though
14:35:58PMunchBut termstyle is really only meant for terminals which are compatible with ANSI colours, so the windows terminal is already out I believe
14:36:56FromDiscord<Rika> are we talking about the new windows terminal or the old command prompt
14:36:59FromDiscord<lpha3ch0> The symbols work well enough on Windows and look good except for they are undersized compared to the following text.
14:37:47*Shadow0133 quit (Quit: Client closed)
14:38:17FromDiscord<Schelz> Does anyone have a doc for how to link cpp file with nim code, some examples would be great too.
14:39:20FromDiscord<lpha3ch0> I'm not a developer and I still have a lot to learn to be good at programming in Nim. At the moment I'm just happy that I could give a little bit back to a language that I
14:40:30FromDiscord<lpha3ch0> (edit) "I'm not a developer and I still have a lot to learn to be good at programming in Nim. At the moment I'm just happy that I could give a little bit back to a language that I ... " added "love. I'm always looking for excuses to rewrite something in Nim just so I can learn more. Last night I tried to go back to scripting in Python and Ruby for a little side project but I just ended up going right back to Nim."
14:53:43PMunchHaha sounds familiar @lpha3ch0 :P
14:53:58PMunchThe "going right back to Nim" part, not the "not a developer part"
14:54:19PMunch@Schelz, not quite sure what you mean
14:55:59PMunchYou technically don't "link" C++ files, you "link" a dynamic or static library, and at that point it doesn't matter much which language it was written in
14:56:45PMunchBut you can `importcpp` things from a header in Nim and build with the C++ sources?
15:00:37*gsalazar_ joined #nim
15:02:57*gsalazar quit (Ping timeout: 240 seconds)
15:06:14*gsalazar__ joined #nim
15:08:56*gsalazar_ quit (Ping timeout: 272 seconds)
15:10:07*gsalazar_ joined #nim
15:13:08*gsalazar__ quit (Ping timeout: 256 seconds)
15:24:49*wyrd quit (Remote host closed the connection)
15:25:06*wyrd joined #nim
15:39:04NimEventerNew question by pooooky: How to disable warning in Nim, see https://stackoverflow.com/questions/71209055/how-to-disable-warning-in-nim
15:40:32FromDiscord<Deceptive> I remember there was Windows Server Dockerfile with Nim included can anyone link it to me?
15:42:09FromDiscord<Deceptive> https://github.com/sirredbeard/nim-windows-container
15:42:11FromDiscord<Deceptive> Found it
16:03:44FromDiscord<QueenFuckingAdrielle> Anyone have any input on best serialization methods? I've read several places online that using std/marshal is a "bad" way to serialize. Why is it bad and what are the alternatives?↵↵Context: I need to serialize and serialize custom Message objects when sending and receiving in zmq.
16:03:54FromDiscord<QueenFuckingAdrielle> (edit) "serialize" => "deserialize"
16:08:19FromDiscord<huantian> You can check out flatty or frosty
16:08:57FromDiscord<huantian> Both are pretty neat serialization libs
16:09:37FromDiscord<QueenFuckingAdrielle> I'll check those out. I'm also using https://github.com/jangko/msgpack4nim but im worried its not going to be maintained much
16:11:50*Schnouki quit (Remote host closed the connection)
16:11:50*toothlessgear quit (Remote host closed the connection)
16:12:31*Schnouki joined #nim
16:12:52*toothlessgear joined #nim
16:18:07*gsalazar_ quit (Quit: Leaving)
16:20:18*Gustavo6046 joined #nim
16:24:36*gsalazar joined #nim
16:29:52FromDiscord<qb> Could I tell the compiler to just create the c file without building it?
16:32:51PMunchYes
16:33:05PMunchYou find the switch in `nim --fullhelp`
16:33:14PMunchDon't remember it off the top of my head and have to go now
16:33:15*PMunch quit (Quit: leaving)
16:33:20FromDiscord<QueenFuckingAdrielle> I'm considering support rust in my robotics platform. I am not a huge fan of rust, but what is everyone's feeling on rust? Nim is by far my favorite lang and I have always seen rust as the main competitor, if we even assume thats a thing with programming languages.
16:33:32FromDiscord<QueenFuckingAdrielle> (edit) "support" => "supporting"
16:34:35FromDiscord<qb> --compileOnly was it
16:34:36FromDiscord<qb> thanks
16:43:20*sagax joined #nim
16:58:11*Schnouki quit (Remote host closed the connection)
16:58:12*toothlessgear quit (Remote host closed the connection)
17:04:16*Schnouki joined #nim
17:04:17*Schnouki quit (Changing host)
17:04:17*Schnouki joined #nim
17:04:35*wyrd quit (Ping timeout: 240 seconds)
17:04:37*toothlessgear joined #nim
17:05:36*wyrd joined #nim
17:12:10FromDiscord<jmgomez> Hey guys, on windows when I specify --app:lib using clang, it generates .lib and dll files. If I not specy clang (I assume it uses the microsoft compiler) it doesnt generate the import lib file, just the dll. How can I generate the missing import lib file?
17:12:17*noeontheend joined #nim
17:16:52FromDiscord<Bloss> In reply to @QueenFuckingAdrielle "I'm considering supporting rust": nim is closer to go than rust IMO but for your use case rust is likely good
17:21:24FromDiscord<Bloss> In reply to @jmgomez "Hey guys, on windows": are you using `{.dynlib.}` pragma? I think if nothing gets dynlib exported the microsoft compiler simply does not generate a .lib file. Mingw on the other hand generates `.dll.a` files instead of .lib files
17:22:25FromDiscord<jmgomez> In reply to @blans "are you using `{.dynlib.}`": yup, Im using it
17:23:10FromDiscord<Bloss> sorry .a files are static libraries not import files
17:23:17FromDiscord<Bloss> hmm then it might be using mingw
17:24:22FromDiscord<jmgomez> can the microsoft compiler be forced?
17:24:47FromDiscord<jmgomez> not sure if you can import something imported in clang with the microsoft compiler?
17:24:56FromDiscord<jmgomez> (edit) "imported" => "created"
17:26:04FromDiscord<Bloss> you should be able to with --cc:vcc
17:26:28FromDiscord<Bloss> in the worst case you can generate a .lib file from a dll
17:26:51FromDiscord<Bloss> https://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll
17:28:40FromDiscord<jmgomez> ohh cool, wasnt seeing the option. It does generate it now!
17:37:13FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Qj7
17:38:13FromDiscord<morgan> this one also uses a `concept` which is also not mentioned by the manual https://gist.github.com/PhilipWitte/31b32858e23604bd925e
17:38:24*noeontheend quit (Ping timeout: 272 seconds)
17:49:08FromDiscord<atlx> hi
17:51:34FromDiscord<morgan> ping me if you respond to my question
18:05:49FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Qjf
18:08:33FromDiscord<demotomohiro> Concepts are explained in experimental manual: https://nim-lang.org/docs/manual_experimental.html#concepts
18:08:46FromDiscord<demotomohiro> @atlx hi
18:09:57FromDiscord<Gibson> how should i use c function pointers from nim ffi?
18:10:31FromDiscord<Gibson> is just `proc x(a: proc()) {.exportc,dylnib.}` okay?
18:10:39FromDiscord<Gibson> (edit) "{.exportc,dylnib.}`" => "{.exportc,dynlib.}`"
18:11:19FromDiscord<treeform> I think you just need `proc() {.cdecl.}`?
18:11:24*ltriant joined #nim
18:11:36FromDiscord<Gibson> alright thanks
18:12:01FromDiscord<Gibson> that's what i assumed but i couldn't see it in the manual and didn't want to trial+error if someone already knew
18:12:50FromDiscord<treeform> You can see many function pointers to C lib here: https://github.com/treeform/staticglfw/blob/master/src/staticglfw.nim#L360
18:13:41FromDiscord<Gibson> okay, should work then, thanks!
18:13:53FromDiscord<can.l> @Gibson There is https://nim-lang.org/docs/manual.html#types-procedural-type which describes what the different proc type pragmas (including cdecl) do.
18:14:39FromDiscord<treeform> In reply to @Gibson "okay, should work then,": This is how you would use them: https://github.com/treeform/fidget/blob/master/src/fidget/opengl/base.nim#L385-L391
18:15:00FromDiscord<Gibson> yeah, just wanted to make sure i had the type right
18:15:18FromDiscord<Gibson> In reply to @can.l "<@!309787486278909952> There is https://nim-lang.or": > A procedural type is internally a pointer to a procedure.↵ah, i guess this explains it
18:16:10*ltriant quit (Ping timeout: 256 seconds)
18:27:22*cyraxjoe quit (Ping timeout: 260 seconds)
18:30:03*cyraxjoe joined #nim
18:36:14FromDiscord<morgan> In reply to @demotomohiro "<@277133333773811712> Composition in that": ah ok, thanks
18:41:24FromDiscord<tosh [uniware]> how can i split the name of a directory off from its full path
18:42:45FromDiscord<tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qjm
18:48:31FromDiscord<Forest> Will the template from https://github.com/juancarlospaco/nim-new-backend still work?
18:51:45FromDiscord<demotomohiro> @tosh [uniware] https://nim-lang.org/docs/os.html#splitFile%2Cstring
18:52:03FromDiscord<tosh [uniware]> ty!
18:53:08FromDiscord<Phil> Curiosity question, anyone here that uses other tooling than vscode + nim plugin for code?↵I find vscode + plugin to be pretty hit-or-miss on the intellisense, while it also takes randomly forever (>3seconds) sometimes to make a suggestion.
18:53:27FromDiscord<Phil> (edit) "while" => "given that" | "also" => "sometimes" | "sometimes" => ""
18:54:13FromDiscord<demotomohiro> I use neovim + some plugins.
18:55:17FromDiscord<Phil> As someone that never intentionally used anything other than nano for terminal command line text editors, does neovim even come with code suggestions ?
18:59:13FromDiscord<demotomohiro> I tried some Nim plugins with suggestion before but that made my neovim slow down. So I removed it. Neovim still can complement identifiers from words in opened files.
19:01:40FromDiscord<demotomohiro> If you open module.nim and write `proc fooInit` then whe you edit other file and type `foo`, neovim can suggest `fooInit`.
19:03:17FromDiscord<Phil> Hmm so essentially similar issues as vscode, suggestions work kind of, but not perfectly
19:06:03FromDiscord<demotomohiro> Im using old PC. If you have faster CPU, it might work smoothly.
19:06:59FromDiscord<Phil> I'm coding in my spare time on an 8 year old Lenovo T440, we might share similar issues 😄
19:07:09FromDiscord<Phil> Though hopefully soon my replacement will arrive
19:08:32FromDiscord<Phil> I was mostly curious if there's a vastly better experience to be had in another editor with nim-intellisense
19:08:33NimEventerNew post on r/nim by Familiar_Ad_8919: skipping parentheses in larger programs, see https://reddit.com/r/nim/comments/sy1jht/skipping_parentheses_in_larger_programs/
19:24:36FromDiscord<QueenFuckingAdrielle> In reply to @blans "nim is closer to": I will probably create a rust api for it. Right now the core runtime is in nim that interfaces with singularity/docker containers or processes in secondary languages or nim code. For secondary languages, python is about 50% of the way to full support. I am looking at supporting c, cpp, rust, and maybe julia in the future. I just don't know if i want to adopt rust as a 1st class languag
19:25:48FromDiscord<QueenFuckingAdrielle> this is more of strategic decision I guess. I'm not sure if I'm fully commercializing this or not, but if I do, nim is not exactly the most common skill/language among potential adopters.
19:31:15FromDiscord<Schelz> In reply to @PMunch "You technically don't "link"": So I have to compile the cpp file into a .lib or .dll ?
19:36:55*neurocyte0917090 quit (Ping timeout: 256 seconds)
19:40:14FromDiscord<demotomohiro> @Schelz You can compile a cpp file and link the obj file:https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma
19:40:58FromDiscord<rakgew> @Phil\: I use micro in the terminal. without setup I get hints and warnings. (but no autoomplete yet)
19:41:05*neurocyte0917090 joined #nim
19:51:39FromDiscord<jos> how do you even write a source to source compiler
19:51:53FromDiscord<jos> like do u literally just emit strings
19:52:13FromDiscord<jos> in lieu of any place u would normally emit assembly or something
19:52:57FromDiscord<jos> i tried looking at the nim compiler's source but it seems a little messy and maybe not the way u wanna do it
20:03:32*jmdaemon joined #nim
20:24:44*Nuc1eoN left #nim (The Lounge - https://thelounge.chat)
20:33:53FromDiscord<leorize> nim compiler is the last place you wanna look at
20:40:39FromDiscord<leorize> and yeah you kinda emit string
20:41:37FromDiscord<leorize> but the best way to do it would be to emit an IR that is close to the target language, that way you can do more transformation/optimizations if needed
21:10:56*ltriant joined #nim
21:14:03FromDiscord<ynfle> In reply to @Isofruit "Curiosity question, anyone here": vim + nimlsp
21:15:03FromDiscord<theanxietybuster> I don’t nim much right now but I’ve been coding with ED and some wrappers shoved on top :ferrisSweat:
21:15:53FromDiscord<Phil> In reply to @rakgew "<@180601887916163073>\: I use micro": Does "hints" include getting decent function suggestions, e.g. that it suggests "someproc" in an imported file for "someobj.somep" ?
21:16:01FromDiscord<theanxietybuster> But VS2019+ also now supports building with a Makefile, so it should theoretically work for nim on Windows
21:16:53FromDiscord<Phil> In reply to @ynfle "vim + nimlsp": Do suggestions for proc-autocompletion and variable names work to your satisfaction or is that also pretty slow/incomplete sometimes?
21:17:00FromDiscord<Phil> Same for you @theanxietybuster
21:18:09FromDiscord<theanxietybuster> I haven’t tried them at all. I usually use docs and wing it. If the compiler for a language throws an error, I’ve gotten decent at figuring out where the issue was and fixing it
21:18:39FromDiscord<ynfle> In reply to @Isofruit "Do suggestions for proc-autocompletion": Definitely comlete. Randomly it stops working for a day. Not the fastest but could be my configuration, but for sure faster than VSCode. A new feature is that now it displays the documentation also once the routine (proc, func, iterator, template, macro) is chosen
21:19:13FromDiscord<theanxietybuster> I kind of want to try and see how Nim support is on OniVim2 though
21:20:03FromDiscord<theanxietybuster> Think VSCode built without Electron but with a full Vim framework as the base
21:20:14FromDiscord<Phil> In reply to @ynfle "Definitely comlete. Randomly it": Hmm I'm absolutely terrible with vim given I never even spent more than 5 consecutive minutes with it, but faster and more consistent autocomplete might just be worth it
21:32:45FromDiscord<tosh [uniware]> what compiler arguments should i use to optimize my nim code 🤔
21:33:32FromDiscord<demotomohiro> -d:release or -d:danger
21:34:00FromDiscord<tosh [uniware]> and how do i turn off the console window 🤔
21:35:47FromDiscord<demotomohiro> --app:gui
21:36:07FromDiscord<demotomohiro> https://nim-lang.org/docs/nimc.html
21:36:12FromDiscord<tosh [uniware]> thanks
21:37:32FromDiscord<Goel> Is `writeFile(filename: string; content: openArray[byte])` more performant than `writeFile(filename, content: string)` since it doesn't need to convert all the data to string before? I mean if i have to do a lot of data writing on files and I/O, which is the more performant approach i should use?
21:39:33FromDiscord<ynfle> In reply to @Goel "Is `writeFile(filename: string; content:": You can always benchmark with `benchy` but IO Is always for complicated I think
21:41:32FromDiscord<demotomohiro> How about to read the source code of `writeFile`?
21:46:37*PMunch joined #nim
21:48:22FromDiscord<demotomohiro> It looks like `fwrite` vs `fputs`.
21:51:17FromDiscord<ynfle> In reply to @demotomohiro "It looks like `fwrite`": Which is faster?
21:55:11FromDiscord<Goel> What is `fputs`? never read about that in the IO Module
21:58:56FromDiscord<ynfle> In reply to @Goel "What is `fputs`? never": It's a C things
21:58:58FromDiscord<ynfle> (edit) "things" => "thing"
22:00:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qkm
22:00:16FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L855↵Here is implemetation of `writeFile`.
22:01:15FromDiscord<ynfle> In reply to @Isofruit "Hmm I'm absolutely terrible": Here's a video. You can see the error messages on the bottom. Warnings and hints don't show up 🤷‍♂️ https://media.discordapp.net/attachments/371759389889003532/945440053583306813/Screen_Recording_2022-02-21_at_11.19.15_PM.mp4
22:03:23FromDiscord<demotomohiro> I don't know which one is faster but `fwrite` writes given length while `fputs` writes untils it read `\0`. I think their performance is almost same.
22:04:14FromDiscord<Elegantbeef> I mean doing IO is slow, so it hardly matters imo
22:05:20PMunchHmm, am I missing something here? The pure pragma says that it can be applied to objects to make them not show type information. But I can't see any difference in the generated C.. https://nim-lang.org/docs/manual.html#pragmas-pure-pragma
22:05:55PMunchI found this https://forum.nim-lang.org/t/5125 and tried again with some objects inheriting and a procedure that needs type information. But still no difference
22:05:56FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3Qkn
22:05:57FromDiscord<Elegantbeef> Pmunch i think it's for inheritance, i could be wrong
22:06:20FromDiscord<Elegantbeef> Perhaps try in a release build if you havent
22:06:39FromDiscord<demotomohiro> If you use `writeFile` with string parameter to write random binary data can contain 0, it might not write whole data.
22:06:42FromDiscord<Elegantbeef> Debug may leave type info to give more useful debugging?
22:07:14PMunchStill no difference..
22:07:34FromDiscord<Elegantbeef> Yea the way to write safely would be `fileName.write(myData.toOpenArrayByte(0, myData.len)`
22:07:35PMunchBy the way, this is what I'm testing with: http://ix.io/3Qko
22:07:38FromDiscord<Elegantbeef> writeFile\
22:07:47FromDiscord<Elegantbeef> Perhaps pure got brokededed
22:09:15*Vladar quit (Quit: Leaving)
22:12:24FromDiscord<jos> In reply to @leorize "but the best way": do you think haxe would be a reference?
22:14:02PMunchAha, I see what it does now
22:14:16PMunchWow, the docs on this feature is super vague and misleading!
22:16:04FromDiscord<ynfle> In reply to @PMunch "Aha, I see what": Enlighten us!
22:16:24PMunchHold on, I'm compiling sources
22:16:36PMunchAs in getting together links, not compiling source code..
22:17:08FromDiscord<ynfle> Lol
22:19:22nrds<dowry/freenode99> <rasengan> Classic Freenode had a special part in my heart and everyone else's. It's the saddest and hardest thing I've done, in a long time - but I am giving the directive to shut it down. #MFGA
22:19:26nrds<dowry/freenode99> After people abandoned Freenode in droves, Andrew went even more crazy and decided to purge everything. He deleted every single channel, every single user, everything got nuked. This convinced everybody that hasn't jumped ship yet to do so, and now Freenode is completely and utterly dead.
22:19:31nrds<dowry/freenode99> <rasengan> Classic Freenode had a special part in my heart and everyone else's. It's the saddest and hardest thing I've done, in a long time - but I am giving the directive to shut it down. #MFGA
22:19:35nrds<dowry/freenode99> After people abandoned Freenode in droves, Andrew went even more crazy and decided to purge everything. He deleted every single channel, every single user, everything got nuked. This convinced everybody that hasn't jumped ship yet to do so, and now Freenode is completely and utterly dead.
22:19:40nrds<dowry/freenode99> <rasengan> Classic Freenode had a special part in my heart and everyone else's. It's the saddest and hardest thing I've done, in a long time - but I am giving the directive to shut it down. #MFGA
22:19:44nrds<dowry/freenode99> After people abandoned Freenode in droves, Andrew went even more crazy and decided to purge everything. He deleted every single channel, every single user, everything got nuked. This convinced everybody that hasn't jumped ship yet to do so, and now Freenode is completely and utterly dead.
22:20:04PMunchPrestige, is there anything we can do to remove these messages?
22:22:22PMunchOkay, so Nim has a pragma called `{.inheritable.}` which is mentioned a couple of places in various documentation, but hasn't gotten a section of its own. The best description of what it does comes from the inheritance section in tutorial II: You can use the inheritable pragma to introduce new object roots apart from `system.RootObj`.
22:22:48nrds<Prestige99> not really, people signing up new accounts with different IPs and spamming...
22:23:20PMunchIt seems like they all use that #MFGA hashtag though, could we simply filter messages containing that out?
22:23:25nrds<Prestige99> Maybe can instantly start kicking people quoting rasengan
22:24:20PMunchYeah I mean that message is quoted verbatim, so it shouldn't be hard to just throw in a simple filter..
22:24:27PMunchAnyways, back to inheritable!
22:24:56nrds<Prestige99> Yeah
22:25:01nrds<Prestige99> asking some mods about it
22:25:37PMunchSo with an object marked as `{.inheritable.}` it ends up creating an object with a type field, this holds the specific type of the object that is currently being created.
22:29:47PMunchThis means that it can be used for normal inheritance checking stuff like you would expect with e.g. RootObj
22:30:40PMunchAttaching the `{.pure.}` pragma along with an `{.inheritable.}` pragma means that the object no longer creates this field
22:32:13PMunchThis means that if you define one object with fields `x` and `y`, both ints, and one object with `x` which is `{.pure, inheritable.}` and then inherit that from another object which adds field `y` then the first object with both fields and the new inherited object would be the same object in memory.
22:32:29FromDiscord<Elegantbeef> It should be the same with `type MyType = object of RootObj`
22:32:41FromDiscord<Elegantbeef> Though i still dont see why these types need type information
22:33:01PMunchAs far as I can tell from the few mentions it gets in the manual this is mostly used to interface with C/C++
22:33:09PMunchWhat do you mean?
22:33:43PMunchRootObj is {.inheritable.} but not {.pure.}
22:33:51PMunchSo it has a type field in it
22:33:57FromDiscord<Elegantbeef> I dont see why value types using inheritance need type information
22:34:40PMunchTo do things like `proc myProc(x: MyBaseType) = if x of MyInheritedType: echo "Hello world"`
22:34:51FromDiscord<Elegantbeef> that can be resolved statically
22:34:52PMunchIf MyBaseType is {.inheritable.} that works fine
22:35:01FromDiscord<Elegantbeef> and it'd be `when x is MyInheritedType`
22:35:29PMunchBut if it is {.pure, inheritable.} then it fails to compile with a message that you can't use `of` with pure types
22:35:43FromDiscord<Elegantbeef> Sure but you dont need `of` for value types
22:35:55FromDiscord<Elegantbeef> They can be statically dispatched
22:36:08PMunch`is` doesn't work though
22:36:17FromDiscord<Elegantbeef> It does too
22:37:05PMunchNope: syntax error at or near ""
22:37:08PMunchCrap..
22:37:11PMunchMy paste messed up
22:37:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Qky
22:37:33PMunchhttps://play.nim-lang.org/#ix=3Qkz
22:37:46FromDiscord<Elegantbeef> I dont know i guess it's useful for manual allocated collections
22:38:33PMunchAs you can see your code only outputs "Heh" once for the type where you manually cast to MyBase
22:38:53FromDiscord<Elegantbeef> No it outputs it once for the time i dont convert it
22:39:25FromDiscord<Elegantbeef> A generic constraint that is an inherited object uses a composite type class to dispatch
22:39:34FromDiscord<Elegantbeef> So you get the proper type and dont need runtime checks
22:39:51PMunchAh right
22:40:15FromDiscord<Elegantbeef> I just dont see where you can use this type information easily since they're not the same size
22:40:23PMunchBut just using it as a type doesn't?
22:40:36FromDiscord<Elegantbeef> Nope it upcasts it to that type
22:40:47FromDiscord<Elegantbeef> which makes sense for when it's a `var T`
22:41:35FromDiscord<Elegantbeef> It's just super odd that runtime type information exists for value types to me, there's just not a case i can see it being useful
22:41:47PMunchDynamic dispatch?
22:41:47FromDiscord<Elegantbeef> Maybe methods?
22:41:52PMunchI mean that's probably why it's even there
22:42:22FromDiscord<Elegantbeef> But i mean it doesnt make much sense there either since methods dont make sense given you cannot store them heterogenously
22:42:57PMunchHmm, I was able to create a method for a pure, inheritable object..
22:43:18FromDiscord<Elegantbeef> If you attempt to make a `@[Base(), Child(), Child()` you get a runtime error
22:43:29FromDiscord<Elegantbeef> Which makes sense as there is a loss of information for that conversion
22:43:35FromDiscord<Elegantbeef> It's just a big "why" to me
22:44:55PMunchHmm, this works though: https://play.nim-lang.org/#ix=3QkC
22:45:17PMunchThis as well: https://play.nim-lang.org/#ix=3QkE
22:45:43FromDiscord<Elegantbeef> Well yea cause you have no type information
22:45:50FromDiscord<Elegantbeef> remove `pure` it errors
22:46:20FromDiscord<Elegantbeef> And cause you have no type information you cannot get the types out
22:46:43FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3QkF
22:47:10PMunchAh of course
22:47:18PMunchHmm
22:47:30FromDiscord<ynfle> @PMunch https://play.nim-lang.org/#ix=3QkG
22:47:40FromDiscord<Elegantbeef> I think the only reason it exists is for reference objects
22:47:53FromDiscord<Elegantbeef> ynfle you're slow
22:47:59FromDiscord<ynfle> In reply to @Elegantbeef "ynfle you're slow": You're fat
22:48:04FromDiscord<Elegantbeef> Nah i'm not
22:48:16FromDiscord<ynfle> That's what your mom said
22:50:15PMunch@Elegantbeef, make them ref types though and it works: https://play.nim-lang.org/#ix=3QkH
22:50:27FromDiscord<Elegantbeef> For value type inheritance i think it can be done 100% statically, just need a macro for `x.isChildOf(MyValueType)`
22:50:35FromDiscord<Elegantbeef> Of course it works
22:50:49PMunchThe little snippet in Tutorial II says this "Ref objects should be used whenever inheritance is used."
22:50:51FromDiscord<Elegantbeef> They're now homogeneous size
22:51:02PMunchYeah I know
22:51:22FromDiscord<Elegantbeef> my point was the type information is 100% for reference inheritance
22:51:37FromDiscord<Elegantbeef> If you have value inheritance you can do it all statically without it
22:52:47FromDiscord<Elegantbeef> I guess someone needs to add that `isChildOf` macro to oopsie 😛
22:54:30FromDiscord<retkid> with python stuff
22:54:49FromDiscord<retkid> can nimpy do async?
22:55:28FromDiscord<retkid> i have an async function which i need to call
22:57:31NimEventerNew thread by Cnerd: Catch exceptions without crashing app, see https://forum.nim-lang.org/t/8938
23:15:02FromDiscord<retkid> hey how do import a local module with nimpy
23:15:05FromDiscord<retkid> i cant quite figure it out
23:15:23FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
23:15:25FromDiscord<retkid> (edit)
23:15:42FromDiscord<retkid> it only works with modules which are installed with pypy?
23:25:43FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/945461310777335819/unknown.png
23:31:14PMunchIf anyone is interested in Ratel and wants to give me some feedback for the build tool feature: https://github.com/PMunch/ratel/issues/10
23:36:01FromDiscord<qb> Playing and checking out `parallel`. What exactly is the reason that line 25/26 don't work and 28 does? I actually wan't to do something like `result.add(spawn bleh(i))`. https://play.nim-lang.org/#ix=3QkS
23:37:35FromDiscord<$$$> how can i convert a key of json into a string
23:37:43FromDiscord<$$$> JsonNode to string i mean
23:38:31FromDiscord<retkid> I guess somethings wrong with my distro or something thanks for the help guys ¯\_(ツ)_/¯
23:38:58PMunch$$$, have you tried $?
23:43:11*xet7 quit (Ping timeout: 256 seconds)
23:44:42FromDiscord<$$$> In reply to @PMunch "$$$, have you tried": thanks!
23:45:12PMunchIn general if you want to turn something in Nim into a string, $ is the answer
23:46:53FromDiscord<retkid> to get around this nimpy thing I've system linked my python modules
23:47:07FromDiscord<retkid> Ive not seen anyone else do this for any reason but I guess thats just what the solution is
23:47:30FromDiscord<retkid> so much for portable installs
23:49:29FromDiscord<$$$> what is the nim equivelant of doing [i:] (or in my case [5:]) in python
23:50:31FromDiscord<retkid> [5:0]
23:50:37FromDiscord<retkid> try it out
23:50:43FromDiscord<retkid> its not exact but you'll get it
23:50:59FromDiscord<$$$> In reply to @retkid "its not exact but": wdym
23:51:16FromDiscord<retkid> its like 1 character off or something, dont remember
23:53:43FromDiscord<qb> Guess you're looking for `[5..^1]`
23:58:06*xet7 joined #nim