<< 21-12-2021 >>

00:06:10*Gustavo6046 joined #nim
00:37:02*krux02__ quit (Remote host closed the connection)
00:53:05nixfreaknim[m]in a nim proc what does after; represent or mean ?
00:53:38nixfreaknim[m]proc action(self: PIhandle, c: cint, after: cstring): cint {.cdecl.} =... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/6add77bbd05a3b40e268e8af5b218d8406410074)
00:58:16nixfreaknim[m]or where can I learn more about it ?
00:58:24FromDiscord<ynfle (ynfle)> The parameter `after` or `;`?
00:59:15nixfreaknim[m]after
00:59:44FromDiscord<ynfle (ynfle)> AFAIK it's not a keyword and doesn't have special meaning. Where does that proc come from
01:00:31nixfreaknim[m]https://github.com/dariolah/nim-iup-examples/blob/master/niup/text.nim
01:03:07FromDiscord<ynfle (ynfle)> I don't think it has any special meaning
01:03:12FromDiscord<ynfle (ynfle)> It's just a parameter
01:03:35FromDiscord<Rosen> As far as I can figure out, that seems to be the signature of a callback function that you can attach to a text box. It needs to exist to be the valid signature of the callback, but in this particular case it doesn't do anything
01:03:59FromDiscord<Rosen> Looks like you'd have to go looking in the IUP docs to find out what the "action" callback on a text object does
01:05:07FromDiscord<ynfle (ynfle)> What he said ☝
01:05:11FromDiscord<ynfle (ynfle)> \they
01:08:26nixfreaknim[m]Ok thanks
01:11:33FromDiscord<Elegantbeef> It's not even a callback, it's just a cstring passed to the invoked proc
01:14:06FromDiscord<Elegantbeef> So in this case `after` is just the text in the text box
01:14:21FromDiscord<Elegantbeef> `after` is called `new_val` in the docs
01:33:23nixfreaknim[m]so after represents the text in the box?
01:33:37FromDiscord<Elegantbeef> I think so
01:33:43FromDiscord<Elegantbeef> I could be wrong
01:33:55FromDiscord<Elegantbeef> I'm not an infallible vat of knowledge sadly
01:34:45nixfreaknim[m]yeah I'm so disappointed lol
01:35:19nixfreaknim[m]so after must be a keyword word then , cause it doesn't come up anywhere else in the program
01:37:09nixfreaknim[m]<FromDiscord> "<Elegantbeef> `after` is called..." <- which docs ? the nim ones or iup ?
01:37:18FromDiscord<Elegantbeef> Iup
01:37:54nixfreaknim[m]you didnt get a time out look at the pages ?
01:38:00nixfreaknim[m]s/look/looking/
01:43:07FromDiscord<Elegantbeef> I found the docs here https://metacpan.org/pod/IUP::Text
01:43:21nixfreaknim[m]type Action2Types* = Text_t | MultiLine_t... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/78aa89b28787eb702cec9f4683ec7b06103aeffa)
01:43:36nixfreaknim[m]from the source code
01:43:40nixfreaknim[m]so I think your right
01:59:02arkanoidis nim an academic language or a production one?
01:59:28FromDiscord<Elegantbeef> It's aimed as the latter
02:20:41FromDiscord<ynfle (ynfle)> Not very academic
02:21:23FromDiscord<JSONBash> how do I add different compilation flags into a config file? I have a vague memory of needing something in the `.nimble` file or something like `config.nims`. Maybe I am remembering wrong
02:21:49FromDiscord<Elegantbeef> config.nims is how you do it
02:22:02FromDiscord<JSONBash> is there a quick refernce sheet?
02:22:04FromDiscord<JSONBash> to see how
02:22:27FromDiscord<Elegantbeef> It's just `config.nims` then you can pass flags like you normall would
02:22:34FromDiscord<Elegantbeef> so for instance `-d:ssl` works
02:23:04FromDiscord<JSONBash> Thanks beef!
02:31:57FromDiscord<dizzyliam> Looks like the documentation for my library isn't displaying properly on `nimble.directory`, any ideas why? https://nimble.directory/docs/flower/flower.html
02:32:07FromDiscord<dizzyliam> They seem to build OK
02:36:37FromDiscord<Elegantbeef> Hmm never new nimble hosted docs
02:37:00FromDiscord<Elegantbeef> Do any of the hosted docs work?
02:38:11FromDiscord<JSONBash> @dizzyliam I can see a message hidden in the main content page that says 'Sorry, that file does not exists.' maybe thats a hint
02:41:15FromDiscord<dizzyliam> In reply to @Elegantbeef "Do any of the": Now that I'm checking, no...
02:41:22FromDiscord<dizzyliam> Not that I've found
02:44:02FromDiscord<dizzyliam> Guess I'll open an issue
02:59:42FromDiscord<evoalg> In reply to @Elegantbeef "so for instance `-d:ssl`": is it `-d:ssl` or `--d:ssl` ?
03:00:37FromDiscord<Elegantbeef> It might be `--define:ssl` I dont recall if there is a unary `-` macro
03:01:08FromDiscord<evoalg> ok I was just updating my notes and I had both examples lol
03:01:45FromDiscord<Elegantbeef> It's defined here https://nim-lang.org/docs/nimscript.html#--.t%2Cuntyped%2Cuntyped
03:01:57FromDiscord<Elegantbeef> That module is full of all the nimscript exported code and macros for config/nimble
03:06:29*arkurious quit (Quit: Leaving)
04:05:17*noeontheend quit (Ping timeout: 240 seconds)
04:06:01*supakeen quit (Quit: WeeChat 3.4)
04:06:31*supakeen joined #nim
04:22:49*noeontheend joined #nim
04:32:03*jmd joined #nim
04:35:00*jmd quit (Client Quit)
04:58:00*rockcavera quit (Remote host closed the connection)
05:03:26*sagax joined #nim
05:47:37*noeontheend quit (Ping timeout: 240 seconds)
06:35:11*elph quit (Quit: Connection closed for inactivity)
06:46:13FromDiscord<panopticon> i’m trying to use this project https://github.com/byt3bl33d3r/OffensiveNim/blob/master/src/execute_powershell_bin.nim but when i set —app:gui to run it in the background i get Error: unhandled exception: errno: 9 `Bad file descriptor' [IOError] when the script ends
06:46:29NimEventerNew question by How2: end parameter in echo for Nim?, see https://stackoverflow.com/questions/70431572/end-parameter-in-echo-for-nim
06:46:37FromDiscord<panopticon> (edit) "i’m trying to use this project https://github.com/byt3bl33d3r/OffensiveNim/blob/master/src/execute_powershell_bin.nim but when i set —app:gui to run it in the background i get Error: unhandled exception: errno: 9 `Bad file descriptor' [IOError] when the script ends ... " added "do any of u guys have any ideas why?"
07:03:07FromDiscord<Elegantbeef> @panopticon\: do you access anything from the running script when it could be done?
07:07:52*Lord_Nightmare quit (Ping timeout: 256 seconds)
07:08:55*Lord_Nightmare joined #nim
07:53:05*PMunch joined #nim
07:59:05*Gustavo6046 quit (Quit: Leaving)
08:01:57FromDiscord<cabboose> https://github.com/shayanhabibi/wrflock
09:43:46*neurocyte0132889 joined #nim
09:43:46*neurocyte0132889 quit (Changing host)
09:43:46*neurocyte0132889 joined #nim
09:50:07*geek_ joined #nim
09:54:49*elph joined #nim
10:14:57*geek_ quit (Ping timeout: 240 seconds)
10:23:14*geek_ joined #nim
10:40:22*geek_ quit (Ping timeout: 256 seconds)
10:42:32*arkanoid quit (Ping timeout: 252 seconds)
10:46:12FromDiscord<no name fits> Was Nim getting an official gui lib?
10:47:21*arkanoid joined #nim
10:49:57FromDiscord<konsumlamm> not that i know of
10:58:02FromDiscord<no name fits> Well what's the hottest in nim gui libs right now then? I wanna be hip
11:21:24FromDiscord<Solitude> gintro is a comprehensive gtk wrapper, nigui is simple crossplatform wrapper around windows gui and gtk, and fidget is upcoming saviour of nim gui.
11:32:28FromDiscord<valerga> What I wonder is if this would work for gui libraries https://github.com/PMunch/futhark
11:39:48FromDiscord<Rika> It would take a lot of work
11:52:39PMunch@valerga, don't see why it wouldn't
11:53:26PMunchAnd I take it you didn't get super far then @Rika if you think it would take a lot of work :(
11:54:24FromDiscord<Rika> I mean it’s not “nothing” but I feel it would be less than nimterop
11:54:29FromDiscord<Rika> Nonetheless a lot of work
11:57:58PMunchI think it would be pretty easy to wrap a UI library with Futhark
11:58:04PMunchDepends of course on the library
11:58:11PMunchBut I had Sciter working
12:00:32*dtomato quit (Quit: The Lounge - https://thelounge.chat)
12:01:25*dtomato joined #nim
12:01:53*dtomato quit (Client Quit)
12:02:16*dtomato joined #nim
12:02:34*Vladar joined #nim
12:06:02*supakeen quit (Quit: WeeChat 3.4)
12:06:13FromDiscord<no name fits> I wish you could bookmark messages
12:10:37PMunchYou can bookmark links like this: https://irclogs.nim-lang.org/21-12-2021.html#12:06:13
12:35:09FromDiscord<no name fits> that's handy
12:35:30FromDiscord<no name fits> Discord should have that built-in, like a lot of other stuff
12:36:22FromDiscord<Phytolizer> you can save the message link, right click the message and "copy message link"
12:36:53FromDiscord<no name fits> In reply to @Phytolizer "you can save the": Well yeah, but I meant like you have bookmarks in the browser, you should have that for Discord
12:36:58FromDiscord<Phytolizer> true
12:37:08FromDiscord<qb> How about imgui. Nimgl has bindings
12:37:28FromDiscord<qb> https://github.com/qb-0/NimbleImGui
12:37:50FromDiscord<no name fits> I'll make a list and check it twice and try out some libs
12:37:51FromDiscord<hmmm> on windows I liked wnim a lot
12:38:16FromDiscord<hmmm> we still need something that is good with tabular like data, with columns and whatnot
12:38:22FromDiscord<Rika> ~~I’m making a wrapper for not curses right now, that’s technically a GUI right~~
12:39:27pippinin that vein, my first experiment with nim is a wrapper for modern vector graphics the terminal way https://ctx.graphics/file/demos/nim/ctx2d.nim.html
12:40:35FromDiscord<hmmm> something like dephi stuff would be cool I guess
12:41:18FromDiscord<no name fits> sent a long message, see http://ix.io/3J25
12:41:46FromDiscord<Rika> Futhark is not really a GUI, it’s to make wrappers for GUIs
12:41:48FromDiscord<hmmm> how about making a fake videogame UI with godot
12:42:06FromDiscord<hmmm> you can do 2d UI with godot
12:42:08FromDiscord<qb> guess raylib also has a gui library build in. Never used it but looks cool
12:42:19FromDiscord<qb> (edit) "build" => "built"
12:42:23FromDiscord<no name fits> Seems a little too intensive for my uses. It's just for a chat app
12:43:00FromDiscord<qb> https://github.com/raysan5/raygui
12:43:11FromDiscord<qb> Not sure if the nim bindings cover it
12:44:57FromDiscord<hmmm> honesty anything with bindings is boring to write and read. Ideally we should have something nim native that is easy to write but complete and not toylike. It's indeed a massive undertaking
12:45:42FromDiscord<hmmm> @treeform how is the status on fidget2 my bro
12:47:23FromDiscord<retkid> hey how can i make a table hat does not allow for redefinition
12:47:31FromDiscord<Rika> In reply to @hmmm "honesty anything with bindings": If the wrapper is done right then it would be transparent from a regular pure Nim library
12:48:02FromDiscord<retkid> ie
12:48:16FromDiscord<retkid> a["x"] = 1↵a["x"] = 2
12:48:20*geek_ joined #nim
12:48:35FromDiscord<retkid> (edit) "a["x"] = 1↵a["x"] = 2" => "sent a code paste, see https://play.nim-lang.org/#ix=3J29"
12:48:48FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3J29" => "https://play.nim-lang.org/#ix=3J2a"
12:49:51FromDiscord<retkid> i could obviously test it if it already exists and if it does raise, but is there a pre-existing method for this
12:52:24FromDiscord<no name fits> Let or const?
12:52:35FromDiscord<retkid> const is weird in nim just use const
12:52:39FromDiscord<retkid> (edit) "const" => "lry"
12:52:40FromDiscord<retkid> (edit) "lry" => "let"
12:52:52FromDiscord<no name fits> No I'm suggesting it to you
12:53:20FromDiscord<no name fits> Also const works as expected for me
12:54:16FromDiscord<retkid> well adding to a table using let doesn't really happen?
12:54:20*rockcavera joined #nim
12:54:20*rockcavera quit (Changing host)
12:54:20*rockcavera joined #nim
12:54:36FromDiscord<retkid> because the table would then be immutable
12:56:02FromDiscord<no name fits> Yes. Then if you need a mutable table I'd just do `if not myTable.hasKey(myKey)`
12:56:28FromDiscord<retkid> well im aware of that but I wanted a smoother thing
12:56:43FromDiscord<retkid> I guess I can modify the [key] template
13:07:02*geek_ quit (Ping timeout: 240 seconds)
13:45:29*tiorock joined #nim
13:45:29*tiorock quit (Changing host)
13:45:29*tiorock joined #nim
13:45:29*rockcavera is now known as Guest2284
13:45:29*Guest2284 quit (Killed (osmium.libera.chat (Nickname regained by services)))
13:45:29*tiorock is now known as rockcavera
14:04:15*rockcavera quit (Remote host closed the connection)
14:27:15FromDiscord<panopticon> In reply to @Elegantbeef "<@189039745647640576>\: do you access": i’m trying to run a powershell empire agent but with the app set to gui it crashes when i run a module and when the pc sleeps or when i run the kill command for the agent :/
15:02:25*freevryheid joined #nim
15:03:56*freevryheid left #nim (WeeChat 3.4)
15:06:06*PMunch quit (Quit: Leaving)
15:07:40*neurocyte0132889 quit (Read error: Connection reset by peer)
15:08:21*neurocyte0132889 joined #nim
15:08:21*neurocyte0132889 quit (Changing host)
15:08:21*neurocyte0132889 joined #nim
15:11:50*freevryheid joined #nim
15:16:06*freevryheid left #nim (WeeChat 3.4)
15:26:11*freevryheid joined #nim
15:53:31NimEventerNew Nimble package! prettyvec - Small library for working with vectors, see https://github.com/prettybauble/prettyvec
16:07:50*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
16:48:26FromDiscord<tbrekalo> what is a good practice for using `.raises.` pragma?
16:54:19*rockcavera joined #nim
16:54:19*rockcavera quit (Changing host)
16:54:19*rockcavera joined #nim
16:57:29FromDiscord<tbrekalo> Should I write `result.line = move(line)` here? https://media.discordapp.net/attachments/371759389889003532/922895561814851644/unknown.png
17:02:12*xet7 quit (Remote host closed the connection)
17:03:03*xet7 joined #nim
17:27:40*arkurious joined #nim
17:27:56*flynn quit (Quit: The Lounge - https://thelounge.chat)
17:30:05*flynn joined #nim
17:34:22FromDiscord<tbrekalo> Also; is something like this possible? https://media.discordapp.net/attachments/371759389889003532/922904840458350662/unknown.png
17:47:20FromDiscord<auxym> In reply to @tbrekalo "Also; is something like": See here: https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT types in Nim only exist at compile-time, at run time everything is just data, so if you're operating on types, you have to use `when` or other compile-time mechanics (template, macros, etc)
17:47:57FromDiscord<tbrekalo> thanks
17:50:54FromDiscord<auxym> About move, sink, etc: in all cases they are never required I believe, just an optimization for the GC you can optionally use. https://nim-lang.org/docs/destructors.html#move-semantics says `This property is computed by a static control flow analysis but can also be enforced by using system.move explicitly`. Whether you should enforce it here, not sure, I haven't used these much myself, just leave everything on auto.
17:53:23FromDiscord<auxym> In reply to @tbrekalo "thanks": Also, you can use `1'i32'`/`i'u32` or `int32(1)`/`uint32(1)` or `1.int32`/`1.uint32` for creating literal (u)int32s. Casts are unsafe so best avoided unless you really need them and know what you are doing (reinterpreting raw binary data).
17:56:24FromDiscord<tbrekalo> In reply to @auxym "Also, you can use": I am kinda annoyed by the fact that there's not parseUInt32 in std
17:58:55FromDiscord<auxym> agreed, though unless you are running this on an 8bit or 16bit micro, `parseUint(s).uint32` should be equivalent. Since your system `uint` will be either 32 or 64.
18:00:39FromDiscord<tbrekalo> @auxym , can you help me a bit with nim's move semantics?↵Should move be used when assigning the `sink` param to part of the result variable as in the example I posted above?
18:01:16FromDiscord<auxym> Yeah, really not familiar with that stuff, sorry.
18:01:28FromDiscord<tbrekalo> :/
18:01:42FromDiscord<auxym> see my message above though? https://discord.com/channels/371759389889003530/371759389889003532/922909005158961242
18:03:03FromDiscord<tbrekalo> In reply to @auxym "see my message above": didn't see it; sorry
18:06:10FromDiscord<tbrekalo> https://youtu.be/aUJcYTnPWCg?t=480 this answered my question
18:18:43*lumo_e joined #nim
18:47:48*Vladar quit (Quit: Leaving)
18:59:45FromDiscord<retkid> is there a prexisting function to split a string based on its length
18:59:57FromDiscord<retkid> you spit it into 10 equal characters
19:00:06FromDiscord<retkid> (edit) "characters" => "length bytes"
19:00:14FromDiscord<retkid> (edit) "you spit it into 10 equal length bytes ... " added "with a remainder"
19:08:15FromDiscord<TryAngle> what are good / most used UI libraries right now?
19:08:22FromDiscord<TryAngle> (cross platform support)
19:08:30FromDiscord<retkid> theres like 2 and they aren't really practical
19:08:34FromDiscord<retkid> probably go somewhere else for ui
19:08:50FromDiscord<TryAngle> ok guess I just use html then
19:08:52FromDiscord<TryAngle> unlucky
19:08:54FromDiscord<IsaacPaul> hmm
19:08:59FromDiscord<retkid> i mean
19:09:05FromDiscord<retkid> i didn't say dont tru
19:09:08FromDiscord<retkid> (edit) "tru" => "try"
19:09:26FromDiscord<retkid> does anyone have the gui library list
19:09:28FromDiscord<retkid> (edit) "list" => "list?"
19:09:37FromDiscord<retkid> i cant ind it
19:09:40FromDiscord<retkid> (edit) "ind" => "find"
19:09:43FromDiscord<ajusa> There's the libui bindings and WebView options I guess, those would be the most mature options? Along with Qt
19:09:57FromDiscord<retkid> https://github.com/xflywind/awesome-nim
19:10:01FromDiscord<IsaacPaul> There is a wrapper for QT I believe and Dear image gui
19:10:04FromDiscord<retkid> theres ui section here
19:10:23FromDiscord<retkid> @TryAngle
19:12:23FromDiscord<TryAngle> hmm nimx looks good I guess
19:12:28FromDiscord<TryAngle> did anybody here try it?
19:12:37FromDiscord<retkid> no i do everything in svelte
19:13:26FromDiscord<TryAngle> ah so u basically use frontend (web) + backend (nim) architecture for UI ?
19:13:51FromDiscord<retkid> I do backend in Nim and maybe C in the future
19:13:59FromDiscord<retkid> connects to uii via severs
19:14:21FromDiscord<retkid> I want to expand my system languages with Ocaml but uh
19:14:29FromDiscord<retkid> Ocaml is a bit hard to learn
19:15:00FromDiscord<TryAngle> svelte looks interesting
19:15:32FromDiscord<retkid> if you want it to work on mobile you're stuck with electorn, otherwise you can use NodeGui
19:19:22FromDiscord<TryAngle> hmm maybe ye I might make it a browser app 🤔
19:19:33FromDiscord<TryAngle> but I really do not like electron 🤮
19:20:36FromDiscord<retkid> well
19:20:47FromDiscord<retkid> electron is fine lol idk what you're on about
19:30:04FromDiscord<TryAngle> In reply to @retkid "electron is fine lol": the fault might not be in electron itself but maybe the projects that use electron but every "mainstream" electron app just takes so much memory and cpu and freezes for me sometimes idk.
19:30:55FromDiscord<retkid> well
19:30:58FromDiscord<retkid> thats why you use nodegui
19:31:12FromDiscord<retkid> otherwise you're developing 2 apps, 1 for the desktop and 1 for your phone
19:31:16FromDiscord<retkid> which you'd be doing anyway lol
19:31:18FromDiscord<retkid> so idk
19:34:52FromDiscord<auxym> In reply to @retkid "you spit it into": Not to my knowledge, but you can whip something up with countUp and map I think
19:36:29FromDiscord<IsaacPaul> imo there is no good cross platform UI library atm. You got QT, Election, or wrappers over system api which are just plain ugly.
19:36:44FromDiscord<auxym> for GUI there's https://github.com/PMunch/wxnim as well, wrapper for wxwidgets which is a pretty mature and complete gui toolkit. Has the advantage of using native widgets too. don't think it supports mobile then
19:37:07FromDiscord<auxym> (edit) "then" => "though"
19:40:09FromDiscord<auxym> and https://github.com/filcuc/nimqml for Qt QML
19:43:21FromDiscord<huantian> Is there a good way to download a file from a url which automatically gets the filename from the Content-Disposition?
19:45:59FromDiscord<huantian> ideally it would add `(someint)` to the end of the filename if it already exists, but I can do that seperately
19:51:23FromDiscord<huantian> also, is it possible to stream download files? does httpclient.downloadFIle already do that?
20:13:49freevryheidhttps://github.com/xflywind/awesome-nim#gui
20:53:05FromDiscord<pmunch> Not as far as I know, no↵(@auxym)
20:53:26FromDiscord<pmunch> But it supports raw X11, so that's nice
21:00:00FromDiscord<hmmm> I have a plan to solve all our GUI problems
21:01:37FromDiscord<hmmm> we invite Araq to discord main for christmas celebrations, we let him drink a couple of heavy beers and then when he is weak we ask him if he codes a GUI for us 😏
21:03:27FromDiscord<evoalg> In reply to @retkid "is there a prexisting": not something like this? https://play.nim-lang.org/#ix=3J4o
21:03:53FromDiscord<retkid> i wrote the function
21:03:58FromDiscord<retkid> but now i dont need the function
21:04:03FromDiscord<retkid> so im upset i spent time writing
21:04:03FromDiscord<evoalg> lol
21:04:04FromDiscord<retkid> (edit) "so im upset i spent time writing ... " added "it"
21:04:56*krux02 joined #nim
21:52:03FromDiscord<retkid> In reply to @evoalg "not something like this?": ok i needed it again and you are a sugar god thank you
21:52:09FromDiscord<retkid> i should really learn the functional stuff there
21:57:18FromDiscord<Forest> What's a good library for Nim that has support for UDP and TCP sockets at the same time? I'd also wanna be able to use it asynchronously if possible
21:57:49FromDiscord<Forest> I'd preferably want a simple API to do it too
21:58:04FromDiscord<Forest> If this is too much to ask just lmk and maybe suggest anything else? Thanks in advance aha
21:58:10FromDiscord<Elegantbeef> https://nim-lang.org/docs/asyncnet.html ?
21:59:04FromDiscord<Forest> Oh i didn't realize nim had an async net module, i thought it was only synchronous lol, thanks
21:59:25FromDiscord<Elegantbeef> No problem
22:02:21NimEventerNew post on r/nim by richardd08: Which dataframe library to use?, see https://reddit.com/r/nim/comments/rlpcdp/which_dataframe_library_to_use/
22:18:56FromDiscord<Sabena Sema> does the stdlib expose alloca?
22:19:59FromDiscord<treeform> Hey, I finished a library to parse csv files and would like for some one to proof-read my readme: https://github.com/treeform/tabby and maybe get your other thoughts?
22:21:14FromDiscord<Sabena Sema> why must the `ParseContext` be a ref-object?
22:21:27FromDiscord<treeform> In reply to @tbrekalo "I've got a question": You can try my csv lib: https://github.com/treeform/tabby
22:21:54FromDiscord<treeform> In reply to @Sabena Sema "why must the": because it contains .data which is a big string
22:22:04FromDiscord<Sabena Sema> so?
22:22:23FromDiscord<treeform> if you pass a object with a big string it will get copied
22:22:28FromDiscord<treeform> making stuff really slow
22:24:32FromDiscord<treeform> I usually find ref objects to be faster, except in special cases.
22:24:54FromDiscord<Sabena Sema> but writing `ref object` prevents me from using it with value semantics. Idk, I generally think `ref object` is a mistake unless the object uses inheritance
22:25:17FromDiscord<treeform> Really I usually think object is a mistake? as I just see slowness.
22:25:19FromDiscord<Sabena Sema> like passing a value object to a function by both direct value and var won't copy it
22:25:26FromDiscord<Sabena Sema> it's only on assignments
22:25:46FromDiscord<treeform> Some times it will copy the object when passed by direct value
22:26:06FromDiscord<treeform> you need to do the {.bycopy.} or {.byref.} thing if you want to be sure
22:26:08FromDiscord<Sabena Sema> well, it _definately_ won't copy that string
22:26:27FromDiscord<Sabena Sema> and generally it'll only actually copy it if that would be faster
22:26:39FromDiscord<treeform> I disagree
22:27:25FromDiscord<treeform> object are generally slower because they love to copy things in surprising ways.
22:27:51FromDiscord<treeform> with reg object I am guaranteed to only copy a pointer
22:27:56FromDiscord<treeform> (edit) "reg" => "ref"
22:28:39FromDiscord<Sabena Sema> so, mark it bycopy
22:28:41FromDiscord<Sabena Sema> (edit) "bycopy" => "byref"
22:28:53FromDiscord<hmmm> treeformy can tabby handle the case of a csv with unspecified number of columns
22:29:11FromDiscord<hmmm> I mean different csv can have different col
22:29:25FromDiscord<treeform> In reply to @hmmm "treeformy can tabby handle": What do you mean? I think no.
22:29:38FromDiscord<treeform> Because you can't have a nim object with unspecified number of columns.
22:29:42FromDiscord<Sabena Sema> that way you always get the pointer but don't generate garbage each time you use the type completely inside one stack frame
22:29:45FromDiscord<hmmm> csv a has 3 columns and csv b has 5 columns
22:30:44FromDiscord<treeform> In reply to @Sabena Sema "that way you always": It's a single object, what garbage, 1 thing? Its with object you get copying in your stack frame for no reason.
22:31:08FromDiscord<treeform> In reply to @hmmm "csv a has 3": What are the fields of csv a and csv b?
22:31:24FromDiscord<treeform> (edit) "fields" => "columns"
22:32:17FromDiscord<Sabena Sema> it's not so bad for ParseContext but for like a container (like the ones in bitty) if you use them in a loop it can generate really quite a decent amount of garbage that needs to get cleaned up
22:32:28FromDiscord<hmmm> csv b has 1 date and 1 text col more than csv a that had id date and text
22:33:44FromDiscord<Sabena Sema> esp considering that ParseContext has so many other allocations hanging off anyways
22:33:51FromDiscord<hmmm> I mean I might create 2 objects but I wanted to know for the general case, but indeed we can't have objects with unspecified fields
22:33:56FromDiscord<treeform> In reply to @hmmm "csv b has 1": You would create an row that has all fields, then it will read the header and populate only the fields you have.
22:34:05FromDiscord<treeform> (edit) "have." => "have in the csv."
22:35:37FromDiscord<hmmm> well generally this case is better served with seqs that can grow and normal csv parsers that consume and produce seqs of seqs
22:35:37FromDiscord<treeform> In reply to @Sabena Sema "it's not so bad": So this is about bitty not tabby? Can write a benchmark where non ref bitty is faster than ref bitty?
22:35:49FromDiscord<Sabena Sema> yeah, I think I'll have to do that
22:35:55FromDiscord<Sabena Sema> it's about both
22:36:06FromDiscord<treeform> bitty is much simpler to benchmark though
22:36:12FromDiscord<Sabena Sema> yes
22:36:22FromDiscord<hmmm> anyway is there a reson because or std csvparse doesn't come equipped with facilities to write the csv back to file?
22:36:38FromDiscord<hmmm> reason
22:36:45FromDiscord<hmmm> our
22:37:03FromDiscord<hmmm> jeesus my english please put me down with a desert eagle .50
22:39:25FromDiscord<Sabena Sema> For bitty I also kinda want the copying semantics that value types have, but perhaps that's just because I'm used to C and C++
22:40:26FromDiscord<treeform> In reply to @hmmm "csv b has 1": Some thing like this: https://gist.github.com/treeform/fe05e8ffb24a22a7a3ca92c804521cfd
22:41:23FromDiscord<hmmm> woa it can?
22:41:34FromDiscord<treeform> In reply to @Sabena Sema "yeah, I think I'll": I am simple ... show me the numbers?
22:41:47FromDiscord<hmmm> wait the first csv has 5 column all of the a + date and text more
22:42:03FromDiscord<treeform> what 5 columns?
22:42:06FromDiscord<hmmm> hehe\
22:42:37FromDiscord<hmmm> yes sorry I can't explain myself in english today apparently 😦
22:43:06FromDiscord<hmmm> csv a is id date text and csb is id date text date text
22:43:11FromDiscord<Sabena Sema> In reply to @treeform "I am simple ...": yes, reasonable. I'll write a benchmark when I have time
22:43:50FromDiscord<treeform> In reply to @hmmm "wait the first csv": 5 columns: https://gist.github.com/treeform/fe05e8ffb24a22a7a3ca92c804521cfd
22:44:16FromDiscord<treeform> So csv b uses duplicate names?
22:44:22FromDiscord<treeform> ok
22:44:25FromDiscord<hmmm> this is pretty cool
22:47:12FromDiscord<treeform> Here is with duplicate names: https://gist.github.com/treeform/fe05e8ffb24a22a7a3ca92c804521cfd
22:47:19FromDiscord<treeform> @hmmm is this what you mean?
22:47:43FromDiscord<Sabena Sema> The other thing that types like BitArray2D do is generally use more cache, in a loop using BitArray2D you're going to load in the cache line containing the BitArray2D, then go and load the cache line containing `bits`, which is pretty likely to be a different cache line. I'll try and write a benchmark showing this, but it might look a bit contrived since I'll need to do "stuff" that evicts those lines later in the loop
22:48:23FromDiscord<hmmm> In reply to @treeform "<@!887269570765791243> is this what": yea, and if I pass the smaller csv it will work the same even without the missing fields right?
22:48:39FromDiscord<treeform> In reply to @Sabena Sema "The other thing that": We use 1d bit array in box, but again we only have 1 bit array for the duration of the whole program. So heap garbage is not an issue.
22:48:46FromDiscord<treeform> (edit) "box," => "boxy,"
22:48:58FromDiscord<treeform> In reply to @hmmm "yea, and if I": yes
22:49:04FromDiscord<Sabena Sema> yeah, if there's only one in the whole program it's fine
22:49:30FromDiscord<hmmm> In reply to @treeform "yes": 💪
22:49:56FromDiscord<Sabena Sema> but in a loop it's not, obviously in a simple loop you can just move the BitArray up before the loop starts, and replace it's content each iteration, but if the usage is in a function that gets called from somewhere in the loop things get more annoying
22:50:39FromDiscord<treeform> In reply to @hmmm "💪": See here: https://gist.github.com/treeform/fe05e8ffb24a22a7a3ca92c804521cfd
22:51:54*noeontheend joined #nim
22:52:02FromDiscord<hmmm> 1 object 2 csvs, looks gud, I'll install tabby and tell you if it works for me in this form
22:52:22FromDiscord<Sabena Sema> this is a bigger problem for like, vector/linalg libraries (and I see vmath does indeed use value types)
22:52:31FromDiscord<Sabena Sema> but still, I'll write a benchmark later
22:52:37FromDiscord<Sabena Sema> it'll be fun
22:52:37FromDiscord<hmmm> oh noes it's not on nimble 😦
22:55:41FromDiscord<treeform> i'll add it to nimble soon
22:55:48FromDiscord<hmmm> 👍
22:57:11FromDiscord<treeform> In reply to @Sabena Sema "this is a bigger": there are cases were objects make sense, like vmath is a prefect example.
22:58:18FromDiscord<treeform> But like here for example: https://github.com/nim-lang/Nim/blob/devel/lib/pure/parsesql.nim#L43
22:58:31FromDiscord<treeform> I made everything run like 5x faster by switch to a ref object for token.
22:59:19FromDiscord<Sabena Sema> my kinda general problem with `ref object` is that unlike with normal object semantics I can't decide if I want reference or value semantics, if I want value I'm just outta luck and need to modify the source code
22:59:21FromDiscord<treeform> because plain object creates so many memory allocations.
22:59:41FromDiscord<treeform> In reply to @Sabena Sema "my kinda general problem": yeah but usually is a ref for a reason
22:59:46FromDiscord<treeform> because plain object is too slow
23:00:19FromDiscord<Sabena Sema> where were the copies in parsesql actually coming from?
23:00:51FromDiscord<treeform> i don't remember its been like a year ago
23:00:58FromDiscord<treeform> I have sense have written my own SQL parser.
23:05:53FromDiscord<TurtleP> Hm.. what is the best way to compare two file `stat` modification times? I have the code in place, but unlike python, I can't do `first.st_mtime > second.st_mtime` since there's both seconds and nanoseconds in `Time` objects
23:07:30FromDiscord<Elegantbeef> Do you know there is `getLastModificationTime` in os?
23:07:57FromDiscord<TurtleP> oh, there is?
23:08:00FromDiscord<Elegantbeef> With it you could do `first < second`
23:08:11FromDiscord<TurtleP> huh, ok, awesome
23:08:20FromDiscord<Elegantbeef> Or i guess `first > second`
23:08:37FromDiscord<Elegantbeef> Just `import std/[os, times]` and you're golden 🙂
23:08:51FromDiscord<TurtleP> hmm this still returns a `Time` object
23:09:02FromDiscord<TurtleP> https://media.discordapp.net/attachments/371759389889003532/922989069372370994/unknown.png
23:09:11FromDiscord<Elegantbeef> what is `second` in your example?
23:09:22FromDiscord<TurtleP> they are both the last modification times for files
23:09:37FromDiscord<Elegantbeef> Dont you want to see if one was modified more recently?
23:09:48FromDiscord<TurtleP> yes
23:10:02FromDiscord<Elegantbeef> So then use that for both and then `first > second` will work
23:10:13FromDiscord<Elegantbeef> There is a `>` operator for that
23:10:13FromDiscord<TurtleP> https://media.discordapp.net/attachments/371759389889003532/922989362306752592/unknown.png
23:10:29FromDiscord<Elegantbeef> Do you have `times` imported?
23:10:36FromDiscord<TurtleP> hm, no
23:10:44FromDiscord<Elegantbeef> import it
23:10:46FromDiscord<TurtleP> ah that fixes it
23:10:48FromDiscord<Solitude> In reply to @treeform "I made everything run": im sure you could achieve the same speedup with {.byref.}, without changing copying semantics
23:10:51FromDiscord<TurtleP> kind of weird, but alright
23:10:59FromDiscord<Elegantbeef> Nim doesnt bring in all procedures with types since they're all freestanding
23:11:08FromDiscord<Elegantbeef> There is no way to say "Wherever you go you want this"
23:11:39FromDiscord<Elegantbeef> There is an RFC for "type bound operations" if i recall correctly, but it is what it is presently
23:12:03FromDiscord<Elegantbeef> I'm sure sabena will give a long winded reason why they should exist 😛
23:12:23FromDiscord<Sabena Sema> In reply to @Solitude "im sure you could": I bet the problem was not actually in parameter passing, since var paramters are always byref and default "no address" parameters should not be copying the inner string no matter what
23:12:26FromDiscord<Sabena Sema> if they are it's kinda a bug
23:12:28FromDiscord<demotomohiro> There is `fileNewer` proc in os module.↵https://nim-lang.org/docs/os.html#fileNewer%2Cstring%2Cstring
23:12:42FromDiscord<Elegantbeef> Ah there you go dont even need times
23:12:55FromDiscord<Elegantbeef> Thanks demo for making me redundant
23:16:22FromDiscord<demotomohiro> Elegantbeef, you teached important Nim features!
23:17:49FromDiscord<Solitude> In reply to @Sabena Sema "I bet the problem": no, the problem is that small objects containing strings that dont qualify for implicit reference passing are copied fully, including new string allocation
23:19:41FromDiscord<Sabena Sema> that seems like a bug to me
23:20:26FromDiscord<Solitude> maybe, i bet araq would say that its by design
23:21:04FromDiscord<Sabena Sema> I mean it might make the internals simpler, since assignment and the parameter copy would be the same
23:21:51FromDiscord<Sabena Sema> oh
23:22:35FromDiscord<Sabena Sema> no
23:22:40FromDiscord<Sabena Sema> all the subobjects also have no address
23:22:44*Colt quit (Remote host closed the connection)
23:23:10FromDiscord<Sabena Sema> so you can't mutate the inner strings or take their address
23:23:14*Colt joined #nim
23:23:16FromDiscord<Sabena Sema> so why copy them ever?
23:23:37FromDiscord<Solitude> you should ask that in #internals
23:25:07FromDiscord<TurtleP> ah thank you both @demotomohiro and @ElegantBeef!
23:27:35FromDiscord<TryAngle> the std/xmltree module causes huge bloat of whitespaces... is there a way to stip them away?
23:27:43FromDiscord<TryAngle> (edit) "causes" => "has a"
23:29:24*Colt quit (Remote host closed the connection)
23:29:50*Colt joined #nim
23:42:38FromDiscord<treeform> In reply to @Solitude "im sure you could": Do you have benchmarks to prove that?
23:44:10FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3J4Q
23:44:29FromDiscord<TryAngle> (edit) "https://play.nim-lang.org/#ix=3J4Q" => "https://paste.rs/PoY"
23:54:37*lumo_e quit (Ping timeout: 240 seconds)