<< 10-06-2020 >>

00:02:01*FromDiscord quit (Remote host closed the connection)
00:02:16*FromDiscord joined #nim
00:07:05ldleworkWhen trying to mutate a field on my object type, I'm getting: Error: attempting to call undeclared routine: 'output='
00:07:09ldleworkWhat am I supposed to do?
00:07:24ldleworkAre objects immutable?
00:07:36PrestigeIf they are declared with var they are mutable
00:08:08ldleworkthe fields or the object
00:08:19PrestigeThe object
00:08:24ldleworkI have it defined like: var testCase: Case
00:08:29ldleworkthen I do testCase.output = "some tring"
00:08:33ldleworkand get the error above
00:08:41*chemist69_ quit (Ping timeout: 272 seconds)
00:08:48Prestigecan u show the code in a snippet on play.nim-lang.org?
00:09:22*chemist69 joined #nim
00:10:11ldleworkoh the problem is that field doesn't exist
00:10:14ldlework:)
00:17:09*nekits quit (Quit: The Lounge - https://thelounge.chat)
00:18:04*nekits joined #nim
00:37:16FromDiscord<él liquido> @willyboar PMunch is compiling a proc with *308* million args
00:39:04*fredrikhr quit (Ping timeout: 256 seconds)
00:39:25FromDiscord<willyboar> Yes i know 😛
00:40:23FromDiscord<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:19FromDiscord<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:56shashlickis the marshal module not able to handle references?
02:39:16shashlick$$ works but to[Type] complains
02:53:17leorize[m]@InventorMatt can we see the code?
02:55:36FromDiscord<InventorMatt> here is the small library I update to work with modern nim https://play.nim-lang.org/#ix=2oN0
02:55:51FromDiscord<InventorMatt> and here is the tests code in which I receive the error https://play.nim-lang.org/#ix=2oN2
03:02:34FromDiscord<Rika> @InventorMatt use waitfor instead
03:02:39FromDiscord<Rika> of await
03:03:03FromDiscord<Rika> await needs to be inside an async proc, if it isnt, use waitfor (will make the proc synchronous)
03:03:26FromDiscord<Rika> not that thats an issue from what i see in the code
03:06:16FromDiscord<InventorMatt> thanks that did solve that problem.
03:07:37*chemist69 quit (Ping timeout: 260 seconds)
03:08:16FromDiscord<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:40FromDiscord<Rika> nope
03:20:50FromDiscord<Rika> someone else might now
03:20:52FromDiscord<Rika> (edit) 'now' => 'know'
03:26:09shashlicklooks like marshal doesn't like it if a field points back to the object ref
03:41:52leorize[m]@InventorMatt it's the in-code version of the `-d:` switch
03:42:11FromDiscord<Rika> oh, its deprecated?
03:42:37leorize[m]it's undeprecated on devel btw :P
03:42:42leorize[m]don't worry too much about it
03:48:34FromDiscord<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:46FromGitter<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:34FromGitter<Knaque> To elaborate, `echo One` prints "text1," but I'd like to be able to get both its name and value separately.
04:18:57FromDiscord<Rika> .repr?
04:19:32FromDiscord<Rika> nah, didnt work..
04:19:33*rockcavera quit (Remote host closed the connection)
04:21:12TongirKnaque: This may be what you need https://nim-lang.org/docs/strutils.html#parseEnum%2Cstring
04:22:51Tongirso parseEnum[MyEnum]("text2") should get you MyEnum.Two
04:22:58FromDiscord<Rika> Tongir: theyre looking to print the name of the enum, not get the value
04:23:01FromDiscord<Rika> from a string
04:23:14FromGitter<Knaque> Yeah, that doesn't quite look like what I'm looking for.
04:23:15FromDiscord<Elegant Beef> it's just .ord for the value
04:23:35FromDiscord<Elegant Beef> One.ord gets you the int value and One returns the string value
04:23:36FromDiscord<Rika> they mean the name of the enum entry, not the number value
04:24:14FromDiscord<Rika> so if they echo enumname(One) it should print "One" (enumname is for example, not real)
04:24:22TongirOh
04:24:26TongirHaha
04:24:28FromGitter<Knaque> Rika is right on the money.
04:25:54TongirMacro, perhaps
04:26:57FromGitter<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:29FromDiscord<Elegant Beef> Well in this case the macro basically just returns the identifier
04:27:50*stefantalpalaru joined #nim
04:27:57FromDiscord<Elegant Beef> It's a weird thing to want the actual enum name
04:28:02FromDiscord<Elegant Beef> May i ask why you want that?
04:28:08FromDiscord<Rika> it wouldnt be able to do things like enumname(1.MyEnum) or enumname(parseEnum[MyEnum]("text1"))
04:28:10TongirYeah. 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:40TongirI'll have a fiddle Knaque
04:28:55FromGitter<Knaque> Thanks Tongir.
04:29:50FromGitter<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:31TongirKnaque: https://play.nim-lang.org/#ix=2oNe
04:36:37TongirMaybe that does what you want
04:37:46FromDiscord<Elegant Beef> As rika pointed out↵https://play.nim-lang.org/#ix=2oNg
04:38:39FromDiscord<flywind> Maybe this
04:38:43FromDiscord<flywind> sent a long message, see http://ix.io/2oNh
04:41:02FromGitter<Knaque> Looks like that works! Thank you very much.
04:43:47voltistIs there a way to make DocGen put all the documentation from every module in a library into one page?
04:46:22shashlickTheindex
04:48:38voltistFair enough :)
04:51:14ldleworkI guild a unit-testing tool for Nixlang in Nimlang, https://github.com/nix-community/nixt
04:51:17ldleworkbuilt*
04:53:09*adnan338 joined #nim
04:53:20FromDiscord<Elegant Beef> Now imagine if you linked the repo properly 😄
04:53:34FromDiscord<Elegant Beef> Or rather made it public
04:53:47*adnan338 quit (Client Quit)
04:54:53FromDiscord<Elegant Beef> I believe in you ldlework you can write `nix-community/nixt`
04:55:22ldleworkhave to wait for phone to charge so i can 2fa
04:55:26FromDiscord<Elegant Beef> Ah
04:55:51FromDiscord<Elegant Beef> Hopefully my jokes werent too condescending 😛
04:58:01TongirElegantly condescending XD
05:00:50ldleworkhttps://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:49FromDiscord<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:20PMunchldlework, Nixlang?
06:19:40ldleworkYeah the pure-lazy language that drives the Nix package manager / NixOS
06:19:53ldleworkNixt is a test-runner for that language, built in Nim
06:20:20PMunchOh right, I was wondering if it had anything to do with Nix
06:21:20FromDiscord<Rika> pure-lazy?
06:21:54ldleworkfunctionally 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:45FromDiscord<Zed> is there any way i can name an import?
06:28:28FromDiscord<Zed> like python where you can do this `import thing as e`
06:29:25FromDiscord<Elegant Beef> https://nim-lang.org/docs/manual.html#modules-from-import-statement
06:29:41FromDiscord<Elegant Beef> Man i cant read
06:29:52PMunchIt's just "import X as Y": https://play.nim-lang.org/#ix=2oNw
06:30:30FromDiscord<Zed> ok that works
06:31:01PMunchAnd if you want qualified imports: https://play.nim-lang.org/#ix=2oNy
06:31:38FromDiscord<Zed> That's what i've been trying to do!! i was just writing it out
06:31:48FromDiscord<Elegant Beef> qualified imports == poo
06:32:00FromDiscord<Zed> why
06:32:02FromDiscord<Zed> ?
06:32:32FromDiscord<Elegant Beef> Well cause it interferes with the UFCS
06:32:43FromDiscord<Elegant Beef> but if you are using parameterless procs then it's no different
06:33:01FromDiscord<Zed> sometimes you dont want to import everything from a library
06:33:08PMunchBut why?
06:33:38*tane_ joined #nim
06:33:52FromDiscord<Elegant Beef> `from module import proc` has you covered then
06:33:55FromDiscord<willyboar> Good morning
06:34:03FromDiscord<Elegant Beef> Gnight
06:34:03FromDiscord<Elegant Beef> :d
06:34:27PMunchOr if you just don't one specific thing because it clashes: https://play.nim-lang.org/#ix=2oNB
06:35:14FromDiscord<willyboar> Why such a hate with nim import system
06:35:17FromDiscord<Elegant Beef> Qualified imports are always weird to me coming from C#
06:35:30FromDiscord<willyboar> i personally never have a problem with
06:35:31FromDiscord<Elegant Beef> We have name spaces to divide code
06:35:38FromDiscord<Elegant Beef> In nim we have modules to do so
06:36:32FromDiscord<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:50FromDiscord<Zed> do you mean we dont have namespaces?
06:37:57FromDiscord<Elegant Beef> No i meant in C#
06:38:10FromDiscord<Zed> ah
06:38:24FromDiscord<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:39FromDiscord<willyboar> i seen it a lot
06:38:40FromDiscord<Elegant Beef> Now if you actually added something, that'd be great
06:38:43FromDiscord<Elegant Beef> Ah
06:38:45FromDiscord<Elegant Beef> Lol
06:39:11FromDiscord<Elegant Beef> Yea i dont often look a modules so, i just assumed it was possible
06:39:11FromDiscord<Zed> patience beef
06:39:11FromDiscord<willyboar> I like suspense 😛
06:39:27FromDiscord<Elegant Beef> Patience when a textblock is yellow on my screen!
06:39:35FromDiscord<Zed> it's colourful
06:43:00FromDiscord<JSGrant> Idlework: Now we just need to rewrite everything else in Nim ... :^)
06:43:14FromDiscord<Elegant Beef> Yea just remake nixos in nim
06:43:19FromDiscord<Elegant Beef> You can do it in a weekend
06:43:24FromDiscord<willyboar> I started add web frameworks to the web framework benchmark
06:43:50FromDiscord<JSGrant> @Elegant Beef Don't cut yourself short, it'll only be like 10 hours lol
06:44:08FromDiscord<willyboar> Curious too see the results
06:44:18FromDiscord<willyboar> (edit) 'too' => 'to'
06:45:40FromDiscord<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:29FromDiscord<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:51alehander92Araq thanks
07:06:13alehander92for the compiler fix related tonested await
07:13:05Araqyou'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:44FromDiscord<Shucks> Where can https://nim-lang.org/docs/quitprocs.html be found? Tried to import `std/addQuitClosure`
09:03:12FromDiscord<Shucks> erm, `std/quitprocs`
09:03:29FromDiscord<Shucks> (edit) '`std/addQuitClosure`' => '`std/quitprocs`'
09:04:46*oddp joined #nim
09:07:56Zevvmratsim: 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:32FromDiscord<mratsim> It sounds like ECMAS(cript)
09:08:37FromDiscord<mratsim> but I'm sure it's not that
09:08:39Zevvhaha, not quite :)
09:08:41FromDiscord<mratsim> so what is it?
09:09:59Zevvgeneric 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:06Zevvhttps://en.wikipedia.org/wiki/CMA-ES
09:10:41Zevvit'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:45Zevvwhich is often the case with me
09:12:33ZevvThe theory seems related to kalman filters
09:14:13FromDiscord<Rika> @Shucks it no longer exists
09:14:47FromDiscord<Rika> it seems
09:15:07Zevv"non-linear non-convex black-box optimisation"
09:15:45FromDiscord<Shucks> mh..
09:15:48FromDiscord<Rika> https://github.com/nim-lang/Nim/issues/14331
09:15:49disbotDocumentation nonexistent quitprocs module
09:16:31*krux02 joined #nim
09:16:42FromDiscord<Rika> prolly in devel but not 1/2
09:16:43FromDiscord<Rika> 1.2
09:17:31FromDiscord<Rika> it sure is in devel
09:19:10FromDiscord<Shucks> Damn. So how could I realize `deinit2` since `quit` bypasses defer? https://play.nim-lang.org/#ix=2oOc
09:19:25Yardanicorealise?
09:20:02*krux02 quit (Client Quit)
09:20:34*krux02 joined #nim
09:21:13Yardanicoyou can just copy this
09:21:14Yardanicoalso quitprocs isn't in devel either
09:21:18Yardanicosorry wrong text
09:21:19Yardanicohttps://github.com/nim-lang/Nim/blob/devel/lib/pure/quitprocs.nim
09:21:24Yardanicojust copy this file and use it
09:21:35Yardanicoit's really small
09:23:07FromDiscord<Shucks> True
09:24:01krux02good morning
09:25:19FromDiscord<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:37Yardanico"sorry wrong text"
09:26:08YardanicoI sometimes mechanically copy the text I'm typing to edit it faster and stuff
09:26:26FromDiscord<Rika> "sorry wrong text" didnt make sense to me
09:26:27FromDiscord<Rika> okay
09:33:16alehander92krux02
09:33:18alehander92morninng
09:34:04*neceve_ joined #nim
09:35:34krux02good morning
09:36:05krux02today I found out, that emacs has a builtin irc client.
09:36:12krux02I am trying it out currentl.
09:36:24krux02It works so far.
09:36:52Yardanicothere's also a good third-party TDLib-based Telegram client (my emacs using acquaintance uses it) - telega.el
09:38:38bungdoes it has features more than a irc client ?
09:38:49Yardanicobung: telegram isn't IRC :P
09:39:24alehander92wow interesting
09:39:28bungyeah, I should @krux02
09:39:30alehander92i havent tried using a vscode one
09:39:38*Vladar quit (Quit: Leaving)
09:40:58bungirc client could have code syntax highlight?
09:48:12livcdbtw what's the situation with IC?
09:52:21PMunchHmm, has anyone already written something to extract PNG icons from X11 windows?
09:53:16alehander92sounds very particular
09:53:30PMunchHaha, I know
09:54:09alehander92just squeeze your eyes a bit
09:54:20alehander92and you'll see them
09:54:40PMunchI'm writing a quick little window switcher script
09:54:44PMunchAnd I wanted to use the icons
09:57:35FromDiscord<él liquido> hm, so why exactly PNG
09:57:42FromDiscord<él liquido> shouldn't a pixmap just work?
10:01:36FromDiscord<él liquido> PMunch: this might help https://stackoverflow.com/questions/55413341/get-applications-icon-using-xlib
10:01:56PMunchWell because I want to feed it to a program that only accepts pngs..
10:02:29PMunchI already found that, I just wanted to know if anyone had written the code for it in Nim yet
10:02:37PMunchOtherwise 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:32PMunchUgh, 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:46PMunchWhy is there no process.write for example that wraps this?
10:21:54FromDiscord<Shucks> Don't you just helped me to do that WriteProcessMemory stuff?
10:27:07PMunchYes?
10:29:22PMunchNice, 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:23alehander92why do you need to write process memory
10:33:02krux02PMunch: 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:32alehander92we can have a unix-y wrapper in fusion
10:37:38alehander92i was thinking these days
10:37:46alehander92how hard is to make a good os module
10:37:46*Tongir quit (Ping timeout: 246 seconds)
10:37:51alehander92when looking at fuschia
10:38:23alehander92e.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:54PMunchkrux02, 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:50bunglooks like Stream type need writeImpl readImpl
10:43:46FromDiscord<Recruit_main707> does anyone know something about memfiles?↵https://nim-lang.org/docs/memfiles.html
10:45:28FromDiscord<él liquido> yea, why?
10:45:41FromDiscord<Recruit_main707> i dont know how to use it :P
10:46:00FromDiscord<Recruit_main707> do you have an example i can see?
10:46:32FromDiscord<é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:05FromDiscord<Recruit_main707> right, and then how do i edit, lets say the first two characters
10:47:18FromDiscord<él liquido> write to `yourFile.mem`
10:47:47FromDiscord<él liquido> so you basically `cast[ptr UncheckedArray[uint8]](yourFile.mem)` and write to that
10:48:40FromDiscord<Recruit_main707> character by character?
10:49:15FromDiscord<él liquido> yes
10:49:37FromDiscord<él liquido> if you cast it to a `ptr UncheckedArray[T]` it basically acts as an array of `T`
10:49:57krux02alehander92: 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:57krux02some point you just have to redo it.
10:50:15alehander92yeah i guess so
10:50:39FromDiscord<Recruit_main707> i wish we had a higher level function to use memfiles
10:50:40alehander92it's the old stdlib vs others discussion
10:51:06krux02I think memfiles have a pretty nice API.
10:51:08alehander92krux02 i didnt know about nes and snes, good example
10:51:38FromDiscord<él liquido> @Recruit_main707 but it doesn't play well with memfiles, then. they're an inherently low-level feature
10:51:39krux02in snes and nes, the ROM is directly addressable memory.
10:52:13krux02putting the module into the console is literally loading the game, physically.
10:52:31krux02Therefore you also don't have any loading times.
10:52:43alehander92sounds reasonable
11:02:43krux02It 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:27alehander92<3
11:06:33alehander92cool
11:06:57alehander92i wondered if a more fine-grained permission model would come to any os soon
11:07:34alehander92something like "this process can access this pattern of files, this memory and use max this ram" etc
11:08:15alehander92maybe fuschia handles can model some of it and i am sure research os-es have much more sophisticated stuff
11:08:26alehander92but e.g. i want it for linux
11:13:38PrestigeIs there a way to package an external executable inside of a Nim program?
11:14:08PrestigeI'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:15alehander92does the license permit it!!
11:15:56PrestigeMit
11:16:01alehander92if it depends on the go runtime and everything it might be easier to make him install it
11:16:14FromDiscord<él liquido> Prestige: with
11:16:36FromDiscord<Rika> Install it via the package manager
11:16:40FromDiscord<Rika> As a dep I mean
11:17:46PrestigeIt'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:28alehander92eh cant you just ship a static binary
11:18:35alehander92doesnt go produce stuff like that
11:18:52PrestigeYeah, just not sure if/how I could wrap it with Nim
11:19:12PrestigeAnd I'm trying to avoid it being 2 separate binaries
11:20:40alehander92well you can just .. invoke it
11:20:50bungstatic read it as file extract it to somewhere then run it ?
11:21:05alehander92does the hackathon
11:21:30alehander92have rules for how many files
11:21:33alehander92you produce?
11:22:43alehander92not sure how packaging typically works on osx tho
11:22:44PrestigeNope 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:50PrestigeYeah me either lol
11:23:16alehander92cant you make a brew package
11:23:20alehander92or is that not common now
11:25:21PrestigeIt is, but it's going to be an internal (to the company) program
11:26:17PrestigeWas hoping to have a single executable but if that isn't going to work I'll just do something else
11:29:29alehander92eh two binaries still seem good to me
11:29:35alehander92after all `fzf` is useful
11:29:43alehander92so they just get two tols
11:29:47alehander92tools maybe b
11:30:02alehander92but yeah it can be frustrating
11:33:47PrestigeCool, should be fine. Thanks alehander92
11:35:18*rockcavera joined #nim
11:40:11*Senny joined #nim
11:44:13alehander92no problem
11:44:26alehander92:)
11:47:38PMunchWell..
11:48:43PMunchYou can use staticRead/slurp to grab the program file, and then on runtime just write it out to a file again..
11:48:54PMunchIf it's for a hackathon it doesn't have to be pretty :)
11:48:58PMunchPrestige ^
11:51:14FromDiscord<Technisha Circuit> How do i use `loadLib` from dynlib to:↵A) Get a function↵B) Get a variable
11:51:40FromDiscord<Technisha Circuit> I'm trying to make a command handler for dimscord with .so files so i can load them dynamically
11:51:59PMunchLike this? https://nim-lang.org/docs/dynlib.html
11:52:23PMunchThat is by using `symAddr` to get the symbol
11:52:38krux02PMunch: no that is not how you are supposed to write a quine
11:52:52PMunchkrux02, quine?
11:53:07krux02a quine is a program that prints out its own source code.
11:54:05PMunchAh, never heard that term before
11:54:28PMunchBut this wasn't printing out its own source, this is just "unpacking" a part of the program as it execute
11:55:01krux02PMunch: here is an exaggerated example: https://github.com/mame/quine-relay
11:58:06bungthat's crazy
11:58:17*bacterio joined #nim
11:59:06krux02it includes Nim
11:59:23krux02it has crazy dependencies
12:02:57shashlickPrestige check out nimdeps
12:04:12FromDiscord<Technisha Circuit> > Like this? https://nim-lang.org/docs/dynlib.html↵I've only been able to get that working for procs :/
12:05:45PMunchI assume the variables you are trying to reach are top-level, exported, and declared with the correct pragmas?
12:05:58PMunchCan you see them in the output of "nm -a <program name>"
12:06:01*supakeen quit (Quit: WeeChat 2.8)
12:06:06shashlickhttps://github.com/genotrance/nimdeps
12:06:06PMunchOr dll name rather
12:06:35*supakeen joined #nim
12:07:10FromDiscord<Technisha Circuit> Let me see
12:10:22FromDiscord<Technisha Circuit> I've figured out how to use loadLib correctly, never mind :p
12:10:46FromDiscord<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:47FromDiscord<Technisha Circuit> Uh
12:10:52*nekits quit (Quit: The Lounge - https://thelounge.chat)
12:11:29PMunchWhat type is the variable you're trying to read?
12:12:04FromDiscord<Technisha Circuit> main.nim: https://hastebin.com/yuqavayihe.nim
12:12:05FromDiscord<Technisha Circuit> test.nim: https://hastebin.com/udokicoboj
12:12:14*nekits joined #nim
12:12:19FromDiscord<Technisha Circuit> Oh
12:12:21FromDiscord<Technisha Circuit> Nvn
12:12:23FromDiscord<Technisha Circuit> Nvm*
12:12:27FromDiscord<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:30PrestigeThanks shashlick
12:50:22PrestigeWriting 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:27FromGitter<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:52FromDiscord<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:16PrestigeLooks like I can use execProcess, but I'm unable to see fzf running.. hm
13:12:22PrestigePMunch: Do you know how to interact with the shell in nim?
13:12:47PMunchDefine interact
13:12:59*ehmry joined #nim
13:13:06*dzamo[m]1 joined #nim
13:13:51PrestigeAtm 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:32PMunchAh, that's because the streams are taken by Nim
13:15:03PMunchIf you use startProcess with poUseParentStreams or something like that it should work
13:15:03PrestigeIs 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:21PMunchWhat do you mean around it?
13:15:26FromGitter<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:38shashlickPrestige, now set ff which is an fzf wrapper in Nim
13:17:38shashlickhttps://github.com/genotrance/ff
13:17:38FromGitter<kaushalmodi> Prestige, PMunch: Also I am interested in seeing how you implement that CUI selector in Nim
13:18:00shashlickff does that
13:18:36FromGitter<kaushalmodi> shashlick: will have a look
13:18:36FromGitter<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:39Prestigehmm 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:17FromGitter<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:01FromGitter<kaushalmodi> also, not as a standalone binary but a library
13:20:01FromGitter<kaushalmodi> something that work like `pickOne(@["opt1", "opt2", ..])`
13:20:16shashlickIt's only tested on windows but that's cause fzf works well on Linux
13:20:21FromGitter<kaushalmodi> .. and the `pickOne` then launches that fzf/smenu like interactive selector in the terminal
13:20:38shashlickThe code gives you an idea what it can do
13:20:43shashlickShould work in Linux
13:21:03FromGitter<kaushalmodi> I'll have a look. Thanks
13:23:04shashlickThe thing with fzf is that it cannot return info back to the caller
13:23:35shashlickCause if you want to read back the output, you don't see anything
13:23:35FromGitter<kaushalmodi> hmm, I might venture into a wrapper for smenu
13:23:48FromGitter<kaushalmodi> unfortunately it doesn't have a good API
13:24:03FromGitter<kaushalmodi> so I'll need to use the same startProcess approach
13:25:44shashlickYou could write the selection to a file and then read it back perhaps
13:28:16FromGitter<kaushalmodi> yes, I'll need to do that.. or probably smenu would return the selection as TaintedString returned by startProcess
13:28:56PMunchPrestige, what error?
13:30:08*rockcavera quit (Remote host closed the connection)
13:31:15Prestigesomething 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:30PrestigerentStreams notin p.options` API usage error: stream access not allowed when you use poParentStreams [AssertionError]
13:33:54Prestigeit cut off the start, was `poParentStreams notin ... `
13:33:58PMunchAh yes, you can't read from the stream when you use that
13:34:53Prestigeoh, well dang. I'll need the result from fzf
13:36:00PrestigeI wish this was easy to do like using bash lol
13:36:24disruptekthere will be a stream today.
13:36:44PMunchWhat happens if you just busy loop and read from the output of starProcess and write that out to the terminal?
13:37:19PMunchHmm, 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:51Prestigeoh what I just got it to work
13:41:00PrestigeI needed waitForExit
13:41:33Prestige(as well as poParentStreams)
13:41:45PMunchAh, nice
13:46:38PrestigeBut you said there's no way to get the output?
13:47:04PMunchI didn't think so
13:47:37PMunchI 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:08FromDiscord<Shucks> So `json` has `parseFile` but not `toFile`?
14:19:34Yardanicomake a PR
14:19:36Yardanicoif you want
14:29:33FromGitter<Vindaar> @Shucks: well `toFile` is just `writeFile("someFilename", $someJson)`
14:30:08FromDiscord<Shucks> yea doing that atm. ``` let config = %*s↵ write_file("config.json", $config)```
14:30:50FromDiscord<Shucks> just wondering if I could just save up that config variable. `$%*s` doesnt seems to work
14:31:54FromGitter<Vindaar> I'm confused, what's `s` exactly? `%*` is the macro which takes "literal" json, no?
14:32:17Yardanico@Shucks easily
14:32:34YardanicowriteFile("config.json", $(%*{"a": "b"}))
14:32:39Yardaniconot sure if you'd want that though
14:32:54FromDiscord<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:01Yardaniconah
14:33:04FromDiscord<Shucks> That looks good. Thanks @Yardanico
14:33:12FromGitter<Vindaar> yes, so in your code `s` isn't actually `s` but you meant it as a placeholder?
14:33:40FromGitter<Vindaar> but yes, @Yardanico's approach works
14:33:41Yardanico@Vindaar %* works with variables too
14:34:03FromGitter<Vindaar> well, yes but only converts a type to a JsonNode in that case
14:34:04FromDiscord<Shucks> `"config.json".write_file($(%*s))` That compiles 🙂 thanks
14:34:21FromGitter<Vindaar> so you might as well just write `% s`
14:34:35Yardanicoah right
14:37:33FromDiscord<Shucks> `%` takes a JsonNode no? `s` is a object. Sorry for not clearing that
14:37:39Yardanicono
14:37:45Yardanico% is for converting different values to JsonNode
14:37:57Yardanicoit's defined for most standard types including generic "object" and "tuple"
14:38:21Yardanico%* is a macro that recursively adds % to all values in the expression
14:40:20FromDiscord<Shucks> Alright, works aswell. Thanks
14:45:07*bacterio joined #nim
14:45:09FromDiscord<Shucks> `"config.json".write_file((% s).pretty())` I just love nim..
14:45:37YardanicoI'd write it as writeFile("config.json", pretty(%s)) though :P
14:47:23PMunchHaha @Shucks, not sure if that was sarcastic or not :P
14:47:34Yardanicoyeah I got a sarcastic vibe from it too :P
14:47:59PMunchYardanico, your way is definitely the more Royale way of doing it
14:48:17Yardanicoso you use that term ? :P from that forum thread
14:48:28PMunchHaha, I've started using it to try it out :P
14:48:43FromDiscord<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:00FromDiscord<Shucks> Nah I need to remove that dots lol. I wasnt sarcastic ;D
14:49:25Yardanicocheck how other code is written :P
14:49:42Yardanicofor some info you can check https://nim-lang.org/docs/nep1.html
14:52:04FromDiscord<Shucks> Thanks. Yea `write_file("config.json", pretty(% s))` makes a lot more sense lol
14:56:37disruptek~stream
14:56:37disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek
14:58:40FromDiscord<Shucks> ~help
14:58:45FromDiscord<Shucks> ~commands
14:58:46disbotno footnotes for `commands`. 🙁
14:58:49FromDiscord<Shucks> >.<
14:58:52disruptektry !help
14:58:56FromDiscord<Shucks> !help
14:59:00Yardanico!help
15:01:09PMunchtilde-help should PM you the help message on IRC
15:01:20disruptekwell, you know what to you.
15:01:21PMunchSo it probably got PMed to FromDiscord :P
15:01:22disruptekwhat to do.
15:01:55Yardanicoremove the discord bridge
15:01:56disruptekyou can read about it here:
15:02:00disruptek~notes
15:02:01disbotnotes: 11https://gist.github.com/disruptek/41100bf20978de9a3cff55b23fcfe44e -- disruptek
15:02:01*bacterio quit (Ping timeout: 246 seconds)
15:02:14disruptekcome on twitch and you can talk to the bot directly.
15:02:22Yardanicobetter come on freenode
15:04:02*narimiran quit (Ping timeout: 260 seconds)
15:04:44PMunchZevv, I played around with fibers a bit more: https://github.com/PMunch/fibers
15:05:21livcdi am on shit network today
15:08:19PMunchReally poorly documented, and highly experimental. But I think the system is cool and might be useful
15:08:29PMunchOh well, off to walk the dog
15:08:29*PMunch quit (Quit: leaving)
15:09:50disruptekthat 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:53disruptek!last clyybber
15:45:54disbotclyybber spoke in 12#nim-offtopic 2 days ago
15:46:06disruptek!last Clyybber
15:46:07disbotclyybber spoke in 12#nim-offtopic 2 days ago
15:46:10disruptekpffbt
15:51:57FromDiscord<KrispPurg> sent a code paste, see http://ix.io/2oPl
15:52:23FromDiscord<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:21disrupteki've released 129,000 lines of nim so far.
16:33:39disrupteknot including generated stuff.
16:36:53disruptek26 projects.
16:37:08disrupteki would say less than 10k lines are worth anything, though.
16:40:42shashlickThat's awesome
16:41:07FromGitter<Vindaar> @disruptek: how did you count the lines properly?
16:41:18disruptekone at a time.
16:41:26FromGitter<Vindaar> :P:P:P
16:42:07shashlickNimterop 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:56FromDiscord<lqdev> so I have a `type GlEnum = distinct uint32`, but somehow I can't create a proc `==`*(a, b: GlEnum) {.borrow.}?
16:51:56silvernodeHow is everyone today?
16:53:56FromDiscord<lqdev> ah I forgot bool
16:54:00FromDiscord<lqdev> silvernode: sleepy
16:54:42FromDiscord<Generic> @lqdev you forgot the :bool
16:54:50FromDiscord<Generic> haven't sorry for the ping
16:55:20FromDiscord<Generic> *read, can't write either. I probably need to give back by internet driver license soon
16:56:11FromDiscord<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:30PrestigeI'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:20leorize[m]wdym?
17:45:06PrestigeSince 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:30PrestigeIf I initialize it as an empty seq I won't get any matches
17:46:39leorize[m]that's a weird design then
17:46:40leorize[m]are you using nim-regex or the stdlib ones?
17:47:59FromDiscord<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:01PrestigeStdlib - yeah I expected to either have an iterator or a seq returned
17:48:30disruptektreeform: there's, like, fileExists and existsFile and iirc one of them works statically.
17:49:17FromDiscord<treeform> I tried it. I'll try it again.
17:50:10FromDiscord<Recruit_main707> should memory mapped files be faster than sockets?
17:50:19FromDiscord<treeform> hmm both of them say `Error: this proc is not available on the NimScript target; usage of 'existsFile' is an {.error.}`
17:50:20disruptekyeah.
17:50:28disruptekweird.
17:50:45FromDiscord<Recruit_main707> disruptek, is that yeah to me?
17:50:47disruptekthere was a commit against this stuff not that long ago.
17:50:55disruptekrecruit: yep.
17:51:08FromDiscord<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:01FromDiscord<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:42FromDiscord<Recruit_main707> and that "1" * 1000 might not be very effecient, but 100 times longer strings go way faster with sockets still
18:11:23Yardanicowe have strutils.repeat btw
18:11:52FromDiscord<Recruit_main707> next time then :P, but out of that?
18:12:13Yardanicoi never used mmap
18:12:19Yardanico(memfiles)
18:13:50krux02`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:23FromDiscord<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:55FromDiscord<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:03PrestigeAre there any functions like printf where a new line isn't printed?
18:35:21leorize[m]write()?
18:37:47Prestigeah then I can get stdout from io, okay
18:41:54*bacterio quit (Ping timeout: 256 seconds)
18:52:51silvernodeSo 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:02silvernodeI just want to do basic stuff like: ./myApp arg1 arg2 arg3 .......
18:55:56silvernodeI 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:08silvernodebuilt*
19:10:18*bacterio joined #nim
19:13:43*oprypin quit (Quit: Bye)
19:13:52*oprypin joined #nim
19:15:19FromGitter<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:18FromGitter<kaushalmodi> silvernode: Otherwise, check out https://scripter.co/notes/nim/#command-line-parameters
19:25:18silvernode@kaushalmodi I think that's where I got my hacky code from, that persons blog.
19:27:54*rockcavera joined #nim
19:34:49FromGitter<kaushalmodi> *I am not going to reveal that the author of that hacky code is me.*
19:36:34FromDiscord<Recruit_main707> How would you break from a nested loop?
19:36:41*pbb quit (Remote host closed the connection)
19:37:01FromGitter<kaushalmodi> Recruit_main707: `break` or `break labelOfOuterLoop`
19:37:33FromGitter<kaushalmodi> https://scripter.co/notes/nim/#labeled-block
19:37:53*pbb joined #nim
19:38:08disruptekbase64 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:23FromDiscord<Recruit_main707> thx
19:44:28Zevvdisruptek: where is that
19:44:37disruptekwhat?
19:44:59disruptekit's the one from kostya's benchmark game.
19:45:26disruptekit appears to have gotten about 10% slower in refc, too.
19:47:17Zevv50% spent in nimPrepareStrMutationV2
19:48:09ZevvI've been there
19:48:16disruptekhonduras?
19:48:18FromDiscord<Varriount> Zevv: Here's an idea - turn a [jq](https://stedolan.github.io/jq/) program into Nim code at compile-time. 😄
19:49:21Zevvvarriout: Great idea, when will you get started? :)
19:49:36Zevvdisruptek: nope, not yet
19:49:59Zevvanway, that proc is basically an alloc and a memcpy
19:51:27Zevvbut only for string literals. otherwise its a noop
19:52:34Zevvwhich actually does not make sense
19:52:41disruptekfun.
19:52:47FromDiscord<dom96> oh cool, Nim is on HN front page
19:54:52*NimBot joined #nim
19:56:05Zevvdisruptek: I think we can optimize something here
19:56:18Zevvit calls that proc approximately 2500000000 times
19:56:19disruptekcool.
19:56:22disrupteklol
19:56:27Zevveven though it never gets passed a strlit
19:56:38disruptekit has been slow for ages.
19:59:56Zevvbwah unreadable code with templates and whenNimVms
20:01:17Zevvwell, with every 'result[outputIndex] = alphabet[x and 63]' the compiler also emits a call to nimPrepareStrMutationV2()
20:01:44Zevvso it's a function call for every processed char it seems
20:03:02Zevvnot something you want in your inner loop, typically
20:06:52*silvernode quit (Ping timeout: 246 seconds)
20:17:18PrestigeSo 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:31krux02`Prestige: not that I know about. Terminal is rather bare bone in that respect.
20:20:13krux02`what you need is a line editing function.
20:23:12krux02`something like gnu readline.
20:23:29FromDiscord<Rika> dont we have linenoise
20:23:46FromDiscord<Rika> the line noise wrapper thing or something
20:24:07krux02`linenoise is not really good.
20:24:12krux02`I tried it out.
20:24:44krux02`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:44Araqa good optimizer could hoist nimPrepareStrMutationV2 out of the loop
20:24:47*Araq sighs
20:25:31Zevvit doesn't :(
20:25:50Zevvit's not in the same module. Maybe flto will notice
20:27:04Zevvbut it now gets called for any assignment of a s[]
20:28:27Araqah ok
20:28:33Zevvflto does speed up a factor of 2
20:28:35Araqwe can split it in a hot and cold path
20:28:49Araqto help the C optimizer out
20:29:30Zevvyeah but the implementation of nimPrepareStrMutationV2 does not live in the same c file, so it can't do much there
20:30:50Zevvnice of flto to look a bit further, but not something we want to rely on I guess
20:35:09PrestigeHm yeah krux02` I may look into it anyway, I need that functionality for what I'm doing
20:38:37Zevvstill, 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:13disruptekZevv: don't be a baby.
20:40:19disruptekit's not your cpu to burn.
20:40:26disruptekwinter is coming.
20:41:11Zevvoh I never cared for that. 100% of the energy spent in my computers is put to good use in winter
20:41:36Zevvbut it's summery now, and I prefer my groin unmoist
20:41:46disruptekme too.
20:41:52FromDiscord<Shucks> This server needs a `#beginner` channel for my dumb questions.
20:41:53Zevvthanks
20:41:56disrupteknp
20:42:02disruptekaww shucks
20:42:03ZevvShucks: we're all beginners here
20:43:09FromDiscord<Shucks> ;D
20:43:22*haxscramper quit (Remote host closed the connection)
20:44:07PrestigeLooks like linenoise doesn't allow the user to edit the prompt
20:44:36FromDiscord<Rika> can always edit linenoise cant ya
20:44:44FromDiscord<Rika> ah wait this is the wrapper no?
20:44:55FromDiscord<Rika> i made a full nim port 😛
20:44:57PrestigeYep it's a wrapper for a c lib
20:45:04FromDiscord<Rika> its pretty bad but its whatever
20:45:05FromDiscord<Rika> https://github.com/de-odex/linenoise-nim
20:45:36Zevvdisruptek: https://github.com/nim-lang/Nim/issues/14630
20:45:38disbotARC generates nimPrepareStrMutationV2() for every string []= ; snippet at 12https://play.nim-lang.org/#ix=2oR0
20:45:54Prestige@Rika does this allow for prompt editing or is it just a port?
20:46:04disruptekshould be quite a bit faster when fixed.
20:46:05FromDiscord<Rika> its a total port
20:46:11FromDiscord<Rika> it should be easier to edit 😛
20:46:44Zevvdisruptek: lemmemeasure
20:47:21Zevv3x
20:48:33Zevvregular: 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:47FromDiscord<Technisha Circuit> Would https://github.com/achesak/nim-speech work with the latest versions of Nim?
20:56:57FromDiscord<Technisha Circuit> And is there a better one using the Google api
20:57:13FromDiscord<Technisha Circuit> We need text to speech and speech to text
20:57:24disruptekwhy?
20:58:24FromDiscord<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:10FromDiscord<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:24disruptekdon't worry about it.
22:11:35disruptekyes, it has some amount of dead code elimination.
22:12:20FromDiscord<Shucks> thats great
22:15:49FromDiscord<Shucks> so `{.deadCodeElim: on.}` is always activated yes?
22:16:02FromDiscord<Shucks> even without the pragma
22:18:43FromDiscord<Shucks> or more like the argument for the compiler is on by default
22:18:58disruptekyes.
22:43:11*silvernode joined #nim
22:53:17FromDiscord<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:30FromDiscord<Spy653> I'm thinking pointers?
22:54:25*xet7 joined #nim
22:55:10FromDiscord<Rika> what do you mean
22:55:36FromDiscord<Rika> you can make arguments variable, `proc something(arg1: var string) = arg1 = "changed it"`
22:55:53FromDiscord<Rika> @Spy653 see above
22:56:20FromDiscord<Spy653> am very new to nim
22:56:46FromDiscord<Rika> thats fine, we'll either redirect you to the manual or answer the question if needed
22:56:47FromDiscord<Rika> 😛
22:57:12FromDiscord<Spy653> could you expand on that example for me
22:58:05FromDiscord<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:59FromDiscord<Spy653> I'm not understanding the `= arg1 = "changed it"`
23:00:02FromDiscord<Spy653> oooh wait
23:00:10FromDiscord<Rika> thats the body
23:00:18FromDiscord<Rika> in indented style itll look like this
23:00:30FromDiscord<Rika> ```proc something(arg1: var string) = ↵ arg1 = "changed it"```
23:00:33FromDiscord<Spy653> yeah makes sense with a line break
23:01:10FromDiscord<Spy653> ok thanks that all seems to make sense
23:08:01disruptek~manual
23:08:01disbotmanual: 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:51FromDiscord<Rika> is there a mode to make nim destroy on scope exit instead of proc exit
23:44:01FromDiscord<Rika> even for just one type
23:50:52*rockcavera joined #nim