<< 11-10-2022 >>

00:23:46*derpydoo joined #nim
00:42:01*derpydoo quit (Ping timeout: 246 seconds)
01:26:35FromDiscord<auxym> does `{.hint[name]: off.}` apply only to the module it is in? or the entire build?
01:32:45FromDiscord<exelotl> I'd expect it to be the module only
01:33:47FromDiscord<exelotl> In reply to @Event Horizon "Wonder how difficult it'd": https://gist.github.com/1f387c47468d02be4587044ed270c907 maybe not my most up to date version of this but it's pretty straightforward
01:37:48FromDiscord<Elegantbeef> Too much manual typing, just use a dot operator and make life difficult for everyone 😄
01:39:47FromDiscord<exelotl> The main problem with dot operators is that annoying bug where all wrong field accesses will now reference your custom operator in their error messages
01:40:35FromDiscord<Elegantbeef> Eh, it's a mild issue that only effects specific objects
01:40:36FromDiscord<Elegantbeef> but yea it's a whole thing
02:03:47*arkurious quit (Quit: Leaving)
04:57:40*CyberTailor joined #nim
05:15:30FromDiscord<Girvo> In reply to @elcritch "are you using ORC": I'm using `refc` :/
05:16:26FromDiscord<Girvo> I think I'm just going to have to run Valgrind/cachegrind against the server and see what pops up. _Something_ is leaking with my usage of AsyncSockets it seems
05:20:15*CyberTailor quit (Quit: Konversation terminated!)
05:22:10*CyberTailor joined #nim
05:31:13*CyberTailor quit (Quit: Konversation terminated!)
05:31:30*CyberTailor joined #nim
05:35:59*CyberTailor left #nim (#nim)
06:17:02FromDiscord<wick3dr0se> How do you make a system call in Nim? Like to run `ps -ef` command in Linux for example
06:18:25FromDiscord<wick3dr0se> Like in C `system()`
06:18:51FromDiscord<Elegantbeef> `std/os` and `std/osproc` have `execCmd` and process procedures
06:19:41FromDiscord<wick3dr0se> Hey, thanks! I started learning Nim today and I'm attempting to write a kill process by name program in it
06:20:41FromDiscord<Girvo> If you want _actuall_ syscalls: https://github.com/def-/nim-syscall
06:20:53FromDiscord<Girvo> Linux-specific, mind
06:22:05FromDiscord<wick3dr0se> So is Nim considered a scripting language as well? I read it takes syntactically from Python but it's not like BASH where I can just make a call to any command directly or write lines to a file witout open
06:22:19FromDiscord<Elegantbeef> It's a compiled programming language
06:22:29FromDiscord<wick3dr0se> It just reminds me of different syntax C
06:22:46FromDiscord<Elegantbeef> It's inspired by pascal which is empirically better
06:23:13FromDiscord<Bung> In reply to @exelotl "The main problem with": https://github.com/nim-lang/Nim/pull/20468 this might help
06:23:15FromDiscord<wick3dr0se> I like it a lot so far. I just got confused reading that it can handle high-level scripting or something like that somewhere
06:23:31FromDiscord<Elegantbeef> It has a scripting subset
06:23:51FromDiscord<Elegantbeef> But it's only really meant for macros/compile time evaluations
06:24:17FromDiscord<Bung> also has awesome https://github.com/beef331/nimscripter
06:25:23FromDiscord<Elegantbeef> I still wouldnt say use Nimscript really
06:25:38FromDiscord<Elegantbeef> For small things compiled Nim is fine, for big things compiled Nim is fine
06:26:38FromDiscord<Bung> wrong typing
06:26:47FromDiscord<wick3dr0se> Yea I'm not sure I need an interpreter but just a proficent way to make a call. I'll have to read the output line by line for a match to input
06:27:13FromDiscord<wick3dr0se> I guess execCmd would be best
06:31:15*kenran joined #nim
06:32:37FromDiscord<wick3dr0se> Would you guys suggest anything for https? Like if you wanted to download a photo from the Unsplash API
06:32:51FromDiscord<Elegantbeef> `std/httpclient`
06:33:27FromDiscord<wick3dr0se> Thanks lol. You're good
06:47:42FromDiscord<wick3dr0se> I can't seem to get downloadFile from std/httpclient to work. I tried `downloadFile(HttpClient, "https://source.unsplash.com/random", "random"), but I can't figure out what I'm doing wrong with it. It should save the image to a file named random
06:48:00FromDiscord<wick3dr0se> (edit) ""random")," => ""random")`,"
06:48:35FromDiscord<wick3dr0se> (edit) "I can't seem to get downloadFile from std/httpclient to work. I tried `downloadFile(HttpClient, "https://source.unsplash.com/random", "random")`, but I can't figure out what I'm doing wrong with it. It should save the image to" => "sent" | "file named random" => "long message, see http://ix.io/4cOp"
06:50:13FromDiscord<morgan> is there a way to have varargs with a minimum number of them (2, tho 1 would probably not be an issue, just not 0)
06:51:20FromDiscord<morgan> or openarray
06:55:18FromDiscord<Elegantbeef> Only assertions, they're both not static values
06:55:28FromDiscord<Elegantbeef> One could intercept it with a macro though
06:57:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4cOq
06:57:50FromDiscord<Elegantbeef> That of course doesnt work with the implicit array/seq passing as `varargs`
07:14:11FromDiscord<morgan> ah right yea
07:14:12FromDiscord<morgan> thanks
07:31:19FromDiscord<huantian> In reply to @wick3dr0se "I can't seem to": You’re passing it the type HttpClient instead of an instance of HttpClient
07:31:40FromDiscord<huantian> The HttpClient examples should show how you’d use it
08:29:32FromDiscord<pyryrin> Is a seq in nim more like vector in c++ or list in c++
08:29:43FromDiscord<Elegantbeef> Vector
08:29:56FromDiscord<pyryrin> Okay
08:30:11FromDiscord<pyryrin> So deletion and insertion is expensive
08:30:29FromDiscord<Elegantbeef> Deletion is only expensive if order matters
08:31:01FromDiscord<pyryrin> Okay
08:48:35*rockcavera quit (Remote host closed the connection)
08:50:45*PMunch joined #nim
09:07:38*estiquelapice joined #nim
10:12:05FromDiscord<Horizon [She/Her]> In reply to @Elegantbeef "https://nim-lang.org/docs/manual_experimental.html#": Oh neat
10:13:33FromDiscord<Horizon [She/Her]> In reply to @exelotl "https://gist.github.com/1f387c47468d02be4587044ed27": That was what i was thinking of doing before haha
10:30:54FromDiscord<Phil> Whats the difference in c++?↵Is a vector a resizeable array and a list a linked list?
10:46:16NimEventerNew thread by drkameleon: Packing integers and GMP bignums in a single value, see https://forum.nim-lang.org/t/9522
12:28:19*arkurious joined #nim
13:14:30FromDiscord<auxym> In reply to @Isofruit "Whats the difference in": yes. ps nim has linked lists in https://nim-lang.org/docs/lists.html
13:16:04FromDiscord<auxym> LLs are fast for insertions/deletions in the middle of the list (just update 2 pointers), but slow (and not cache friendly) for iteration through the list or searching for some element
13:18:29FromDiscord<Phil> In reply to @auxym "yes. ps nim has": I'm aware of linked list and how they work, no worries there, I'm just not aware behind what vocabulary c++ hides linked lists, aka if a list in c++ meant a linked list or the data type of a list implemented via array (see e.g. Java "arrayList")
13:21:22FromDiscord<auxym> yeah, seemingly every language reinvents this terminology, haha
13:21:41FromDiscord<auxym> python lists are actually like nim seqs / c++ vectors
13:22:57FromDiscord<auxym> and lua uses the same implementation for lists/arrays and hash tables, which is sort of interesting
14:10:13*PMunch quit (Remote host closed the connection)
14:18:18FromDiscord<Phil> Python lists were linked lists?
14:18:20FromDiscord<Phil> Huh
14:24:42FromDiscord<auxym> nah, like I said they are dynamically allocated arrays, like nim seqs, cpp vectors, java arraylist, etc
14:25:35FromDiscord<Phil> Ahhh I missed that connection, check
14:55:57*kenran quit (Remote host closed the connection)
15:33:09*xet7 quit (Remote host closed the connection)
15:39:04FromDiscord<albassort> you guys think i can write a better version of fcitx in nim
15:39:13FromDiscord<albassort> i would need to capture user input on the os level
15:39:22FromDiscord<albassort> or use gtk
15:39:37*rockcavera joined #nim
15:39:37*rockcavera quit (Changing host)
15:39:37*rockcavera joined #nim
15:42:46FromDiscord<auxym> sdl?
16:00:21FromDiscord<albassort> In reply to @auxym "sdl?": ?
16:28:44*wallabra quit (Ping timeout: 268 seconds)
16:30:22*wallabra joined #nim
16:48:02*wallabra quit (Ping timeout: 246 seconds)
16:49:06FromDiscord<auxym> what does fcitx do? SDL has stuff to capture user input for games and similar, and is portable across OSes https://github.com/nim-lang/sdl2
17:12:52FromDiscord<huantian> In reply to @albassort "you guys think i": I mean go for it but you’d have to rewrite all the plugins and stuff
17:21:51FromDiscord<Horizon [She/Her]> Is there a way i could store information for a macro, in a pragma?
17:23:05FromDiscord<Horizon [She/Her]> I wanna add `{.getter, setter, name("currentHealth", ["curHealth"]).}` pragmas so my macro can expand them automatically
17:25:44*rez joined #nim
17:45:25*genpaku quit (Remote host closed the connection)
17:48:42*genpaku joined #nim
17:53:04FromDiscord<gibson> @Horizon [She/Her] https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations
17:54:59FromDiscord<Horizon [She/Her]> Oh neat!
17:58:50*wallabra joined #nim
18:02:38FromDiscord<Phil> It's how I will likely expand norm models for my extensions, give you copious amounts of pragmas to give me metadata about the model field, like descriptive help texts
18:16:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRN
18:17:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRO
18:18:48FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRP
18:20:36FromDiscord<demotomohiro> !eval import sequtils; type Level = 0..9; echo toSeq Level.low .. Level.high
18:20:42NimBot@[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
18:26:09FromDiscord<Phil> I am not a smart man, thanks demo for the hint!
18:31:52*derpydoo joined #nim
18:58:38*pro joined #nim
19:17:08*pro quit (Quit: pro)
19:42:19*kenran joined #nim
19:50:17*kenran quit (Remote host closed the connection)
19:53:00*kenran joined #nim
19:53:46*kenran quit (Remote host closed the connection)
19:54:33*kenran joined #nim
20:05:39FromDiscord<mantielero (mantielero)> I am trying to do some C++ bindings. How do I wrap a pre-increment?
20:05:47FromDiscord<mantielero (mantielero)> I was trying something like\:
20:05:55FromDiscord<mantielero (mantielero)> `proc inc[K,V](self:var CppMapIterator[K,V]) {.importcpp:"++#" .}`
20:07:13FromDiscord<mantielero (mantielero)> I also tried\:
20:07:20FromDiscord<mantielero (mantielero)> `proc inc[K,V](self:CppMapIterator[K,V]):CppMapIterator[K,V] {.importcpp:"++#" .}`
20:07:46FromDiscord<mantielero (mantielero)> But I am getting errors about\: `SIGSEGV: Illegal storage access. (Attempt to read from nil?)`
20:08:00FromDiscord<gibson> Isn't the pre-inc op in c++ named?
20:08:05FromDiscord<gibson> ex: `operator++()`
20:09:08FromDiscord<mantielero (mantielero)> This fails also\: `proc inc[K,V](self:var CppMapIterator[K,V]) {.importcpp:"#.operator++()" .}`
20:10:49FromDiscord<gibson> I'm not sure you have tried importcpp on simple situations, it just looks like you're copy/pasting stuff into the quotes.
20:12:48FromDiscord<Generic> Hm that is weird
20:13:06FromDiscord<mantielero (mantielero)> This is the code I am playing with\: https://pastebin.com/mBqLDr3b
20:13:12FromDiscord<Generic> The var parameter should be passed as a pointer
20:13:43FromDiscord<Generic> So it shouldn't compile with. Instead of ->
20:14:08FromDiscord<Generic> Unless it's different in the C++ backend
20:14:56FromDiscord<mantielero (mantielero)> Line 39 is the definition and line 48 where I use it. I compile like\: `nim cpp -r example.nim`
20:23:32FromDiscord<Generic> Can you show me the generated C++ code?
20:26:43FromDiscord<gibson> @mantielero This works for me as you had it, actually. `proc inc(this: Point) {.importcpp: "#.operator++()".}`
20:27:35FromDiscord<mantielero (mantielero)> https://pastebin.com/nGMqXjyA
20:28:50FromDiscord<mantielero (mantielero)> How is `Point` defined?
20:31:03FromDiscord<mantielero (mantielero)> @\_discord\_517047177961537548\:t2bot.io do you manage to compile/run my code?
20:31:12FromDiscord<mantielero (mantielero)> (@gibson)
20:32:10FromDiscord<gibson> No, I get the same error as you with your code. Point is a simple class w/ 2 member variables.↵Maybe look here for some inspiration? https://github.com/Clonkk/nim-cppstl/blob/master/cppstl/std_vector.nim
20:34:30FromDiscord<Generic> Have you tried using a simpler type?
20:34:50FromDiscord<Generic> I.e. not a string
20:35:40FromDiscord<mantielero (mantielero)> Not yet.
20:37:17FromDiscord<mantielero (mantielero)> Ok. It works
20:37:35FromDiscord<mantielero (mantielero)> The issue is not the binding, but how I use it within `iterator`
20:38:31FromDiscord<mantielero (mantielero)> sent a code paste, see https://play.nim-lang.org/#ix=4cSi
20:48:23FromDiscord<demotomohiro> `proc inc(x: var Test) {.importcpp: "++#".}` works:↵https://wandbox.org/permlink/JGW1XmKzKk68PJlE
20:50:11FromDiscord<mantielero (mantielero)> Yeah. It looks like both versions where right. Now trying to fix the iterator
21:06:04FromDiscord<mantielero (mantielero)> Fixed version\: https://pastebin.com/6hYv2tUW
21:08:13FromDiscord<mantielero (mantielero)> Thanks all
21:17:16FromDiscord<demotomohiro> There is C++ STL wrapper for Nim:↵https://github.com/Clonkk/nim-cppstl↵But it doesn't support std::pair or std::map.
21:19:10FromDiscord<mantielero (mantielero)> Yeah. I am aware of nim-cppstl. Maybe I can contribute some code (but I am not a pro, so I don't think it will be as good)
21:29:06*kenran quit (Remote host closed the connection)
22:15:36FromDiscord<hotdog> Anyone know of a reasonable size project using npeg?
22:27:38FromDiscord<wick3dr0se> In reply to @huantian "You’re passing it the": Thanks man! I'll look into this and see if I can't find some noob-friendly example
22:47:28*derpydoo quit (Ping timeout: 246 seconds)
22:54:07*derpydoo joined #nim
23:52:26FromDiscord<Bung> In reply to @hotdog "Anyone know of a": I use a lot https://github.com/search?q=user%3Abung87+npeg&type=code
23:56:27*derpydoo quit (Ping timeout: 250 seconds)