00:01:56 | FromDiscord | <Phil> If you can get my pseudocode snippets above to compile anywhere I'll be wildly impressed |
00:03:19 | FromDiscord | <dlesnoff> In reply to @ChocolettePalette "There's a bug in": does it not provide an exit code? It is probably the getCpuInfo proc. Do you have a /proc/cpuinfo file?↵I don't know who you are talking to. |
00:03:44 | * | wallabra quit (Ping timeout: 276 seconds) |
00:03:59 | FromDiscord | <Phil> I'm semi sure myself since Chocolette makes the odd joke here and there |
00:36:04 | * | neceve quit (Ping timeout: 272 seconds) |
00:36:41 | FromDiscord | <⎝⪩﹏⪨⎠> What's wrong with this code? https://media.discordapp.net/attachments/371759389889003532/1038612850240913489/image.png https://media.discordapp.net/attachments/371759389889003532/1038612850576474194/image.png |
00:38:11 | FromDiscord | <ranjeet singhi (young man)> One thing that isn't wrong is that beautiful theme you are using WHAT IS IT |
00:39:09 | FromDiscord | <AmjadHD> What's the difference between `type` and `typedesc` ? |
00:39:41 | FromDiscord | <⎝⪩﹏⪨⎠> In reply to @ranjeet singhi (young man) "One thing that isn't": Darktooth + ColdCode for the screenshots. |
00:42:03 | FromDiscord | <gibson> How can `$` for `float` be influenced to produce non-scientific notation? |
00:42:52 | FromDiscord | <Elegantbeef> Your return type is `string or T` |
00:42:53 | FromDiscord | <Elegantbeef> Nim doesnt allow that really |
00:42:53 | FromDiscord | <Elegantbeef> It's one or the other not both |
00:43:47 | FromDiscord | <Elegantbeef> `strutils.formatFloat` |
00:44:04 | FromDiscord | <Elegantbeef> What you're after is an CTE error likely |
00:44:24 | FromDiscord | <⎝⪩﹏⪨⎠> In reply to @Elegantbeef "It's one or the": So instead of returning a string, I should raise an error. |
00:44:39 | FromDiscord | <Elegantbeef> No you can do it statically |
00:50:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f4e |
00:50:29 | FromDiscord | <Rika> In reply to @AmjadHD "What's the difference between": First declares a type, second is the type encapsulated as a value (kinda) |
01:13:42 | FromDiscord | <AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=4f4i |
01:14:22 | FromDiscord | <Elegantbeef> `type` is an alias for `typedesc` |
01:14:39 | FromDiscord | <Generic> oh since when? |
01:14:51 | FromDiscord | <Elegantbeef> Pre 1.0 |
01:15:02 | FromDiscord | <Generic> hm, never noticed |
01:15:17 | FromDiscord | <Elegantbeef> `typedesc` is the "proper" one |
01:15:27 | FromDiscord | <Generic> it is a bit weird |
01:15:47 | FromDiscord | <Generic> because it can also be used as a function |
01:16:03 | FromDiscord | <Elegantbeef> Exactly why you should use `typeof` and `type[T]` |
01:17:49 | FromDiscord | <Elegantbeef> Sorry `typedesc[T]` |
01:17:56 | FromDiscord | <Generic> ~~I would rather have Nim to be not such a keyword hog~~ |
01:18:40 | FromDiscord | <AmjadHD> In reply to @AmjadHD "Is there an option": Why is compiling `runnableExamples` necessary in docs generation ? |
01:18:40 | FromDiscord | <Generic> but alas it is far too late |
01:19:10 | FromDiscord | <Generic> also the keywords are kind of necessary to make the grammar simpler than say C++ |
01:19:12 | FromDiscord | <Elegantbeef> Cause you want the code embedded in the docs to work↵(@AmjadHD) |
01:19:41 | FromDiscord | <AmjadHD> In reply to @Elegantbeef "Cause you want the": I don't. |
01:20:19 | FromDiscord | <AmjadHD> I want it to generate docs fast. |
01:22:17 | FromDiscord | <Bung> wrong example imply wrong document |
01:22:43 | FromDiscord | <Elegantbeef> Then dont use runnable examples use code blocks in your doc comment |
01:25:41 | FromDiscord | <AmjadHD> When I run `koch docs` to update the generated docs after fetching from upstream it takes a lot of time to finish, When I'm pretty sure the runnableExamples are fine because they passed the CI. |
01:27:37 | FromDiscord | <Elegantbeef> There might be a feature to do it, but idk |
01:32:47 | FromDiscord | <Hieronymus Frach> I program for fun and have been wanting to learn a new language for the past few days now. Heard about Nim from fireship, so far looks awesome! Should I learn nim coming from a python-only background? |
01:33:32 | FromDiscord | <huantian> no reason not to, do expect it to be a decent amount different from python though |
01:34:00 | FromDiscord | <Tuatarian> If you want to, go for it |
01:34:07 | FromDiscord | <Tuatarian> Not too much anybody can say |
01:34:08 | FromDiscord | <huantian> at least in some ways it's definitely different |
01:37:08 | FromDiscord | <Hieronymus Frach> In reply to @iWonderAboutTuatara "Not too much anybody": Good point considering this was also posted in the official server. I am going to give it a try and have fun with it |
01:42:46 | FromDiscord | <Tuatarian> If you're learning, I'd recommend nim by example + nim basics + official tutorial |
01:43:02 | FromDiscord | <Tuatarian> Don't need to go through those all at once but you should refer back frequently |
01:43:23 | FromDiscord | <Tuatarian> The error messages can be a bit confusing at first, feel free to Google or ask if confused |
02:12:26 | FromDiscord | <Tower> sent a code paste, see https://play.nim-lang.org/#ix=4f4v |
02:13:54 | FromDiscord | <Tower> sent a code paste, see https://play.nim-lang.org/#ix=4f4w |
02:14:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/WdR |
02:14:44 | FromDiscord | <Elegantbeef> In type definitions Nim assumes `proc(...): .. {.closure.}` for `proc`s |
02:15:03 | FromDiscord | <Elegantbeef> which means you either need to explicitly state "I only want Nimcalls" or raise the nimcall to closure |
02:15:50 | FromDiscord | <Tower> Thank you!! what is the ELI5 of closure vs nimcall? I remember reading that closures can use external variables within its scope (or something similar), though I don't immediately see how that is relevant to what I was trying 🤔 |
02:16:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f4x |
02:16:45 | FromDiscord | <Elegantbeef> Like i said nim defaults to `closure` calling conventions on procedures, and closures are not compatible with nim's default calling convention(nimcall) |
02:17:05 | FromDiscord | <Elegantbeef> The difference between a closure and nimcall is that a closure is really a tuple `(Environment, PointerProc)` |
02:17:26 | FromDiscord | <Elegantbeef> The environment holds the data you need for the storage |
02:18:13 | FromDiscord | <Elegantbeef> You can see this if you do `assert sizeof(proc()) != sizeof(proc(){.nimcall.})` |
02:20:13 | FromDiscord | <Tower> > Like i said nim defaults to closure calling conventions on procedures, and closures are not compatible with nim's default calling convention(nimcall)↵so wait, is nim's default closure, or is its default nimcall? Sorry about my misunderstanding, but your message seems to imply both |
02:20:24 | FromDiscord | <Elegantbeef> Default in type definition is closure |
02:20:27 | FromDiscord | <Tower> (edit) "> Like i said nim defaults to closure calling conventions on procedures, and closures are not compatible with nim's default calling convention(nimcall)↵so wait, is nim's default ... closure," added "calling convention" |
02:20:43 | FromDiscord | <Elegantbeef> Default as a definition is nimcall(unless anonymous) |
02:20:52 | FromDiscord | <Tower> Okay, so the type definition defaults to closure, but "regular" procs default to nimcall↵I think i get it a bit more now |
02:21:05 | FromDiscord | <Tower> Is there a benefit to having the defaults differ? |
02:21:06 | FromDiscord | <Tuatarian> how do you dealloc a variable? |
02:21:24 | FromDiscord | <Tuatarian> I'm just doing `dealloc(addr (the variable))` which segfaults |
02:21:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f4y |
02:21:56 | FromDiscord | <Elegantbeef> The benefit is you can inline non closures, and dont have a complex program for basic things |
02:22:18 | FromDiscord | <Elegantbeef> `dealloc(theVariable)` |
02:22:18 | FromDiscord | <Elegantbeef> If it's a variable that is a pointer you allocated |
02:22:34 | FromDiscord | <Elegantbeef> What exactly are you doing tuatara |
02:22:42 | FromDiscord | <Tuatarian> I'll just send the code |
02:22:55 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4f4z |
02:22:57 | FromDiscord | <Tuatarian> ideally I'd set precs at compile time |
02:23:04 | FromDiscord | <Tuatarian> couldn't find a very good way to do it though |
02:23:08 | FromDiscord | <Elegantbeef> You dont dealloc it |
02:23:16 | FromDiscord | <Elegantbeef> Nim's memory management will clean it up |
02:23:34 | FromDiscord | <Tuatarian> ok arc will get rid of it I guess since it's never used again? |
02:23:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f4A |
02:23:59 | FromDiscord | <Elegantbeef> Of course it will |
02:24:13 | FromDiscord | <Tuatarian> I didn't realize that worked with block |
02:24:23 | FromDiscord | <Elegantbeef> \In nim everything can be an expression |
02:24:32 | FromDiscord | <Elegantbeef> Who has the next question i'm on a streak! |
02:24:32 | FromDiscord | <Tuatarian> since I thought loops were runtime in general, but I guess you can force it to be comptime by assigning it to a comptime const |
02:24:39 | FromDiscord | <Tuatarian> super helpful, thanks! |
02:24:51 | FromDiscord | <Elegantbeef> Well is `precLines` a runtime or compile time value? |
02:24:54 | FromDiscord | <Tuatarian> comptime |
02:24:57 | FromDiscord | <Elegantbeef> Then yea |
02:25:04 | FromDiscord | <Elegantbeef> Nim allows all code to run statically if you tell it |
02:25:09 | FromDiscord | <Elegantbeef> either inside a const or a `static:` block |
02:25:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f4C |
02:26:00 | FromDiscord | <Elegantbeef> I say all but as you likely know it's a subset |
02:26:29 | FromDiscord | <Tuatarian> yeah |
02:26:32 | FromDiscord | <Tuatarian> thanks! |
02:27:00 | FromDiscord | <Tuatarian> I guess here precs would still be mutable, just assigned initially at comptime? |
02:27:12 | FromDiscord | <Elegantbeef> Yes |
02:27:21 | FromDiscord | <Tuatarian> how does that actually work? |
02:27:35 | FromDiscord | <Tuatarian> how does one allocate memory at comptime? or is it just done at init time |
02:27:52 | FromDiscord | <Elegantbeef> The constant is stored in the program and on initialisation it copies from the static |
02:28:02 | FromDiscord | <Elegantbeef> It's the same as `var a = const` |
02:28:12 | FromDiscord | <Elegantbeef> It's just moving the const into the definition |
02:28:54 | FromDiscord | <Tuatarian> I see |
02:29:02 | FromDiscord | <Tuatarian> thanks! |
02:30:26 | FromDiscord | <Tuatarian> gives a bit of an odd error |
02:30:28 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4f4E |
02:30:46 | FromDiscord | <Tuatarian> `/home/tuatarian/code/Heaviside/parlex.nim(17, 22) Error: type mismatch: got <proc (initialSize: int): Table[system.string, system.int]{.noSideEffect, gcsafe.}, string, int>` |
02:30:53 | FromDiscord | <Tuatarian> copying things from terminal is kind of a pain ngl |
02:30:54 | FromDiscord | <Elegantbeef> `()` |
02:31:09 | FromDiscord | <Tuatarian> oh oops |
02:31:10 | FromDiscord | <Tuatarian> thanks |
02:31:48 | FromDiscord | <Elegantbeef> I'm something of a compiler myself |
02:32:34 | FromDiscord | <!!sharpcdf!!> sent a code paste, see https://play.nim-lang.org/#ix=4f4F |
02:32:42 | FromDiscord | <!!sharpcdf!!> ive installed lfs and i added it to my repo but it didnt change anything |
02:32:57 | FromDiscord | <Elegantbeef> Why are you shipping `.so` in a git repo? |
02:33:05 | FromDiscord | <!!sharpcdf!!> and im not sure how to remove libLLVM thing |
02:33:06 | FromDiscord | <!!sharpcdf!!> im not |
02:33:09 | FromDiscord | <!!sharpcdf!!> i dont know how it got there |
02:33:19 | FromDiscord | <!!sharpcdf!!> i think i installed it while working on the repo and it accidentally got mixed in |
02:34:21 | FromDiscord | <Elegantbeef> Search your commits that add it, remove it from that commit continue |
02:36:05 | FromDiscord | <!!sharpcdf!!> how do i do that 😅 not very good with git |
02:36:39 | FromDiscord | <Elegantbeef> `git log name-status` |
02:36:49 | FromDiscord | <Elegantbeef> find the commit that adds that file |
02:37:40 | FromDiscord | <Elegantbeef> `git rebase -i commit` mark it `edit`. `git rm` said file and `git add --all`. then `git rebase --continue` until you get home |
02:38:06 | FromDiscord | <Elegantbeef> Actually you might need to do `git rebase -i HEAD~5` or however many commits back it is |
02:38:38 | FromDiscord | <!!sharpcdf!!> 🫠 |
02:38:55 | FromDiscord | <Elegantbeef> Time to learn git 😛 |
02:39:08 | FromDiscord | <!!sharpcdf!!> definitely need to skim over the documentation for it one of these days |
02:39:45 | FromDiscord | <Elegantbeef> Start contributing to projects, you'll learn it and make multiple mistakes |
02:40:09 | FromDiscord | <!!sharpcdf!!> its weird though because its not even in the folder of the project |
02:41:26 | FromDiscord | <Elegantbeef> I do like that you attempted to add git-lfs instead of fixing the problem |
02:41:30 | FromDiscord | <Elegantbeef> That's some fun stuff |
02:52:40 | FromDiscord | <!!sharpcdf!!> it recommended to do that so i kinda just went along lol |
02:53:29 | FromDiscord | <!!sharpcdf!!> git scares me when i somehow manage to trigger a merge and then fix conflicts with incoming changes instead of current changes and then i have a ruined project that i spent 2 days on aaaaaaaaaa |
02:54:03 | FromDiscord | <!!sharpcdf!!> git merge --abort is my best friend |
02:54:35 | FromDiscord | <!!sharpcdf!!> im thinking about just deleting the local git repo, init a new one then make a remote to the one on github |
02:54:44 | FromDiscord | <!!sharpcdf!!> that typically works without having to fix any conflicts |
02:57:58 | FromDiscord | <!!sharpcdf!!> oh no |
02:58:52 | * | thomasross quit (Quit: Leaving) |
03:01:20 | FromDiscord | <Rika> Personally use a git helper like lazy git |
03:04:03 | FromDiscord | <!!sharpcdf!!> interesting |
03:04:26 | FromDiscord | <!!sharpcdf!!> especially because ive never heard of it and i think i just lost all my work |
03:04:27 | FromDiscord | <!!sharpcdf!!> 3rd time |
03:07:44 | FromDiscord | <Elegantbeef> Always make a new branch when doing things that you're unsure of |
03:07:48 | FromDiscord | <!!sharpcdf!!> bruh somehow my commit history went back like 2 months |
03:07:54 | FromDiscord | <!!sharpcdf!!> i cant fix it |
03:08:18 | FromDiscord | <!!sharpcdf!!> im sure of it |
03:09:09 | FromDiscord | <!!sharpcdf!!> i just had trouble with the llvm thing because somehow it added to my repo |
03:09:15 | FromDiscord | <!!sharpcdf!!> and it broke everything |
03:10:50 | FromDiscord | <!!sharpcdf!!> i am extremely sad and disappointed right now |
03:23:57 | * | arkurious quit (Quit: Leaving) |
03:32:07 | FromDiscord | <Cheesy Brik> sent a code paste, see https://play.nim-lang.org/#ix=4f4M |
03:32:17 | FromDiscord | <Elegantbeef> `import std/[hashes, random]` |
03:32:25 | FromDiscord | <Cheesy Brik> (edit) "https://play.nim-lang.org/#ix=4f4M" => "https://paste.rs/TOL" |
03:32:26 | FromDiscord | <Cheesy Brik> Ah ok nice |
03:49:05 | FromDiscord | <MrNavaStar> Hi! I'm new here. Is there a good place for me to ask questions about a library? Im having trouble using the Serial library and was wondering if there was anyone who could give me a hand! |
03:49:08 | FromDiscord | <MrNavaStar> (edit) "hand!" => "hand" |
03:49:55 | FromDiscord | <Elegantbeef> Here is likely fine |
03:50:24 | FromDiscord | <MrNavaStar> okay awesome |
03:50:37 | * | mahlon quit (*.net *.split) |
03:50:48 | FromDiscord | <Elegantbeef> Might be a bit difficult for actually testing 😄 |
03:51:17 | * | mahlon joined #nim |
03:52:49 | FromDiscord | <MrNavaStar> sent a code paste, see https://play.nim-lang.org/#ix=4f4N |
03:53:07 | FromDiscord | <MrNavaStar> if anyone has some clues as to what im doing wrong, that would be awesome! |
03:53:36 | FromDiscord | <Elegantbeef> you can just do `port.read(buff)` not that it'll fix anything |
03:54:19 | FromDiscord | <MrNavaStar> really? it doesn't seem to be happy about that |
03:54:39 | FromDiscord | <MrNavaStar> maybe different for async and non async? |
03:54:48 | FromDiscord | <Elegantbeef> Ah right async 😄 |
03:57:33 | FromDiscord | <Elegantbeef> Kinda odd there isnt a timeout length, i wagered that'd be the problem |
03:58:36 | FromDiscord | <MrNavaStar> oh, how do I set that? This code is basically just copied from the Serial libraries examples |
03:58:55 | * | joast quit (*.net *.split) |
03:58:55 | * | Onionhammer quit (*.net *.split) |
03:58:55 | * | lain quit (*.net *.split) |
03:58:55 | * | dza quit (*.net *.split) |
03:59:13 | * | Onionhammer joined #nim |
03:59:50 | * | lain joined #nim |
03:59:55 | FromDiscord | <Elegantbeef> Yea that's my point |
03:59:55 | FromDiscord | <Elegantbeef> The library doesnt have a timeout |
03:59:59 | FromDiscord | <MrNavaStar> oooo |
04:00:31 | * | dza joined #nim |
04:03:32 | * | adium quit (*.net *.split) |
04:03:32 | * | NimEventer quit (*.net *.split) |
04:03:32 | * | termer quit (*.net *.split) |
04:03:43 | * | NimEventer joined #nim |
04:04:18 | * | termer joined #nim |
04:04:45 | * | adium joined #nim |
04:05:59 | FromDiscord | <Elegantbeef> I dont really have a way to test this afaik, so cannot say much sadly |
04:06:27 | FromDiscord | <MrNavaStar> all good, thanks anyway! |
04:08:20 | FromDiscord | <MrNavaStar> its so weird, even running a direct copy paste of their example code doesn't work |
04:14:40 | * | estiquelapice quit () |
04:15:01 | * | estiquelapice joined #nim |
04:16:26 | * | Goodbye_Vincent quit (*.net *.split) |
04:16:26 | * | kevinsjoberg quit (*.net *.split) |
04:16:26 | * | robertmeta quit (*.net *.split) |
04:16:26 | * | gshumway quit (*.net *.split) |
04:16:26 | * | ttkap quit (*.net *.split) |
04:16:48 | * | kevinsjoberg joined #nim |
04:16:54 | * | robertmeta joined #nim |
04:17:03 | * | Goodbye_Vincent joined #nim |
04:18:12 | * | gshumway joined #nim |
04:28:49 | FromDiscord | <JeysonFlores> holy cow, I was happy because in my free-time startup I finally started to use Nim for production. I was designing a pub/sub websockt-based service for realtime notifications. I used Jester and the WS library, but suddenly when I started to test the draft, the performance was horrible |
04:29:03 | FromDiscord | <Cheesy Brik> Can someone explain to me why nim uses `result =` instead of a return keyword? It already has a yield keyword. |
04:29:10 | FromDiscord | <Elegantbeef> Did you do `-d:release`? |
04:29:33 | FromDiscord | <Require Support> In reply to @Cheesy Brik "Can someone explain to": you can use return too i think |
04:29:34 | FromDiscord | <Elegantbeef> It has both↵(@Cheesy Brik) |
04:29:44 | FromDiscord | <Elegantbeef> an implicit `result` and an explicit `return` |
04:32:32 | * | Yardanico quit (*.net *.split) |
04:32:32 | * | qwestion quit (*.net *.split) |
04:32:32 | * | syl quit (*.net *.split) |
04:32:45 | * | Yardanico joined #nim |
04:32:50 | * | Yardanico quit (Changing host) |
04:32:50 | * | Yardanico joined #nim |
04:33:04 | FromDiscord | <Cheesy Brik> In reply to @Elegantbeef "It has both (<@666999744572293170>)": Oh I see, I just read the docs, so the result var is like a store for stuff you wanna return at the end of the function not an actual return. The why is the common syntax to use result= even if return would do the same thing? |
04:33:19 | FromDiscord | <Elegantbeef> Cause `return`ing is generally for a different semantic |
04:33:28 | FromDiscord | <Elegantbeef> Nim also has implicit return |
04:33:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/qp1 |
04:34:11 | * | syl joined #nim |
04:36:15 | FromDiscord | <Cheesy Brik> In reply to @Elegantbeef "Nim also has implicit": That’s so interesting, is that evaluated at compile time to be just as efficient? |
04:37:04 | FromDiscord | <Elegantbeef> Not evaluated but yes it's converted to the same |
04:38:22 | FromDiscord | <Cheesy Brik> In reply to @Elegantbeef "Not evaluated but yes": Useful, nim continues to surprise me with how simple it can be while still giving a ton of control |
04:45:47 | FromDiscord | <Elegantbeef> Hey this is a common complaint "It has too many ways to do the same thing" |
05:30:34 | * | ltriant quit (Ping timeout: 272 seconds) |
05:54:54 | * | mahlon quit (Ping timeout: 260 seconds) |
05:57:32 | * | mahlon joined #nim |
06:00:58 | * | Onionhammer7 joined #nim |
06:02:08 | FromDiscord | <ynfle> Anyone deployed nim to aws lambda that could help me? |
06:02:12 | * | dza6 joined #nim |
06:03:04 | * | Onionhammer quit (Ping timeout: 260 seconds) |
06:03:04 | * | Onionhammer7 is now known as Onionhammer |
06:03:28 | FromDiscord | <ynfle> I'm trying to use the right `--cpu` because I am on an m1 mac |
06:03:39 | * | dza quit (Ping timeout: 260 seconds) |
06:03:39 | * | dza6 is now known as dza |
07:20:30 | FromDiscord | <ChocolettePalette> You might need to consider cross-compilation i.e. using both --os and --cpu. You need to somehow inquire about what CPU is used at AWS, which doesn't depend on your own CPU iirc |
07:36:21 | * | tanami quit (Ping timeout: 268 seconds) |
07:47:10 | FromDiscord | <soda> sent a code paste, see https://play.nim-lang.org/#ix=4f5s |
07:53:51 | FromDiscord | <Rika> Install the version of OpenSSL that starts with a 1 |
07:54:23 | FromDiscord | <ringabout> What's your Nim version btw? |
07:55:18 | FromDiscord | <ringabout> I saw tge same error yesterday. |
07:55:30 | FromDiscord | <ringabout> (edit) "tge" => "the" |
07:55:45 | FromDiscord | <ringabout> In reply to @Isofruit "> (base) ~/dev/playground %": here |
07:56:12 | FromDiscord | <soda> In reply to @Rika "Install the version of": okay thanks |
07:56:25 | FromDiscord | <soda> In reply to @flywind "What's your Nim version": 1.6.6 |
07:56:28 | FromDiscord | <Phil> Can confirm btw that it's still a thing |
07:56:54 | FromDiscord | <ringabout> In reply to @Isofruit "Can confirm btw that": Yeah, what's your OS? |
07:56:57 | FromDiscord | <Phil> though mine is more a choosenim issue, nimble itself worked yesterday |
07:57:10 | FromDiscord | <Phil> Arch and I'm on pretty much all the newest updates |
07:57:16 | FromDiscord | <soda> ^ |
07:57:40 | FromDiscord | <ringabout> Does Arch default to OpenSSL 3? |
07:57:56 | FromDiscord | <Phil> That is a very good question that I'll need to google to figure out |
07:58:23 | FromDiscord | <soda> @ringabout yes |
07:58:34 | FromDiscord | <ringabout> There is a `getSSLVersion` in openssl libray |
07:58:34 | FromDiscord | <Phil> > (base) ~ % openssl version↵> OpenSSL 1.1.1n 15 Mar 2022 |
07:58:41 | FromDiscord | <ringabout> (edit) "libray" => "library" |
07:59:14 | FromDiscord | <soda> sent a code paste, see https://play.nim-lang.org/#ix=4f5t |
07:59:26 | FromDiscord | <ringabout> (edit) "`getSSLVersion`" => "`getOpenSSLVersion`" | "library" => "library." |
07:59:32 | FromDiscord | <Phil> Grabbed the last 3 updates, rebooting and then I'll respond again |
08:00:38 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4f5v |
08:00:47 | FromDiscord | <Phil> Still the same for me |
08:00:51 | FromDiscord | <soda> i just notice that everything openssl related is broken on my end |
08:00:54 | * | mahlon quit (Ping timeout: 260 seconds) |
08:00:55 | FromDiscord | <Phil> I am on devel as a sidenote |
08:01:29 | FromDiscord | <Elegantbeef> Did you rebuild choosenim with devel? |
08:01:37 | FromDiscord | <ringabout> In reply to @Isofruit "> (base) ~ %": That seems not to be a different issue. |
08:02:07 | FromDiscord | <ringabout> Probably open an issue on the issue tracker of choosenim |
08:02:14 | FromDiscord | <ringabout> (edit) removed "not" |
08:02:41 | FromDiscord | <ringabout> `choosenim` supports arch? |
08:03:47 | * | mahlon joined #nim |
08:07:18 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=4f5x |
08:10:05 | FromDiscord | <rakgew> in libusb video https://yewtu.be/watch?v=If7qsVvkIH0 (\~min25)↵for C I saw them just indexing it\: `inter = &config->interface[i];` |
08:10:17 | FromDiscord | <Elegantbeef> `interfaceArr = cast[ptr UncheckedArray[ptr LibusbConfigDescriptor](libusbGetConfig....)` |
08:10:19 | FromDiscord | <rakgew> but that did not seem to work for the nim type |
08:10:43 | FromDiscord | <Elegantbeef> Wait that's not right 😄 |
08:11:25 | FromDiscord | <Elegantbeef> The wrapping uses `ptr LibUsbInterface` instead of `ptr UncheckedArray[...}` |
08:11:53 | FromDiscord | <Elegantbeef> So you will need to do `cast[ptr UncheckedArray[LibUsbInterface]](config.interfaces)[i]` |
08:11:56 | FromDiscord | <rakgew> aha - with some casting magic. thank you so much Elegantbeef! |
08:12:05 | FromDiscord | <Elegantbeef> Blame the author in this case |
08:12:10 | FromDiscord | <rakgew> yes it is a `ptr LibUsbInterface` |
08:12:22 | FromDiscord | <Elegantbeef> PR the change to use a `ptr UncheckedArray` 😄 |
08:13:07 | FromDiscord | <rakgew> oh ok. thank you! |
08:13:25 | FromDiscord | <Phil> In reply to @Elegantbeef "Did you rebuild choosenim": Nope |
08:13:43 | FromDiscord | <Elegantbeef> In Nim you can only index arrays in C you can index pointers |
08:14:06 | FromDiscord | <Elegantbeef> So you need to use the UncheckedArray for collections to not have an annoying cast |
08:14:42 | FromDiscord | <Phil> However, I might as well reinstall choosenim |
08:15:49 | FromDiscord | <Phil> Reinstall of choosenim bumped me down to nim 1.6.8, on there choosenim works again |
08:43:42 | FromDiscord | <albassort> hey guys im kinda braindead |
08:43:59 | FromDiscord | <albassort> how the hell is E38184 actually 3044 in hex |
08:44:07 | FromDiscord | <albassort> what method of conversion is this |
08:45:29 | * | Goodbye_Vincent quit (Quit: ) |
08:46:40 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1038736160203210812/image.png |
08:46:43 | FromDiscord | <albassort> this is breaking my brain |
08:47:26 | FromDiscord | <Generic> it's UTF8 |
08:48:14 | FromDiscord | <albassort> im reading that right now |
08:48:25 | FromDiscord | <albassort> different standards |
08:48:34 | FromDiscord | <albassort> dumb digital technology |
08:48:41 | FromDiscord | <Generic> it's not dumb at all |
08:48:49 | FromDiscord | <Generic> it's just something completely different |
08:48:52 | FromDiscord | <albassort> its really smart and efficient |
08:49:12 | FromDiscord | <albassort> but im hear trying to figure out how two numbers correlate and my mind was melting |
08:49:50 | * | jjido joined #nim |
09:00:22 | FromDiscord | <demotomohiro> If unicode was encoded as 3 or 4 bytes fixed size charactor, it would be much simpler and easy to understand. |
09:05:15 | FromDiscord | <Generic> UTF-16 and UTF-32 exist |
09:06:00 | FromDiscord | <Generic> though in this English-centric world we live in, UTF-8 is a good idea |
09:06:16 | FromDiscord | <Generic> besides it avoids some other issues |
09:06:25 | FromDiscord | <Generic> like it doesn't need byte order marks |
09:06:57 | FromDiscord | <&Makarov/1> hello beautiful people , pls is there any guide for leaening nim for system programming , a book or something ? cause i wanna learn some system programming and i really lack guidance ! and thanks in advance ! |
09:18:00 | * | Goodbye_Vincent joined #nim |
09:21:31 | FromDiscord | <albassort> In reply to @demotomohiro "If unicode was encoded": currently searching for an index for utf-8 |
09:39:14 | FromDiscord | <albassort> ok |
09:39:22 | FromDiscord | <albassort> so utf8 is unicode right |
09:39:26 | FromDiscord | <albassort> thats super cool |
09:39:41 | FromDiscord | <albassort> i cant find a single explanation for how the encoding happens |
09:45:37 | FromDiscord | <Generic> https://en.wikipedia.org/wiki/UTF-8#Encoding |
09:45:39 | FromDiscord | <Generic> ??? |
09:47:44 | FromDiscord | <Horizon [She/Her]> In reply to @Isofruit "Damn I can phone": Ah, no proc 1 needs to be able to read variables in proc 3, and afaik, proc 1 also needs to be in proc 2 for macros |
09:48:39 | FromDiscord | <Generic> In reply to @&Makarov/1 "hello beautiful people ,": there are two books, Nim in Action (which is already a bit older) and Mastering Nim (which was only recently published) |
09:48:54 | FromDiscord | <Generic> I can't say much about them personally, because I haven't read either of them |
09:49:02 | FromDiscord | <&Makarov/1> In reply to @Generic "there are two books,": oooh thanks for your kind reply dear friend ! |
09:49:10 | FromDiscord | <&Makarov/1> surely i'll check them ! |
09:49:25 | FromDiscord | <&Makarov/1> m currently a web dev , but i didnt like much the field ! 😂 |
09:50:05 | FromDiscord | <Generic> well if you're out for a Nim job, then be aware that there aren't that many out there |
09:50:47 | FromDiscord | <&Makarov/1> In reply to @Generic "well if you're out": m more into research and fun ! 😂 |
09:51:18 | FromDiscord | <&Makarov/1> currently m elixir dev , and they arent many jobs in my country also 😂 |
09:51:56 | FromDiscord | <Generic> oh ok, if you're coming from Elixir, Nim will be almost mainstream compared to that haha |
09:54:29 | FromDiscord | <&Makarov/1> In reply to @Generic "oh ok, if you're": wdym by mainstream ? |
09:54:58 | FromDiscord | <Bung> mainstream language I guess |
09:56:06 | FromDiscord | <&Makarov/1> alright thanks guys ! |
09:56:21 | FromDiscord | <&Makarov/1> btw why they are a lot of bots here 😅 |
09:57:09 | * | ltriant joined #nim |
09:57:33 | FromDiscord | <Bung> they use different clients matrix here |
09:59:25 | FromDiscord | <&Makarov/1> In reply to @Bung "they use different clients": different client for discord ? |
09:59:37 | FromDiscord | <&Makarov/1> that's new for me 😅 |
10:00:26 | FromDiscord | <&Makarov/1> but why ? |
10:00:38 | FromDiscord | <that_dude> Not different discord clients |
10:00:52 | FromDiscord | <that_dude> other chat systems have been bridged with the discord channels via bots |
10:01:07 | FromDiscord | <that_dude> that way irc and matrix chat rooms (other programn) can communicate in here too |
10:01:13 | FromDiscord | <rakgew> matrix is bridged to discord (or the other way around) - for matrix there are many different clients |
10:01:28 | FromDiscord | <&Makarov/1> In reply to @rakgew "matrix is bridged to": alright , but why ? 😅 |
10:01:30 | FromDiscord | <that_dude> (edit) "programn)" => "programs)" |
10:01:34 | FromDiscord | <&Makarov/1> i guess i cant use voice chat right ? |
10:02:04 | FromDiscord | <Bung> like I'd prefer irc cli client, but some channel not bridged |
10:02:25 | FromDiscord | <that_dude> In reply to @&Makarov/1 "alright , but why": For the same reason we don't only talk on facebook messenger. It's a preference where we want to talk and what client to use |
10:02:30 | FromDiscord | <Bung> now I use element client on a Pentium cpu mini pc |
10:02:46 | FromDiscord | <Phil> In reply to @Event Horizon "Ah, no proc 1": Would the template idea work? It would pretty much just split out the generating of the proc and the mechanics could all work as before, just makes the code a bit simpler to read.↵template could be called "generateProc1()" with proc1 being whatever your proc name is |
10:02:55 | FromDiscord | <&Makarov/1> In reply to @Bung "now I use element": aaah alright ! |
10:03:21 | FromDiscord | <Phil> (edit) "before," => "before (since you'll still be syntactically copy-pasting code and get the same code as an end-result)," |
10:04:27 | FromDiscord | <Horizon [She/Her]> Nope, because proc 1 has a different implementation every time |
10:05:41 | FromDiscord | <Horizon [She/Her]> In reply to @Isofruit "Would the template idea": There's only one version of proc 3, but for every variation of proc 1 (which there'll be many of), there's another variation of proc 2, though proc 2 typically stays the same since proc 2 just 'wraps' proc 1 |
10:06:08 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
10:18:12 | FromDiscord | <dlesnoff> In reply to @Elegantbeef "`git rebase -i commit`": I love git trickery, it seems so magic to newcomers, but is just natural when you understand commit tree, branches, and log rebasing. |
10:18:54 | FromDiscord | <dlesnoff> In reply to @flywind "Does Arch default to": good to know. I'll probably won't do a pacman -Syu for now ^^ |
10:29:11 | FromDiscord | <konradmb> In reply to @&Makarov/1 "alright , but why": This site explains why in detail: https://joinmatrix.org/guide/matrix-vs-discord/ |
10:29:40 | FromDiscord | <konradmb> I use both, but usually prefer Matrix |
10:31:56 | * | neceve joined #nim |
10:43:05 | FromDiscord | <&Makarov/1> In reply to @konradmb "This site explains why": alright , thaanks ! |
10:52:17 | * | neceve_ joined #nim |
10:53:33 | * | neceve_ quit (Client Quit) |
10:59:19 | FromDiscord | <pyryrin> sent a code paste, see https://play.nim-lang.org/#ix=4f6b |
11:00:34 | FromDiscord | <rakgew> sent a long message, see http://ix.io/4f6e |
11:04:03 | FromDiscord | <Generic> In reply to @pyryrin "do nim seqs like": yes, conceptually they're the same data structure, though details like the growth function may differ |
11:04:35 | FromDiscord | <pyryrin> so it does kinda grow capacity wirdly or new allocation everytime you add element |
11:04:44 | FromDiscord | <pyryrin> ? |
11:05:11 | FromDiscord | <Generic> it doesn't grow with every allocation |
11:05:21 | FromDiscord | <Generic> that's the entire point |
11:05:35 | FromDiscord | <pyryrin> okay |
11:08:18 | FromDiscord | <Generic> ok I've just looked into the actual implementation |
11:08:33 | FromDiscord | <Generic> and gc:arc seqs actually only grow by as much as necessary |
11:08:38 | FromDiscord | <Generic> so I was wrong, huh |
11:09:12 | FromDiscord | <pyryrin> is it same with gc:orc |
11:09:25 | FromDiscord | <Generic> yes, they're exactly the same except for the cycle collector |
11:09:42 | FromDiscord | <pyryrin> so its basically every add is a new allocation |
11:09:45 | FromDiscord | <pyryrin> right |
11:09:48 | FromDiscord | <Generic> yeah |
11:10:04 | FromDiscord | <pyryrin> but deletion doesnt deallocate |
11:10:07 | FromDiscord | <Generic> yeah |
11:10:10 | FromDiscord | <Generic> when creating a seq you can set an initial capacity though |
11:10:15 | FromDiscord | <pyryrin> okay |
11:10:51 | FromDiscord | <Generic> though now that I know this I have to go through some code I've written which is supposed to be fast |
11:10:52 | FromDiscord | <Generic> haha |
11:11:37 | FromDiscord | <Generic> because I've always assumed add would grow by more than one element |
11:34:30 | * | neceve_ joined #nim |
11:39:15 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4f6q |
11:39:38 | * | neceve_ quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
11:48:42 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4f6t |
11:50:35 | FromDiscord | <auxym> but IMO, the easiest or most obvious way to understand generics is container types. `proc a[T](s: seq[T] = ...` is a proc that can take a seq containing any type (homogeneously, of course) |
11:53:17 | FromDiscord | <auxym> (also note that your template could be just a proc) |
11:58:33 | FromDiscord | <sOkam!> In reply to @auxym "but IMO, the easiest": what do you mean by container types? |
11:58:58 | FromDiscord | <auxym> types that contain other types. seqs, arrays, tables, seqs, etc |
11:59:08 | FromDiscord | <auxym> (edit) "seqs," => "sets," |
11:59:38 | FromDiscord | <sOkam!> why does that make them easier to understand? i think i'm missing why that is |
12:02:15 | FromDiscord | <auxym> maybe it's just my brain but that's what made it clicked when I started using static types (java), having only used dynamic typing (python) before. |
12:03:33 | FromDiscord | <auxym> A `seq`contains another type (eg seq of strings, or ints). Therefore `var s: seq` doens't make sense as a type definition, you have to qualify the seq with a type parameter that defines which type the seq contains: `var s: seq[int]` |
12:05:24 | FromDiscord | <auxym> from there you can realize that you can use an abstract type param (eg `T`) and the compiler will generate a new "concrete" proc implementation for you based on the contrete type you specified. And that's a generic. |
12:05:35 | * | genpaku quit (Remote host closed the connection) |
12:07:52 | FromDiscord | <ChocolettePalette> But Go has generics too... |
12:08:42 | * | genpaku joined #nim |
12:32:57 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=4f6F |
12:35:09 | * | neceve_ joined #nim |
12:35:32 | FromDiscord | <untoreh> the ultimate whackamole solution |
12:35:56 | FromDiscord | <untoreh> :p |
12:36:14 | * | neceve quit (Ping timeout: 260 seconds) |
12:39:05 | * | jmdaemon quit (Ping timeout: 255 seconds) |
12:43:17 | FromDiscord | <exelotl> That seems bad, when something is nil a not-nil type should force you to deal with it. "Create a new one and pretend nothing is wrong" might not be the right thing to do in every situation |
12:43:26 | FromDiscord | <scarf> hi, does nim has optimized container, something like c++'s `std::hive`?↵<https://plflib.org/colony.htm>↵<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0447r15.html> |
12:47:37 | FromDiscord | <ChocolettePalette> 🐝🐝🐝↵(@scarf) |
12:47:51 | * | neceve_ is now known as neceve |
12:48:52 | FromDiscord | <Rika> Not that I know of, no |
12:50:56 | FromDiscord | <auxym> the perf characteristics sound sort of like a slotmap, and I remember had a somewhat simple slotmap implementation in nim as part of a js game library or something |
12:51:15 | FromDiscord | <auxym> https://www.youtube.com/watch?v=SHaAR7XPtNU |
12:51:34 | FromDiscord | <auxym> (edit) "the perf characteristics sound sort of like a slotmap, and I remember ... had" added "someone" |
12:51:56 | FromDiscord | <scarf> In reply to @auxym "the perf characteristics sound": thank you! |
12:52:20 | FromDiscord | <auxym> here actually: https://github.com/planetis-m/goodluck/blob/main/project2d/slottables.nim |
12:58:45 | FromDiscord | <dlesnoff> Isn't there a DS collection library somewhere ? (DS: data structure) |
12:59:32 | FromDiscord | <auxym> no, but it would be cool if someone made one :)\ |
12:59:41 | FromDiscord | <auxym> Not aware of one, anyways |
12:59:58 | * | jjido joined #nim |
13:00:17 | FromDiscord | <dlesnoff> I know there is a DS list in the curated list of packages |
13:01:10 | FromDiscord | <dlesnoff> https://github.com/ringabout/awesome-nim#data-structures |
13:02:00 | FromDiscord | <dlesnoff> I am often lost on how to optimize my programs in Nim. There is often many ways to write the same thing. |
13:02:56 | FromDiscord | <Rika> Reduce reference use but not too much, pretty much that and you’ll be fine for a while |
13:03:13 | FromDiscord | <Rika> Ways to write the same thing should be almost equivalent in speed |
13:03:19 | FromDiscord | <Rika> Do you need the speed right now? |
13:06:21 | FromDiscord | <dlesnoff> Nothing that is critical, but I like to have efficiency guidelines when I code. |
13:07:33 | FromDiscord | <Rika> Then avoid excessive indirection, and perhaps inheritance and OOP as well |
13:07:43 | FromDiscord | <Rika> Use generics and object variants as much as possible |
13:08:11 | FromDiscord | <Rika> If you really need the reference semantics then there’s no choice but to go with the reference, don’t worry there |
13:08:36 | FromDiscord | <Rika> I’m not too sure on other things, perhaps preallocate your strings and sequences as much as possible |
13:08:53 | FromDiscord | <dlesnoff> For example, there is this guide on memory representation: https://zevv.nl/nim-memory/↵but it doesn't say anything apart classic memory layout representation in memory in C and to check memory alignment |
13:09:25 | FromDiscord | <dlesnoff> (edit) "alignment" => "alignment↵So it optimizes memory (by a good ordering of the fields)." |
13:13:15 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4f6M |
13:13:57 | FromDiscord | <Rika> What issues are you encountering from doing what you said? |
13:17:24 | FromDiscord | <Andreas> sent a long message, see http://ix.io/4f6N |
13:17:30 | FromDiscord | <auxym> @dlesnoff if you're looking to optimize, the #1 rule is always the same: profile, profile, profile. Blind "optimization" without any instrumentation to guide you is useless |
13:21:17 | FromDiscord | <Rika> In reply to @Andreas "`cannot instantiate Atomic [type": https://nim-lang.org/docs/system.html#AtomType |
13:21:39 | FromDiscord | <Rika> References aren’t atom types it seems |
13:22:26 | FromDiscord | <Andreas> In reply to @Rika "References aren’t atom types": yep, if i use `Atomic[ ptr Node ]` the variant-object is gone ? |
13:22:35 | FromDiscord | <Rika> No |
13:23:38 | FromDiscord | <Rika> You will have double indirection and maybe some issues regarding reference |
13:26:14 | FromDiscord | <Andreas> In reply to @Rika "You will have double": hm, can you recommend some solution. I'd basically need a Atomic-ptr to be able to 'swing-the-ptr' via a CAS ? |
13:27:31 | FromDiscord | <Rika> Why do you have reference for the initial node type? Double indirection isn’t necessarily a dealbreaker, just a performance issue |
13:27:56 | FromDiscord | <Rika> The reference issue might not even exist, prolly doesn’t using ARC which I assumed anyway because you also use the new threading library |
13:29:34 | FromDiscord | <Rika> Maybe it could be more ergonomic to split the type into non and reference type like Nim sometimes does |
13:29:43 | FromDiscord | <Andreas> In reply to @Rika "The reference issue might": the linked-list contains might look like so : `Hint->Hint->Node->Node->Hint->Node` |
13:29:58 | FromDiscord | <Rika> NodeObj = object ...↵Node = ref NodeObj |
13:30:49 | FromDiscord | <Rika> In reply to @Andreas "the linked-list contains might": You don’t need that if you store the regular object in a pointer anyway, the importance is the indirection not the reference |
13:30:58 | FromDiscord | <Rika> (edit) "that" => "to worry" |
13:31:24 | FromDiscord | <Rika> The indirection is needed to store a type in itself so that it stays constant size |
13:34:44 | FromDiscord | <dlesnoff> In reply to @Jiezron "Isn't there a DS": There is this too: https://github.com/ringabout/data-structure-in-Nim |
13:43:27 | FromDiscord | <Andreas> thx, well i corrected the way the items of the linked-list point to each other. Since i don't really understand the performance-consequences of indirection in that case - i have a basic question : Does it make sense at all to declare atomic-types inside such Objects or Object-Variants. As `ref` is not (yet) a supported AtomType, that excludes as-far-as-i-understand `variant-objects` atm.↵Therefore in my case i'd need two plain `object |
13:44:53 | FromDiscord | <Rika> Why would you be unable to use variant types without references? |
13:46:06 | FromDiscord | <Rika> Maybe you misunderstood what indirection means |
13:46:15 | FromDiscord | <Rika> Pointers and references are both forms of indirection |
13:46:39 | FromDiscord | <Rika> You can use either of them to store types within themselves |
14:12:29 | * | genpaku quit (Ping timeout: 260 seconds) |
14:14:22 | * | genpaku joined #nim |
14:26:03 | * | arkurious joined #nim |
14:29:10 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
14:30:09 | * | jjido joined #nim |
14:37:11 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
14:37:42 | FromDiscord | <scarf> sent a code paste, see https://play.nim-lang.org/#ix=4f79 |
14:37:49 | FromDiscord | <scarf> (edit) "https://play.nim-lang.org/#ix=4f79" => "https://play.nim-lang.org/#ix=4f7a" |
14:39:19 | * | neceve quit (Ping timeout: 260 seconds) |
14:39:33 | * | neceve joined #nim |
14:40:16 | * | jonlevin joined #nim |
14:50:00 | FromDiscord | <Rika> It’s hard to tell how to fix it without knowing what’s wrong |
15:04:37 | FromDiscord | <Cheesy Brik> Are proc’s stored as objects and if so what is the type name? |
15:09:07 | FromDiscord | <Bung> borrow what ? |
15:12:55 | FromDiscord | <Phil> In reply to @Cheesy Brik "Are proc’s stored as": You mean like python? Not to my knowledge. |
15:17:56 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "You mean like python?": Man that sucks, it’s one of the few things I like about oop |
15:31:30 | FromDiscord | <Cheesy Brik> Does anyone have a comparative time performance of nim compared to others such as c++, python, rust, Java, etc. |
15:36:29 | FromDiscord | <Generic> there are some benchmark sites for this out there |
15:36:56 | FromDiscord | <Generic> though their results are pretty questionable |
15:37:25 | FromDiscord | <Generic> because with languages such as Nim, C++ or Rust you more or less have access to everything your computer can deliver |
15:43:16 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/Y9K |
15:44:08 | FromDiscord | <sOkam!> right now i only know how to pass custom types as input. but not the type itself |
15:44:40 | FromDiscord | <sOkam!> (edit) "right now i only know how to pass ... custom" added "values with" |
15:45:26 | FromDiscord | <Bung> typedesc[MyType] |
15:45:34 | FromDiscord | <sOkam!> ty! |
15:46:15 | FromDiscord | <sOkam!> wait... is that valid for any type? |
15:46:46 | FromDiscord | <sOkam!> like, the point in this usecase is to check what type the variable is inside the function |
15:48:09 | FromDiscord | <Bung> it sound more like a generic proc , why dont just just `thing[T]` |
15:49:00 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4f7V |
15:49:37 | FromDiscord | <sOkam!> In reply to @Bung "it sound more like": Because I have no clue how to use them in practice, other than I learned the syntax for them today a few hours ago↵So I don't know if that's the way to do it here |
15:50:31 | FromDiscord | <sOkam!> The key is that if type is Vec3, each attribute is gonna be given to opengl with a mandatory `EGL_FLOAT`, and I would like to avoid having to type that externally outside of this function |
15:50:36 | FromDiscord | <Bung> this one is also fine |
15:53:21 | FromDiscord | <Bung> not sure if you want use a value,if it is u can just `Vec3 or Vec2 or Vec1 ` |
15:54:39 | FromDiscord | <Bung> u can also try `typedesct[A] pr typedesct[B]`, but I haven't used |
15:54:42 | FromDiscord | <sOkam!> Not sure if I will need it either, so far it seems to work well with jhust the type |
15:55:06 | FromDiscord | <sOkam!> might need to refactor possibly, will keep it in mind 🤷♂️ |
15:55:23 | FromDiscord | <Cheesy Brik> In reply to @sOkam! "Because I have no": If I’m not mistaken (also a nim newbie) you can do `thing[T](num:int; vec3:T)` then inside the proc have `assert T==MyType` |
15:55:52 | FromDiscord | <Cheesy Brik> (edit) "T==MyType`" => "T==Vec3`" |
16:03:36 | FromDiscord | <Bung> yeah , use generic proc is also an option, inside the proc u do `when T is Vec3: doTheWork` |
16:04:55 | FromDiscord | <Cheesy Brik> Was just watching this video, https://youtu.be/QM1iUe6IofM anything like the use block he suggests around 42:00 in nim? Or could you make a macro/template for it? |
16:07:41 | FromDiscord | <scarf> In reply to @Rika "It’s hard to tell": or in other words, how could i have a distinct object constructor? |
16:07:49 | FromDiscord | <scarf> (edit) "could" => "would" |
16:08:37 | FromDiscord | <Rika> have a proc return that distinct object? or convert the parent type to the distinct `vec2val.vec2dstc` |
16:08:55 | FromDiscord | <Rika> in your case that would be `like` not `dstc` mb |
16:14:14 | FromDiscord | <sOkam!> In reply to @Bung "yeah , use generic": why compiletime? |
16:14:56 | FromDiscord | <Bung> the question is why runtime |
16:20:21 | FromDiscord | <sOkam!> In reply to @Bung "the question is why": i have the same answer to both.: ❔ |
16:20:43 | FromDiscord | <Cheesy Brik> I feel like using any code flow here is unnecessary just pass an error if the type doesn’t match what you want, unless you need dif behaviors for dif types but then you just overload. |
16:21:29 | FromDiscord | <sOkam!> In reply to @Cheesy Brik "I feel like using": i have to convert the typedef to somehting that opengl understands |
16:23:01 | FromDiscord | <Cheesy Brik> And you’re already using a vec3 type so as I said before you can just `assert type == Vec3` before passing it to OpenGL |
16:23:18 | FromDiscord | <Cheesy Brik> Unless I’m misunderstanding |
16:23:42 | FromDiscord | <sOkam!> In reply to @Cheesy Brik "And you’re already using": im not passing the vec3 to opengl↵i'm using vmath types to store my data, and when i register the attribute it expects EGL_FLOAT |
16:24:04 | FromDiscord | <Cheesy Brik> Ah ok I see |
16:24:22 | FromDiscord | <Cheesy Brik> Then yeh codeflow should prob be used |
16:24:30 | FromDiscord | <Cheesy Brik> (edit) "codeflow" => "code flow" |
16:32:38 | FromDiscord | <Phil> In reply to @Cheesy Brik "Man that sucks, it’s": You got to keep in mind that types in general (proc signatures count as such) are only compile-time.↵No manipulating or generating those at runtime |
16:35:30 | FromDiscord | <Phil> As for performance... I can't really perform benchmarks, for my purposes (webdev) it's been beating out my python implementation of endpoints by roughly a factor of 4-10. Mind you, in absolute terms that's the difference between 100-300ms to 5-50ms |
16:36:07 | FromDiscord | <Phil> (edit) "As for performance... I can't really perform benchmarks, for my purposes (webdev) it's been beating out my python implementation of endpoints by roughly a factor of 4-10. Mind you, in absolute terms that's the difference between 100-300ms to 5-50ms ... " added "(Django vs Prologue + Norm basically)" |
16:37:15 | FromDiscord | <Phil> Generally synthetic benchmarks don't mean much either way as it depends on the scenario. The key bit is that you can mess with memory etc. if you want with various memory modes and optimize for those. |
16:39:43 | NimEventer | New post on r/nim by Robert_Bobbinson: Is it possible to make Android apps with Nim? Thanks., see https://reddit.com/r/nim/comments/ynv5fz/is_it_possible_to_make_android_apps_with_nim/ |
16:40:14 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "Generally synthetic benchmarks don't": Yeh I’d just want a general benchmark for basic comparison as I’m not really and efficiency nut and don’t work in area where it’s necessarily need but I like knowing I won’t have to wait a few minutes to get results. |
16:40:24 | FromDiscord | <Cheesy Brik> (edit) "and" => "an" |
16:40:33 | FromDiscord | <Cheesy Brik> (edit) "need" => "needed" |
16:42:35 | FromDiscord | <Phil> The thing is that even in terms of basic comparisons synthetic benchmarks will surprise you |
16:42:47 | FromDiscord | <dom96> You typically can't go wrong with any compiled language when it comes to performance. |
16:42:56 | FromDiscord | <dom96> But if you really want some benchmarks: https://www.techempower.com/benchmarks/#section=data-r21&test=json |
16:43:02 | FromDiscord | <dom96> Nim is #12 there |
16:43:11 | FromDiscord | <Phil> Let me find the most hilarious web-framework benchmarks |
16:43:14 | * | neceve_ joined #nim |
16:43:26 | FromDiscord | <Phil> I do recall some JS server being ridiculously high up there in one of them |
16:43:34 | * | neceve quit (Ping timeout: 260 seconds) |
16:43:45 | FromDiscord | <Phil> Oh, httpbeast still at the top spot, lol |
16:44:59 | FromDiscord | <Phil> Average Latency has almost half a dozen java webservers beat out cpp is a funny one https://media.discordapp.net/attachments/371759389889003532/1038856538070208532/image.png |
16:45:18 | FromDiscord | <dom96> yeah, it's pretty amazing nobody has beat it yet in Nim-land. I've mostly left it untouched since 2018. |
16:45:36 | FromDiscord | <Cheesy Brik> Is there a web assembly framework for nim yet, even tho web assembly is kinda still a bit new |
16:45:44 | FromDiscord | <Phil> Similarly you have ruby, php and js beating out cpp in minimum latency https://media.discordapp.net/attachments/371759389889003532/1038856720048472154/image.png |
16:54:18 | * | Jjp137 quit (Ping timeout: 255 seconds) |
16:56:13 | FromDiscord | <auxym> In reply to @Cheesy Brik "Man that sucks, it’s": Nim does have first-class procs, if that's what you mean. You can take procs as proc arguments, or return procs from procs, etc. As for the types, see here: https://nim-lang.org/docs/manual.html#types-procedural-type |
16:57:17 | FromDiscord | <Cheesy Brik> In reply to @auxym "Nim *does* have first-class": Ah ok, could I redefine a proc namespace like myNewProc = oldProc? |
16:57:57 | FromDiscord | <Phil> In reply to @Cheesy Brik "Ah ok, could I": Ohhhh I thought you meant stuff like you can do in python where you can literally manipulate the contents of function params or crap like that at runtime |
16:58:10 | FromDiscord | <Phil> If you just want to be able to generate procs or the like, yeah nim can do that |
16:58:32 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "Ohhhh I thought you": Yeh I know what you mean, I’ve never found a use case for that |
16:58:33 | FromDiscord | <Phil> You can pass them as parameters, generate them, assign them to variables, store them in hashmaps etc. |
16:58:40 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "You can pass them": Nice |
16:58:59 | FromDiscord | <Cheesy Brik> That reminds me, what’s the hash map syntax in nim |
16:59:01 | FromDiscord | <Phil> In reply to @Cheesy Brik "Nice": Note though that due to static typing, if you store them in hashmaps, all procs in there will have to be of the same signature |
16:59:02 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4f8j |
16:59:16 | FromDiscord | <auxym> you can then assign to `p` any proc that fits its signature (proc type) |
16:59:53 | FromDiscord | <auxym> In reply to @Cheesy Brik "That reminds me, what’s": see the std/tables module docs |
17:00:16 | FromDiscord | <Cheesy Brik> In reply to @auxym "see the std/tables module": 👍 |
17:00:29 | FromDiscord | <Phil> Instantiation has many ways, for accessing them it's the usual `table["key"]` and `table["key"] = newvalue` |
17:02:36 | FromDiscord | <Phil> Funny sidenote on that one |
17:02:42 | FromDiscord | <Phil> `[]` and `[]=` are also just procs |
17:02:49 | FromDiscord | <Phil> That you can redefine if you want |
17:03:39 | FromDiscord | <Phil> Or can define for any other type you want if you want something to behave like a table and you want to store it away in some other manner |
17:04:14 | FromDiscord | <Cheesy Brik> What’s the `` syntax mean in nim |
17:04:29 | FromDiscord | <Phil> Backtick syntax? |
17:05:00 | FromDiscord | <Cheesy Brik> Yeh what’s that used for |
17:05:06 | FromDiscord | <Phil> Ohhhh that is for symbols such as $ |
17:05:28 | FromDiscord | <Phil> proc \`$\` basically just means you're defining a proc that is called "$" |
17:05:39 | FromDiscord | <Cheesy Brik> Ah ok |
17:05:45 | FromDiscord | <Phil> That's the typical "toString" for nim btw |
17:05:48 | Amun-Ra | you making special symbols "plain" |
17:05:53 | Amun-Ra | you're* |
17:06:03 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "That's the typical "toString"": Yeh I knew that |
17:07:43 | FromDiscord | <Cheesy Brik> You know what I’ve always wanted to see in a language, being able to iterate on a plain int, so `for i in 10` is the same as `for i in 0..10` |
17:10:22 | FromDiscord | <auxym> In reply to @Cheesy Brik "You know what I’ve": you've come to the right place https://play.nim-lang.org/#ix=4f8n |
17:11:27 | FromDiscord | <Cheesy Brik> In reply to @auxym "you've come to the": :0, what is the items iterator, is it called when ever converting a on object to an iterator? |
17:11:37 | FromDiscord | <Cheesy Brik> (edit) "a on" => "an" |
17:12:40 | FromDiscord | <auxym> yeah, it's sort of a magic name in nim. When iterating over something that is not already an iterator, nim attempts to call an `items` iterator |
17:13:06 | FromDiscord | <Phil> Similarly echo x will try to call echo $x |
17:13:12 | FromDiscord | <Phil> if x is not a string |
17:13:18 | FromDiscord | <auxym> see also `pairs` https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implicit-itemsslashpairs-invocations |
17:13:26 | FromDiscord | <Cheesy Brik> Ah ok, so kinda like a dunder in python , is there a list of those somewhere? |
17:14:11 | FromDiscord | <auxym> the manual is the most complete reference I guess. what's a dunder though? I know python pretty well but never heard that name |
17:14:22 | FromDiscord | <Phil> Python is a protocol driven language |
17:14:34 | FromDiscord | <Phil> There are a set of specific pre-defined methods that implement certain protocols |
17:14:44 | FromDiscord | <auxym> python has "magic" double-underscore functions like `call`, `add` etc |
17:15:24 | FromDiscord | <Phil> e.g. if you implement `str()` for an object type your type will always work in str(yourtype) calls etc. |
17:15:36 | FromDiscord | <Phil> in nim you don't really bother, `+` is just a proc |
17:15:38 | FromDiscord | <Cheesy Brik> In reply to @auxym "python has "magic" double-underscore": Dunder comes from “double underscore” :) |
17:15:44 | FromDiscord | <auxym> oh 🙂 |
17:16:24 | FromDiscord | <Cheesy Brik> Anyways is there a list of procs/methods like that or is it just look through the manual and find out |
17:17:30 | FromDiscord | <Phil> I don't think so. Keep in mind that like half the things that would be dunder methods in python to make things work with like`+`, `-` etc don't apply to nim since you would just define a `+`proc directly |
17:18:04 | FromDiscord | <auxym> off the top of my head, there aren't that many anyways. in fact I can't think of anything except `$` and pairs/items. Like Phil said, operator overloading is implemented by writing a proc with backticks |
17:19:05 | FromDiscord | <Cheesy Brik> In reply to @auxym "off the top of": Does this work with custom symbols or only predefined ones |
17:19:10 | FromDiscord | <Phil> That makes it ironically more flexible than python in that regard, since you can define behaviour for example of what should happen if you try to add a database connection to a string or other silly things like that |
17:19:44 | FromDiscord | <auxym> there's converters I guess which allow you to implicitly convert any type to any other type. no special naming though, they are just defined like procs but with the `converter` keyword instead of proc/func |
17:20:15 | FromDiscord | <Phil> In reply to @Cheesy Brik "Does this work with": You can write your own `+` proc for any arbitrary combination of types |
17:20:16 | FromDiscord | <Rika> then you dont get the dumb "radd" vs "add" issue |
17:20:22 | FromDiscord | <Rika> issue -> confusion |
17:20:54 | FromDiscord | <Cheesy Brik> In reply to @Isofruit "You can write your": Heh nice |
17:21:12 | FromDiscord | <auxym> In reply to @Cheesy Brik "Does this work with": https://nim-lang.org/docs/manual.html#lexical-analysis-operators you can make any combination of them however, like you could implement your own `&?--` operator |
17:21:14 | FromDiscord | <Cheesy Brik> In reply to @Rika "then you dont get": Yes |
17:21:56 | FromDiscord | <Cheesy Brik> In reply to @auxym "https://nim-lang.org/docs/manual.html#lexical-analy": Could I use any Unicode char? Like dumb example `€` |
17:22:20 | FromDiscord | <auxym> yes but IIRC it's still considered experimental |
17:22:31 | FromDiscord | <auxym> https://nim-lang.org/docs/manual.html#lexical-analysis-unicode-operators |
17:22:52 | FromDiscord | <Cheesy Brik> In reply to @auxym "yes but IIRC it's": An ok |
17:22:58 | FromDiscord | <Cheesy Brik> (edit) "An" => "Ah" |
17:23:02 | FromDiscord | <auxym> so it might get removed in future versions, no stability guarantee, etc |
17:24:26 | * | jjido joined #nim |
17:24:44 | FromDiscord | <Cheesy Brik> Ah |
17:25:00 | FromDiscord | <Cheesy Brik> How actively is nim still devolved since it’s like 15 years old |
17:25:05 | FromDiscord | <huantian> Unicode ops is coming in 2.0 |
17:25:36 | FromDiscord | <huantian> As a stable feature |
17:26:32 | NimEventer | New thread by mantielero: Wrapping c++ function - cannot instantiate 'T2', see https://forum.nim-lang.org/t/9581 |
17:30:14 | FromDiscord | <Saint> https://github.com/zevv/npeg |
17:30:28 | FromDiscord | <Saint> Anyone used this much? Or anyone used Raku Grammars much? |
17:30:34 | FromDiscord | <Saint> Just hoping to find a sort of overlap |
17:36:18 | FromDiscord | <Cheesy Brik> Does nim get rid of unused procs and vars so using large libraries with many unused procs isn’t a slow down? |
17:36:20 | FromDiscord | <Saint> By that I mean if someone is familiar with both of them |
17:36:34 | FromDiscord | <Saint> In reply to @Cheesy Brik "Does nim get rid": I'm sure the compiler does that |
17:36:59 | FromDiscord | <Saint> Actually that probably isn't true, I don't know |
17:39:00 | FromDiscord | <Cheesy Brik> In reply to @Cheesy Brik "Does nim get rid": Asking cuz I wanna create a personal utils library but don’t want unnecessary slow down |
17:40:07 | FromDiscord | <demotomohiro> @Cheesy Brik Died code elimination is turn on in -d:release |
17:40:22 | FromDiscord | <Cheesy Brik> Thx |
17:43:08 | FromDiscord | <demotomohiro> And you can read assembly code generated by backend C compiler with `--asm` option and you can see if unused variables are removed. |
17:48:45 | Zevv | Saint: I use npeg every now and then, what's up |
17:51:39 | Zevv | don't know anything about Raku Grammars though |
17:51:58 | * | kenran joined #nim |
17:57:35 | FromDiscord | <Saint> In reply to @Zevv "<@890692135827959919>: I use npeg": Oh cool, yeah I was playing a bit with Raku's Grammar, cause people were saying it's like regex on steroids or good for text processing, but then when I discovered this for nim I was wondering if it's still worth to build stuff in Raku for the regex/text processing stuff first or just do it all in nim |
17:58:09 | FromDiscord | <Saint> Zevv: Maybe I could ask you, how good is npeg as a sort of drop in for a bit more advanced regex? |
17:58:12 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4f8y |
17:58:31 | FromDiscord | <Cheesy Brik> In reply to @ShalokShalom "You mean developed? ": Yeh lmao, cool |
17:59:12 | FromDiscord | <Saint> The syntax seems pretty diff from regex, which is what Raku's grammars basically build off of, but maybe that's for the better? |
17:59:42 | Zevv | to start with, it's more verbose than regular expressions of course |
18:00:07 | Zevv | but there's a bit more to that; regexps are great for small tasks, doing one thing |
18:00:21 | * | kenran quit (Remote host closed the connection) |
18:00:23 | Zevv | but PEGs allow you to build up a grammar and reuse rules |
18:00:26 | Zevv | allowing for recursion |
18:00:38 | Zevv | and with npeg, you can freely mix and match the grammar definition and Nim code |
18:01:11 | Zevv | it's not ment to be a better regexp or to replace regular expressions, they both have their place |
18:05:51 | FromDiscord | <Saint> sent a code paste, see https://play.nim-lang.org/#ix=4f8A |
18:06:19 | FromDiscord | <Cheesy Brik> To me it just seems like a implementation of standard parser grammar |
18:06:22 | FromDiscord | <Saint> I meant they use a lot of standard regex notation, and you just build higher level tokens and so on |
18:06:50 | FromDiscord | <Saint> Yeah, I mean regex can also I think parse any language too, just gets unwieldy (?) |
18:06:58 | FromDiscord | <Saint> I guess that should answer my question |
18:07:06 | Zevv | looking at raku grammars, I think it's kind of the same philosphy |
18:07:17 | Zevv | it's not strictly peg, but that's not a good or bad thing |
18:08:12 | Zevv | the one thing npeg can do and raku grammars can not |
18:08:20 | Zevv | is draw nifty railroad graphs |
18:08:28 | Zevv | because, who doesn't like graphs, right |
18:09:15 | Zevv | https://play.nim-lang.org/#ix=4f8A |
18:09:24 | Zevv | no wrong url, http://zevv.nl/div/graph.png that one |
18:13:47 | FromDiscord | <Saint> In reply to @Zevv "no wrong url, http://zevv.nl/div/graph.png": Oh this is so cool! |
18:13:55 | Zevv | i know right |
18:13:57 | FromDiscord | <Saint> Yeah Raku's output is not that clean, pretty hard to read actually |
18:14:06 | FromDiscord | <Saint> They do it more vertically and it becomes a mess |
18:14:21 | FromDiscord | <Saint> This looks extremely legible |
18:22:07 | FromDiscord | <!!sharpcdf!!> In reply to @sharpcdf "i am extremely sad": Huge shoutout to ugit on GitHub, I got the conflicts to revert |
18:22:20 | FromDiscord | <Arouzing> Hello! rather new to nim, but loving it so far! this language will be a great tool for my custom linux tooling. I also recently found a great article that shows how to compile with musl on nim! was rather fun to get working. |
18:22:25 | FromDiscord | <!!sharpcdf!!> Just gotta figure out how to get the rest of that shit to push to the repo |
18:31:07 | FromDiscord | <huantian> In reply to @Arouzing "Hello! rather new to": Awesome to hear that! |
18:58:17 | FromDiscord | <Cheesy Brik> Want to experiment with a good gui library, anyone got one? |
19:01:08 | FromDiscord | <that_dude> In reply to @Cheesy Brik "Want to experiment with": https://github.com/nim-lang/Nim/wiki/Curated-Packages#gui is usually the goto recomendation to look at. |
19:02:45 | FromDiscord | <that_dude> To me fidget and https://github.com/ansiwave/nimwave seemed the most promising |
19:03:24 | FromDiscord | <Cheesy Brik> Weird question, could I have a nim file, compile nim code? As in it takes in nim code and compiles it. Ofc I could use the command, but I want it to be independent of having nim installed. |
19:04:01 | FromDiscord | <SREagle> sent a long message, see http://ix.io/4f8W |
19:04:43 | * | LuxuryMode joined #nim |
19:07:30 | * | Jjp137 joined #nim |
19:10:37 | * | krux02 joined #nim |
19:12:32 | FromDiscord | <that_dude> In reply to @Cheesy Brik "Weird question, could I": If you mean in more of an interpreter way, I do think yes, https://forum.nim-lang.org/t/1319, https://forum.nim-lang.org/t/7477 may be helpful in that avenue |
19:13:41 | * | PMunch joined #nim |
19:14:18 | FromDiscord | <Cheesy Brik> In reply to @that_dude "If you mean in": No I mean actually make a new exe file, I know it’s weird but it’s a for a fun idea I have. |
19:15:45 | FromDiscord | <SREagle> uhm, if you complied a nim script, this normally results in an exe which does not need nim installed?! I fail to understand you need, it seems... |
19:16:03 | FromDiscord | <SREagle> (edit) "complied" => "compiled" | "script," => "soure file," |
19:16:11 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
19:16:21 | FromDiscord | <Cheesy Brik> In reply to @SREagle "uhm, if you compiled": I mean a nim file that can create exe files from nim code |
19:17:00 | FromDiscord | <that_dude> IIrc if you import and use the right things, you can include the nim compiler into the exe to evaluate things (I do think it's limited to nimscript) as a standalone exe |
19:17:30 | FromDiscord | <that_dude> but otherwise it sounds like you're just repackaging the compiler? |
19:17:49 | FromDiscord | <Cheesy Brik> In reply to @that_dude "but otherwise it sounds": Yeh ik, I might just do that |
19:17:53 | FromDiscord | <Cheesy Brik> Is that legal? |
19:18:12 | FromDiscord | <that_dude> 99.9% of nim is mit licensed so yeah if you can figure it out |
19:18:27 | FromDiscord | <Cheesy Brik> Yeh I’ll experiment with it |
19:18:33 | FromDiscord | <that_dude> I believe the whole compiler is mit too |
19:19:33 | * | jjido joined #nim |
19:24:28 | PMunch | @that_dude, it's not limited to NimScript |
19:24:58 | PMunch | Take nimsuggest for example, it imports the compiler to evaluate the Nim code given from the editor and report errors and such |
19:28:08 | PMunch | This is probably a good place to start, it's the start of the compiler itself, where the command line is parsed and compilation kicked of: https://github.com/nim-lang/Nim/blob/devel/compiler/nim.nim |
19:52:29 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
20:01:42 | FromDiscord | <Phil> Every other week or so I keep getting interested into writing a normal gui app.↵Then I see the examples and how the structure of the application is within the code itself, I realize how annoying that likely is to keep the code that declares the interface properly separated from the business logic surrounding the data I want to show and said interest takes a massive hit |
20:02:17 | FromDiscord | <Phil> (edit) "the application" => "a GUI page" |
20:02:41 | FromDiscord | <Phil> (edit) "show" => "render into the interface" |
20:02:52 | FromDiscord | <Phil> (edit) "said" => "my initial" |
20:04:09 | Zevv | PMunch: is proc `[]`*[S](cs: Captures[S], range: HSlice[system.int, system.int]): seq[Capture[S]] enough? |
20:04:23 | Zevv | or do I need more than that? your title says "operators", not "operator" :) |
20:06:33 | FromDiscord | <Phil> Wait, no, I think I may have missunderstood, so QML is basically like HTML, you pass it a context to render stuff and it renders it then I guess |
20:08:38 | FromDiscord | <ShalokShalom> In reply to @Cheesy Brik "Want to experiment with": Godot 3 |
20:09:21 | FromDiscord | <Cheesy Brik> Lmao, love godot, but want a pure nim library |
20:09:40 | * | tanami joined #nim |
20:10:54 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4f96 |
20:11:14 | FromDiscord | <ShalokShalom> You can theoretically code all in .qml with Javascript for the logic, but its discouraged. |
20:12:03 | * | jjido joined #nim |
20:12:06 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4f97 |
20:13:07 | FromDiscord | <ShalokShalom> In reply to @Cheesy Brik "Weird question, could I": You mean, without comping it to C, C++ etc first?↵↵There is a pure llvm compiler |
20:13:41 | FromDiscord | <Cheesy Brik> In reply to @ShalokShalom "You mean, without comping": No idrc I just want it to make an exe out of it |
20:13:47 | FromDiscord | <ShalokShalom> https://github.com/arnetheduck/nlvm |
20:13:49 | FromDiscord | <Phil> In reply to @ShalokShalom "Qml is a superset": Are QML only capable of using code defined within the QML for actions. Explicit example: Can a QML file trigger a nim proc if a button is clicked ? |
20:14:24 | FromDiscord | <Phil> From what I'm seeing so far you have the "backend language" (nim) providing a context for the QML file to draw the data from to render |
20:23:41 | FromDiscord | <sOkam!> Talking about gui, has anyone worked with nuklear in Nim?↵There are like 3-4 bindings, but all seem super abandoned |
20:24:27 | FromDiscord | <sOkam!> (edit) "Talking about gui, has anyone worked with nuklear in Nim?↵There are like 3-4 bindings, but all seem super abandoned ... " added "_(unless i misunderstood, and some behave well, which is why im asking)_" |
20:24:43 | FromDiscord | <Elegantbeef> They're almost all abandoned |
20:24:56 | FromDiscord | <Elegantbeef> Dont know if any work |
20:25:00 | FromDiscord | <sOkam!> should futhark be able to handle nuklear? |
20:25:09 | FromDiscord | <Elegantbeef> Likely |
20:25:19 | FromDiscord | <Elegantbeef> It handles many C libraries |
20:25:25 | FromDiscord | <sOkam!> last time i tried with another codebase, i found a lot of issues and support was hard to find |
20:25:49 | FromDiscord | <sOkam!> but yeah, should try at some point |
20:27:18 | FromDiscord | <Elegantbeef> Futhark is relatively easy to use and support is just screaming "Pmunch" three times in a mirror or asking here |
20:30:07 | FromDiscord | <sOkam!> Yeah, for some reason back then the screaming in the mirror didn't work 🙂↵I wish I remembered why that was. Goldfish life 🐠 |
20:36:09 | FromDiscord | <albassort> What is the fastest way to filter an array based on a prefix of an input |
20:36:21 | FromDiscord | <albassort> Animal↵Ani |
20:37:22 | FromDiscord | <Elegantbeef> `var a = myColl.filterIt(it.startsWith("ani"))` |
20:37:29 | FromDiscord | <albassort> Speed normally wouldn't matter but the array is like 200000 items long |
20:38:12 | FromDiscord | <albassort> In reply to @Elegantbeef "`var a = myColl.filterIt(it.startsWith("ani"))`": But I'm performance critical |
20:38:19 | FromDiscord | <Elegantbeef> So then dont filter it |
20:38:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f9g |
20:38:50 | FromDiscord | <albassort> Filter was used in the English sense not in the programming sense |
20:39:37 | FromDiscord | <Elegantbeef> You can also multithread this and have a thread handle X amount of entries |
20:40:28 | FromDiscord | <albassort> Yeah I'm already using a similar threading architecture in my code I can just repurpose it |
20:41:07 | FromDiscord | <albassort> I still need to write macros for my threads to make my life easier |
20:43:37 | FromDiscord | <Elegantbeef> Uhh |
20:43:52 | FromDiscord | <albassort> I know I've been saying that for a year now |
20:43:58 | FromDiscord | <albassort> Macros are scary okay |
20:44:04 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4f9h |
20:44:20 | FromDiscord | <Elegantbeef> I dont know why a macro is really needed for threading in this case |
20:44:28 | FromDiscord | <albassort> No just generally |
20:44:40 | FromDiscord | <albassort> Just to make the code more compact |
20:44:56 | FromDiscord | <ShalokShalom> In reply to @Isofruit "From what I'm seeing": But usually, when you use a backend language like Nim, you tend to use it for all logic |
20:44:57 | FromDiscord | <albassort> I have never needed a macro |
20:45:03 | FromDiscord | <ShalokShalom> As far as I understand |
20:45:20 | FromDiscord | <Phil> In reply to @ShalokShalom "But usually, when you": Yeah but that means you need to be able to trigger updates |
20:45:23 | FromDiscord | <ShalokShalom> In reply to @albassort "I have never needed": You probably used some unknowingly |
20:45:28 | FromDiscord | <Phil> Which means you need to trigger nim procs from inside of QML |
20:45:33 | FromDiscord | <Elegantbeef> You can just write the code more compact without macros |
20:45:33 | FromDiscord | <Elegantbeef> There are multiple things you can do before you jump to a macro |
20:45:47 | FromDiscord | <albassort> In reply to @ShalokShalom "You probably used some": I use a few, but I meant for my purposes of writing one |
20:46:20 | FromDiscord | <Phil> Personally, unless it makes the code more readable I'd use macros for that rather than just making code more compact |
20:46:34 | FromDiscord | <albassort> It makes it more readable and compact |
20:46:44 | FromDiscord | <Elegantbeef> Always use the simplest tool... cmon people |
20:46:46 | FromDiscord | <Elegantbeef> Like what's the code we're shrinking |
20:46:50 | FromDiscord | <Phil> An example where "compactness" can reach questionable levels imo is jester. Because there you can do in 7 lines and a lot of the stuff it does is hidden |
20:46:54 | FromDiscord | <albassort> I just want to write some macros to handle the typing |
20:47:15 | FromDiscord | <Phil> (edit) "An example where "compactness" can reach questionable levels imo is jester. Because there you can do ... in" added "an entire server with an endpoint" |
20:47:22 | FromDiscord | <albassort> I also really don't like that you pass tuples and I want to just completely automate that to make code look prettier |
20:47:23 | FromDiscord | <ShalokShalom> In reply to @Cheesy Brik "No idrc I just": Well, the Nim compiler does this? |
20:47:31 | FromDiscord | <ShalokShalom> This is the default way of doing things |
20:47:41 | FromDiscord | <ShalokShalom> Or do you mean an exe, like in Windows? |
20:48:03 | FromDiscord | <ShalokShalom> Idk what Nim produces on Windows, maybe an .exe anyway? |
20:48:12 | FromDiscord | <Elegantbeef> Obviously it creats an exe |
21:09:02 | FromDiscord | <Cheesy Brik> Malwarebytes is saying it found a file called Trojan.ReverseShell in a compiled nim file, something I should I worry about?? |
21:09:55 | FromDiscord | <Elegantbeef> No, Nim gets falsely flagged as it's commonly used to write malware |
21:09:58 | FromDiscord | <Elegantbeef> Go has the same problem |
21:10:38 | FromDiscord | <Cheesy Brik> Ah alr, yeh I just set my nim program folder as a allow area |
21:13:49 | FromDiscord | <Cheesy Brik> Ok now I'm getting an error, `could not load: pcre64.dll` |
21:17:30 | FromDiscord | <albassort> In reply to @Elegantbeef "No, Nim gets falsely": No it's not. One guy did it |
21:20:22 | FromDiscord | <Cheesy Brik> In reply to @Cheesy Brik "Ok now I'm getting": nvm i think malware bytes removed nims path vars, reinstall fixed it 👍 |
21:20:53 | FromDiscord | <Elegantbeef> "One guy did it"?↵(@albassort) |
21:21:11 | FromDiscord | <albassort> There was like one article about it a year ago |
21:21:30 | PMunch | Zevv, sorry I was off watching handball. I think that would suffice, but I'm not sure how HSlice's are made considering BackwardsIndex |
21:21:47 | FromDiscord | <albassort> And now everyone who knows nothing about nim but believes they are educated, thinks that nim is primarily used for malware |
21:22:00 | FromDiscord | <Elegantbeef> Are you ok? |
21:22:14 | FromDiscord | <Elegantbeef> https://github.com/byt3bl33d3r/OffensiveNim is a relatively common path to Nim-lang.org |
21:22:26 | PMunch | sOkam, could have been early days of the library, hopefully more stuff works out of the box now :) |
21:23:27 | PMunch | Anyways, I'm off for tonight |
21:23:38 | * | PMunch quit (Quit: leaving) |
21:29:26 | FromDiscord | <ChocolettePalette> Ngl I was about to write a malware in Nim |
21:29:35 | FromDiscord | <Cheesy Brik> How can i let a template take in a symbol? |
21:29:46 | FromDiscord | <Elegantbeef> `name: untyped` |
21:29:51 | FromDiscord | <Elegantbeef> or `name: typed` |
21:31:51 | FromDiscord | <Cheesy Brik> It says it's expecting an expression |
21:32:13 | FromDiscord | <Elegantbeef> What are you trying to do |
21:32:36 | FromDiscord | <ChocolettePalette> It would've been about a so called "Amogus"\: starting a daemon which would pop-under transparent windows w/o decorations playing GIFs of amogus running AND also playing that based amogus song until you click those. But it was too difficult so I changed my mind to be a cracker/hacker/etc maybe someone might adopt and implement my idea |
21:32:50 | FromDiscord | <Cheesy Brik> sent a code paste, see https://play.nim-lang.org/#ix=4f9L |
21:33:19 | FromDiscord | <Elegantbeef> You mean an operator not a symbol, got it |
21:33:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4f9M |
21:33:36 | FromDiscord | <Cheesy Brik> oh alr, |
21:33:49 | FromDiscord | <Elegantbeef> also you'll want to do `sym(a, b)` |
21:37:43 | FromDiscord | <Elegantbeef> Unrelated to the template but dont do `a = a + b` for strings |
21:37:56 | FromDiscord | <Elegantbeef> It's much slower than `a.add b` |
21:38:14 | FromDiscord | <Elegantbeef> Assuming you do `+` as an alias to `&` |
21:39:09 | FromDiscord | <Cheesy Brik> In reply to @Elegantbeef "It's much slower than": doesn't add only work with chars |
21:39:17 | FromDiscord | <Elegantbeef> No it works with strings aswell |
21:40:22 | FromDiscord | <Cheesy Brik> but not with anonymous strings |
21:41:15 | FromDiscord | <Elegantbeef> What? |
21:41:37 | FromDiscord | <Cheesy Brik> .add only works with var strings |
21:42:05 | FromDiscord | <Elegantbeef> Yes? |
21:42:14 | FromDiscord | <Elegantbeef> `&` is used for joining two strings together |
21:43:02 | FromDiscord | <Elegantbeef> It's also immutable vs. mutable strings |
21:43:09 | FromDiscord | <Elegantbeef> var is mutable |
21:45:49 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
21:58:50 | FromDiscord | <ChocolettePalette> So strings can be mutable and immutable? Why did I think that they all were immutable? Because of Python? |
21:59:07 | FromDiscord | <Elegantbeef> Likely in Nim strings are just null terminated character sequences |
22:00:43 | FromDiscord | <Cheesy Brik> Just having fun https://media.discordapp.net/attachments/371759389889003532/1038935989776814260/image.png |
22:01:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fa0 |
22:01:27 | FromDiscord | <ChocolettePalette> Why does it \~? o.o↵(@Cheesy Brik) |
22:01:53 | FromDiscord | <Elegantbeef> They're just aliasing operators |
22:02:16 | FromDiscord | <ChocolettePalette> But it underlined it with a yellow \~ |
22:02:25 | FromDiscord | <ChocolettePalette> Must be a warning or smth |
22:02:31 | FromDiscord | <Elegantbeef> unused |
22:02:36 | FromDiscord | <ChocolettePalette> Ah! |
22:04:12 | FromDiscord | <Cheesy Brik> Yeh creating a utils library for myself |
22:05:28 | FromDiscord | <ChocolettePalette> You might want to put a \ after your `%` to make it an exportable proc or operator to use in other modules |
22:07:19 | FromDiscord | <Cheesy Brik> In reply to @ChocolettePalette "You might want to": Oh yeh forgot about exporting |
22:27:17 | FromDiscord | <Cheesy Brik> How to define unary symbol procs? |
22:31:00 | FromDiscord | <Cheesy Brik> How would I type in a func to do any type except one type |
22:31:15 | FromDiscord | <Cheesy Brik> Like take any type expect a string |
22:41:13 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=4fae |
22:41:25 | FromDiscord | <Cheesy Brik> thx |
22:52:25 | FromDiscord | <Cheesy Brik> I'm surprised this implementation isn't already in the random module `proc randomize[T: not int64](seed:T) = randomize(hash(seed))` |
23:21:01 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4fan |
23:21:29 | FromDiscord | <voidwalker> any idea what this "url-encoded" thing is ? It's not the urlencode in the uri lib |
23:24:09 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4fap |
23:27:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4faq |
23:39:03 | FromDiscord | <System64 ~ Flandre Scarlet> Thanks! |
23:39:53 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4fas |
23:48:11 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4fav |
23:53:47 | FromDiscord | <System64 ~ Flandre Scarlet> nevermind, I fixed it |
23:58:42 | FromDiscord | <demotomohiro> @Cheesy Brik How about to use type class? https://nim-lang.org/docs/manual.html#generics-type-classes |