00:02:01 | * | FromDiscord quit (Remote host closed the connection) |
00:02:16 | * | FromDiscord joined #nim |
00:07:05 | ldlework | When trying to mutate a field on my object type, I'm getting: Error: attempting to call undeclared routine: 'output=' |
00:07:09 | ldlework | What am I supposed to do? |
00:07:24 | ldlework | Are objects immutable? |
00:07:36 | Prestige | If they are declared with var they are mutable |
00:08:08 | ldlework | the fields or the object |
00:08:19 | Prestige | The object |
00:08:24 | ldlework | I have it defined like: var testCase: Case |
00:08:29 | ldlework | then I do testCase.output = "some tring" |
00:08:33 | ldlework | and get the error above |
00:08:41 | * | chemist69_ quit (Ping timeout: 272 seconds) |
00:08:48 | Prestige | can u show the code in a snippet on play.nim-lang.org? |
00:09:22 | * | chemist69 joined #nim |
00:10:11 | ldlework | oh the problem is that field doesn't exist |
00:10:14 | ldlework | :) |
00:17:09 | * | nekits quit (Quit: The Lounge - https://thelounge.chat) |
00:18:04 | * | nekits joined #nim |
00:37:16 | FromDiscord | <él liquido> @willyboar PMunch is compiling a proc with *308* million args |
00:39:04 | * | fredrikhr quit (Ping timeout: 256 seconds) |
00:39:25 | FromDiscord | <willyboar> Yes i know 😛 |
00:40:23 | FromDiscord | <willyboar> I wanted to tickle @mratsim because said 3 mil 😦 |
01:05:57 | * | chemist69 quit (Ping timeout: 256 seconds) |
01:07:42 | * | chemist69 joined #nim |
01:12:21 | * | FromDiscord quit (Remote host closed the connection) |
01:12:35 | * | FromDiscord joined #nim |
01:25:11 | * | oddp quit (Ping timeout: 260 seconds) |
01:32:35 | * | Tongir joined #nim |
01:34:59 | * | Tlanger quit (Ping timeout: 260 seconds) |
02:04:19 | * | dddddd quit (Ping timeout: 246 seconds) |
02:05:18 | * | silvernode quit (Quit: Konversation terminated!) |
02:05:31 | * | silvernode joined #nim |
02:16:14 | * | muffindrake quit (Ping timeout: 256 seconds) |
02:18:01 | * | muffindrake joined #nim |
02:30:19 | FromDiscord | <InventorMatt> I am trying to use the asyncdispatch library and when I use await on the proc I am using I get "Error: Await only available within .async" as an error. the proc I am using has the async pragma attached so does anyone have an idea for a solution? |
02:38:56 | shashlick | is the marshal module not able to handle references? |
02:39:16 | shashlick | $$ works but to[Type] complains |
02:53:17 | leorize[m] | @InventorMatt can we see the code? |
02:55:36 | FromDiscord | <InventorMatt> here is the small library I update to work with modern nim https://play.nim-lang.org/#ix=2oN0 |
02:55:51 | FromDiscord | <InventorMatt> and here is the tests code in which I receive the error https://play.nim-lang.org/#ix=2oN2 |
03:02:34 | FromDiscord | <Rika> @InventorMatt use waitfor instead |
03:02:39 | FromDiscord | <Rika> of await |
03:03:03 | FromDiscord | <Rika> await needs to be inside an async proc, if it isnt, use waitfor (will make the proc synchronous) |
03:03:26 | FromDiscord | <Rika> not that thats an issue from what i see in the code |
03:06:16 | FromDiscord | <InventorMatt> thanks that did solve that problem. |
03:07:37 | * | chemist69 quit (Ping timeout: 260 seconds) |
03:08:16 | FromDiscord | <InventorMatt> do you know what define used to do? it was in the old code and it says it has been deprecated but I don't know what I am supposed to replace it with? |
03:08:24 | * | chemist69 joined #nim |
03:20:40 | FromDiscord | <Rika> nope |
03:20:50 | FromDiscord | <Rika> someone else might now |
03:20:52 | FromDiscord | <Rika> (edit) 'now' => 'know' |
03:26:09 | shashlick | looks like marshal doesn't like it if a field points back to the object ref |
03:41:52 | leorize[m] | @InventorMatt it's the in-code version of the `-d:` switch |
03:42:11 | FromDiscord | <Rika> oh, its deprecated? |
03:42:37 | leorize[m] | it's undeprecated on devel btw :P |
03:42:42 | leorize[m] | don't worry too much about it |
03:48:34 | FromDiscord | <InventorMatt> thanks. |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:42 | * | supakeen joined #nim |
04:07:29 | * | NimBot joined #nim |
04:14:46 | FromGitter | <Knaque> Say I have an enum with a string value (i.e. `type MyEnum = enum One = "text1", Two = "text2"`). Is it still possible to get the name of the enum? |
04:15:34 | FromGitter | <Knaque> To elaborate, `echo One` prints "text1," but I'd like to be able to get both its name and value separately. |
04:18:57 | FromDiscord | <Rika> .repr? |
04:19:32 | FromDiscord | <Rika> nah, didnt work.. |
04:19:33 | * | rockcavera quit (Remote host closed the connection) |
04:21:12 | Tongir | Knaque: This may be what you need https://nim-lang.org/docs/strutils.html#parseEnum%2Cstring |
04:22:51 | Tongir | so parseEnum[MyEnum]("text2") should get you MyEnum.Two |
04:22:58 | FromDiscord | <Rika> Tongir: theyre looking to print the name of the enum, not get the value |
04:23:01 | FromDiscord | <Rika> from a string |
04:23:14 | FromGitter | <Knaque> Yeah, that doesn't quite look like what I'm looking for. |
04:23:15 | FromDiscord | <Elegant Beef> it's just .ord for the value |
04:23:35 | FromDiscord | <Elegant Beef> One.ord gets you the int value and One returns the string value |
04:23:36 | FromDiscord | <Rika> they mean the name of the enum entry, not the number value |
04:24:14 | FromDiscord | <Rika> so if they echo enumname(One) it should print "One" (enumname is for example, not real) |
04:24:22 | Tongir | Oh |
04:24:26 | Tongir | Haha |
04:24:28 | FromGitter | <Knaque> Rika is right on the money. |
04:25:54 | Tongir | Macro, perhaps |
04:26:57 | FromGitter | <Knaque> As someone with little understanding of metaprogramming, how might I do that? |
04:27:29 | * | stefantalpalaru quit (Quit: ZNC 1.7.5 - https://znc.in) |
04:27:29 | FromDiscord | <Elegant Beef> Well in this case the macro basically just returns the identifier |
04:27:50 | * | stefantalpalaru joined #nim |
04:27:57 | FromDiscord | <Elegant Beef> It's a weird thing to want the actual enum name |
04:28:02 | FromDiscord | <Elegant Beef> May i ask why you want that? |
04:28:08 | FromDiscord | <Rika> it wouldnt be able to do things like enumname(1.MyEnum) or enumname(parseEnum[MyEnum]("text1")) |
04:28:10 | Tongir | Yeah. The One is already an ordinal value of 0 (I think it starts at 0), but the field should be available in the AST |
04:28:40 | Tongir | I'll have a fiddle Knaque |
04:28:55 | FromGitter | <Knaque> Thanks Tongir. |
04:29:50 | FromGitter | <Knaque> As for why I need this, Elegant Beef, I don't really have a good answer to offer. I just think it's something I'll need for this project. |
04:36:31 | Tongir | Knaque: https://play.nim-lang.org/#ix=2oNe |
04:36:37 | Tongir | Maybe that does what you want |
04:37:46 | FromDiscord | <Elegant Beef> As rika pointed out↵https://play.nim-lang.org/#ix=2oNg |
04:38:39 | FromDiscord | <flywind> Maybe this |
04:38:43 | FromDiscord | <flywind> sent a long message, see http://ix.io/2oNh |
04:41:02 | FromGitter | <Knaque> Looks like that works! Thank you very much. |
04:43:47 | voltist | Is there a way to make DocGen put all the documentation from every module in a library into one page? |
04:46:22 | shashlick | Theindex |
04:48:38 | voltist | Fair enough :) |
04:51:14 | ldlework | I guild a unit-testing tool for Nixlang in Nimlang, https://github.com/nix-community/nixt |
04:51:17 | ldlework | built* |
04:53:09 | * | adnan338 joined #nim |
04:53:20 | FromDiscord | <Elegant Beef> Now imagine if you linked the repo properly 😄 |
04:53:34 | FromDiscord | <Elegant Beef> Or rather made it public |
04:53:47 | * | adnan338 quit (Client Quit) |
04:54:53 | FromDiscord | <Elegant Beef> I believe in you ldlework you can write `nix-community/nixt` |
04:55:22 | ldlework | have to wait for phone to charge so i can 2fa |
04:55:26 | FromDiscord | <Elegant Beef> Ah |
04:55:51 | FromDiscord | <Elegant Beef> Hopefully my jokes werent too condescending 😛 |
04:58:01 | Tongir | Elegantly condescending XD |
05:00:50 | ldlework | https://github.com/nix-community/nixt/ repo made public |
05:05:40 | * | solitudesf joined #nim |
05:06:21 | * | Senny quit (Ping timeout: 272 seconds) |
05:17:49 | FromDiscord | <Elegant Beef> I like your tests proc |
05:21:23 | * | bung joined #nim |
05:33:38 | * | narimiran joined #nim |
05:42:08 | * | kenran joined #nim |
05:50:47 | * | Tlanger joined #nim |
05:51:13 | * | Tongir quit (Ping timeout: 264 seconds) |
05:54:12 | * | Kaivo quit (Ping timeout: 265 seconds) |
05:55:17 | * | Kaivo joined #nim |
06:01:26 | * | PMunch joined #nim |
06:09:02 | * | Tongir joined #nim |
06:11:38 | * | Tlanger quit (Ping timeout: 256 seconds) |
06:18:02 | * | vesper quit (Quit: ZNC 1.7.5 - https://znc.in) |
06:18:22 | * | vesper11 joined #nim |
06:19:20 | PMunch | ldlework, Nixlang? |
06:19:40 | ldlework | Yeah the pure-lazy language that drives the Nix package manager / NixOS |
06:19:53 | ldlework | Nixt is a test-runner for that language, built in Nim |
06:20:20 | PMunch | Oh right, I was wondering if it had anything to do with Nix |
06:21:20 | FromDiscord | <Rika> pure-lazy? |
06:21:54 | ldlework | functionally pure (no-effects), lazily evaluated (non-strict) |
06:25:18 | * | tdc joined #nim |
06:25:24 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:27:45 | FromDiscord | <Zed> is there any way i can name an import? |
06:28:28 | FromDiscord | <Zed> like python where you can do this `import thing as e` |
06:29:25 | FromDiscord | <Elegant Beef> https://nim-lang.org/docs/manual.html#modules-from-import-statement |
06:29:41 | FromDiscord | <Elegant Beef> Man i cant read |
06:29:52 | PMunch | It's just "import X as Y": https://play.nim-lang.org/#ix=2oNw |
06:30:30 | FromDiscord | <Zed> ok that works |
06:31:01 | PMunch | And if you want qualified imports: https://play.nim-lang.org/#ix=2oNy |
06:31:38 | FromDiscord | <Zed> That's what i've been trying to do!! i was just writing it out |
06:31:48 | FromDiscord | <Elegant Beef> qualified imports == poo |
06:32:00 | FromDiscord | <Zed> why |
06:32:02 | FromDiscord | <Zed> ? |
06:32:32 | FromDiscord | <Elegant Beef> Well cause it interferes with the UFCS |
06:32:43 | FromDiscord | <Elegant Beef> but if you are using parameterless procs then it's no different |
06:33:01 | FromDiscord | <Zed> sometimes you dont want to import everything from a library |
06:33:08 | PMunch | But why? |
06:33:38 | * | tane_ joined #nim |
06:33:52 | FromDiscord | <Elegant Beef> `from module import proc` has you covered then |
06:33:55 | FromDiscord | <willyboar> Good morning |
06:34:03 | FromDiscord | <Elegant Beef> Gnight |
06:34:03 | FromDiscord | <Elegant Beef> :d |
06:34:27 | PMunch | Or if you just don't one specific thing because it clashes: https://play.nim-lang.org/#ix=2oNB |
06:35:14 | FromDiscord | <willyboar> Why such a hate with nim import system |
06:35:17 | FromDiscord | <Elegant Beef> Qualified imports are always weird to me coming from C# |
06:35:30 | FromDiscord | <willyboar> i personally never have a problem with |
06:35:31 | FromDiscord | <Elegant Beef> We have name spaces to divide code |
06:35:38 | FromDiscord | <Elegant Beef> In nim we have modules to do so |
06:36:32 | FromDiscord | <Elegant Beef> I could be wrong but if you're often including/excluding specific procs you could always make a module that exports the procs you want |
06:37:50 | FromDiscord | <Zed> do you mean we dont have namespaces? |
06:37:57 | FromDiscord | <Elegant Beef> No i meant in C# |
06:38:10 | FromDiscord | <Zed> ah |
06:38:24 | FromDiscord | <willyboar> > I could be wrong but if you're often including/excluding specific procs you could always make a module that exports the procs you want↵@Elegant Beef |
06:38:39 | FromDiscord | <willyboar> i seen it a lot |
06:38:40 | FromDiscord | <Elegant Beef> Now if you actually added something, that'd be great |
06:38:43 | FromDiscord | <Elegant Beef> Ah |
06:38:45 | FromDiscord | <Elegant Beef> Lol |
06:39:11 | FromDiscord | <Elegant Beef> Yea i dont often look a modules so, i just assumed it was possible |
06:39:11 | FromDiscord | <Zed> patience beef |
06:39:11 | FromDiscord | <willyboar> I like suspense 😛 |
06:39:27 | FromDiscord | <Elegant Beef> Patience when a textblock is yellow on my screen! |
06:39:35 | FromDiscord | <Zed> it's colourful |
06:43:00 | FromDiscord | <JSGrant> Idlework: Now we just need to rewrite everything else in Nim ... :^) |
06:43:14 | FromDiscord | <Elegant Beef> Yea just remake nixos in nim |
06:43:19 | FromDiscord | <Elegant Beef> You can do it in a weekend |
06:43:24 | FromDiscord | <willyboar> I started add web frameworks to the web framework benchmark |
06:43:50 | FromDiscord | <JSGrant> @Elegant Beef Don't cut yourself short, it'll only be like 10 hours lol |
06:44:08 | FromDiscord | <willyboar> Curious too see the results |
06:44:18 | FromDiscord | <willyboar> (edit) 'too' => 'to' |
06:45:40 | FromDiscord | <JSGrant> I tried to switch to NixOS like a dozen times over the past few-years, and there are many parts I really like -- but there's no way I see it winning long-term over Silverblue; The all-or-nothing nature of it is just brutal unless you are willing to invest 100% |
06:47:29 | FromDiscord | <JSGrant> Like I REALLY WISH Silverblue had some kind of declarative-config file; Home-manager is awesome, etc ... but really having that ability to "be mutable when convenient" for mass adoption. |
06:52:46 | * | letto quit (Quit: Konversation terminated!) |
06:53:30 | * | letto joined #nim |
06:54:38 | * | letto quit (Client Quit) |
06:55:12 | * | letto joined #nim |
06:55:29 | * | Guest16946 quit (Ping timeout: 245 seconds) |
07:02:55 | * | fredrikhr joined #nim |
07:05:51 | alehander92 | Araq thanks |
07:06:13 | alehander92 | for the compiler fix related tonested await |
07:13:05 | Araq | you're welcome |
07:50:56 | * | lritter joined #nim |
08:38:50 | * | Vladar joined #nim |
08:54:36 | * | sz0 quit (Ping timeout: 256 seconds) |
08:56:52 | * | sz0 joined #nim |
09:02:44 | FromDiscord | <Shucks> Where can https://nim-lang.org/docs/quitprocs.html be found? Tried to import `std/addQuitClosure` |
09:03:12 | FromDiscord | <Shucks> erm, `std/quitprocs` |
09:03:29 | FromDiscord | <Shucks> (edit) '`std/addQuitClosure`' => '`std/quitprocs`' |
09:04:46 | * | oddp joined #nim |
09:07:56 | Zevv | mratsim: I've been planning to make a CMA-ES implementation in Nim for a long time. I never properly understood the internals, but I use it quite often as a black-box. You know anything about that? |
09:08:32 | FromDiscord | <mratsim> It sounds like ECMAS(cript) |
09:08:37 | FromDiscord | <mratsim> but I'm sure it's not that |
09:08:39 | Zevv | haha, not quite :) |
09:08:41 | FromDiscord | <mratsim> so what is it? |
09:09:59 | Zevv | generic genetic algorithm. You ask it for a N-size vector of things, you do your test/simulation, pass back the error of your end result, and repeat until err is small enough |
09:10:06 | Zevv | https://en.wikipedia.org/wiki/CMA-ES |
09:10:41 | Zevv | it's usable for tons of funny stuff. There's often better algorithms fiting specific domains ,but this one seems to be the most optimal solution if you don't know what you're doing |
09:10:45 | Zevv | which is often the case with me |
09:12:33 | Zevv | The theory seems related to kalman filters |
09:14:13 | FromDiscord | <Rika> @Shucks it no longer exists |
09:14:47 | FromDiscord | <Rika> it seems |
09:15:07 | Zevv | "non-linear non-convex black-box optimisation" |
09:15:45 | FromDiscord | <Shucks> mh.. |
09:15:48 | FromDiscord | <Rika> https://github.com/nim-lang/Nim/issues/14331 |
09:15:49 | disbot | ➥ Documentation nonexistent quitprocs module |
09:16:31 | * | krux02 joined #nim |
09:16:42 | FromDiscord | <Rika> prolly in devel but not 1/2 |
09:16:43 | FromDiscord | <Rika> 1.2 |
09:17:31 | FromDiscord | <Rika> it sure is in devel |
09:19:10 | FromDiscord | <Shucks> Damn. So how could I realize `deinit2` since `quit` bypasses defer? https://play.nim-lang.org/#ix=2oOc |
09:19:25 | Yardanico | realise? |
09:20:02 | * | krux02 quit (Client Quit) |
09:20:34 | * | krux02 joined #nim |
09:21:13 | Yardanico | you can just copy this |
09:21:14 | Yardanico | also quitprocs isn't in devel either |
09:21:18 | Yardanico | sorry wrong text |
09:21:19 | Yardanico | https://github.com/nim-lang/Nim/blob/devel/lib/pure/quitprocs.nim |
09:21:24 | Yardanico | just copy this file and use it |
09:21:35 | Yardanico | it's really small |
09:23:07 | FromDiscord | <Shucks> True |
09:24:01 | krux02 | good morning |
09:25:19 | FromDiscord | <Rika> how is that not in devel |
09:25:21 | * | FromDiscord quit (Remote host closed the connection) |
09:25:36 | * | FromDiscord joined #nim |
09:25:37 | Yardanico | "sorry wrong text" |
09:26:08 | Yardanico | I sometimes mechanically copy the text I'm typing to edit it faster and stuff |
09:26:26 | FromDiscord | <Rika> "sorry wrong text" didnt make sense to me |
09:26:27 | FromDiscord | <Rika> okay |
09:33:16 | alehander92 | krux02 |
09:33:18 | alehander92 | morninng |
09:34:04 | * | neceve_ joined #nim |
09:35:34 | krux02 | good morning |
09:36:05 | krux02 | today I found out, that emacs has a builtin irc client. |
09:36:12 | krux02 | I am trying it out currentl. |
09:36:24 | krux02 | It works so far. |
09:36:52 | Yardanico | there's also a good third-party TDLib-based Telegram client (my emacs using acquaintance uses it) - telega.el |
09:38:38 | bung | does it has features more than a irc client ? |
09:38:49 | Yardanico | bung: telegram isn't IRC :P |
09:39:24 | alehander92 | wow interesting |
09:39:28 | bung | yeah, I should @krux02 |
09:39:30 | alehander92 | i havent tried using a vscode one |
09:39:38 | * | Vladar quit (Quit: Leaving) |
09:40:58 | bung | irc client could have code syntax highlight? |
09:48:12 | livcd | btw what's the situation with IC? |
09:52:21 | PMunch | Hmm, has anyone already written something to extract PNG icons from X11 windows? |
09:53:16 | alehander92 | sounds very particular |
09:53:30 | PMunch | Haha, I know |
09:54:09 | alehander92 | just squeeze your eyes a bit |
09:54:20 | alehander92 | and you'll see them |
09:54:40 | PMunch | I'm writing a quick little window switcher script |
09:54:44 | PMunch | And I wanted to use the icons |
09:57:35 | FromDiscord | <él liquido> hm, so why exactly PNG |
09:57:42 | FromDiscord | <él liquido> shouldn't a pixmap just work? |
10:01:36 | FromDiscord | <él liquido> PMunch: this might help https://stackoverflow.com/questions/55413341/get-applications-icon-using-xlib |
10:01:56 | PMunch | Well because I want to feed it to a program that only accepts pngs.. |
10:02:29 | PMunch | I already found that, I just wanted to know if anyone had written the code for it in Nim yet |
10:02:37 | PMunch | Otherwise I'll just hack up something else quickly |
10:09:44 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
10:09:54 | * | Trustable joined #nim |
10:11:32 | PMunch | Ugh, is the only way to pipe something to a process really to do startProcess, then inputHandle, then open a file by that handle and writing to it? |
10:11:46 | PMunch | Why is there no process.write for example that wraps this? |
10:21:54 | FromDiscord | <Shucks> Don't you just helped me to do that WriteProcessMemory stuff? |
10:27:07 | PMunch | Yes? |
10:29:22 | PMunch | Nice, now I've got a small Nim script that asks i3 for open windows, tries to guess the icon name based on the class, then shows all the programs with icons in a searchable list, and switches to the chosen one |
10:32:23 | alehander92 | why do you need to write process memory |
10:33:02 | krux02 | PMunch: I think it could be because the os wrapper was written by a person who doesn't like the unix phylosophy and disrespects its workflow. |
10:35:33 | * | Tlanger joined #nim |
10:37:32 | alehander92 | we can have a unix-y wrapper in fusion |
10:37:38 | alehander92 | i was thinking these days |
10:37:46 | alehander92 | how hard is to make a good os module |
10:37:46 | * | Tongir quit (Ping timeout: 246 seconds) |
10:37:51 | alehander92 | when looking at fuschia |
10:38:23 | alehander92 | e.g. if an os with very different concepts starts mainstream: where does one put the line between definitely universal stuff like files and other |
10:39:27 | * | stefantalpalaru quit (Changing host) |
10:39:27 | * | stefantalpalaru joined #nim |
10:39:54 | PMunch | krux02, but still.. It's just so tedious.. Ended up with `execProcess("echo '" & myData & "' | theProgram")` which obviously isn't a very nice solution.. |
10:41:41 | * | haxscramper joined #nim |
10:42:50 | bung | looks like Stream type need writeImpl readImpl |
10:43:46 | FromDiscord | <Recruit_main707> does anyone know something about memfiles?↵https://nim-lang.org/docs/memfiles.html |
10:45:28 | FromDiscord | <él liquido> yea, why? |
10:45:41 | FromDiscord | <Recruit_main707> i dont know how to use it :P |
10:46:00 | FromDiscord | <Recruit_main707> do you have an example i can see? |
10:46:32 | FromDiscord | <él liquido> so first you need to open a file with `open()`, and then map an area of the file to memory using `mapMem` |
10:47:05 | FromDiscord | <Recruit_main707> right, and then how do i edit, lets say the first two characters |
10:47:18 | FromDiscord | <él liquido> write to `yourFile.mem` |
10:47:47 | FromDiscord | <él liquido> so you basically `cast[ptr UncheckedArray[uint8]](yourFile.mem)` and write to that |
10:48:40 | FromDiscord | <Recruit_main707> character by character? |
10:49:15 | FromDiscord | <él liquido> yes |
10:49:37 | FromDiscord | <él liquido> if you cast it to a `ptr UncheckedArray[T]` it basically acts as an array of `T` |
10:49:57 | krux02 | alehander92: if something is supported by all current major platforms, you can call it universal. If this property changes and a platform does not have files for examples (old consoles like NES and SNES don't have it for example), then it can't be called universal anymore and you are in a messed up situation. But I wouldn't try to spend any brain cell in the design the os module with thinking of hypothetical future os develo |
10:49:57 | krux02 | some point you just have to redo it. |
10:50:15 | alehander92 | yeah i guess so |
10:50:39 | FromDiscord | <Recruit_main707> i wish we had a higher level function to use memfiles |
10:50:40 | alehander92 | it's the old stdlib vs others discussion |
10:51:06 | krux02 | I think memfiles have a pretty nice API. |
10:51:08 | alehander92 | krux02 i didnt know about nes and snes, good example |
10:51:38 | FromDiscord | <él liquido> @Recruit_main707 but it doesn't play well with memfiles, then. they're an inherently low-level feature |
10:51:39 | krux02 | in snes and nes, the ROM is directly addressable memory. |
10:52:13 | krux02 | putting the module into the console is literally loading the game, physically. |
10:52:31 | krux02 | Therefore you also don't have any loading times. |
10:52:43 | alehander92 | sounds reasonable |
11:02:43 | krux02 | It is also perfect privacy and process isolation, because every program/game comes pysically attached with its own writable memory. There is no persistent memory on the console. In other words, programs cannot read the memory of other files. |
11:06:27 | alehander92 | <3 |
11:06:33 | alehander92 | cool |
11:06:57 | alehander92 | i wondered if a more fine-grained permission model would come to any os soon |
11:07:34 | alehander92 | something like "this process can access this pattern of files, this memory and use max this ram" etc |
11:08:15 | alehander92 | maybe fuschia handles can model some of it and i am sure research os-es have much more sophisticated stuff |
11:08:26 | alehander92 | but e.g. i want it for linux |
11:13:38 | Prestige | Is there a way to package an external executable inside of a Nim program? |
11:14:08 | Prestige | I'm wanting to write something that uses fzf (a program written in go) but don't want the user to have to install an external dep |
11:14:34 | * | bacterio quit (Ping timeout: 240 seconds) |
11:15:15 | alehander92 | does the license permit it!! |
11:15:56 | Prestige | Mit |
11:16:01 | alehander92 | if it depends on the go runtime and everything it might be easier to make him install it |
11:16:14 | FromDiscord | <él liquido> Prestige: with |
11:16:36 | FromDiscord | <Rika> Install it via the package manager |
11:16:40 | FromDiscord | <Rika> As a dep I mean |
11:17:46 | Prestige | It's for my work, we're doing a hackathon. People using only macs, don't have a package manager |
11:18:14 | * | dddddd joined #nim |
11:18:28 | alehander92 | eh cant you just ship a static binary |
11:18:35 | alehander92 | doesnt go produce stuff like that |
11:18:52 | Prestige | Yeah, just not sure if/how I could wrap it with Nim |
11:19:12 | Prestige | And I'm trying to avoid it being 2 separate binaries |
11:20:40 | alehander92 | well you can just .. invoke it |
11:20:50 | bung | static read it as file extract it to somewhere then run it ? |
11:21:05 | alehander92 | does the hackathon |
11:21:30 | alehander92 | have rules for how many files |
11:21:33 | alehander92 | you produce? |
11:22:43 | alehander92 | not sure how packaging typically works on osx tho |
11:22:44 | Prestige | Nope I just wanted it to be an easy install for people but I suppose I could have an installer install the fzf executable as well |
11:22:50 | Prestige | Yeah me either lol |
11:23:16 | alehander92 | cant you make a brew package |
11:23:20 | alehander92 | or is that not common now |
11:25:21 | Prestige | It is, but it's going to be an internal (to the company) program |
11:26:17 | Prestige | Was hoping to have a single executable but if that isn't going to work I'll just do something else |
11:29:29 | alehander92 | eh two binaries still seem good to me |
11:29:35 | alehander92 | after all `fzf` is useful |
11:29:43 | alehander92 | so they just get two tols |
11:29:47 | alehander92 | tools maybe b |
11:30:02 | alehander92 | but yeah it can be frustrating |
11:33:47 | Prestige | Cool, should be fine. Thanks alehander92 |
11:35:18 | * | rockcavera joined #nim |
11:40:11 | * | Senny joined #nim |
11:44:13 | alehander92 | no problem |
11:44:26 | alehander92 | :) |
11:47:38 | PMunch | Well.. |
11:48:43 | PMunch | You can use staticRead/slurp to grab the program file, and then on runtime just write it out to a file again.. |
11:48:54 | PMunch | If it's for a hackathon it doesn't have to be pretty :) |
11:48:58 | PMunch | Prestige ^ |
11:51:14 | FromDiscord | <Technisha Circuit> How do i use `loadLib` from dynlib to:↵A) Get a function↵B) Get a variable |
11:51:40 | FromDiscord | <Technisha Circuit> I'm trying to make a command handler for dimscord with .so files so i can load them dynamically |
11:51:59 | PMunch | Like this? https://nim-lang.org/docs/dynlib.html |
11:52:23 | PMunch | That is by using `symAddr` to get the symbol |
11:52:38 | krux02 | PMunch: no that is not how you are supposed to write a quine |
11:52:52 | PMunch | krux02, quine? |
11:53:07 | krux02 | a quine is a program that prints out its own source code. |
11:54:05 | PMunch | Ah, never heard that term before |
11:54:28 | PMunch | But this wasn't printing out its own source, this is just "unpacking" a part of the program as it execute |
11:55:01 | krux02 | PMunch: here is an exaggerated example: https://github.com/mame/quine-relay |
11:58:06 | bung | that's crazy |
11:58:17 | * | bacterio joined #nim |
11:59:06 | krux02 | it includes Nim |
11:59:23 | krux02 | it has crazy dependencies |
12:02:57 | shashlick | Prestige check out nimdeps |
12:04:12 | FromDiscord | <Technisha Circuit> > Like this? https://nim-lang.org/docs/dynlib.html↵I've only been able to get that working for procs :/ |
12:05:45 | PMunch | I assume the variables you are trying to reach are top-level, exported, and declared with the correct pragmas? |
12:05:58 | PMunch | Can you see them in the output of "nm -a <program name>" |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:06 | shashlick | https://github.com/genotrance/nimdeps |
12:06:06 | PMunch | Or dll name rather |
12:06:35 | * | supakeen joined #nim |
12:07:10 | FromDiscord | <Technisha Circuit> Let me see |
12:10:22 | FromDiscord | <Technisha Circuit> I've figured out how to use loadLib correctly, never mind :p |
12:10:46 | FromDiscord | <Technisha Circuit> ```Traceback (most recent call last)↵/data/data/com.termux/files/home/nim_stuff/dynlibTesting/main.nim(9) main↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)``` |
12:10:47 | FromDiscord | <Technisha Circuit> Uh |
12:10:52 | * | nekits quit (Quit: The Lounge - https://thelounge.chat) |
12:11:29 | PMunch | What type is the variable you're trying to read? |
12:12:04 | FromDiscord | <Technisha Circuit> main.nim: https://hastebin.com/yuqavayihe.nim |
12:12:05 | FromDiscord | <Technisha Circuit> test.nim: https://hastebin.com/udokicoboj |
12:12:14 | * | nekits joined #nim |
12:12:19 | FromDiscord | <Technisha Circuit> Oh |
12:12:21 | FromDiscord | <Technisha Circuit> Nvn |
12:12:23 | FromDiscord | <Technisha Circuit> Nvm* |
12:12:27 | FromDiscord | <Technisha Circuit> This is a variable |
12:27:20 | * | Vladar joined #nim |
12:31:52 | * | bacterio quit (Ping timeout: 258 seconds) |
12:43:53 | * | rockcavera quit (Read error: Connection reset by peer) |
12:47:13 | * | rockcavera joined #nim |
12:48:30 | Prestige | Thanks shashlick |
12:50:22 | Prestige | Writing a cli application in Nim, is the proper way to interact with the terminal (invoking other programs) using startProcess and Process.outputHandle? |
12:50:57 | * | alehander92 quit (Ping timeout: 256 seconds) |
12:51:10 | * | alehander92_ joined #nim |
12:51:27 | FromGitter | <anon767> hm is someone here who has decent nimgl experience? |
12:52:40 | * | msmorgan_ joined #nim |
12:58:07 | * | msmorgan quit (Ping timeout: 256 seconds) |
12:58:07 | * | krux02 quit (Ping timeout: 256 seconds) |
12:58:07 | * | krux02 joined #nim |
12:58:08 | * | msmorgan_ is now known as msmorgan |
12:59:52 | FromDiscord | <lqdev> what's your issue? |
13:00:07 | * | bacterio joined #nim |
13:00:43 | * | beatmox- joined #nim |
13:01:36 | * | krux02 quit (*.net *.split) |
13:01:36 | * | beatmox quit (*.net *.split) |
13:01:36 | * | drewr quit (*.net *.split) |
13:01:36 | * | skrylar[m] quit (*.net *.split) |
13:01:37 | * | anti[m] quit (*.net *.split) |
13:01:37 | * | dzamo[m] quit (*.net *.split) |
13:01:46 | * | lqdev[m] quit (*.net *.split) |
13:05:07 | * | Vladar quit (Quit: Leaving) |
13:05:28 | * | Trustable quit (Ping timeout: 246 seconds) |
13:05:46 | * | Trustable joined #nim |
13:06:49 | * | bacterio quit (Ping timeout: 264 seconds) |
13:07:04 | * | krux02 joined #nim |
13:07:04 | * | drewr joined #nim |
13:07:04 | * | anti[m] joined #nim |
13:07:04 | * | dzamo[m] joined #nim |
13:07:04 | * | lqdev[m] joined #nim |
13:10:15 | * | silvernode quit (Ping timeout: 240 seconds) |
13:10:20 | * | krux02` joined #nim |
13:10:32 | * | silvernode joined #nim |
13:12:16 | Prestige | Looks like I can use execProcess, but I'm unable to see fzf running.. hm |
13:12:22 | Prestige | PMunch: Do you know how to interact with the shell in nim? |
13:12:47 | PMunch | Define interact |
13:12:59 | * | ehmry joined #nim |
13:13:06 | * | dzamo[m]1 joined #nim |
13:13:51 | Prestige | Atm I'm invoking fzf with execProcess and it's technically working, but I never see fzf pop up in my shell when running it from nim |
13:14:32 | PMunch | Ah, that's because the streams are taken by Nim |
13:15:03 | PMunch | If you use startProcess with poUseParentStreams or something like that it should work |
13:15:03 | Prestige | Is there any way around that? |
13:15:17 | * | krux02 quit (Ping timeout: 256 seconds) |
13:15:17 | * | dzamo[m] quit (Ping timeout: 256 seconds) |
13:15:21 | PMunch | What do you mean around it? |
13:15:26 | FromGitter | <kaushalmodi> Prestige: I think you will need execCmd or execCmdEx |
13:16:03 | * | drewr quit (Ping timeout: 256 seconds) |
13:17:38 | * | drewr joined #nim |
13:17:38 | shashlick | Prestige, now set ff which is an fzf wrapper in Nim |
13:17:38 | shashlick | https://github.com/genotrance/ff |
13:17:38 | FromGitter | <kaushalmodi> Prestige, PMunch: Also I am interested in seeing how you implement that CUI selector in Nim |
13:18:00 | shashlick | ff does that |
13:18:36 | FromGitter | <kaushalmodi> shashlick: will have a look |
13:18:36 | FromGitter | <kaushalmodi> it was on my wishlist to have something like this in Nim: https://github.com/p-gen/smenu/blob/master/README.rst |
13:18:39 | Prestige | hmm I get an error trying to use poParentStreams |
13:18:55 | * | skrylar[m] joined #nim |
13:18:56 | * | skrylar[m] quit (Changing host) |
13:18:56 | * | skrylar[m] joined #nim |
13:19:17 | FromGitter | <kaushalmodi> shashlick: ⏎ ⏎ > ff is a Windows wrapper for fzf ⏎ ⏎ hmm, I am though looking for something in Linux [https://gitter.im/nim-lang/Nim?at=5ee0ddcb5782a31278ef26ee] |
13:20:01 | FromGitter | <kaushalmodi> also, not as a standalone binary but a library |
13:20:01 | FromGitter | <kaushalmodi> something that work like `pickOne(@["opt1", "opt2", ..])` |
13:20:16 | shashlick | It's only tested on windows but that's cause fzf works well on Linux |
13:20:21 | FromGitter | <kaushalmodi> .. and the `pickOne` then launches that fzf/smenu like interactive selector in the terminal |
13:20:38 | shashlick | The code gives you an idea what it can do |
13:20:43 | shashlick | Should work in Linux |
13:21:03 | FromGitter | <kaushalmodi> I'll have a look. Thanks |
13:23:04 | shashlick | The thing with fzf is that it cannot return info back to the caller |
13:23:35 | shashlick | Cause if you want to read back the output, you don't see anything |
13:23:35 | FromGitter | <kaushalmodi> hmm, I might venture into a wrapper for smenu |
13:23:48 | FromGitter | <kaushalmodi> unfortunately it doesn't have a good API |
13:24:03 | FromGitter | <kaushalmodi> so I'll need to use the same startProcess approach |
13:25:44 | shashlick | You could write the selection to a file and then read it back perhaps |
13:28:16 | FromGitter | <kaushalmodi> yes, I'll need to do that.. or probably smenu would return the selection as TaintedString returned by startProcess |
13:28:56 | PMunch | Prestige, what error? |
13:30:08 | * | rockcavera quit (Remote host closed the connection) |
13:31:15 | Prestige | something about not being allowed to use the option.. I'll try changing the code back and get the error msg again |
13:32:37 | * | bacterio joined #nim |
13:32:57 | * | stever joined #nim |
13:33:30 | Prestige | rentStreams notin p.options` API usage error: stream access not allowed when you use poParentStreams [AssertionError] |
13:33:54 | Prestige | it cut off the start, was `poParentStreams notin ... ` |
13:33:58 | PMunch | Ah yes, you can't read from the stream when you use that |
13:34:53 | Prestige | oh, well dang. I'll need the result from fzf |
13:36:00 | Prestige | I wish this was easy to do like using bash lol |
13:36:24 | disruptek | there will be a stream today. |
13:36:44 | PMunch | What happens if you just busy loop and read from the output of starProcess and write that out to the terminal? |
13:37:19 | PMunch | Hmm, I thought tools like fzf wrote directly to the terminal and not through stdout.. |
13:37:40 | * | bacterio quit (Ping timeout: 246 seconds) |
13:40:51 | Prestige | oh what I just got it to work |
13:41:00 | Prestige | I needed waitForExit |
13:41:33 | Prestige | (as well as poParentStreams) |
13:41:45 | PMunch | Ah, nice |
13:46:38 | Prestige | But you said there's no way to get the output? |
13:47:04 | PMunch | I didn't think so |
13:47:37 | PMunch | I mean except from telling it to write it to a file or a named pipe and then read it from there in Nim |
13:50:09 | * | Vladar joined #nim |
13:56:55 | * | bung quit (Ping timeout: 246 seconds) |
14:05:14 | * | bacterio joined #nim |
14:06:20 | * | bung joined #nim |
14:09:25 | * | drewr quit (Quit: brb) |
14:10:28 | * | drewr joined #nim |
14:15:49 | * | bacterio quit (Ping timeout: 264 seconds) |
14:19:08 | FromDiscord | <Shucks> So `json` has `parseFile` but not `toFile`? |
14:19:34 | Yardanico | make a PR |
14:19:36 | Yardanico | if you want |
14:29:33 | FromGitter | <Vindaar> @Shucks: well `toFile` is just `writeFile("someFilename", $someJson)` |
14:30:08 | FromDiscord | <Shucks> yea doing that atm. ``` let config = %*s↵ write_file("config.json", $config)``` |
14:30:50 | FromDiscord | <Shucks> just wondering if I could just save up that config variable. `$%*s` doesnt seems to work |
14:31:54 | FromGitter | <Vindaar> I'm confused, what's `s` exactly? `%*` is the macro which takes "literal" json, no? |
14:32:17 | Yardanico | @Shucks easily |
14:32:34 | Yardanico | writeFile("config.json", $(%*{"a": "b"})) |
14:32:39 | Yardanico | not sure if you'd want that though |
14:32:54 | FromDiscord | <Shucks> > I'm confused, what's `s` exactly? `%*` is the macro which takes "literal" json, no?↵@Vindaar[Gitter]#0000 Yea. `Convert an expression to a JsonNode directly,` |
14:33:01 | Yardanico | nah |
14:33:04 | FromDiscord | <Shucks> That looks good. Thanks @Yardanico |
14:33:12 | FromGitter | <Vindaar> yes, so in your code `s` isn't actually `s` but you meant it as a placeholder? |
14:33:40 | FromGitter | <Vindaar> but yes, @Yardanico's approach works |
14:33:41 | Yardanico | @Vindaar %* works with variables too |
14:34:03 | FromGitter | <Vindaar> well, yes but only converts a type to a JsonNode in that case |
14:34:04 | FromDiscord | <Shucks> `"config.json".write_file($(%*s))` That compiles 🙂 thanks |
14:34:21 | FromGitter | <Vindaar> so you might as well just write `% s` |
14:34:35 | Yardanico | ah right |
14:37:33 | FromDiscord | <Shucks> `%` takes a JsonNode no? `s` is a object. Sorry for not clearing that |
14:37:39 | Yardanico | no |
14:37:45 | Yardanico | % is for converting different values to JsonNode |
14:37:57 | Yardanico | it's defined for most standard types including generic "object" and "tuple" |
14:38:21 | Yardanico | %* is a macro that recursively adds % to all values in the expression |
14:40:20 | FromDiscord | <Shucks> Alright, works aswell. Thanks |
14:45:07 | * | bacterio joined #nim |
14:45:09 | FromDiscord | <Shucks> `"config.json".write_file((% s).pretty())` I just love nim.. |
14:45:37 | Yardanico | I'd write it as writeFile("config.json", pretty(%s)) though :P |
14:47:23 | PMunch | Haha @Shucks, not sure if that was sarcastic or not :P |
14:47:34 | Yardanico | yeah I got a sarcastic vibe from it too :P |
14:47:59 | PMunch | Yardanico, your way is definitely the more Royale way of doing it |
14:48:17 | Yardanico | so you use that term ? :P from that forum thread |
14:48:28 | PMunch | Haha, I've started using it to try it out :P |
14:48:43 | FromDiscord | <Shucks> Yea im still confused about the style behaviour. Like im coming from python, theres pep8 which tells you what indentation etc. you should use. And nimpretty itself doesn't seems to do much to be honest. |
14:49:00 | FromDiscord | <Shucks> Nah I need to remove that dots lol. I wasnt sarcastic ;D |
14:49:25 | Yardanico | check how other code is written :P |
14:49:42 | Yardanico | for some info you can check https://nim-lang.org/docs/nep1.html |
14:52:04 | FromDiscord | <Shucks> Thanks. Yea `write_file("config.json", pretty(% s))` makes a lot more sense lol |
14:56:37 | disruptek | ~stream |
14:56:37 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
14:58:40 | FromDiscord | <Shucks> ~help |
14:58:45 | FromDiscord | <Shucks> ~commands |
14:58:46 | disbot | no footnotes for `commands`. 🙁 |
14:58:49 | FromDiscord | <Shucks> >.< |
14:58:52 | disruptek | try !help |
14:58:56 | FromDiscord | <Shucks> !help |
14:59:00 | Yardanico | !help |
15:01:09 | PMunch | tilde-help should PM you the help message on IRC |
15:01:20 | disruptek | well, you know what to you. |
15:01:21 | PMunch | So it probably got PMed to FromDiscord :P |
15:01:22 | disruptek | what to do. |
15:01:55 | Yardanico | remove the discord bridge |
15:01:56 | disruptek | you can read about it here: |
15:02:00 | disruptek | ~notes |
15:02:01 | disbot | notes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek |
15:02:01 | * | bacterio quit (Ping timeout: 246 seconds) |
15:02:14 | disruptek | come on twitch and you can talk to the bot directly. |
15:02:22 | Yardanico | better come on freenode |
15:04:02 | * | narimiran quit (Ping timeout: 260 seconds) |
15:04:44 | PMunch | Zevv, I played around with fibers a bit more: https://github.com/PMunch/fibers |
15:05:21 | livcd | i am on shit network today |
15:08:19 | PMunch | Really poorly documented, and highly experimental. But I think the system is cool and might be useful |
15:08:29 | PMunch | Oh well, off to walk the dog |
15:08:29 | * | PMunch quit (Quit: leaving) |
15:09:50 | disruptek | that was fun. |
15:11:14 | * | kenran_ joined #nim |
15:13:56 | * | kenran quit (Ping timeout: 256 seconds) |
15:30:55 | * | bacterio joined #nim |
15:35:10 | * | waleee-cl joined #nim |
15:37:47 | * | zedeus quit (Ping timeout: 260 seconds) |
15:37:47 | * | bacterio quit (Ping timeout: 258 seconds) |
15:38:36 | * | bung quit (Quit: Lost terminal) |
15:39:44 | * | zedeus joined #nim |
15:45:53 | disruptek | !last clyybber |
15:45:54 | disbot | clyybber spoke in 12#nim-offtopic 2 days ago |
15:46:06 | disruptek | !last Clyybber |
15:46:07 | disbot | clyybber spoke in 12#nim-offtopic 2 days ago |
15:46:10 | disruptek | pffbt |
15:51:57 | FromDiscord | <KrispPurg> sent a code paste, see http://ix.io/2oPl |
15:52:23 | FromDiscord | <KrispPurg> (edit) 'http://ix.io/2oPl' => 'http://ix.io/2oPm' |
16:05:47 | * | bacterio joined #nim |
16:08:31 | * | skistaddy joined #nim |
16:08:56 | * | skistaddy quit (Remote host closed the connection) |
16:11:24 | * | Trustable quit (Remote host closed the connection) |
16:14:19 | * | silvernode quit (Ping timeout: 265 seconds) |
16:31:46 | * | bacterio quit (Ping timeout: 260 seconds) |
16:32:50 | * | xet7 quit (Quit: Leaving) |
16:33:21 | disruptek | i've released 129,000 lines of nim so far. |
16:33:39 | disruptek | not including generated stuff. |
16:36:53 | disruptek | 26 projects. |
16:37:08 | disruptek | i would say less than 10k lines are worth anything, though. |
16:40:42 | shashlick | That's awesome |
16:41:07 | FromGitter | <Vindaar> @disruptek: how did you count the lines properly? |
16:41:18 | disruptek | one at a time. |
16:41:26 | FromGitter | <Vindaar> :P:P:P |
16:42:07 | shashlick | Nimterop is 7k lines, doubt I've written 100k in the three years with Nim |
16:50:17 | * | Tyresc joined #nim |
16:50:31 | * | kenran_ quit (Ping timeout: 246 seconds) |
16:51:23 | * | FromGitter quit (Remote host closed the connection) |
16:51:23 | * | oprypin quit (Quit: Bye) |
16:51:36 | * | silvernode joined #nim |
16:51:41 | * | oprypin joined #nim |
16:51:55 | * | FromGitter joined #nim |
16:51:56 | FromDiscord | <lqdev> so I have a `type GlEnum = distinct uint32`, but somehow I can't create a proc `==`*(a, b: GlEnum) {.borrow.}? |
16:51:56 | silvernode | How is everyone today? |
16:53:56 | FromDiscord | <lqdev> ah I forgot bool |
16:54:00 | FromDiscord | <lqdev> silvernode: sleepy |
16:54:42 | FromDiscord | <Generic> @lqdev you forgot the :bool |
16:54:50 | FromDiscord | <Generic> haven't sorry for the ping |
16:55:20 | FromDiscord | <Generic> *read, can't write either. I probably need to give back by internet driver license soon |
16:56:11 | FromDiscord | <KrispPurg> Anyone read my message? |
16:59:56 | * | bacterio joined #nim |
17:01:12 | * | rockcavera joined #nim |
17:09:36 | * | kenran joined #nim |
17:11:50 | * | bacterio quit (Ping timeout: 265 seconds) |
17:15:18 | * | bacterio joined #nim |
17:22:16 | * | arecaceae quit (Remote host closed the connection) |
17:22:37 | * | arecaceae joined #nim |
17:30:13 | * | bacterio quit (Ping timeout: 264 seconds) |
17:32:30 | Prestige | I'm using the regex match function and passing in a sequence I've initialized - it looks like it doesn't fill the sequence though, I'm having to initialize it with some size.. Is there a way to do this more dynamically? |
17:43:20 | leorize[m] | wdym? |
17:45:06 | Prestige | Since the proc has an array as an out parameter I'm having to initialize my sequence with some size, or else I don't get any matches back |
17:45:30 | Prestige | If I initialize it as an empty seq I won't get any matches |
17:46:39 | leorize[m] | that's a weird design then |
17:46:40 | leorize[m] | are you using nim-regex or the stdlib ones? |
17:47:59 | FromDiscord | <treeform> Hey guys do you know if there is a way to check if file exists in a `static:` block? Important OS does not work. Using exceptions does not work as well... |
17:48:01 | Prestige | Stdlib - yeah I expected to either have an iterator or a seq returned |
17:48:30 | disruptek | treeform: there's, like, fileExists and existsFile and iirc one of them works statically. |
17:49:17 | FromDiscord | <treeform> I tried it. I'll try it again. |
17:50:10 | FromDiscord | <Recruit_main707> should memory mapped files be faster than sockets? |
17:50:19 | FromDiscord | <treeform> hmm both of them say `Error: this proc is not available on the NimScript target; usage of 'existsFile' is an {.error.}` |
17:50:20 | disruptek | yeah. |
17:50:28 | disruptek | weird. |
17:50:45 | FromDiscord | <Recruit_main707> disruptek, is that yeah to me? |
17:50:47 | disruptek | there was a commit against this stuff not that long ago. |
17:50:55 | disruptek | recruit: yep. |
17:51:08 | FromDiscord | <Recruit_main707> i guess its python then |
17:56:11 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
17:56:47 | * | pbb joined #nim |
17:58:21 | * | bacterio joined #nim |
18:06:54 | * | oprypin quit (Quit: Bye) |
18:07:02 | * | oprypin joined #nim |
18:08:13 | * | oprypin quit (Client Quit) |
18:08:21 | * | oprypin joined #nim |
18:09:01 | FromDiscord | <Recruit_main707> am i doing something really wrong? because this code is really slow https://media.discordapp.net/attachments/371759389889003532/720338744821153823/unknown.png |
18:09:42 | FromDiscord | <Recruit_main707> and that "1" * 1000 might not be very effecient, but 100 times longer strings go way faster with sockets still |
18:11:23 | Yardanico | we have strutils.repeat btw |
18:11:52 | FromDiscord | <Recruit_main707> next time then :P, but out of that? |
18:12:13 | Yardanico | i never used mmap |
18:12:19 | Yardanico | (memfiles) |
18:13:50 | krux02` | Yardanico: You don't ever need to use memfiles, but it surely is efficient. |
18:14:41 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
18:15:23 | FromDiscord | <Recruit_main707> im starting to doubt it |
18:16:33 | * | vesuvir joined #nim |
18:19:24 | * | vesuvir quit (Remote host closed the connection) |
18:19:48 | * | rockcavera quit (Read error: Connection reset by peer) |
18:20:02 | * | bacterio quit (Ping timeout: 260 seconds) |
18:20:55 | FromDiscord | <Recruit_main707> would having an slow hard disc affect performance?? |
18:22:25 | * | bacterio joined #nim |
18:22:33 | * | rockcavera joined #nim |
18:23:53 | * | rockcavera quit (Remote host closed the connection) |
18:35:03 | Prestige | Are there any functions like printf where a new line isn't printed? |
18:35:21 | leorize[m] | write()? |
18:37:47 | Prestige | ah then I can get stdout from io, okay |
18:41:54 | * | bacterio quit (Ping timeout: 256 seconds) |
18:52:51 | silvernode | So I'm trying to find a sane way to parse cmd line options with just the stdlib, I found some examples in the parseopt module but when I run the examples, I don't get any output. https://nim-lang.org/docs/parseopt.html#15 |
18:55:02 | silvernode | I just want to do basic stuff like: ./myApp arg1 arg2 arg3 ....... |
18:55:56 | silvernode | I had some crude code working which was a modified example of code I found on some blog, but there has to be a cleaner way that is build into the stdlib right? |
18:56:08 | silvernode | built* |
19:10:18 | * | bacterio joined #nim |
19:13:43 | * | oprypin quit (Quit: Bye) |
19:13:52 | * | oprypin joined #nim |
19:15:19 | FromGitter | <kaushalmodi> silvernode: Assume cligen to be part of stdlib; it's an awesome cli parsing package |
19:15:34 | * | bacterio quit (Ping timeout: 260 seconds) |
19:16:18 | FromGitter | <kaushalmodi> silvernode: Otherwise, check out https://scripter.co/notes/nim/#command-line-parameters |
19:25:18 | silvernode | @kaushalmodi I think that's where I got my hacky code from, that persons blog. |
19:27:54 | * | rockcavera joined #nim |
19:34:49 | FromGitter | <kaushalmodi> *I am not going to reveal that the author of that hacky code is me.* |
19:36:34 | FromDiscord | <Recruit_main707> How would you break from a nested loop? |
19:36:41 | * | pbb quit (Remote host closed the connection) |
19:37:01 | FromGitter | <kaushalmodi> Recruit_main707: `break` or `break labelOfOuterLoop` |
19:37:33 | FromGitter | <kaushalmodi> https://scripter.co/notes/nim/#labeled-block |
19:37:53 | * | pbb joined #nim |
19:38:08 | disruptek | base64 benchmark is still ~4.4s in arc and 1.6s in refc. |
19:42:10 | * | bacterio joined #nim |
19:43:15 | * | oprypin quit (Quit: Bye) |
19:43:18 | * | qwertfisch quit (Quit: ZNC - http://znc.in) |
19:43:24 | * | oprypin joined #nim |
19:43:26 | * | oprypin quit (Client Quit) |
19:43:31 | * | qwertfisch joined #nim |
19:43:34 | * | oprypin joined #nim |
19:44:23 | FromDiscord | <Recruit_main707> thx |
19:44:28 | Zevv | disruptek: where is that |
19:44:37 | disruptek | what? |
19:44:59 | disruptek | it's the one from kostya's benchmark game. |
19:45:26 | disruptek | it appears to have gotten about 10% slower in refc, too. |
19:47:17 | Zevv | 50% spent in nimPrepareStrMutationV2 |
19:48:09 | Zevv | I've been there |
19:48:16 | disruptek | honduras? |
19:48:18 | FromDiscord | <Varriount> Zevv: Here's an idea - turn a [jq](https://stedolan.github.io/jq/) program into Nim code at compile-time. 😄 |
19:49:21 | Zevv | varriout: Great idea, when will you get started? :) |
19:49:36 | Zevv | disruptek: nope, not yet |
19:49:59 | Zevv | anway, that proc is basically an alloc and a memcpy |
19:51:27 | Zevv | but only for string literals. otherwise its a noop |
19:52:34 | Zevv | which actually does not make sense |
19:52:41 | disruptek | fun. |
19:52:47 | FromDiscord | <dom96> oh cool, Nim is on HN front page |
19:54:52 | * | NimBot joined #nim |
19:56:05 | Zevv | disruptek: I think we can optimize something here |
19:56:18 | Zevv | it calls that proc approximately 2500000000 times |
19:56:19 | disruptek | cool. |
19:56:22 | disruptek | lol |
19:56:27 | Zevv | even though it never gets passed a strlit |
19:56:38 | disruptek | it has been slow for ages. |
19:59:56 | Zevv | bwah unreadable code with templates and whenNimVms |
20:01:17 | Zevv | well, with every 'result[outputIndex] = alphabet[x and 63]' the compiler also emits a call to nimPrepareStrMutationV2() |
20:01:44 | Zevv | so it's a function call for every processed char it seems |
20:03:02 | Zevv | not something you want in your inner loop, typically |
20:06:52 | * | silvernode quit (Ping timeout: 246 seconds) |
20:17:18 | Prestige | So in bash when I prompt for input I can set a default value that the user can edit (as if they had typed it themselves), trying to replicate that with Nim. Is there a way to output text to the terminal in that manner? |
20:19:31 | krux02` | Prestige: not that I know about. Terminal is rather bare bone in that respect. |
20:20:13 | krux02` | what you need is a line editing function. |
20:23:12 | krux02` | something like gnu readline. |
20:23:29 | FromDiscord | <Rika> dont we have linenoise |
20:23:46 | FromDiscord | <Rika> the line noise wrapper thing or something |
20:24:07 | krux02` | linenoise is not really good. |
20:24:12 | krux02` | I tried it out. |
20:24:44 | krux02` | To my experience is is much better if you do not use line noise at all, and then start your problem with rlwrap myprogram arg1 arg2 ... |
20:24:44 | Araq | a good optimizer could hoist nimPrepareStrMutationV2 out of the loop |
20:24:47 | * | Araq sighs |
20:25:31 | Zevv | it doesn't :( |
20:25:50 | Zevv | it's not in the same module. Maybe flto will notice |
20:27:04 | Zevv | but it now gets called for any assignment of a s[] |
20:28:27 | Araq | ah ok |
20:28:33 | Zevv | flto does speed up a factor of 2 |
20:28:35 | Araq | we can split it in a hot and cold path |
20:28:49 | Araq | to help the C optimizer out |
20:29:30 | Zevv | yeah but the implementation of nimPrepareStrMutationV2 does not live in the same c file, so it can't do much there |
20:30:50 | Zevv | nice of flto to look a bit further, but not something we want to rely on I guess |
20:35:09 | Prestige | Hm yeah krux02` I may look into it anyway, I need that functionality for what I'm doing |
20:38:37 | Zevv | still, even with the call optimized out, for these kind of tight loops it is considerable overhead to check for string literals on every single assignment. |
20:40:13 | disruptek | Zevv: don't be a baby. |
20:40:19 | disruptek | it's not your cpu to burn. |
20:40:26 | disruptek | winter is coming. |
20:41:11 | Zevv | oh I never cared for that. 100% of the energy spent in my computers is put to good use in winter |
20:41:36 | Zevv | but it's summery now, and I prefer my groin unmoist |
20:41:46 | disruptek | me too. |
20:41:52 | FromDiscord | <Shucks> This server needs a `#beginner` channel for my dumb questions. |
20:41:53 | Zevv | thanks |
20:41:56 | disruptek | np |
20:42:02 | disruptek | aww shucks |
20:42:03 | Zevv | Shucks: we're all beginners here |
20:43:09 | FromDiscord | <Shucks> ;D |
20:43:22 | * | haxscramper quit (Remote host closed the connection) |
20:44:07 | Prestige | Looks like linenoise doesn't allow the user to edit the prompt |
20:44:36 | FromDiscord | <Rika> can always edit linenoise cant ya |
20:44:44 | FromDiscord | <Rika> ah wait this is the wrapper no? |
20:44:55 | FromDiscord | <Rika> i made a full nim port 😛 |
20:44:57 | Prestige | Yep it's a wrapper for a c lib |
20:45:04 | FromDiscord | <Rika> its pretty bad but its whatever |
20:45:05 | FromDiscord | <Rika> https://github.com/de-odex/linenoise-nim |
20:45:36 | Zevv | disruptek: https://github.com/nim-lang/Nim/issues/14630 |
20:45:38 | disbot | ➥ ARC generates nimPrepareStrMutationV2() for every string []= ; snippet at 12https://play.nim-lang.org/#ix=2oR0 |
20:45:54 | Prestige | @Rika does this allow for prompt editing or is it just a port? |
20:46:04 | disruptek | should be quite a bit faster when fixed. |
20:46:05 | FromDiscord | <Rika> its a total port |
20:46:11 | FromDiscord | <Rika> it should be easier to edit 😛 |
20:46:44 | Zevv | disruptek: lemmemeasure |
20:47:21 | Zevv | 3x |
20:48:33 | Zevv | regular: 0m6.491s flto: 0m3.193s "fixed": 0m2.211s |
20:48:35 | * | kenran quit (Ping timeout: 260 seconds) |
20:51:14 | * | neceve_ quit (Ping timeout: 260 seconds) |
20:56:47 | FromDiscord | <Technisha Circuit> Would https://github.com/achesak/nim-speech work with the latest versions of Nim? |
20:56:57 | FromDiscord | <Technisha Circuit> And is there a better one using the Google api |
20:57:13 | FromDiscord | <Technisha Circuit> We need text to speech and speech to text |
20:57:24 | disruptek | why? |
20:58:24 | FromDiscord | <Technisha Circuit> Because it's for a project that requires both user speech recognition and the ability to respond with audio |
20:59:35 | * | lritter quit (Quit: Leaving) |
21:03:19 | * | abm joined #nim |
21:08:01 | * | tdc quit (Ping timeout: 264 seconds) |
21:09:00 | * | team\andinus quit (Quit: ERC (IRC client for Emacs 26.3)) |
21:09:56 | * | Jesin quit (Quit: Leaving) |
21:11:20 | * | team\andinus joined #nim |
21:15:20 | * | Vladar quit (Quit: Leaving) |
21:19:40 | * | Jesin joined #nim |
21:23:52 | * | solitudesf quit (Ping timeout: 246 seconds) |
21:38:26 | * | aenesidemus joined #nim |
21:43:03 | * | rockcavera quit (Remote host closed the connection) |
21:47:22 | * | tane_ quit (Quit: Leaving) |
21:51:35 | * | abm quit (Quit: Leaving) |
21:52:04 | * | waleee-cl joined #nim |
22:11:10 | FromDiscord | <Shucks> Does it matter if I import a whole library or just parts of it? Does the compiler check which files from the package are actually used? |
22:11:24 | disruptek | don't worry about it. |
22:11:35 | disruptek | yes, it has some amount of dead code elimination. |
22:12:20 | FromDiscord | <Shucks> thats great |
22:15:49 | FromDiscord | <Shucks> so `{.deadCodeElim: on.}` is always activated yes? |
22:16:02 | FromDiscord | <Shucks> even without the pragma |
22:18:43 | FromDiscord | <Shucks> or more like the argument for the compiler is on by default |
22:18:58 | disruptek | yes. |
22:43:11 | * | silvernode joined #nim |
22:53:17 | FromDiscord | <Spy653> hey, I'm loosly converting some batch scripts to nim. I have a function that takes a string and a variable to be changed, how would I implement this in nim? |
22:53:30 | * | sagax quit (Remote host closed the connection) |
22:53:30 | FromDiscord | <Spy653> I'm thinking pointers? |
22:54:25 | * | xet7 joined #nim |
22:55:10 | FromDiscord | <Rika> what do you mean |
22:55:36 | FromDiscord | <Rika> you can make arguments variable, `proc something(arg1: var string) = arg1 = "changed it"` |
22:55:53 | FromDiscord | <Rika> @Spy653 see above |
22:56:20 | FromDiscord | <Spy653> am very new to nim |
22:56:46 | FromDiscord | <Rika> thats fine, we'll either redirect you to the manual or answer the question if needed |
22:56:47 | FromDiscord | <Rika> 😛 |
22:57:12 | FromDiscord | <Spy653> could you expand on that example for me |
22:58:05 | FromDiscord | <Rika> `proc something() = ` is a function declaration↵`arg1: string` means there is an argument that takes in a string↵`var` here makes it so you can mutate it in the function |
22:59:59 | FromDiscord | <Spy653> I'm not understanding the `= arg1 = "changed it"` |
23:00:02 | FromDiscord | <Spy653> oooh wait |
23:00:10 | FromDiscord | <Rika> thats the body |
23:00:18 | FromDiscord | <Rika> in indented style itll look like this |
23:00:30 | FromDiscord | <Rika> ```proc something(arg1: var string) = ↵ arg1 = "changed it"``` |
23:00:33 | FromDiscord | <Spy653> yeah makes sense with a line break |
23:01:10 | FromDiscord | <Spy653> ok thanks that all seems to make sense |
23:08:01 | disruptek | ~manual |
23:08:01 | disbot | manual: 11the Nim Manual is https://nim-lang.org/docs/manual.html -- disruptek |
23:12:25 | * | rockcavera joined #nim |
23:24:08 | * | krux02` quit (Remote host closed the connection) |
23:26:43 | * | fredrikhr quit (Ping timeout: 246 seconds) |
23:42:19 | * | rockcavera quit (Remote host closed the connection) |
23:43:51 | FromDiscord | <Rika> is there a mode to make nim destroy on scope exit instead of proc exit |
23:44:01 | FromDiscord | <Rika> even for just one type |
23:50:52 | * | rockcavera joined #nim |