00:23:46 | * | derpydoo joined #nim |
00:42:01 | * | derpydoo quit (Ping timeout: 246 seconds) |
01:26:35 | FromDiscord | <auxym> does `{.hint[name]: off.}` apply only to the module it is in? or the entire build? |
01:32:45 | FromDiscord | <exelotl> I'd expect it to be the module only |
01:33:47 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> Too much manual typing, just use a dot operator and make life difficult for everyone 😄 |
01:39:47 | FromDiscord | <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:35 | FromDiscord | <Elegantbeef> Eh, it's a mild issue that only effects specific objects |
01:40:36 | FromDiscord | <Elegantbeef> but yea it's a whole thing |
02:03:47 | * | arkurious quit (Quit: Leaving) |
04:57:40 | * | CyberTailor joined #nim |
05:15:30 | FromDiscord | <Girvo> In reply to @elcritch "are you using ORC": I'm using `refc` :/ |
05:16:26 | FromDiscord | <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:02 | FromDiscord | <wick3dr0se> How do you make a system call in Nim? Like to run `ps -ef` command in Linux for example |
06:18:25 | FromDiscord | <wick3dr0se> Like in C `system()` |
06:18:51 | FromDiscord | <Elegantbeef> `std/os` and `std/osproc` have `execCmd` and process procedures |
06:19:41 | FromDiscord | <wick3dr0se> Hey, thanks! I started learning Nim today and I'm attempting to write a kill process by name program in it |
06:20:41 | FromDiscord | <Girvo> If you want _actuall_ syscalls: https://github.com/def-/nim-syscall |
06:20:53 | FromDiscord | <Girvo> Linux-specific, mind |
06:22:05 | FromDiscord | <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:19 | FromDiscord | <Elegantbeef> It's a compiled programming language |
06:22:29 | FromDiscord | <wick3dr0se> It just reminds me of different syntax C |
06:22:46 | FromDiscord | <Elegantbeef> It's inspired by pascal which is empirically better |
06:23:13 | FromDiscord | <Bung> In reply to @exelotl "The main problem with": https://github.com/nim-lang/Nim/pull/20468 this might help |
06:23:15 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> It has a scripting subset |
06:23:51 | FromDiscord | <Elegantbeef> But it's only really meant for macros/compile time evaluations |
06:24:17 | FromDiscord | <Bung> also has awesome https://github.com/beef331/nimscripter |
06:25:23 | FromDiscord | <Elegantbeef> I still wouldnt say use Nimscript really |
06:25:38 | FromDiscord | <Elegantbeef> For small things compiled Nim is fine, for big things compiled Nim is fine |
06:26:38 | FromDiscord | <Bung> wrong typing |
06:26:47 | FromDiscord | <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:13 | FromDiscord | <wick3dr0se> I guess execCmd would be best |
06:31:15 | * | kenran joined #nim |
06:32:37 | FromDiscord | <wick3dr0se> Would you guys suggest anything for https? Like if you wanted to download a photo from the Unsplash API |
06:32:51 | FromDiscord | <Elegantbeef> `std/httpclient` |
06:33:27 | FromDiscord | <wick3dr0se> Thanks lol. You're good |
06:47:42 | FromDiscord | <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:00 | FromDiscord | <wick3dr0se> (edit) ""random")," => ""random")`," |
06:48:35 | FromDiscord | <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:13 | FromDiscord | <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:20 | FromDiscord | <morgan> or openarray |
06:55:18 | FromDiscord | <Elegantbeef> Only assertions, they're both not static values |
06:55:28 | FromDiscord | <Elegantbeef> One could intercept it with a macro though |
06:57:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4cOq |
06:57:50 | FromDiscord | <Elegantbeef> That of course doesnt work with the implicit array/seq passing as `varargs` |
07:14:11 | FromDiscord | <morgan> ah right yea |
07:14:12 | FromDiscord | <morgan> thanks |
07:31:19 | FromDiscord | <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:40 | FromDiscord | <huantian> The HttpClient examples should show how you’d use it |
08:29:32 | FromDiscord | <pyryrin> Is a seq in nim more like vector in c++ or list in c++ |
08:29:43 | FromDiscord | <Elegantbeef> Vector |
08:29:56 | FromDiscord | <pyryrin> Okay |
08:30:11 | FromDiscord | <pyryrin> So deletion and insertion is expensive |
08:30:29 | FromDiscord | <Elegantbeef> Deletion is only expensive if order matters |
08:31:01 | FromDiscord | <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:05 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "https://nim-lang.org/docs/manual_experimental.html#": Oh neat |
10:13:33 | FromDiscord | <Horizon [She/Her]> In reply to @exelotl "https://gist.github.com/1f387c47468d02be4587044ed27": That was what i was thinking of doing before haha |
10:30:54 | FromDiscord | <Phil> Whats the difference in c++?↵Is a vector a resizeable array and a list a linked list? |
10:46:16 | NimEventer | New 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:30 | FromDiscord | <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:04 | FromDiscord | <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:29 | FromDiscord | <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:22 | FromDiscord | <auxym> yeah, seemingly every language reinvents this terminology, haha |
13:21:41 | FromDiscord | <auxym> python lists are actually like nim seqs / c++ vectors |
13:22:57 | FromDiscord | <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:18 | FromDiscord | <Phil> Python lists were linked lists? |
14:18:20 | FromDiscord | <Phil> Huh |
14:24:42 | FromDiscord | <auxym> nah, like I said they are dynamically allocated arrays, like nim seqs, cpp vectors, java arraylist, etc |
14:25:35 | FromDiscord | <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:04 | FromDiscord | <albassort> you guys think i can write a better version of fcitx in nim |
15:39:13 | FromDiscord | <albassort> i would need to capture user input on the os level |
15:39:22 | FromDiscord | <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:46 | FromDiscord | <auxym> sdl? |
16:00:21 | FromDiscord | <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:06 | FromDiscord | <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:52 | FromDiscord | <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:51 | FromDiscord | <Horizon [She/Her]> Is there a way i could store information for a macro, in a pragma? |
17:23:05 | FromDiscord | <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:04 | FromDiscord | <gibson> @Horizon [She/Her] https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations |
17:54:59 | FromDiscord | <Horizon [She/Her]> Oh neat! |
17:58:50 | * | wallabra joined #nim |
18:02:38 | FromDiscord | <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:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRN |
18:17:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRO |
18:18:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4cRP |
18:20:36 | FromDiscord | <demotomohiro> !eval import sequtils; type Level = 0..9; echo toSeq Level.low .. Level.high |
18:20:42 | NimBot | @[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
18:26:09 | FromDiscord | <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:39 | FromDiscord | <mantielero (mantielero)> I am trying to do some C++ bindings. How do I wrap a pre-increment? |
20:05:47 | FromDiscord | <mantielero (mantielero)> I was trying something like\: |
20:05:55 | FromDiscord | <mantielero (mantielero)> `proc inc[K,V](self:var CppMapIterator[K,V]) {.importcpp:"++#" .}` |
20:07:13 | FromDiscord | <mantielero (mantielero)> I also tried\: |
20:07:20 | FromDiscord | <mantielero (mantielero)> `proc inc[K,V](self:CppMapIterator[K,V]):CppMapIterator[K,V] {.importcpp:"++#" .}` |
20:07:46 | FromDiscord | <mantielero (mantielero)> But I am getting errors about\: `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` |
20:08:00 | FromDiscord | <gibson> Isn't the pre-inc op in c++ named? |
20:08:05 | FromDiscord | <gibson> ex: `operator++()` |
20:09:08 | FromDiscord | <mantielero (mantielero)> This fails also\: `proc inc[K,V](self:var CppMapIterator[K,V]) {.importcpp:"#.operator++()" .}` |
20:10:49 | FromDiscord | <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:48 | FromDiscord | <Generic> Hm that is weird |
20:13:06 | FromDiscord | <mantielero (mantielero)> This is the code I am playing with\: https://pastebin.com/mBqLDr3b |
20:13:12 | FromDiscord | <Generic> The var parameter should be passed as a pointer |
20:13:43 | FromDiscord | <Generic> So it shouldn't compile with. Instead of -> |
20:14:08 | FromDiscord | <Generic> Unless it's different in the C++ backend |
20:14:56 | FromDiscord | <mantielero (mantielero)> Line 39 is the definition and line 48 where I use it. I compile like\: `nim cpp -r example.nim` |
20:23:32 | FromDiscord | <Generic> Can you show me the generated C++ code? |
20:26:43 | FromDiscord | <gibson> @mantielero This works for me as you had it, actually. `proc inc(this: Point) {.importcpp: "#.operator++()".}` |
20:27:35 | FromDiscord | <mantielero (mantielero)> https://pastebin.com/nGMqXjyA |
20:28:50 | FromDiscord | <mantielero (mantielero)> How is `Point` defined? |
20:31:03 | FromDiscord | <mantielero (mantielero)> @\_discord\_517047177961537548\:t2bot.io do you manage to compile/run my code? |
20:31:12 | FromDiscord | <mantielero (mantielero)> (@gibson) |
20:32:10 | FromDiscord | <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:30 | FromDiscord | <Generic> Have you tried using a simpler type? |
20:34:50 | FromDiscord | <Generic> I.e. not a string |
20:35:40 | FromDiscord | <mantielero (mantielero)> Not yet. |
20:37:17 | FromDiscord | <mantielero (mantielero)> Ok. It works |
20:37:35 | FromDiscord | <mantielero (mantielero)> The issue is not the binding, but how I use it within `iterator` |
20:38:31 | FromDiscord | <mantielero (mantielero)> sent a code paste, see https://play.nim-lang.org/#ix=4cSi |
20:48:23 | FromDiscord | <demotomohiro> `proc inc(x: var Test) {.importcpp: "++#".}` works:↵https://wandbox.org/permlink/JGW1XmKzKk68PJlE |
20:50:11 | FromDiscord | <mantielero (mantielero)> Yeah. It looks like both versions where right. Now trying to fix the iterator |
21:06:04 | FromDiscord | <mantielero (mantielero)> Fixed version\: https://pastebin.com/6hYv2tUW |
21:08:13 | FromDiscord | <mantielero (mantielero)> Thanks all |
21:17:16 | FromDiscord | <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:10 | FromDiscord | <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:36 | FromDiscord | <hotdog> Anyone know of a reasonable size project using npeg? |
22:27:38 | FromDiscord | <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:26 | FromDiscord | <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) |