00:00:19 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:43 | * | tk joined #nim |
00:01:24 | FromDiscord | <demotomohiro> Is that means you want to do that without standard library? |
00:02:30 | FromDiscord | <Elegantbeef> No clue what that means |
00:03:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QeL |
00:03:21 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3QeM |
00:03:39 | FromDiscord | <Elegantbeef> Mines cooler |
00:03:44 | FromDiscord | <Recruit_main707> true :( |
00:13:06 | FromDiscord | <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:00 | FromDiscord | <Rika> In reply to @Elegantbeef "Mines cooler": Yours is automatically awful for using short variable names smh |
00:23:52 | FromDiscord | <Elegantbeef> True |
00:23:55 | FromDiscord | <Elegantbeef> Sorry, "true \:(" |
00:25:56 | FromDiscord | <dom96> using `,` instead of `;` wins all contests in my book |
00:27:29 | FromDiscord | <Rika> ? Why |
00:28:04 | FromDiscord | <Elegantbeef> Weird contest breaking, given `;` is technically safer |
00:28:15 | FromDiscord | <Elegantbeef> I just cant get my fingers to type it naturally |
00:33:20 | FromDiscord | <dom96> In reply to @Rika "? Why": No objective reason, I just dislike it in parameter lists |
00:33:51 | FromDiscord | <dom96> mainly because it only makes sense to be used for special cases |
00:34:46 | FromDiscord | <dom96> so using it for all parameter lists is just meh |
01:06:24 | NimEventer | New 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:53 | FromDiscord | <Forest> sent a code paste, see https://paste.rs/cwD |
01:23:17 | FromDiscord | <Elegantbeef> manually convert to cstring |
01:23:27 | FromDiscord | <Elegantbeef> `cstring myExpression` |
01:24:20 | FromDiscord | <Forest> But I'm passing it to JS |
01:24:30 | FromDiscord | <Elegantbeef> cstring is "compatible string" |
01:24:36 | FromDiscord | <Elegantbeef> You can ignore it on JS afaik |
01:25:01 | FromDiscord | <Forest> So the warning doesn't affect JS then? |
01:25:07 | FromDiscord | <Forest> And won't in the future? |
01:25:29 | FromDiscord | <Elegantbeef> Like i said you can just convert it manually and the warning goes way |
01:25:51 | FromDiscord | <Elegantbeef> so you probably should convert it anyway |
01:26:07 | FromDiscord | <Elegantbeef> The implicit conversion is a possible unsafe operation which is why that warning exists |
01:26:17 | FromDiscord | <Elegantbeef> possible unsafe operation on C/C++\ |
01:26:26 | FromDiscord | <Forest> But how would i pass it to JS then without using `importjs`? |
01:26:38 | FromDiscord | <Elegantbeef> `cstring` |
01:26:42 | FromDiscord | <Forest> Since i have to use JS's `new` |
01:26:49 | FromDiscord | <Forest> In reply to @Elegantbeef "`cstring`": I don't understand |
01:26:56 | FromDiscord | <Elegantbeef> just do `cstring(expression)` |
01:27:05 | FromDiscord | <Elegantbeef> where expression is the template or macro you're using |
01:27:49 | FromDiscord | <Forest> `proc newFile(parent: JsObject, child: cstring) {.importjs: "new File(@)".}` |
01:28:10 | FromDiscord | <Elegantbeef> now where do you call that |
01:28:19 | FromDiscord | <Forest> Wait |
01:28:25 | FromDiscord | <Forest> Ohhhhh i understand what you mean now |
01:28:29 | FromDiscord | <Forest> My brain is dumb |
01:29:45 | FromDiscord | <Forest> Thanks! |
02:15:30 | * | arkurious quit (Quit: Leaving) |
02:35:16 | NimEventer | New Nimble package! dogapi_cli - Tool to download dogs images, see https://github.com/thexxiv/dogapi-cli |
02:36:33 | FromDiscord | <Elegantbeef> an 110 line function with no comments, scary |
02:38:35 | FromDiscord | <deech> What is the difference between a HSlice & a tuple? |
02:39:44 | FromDiscord | <Elegantbeef> Hslice is an easier type to abstract over imo |
02:40:00 | FromDiscord | <Elegantbeef> It's also distinct |
02:40:13 | FromDiscord | <Elegantbeef> Not all `(int, int)`s are valid slices |
02:42:07 | FromDiscord | <Elegantbeef> Atleast i interpreted it as "Why not use a tuple for slices instead" |
02:42:50 | FromDiscord | <deech> Yes that's what I meant. |
02:43:42 | FromDiscord | <huantian> In reply to @Elegantbeef "an 110 line function": that's a lot of indentation |
02:44:39 | FromDiscord | <Elegantbeef> i'm a bit biased cause i find tuples only useful for return types/unpacking |
02:44:47 | FromDiscord | <Elegantbeef> Pretty everywhere else i much prefer static typing |
02:46:03 | FromDiscord | <Elegantbeef> `type HSlice[X, Y] = tuple[a: X, b: Y]` is not so weakly typed 😛 |
02:46:10 | FromDiscord | <Elegantbeef> i guess i should say strong typing |
02:48:29 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> `[a..b]` |
02:49:51 | FromDiscord | <Elegantbeef> It's a strongly typed heterogeneous pair of values, it's useful whenever you need a runtime range |
02:50:11 | FromDiscord | <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:49 | FromDiscord | <Elegantbeef> You can do `someFloat in 0d..30d` or similar for your types that implement the operators needed |
02:54:58 | FromDiscord | <Elegantbeef> "In this episode of beefs ramblings cause someone to lose conversational interest" 😛 |
02:59:35 | FromDiscord | <deech> Haven't lost interest just looking over the codebase for uses of HSlice where the types aren't Ordinal. |
03:00:28 | FromDiscord | <Elegantbeef> Distincts would be one place |
03:00:57 | FromDiscord | <Elegantbeef> I guess that is ordinal 😀 |
03:01:31 | FromDiscord | <Elegantbeef> User defined numeric types that are not Ordinal based would be something |
03:01:39 | FromDiscord | <Elegantbeef> 128bit integers/floats for instance |
03:02:42 | FromDiscord | <deech> Why are they not ordinal? |
03:03:33 | FromDiscord | <Elegantbeef> Cause ordinal is a hard coded typeclasss |
03:06:19 | FromDiscord | <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:56 | FromDiscord | <deech> (edit) "Ordinal," => "Ordinal for useful indexing functions," |
03:07:15 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/945154673923481690/image.png |
03:07:16 | FromDiscord | <Elegantbeef> It's not |
03:07:40 | FromDiscord | <Elegantbeef> !eval let a = "hello".."world" |
03:07:42 | NimBot | <no output> |
03:08:38 | FromDiscord | <deech> What could I do with HSlice[string,string]? |
03:10:07 | * | jmdaemon quit (Ping timeout: 256 seconds) |
03:11:54 | FromDiscord | <Elegantbeef> I mean what ever you want 😛 |
03:12:44 | FromDiscord | <deech> I guess ... 🙂 |
03:14:10 | * | jmdaemon joined #nim |
03:14:13 | FromDiscord | <deech> Unless I'm missing something there's not much I can do except access `a` and `b`. Even `len` requires Ordinals. |
03:14:54 | FromDiscord | <Elegantbeef> That's up to a user implementation you could in theory make `a..b` for string disallow anything outside of that |
03:15:31 | FromDiscord | <Rika> Length could mean anything for non ordinals and it’s up to the implementer what it would mean |
03:17:14 | FromDiscord | <kiell> whats the difference between object and rootobj? |
03:17:15 | FromDiscord | <deech> Yep, so I guess I'd need to redefine all those. I guess custom ranges could be useful. |
03:17:33 | FromDiscord | <deech> In any case, going to bed. Thanks! |
03:17:34 | FromDiscord | <Elegantbeef> Root object is the root for inheritance↵(@kiell) |
03:19:03 | FromDiscord | <kiell> so if i dont plan to use an object for inheritance then rootobj isnt required? |
03:19:34 | FromDiscord | <Elegantbeef> Yep |
03:19:38 | FromDiscord | <kiell> im just confused why ppl do `type obj = ref object` vs `type obj = ref object of RootObj` |
03:19:41 | FromDiscord | <kiell> ok |
03:22:33 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> They want inheritance kiell or dont know what they're doing |
03:25:09 | FromDiscord | <Elegantbeef> Well you could do the negative ranges using `static HSlice` |
04:05:55 | FromDiscord | <Hamid_Bluri> !eval typeof "hello".."world" |
04:05:56 | NimBot | Compile 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:11 | FromDiscord | <Hamid_Bluri> !eval echo typeof "hello".."world" |
04:06:12 | NimBot | Compile failed: /playground/nim/lib/system/iterators_1.nim(98, 10) Error: type mismatch: got <string> |
04:06:22 | FromDiscord | <Hamid_Bluri> 😕 |
04:06:22 | FromDiscord | <Elegantbeef> You'll get it eventually |
04:06:32 | * | supakeen joined #nim |
04:06:35 | FromDiscord | <Hamid_Bluri> hey beef, good mornin |
04:06:45 | FromDiscord | <Elegantbeef> the command syntax doesnt play well there |
04:06:49 | FromDiscord | <Elegantbeef> It's not morning you liar! |
04:06:58 | FromDiscord | <Hamid_Bluri> it's 7:38 AM here |
04:07:21 | FromDiscord | <Elegantbeef> I figured it was morning for you, but i have to pretend to be angry |
04:07:41 | nrds | <Prestige99> It's almost morning |
04:12:25 | FromDiscord | <Elegantbeef> It's 9pm |
04:13:23 | FromDiscord | <huantian> no way it's 9pm for me |
04:16:16 | FromDiscord | <Elegantbeef> It's not 9pm for you, shame |
04:16:25 | FromDiscord | <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:30 | FromDiscord | <Arathanis> is there a reason that:↵one works but the other does not? https://media.discordapp.net/attachments/371759389889003532/945183678013800539/unknown.png |
05:02:49 | FromDiscord | <Elegantbeef> Nim's sub range type doesnt work with `..<` |
05:02:58 | FromDiscord | <Arathanis> ah |
05:07:28 | FromDiscord | <tosh [uniware]> In reply to @Elegantbeef "It's 9pm": ru a bot |
05:08:36 | FromDiscord | <Elegantbeef> No |
05:08:43 | FromDiscord | <Elegantbeef> I sure hope not |
05:08:54 | FromDiscord | <Arathanis> thats just what a bot would say 🤔 |
05:09:09 | FromDiscord | <Elegantbeef> Nah microsofts bots yell racist remarks |
05:32:43 | FromDiscord | <tosh [uniware]> In reply to @Elegantbeef "Nah microsofts bots yell": how u got the bot tag |
05:36:10 | FromDiscord | <Elegantbeef> I'm on matrix using the bridge to talk to discord |
05:39:29 | FromDiscord | <tosh [uniware]> whats matrix |
05:39:57 | FromDiscord | <Elegantbeef> A chat protocol |
05:40:11 | FromDiscord | <tosh [uniware]> do u know how to get a list of current processes in nim |
05:41:30 | FromDiscord | <Elegantbeef> Probably need to use system calls |
05:42:41 | FromDiscord | <leorize> depends on the operating system |
05:42:45 | FromDiscord | <tosh [uniware]> In reply to @leorize "depends on the operating": windows |
05:44:35 | FromDiscord | <leorize> Looks like this is what you need\: https://docs.microsoft.com/en-us/windows/win32/psapi/process-status-helper |
05:44:43 | FromDiscord | <leorize> winim should provide wrappers for the API used here |
05:46:44 | FromDiscord | <tosh [uniware]> thanks!! 🙂 |
05:49:53 | * | krux02 quit (Remote host closed the connection) |
06:03:28 | * | ltriant quit (Ping timeout: 256 seconds) |
06:11:30 | NimEventer | New 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:34 | NimEventer | New Nimble package! cloudbet - Cloudbet Virtual Crypto Casino API Client, see https://github.com/juancarlospaco/cloudbet |
07:16:59 | FromDiscord | <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:17 | FromDiscord | <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:43 | FromDiscord | <tosh [uniware]> In reply to @haolian9 (高浩亮) "hi, i happened to": random question, why do u guys use matrix ? |
07:23:01 | FromDiscord | <Elegantbeef> I prefer open software |
07:23:40 | FromDiscord | <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:02 | FromDiscord | <Elegantbeef> You'd follow https://docs.microsoft.com/en-us/windows/win32/psapi/enumerating-all-processes |
07:24:02 | FromDiscord | <tosh [uniware]> i tried using it but i just couldnt figure it out |
07:24:21 | FromDiscord | <haolian9 (高浩亮)> wrong person, i did not ...↵(@tosh [uniware]) |
07:24:35 | FromDiscord | <Elegantbeef> Gitter is matrix based |
07:24:38 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> ok what do you have? |
07:27:12 | FromDiscord | <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:50 | FromDiscord | <tosh [uniware]> first line |
07:28:52 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfR |
07:28:52 | FromDiscord | <tosh [uniware]> idk if its right |
07:29:02 | FromDiscord | <Elegantbeef> Nope |
07:29:11 | FromDiscord | <tosh [uniware]> dam what did i do wrong |
07:29:41 | FromDiscord | <tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945220718981971988/unknown.png |
07:29:43 | FromDiscord | <tosh [uniware]> this line btw |
07:29:53 | FromDiscord | <ShalokShalom> whats the difference between exec and execCmd |
07:30:03 | FromDiscord | <ShalokShalom> other than that execCmd doesnt work in NimScript |
07:31:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QfS |
07:32:14 | FromDiscord | <Elegantbeef> Whoops ` aProcess: array[1024, DWord]` |
07:32:42 | FromDiscord | <Elegantbeef> one of them returns the exit code the other the stdout |
07:32:49 | FromDiscord | <tosh [uniware]> can u explain what this kinda does cuz im lowk confused |
07:33:03 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "one of them returns": do you mean me? |
07:33:22 | FromDiscord | <Elegantbeef> we declare `aProccess` of an array with a size of `1024` and elements of `Dword` |
07:33:43 | FromDiscord | <Elegantbeef> We then declare `cbNeeded` and `cProcesses` as DWord and `i` as uint 😛 |
07:34:22 | NimEventer | New 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:22 | FromDiscord | <tosh [uniware]> is `aProcess` supposed to be `aProcesses` 🤔 |
07:34:49 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> Yea it should be |
07:36:25 | FromDiscord | <tosh [uniware]> where u learn this |
07:36:48 | FromDiscord | <Elegantbeef> I'm self taught so here and there |
07:37:01 | FromDiscord | <tosh [uniware]> like what resources tho |
07:37:07 | FromDiscord | <Elegantbeef> I've learned a lot of C interop and low level programming due to using Nim |
07:37:18 | FromDiscord | <Elegantbeef> I really dont have any resources for this |
07:37:39 | FromDiscord | <tosh [uniware]> imma try to do the "PrintProcessNameAndID" function and u tell me if im right |
07:41:11 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfT |
07:44:25 | FromDiscord | <Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/winim/inc/psapi.nim#L175 here is the procedure that uses that |
07:44:38 | FromDiscord | <Elegantbeef> The important part is going to be the `LPWSTR` so now we get to figure out how that works |
07:47:07 | FromDiscord | <Elegantbeef> The issue is less Nim syntax imo, and more lack of procedure definitions |
07:47:47 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> Cause i'm trying to find the answers but fuck is it tedious |
07:47:56 | FromDiscord | <tosh [uniware]> fr |
07:48:17 | FromDiscord | <Elegantbeef> Looks like `var szProcessName = T"<unknown>"` might do it |
07:48:52 | FromDiscord | <tosh [uniware]> it didnt error and thats farther than i got so imma assume it works 🙏 |
07:49:10 | FromDiscord | <Elegantbeef> It might error later when it attempts to load names longer than `<unknown>` |
07:50:38 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfU |
07:50:57 | FromDiscord | <Elegantbeef> look at the definition inside winim |
07:51:03 | FromDiscord | <tosh [uniware]> wym |
07:51:15 | FromDiscord | <Elegantbeef> https://github.com/khchen/winim/blob/b7b32603f4ef672bc34405bc6200e8aab2c366b1/winim/inc/winbase.nim#L1962 |
07:52:39 | * | jjido joined #nim |
07:53:38 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfW |
07:53:55 | FromDiscord | <Elegantbeef> `PROCESS_QUERY_INFORMATION | PROCESS_VM_READ` will be `PROCESS_QUERY_INFORMATION or PROCESS_VM_READ` in nim i assume |
07:54:04 | FromDiscord | <Elegantbeef> bitwise or in Nim is `or` |
07:56:54 | FromDiscord | <tosh [uniware]> how we looking so far |
07:56:56 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfY |
07:57:11 | FromDiscord | <Elegantbeef> Aside from formatting seems fine |
07:57:45 | FromDiscord | <tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945227779270664222/unknown.png |
07:57:58 | FromDiscord | <tosh [uniware]> i tried to find it in winim with ctrl f and i couldnt |
07:57:59 | FromDiscord | <tosh [uniware]> 🤔 |
07:58:20 | FromDiscord | <Elegantbeef> It's in psapi.nim |
07:58:53 | FromDiscord | <Elegantbeef> https://github.com/khchen/winim/blob/master/winim/inc/psapi.nim#L132 |
08:00:11 | FromDiscord | <tosh [uniware]> thoughts |
08:00:15 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3QfZ |
08:00:35 | FromDiscord | <tosh [uniware]> idek what im doing python just go to slow so i like just now download nim 😭 |
08:00:36 | FromDiscord | <Elegantbeef> I hate the `( value )` 😛 |
08:00:45 | FromDiscord | <tosh [uniware]> In reply to @Elegantbeef "I hate the `(": naw the spaces look cleaner 😤 |
08:00:50 | FromDiscord | <Elegantbeef> If it works it works |
08:00:56 | FromDiscord | <tosh [uniware]> https://media.discordapp.net/attachments/371759389889003532/945228583352295424/unknown.png |
08:01:00 | FromDiscord | <tosh [uniware]> what is _tprintf |
08:01:05 | * | neurocyte0917090 joined #nim |
08:01:14 | FromDiscord | <Elegantbeef> a unicode aware print |
08:01:16 | FromDiscord | <Elegantbeef> I assume |
08:01:32 | FromDiscord | <tosh [uniware]> fuck it just registered sumthing was wrong https://media.discordapp.net/attachments/371759389889003532/945228735169327104/unknown.png |
08:01:33 | FromDiscord | <tosh [uniware]> LMAO |
08:01:56 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg3 |
08:03:37 | FromDiscord | <Elegantbeef> Dont know what to say, did you `import winim`? |
08:04:57 | FromDiscord | <tosh [uniware]> i fixed that, i had imported `winim/lean` |
08:05:06 | FromDiscord | <tosh [uniware]> new error! |
08:05:17 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg6 |
08:05:45 | FromDiscord | <Elegantbeef> `DWord sizeof(hMod)`? |
08:06:01 | FromDiscord | <tosh [uniware]> hm? |
08:06:42 | FromDiscord | <Elegantbeef> Convert the int into a DWord |
08:06:58 | FromDiscord | <tosh [uniware]> how |
08:07:15 | FromDiscord | <Elegantbeef> `Dword sizeof(hMod)` |
08:07:26 | FromDiscord | <Elegantbeef> Or `DWord(sizeof(hMod))` |
08:07:34 | FromDiscord | <tosh [uniware]> ok fixed that, now line 13 |
08:07:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:07:59 | FromDiscord | <Elegantbeef> Read the compiler error very very well |
08:08:00 | FromDiscord | <Elegantbeef> Pleas |
08:08:51 | FromDiscord | <tosh [uniware]> i fixed it omg |
08:09:04 | FromDiscord | <tosh [uniware]> !! |
08:09:29 | FromDiscord | <tosh [uniware]> now to do the main function |
08:09:32 | FromDiscord | <tosh [uniware]> ☹️ |
08:10:20 | FromDiscord | <Elegantbeef> you might be able to print with `import std/strformat` and `echo fmt"{szProcessName} (PID:{processId})` |
08:10:24 | FromDiscord | <Elegantbeef> I already gave you the main |
08:12:16 | FromDiscord | <tosh [uniware]> ? |
08:12:20 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qg7 |
08:12:26 | FromDiscord | <Elegantbeef> Yes they're the same |
08:12:29 | FromDiscord | <tosh [uniware]> they looked mad different i didnt even know |
08:12:31 | FromDiscord | <tosh [uniware]> 😭 |
08:12:43 | FromDiscord | <Elegantbeef> Yea one is much cleaner |
08:12:55 | FromDiscord | <tosh [uniware]> do u think nim is as good as C or CPP |
08:12:57 | FromDiscord | <tosh [uniware]> 🤔 |
08:13:07 | FromDiscord | <Elegantbeef> It's better |
08:13:13 | FromDiscord | <Elegantbeef> It doesnt make me question my sanity |
08:15:29 | FromDiscord | <tosh [uniware]> "` Error: type mismatch: got 'int' for 'cbNeeded div 4' but expected 'DWORD = int32'`" |
08:15:42 | FromDiscord | <Elegantbeef> same as before |
08:15:46 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qga |
08:16:16 | FromDiscord | <tosh [uniware]> fixed |
08:16:22 | FromDiscord | <tosh [uniware]> now test |
08:17:13 | * | gsalazar joined #nim |
08:17:43 | FromDiscord | <tosh [uniware]> idek what could have caused this, all of the process names are now "<unknown>" |
08:17:51 | FromDiscord | <tosh [uniware]> ex: `"<unknown> (PID:15772)"` |
08:19:14 | * | Gustavo6046 quit (Quit: Leaving) |
08:20:02 | FromDiscord | <Elegantbeef> I dont know what to say |
08:20:12 | FromDiscord | <Elegantbeef> It's something with the process name of course, but no clue |
08:21:44 | FromDiscord | <tosh [uniware]> this language so painful |
08:21:45 | FromDiscord | <tosh [uniware]> 😭 |
08:21:57 | FromDiscord | <Elegantbeef> It's not Nim |
08:22:04 | FromDiscord | <Elegantbeef> It's winim |
08:22:53 | FromDiscord | <tosh [uniware]> from python to low level stuff is quite a jump |
08:27:22 | FromDiscord | <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:17 | FromDiscord | <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:16 | FromDiscord | <Waldecir Santos> Is it possible to have `"named"` varargs I want to mimic python `kwargs`. |
09:55:15 | FromDiscord | <Elegantbeef> what's kwargs do again? |
09:55:43 | FromDiscord | <Waldecir Santos> kwargs is a dict inside the "proc" |
09:55:54 | FromDiscord | <Elegantbeef> Ah then like i said last time use `tuple` |
09:56:59 | FromDiscord | <Waldecir Santos> Hmm let me check. |
09:57:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qgx |
09:58:11 | FromDiscord | <Elegantbeef> You can write a macro to do the introspection better, or use a concept |
09:59:28 | FromDiscord | <Elegantbeef> For the concept variant |
09:59:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/JpN |
09:59:50 | FromDiscord | <Waldecir Santos> Yeah I'm trying to avoid the double `((` this looks terrible. |
10:00:18 | FromDiscord | <Waldecir Santos> Wow this is the first time I see `concept` awesome |
10:00:49 | FromDiscord | <Elegantbeef> I dont get the point of kwargs |
10:01:09 | FromDiscord | <Elegantbeef> Just take an optional and or defaults |
10:01:20 | FromDiscord | <Waldecir Santos> I need to do some magic to convert it to SQL queries |
10:01:52 | FromDiscord | <Waldecir Santos> Like django thoes, e.g: `Entry.objects.filter(pub_dateyear=2006)` |
10:02:17 | FromDiscord | <Waldecir Santos> or `Entry.objects.filter(headlinestartswith="What")` |
10:02:32 | FromDiscord | <Elegantbeef> Sure you dont need kwargs just make `filter` a macro |
10:02:50 | FromDiscord | <Rika> You can get nicer syntax with a macro, even |
10:03:18 | FromDiscord | <Waldecir Santos> Sure but this will not work at runtime right ? |
10:03:58 | FromDiscord | <Elegantbeef> What do you mean? |
10:04:26 | FromDiscord | <Rika> You need your “kwargs” to be runtime modifiable! |
10:04:28 | FromDiscord | <Rika> ? |
10:04:45 | FromDiscord | <Waldecir Santos> I mean these args can be defined at run time, they cannot be determined at compile time |
10:04:50 | FromDiscord | <Waldecir Santos> Yes @Rika |
10:05:04 | FromDiscord | <Rika> Runtime defined ain’t runtime modified |
10:05:16 | FromDiscord | <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:06 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> If i understood what was desired i'd say what to do but i'm just lost |
10:06:14 | FromDiscord | <Rika> But a macro should suffice |
10:07:17 | FromDiscord | <Elegantbeef> No waldecir dont talk about django, that doesnt help |
10:08:12 | FromDiscord | <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:52 | FromDiscord | <Elegantbeef> so a `Table[string, string]` 😀 |
10:09:12 | FromDiscord | <Waldecir Santos> Tuple is perfect, but I have the `((` `))` and this looks aweful |
10:09:46 | FromDiscord | <Elegantbeef> You could always make a macro for the call then convert it into a tuple and call the proper thing |
10:10:10 | FromDiscord | <Waldecir Santos> Yeah I'll play with it, you both helped a lot. |
10:10:14 | FromDiscord | <Waldecir Santos> Thank you |
10:10:53 | FromDiscord | <Elegantbeef> I've never dealt with this stuff so you asking these questions just makes me question my sanity |
10:11:20 | FromDiscord | <Elegantbeef> "I dont understand why anyone in their right mind wants to dynamically make stuff" |
10:11:58 | FromDiscord | <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:52 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> It's 100% possible |
10:13:19 | FromDiscord | <Elegantbeef> You just have to know what you need explicitly 😛 |
10:13:47 | FromDiscord | <Waldecir Santos> Right, that is my problem right now, too much unknowns from my side |
10:15:15 | vilhelmbergsoe | Hi 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:35 | FromDiscord | <Elegantbeef> It's used all over the plcae |
10:15:37 | FromDiscord | <Elegantbeef> place\ |
10:15:53 | FromDiscord | <Elegantbeef> It can be used for everything without much hassle imo |
10:16:01 | FromDiscord | <Rika> I would say it leans heavier to system than networking. |
10:16:29 | FromDiscord | <Rika> But it is applicable in a lot of areas, just needs work |
10:17:16 | FromDiscord | <Elegantbeef> Yea there are some issue with concurrency and parallelism presently i think, but weave/taskpools help there |
10:21:43 | vilhelmbergsoe | Alright nice! and thanks :) |
10:22:08 | vilhelmbergsoe | I'll take a look at the concurrency model |
10:24:02 | FromDiscord | <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:06 | vilhelmbergsoe | Elegantbeef: Haha yeah, i'm watching it now :) |
10:33:35 | * | ltriant quit (Ping timeout: 252 seconds) |
10:35:49 | FromDiscord | <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:35 | FromDiscord | <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:14 | FromDiscord | <ITR> or maybe I was looking for constraint stuff. I haven't slept in a while |
11:26:16 | FromDiscord | <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:01 | FromDiscord | <Waldecir Santos> @Rika @ElegantBeef your suggestion for doing something like this, right? |
11:43:54 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3QgR |
11:45:21 | FromDiscord | <Rika> no |
11:45:29 | FromDiscord | <Rika> the macro is doThing |
11:46:12 | FromDiscord | <Waldecir Santos> Hmm but I'll have the same varargs problem, no ? |
11:46:27 | FromDiscord | <Waldecir Santos> Let me try this, macro is really new to me. |
11:48:31 | FromDiscord | <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:41 | FromDiscord | <ShalokShalom> I know, that ECS had to be implemented specifically to Godot. |
11:56:05 | FromDiscord | <ShalokShalom> Respectively, into GDScript, if I remember correctly now. |
11:56:13 | FromDiscord | <Waldecir Santos> @Rika yeah I don't know how to get the `(...)` part inside the macro |
11:56:14 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/945287798339039232/unknown.png |
11:56:20 | FromDiscord | <Waldecir Santos> This is what I'm receiving |
11:57:05 | FromDiscord | <Waldecir Santos> This is what I mean by having the same varargs problem |
11:57:20 | FromDiscord | <ShalokShalom> https://github.com/GodotECS/godex#godex |
11:57:36 | FromDiscord | <ShalokShalom> So, that means I can use Pararules just like that in Godot? |
11:57:46 | FromDiscord | <ShalokShalom> Has anybody tried that? |
11:58:09 | FromDiscord | <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:06 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3Qh1 |
12:12:36 | FromDiscord | <ynfle> To be honest, i'd just use table constructor syntax and then convert to table internally |
12:13:14 | NimEventer | New 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:34 | Shadow0133 | How would i go about crosscompiling to raspberry pi 1 b+ (arm6l, if i'm not mistaken)? Either program or compiler |
12:47:27 | FromDiscord | <Waldecir Santos> In reply to @ynfle "These are 2 separate": Oh I see thank you |
12:57:49 | * | jjido joined #nim |
13:07:53 | FromDiscord | <ynfle> In reply to @Shadow0133 "How would i go": From which platform? |
13:08:29 | Shadow0133 | debian, x86_64 |
13:32:02 | Amun-Ra | Shadow0133: for example https://www.kitware.com/cross-compiling-for-raspberry-pi/ |
13:38:43 | * | slowButPresent joined #nim |
13:39:55 | FromDiscord | <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:46 | FromDiscord | <lpha3ch0> (edit) "bring" => "make" | "joy." => "happy." |
13:41:19 | FromDiscord | <lpha3ch0> (edit) "simplest of" => "simple" |
13:43:11 | * | krux02 joined #nim |
13:46:56 | * | PMunch joined #nim |
13:49:38 | FromDiscord | <auxym> neat, consider publishing it on nimble.directory |
13:51:32 | PMunch | lpha3ch0, that is pretty neat. I guess it could become part of termstyle :) |
13:53:15 | FromDiscord | <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:08 | PMunch | I'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:56 | FromDiscord | <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:25 | PMunch | Thanks for the kind words, glad you enjoy my work :) |
14:29:57 | FromDiscord | <lpha3ch0> Unfortunately, while this looks great in the Linux terminal, the symbols are ugly in the Windows terminal. |
14:31:25 | FromDiscord | <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:10 | PMunch | Yeah the Windows terminal isn't great.. |
14:35:18 | PMunch | Powershell is apparently a bit better though |
14:35:58 | PMunch | But termstyle is really only meant for terminals which are compatible with ANSI colours, so the windows terminal is already out I believe |
14:36:56 | FromDiscord | <Rika> are we talking about the new windows terminal or the old command prompt |
14:36:59 | FromDiscord | <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:17 | FromDiscord | <Schelz> Does anyone have a doc for how to link cpp file with nim code, some examples would be great too. |
14:39:20 | FromDiscord | <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:30 | FromDiscord | <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:43 | PMunch | Haha sounds familiar @lpha3ch0 :P |
14:53:58 | PMunch | The "going right back to Nim" part, not the "not a developer part" |
14:54:19 | PMunch | @Schelz, not quite sure what you mean |
14:55:59 | PMunch | You 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:45 | PMunch | But 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:04 | NimEventer | New question by pooooky: How to disable warning in Nim, see https://stackoverflow.com/questions/71209055/how-to-disable-warning-in-nim |
15:40:32 | FromDiscord | <Deceptive> I remember there was Windows Server Dockerfile with Nim included can anyone link it to me? |
15:42:09 | FromDiscord | <Deceptive> https://github.com/sirredbeard/nim-windows-container |
15:42:11 | FromDiscord | <Deceptive> Found it |
16:03:44 | FromDiscord | <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:54 | FromDiscord | <QueenFuckingAdrielle> (edit) "serialize" => "deserialize" |
16:08:19 | FromDiscord | <huantian> You can check out flatty or frosty |
16:08:57 | FromDiscord | <huantian> Both are pretty neat serialization libs |
16:09:37 | FromDiscord | <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:52 | FromDiscord | <qb> Could I tell the compiler to just create the c file without building it? |
16:32:51 | PMunch | Yes |
16:33:05 | PMunch | You find the switch in `nim --fullhelp` |
16:33:14 | PMunch | Don't remember it off the top of my head and have to go now |
16:33:15 | * | PMunch quit (Quit: leaving) |
16:33:20 | FromDiscord | <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:32 | FromDiscord | <QueenFuckingAdrielle> (edit) "support" => "supporting" |
16:34:35 | FromDiscord | <qb> --compileOnly was it |
16:34:36 | FromDiscord | <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:10 | FromDiscord | <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:52 | FromDiscord | <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:24 | FromDiscord | <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:25 | FromDiscord | <jmgomez> In reply to @blans "are you using `{.dynlib.}`": yup, Im using it |
17:23:10 | FromDiscord | <Bloss> sorry .a files are static libraries not import files |
17:23:17 | FromDiscord | <Bloss> hmm then it might be using mingw |
17:24:22 | FromDiscord | <jmgomez> can the microsoft compiler be forced? |
17:24:47 | FromDiscord | <jmgomez> not sure if you can import something imported in clang with the microsoft compiler? |
17:24:56 | FromDiscord | <jmgomez> (edit) "imported" => "created" |
17:26:04 | FromDiscord | <Bloss> you should be able to with --cc:vcc |
17:26:28 | FromDiscord | <Bloss> in the worst case you can generate a .lib file from a dll |
17:26:51 | FromDiscord | <Bloss> https://stackoverflow.com/questions/9946322/how-to-generate-an-import-library-lib-file-from-a-dll |
17:28:40 | FromDiscord | <jmgomez> ohh cool, wasnt seeing the option. It does generate it now! |
17:37:13 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Qj7 |
17:38:13 | FromDiscord | <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:08 | FromDiscord | <atlx> hi |
17:51:34 | FromDiscord | <morgan> ping me if you respond to my question |
18:05:49 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Qjf |
18:08:33 | FromDiscord | <demotomohiro> Concepts are explained in experimental manual: https://nim-lang.org/docs/manual_experimental.html#concepts |
18:08:46 | FromDiscord | <demotomohiro> @atlx hi |
18:09:57 | FromDiscord | <Gibson> how should i use c function pointers from nim ffi? |
18:10:31 | FromDiscord | <Gibson> is just `proc x(a: proc()) {.exportc,dylnib.}` okay? |
18:10:39 | FromDiscord | <Gibson> (edit) "{.exportc,dylnib.}`" => "{.exportc,dynlib.}`" |
18:11:19 | FromDiscord | <treeform> I think you just need `proc() {.cdecl.}`? |
18:11:24 | * | ltriant joined #nim |
18:11:36 | FromDiscord | <Gibson> alright thanks |
18:12:01 | FromDiscord | <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:50 | FromDiscord | <treeform> You can see many function pointers to C lib here: https://github.com/treeform/staticglfw/blob/master/src/staticglfw.nim#L360 |
18:13:41 | FromDiscord | <Gibson> okay, should work then, thanks! |
18:13:53 | FromDiscord | <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:39 | FromDiscord | <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:00 | FromDiscord | <Gibson> yeah, just wanted to make sure i had the type right |
18:15:18 | FromDiscord | <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:14 | FromDiscord | <morgan> In reply to @demotomohiro "<@277133333773811712> Composition in that": ah ok, thanks |
18:41:24 | FromDiscord | <tosh [uniware]> how can i split the name of a directory off from its full path |
18:42:45 | FromDiscord | <tosh [uniware]> sent a code paste, see https://play.nim-lang.org/#ix=3Qjm |
18:48:31 | FromDiscord | <Forest> Will the template from https://github.com/juancarlospaco/nim-new-backend still work? |
18:51:45 | FromDiscord | <demotomohiro> @tosh [uniware] https://nim-lang.org/docs/os.html#splitFile%2Cstring |
18:52:03 | FromDiscord | <tosh [uniware]> ty! |
18:53:08 | FromDiscord | <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:27 | FromDiscord | <Phil> (edit) "while" => "given that" | "also" => "sometimes" | "sometimes" => "" |
18:54:13 | FromDiscord | <demotomohiro> I use neovim + some plugins. |
18:55:17 | FromDiscord | <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:13 | FromDiscord | <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:40 | FromDiscord | <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:17 | FromDiscord | <Phil> Hmm so essentially similar issues as vscode, suggestions work kind of, but not perfectly |
19:06:03 | FromDiscord | <demotomohiro> Im using old PC. If you have faster CPU, it might work smoothly. |
19:06:59 | FromDiscord | <Phil> I'm coding in my spare time on an 8 year old Lenovo T440, we might share similar issues 😄 |
19:07:09 | FromDiscord | <Phil> Though hopefully soon my replacement will arrive |
19:08:32 | FromDiscord | <Phil> I was mostly curious if there's a vastly better experience to be had in another editor with nim-intellisense |
19:08:33 | NimEventer | New 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:36 | FromDiscord | <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:48 | FromDiscord | <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:15 | FromDiscord | <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:14 | FromDiscord | <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:58 | FromDiscord | <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:39 | FromDiscord | <jos> how do you even write a source to source compiler |
19:51:53 | FromDiscord | <jos> like do u literally just emit strings |
19:52:13 | FromDiscord | <jos> in lieu of any place u would normally emit assembly or something |
19:52:57 | FromDiscord | <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:53 | FromDiscord | <leorize> nim compiler is the last place you wanna look at |
20:40:39 | FromDiscord | <leorize> and yeah you kinda emit string |
20:41:37 | FromDiscord | <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:03 | FromDiscord | <ynfle> In reply to @Isofruit "Curiosity question, anyone here": vim + nimlsp |
21:15:03 | FromDiscord | <theanxietybuster> I don’t nim much right now but I’ve been coding with ED and some wrappers shoved on top :ferrisSweat: |
21:15:53 | FromDiscord | <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:01 | FromDiscord | <theanxietybuster> But VS2019+ also now supports building with a Makefile, so it should theoretically work for nim on Windows |
21:16:53 | FromDiscord | <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:00 | FromDiscord | <Phil> Same for you @theanxietybuster |
21:18:09 | FromDiscord | <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:39 | FromDiscord | <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:13 | FromDiscord | <theanxietybuster> I kind of want to try and see how Nim support is on OniVim2 though |
21:20:03 | FromDiscord | <theanxietybuster> Think VSCode built without Electron but with a full Vim framework as the base |
21:20:14 | FromDiscord | <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:45 | FromDiscord | <tosh [uniware]> what compiler arguments should i use to optimize my nim code 🤔 |
21:33:32 | FromDiscord | <demotomohiro> -d:release or -d:danger |
21:34:00 | FromDiscord | <tosh [uniware]> and how do i turn off the console window 🤔 |
21:35:47 | FromDiscord | <demotomohiro> --app:gui |
21:36:07 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/nimc.html |
21:36:12 | FromDiscord | <tosh [uniware]> thanks |
21:37:32 | FromDiscord | <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:33 | FromDiscord | <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:32 | FromDiscord | <demotomohiro> How about to read the source code of `writeFile`? |
21:46:37 | * | PMunch joined #nim |
21:48:22 | FromDiscord | <demotomohiro> It looks like `fwrite` vs `fputs`. |
21:51:17 | FromDiscord | <ynfle> In reply to @demotomohiro "It looks like `fwrite`": Which is faster? |
21:55:11 | FromDiscord | <Goel> What is `fputs`? never read about that in the IO Module |
21:58:56 | FromDiscord | <ynfle> In reply to @Goel "What is `fputs`? never": It's a C things |
21:58:58 | FromDiscord | <ynfle> (edit) "things" => "thing" |
22:00:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Qkm |
22:00:16 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L855↵Here is implemetation of `writeFile`. |
22:01:15 | FromDiscord | <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:23 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> I mean doing IO is slow, so it hardly matters imo |
22:05:20 | PMunch | Hmm, 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:55 | PMunch | I 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:56 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3Qkn |
22:05:57 | FromDiscord | <Elegantbeef> Pmunch i think it's for inheritance, i could be wrong |
22:06:20 | FromDiscord | <Elegantbeef> Perhaps try in a release build if you havent |
22:06:39 | FromDiscord | <demotomohiro> If you use `writeFile` with string parameter to write random binary data can contain 0, it might not write whole data. |
22:06:42 | FromDiscord | <Elegantbeef> Debug may leave type info to give more useful debugging? |
22:07:14 | PMunch | Still no difference.. |
22:07:34 | FromDiscord | <Elegantbeef> Yea the way to write safely would be `fileName.write(myData.toOpenArrayByte(0, myData.len)` |
22:07:35 | PMunch | By the way, this is what I'm testing with: http://ix.io/3Qko |
22:07:38 | FromDiscord | <Elegantbeef> writeFile\ |
22:07:47 | FromDiscord | <Elegantbeef> Perhaps pure got brokededed |
22:09:15 | * | Vladar quit (Quit: Leaving) |
22:12:24 | FromDiscord | <jos> In reply to @leorize "but the best way": do you think haxe would be a reference? |
22:14:02 | PMunch | Aha, I see what it does now |
22:14:16 | PMunch | Wow, the docs on this feature is super vague and misleading! |
22:16:04 | FromDiscord | <ynfle> In reply to @PMunch "Aha, I see what": Enlighten us! |
22:16:24 | PMunch | Hold on, I'm compiling sources |
22:16:36 | PMunch | As in getting together links, not compiling source code.. |
22:17:08 | FromDiscord | <ynfle> Lol |
22:19:22 | nrds | <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:26 | nrds | <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:31 | nrds | <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:35 | nrds | <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:40 | nrds | <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:44 | nrds | <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:04 | PMunch | Prestige, is there anything we can do to remove these messages? |
22:22:22 | PMunch | Okay, 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:48 | nrds | <Prestige99> not really, people signing up new accounts with different IPs and spamming... |
22:23:20 | PMunch | It seems like they all use that #MFGA hashtag though, could we simply filter messages containing that out? |
22:23:25 | nrds | <Prestige99> Maybe can instantly start kicking people quoting rasengan |
22:24:20 | PMunch | Yeah I mean that message is quoted verbatim, so it shouldn't be hard to just throw in a simple filter.. |
22:24:27 | PMunch | Anyways, back to inheritable! |
22:24:56 | nrds | <Prestige99> Yeah |
22:25:01 | nrds | <Prestige99> asking some mods about it |
22:25:37 | PMunch | So 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:47 | PMunch | This means that it can be used for normal inheritance checking stuff like you would expect with e.g. RootObj |
22:30:40 | PMunch | Attaching the `{.pure.}` pragma along with an `{.inheritable.}` pragma means that the object no longer creates this field |
22:32:13 | PMunch | This 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:29 | FromDiscord | <Elegantbeef> It should be the same with `type MyType = object of RootObj` |
22:32:41 | FromDiscord | <Elegantbeef> Though i still dont see why these types need type information |
22:33:01 | PMunch | As 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:09 | PMunch | What do you mean? |
22:33:43 | PMunch | RootObj is {.inheritable.} but not {.pure.} |
22:33:51 | PMunch | So it has a type field in it |
22:33:57 | FromDiscord | <Elegantbeef> I dont see why value types using inheritance need type information |
22:34:40 | PMunch | To do things like `proc myProc(x: MyBaseType) = if x of MyInheritedType: echo "Hello world"` |
22:34:51 | FromDiscord | <Elegantbeef> that can be resolved statically |
22:34:52 | PMunch | If MyBaseType is {.inheritable.} that works fine |
22:35:01 | FromDiscord | <Elegantbeef> and it'd be `when x is MyInheritedType` |
22:35:29 | PMunch | But if it is {.pure, inheritable.} then it fails to compile with a message that you can't use `of` with pure types |
22:35:43 | FromDiscord | <Elegantbeef> Sure but you dont need `of` for value types |
22:35:55 | FromDiscord | <Elegantbeef> They can be statically dispatched |
22:36:08 | PMunch | `is` doesn't work though |
22:36:17 | FromDiscord | <Elegantbeef> It does too |
22:37:05 | PMunch | Nope: syntax error at or near "" |
22:37:08 | PMunch | Crap.. |
22:37:11 | PMunch | My paste messed up |
22:37:27 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Qky |
22:37:33 | PMunch | https://play.nim-lang.org/#ix=3Qkz |
22:37:46 | FromDiscord | <Elegantbeef> I dont know i guess it's useful for manual allocated collections |
22:38:33 | PMunch | As you can see your code only outputs "Heh" once for the type where you manually cast to MyBase |
22:38:53 | FromDiscord | <Elegantbeef> No it outputs it once for the time i dont convert it |
22:39:25 | FromDiscord | <Elegantbeef> A generic constraint that is an inherited object uses a composite type class to dispatch |
22:39:34 | FromDiscord | <Elegantbeef> So you get the proper type and dont need runtime checks |
22:39:51 | PMunch | Ah right |
22:40:15 | FromDiscord | <Elegantbeef> I just dont see where you can use this type information easily since they're not the same size |
22:40:23 | PMunch | But just using it as a type doesn't? |
22:40:36 | FromDiscord | <Elegantbeef> Nope it upcasts it to that type |
22:40:47 | FromDiscord | <Elegantbeef> which makes sense for when it's a `var T` |
22:41:35 | FromDiscord | <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:47 | PMunch | Dynamic dispatch? |
22:41:47 | FromDiscord | <Elegantbeef> Maybe methods? |
22:41:52 | PMunch | I mean that's probably why it's even there |
22:42:22 | FromDiscord | <Elegantbeef> But i mean it doesnt make much sense there either since methods dont make sense given you cannot store them heterogenously |
22:42:57 | PMunch | Hmm, I was able to create a method for a pure, inheritable object.. |
22:43:18 | FromDiscord | <Elegantbeef> If you attempt to make a `@[Base(), Child(), Child()` you get a runtime error |
22:43:29 | FromDiscord | <Elegantbeef> Which makes sense as there is a loss of information for that conversion |
22:43:35 | FromDiscord | <Elegantbeef> It's just a big "why" to me |
22:44:55 | PMunch | Hmm, this works though: https://play.nim-lang.org/#ix=3QkC |
22:45:17 | PMunch | This as well: https://play.nim-lang.org/#ix=3QkE |
22:45:43 | FromDiscord | <Elegantbeef> Well yea cause you have no type information |
22:45:50 | FromDiscord | <Elegantbeef> remove `pure` it errors |
22:46:20 | FromDiscord | <Elegantbeef> And cause you have no type information you cannot get the types out |
22:46:43 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3QkF |
22:47:10 | PMunch | Ah of course |
22:47:18 | PMunch | Hmm |
22:47:30 | FromDiscord | <ynfle> @PMunch https://play.nim-lang.org/#ix=3QkG |
22:47:40 | FromDiscord | <Elegantbeef> I think the only reason it exists is for reference objects |
22:47:53 | FromDiscord | <Elegantbeef> ynfle you're slow |
22:47:59 | FromDiscord | <ynfle> In reply to @Elegantbeef "ynfle you're slow": You're fat |
22:48:04 | FromDiscord | <Elegantbeef> Nah i'm not |
22:48:16 | FromDiscord | <ynfle> That's what your mom said |
22:50:15 | PMunch | @Elegantbeef, make them ref types though and it works: https://play.nim-lang.org/#ix=3QkH |
22:50:27 | FromDiscord | <Elegantbeef> For value type inheritance i think it can be done 100% statically, just need a macro for `x.isChildOf(MyValueType)` |
22:50:35 | FromDiscord | <Elegantbeef> Of course it works |
22:50:49 | PMunch | The little snippet in Tutorial II says this "Ref objects should be used whenever inheritance is used." |
22:50:51 | FromDiscord | <Elegantbeef> They're now homogeneous size |
22:51:02 | PMunch | Yeah I know |
22:51:22 | FromDiscord | <Elegantbeef> my point was the type information is 100% for reference inheritance |
22:51:37 | FromDiscord | <Elegantbeef> If you have value inheritance you can do it all statically without it |
22:52:47 | FromDiscord | <Elegantbeef> I guess someone needs to add that `isChildOf` macro to oopsie 😛 |
22:54:30 | FromDiscord | <retkid> with python stuff |
22:54:49 | FromDiscord | <retkid> can nimpy do async? |
22:55:28 | FromDiscord | <retkid> i have an async function which i need to call |
22:57:31 | NimEventer | New thread by Cnerd: Catch exceptions without crashing app, see https://forum.nim-lang.org/t/8938 |
23:15:02 | FromDiscord | <retkid> hey how do import a local module with nimpy |
23:15:05 | FromDiscord | <retkid> i cant quite figure it out |
23:15:23 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
23:15:25 | FromDiscord | <retkid> (edit) |
23:15:42 | FromDiscord | <retkid> it only works with modules which are installed with pypy? |
23:25:43 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/945461310777335819/unknown.png |
23:31:14 | PMunch | If 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:01 | FromDiscord | <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:35 | FromDiscord | <$$$> how can i convert a key of json into a string |
23:37:43 | FromDiscord | <$$$> JsonNode to string i mean |
23:38:31 | FromDiscord | <retkid> I guess somethings wrong with my distro or something thanks for the help guys ¯\_(ツ)_/¯ |
23:38:58 | PMunch | $$$, have you tried $? |
23:43:11 | * | xet7 quit (Ping timeout: 256 seconds) |
23:44:42 | FromDiscord | <$$$> In reply to @PMunch "$$$, have you tried": thanks! |
23:45:12 | PMunch | In general if you want to turn something in Nim into a string, $ is the answer |
23:46:53 | FromDiscord | <retkid> to get around this nimpy thing I've system linked my python modules |
23:47:07 | FromDiscord | <retkid> Ive not seen anyone else do this for any reason but I guess thats just what the solution is |
23:47:30 | FromDiscord | <retkid> so much for portable installs |
23:49:29 | FromDiscord | <$$$> what is the nim equivelant of doing [i:] (or in my case [5:]) in python |
23:50:31 | FromDiscord | <retkid> [5:0] |
23:50:37 | FromDiscord | <retkid> try it out |
23:50:43 | FromDiscord | <retkid> its not exact but you'll get it |
23:50:59 | FromDiscord | <$$$> In reply to @retkid "its not exact but": wdym |
23:51:16 | FromDiscord | <retkid> its like 1 character off or something, dont remember |
23:53:43 | FromDiscord | <qb> Guess you're looking for `[5..^1]` |
23:58:06 | * | xet7 joined #nim |