00:00:13 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:37 | * | tk joined #nim |
00:04:45 | FromDiscord | <gibson> Yes, it just seems unnecessary, and means the syntax cleanliness comes with a non-zero cost. |
00:04:59 | anddam | considering this definition https://github.com/nimgl/imgui/blob/de9928dd091c29e4a6d9fa43e50219878730eb66/src/imgui.nim#L3016 |
00:05:12 | FromDiscord | <Yardanico> In reply to @gibson "Yes, it just seems": do you mean something like int(myEnumValue) ? |
00:05:28 | FromDiscord | <gibson> @Yardanico exactly. |
00:05:29 | FromDiscord | <Yardanico> this will be zero-cost with a normal C compiler like GCC or Clang |
00:05:34 | FromDiscord | <Yardanico> or most others |
00:05:43 | FromDiscord | <gibson> Oh really? okay, great. |
00:05:45 | anddam | this block https://github.com/nimgl/imgui#usage should actually have `igSliderFloat("float", addr(f), 0.0f, 1.0f)` with addr() right? |
00:05:59 | FromDiscord | <Yardanico> In reply to @anddam "this block https://github.com/nimgl/imgui#usage ": yes, that example is largely outdated |
00:06:09 | FromDiscord | <Yardanico> you should check tests/test.nim |
00:06:17 | anddam | Yardanico: ok but I have to start somewhere |
00:06:24 | anddam | oh thanks for the pointer |
00:07:53 | anddam | why does the manual refer to addr() as an operator if it's not listed at https://nim-lang.org/docs/manual.html#lexical-analysis-operators ? |
00:08:57 | FromDiscord | <Elegantbeef> Those are talking about symbol operators and `addr` is not a symbol operator π |
00:09:38 | FromDiscord | <Elegantbeef> Oh i missed the other operators, i think it's not overridable |
00:09:45 | FromDiscord | <Elegantbeef> As such it doesnt need to be mentioned there |
00:15:39 | anddam | last question (for tonight) the executables cannot load cimgui.so, shouldn't the nimgl/imgui package I installed have built that object? |
00:19:23 | FromDiscord | <Elegantbeef> I could be wrong but if you're using the C backend you need to build the shared object yourself, but when using C++ it'll work fine |
00:20:18 | FromDiscord | <Yardanico> yes, you're right |
00:20:31 | FromDiscord | <Yardanico> imgui is a C++ library and cimgui provides a C interface for that, so you need to build it yourself |
00:20:38 | FromDiscord | <Yardanico> or use Nim's C++ backend, then it'll use imgui directly |
00:28:17 | anddam | Yardanico: with cpp I then get errors since imageguie functions are not declared, https://termbin.com/ptcj |
00:29:07 | anddam | could this possibly be due to the use of proc igText*(fmt: cstring): void {.importc: "igText", varargs.} in imgui.nim, so that .cimport won't work with C++ backend? |
00:29:07 | FromDiscord | <Yardanico> weird, it shouldn't use cimgui when compiling with C++ |
00:30:24 | FromDiscord | <Elegantbeef> `importC` is just "importBackend" basically |
00:31:30 | anddam | I see, I built the cmimgui carried by imgui nim package |
00:31:36 | anddam | at /home/anddam/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui |
00:32:20 | * | yarrie quit (Read error: Connection reset by peer) |
00:32:47 | FromDiscord | <Yardanico> and how did you install imgui itself? |
00:33:07 | FromDiscord | <Yardanico> I just did `nimble install https://github.com/nimgl/imgui.git` . copied the example from https://github.com/nimgl/imgui/blob/master/tests/test.nim and it works with `nim cpp -r test.nim` |
00:34:01 | FromDiscord | <Yardanico> can you try adding `-f` to see if that helps? or maybe you modified any imgui files manually so that it doesn't work now? |
00:34:51 | * | krux02 quit (Remote host closed the connection) |
00:37:33 | anddam | I did not install imgui at all, it's in cimgui |
00:38:06 | FromDiscord | <Yardanico> huh? |
00:38:11 | FromDiscord | <Yardanico> nonono, you didn't understand |
00:38:17 | FromDiscord | <Yardanico> cimgui is only needed if you compile with the C backend |
00:38:27 | FromDiscord | <Yardanico> if you compile with the C++ backend you just install imgui and use it |
00:39:43 | anddam | Yardanico: ok, but since that did not work, with the C++ backend I tried to build cimgui and use the C backend |
00:42:23 | anddam | this is with -f https://termbin.com/cz0s |
00:42:59 | anddam | oh, my bad, I was trying back the "minimal" example of README |
00:43:06 | anddam | test.nim does actually build |
00:43:13 | anddam | and works too |
00:45:44 | anddam | just for the sake of curiosity, I tried to build the cimgui.so object and placed it near the executable and I get a segfault |
00:45:55 | anddam | what would be a proper way to use the C backend? |
00:46:15 | FromDiscord | <Yardanico> In reply to @anddam "just for the sake": as in? |
00:46:30 | FromDiscord | <Yardanico> first of all, on Linux you also need to make it use that .so file because it doesn't search for them in the current directory |
00:46:51 | FromDiscord | <Yardanico> with LD_LIBRARY_PATH for example |
00:47:01 | FromDiscord | <Yardanico> `LD_LIBRARY_PATH=. ./mybinary` |
00:48:59 | anddam | or place some dir where ld looks |
00:49:11 | anddam | I guess ~/.local/lib fits |
00:49:38 | FromDiscord | <Yardanico> nope |
00:51:07 | anddam | LD_LIBRARY_PATH=. I get the same segfault that I do without |
00:51:25 | FromDiscord | <Yardanico> what's the error message? |
00:51:28 | FromDiscord | <Yardanico> assuming you compiled in debug mode |
00:51:42 | anddam | $ file cimgui.so |
00:51:45 | anddam | cimgui.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7e1f2d3a229c937fe8df1c62675b9404461fcb8a, with debug_info, not stripped |
00:52:12 | anddam | https://termbin.com/ljxd |
00:52:44 | anddam | oh wait, I am a double-idiot |
00:52:44 | FromDiscord | <Yardanico> well because the code in that readme is not valid as I've said before |
00:52:46 | FromDiscord | <Yardanico> how did you modify it? |
00:52:54 | FromDiscord | <Yardanico> did you do `var f: ptr float32` by any chance? |
00:53:12 | FromDiscord | <Yardanico> the proper way would be to do igSliderFloat("float", addr f, ...) instead and just have it the same value |
00:55:07 | anddam | I went with the latter, addr(f) |
00:55:13 | FromDiscord | <Yardanico> hm |
00:55:33 | * | rockcavera joined #nim |
00:55:33 | * | rockcavera quit (Changing host) |
00:55:33 | * | rockcavera joined #nim |
00:55:37 | FromDiscord | <Yardanico> in any case, that example is not really usable as you don't even have a drawing loop |
00:55:48 | FromDiscord | <Yardanico> it's segfaulting because you didn't set up any contexts and stuff |
00:56:18 | FromDiscord | <Yardanico> so just use the example from tests/tests.nim and simplify it to your needs |
00:57:17 | FromDiscord | <gibson> @Yardanico Re: converter and int(enum) elision, godbolt confirms that with -O3 the compiler inlines everything and reduces the code to what I was expecting. Thanks! Very nice. |
00:57:46 | anddam | Yardanico: yep, that's what the double-idiot part was from, I figured that since I can build test.nim with the C backend and cimgui.so |
00:57:48 | FromDiscord | <Yardanico> In reply to @gibson "<@!177365113899057152> Re: converter and": -O3 is what Nim passes by default when you compile with -d:release or -d:danger btw |
00:57:58 | anddam | Yardanico: so I am stripping down the example |
00:58:01 | FromDiscord | <gibson> Yup! That's why I had to check with O3. |
00:58:04 | anddam | thanks *a lot* |
00:58:44 | FromDiscord | <gibson> It wasn't clear because with -d:release nim still generates the C code function call etc. |
00:58:58 | FromDiscord | <Yardanico> In reply to @gibson "Yup! That's why I": and yeah, this is a free conversion because enums are really just integers on the C side |
00:59:02 | FromDiscord | <Yardanico> `typedef NU8 tyEnum_DataCuDfe3rZKZRY6AsMu2JJnw;` |
00:59:15 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/912145168419917844/unknown.png |
00:59:50 | FromDiscord | <gibson> π€· I have long since given up claiming I "know" what the compiler is doing, and will happily defer to experts like you! |
01:00:01 | FromDiscord | <Yardanico> i'm far from being an expert :) |
01:00:17 | FromDiscord | <gibson> I scraped together all the typedefs and defines from nimbase etc. so my small example actually runs. |
01:00:32 | FromDiscord | <Yardanico> i don't know most of the stuff what compilers do either |
01:00:34 | FromDiscord | <Yardanico> In reply to @gibson "I scraped together all": heh |
01:01:07 | FromDiscord | <Yardanico> In reply to @gibson "I scraped together all": any reason you had to do that btw? godbolt supports Nim (even thought the support is far from perfect) |
01:01:18 | anddam | just as info 1.6.0 is ready to merge on Void https://github.com/void-linux/void-packages/pull/34106 |
01:02:30 | FromDiscord | <gibson> @Yardanico Oh my gosh, that's awesome. Last time I checked was a couple years ago and it was not there π€¦ββοΈ should've checked again. |
01:03:00 | FromDiscord | <Yardanico> also I'd recommend you to use `-d:danger --gc:arc` when checking stuff on godbolt for minimum assembly size |
01:03:21 | FromDiscord | <Yardanico> maybe even with LTO |
01:03:24 | * | xet7 quit (Remote host closed the connection) |
01:03:31 | FromDiscord | <gibson> Good pointers, thanks. |
01:04:30 | * | xet7 joined #nim |
01:04:57 | FromDiscord | <Yardanico> as you can see there's no real cost, it just moves the value with zero-extend (so 8-bit becomes 64-bit) https://media.discordapp.net/attachments/371759389889003532/912146594550390794/unknown.png |
01:05:19 | FromDiscord | <Yardanico> and if you return `int8` instead it's just a simple `mov` |
01:06:04 | FromDiscord | <gibson> I was very unsure if that and the converter fn call would all get optimized away. Having this built into godbolt is great and will help a lot as I learn more. |
01:06:27 | FromDiscord | <Yardanico> but yeah, about godbolt specifically - main problem with Nim is that it only allows you to view the assembly for the main module (the one you're editing on the left), it doesn't include assembly from other files (like stdlib) |
01:06:33 | FromDiscord | <Yardanico> which might be pretty confusing |
01:07:38 | FromDiscord | <gibson> Yes, I see that. Good and bad, because it definitely reduces the output, which is nice most of the time. |
01:08:00 | FromDiscord | <Yardanico> In reply to @gibson "I was very unsure": it's not a "converter" really, it's a safe type conversion, those things are (almost) free in Nim |
01:08:15 | FromDiscord | <Yardanico> i mean, even with a couple more assembly instructions the speed will probably be the same :) |
01:10:52 | FromDiscord | <gibson> My OP question was about Nim `converter`s and if they get optimized away for literals. I knew the type-safe conversions are free, but wasn't sure if I needed to explicitly write that or if the converter fn call in the generated c code would get optimized away. |
01:11:48 | FromDiscord | <Yardanico> In reply to @gibson "My OP question was": well, `converter`s won't get optimized on the Nim side obviously, it's up to the C compiler |
01:11:56 | FromDiscord | <Yardanico> converters are what's used to implicitly convert types in Nim |
01:12:16 | FromDiscord | <Yardanico> hm, actually it might with a const, lemme see |
01:12:19 | FromDiscord | <gibson> I was naively trying to put `{.compileTime.}` on the converter. |
01:12:43 | FromDiscord | <Yardanico> that makes it only work in compileTime, so when you're compiling the program |
01:12:59 | FromDiscord | <gibson> Yeah, I wanted the literals transformed. |
01:13:28 | FromDiscord | <gibson> Anyway, thanks, all confusion resolved! |
01:25:09 | * | dtomato joined #nim |
01:42:11 | * | dtomato quit (Read error: Connection reset by peer) |
01:43:13 | FromDiscord | <gibson> @Yardanico Interesting, Using Nim support in godbolt, I can't actually show an A/B comparison of this optimization. Using a converter on an enum for int(enum) adds 22 instructions. `-d:release --gc:arc --passL:-flto` https://godbolt.org/z/7W9j1Prfq |
01:43:51 | FromDiscord | <Yardanico> What happens if you add {.inline.} to the converter? |
01:44:49 | FromDiscord | <gibson> Then it indeed inlines the instruction obviating a jump, but otherwise it's the same outcome. |
01:45:13 | FromDiscord | <Yardanico> well, that's to be expected, converters are normal functions except called implicitly in nim |
01:45:51 | FromDiscord | <Yardanico> Usually it's recommended to avoid them, but they can be useful, yes |
01:46:03 | FromDiscord | <gibson> What I really want is a `template converter` π |
01:47:06 | FromDiscord | <gibson> It is definitely clearer to write `int(thing)` everywhere, but starts to add visual noise. |
01:47:48 | FromDiscord | <gibson> I'll just refactor to reduce. |
01:57:29 | FromDiscord | <impbox [ftsf]> hmm so my app is segfaulting, i'd like to get a stacktrace of where it's happening, any way to do this? |
01:58:00 | FromDiscord | <impbox [ftsf]> I see there's std/segfaults i tried importing that, but i'm not sure how to use it to get something useful to track down where it's happening |
01:58:55 | FromDiscord | <Elegantbeef> best to use `gdb` or similar and build it with `--debugger:native` |
01:59:38 | FromDiscord | <impbox [ftsf]> ack, will try that |
01:59:52 | FromDiscord | <impbox [ftsf]> i seem to recall getting stacktraces for segfaults in nim in the past, or am i imagining that? |
02:00:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKr |
02:00:52 | FromDiscord | <impbox [ftsf]> ohh, shakes fist at beef it's crashing because i uncommented my gl debug thing to test if it crashed for me too haha |
02:00:53 | FromDiscord | <Elegantbeef> So it should happen if it's caused by nim code |
02:08:40 | * | arkurious quit (Quit: Leaving) |
02:54:39 | FromDiscord | <π§ππ’> how do i create a table from constant data |
02:54:51 | FromDiscord | <π§ππ’> eg this should be a table |
02:54:51 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FKz |
02:55:42 | FromDiscord | <Elegantbeef> `.toTable` |
02:56:05 | FromDiscord | <Elegantbeef> `{"a": "b"}` creates an array of tuples |
02:56:07 | FromDiscord | <π§ππ’> does .newTable work to? |
02:56:27 | FromDiscord | <Elegantbeef> well they're different semantics |
02:56:36 | FromDiscord | <Elegantbeef> `new` implies a ref Table |
02:56:55 | FromDiscord | <Elegantbeef> the table is kinda useless anyway |
02:57:07 | FromDiscord | <π§ππ’> ah ok |
02:57:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKA |
02:59:46 | FromDiscord | <π§ππ’> thats a lot better damn |
03:00:04 | FromDiscord | <π§ππ’> im kinda doing this atm, any better way? |
03:00:08 | FromDiscord | <π§ππ’> sorry for the spam |
03:00:10 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=3FKB |
03:00:11 | FromDiscord | <π§ππ’> im kinda doing this atm, any better way? |
03:01:07 | FromDiscord | <Elegantbeef> `const Keywords = {tkConst..tkWhile}` ... `of Keywords` |
03:01:18 | FromDiscord | <π§ππ’> wdym |
03:01:32 | FromDiscord | <Elegantbeef> make a bitset for keywords instead of manually making trees |
03:01:36 | FromDiscord | <Elegantbeef> same for operators |
03:01:43 | FromDiscord | <π§ππ’> could u give an example |
03:01:46 | FromDiscord | <Elegantbeef> `const operators = {tkPlus .. tkGreaterEqual}` |
03:02:05 | FromDiscord | <π§ππ’> i struggle to see how this is cleaner |
03:02:22 | FromDiscord | <π§ππ’> could u provide a full example pls? |
03:03:05 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FKE |
03:03:21 | FromDiscord | <π§ππ’> ah i see |
03:03:24 | FromDiscord | <π§ππ’> thats a lot nicer |
03:04:13 | FromDiscord | <Elegantbeef> Then you can also do things like `someKind in Operators` or `someKind in Keywords` or `someKind notin (Operators + Keywords)` π |
03:04:20 | FromDiscord | <π§ππ’> ahhh |
03:04:21 | FromDiscord | <π§ππ’> i see |
03:04:42 | FromDiscord | <Elegantbeef> It's how we do bitflags in Nim |
03:04:53 | FromDiscord | <π§ππ’> wdym by that |
03:05:27 | FromDiscord | <Elegantbeef> Instead of `tkPlus or tkMinus or tkStar`.... we can do a set of the range which takes bit per value |
03:05:36 | FromDiscord | <π§ππ’> ohh i see |
03:05:38 | FromDiscord | <π§ππ’> thats cool |
03:05:52 | FromDiscord | <Elegantbeef> And then when checking if it's in it you do `tkPlus in yourSet` instead of `tkPlus and yourSet == tkPlus` |
03:06:47 | FromDiscord | <π§ππ’> how do i check if the string is a member of keywords tho? |
03:07:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKG |
03:08:32 | FromDiscord | <π§ππ’> do i need to do `tkConst = "const"` |
03:08:35 | FromDiscord | <π§ππ’> in my enum? |
03:08:37 | FromDiscord | <Elegantbeef> Yes |
03:09:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKH |
03:10:23 | FromDiscord | <Elegantbeef> There are many ways to handle this stuff |
03:21:46 | * | rockcavera quit (Remote host closed the connection) |
04:04:07 | * | Colt2 joined #nim |
04:04:07 | * | Colt2 quit (Changing host) |
04:04:07 | * | Colt2 joined #nim |
04:05:01 | * | Colt quit (Ping timeout: 268 seconds) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:11 | * | Colt2 quit (Client Quit) |
04:06:32 | * | supakeen joined #nim |
04:07:01 | * | Colt joined #nim |
04:15:55 | FromDiscord | <Hamid Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3FKN |
04:16:48 | FromDiscord | <Hamid Bluri> isn't it wierd : / |
04:16:51 | FromDiscord | <Hamid Bluri> (edit) "isn't it wierd : / ... " added "?" |
04:19:57 | FromDiscord | <Hamid Bluri> deleted my message - sorry it was a mistake |
04:48:27 | * | vicecea quit (Remote host closed the connection) |
04:48:57 | * | vicecea joined #nim |
05:03:03 | * | mahlon quit (Ping timeout: 265 seconds) |
05:06:00 | * | mahlon joined #nim |
05:44:18 | * | sagax joined #nim |
05:48:48 | * | flynn quit (*.net *.split) |
05:49:57 | * | flynn joined #nim |
05:54:59 | * | arkanoid quit (*.net *.split) |
05:54:59 | * | GreaseMonkey quit (*.net *.split) |
05:54:59 | * | Ekho quit (*.net *.split) |
05:54:59 | * | systemdsucks quit (*.net *.split) |
05:55:00 | * | nisstyre quit (*.net *.split) |
05:55:09 | * | greaser|q joined #nim |
05:55:28 | * | systemdsucks joined #nim |
05:55:35 | * | arkanoid joined #nim |
05:55:35 | * | nisstyre joined #nim |
05:57:50 | * | greaser|q quit (Changing host) |
05:57:50 | * | greaser|q joined #nim |
05:57:52 | * | greaser|q is now known as GreaseMonkey |
06:03:15 | FromDiscord | <creikey> Is there a difference between `pointer` and `ptr object` |
06:05:18 | FromDiscord | <Elegantbeef> What's the context? |
06:05:25 | FromDiscord | <Elegantbeef> `pointer` is a void pointer which accepts any pointer |
06:06:35 | * | Ekho joined #nim |
06:07:46 | FromDiscord | <creikey> In reply to @Elegantbeef "What's the context?": https://livebook.manning.com/book/nim-in-action/chapter-8/151 |
06:08:31 | FromDiscord | <creikey> difference between `proc pollEvent(event: pointer)` and `proc pollEvent(event: ptr object)` |
06:08:48 | FromDiscord | <creikey> when using the importc pragma and linking to a dynlib (sdl) |
06:09:10 | FromDiscord | <Elegantbeef> In that case `ptr object` should be a constraint of any `ptr object` |
06:09:15 | FromDiscord | <Elegantbeef> Atleast afaik |
06:10:12 | FromDiscord | <creikey> In reply to @Elegantbeef "In that case `ptr": what |
06:11:08 | FromDiscord | <creikey> my reasoning is `SdlWindow = object` was defined above as like an "opaque struct" where we don't care about its fields, so if here we need an `SDL_Event` you can just do `ptr object` instead of defining a separate typ |
06:11:10 | FromDiscord | <creikey> (edit) "typ" => "type" |
06:11:19 | FromDiscord | <Elegantbeef> `proc pollEvent(event: ptr object)` is a generic equivlent to `proc pollEvent[T](event: ptr T)` |
06:11:25 | FromDiscord | <creikey> (edit) "fields," => "fields then used later like `ptr SdlWindowPtr`," |
06:12:01 | FromDiscord | <creikey> In reply to @Elegantbeef "`proc pollEvent*(event: ptr object)`": how does this compare to `pointer`? |
06:12:13 | FromDiscord | <Elegantbeef> pointer takes any `ptr T` |
06:12:19 | FromDiscord | <Elegantbeef> so even `ptr int` |
06:12:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL2 |
06:13:17 | FromDiscord | <Elegantbeef> B is an object definition that is a `ptr` not an alias, which i guess is confusing |
06:13:33 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3FL3 |
06:13:38 | FromDiscord | <creikey> so it is ptr object |
06:13:41 | FromDiscord | <creikey> but it's not the address |
06:13:51 | FromDiscord | <creikey> but the address is ptr object so why is it not B if B is ptr object |
06:14:11 | FromDiscord | <Elegantbeef> B is a unique type |
06:14:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL4 |
06:14:37 | FromDiscord | <Elegantbeef> That's valid for instance |
06:14:58 | FromDiscord | <Elegantbeef> as a parameter `ptr object` is just like `object` it will only take a pointer to an object |
06:14:59 | FromDiscord | <creikey> In reply to @Elegantbeef "B is a unique": so `B is ptr object` but `ptr object isnot B` |
06:15:53 | FromDiscord | <Elegantbeef> just like `proc doThing(a: object)` will take any object |
06:16:05 | FromDiscord | <Elegantbeef> It's a generic in this context |
06:17:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL5 |
06:17:54 | FromDiscord | <Rika> Should have made y a string |
06:17:55 | FromDiscord | <creikey> those both work? |
06:18:21 | FromDiscord | <creikey> In reply to @Elegantbeef "It's a generic in": is it a generic like it'll generate function definitions for all valid types its used with |
06:18:27 | FromDiscord | <Elegantbeef> Yes cause `object` is a implict generic |
06:18:32 | FromDiscord | <Elegantbeef> it's a generic typeclass |
06:19:25 | FromDiscord | <Elegantbeef> Which is what `ptr object` is based on `object` is a typeclass so the proc is generic and turned into `proc doThing[T](a: ptr[T])` |
06:19:45 | FromDiscord | <creikey> so `proc doThing(a: pointer) = echo a` can take `addr(5)` but `proc doThing(a: ptr object) = echo a` can't |
06:19:55 | FromDiscord | <creikey> ptr to generic type |
06:20:42 | FromDiscord | <Elegantbeef> yep |
06:20:49 | FromDiscord | <Elegantbeef> cause `int isnot object` |
06:20:53 | FromDiscord | <creikey> right |
06:20:58 | FromDiscord | <creikey> so it's not a generic that can take any type |
06:21:01 | FromDiscord | <creikey> only things that `is object` |
06:21:38 | FromDiscord | <Elegantbeef> yea i messed up it should've been `proc doThing[T: object](a: ptr[T])` |
06:21:59 | FromDiscord | <creikey> In reply to @Elegantbeef "yea i messed up": I haven't read the metaprogramming chapter or tutorial, is there something like rust's traits for generics or java's/golang's interfaces where you specify what you want the generic type to be able to do |
06:22:12 | FromDiscord | <Rika> No |
06:22:30 | FromDiscord | <Rika> Well βnoβ |
06:22:41 | FromDiscord | <Elegantbeef> There are concepts which do that |
06:22:43 | FromDiscord | <creikey> oh you gotta use objects for polymorphism |
06:22:46 | FromDiscord | <creikey> like inheritance |
06:22:52 | FromDiscord | <creikey> and there isn't multiple inheritance or interfaces |
06:23:02 | FromDiscord | <Rika> Object and others are special cases, otherwise you need to βorβ types if you want to limit them |
06:23:22 | FromDiscord | <Rika> Concepts are experimental |
06:23:26 | FromDiscord | <creikey> concepts lol |
06:23:39 | FromDiscord | <creikey> In reply to @Rika "Concepts are experimental": it's still conceptual |
06:23:50 | FromDiscord | <Rika> It is not, it is implemented |
06:24:04 | FromDiscord | <creikey> I would be very concerned if concepts aren't conceptual |
06:24:07 | FromDiscord | <creikey> then they must've done something wrong |
06:25:05 | * | theoroer joined #nim |
06:25:10 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3FL8 |
06:25:24 | theoroer | why are `dup` in `sugar` and `with` in `std/with` named differently and in different modules when they have the same implementation |
06:25:25 | FromDiscord | <creikey> then I want to make a bunch of different Thing s with different data and they each have their own draw method |
06:25:45 | FromDiscord | <Rika> They arenβt the same |
06:26:13 | FromDiscord | <Rika> In reply to @creikey "what if I have": Needs ref objects and inheritance. Concepts are compile time |
06:26:18 | FromDiscord | <Elegantbeef> Single parent inheritance might be the solutio nthere crikey |
06:26:45 | theoroer | https://github.com/nim-lang/Nim/blob/version-1-6/lib/std/with.nim#L38-L39 https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/sugar.nim#L284-L288 |
06:27:18 | FromDiscord | <creikey> In reply to @Rika "Needs ref objects and": how could something like that be done at compile time? you need the vtable right |
06:27:31 | FromDiscord | <Rika> Look again, with is a statement, dup is an expression is it not? |
06:27:50 | FromDiscord | <Rika> In reply to @creikey "how could something like": It is checked on compile time. You cannot store a concept in a sequence |
06:28:06 | FromDiscord | <Rika> Concepts do not exist on runtime |
06:28:13 | theoroer | stmtlistexpr and stmtlist are semantically the same |
06:28:26 | FromDiscord | <Elegantbeef> They do different things |
06:28:48 | theoroer | but they both use an std/private module when they could just both be in the same module |
06:28:54 | FromDiscord | <Elegantbeef> with allows you to do `.things` dup takes a proc call that takes `var T` and copies inline calling it and returning the `var` |
06:29:04 | FromDiscord | <Elegantbeef> Sure they could be it's bad that they're seperated |
06:29:21 | FromDiscord | <Rika> The reason they are in other modules is because of a lot of things |
06:29:45 | theoroer | if im not mistaken you could literally define dup as a template over with |
06:29:57 | FromDiscord | <Rika> I would have personally called βwithβ βexpand fieldsβ instead |
06:30:31 | theoroer | what do you mean, it doesn't deal with fields at all |
06:30:58 | FromDiscord | <Rika> Am I thinking of another with then |
06:31:07 | FromDiscord | <Rika> See this is why itβs a bad name |
06:31:12 | theoroer | https://nim-lang.org/docs/with.html#with.m%2Ctyped%2Cvarargs%5Buntyped%5D |
06:33:00 | FromDiscord | <Rika> Okay yes this is a different with from what I remember |
06:33:01 | theoroer | lol, there is a nimble package named with that is different, but the std with is also in its own module for some reason |
06:33:08 | FromDiscord | <Rika> Yes |
06:33:13 | FromDiscord | <Rika> It fucks with your head |
06:33:19 | FromDiscord | <Rika> I just checked the standard with |
06:33:26 | FromDiscord | <Rika> Yeah I donβt see how this is much different from dup |
06:34:04 | theoroer | weirdest decision ever to do it like this |
06:34:18 | FromDiscord | <Rika> I assume they were implemented at other times |
06:34:26 | FromDiscord | <Rika> I mean different times |
06:35:13 | FromDiscord | <Elegantbeef> Luckily `std/with` sucks anyway afaik |
06:35:19 | FromDiscord | <Elegantbeef> Not that I have really used it |
06:37:59 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/912230411395006484/unknown.png |
06:38:55 | * | theoroer quit (Ping timeout: 256 seconds) |
06:39:20 | FromDiscord | <Rika> Nice |
06:40:00 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/theindex.html save yourself from an embarrassing search history π |
06:40:41 | FromDiscord | <creikey> nim supports peg?? |
06:40:48 | FromDiscord | <creikey> (edit) "peg??" => "peg matching??" |
06:41:41 | FromDiscord | <creikey> the code isn't even that complicatd |
06:41:43 | FromDiscord | <creikey> (edit) "complicatd" => "complicated" |
06:41:58 | FromDiscord | <Elegantbeef> There's an even cooler implementation in https://github.com/zevv/npeg |
06:42:07 | FromDiscord | <Elegantbeef> But yes the stdlib has `PEG` |
06:42:19 | FromDiscord | <creikey> it's like 2k lines and it looks just like peg but it's in nim |
06:55:36 | Zevv | 1.5k, effectively :) |
07:00:25 | * | theoroer joined #nim |
07:20:04 | * | theoroer quit (Quit: Client closed) |
07:21:50 | FromDiscord | <claude> are identifiers as template calls documented? they're everywhere but I don't remember seeing the documentation for them anywhere |
07:22:41 | FromDiscord | <Rika> What? |
07:23:31 | FromDiscord | <Elegantbeef> Give a concrete example and we might be able to help |
07:23:38 | FromDiscord | <Elegantbeef> There are two things you may be talking about |
07:25:20 | FromDiscord | <claude> `template name: untyped = 3; echo name 3` |
07:26:01 | FromDiscord | <Elegantbeef> Ah yea that's what i thought, i dont think it's documented specifically anywhere |
07:26:01 | FromDiscord | <Rika> Why would you do that over a constant? |
07:26:15 | FromDiscord | <Elegantbeef> It's just an example rika, you can do it for anything |
07:26:22 | FromDiscord | <claude> for the sake of the example |
07:26:33 | FromDiscord | <Rika> I know but even expanding outward I do not see a reason |
07:27:12 | FromDiscord | <claude> would you have preferred i write it out longer |
07:27:18 | FromDiscord | <Elegantbeef> I use it in the nimscript interop so you dont have to do `time()` |
07:28:05 | FromDiscord | <Elegantbeef> but yea it's often needed/desired i reason, i think the case is just you cannot do `var a = someTemplate` so it only makes sense to expand macros/templates when their name appears and they take no arguments |
07:28:12 | FromDiscord | <Elegantbeef> it's not often needed/desired |
07:29:22 | * | theoroer joined #nim |
07:32:34 | * | PMunch joined #nim |
08:26:11 | * | krux02 joined #nim |
08:30:12 | * | krux02 quit (Remote host closed the connection) |
08:30:38 | * | neurocyte0132889 joined #nim |
08:30:38 | * | neurocyte0132889 quit (Changing host) |
08:30:39 | * | neurocyte0132889 joined #nim |
08:30:47 | * | stkrdknmibalz joined #nim |
09:17:35 | * | theoroer quit (Ping timeout: 256 seconds) |
09:28:34 | * | notchris quit (Ping timeout: 265 seconds) |
09:28:35 | * | elph quit (Ping timeout: 264 seconds) |
09:29:03 | * | euantorano quit (Ping timeout: 260 seconds) |
09:29:04 | * | robertmeta quit (Ping timeout: 260 seconds) |
09:29:11 | * | ormiret quit (Ping timeout: 264 seconds) |
09:29:22 | * | LyndsySimon quit (Ping timeout: 268 seconds) |
09:29:22 | * | ormiret joined #nim |
09:30:23 | * | elph joined #nim |
09:30:28 | * | robertmeta joined #nim |
09:30:33 | * | euantorano joined #nim |
09:32:19 | * | notchris joined #nim |
09:33:13 | * | LyndsySimon joined #nim |
09:46:44 | * | Vladar joined #nim |
10:00:41 | NimEventer | New Nimble package! threading - New atomics, thread primitives, channels and atomic refcounting for --gc:arc/orc., see https://github.com/nim-lang/threading |
10:33:46 | * | sagax quit (Excess Flood) |
10:48:43 | * | advesperacit joined #nim |
10:55:25 | * | Guest66 joined #nim |
10:56:21 | * | Guest66 quit (Client Quit) |
10:56:41 | * | Guest66 joined #nim |
10:57:42 | advesperacit | Does anyone have experience compiling statically linked binaries from nim? Using musl-gcc my code compiles but fails to run with "Dynamic loading not supported" and "could not load: libcrypto.so(.1.1|...)" |
10:59:19 | FromDiscord | <Yardanico> In reply to @advesperacit "Does anyone have experience": that's because when compiling statically with musl you won't be able to load shared libraries, and you're using httpclient with -d:ssl (or just -d:ssl with net) which requires openssl |
10:59:27 | FromDiscord | <Yardanico> so you need to also link openssl (or libressl) statically |
10:59:28 | * | Guest66 quit (Client Quit) |
11:00:29 | * | sagax joined #nim |
11:00:37 | FromDiscord | <Yardanico> for libressl you can compile it statically and compile your nim code with flags like this |
11:00:45 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FMi |
11:01:24 | FromDiscord | <Yardanico> (threads:on enables pthreads which seem to be required for libressl) |
11:02:14 | FromDiscord | <lenis> pretty annoying that threads:on doesnt work with librtl |
11:02:24 | advesperacit | Thanks! I'll try to get it working with that. I'm using both threads and ssl. |
11:08:43 | FromDiscord | <lenis> does anyone know how arc/orc performs relative to refc or markAndSweep |
11:09:16 | FromDiscord | <lenis> I heard that arc/orc is recommended in modern nim but i thought that GCs are generally substantially faster than simple reference countingh |
11:09:18 | FromDiscord | <lenis> (edit) "countingh" => "counting" |
11:09:21 | FromDiscord | <Yardanico> the answer is - it depends |
11:09:28 | FromDiscord | <Yardanico> see https://nim-lang.org/blog/2020/12/08/introducing-orc.html |
11:09:33 | FromDiscord | <Yardanico> arc itself is just refcounting with RAII and other nice stuff |
11:09:36 | FromDiscord | <Rika> Do you aim for latency, throughput, or (I forgot the last one) |
11:09:45 | FromDiscord | <Yardanico> In reply to @Rika "Do you aim for": memory usage |
11:09:46 | FromDiscord | <Yardanico> (edit) "usage" => "usage?" |
11:09:50 | FromDiscord | <Rika> Not sure |
11:09:55 | FromDiscord | <Rika> I think |
11:10:19 | * | neurocyte0132889 quit (Ping timeout: 260 seconds) |
11:10:53 | * | neurocyte0132889 joined #nim |
11:10:53 | * | neurocyte0132889 quit (Changing host) |
11:10:53 | * | neurocyte0132889 joined #nim |
11:10:56 | FromDiscord | <lenis> memory usage should be ARC/ORC, especially with useMalloc |
11:11:03 | FromDiscord | <lenis> but i mean throughput |
11:11:32 | FromDiscord | <Yardanico> i think for throughput markAndSweep might be faster, but you should always benchmark for your specific case |
11:12:12 | FromDiscord | <Yardanico> In reply to @Yardanico "see https://nim-lang.org/blog/2020/12/08/introducin": https://media.discordapp.net/attachments/371759389889003532/912299417871187998/unknown.png |
11:12:40 | FromDiscord | <Yardanico> this is a bit of a biased example of course, but still |
11:12:43 | FromDiscord | <Yardanico> always check for yourself :) |
11:14:47 | FromDiscord | <Yardanico> but yes, arc/orc are really good for any kind of interop or for more "weird" targets like webassembly |
11:15:02 | FromDiscord | <Yardanico> refc won't work on things like webassembly at all, not sure about m&s |
11:20:18 | FromDiscord | <lenis> lol, the first example in that post runs a full gc every 10 requests |
11:20:38 | FromDiscord | <lenis> yeah so the second is about what i'd expect. but the difference is surprisingly small |
11:20:42 | FromDiscord | <Rika> It can happen |
11:21:02 | FromDiscord | <Rika> Itβs not small Iβd say |
11:21:22 | FromDiscord | <Yardanico> In reply to @Rika "Itβs not small Iβd": it is |
11:21:29 | FromDiscord | <Yardanico> orc and m&s are very different so that difference is quite small |
11:21:31 | FromDiscord | <Rika> Is it that small? |
11:21:41 | FromDiscord | <Yardanico> 35k vs 40k req/sec in that post |
11:21:48 | FromDiscord | <Rika> Oh you mean throughput |
11:21:51 | FromDiscord | <lenis> 13% slower on ORC |
11:21:54 | FromDiscord | <Rika> Yeah I guess |
11:22:01 | FromDiscord | <Yardanico> and latency is much much lower on ORC |
11:22:03 | FromDiscord | <Yardanico> along with memory |
11:22:12 | FromDiscord | <lenis> and that benchmark is quite harsh in memory allocation |
11:22:27 | FromDiscord | <lenis> all data is allocated in the heap and short lived |
11:28:12 | FromDiscord | <lenis> I do wonder how it compares to refc with GC_step control |
11:28:30 | FromDiscord | <Rika> Benchmark time |
11:54:03 | FromDiscord | <Fish-Face> Is there type that can provide 64bit integers on the JS target? I am doing a demo for some people and could use float, but would rather use a bigint of some kind, or more explicit integer typing, because float would look unnecessarily weird and confusing in such an intro |
11:58:53 | FromDiscord | <lenis> In reply to @Rika "Benchmark time": I have been compiling wrk for the last 15 min |
11:58:54 | FromDiscord | <lenis> kms |
11:59:21 | FromDiscord | <lenis> I should have preinstalled libssl |
11:59:51 | FromDiscord | <Rika> In reply to @Fish-Face "Is there type that": https://nim-lang.github.io/Nim/jsbigints.html ? |
12:00:27 | FromDiscord | <lenis> In reply to @Fish-Face "Is there type that": I believe it was just added in nim 1.6 |
12:02:18 | FromDiscord | <Yardanico> In reply to @Fish-Face "Is there type that": as I've mentioned before, you can use bigints |
12:04:57 | FromDiscord | <lenis> @RikaWow |
12:05:30 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FMC |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:02 | FromDiscord | <Yardanico> arc will leak memory |
12:06:07 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/jP9 |
12:06:13 | FromDiscord | <narimiran> Nim Community Survey 2021 is here! https://nim-lang.org/blog/2021/11/22/community-survey-2021.html |
12:06:31 | * | supakeen joined #nim |
12:07:16 | FromDiscord | <narimiran> Everything should work, but if you notice some errors/typos, please let me know before we spread the word on reddit, twitter, hn, etc. |
12:07:22 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FMF |
12:07:22 | FromDiscord | <Yardanico> In reply to @lenis "this is with ORC": nice |
12:09:35 | FromDiscord | <lenis> ORC seems to cap out at 39.9K requests/s |
12:10:52 | FromDiscord | <lenis> ARC caps at 42.9K requests/s |
12:11:45 | FromDiscord | <lenis> REFC only 1412req/s |
12:13:20 | FromDiscord | <lenis> correction, refc can go up to 42.0K req/s |
12:13:49 | FromDiscord | <lenis> so, it seems that, in this specific benchmark. arc > refc > orc for throughput |
12:15:31 | FromDiscord | <Yardanico> In reply to @lenis "so, it seems that,": well that's obvious, because `arc` doesn't deal with cycles and async has a lot of cycles |
12:15:36 | FromDiscord | <Yardanico> orc has to actually check cycles |
12:15:39 | FromDiscord | <Yardanico> and collect them |
12:15:48 | FromDiscord | <Yardanico> so if you're fine with memory leaking, you can use arc, yes :) |
12:15:51 | FromDiscord | <Yardanico> (for async) |
12:17:40 | NimEventer | New thread by Miran: Nim Community Survey 2021, see https://forum.nim-lang.org/t/8647 |
12:36:22 | FromDiscord | <lenis> In reply to @Yardanico "well that's obvious, because": Yeah you're right. I logged the memory. ORC uses ~200MB, refc and markAndSweep use ~400MB and arc uses over a GB |
12:36:28 | FromDiscord | <Yardanico> exactly :) |
12:37:17 | FromDiscord | <lenis> in the 10s test the cycle collector seems to run about 10 times |
12:37:44 | FromDiscord | <lenis> but the interesting part is that the cycle collector on refc/markAndSweep is about 30-40x slower |
12:38:24 | FromDiscord | <lenis> ORC's mac response time is just over 1ms, while refc/markAndSweep have about 35ms |
12:39:09 | FromDiscord | <lenis> I believe thats because ORC uses static analysis to detect acyclic code, and exempts that memory from the cycle collector. apparently refc and mas dont do this |
12:39:21 | FromDiscord | <Yardanico> In reply to @lenis "I believe thats because": yes, you can also give it hints yourself |
12:39:33 | FromDiscord | <Yardanico> if you mark an object that can potentially be cyclic as `{.acyclic.}` ORC won't check it for cycles |
12:41:39 | FromDiscord | <lenis> pretty awesome |
12:41:48 | FromDiscord | <lenis> I like that you can do microoptimizations like that in nim |
12:42:08 | FromDiscord | <lenis> just like how you can use `likely` to improve branch prediction |
12:42:21 | FromDiscord | <lenis> it actually makes a substantial difference on performance sensitive code |
12:42:57 | FromDiscord | <lenis> I was able to improve the performance of a big loop I had by about 30% using likely/unlikely |
12:43:47 | FromDiscord | <Yardanico> In reply to @lenis "I was able to": you should also try using PGO, it can optimize that stuff automatically |
12:44:08 | FromDiscord | <Yardanico> and yeah, `likely` is a hint to the C compiler, in some cases it can make the code slower |
12:45:02 | FromDiscord | <lenis> i was using a double for loop on a 2-dimensional plane and had an if statement that runs on the outer bound edge only |
12:45:36 | FromDiscord | <lenis> so i already know compile time there is only a 1% chance or so that it will enter that branch |
12:46:01 | FromDiscord | <Yardanico> well, with PGO you run your code with instrumentation on all workloads it usually runs on, and then use that profiling data to help the compiler know which branches are "hotter" |
12:46:08 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/6295 for clang lto + pgo |
12:47:04 | * | rockcavera joined #nim |
12:47:04 | * | rockcavera quit (Changing host) |
12:47:04 | * | rockcavera joined #nim |
12:48:33 | FromDiscord | <hmmm> bois wot is dis hint: Hint: 'parse' cannot raise 'Defect' |
12:48:53 | FromDiscord | <Yardanico> In reply to @hmmm "bois wot is dis": you specified {.raises: [Defect].} for your parse proc but it doesn't do that |
12:49:00 | FromDiscord | <Yardanico> or something similar |
12:49:11 | FromDiscord | <hmmm> I'm doing a try parse datetime except TimeParseError and it works fine but get the hint |
12:49:17 | FromDiscord | <hmmm> no I'm not using curly braces at all |
12:49:46 | FromDiscord | <Yardanico> interesting |
12:49:51 | FromDiscord | <Yardanico> can you show the code? |
12:49:52 | FromDiscord | <hmmm> hmmm |
12:50:01 | FromDiscord | <hmmm> wait I try to clean up the mess lol |
12:51:51 | FromDiscord | <Yardanico> yeah I see the hint too |
12:52:35 | FromDiscord | <hmmm> ah ok |
12:52:52 | FromDiscord | <hmmm> how do I paste code thingies in the code block of discord |
12:53:51 | FromDiscord | <Yardanico> triple quotes newline code newline triplequotes |
12:53:56 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=1pIT |
12:54:08 | FromDiscord | <hmmm> """ |
12:54:11 | FromDiscord | <hmmm> hmmm |
12:54:22 | FromDiscord | <Yardanico> backticks |
12:54:39 | FromDiscord | <Yardanico> and you don't need to post, I already found out what you're talking about |
12:54:53 | FromDiscord | <hmmm> okok it was just for general knowledge lol |
12:55:02 | FromDiscord | <lenis> sent a code paste, see https://play.nim-lang.org/#ix= |
12:55:02 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=1pIT |
12:55:14 | FromDiscord | <hmmm> oh yiss I'm a genius |
13:01:41 | FromDiscord | <hmmm> can I name an type thingy = enum with lowercase or nim gets angry? |
13:02:09 | * | TechAspirer joined #nim |
13:03:00 | FromDiscord | <Yardanico> yes you can |
13:03:06 | FromDiscord | <Yardanico> PascalCase for types is just a convention |
13:03:10 | FromDiscord | <Yardanico> so it's easier to understand that it's a type |
13:04:14 | FromDiscord | <hmmm> π |
13:04:29 | * | kayabaNerve_ quit (Ping timeout: 250 seconds) |
13:05:31 | PMunch | Those "hello" messages was sent over the Discord bridge as links to the playground :P |
13:07:10 | FromDiscord | <Yardanico> yeah the bridge treats all triple backticks code blocks as code pastes |
13:07:16 | FromDiscord | <Yardanico> Because they're almost always multi line |
13:07:32 | FromDiscord | <Yardanico> `we have single backticks for inline code` |
13:14:34 | PMunch | By the way, sometimes people send a short message and some code, and it all gets turned into a paste |
13:14:42 | PMunch | This is a bit awkward |
13:14:50 | FromDiscord | <evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3FMZ |
13:15:21 | PMunch | Case in point: https://play.nim-lang.org/#ix=3FMZ |
13:15:38 | PMunch | And why does it convert * to those weird circle things? |
13:16:04 | PMunch | It means that everything with an export marker needs to be rewritten to run on the playground |
13:16:13 | FromDiscord | <hmmm> hmm how do I print all the possible enums of an enum |
13:18:02 | PMunch | cat mycodefile.nim | grep "MyEnum = enum" |
13:20:19 | supakeen | ohno |
13:21:48 | FromDiscord | <hmmm> nu wait the real question was how do I set an enum with his ord number instead of name |
13:22:06 | PMunch | 100.MyEnum? |
13:22:19 | FromDiscord | <hmmm> hmmmmmmmmm |
13:22:26 | FromDiscord | <hmmm> maybe! |
13:22:27 | FromDiscord | <hmmm> wait |
13:24:43 | FromDiscord | <hmmm> it worked π€¨ |
13:24:50 | FromDiscord | <hmmm> never imagined it would lol |
13:26:10 | PMunch | Why wouldn't it? :P |
13:26:27 | * | src joined #nim |
13:27:35 | FromDiscord | <hmmm> no fkn idea lol π
|
13:30:52 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3FN9 |
13:37:57 | PMunch | That makes no sense, 3 is an int, not an enum type |
13:38:28 | PMunch | But 3.Enummie explicitly converts it to one |
13:41:54 | FromDiscord | <ag> Has there been any improvements on Nim debugging & profiling workflow since this blog post was written?β΅https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.htmlβ΅β΅I guess there is NLVM, but do we have anything else? NLVM doesn't support some useful pragmas. |
13:45:58 | FromDiscord | <ag> (I mainly use Windows) |
13:46:33 | FromDiscord | <ag> Thinking about it a bit more, I guess since Nim generates C/C++ sources it would be hard to debug. Is there a way to generate sourcemaps or something to use with the debugger? Though at that point probably the debugger would need to support that sourcemap...β΅β΅I guess the ideal way would be getting the Nim compiler to generate PDB & DWARF files and then using a custom linker to replace C compiler's debug symbols with those. |
13:52:12 | PMunch | Nim already outputs debugging information which means you will see Nim source lines and such in GDB |
13:52:22 | PMunch | I'm using it right now |
14:01:45 | * | arkurious joined #nim |
14:03:16 | FromDiscord | <dom96> In reply to @lenis "so, it seems that,": M&S should beat all for throughput. |
14:05:27 | * | flynn quit (Quit: Ping timeout (120 seconds)) |
14:06:37 | * | flynn joined #nim |
14:10:04 | FromDiscord | <ag> In reply to @PMunch "Nim already outputs debugging": Yeah, but no way to debug using Visual Studio (or `cppvsdbg` on Visual Studio Code), right? The machine I'm debugging on doesn't have MinGW or GDB installed so I hoped Nim got PDB support since then. |
14:10:48 | PMunch | Hmm, I think I've seen people do that before |
14:32:51 | * | neurocyte0132889 quit (Ping timeout: 264 seconds) |
14:44:05 | * | nisstyre quit (Changing host) |
14:44:05 | * | nisstyre joined #nim |
15:00:01 | FromDiscord | <IsaacPaul> lldb works okβ΅Honestly, the debugger and other nim tooling still needs _a lot_ of work. Strings don't have a preview, enums are annoying such as displaying in vscode as a char in some cases when its a number (best case would be to display a string). |
15:00:22 | FromDiscord | <IsaacPaul> (edit) "in" => "(in" | "cases" => "cases)" |
15:03:16 | * | PMunch quit (Quit: Leaving) |
15:04:41 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3FNW |
15:06:07 | FromDiscord | <Rika> thats one high resolution image of text |
15:11:57 | FromDiscord | <Marisol> There are 3 nim extensions in vscode, which one is recommended? |
15:12:07 | nrds | <Prestige99> saem's |
15:12:38 | FromDiscord | <Marisol> Oh i installed the right one then! Thanks |
15:13:12 | FromDiscord | <gdquest> sent a long message, see http://ix.io/3FO0 |
15:13:32 | FromDiscord | <Recruit_main707> In reply to @Marisol "There are 3 nim": Is there one that is from Gary M? |
15:13:44 | FromDiscord | <Marisol> In reply to @Recruit_main707 "Is there one that": Yeah, why? |
15:14:25 | FromDiscord | <Recruit_main707> I used that because it fixed slight syntax highlight issues the main plugin had/(has) |
15:14:57 | FromDiscord | <Recruit_main707> I donβt know if either is up to date tho |
15:16:16 | FromDiscord | <Marisol> Just realized. Gary's one last update is 2 years ago |
15:16:36 | FromDiscord | <Marisol> saem's is the updated one |
15:17:26 | nrds | <Prestige99> If you spot a bug in the new plugin, please make a bug report |
15:17:31 | FromDiscord | <Recruit_main707> Damn, time flies, yeah we talked about testing stuff back in 04/2020 |
15:19:12 | FromDiscord | <Recruit_main707> Is this still a thing in the main plugin?β΅β΅https://images-ext-2.discordapp.net/external/x2P0khfQumKHPqdNvKVuPKnX0cYE-J6ihSQ-bHt9N2I/https/i.imgur.com/5EyDre1.png |
15:21:02 | * | Colt quit (Ping timeout: 240 seconds) |
15:27:05 | NimEventer | New post on r/nim by miran1: Nim Community Survey 2021, see https://reddit.com/r/nim/comments/qznwhm/nim_community_survey_2021/ |
15:27:10 | FromDiscord | <Recruit_main707> He put a lot of effort and fixed quite a lot of minor bugs, Iβd just bombard him with new errors and he kept solving them hehe |
15:29:03 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=16em |
15:29:28 | FromDiscord | <hmmm> don't know if the best way to go about it but that's my way now π€ |
15:31:16 | * | rockcavera quit (Remote host closed the connection) |
15:33:25 | FromDiscord | <Rika> doesnt work if your enum has holes |
15:33:42 | FromDiscord | <hmmm> who is the psycho that creates enums with holes |
15:33:56 | FromDiscord | <Rika> In reply to @gdquest "Do you know an": count all line breaks before a character? no other way around it |
15:34:11 | FromDiscord | <Rika> i dont think theres anything more efficient than O(n) |
15:34:13 | FromDiscord | <Rika> might be wrong of course |
15:34:20 | FromDiscord | <Rika> In reply to @hmmm "who is the psycho": plenty |
15:34:31 | FromDiscord | <Rika> i'd personally just reserve them though |
15:34:43 | FromDiscord | <Rika> if ever i do need to make a gap for some damn reaosn |
15:37:01 | NimEventer | New Nimble package! zlib - zlib wrapper for Nim, see https://github.com/status-im/nim-zlib |
15:45:49 | FromDiscord | <ag> sent a code paste, see https://play.nim-lang.org/#ix=1qeH |
15:46:53 | FromDiscord | <ag> (edit) "https://play.nim-lang.org/#ix=1qeH" => "https://play.nim-lang.org/#ix=1CzY" |
15:47:07 | FromDiscord | <hmmm> hmm |
15:47:13 | FromDiscord | <hmmm> and what would shl be? |
15:47:16 | FromDiscord | <hmmm> π |
15:47:28 | FromDiscord | <Marisol> bit shift left? |
15:47:33 | FromDiscord | <hmmm> jesus |
15:47:37 | FromDiscord | <hmmm> I'm not touching that thing |
15:48:11 | FromDiscord | <Marisol> Me too. I just guessing actually. Coming from pascal like uhh 15 years ago |
15:48:51 | FromDiscord | <ag> yeah that's bitshift left |
15:49:20 | * | xet7 quit (Remote host closed the connection) |
15:49:25 | FromDiscord | <Marisol> But it's like 1, 10, 100, 1000, 10000, 100000 right. Not that complicated |
15:50:25 | FromDiscord | <narimiran> In reply to @ag "Tons of people including": see https://nim-lang.org/blog/2021/11/15/zen-of-nim.html#static-typing for idiomatic nim way of doing this |
15:50:28 | * | xet7 joined #nim |
15:50:55 | FromDiscord | <narimiran> i.e. don't write C with Nim's syntax π |
15:51:57 | FromDiscord | <ag> sent a code paste, see https://play.nim-lang.org/#ix=1FGL |
15:52:57 | FromDiscord | <ag> (edit) "https://play.nim-lang.org/#ix=1FGL" => "https://play.nim-lang.org/#ix=1MhK" |
15:55:06 | FromDiscord | <ag> In reply to @narimiran "see https://nim-lang.org/blog/2021/11/15/zen-of-nim": Very nice |
15:55:27 | FromDiscord | <Marisol> Haha cool |
16:00:44 | FromDiscord | <lenis> seems like arc/orc is pretty slow when you do a lot of ref object allocation |
16:01:07 | FromDiscord | <Rika> compared to |
16:01:13 | FromDiscord | <Rika> refc or m&s? |
16:01:32 | FromDiscord | <lenis> both |
16:02:14 | FromDiscord | <lenis> I started benchmarking with benchy instead, and showing max delta which is useful for capturing latency concerns. |
16:03:52 | FromDiscord | <lenis> markAndSweep has the best throughput but bad latencyβ΅refc has similar throughput and amazing latency, as long as there are no reference cycles in your code.β΅β΅orc has bad throughput in my test, half of refc/mas. and a worse latency than refc |
16:04:31 | FromDiscord | <Rika> refc's max latency is? |
16:05:53 | FromDiscord | <lenis> 1ms. avg time time is 0.1ms |
16:06:08 | FromDiscord | <lenis> but on arc/orc im getting as high as 2.5ms |
16:06:15 | FromDiscord | <lenis> and 35ms on mas |
16:07:46 | FromDiscord | <Rika> these are short lived? i assume its that since arc/orc is deterministic |
16:08:17 | FromDiscord | <Rika> so it deallocs as soon as it needs to while refc can probably defer to when its not busy (?) just a guess |
16:08:30 | FromDiscord | <Rika> needs to -> can |
16:10:49 | FromDiscord | <hmmm> Since my snippet folder is growing sizable, I realize old timers should have thousands of useful utility snippets lying around, so can we have a nim snippet festival in which people share their secret sauce stuff and lazy people like me can steal all of it? |
16:11:29 | FromDiscord | <ag> In reply to @Rika "so it deallocs as": This made me think of https://abramov.io/rust-dropping-things-in-another-thread |
16:12:34 | FromDiscord | <ag> I wonder if the same thing would work here |
16:13:00 | FromDiscord | <lenis> In reply to @Rika "these are short lived?": yes they are short lived. but im doing 100,000 iterations so refc/mas definately is working in some of those runs |
16:13:38 | FromDiscord | <lenis> in fact i can see that it did 24 gc cycles |
16:14:11 | FromDiscord | <Rika> i know |
16:14:13 | FromDiscord | <Rika> thats not what i mean |
16:14:41 | FromDiscord | <Rika> arc orc is probably doing all of those deallocs and not batching them is what i mean |
16:14:59 | FromDiscord | <Rika> still doesnt explain the max i guess |
16:15:19 | FromDiscord | <lenis> yes but even for avg its a bit disappointing |
16:15:45 | FromDiscord | <lenis> I guess if you are dealing with a lot of short-lived heap objects you are better off using refc |
16:18:44 | FromDiscord | <ag> if you know the max number of items that'll be used at the same time you could also use a memory arena |
16:19:38 | FromDiscord | <ag> (edit) "if you know the max number of items that'll be used at the same time you could also use a memory arena ... " added "/ pool" |
16:19:58 | FromDiscord | <ag> Fusion has a pool for that exact purpose: https://nim-lang.github.io/fusion/src/fusion/pools.html |
16:21:10 | FromDiscord | <ag> (edit) "pool for that exact purpose:" => "pool:" |
16:33:31 | * | neurocyte0132889 joined #nim |
16:33:31 | * | neurocyte0132889 quit (Changing host) |
16:33:31 | * | neurocyte0132889 joined #nim |
16:37:38 | FromDiscord | <gdquest> In reply to @Rika "count all line breaks": Thanks, I should've updated, I went with that, a while loop that finds line breaks and checks if each character number is between `previousLineIndex`, `nextLineIndex` |
16:38:26 | FromDiscord | <Rika> nice |
16:45:09 | FromDiscord | <gdquest> sent a code paste, see https://play.nim-lang.org/#ix=2rcS |
16:46:03 | FromDiscord | <enthus1ast> @gdquest\: i found memory mapped files really fast for this kind of workload |
16:46:20 | FromDiscord | <enthus1ast> https://github.com/enthus1ast/countFasta/blob/8127028eee4c721fbc11308deac3c414ca16af31/fastalib.nim#L8 |
16:49:19 | FromDiscord | <enthus1ast> I think sort is the in place version |
16:49:41 | FromDiscord | <gdquest> Ah! I was wondering seeing the no side effect pragma in the definition |
16:49:53 | FromDiscord | <gdquest> Yeah right that's why then |
16:51:13 | FromDiscord | <gdquest> In reply to @enthus1ast "<@202865241971884032>\: i found memory": Do you know if that has any performance benefit over loading entire files and using standard input to pass them to other processes? |
16:51:13 | FromDiscord | <enthus1ast> guess you want `sorted` https://nim-lang.org/docs/algorithm.html#sorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29 |
16:51:18 | FromDiscord | <gdquest> Yup thanks! |
16:52:17 | FromDiscord | <enthus1ast> what do you mean? |
16:52:48 | FromDiscord | <gdquest> I think I have different requirements than you perhaps, not sure |
16:53:20 | FromDiscord | <gdquest> So what I need is to load the file, process the content (as a string is fine), then pipe it to pandoc to output to different formats |
16:53:41 | FromDiscord | <gdquest> So I'm unsure if a memory-mapped file would have benefits over just working on strings |
16:53:52 | FromDiscord | <enthus1ast> loading entire files can be very fast as well (if they fit in your memory) |
16:54:07 | FromDiscord | <gdquest> Yeah it's all pretty small, at most a couple mb loading the entire project |
16:54:23 | FromDiscord | <enthus1ast> but eg fasta files can be very large so better not do this \:) |
16:54:33 | FromDiscord | <gdquest> Ah gotcha π Thanks for sharing |
16:55:32 | FromDiscord | <π§ππ’> whyd i get this error |
16:55:34 | FromDiscord | <π§ππ’> ` self.error(&"Invalid base specifier {baseSpec}, expected 0x or 0b.")β΅` |
16:55:36 | FromDiscord | <π§ππ’> wait |
16:55:39 | FromDiscord | <π§ππ’> fucking copy paste on linux |
16:55:50 | FromDiscord | <π§ππ’> `'scanCharLiteral' cannot raise 'LexerDefect' [XCannotRaiseY]` |
16:55:51 | FromDiscord | <π§ππ’> this erorr |
16:56:19 | FromDiscord | <π§ππ’> sent a code paste, see https://play.nim-lang.org/#ix=2rRp |
16:56:22 | FromDiscord | <π§ππ’> `type LexerDefect = object of Defect` |
16:56:26 | FromDiscord | <π§ππ’> what am i doing wrong here |
16:59:26 | FromDiscord | <π§ππ’> ig i cant raise Defects since I changed it to be an Exception and that works fine? |
16:59:27 | FromDiscord | <π§ππ’> weird |
17:01:11 | FromDiscord | <hmmm> π€ |
17:01:25 | FromDiscord | <hmmm> apparently our pop is the underwhelming "delete" |
17:01:46 | FromDiscord | <hmmm> rika let's make an rfc to change delete to pop |
17:02:49 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2tyE |
17:03:13 | FromDiscord | <Rika> defect can mean "crash the program here without letting anything catch it" in some contexts |
17:04:31 | FromDiscord | <π§ππ’> ahhh |
17:04:43 | nrds | <Prestige99> how is pop delete? |
17:04:45 | FromDiscord | <π§ππ’> ill never catch this anyway because its a lexer error, if you get it you done goofed |
17:04:58 | FromDiscord | <cschardt (Christof Schardt)> [https---abramov.io-rust-dropping-things-in-another-thread.url](https://files.gitter.im/5602f03e0fc9f982beb19f61/f3eS/https---abramov.io-rust-dropping-things-in-another-thread.url) |
17:05:06 | FromDiscord | <Rika> yes, some people (namely hax i guess) are very vocal about using Defect though |
17:05:20 | FromDiscord | <Rika> someone failed copying a link it seems |
17:06:37 | FromDiscord | <haxscramper> yeah, imagine someone using your parser as a library |
17:07:08 | FromDiscord | <π§ππ’> its for a shitty language im making |
17:07:12 | FromDiscord | <π§ππ’> its not a library |
17:07:45 | FromDiscord | <haxscramper> then imagine unit testing for failures |
17:49:03 | * | rockcavera joined #nim |
17:49:03 | * | rockcavera quit (Changing host) |
17:49:03 | * | rockcavera joined #nim |
18:13:32 | * | Raflemakt joined #nim |
18:16:28 | * | krux02 joined #nim |
18:22:01 | NimEventer | New thread by 12398890: Seems memory leaks in protobuf-nim or nim's GC, see https://forum.nim-lang.org/t/8648 |
18:29:39 | FromDiscord | <Smarc> Hello Guys, I am working on https://github.com/Smarcy/nim_chess at the moment.β΅I'd like to outsource the movementPatterns (isValidMovePattern overloaded procs) to a separate file. Those were in model/board.nim before and I want them to be in movement.nim. But this is causing a circle dependency, because the movement.nim has to know what a Board is. Does anyone have any idea how to work around this? |
19:01:30 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
19:15:04 | FromDiscord | <hmmm> woa, my brain melts at 2D chess and now people want me to learn 4D chess |
19:15:15 | FromDiscord | <hmmm> it will never end π§ |
19:15:51 | FromDiscord | <hmmm> looks fun as hell tbh |
19:16:54 | FromDiscord | <hmmm> put some warp pads in the middle 4 squares to teleport pieces around and you got a blockbuster in your hands |
19:22:30 | FromDiscord | <Solitude> In reply to @Smarc "Hello Guys, I am": move Board type into separate module, maybe? you didnt commit movement.nim |
19:23:59 | * | neurocyte0132889 joined #nim |
19:23:59 | * | neurocyte0132889 quit (Changing host) |
19:23:59 | * | neurocyte0132889 joined #nim |
19:26:47 | * | Raflemakt quit (Ping timeout: 256 seconds) |
19:28:26 | * | Raflemakt joined #nim |
19:31:05 | * | Vladar quit (Remote host closed the connection) |
19:32:15 | FromDiscord | <IsaacPaul> I remember reading you can forward declare a ref type somehow.. there is also this pragma: `{.experimental: "codeReordering".}` |
19:32:40 | FromDiscord | <IsaacPaul> usually cyclic dependencies is a code smell |
19:32:55 | * | Vladar joined #nim |
19:33:08 | FromDiscord | <π§ππ’> how would i implement visitor pattern in nim idiomatically? |
19:36:53 | FromDiscord | <Smarc> In reply to @Solitude "move Board type into": You are right, my bad! It is up now! |
19:38:45 | FromDiscord | <IsaacPaul> In reply to @π§ππ’ "how would i implement": You can build interfaces via concepts or tuple of callbacks.. I haven't used the visitor pattern before (or maybe I have without knowing) so I'm not sure how it's applied or what problem its solving. |
19:38:53 | FromDiscord | <π§ππ’> basically this |
19:38:54 | FromDiscord | <π§ππ’> https://www.baeldung.com/java-visitor-pattern |
19:39:00 | FromDiscord | <π§ππ’> im tryign to write an ast for my crappy language |
19:39:14 | FromDiscord | <Solitude> In reply to @Smarc "You are right, my": move movement import below Board type |
19:41:04 | FromDiscord | <IsaacPaul> the visitor pattern to me just looks its supporting an interface within an interface. |
19:43:35 | FromDiscord | <π§ππ’> so how would i implement this in nim |
19:43:39 | FromDiscord | <π§ππ’> could u gimme a code example? |
19:44:18 | FromDiscord | <IsaacPaul> I can't atm; workin |
19:44:45 | FromDiscord | <π§ππ’> could anyone else? |
20:00:02 | FromDiscord | <ag> Is visitor pattern even considered idiomatic in Nim? |
20:00:29 | FromDiscord | <ag> In reply to @π§ππ’ "im tryign to write": Are you trying to implement the Java part of Crafting Interpreters using Nim? |
20:00:56 | FromDiscord | <π§ππ’> not reading that book but i want to implement an AST / visitor pattenr type thing |
20:01:09 | FromDiscord | <π§ππ’> (edit) "not reading that book but i want to implement an AST / visitor pattenr type thing ... " added "yes" |
20:02:58 | FromDiscord | <ag> I think the way to get a visitor-pattern double dispatch type thing in a non-OOP language is using sumtypes / tagged unions |
20:03:43 | FromDiscord | <ag> See here: https://nim-lang.org/docs/manual.html#types-object-variants |
20:03:59 | FromDiscord | <ag> That's how the AST is done in the Nim compiler I guess |
20:05:44 | FromDiscord | <π§ππ’> hmm this would work |
20:06:03 | FromDiscord | <π§ππ’> but how can i do smth to traverse the node or would i check the node kind? |
20:07:31 | FromDiscord | <ag> Your node would need a `kind` field in it, and you'd check that when traversing |
20:08:32 | madprops | "Have you made code contributions to the Nim project in the past?" |
20:08:37 | madprops | does it mean the compiler? |
20:08:55 | FromDiscord | <Smarc> In reply to @Solitude "move movement import below": That did the trick! Can you explain me why this is important? |
20:13:24 | FromDiscord | <Solitude> In reply to @Smarc "That did the trick!": it breaks the dependency cycle? |
20:28:00 | FromDiscord | <IsaacPaul> In reply to @madprops "does it mean the": I assumed anything in the nim repo (c2nim, nimpretty, nim, ect) |
20:32:42 | FromDiscord | <IsaacPaul> sent a code paste, see https://paste.rs/Fwl |
20:34:03 | FromDiscord | <IsaacPaul> If you create the type Board before Square then nim (or rather c) knows how to build Square. However, it comes after it then it gets stuck. So it's important for the code to be in the right order |
20:34:44 | FromDiscord | <Smarc> In reply to @Solitude "it breaks the dependency": Yes it did |
20:35:22 | FromDiscord | <Smarc> In reply to @IsaacPaul "Compilation works from the": Interesting, never had any problems with that yet. Thanks for clarification! |
20:35:58 | FromDiscord | <ag> In reply to @IsaacPaul "If you create the": Are any plans to change this? This seems like an unnecessary limitation |
20:36:04 | FromDiscord | <ag> (edit) "In reply to @IsaacPaul "If you create the": Are ... any" added "there" |
20:36:23 | FromDiscord | <IsaacPaul> In reply to @ag "Are there any plans": There is already this: `{.experimental: "codeReordering".}` |
20:36:32 | FromDiscord | <ag> Cool |
20:36:57 | FromDiscord | <Smarc> How/Where to use it actually? |
20:37:39 | FromDiscord | <IsaacPaul> Place it at the top of your file or pass it as a flag in the compiler |
20:37:54 | FromDiscord | <IsaacPaul> (edit) "in the compiler" => "when compiling" |
20:38:44 | FromDiscord | <IsaacPaul> It's not perfect tho: https://github.com/nim-lang/Nim/issues/10867 |
20:39:26 | FromDiscord | <Smarc> Mh, I'm kinda confused now |
20:41:07 | FromDiscord | <Yardanico> In reply to @IsaacPaul "There is already this:": That's not for cyclic dependencies |
20:41:18 | FromDiscord | <IsaacPaul> oh |
20:41:20 | FromDiscord | <IsaacPaul> lmbo |
20:41:39 | FromDiscord | <Yardanico> It's only when you want a different order for stuff like procs in your module so you don't have to define a lot of forward declarations |
20:45:12 | FromDiscord | <IsaacPaul> In reply to @ag "Cool": Sorry I lied. lol |
20:47:14 | * | vicfred joined #nim |
20:57:12 | NimEventer | New thread by Devosalain2: Garbage collection of nim vs pony language, see https://forum.nim-lang.org/t/8649 |
21:49:25 | FromDiscord | <Lemon Pecan Pie> good eveningβ΅i'm trying to install nim on ubuntu 20.04 64-bit, but i get this message instead: https://media.discordapp.net/attachments/371759389889003532/912459780860297267/Screenshot_from_2021-11-22_16-48-40.png |
21:49:32 | FromDiscord | <Lemon Pecan Pie> does anyone know what i should do? |
21:49:37 | FromDiscord | <Lemon Pecan Pie> thx in advance |
21:53:45 | FromDiscord | <Solitude> You should just build nim from git. |
21:56:07 | FromDiscord | <Lemon Pecan Pie> k thx |
21:56:48 | FromDiscord | <Elegantbeef> I mean choosenim should work, but could just be an issue with `/tmp` |
21:57:27 | FromDiscord | <Lemon Pecan Pie> i'm completely new to nim but it seems like choosenim would be the easiest option in the long run |
21:57:50 | FromDiscord | <Elegantbeef> Yea it really should be, i've not had that issue before |
21:58:02 | FromDiscord | <pyautogui> Hi - I am interested in contributing to the stdlib. Where should I get started? |
21:58:43 | FromDiscord | <Elegantbeef> In my experience py you can just make a PR and as long as you write ok code and have a test added for it you'll get pointed in the direction |
21:59:01 | FromDiscord | <Lemon Pecan Pie> In reply to @Elegantbeef "Yea it really should": would it help if i screenshotted my tmp directory? |
21:59:20 | FromDiscord | <pyautogui> Got it. Is there any module specifically that could use work? |
21:59:34 | FromDiscord | <Elegantbeef> I mean you can just check if `choosenim-0.8.2_linux_amd64` exists |
21:59:48 | FromDiscord | <Elegantbeef> You can look at the github issue tracker and find stdlib related issues and work on them |
21:59:54 | FromDiscord | <pyautogui> Thanks |
22:00:03 | FromDiscord | <Lemon Pecan Pie> In reply to @Elegantbeef "I mean you can": not in `tmp` |
22:00:19 | FromDiscord | <Elegantbeef> Does it happen if you run it again? |
22:00:43 | FromDiscord | <Lemon Pecan Pie> In reply to @Elegantbeef "Does it happen if": i've run the command about 15 times already lol, same result every time |
22:00:47 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AStdlib here you go py |
22:01:05 | FromDiscord | <pyautogui> Thank you. |
22:01:12 | FromDiscord | <Elegantbeef> Ok can you try a different directory like \~? |
22:01:22 | FromDiscord | <Elegantbeef> I'm just guessing it's playing dumb |
22:02:51 | FromDiscord | <dom96> yeah, try another dir. Why are you running it from /tmp anyway? π |
22:04:03 | FromDiscord | <dom96> In reply to @pyautogui "Got it. Is there": there are a few issues here https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+label%3AStdlib |
22:04:22 | FromDiscord | <Lemon Pecan Pie> https://media.discordapp.net/attachments/371759389889003532/912463540965744701/Screenshot_from_2021-11-22_17-04-08.png |
22:05:04 | FromDiscord | <Lemon Pecan Pie> In reply to @dom96 "yeah, try another dir.": i tried runnig the command from ~ and the message was talking about a directory in tmp |
22:06:03 | FromDiscord | <dom96> do you have `curl` and/or `wget`? |
22:06:13 | FromDiscord | <dom96> I mean you must |
22:06:19 | FromDiscord | <dom96> since you're using it for the script lol |
22:06:29 | FromDiscord | <Lemon Pecan Pie> In reply to @dom96 "since you're using it": i probably do : ) |
22:06:35 | FromDiscord | <dom96> https://github.com/dom96/choosenim/blob/master/scripts/choosenim-unix-init.sh#L61 |
22:06:44 | FromDiscord | <dom96> the script is pretty simple to follow if you want to diagnose it |
22:07:35 | FromDiscord | <Lemon Pecan Pie> In reply to @dom96 "the script is pretty": i'll give it a shot, thx |
22:07:56 | FromDiscord | <Lemon Pecan Pie> oh |
22:08:01 | FromDiscord | <Lemon Pecan Pie> ok |
22:08:07 | FromDiscord | <Lemon Pecan Pie> i ran `sudo apt-get install curl` |
22:08:12 | FromDiscord | <Lemon Pecan Pie> curl installed |
22:08:17 | FromDiscord | <Lemon Pecan Pie> i ran the original command again |
22:08:19 | FromDiscord | <Lemon Pecan Pie> and it worked |
22:08:26 | FromDiscord | <Lemon Pecan Pie> π thx so much for the help! |
22:08:27 | FromDiscord | <Elegantbeef> Lol not checking if curl is in the path |
22:08:41 | FromDiscord | <dom96> huh |
22:08:46 | FromDiscord | <Elegantbeef> Wait how the fuck did run choosenim |
22:08:50 | FromDiscord | <dom96> but you've used `curl` to get the init.sh script |
22:08:51 | FromDiscord | <Elegantbeef> Rather the init |
22:09:17 | FromDiscord | <Lemon Pecan Pie> https://media.discordapp.net/attachments/371759389889003532/912464778511925269/Screenshot_from_2021-11-22_17-09-00.png |
22:09:30 | FromDiscord | <Elegantbeef> Hmmm interesting bug.... |
22:10:24 | FromDiscord | <Elegantbeef> The fact you fetched the init.sh and ran it but didnt have curl will scare me till the end of time |
22:10:25 | FromDiscord | <dom96> whatttt, what was the original `curl` then |
22:11:05 | FromDiscord | <Lemon Pecan Pie> In reply to @dom96 "whatttt, what was the": idk, i'm completely clueless as to what just happened |
22:11:22 | FromDiscord | <Lemon Pecan Pie> but it works : D |
22:11:32 | FromDiscord | <Elegantbeef> So computers are powered by magic pixie dust, i knew it! |
22:13:57 | * | anddam quit (Ping timeout: 256 seconds) |
22:15:56 | * | anddam joined #nim |
22:19:47 | FromDiscord | <IsaacPaul> around 10 years ago I ran into an app bug that only appeared when I deleted a comment then reappeared when I added back the comment. |
22:20:13 | FromDiscord | <IsaacPaul> I really hope it's fixed π |
22:20:33 | FromDiscord | <IsaacPaul> (edit) "an app" => "a compiler" |
22:23:57 | * | advesperacit quit (Remote host closed the connection) |
22:41:15 | * | Raflemakt quit (Ping timeout: 264 seconds) |
22:43:06 | * | Raflemakt joined #nim |
22:51:02 | FromDiscord | <evoalg> In my noob brain, nim compiles from foo.nim to C source code and then from there to an executable. Is this right? When i do `nim c foo.nim` does it store any C source files anywhere (if I even wanted to look at them)? |
22:51:36 | FromDiscord | <IsaacPaul> yea |
22:52:06 | FromDiscord | <Elegantbeef> Yes you can even make it output to a specific folder with `--nimCache:someDir` |
22:52:07 | FromDiscord | <IsaacPaul> In reply to @evoalg "In my noob brain,": add something like `--nimcache:out` and nim will put all the files in there |
22:52:23 | FromDiscord | <Elegantbeef> Otherwise it's in `.cache/nim/projectnam_somesymbols` |
22:52:55 | FromDiscord | <evoalg> Nice thank you ... gosh I hope I'd never actually have to look at them ever π |
22:54:23 | FromDiscord | <Elegantbeef> Hey it's fun "What the fuck is this code" is like a murder mystery written by the Nim compiler |
22:54:38 | FromDiscord | <evoalg> hehehe |
22:57:45 | FromDiscord | <Elegantbeef> It does help when compiler devving π |
22:58:14 | FromDiscord | <evoalg> Another noob question: I was reading above about all this talk about enums and I've never used them (as I don't really understand them and the code snippets I've seen in the doc's leaves me wondering how it would be an advantage to use them) ... I tried testing the example given here a few hours ago, but it doesn't compile: https://play.nim-lang.org/#ix=3FOD |
22:58:36 | FromDiscord | <Elegantbeef> No no no evol |
22:58:41 | FromDiscord | <Elegantbeef> We dont do that here! |
22:59:00 | FromDiscord | <Elegantbeef> That's the Nim way |
22:59:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FOE |
22:59:05 | FromDiscord | <evoalg> oh! |
22:59:15 | FromDiscord | <Elegantbeef> It's identical to what you wanted, just not such a pain in the arse! |
22:59:37 | FromDiscord | <Elegantbeef> So now you can do things like `assert Mon notin weekend` |
22:59:47 | FromDiscord | <Elegantbeef> Worth noting in this case `const` is preferable to \`let |
23:01:44 | FromDiscord | <evoalg> ahh interesting. How would this be used to benefit me though? ... is it to make things clearer (like a named tuple is clearer) or is it to restrict things to catch bugs? |
23:02:05 | FromDiscord | <Elegantbeef> Which part? |
23:02:39 | FromDiscord | <evoalg> I mean that enum example, ... I guess I'm wondering: why do people use these things? |
23:04:14 | FromDiscord | <Elegantbeef> They're the best method and cleanest to represent fixed sizes |
23:04:14 | FromDiscord | <Elegantbeef> Like you could of course do `type Day = 0..6` but now you have to remember "0\` is Monday or is Sunday or is it Saturaday.... |
23:04:15 | FromDiscord | <Elegantbeef> And now you have to document it |
23:04:15 | FromDiscord | <Elegantbeef> With the Enum you know `Monday` is `0` |
23:04:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FOG |
23:05:17 | FromDiscord | <Elegantbeef> So now you have a efficient data type with stringification that makes your life so simple |
23:05:24 | FromDiscord | <Elegantbeef> Enums afterall are just integers |
23:07:23 | FromDiscord | <evoalg> So I can think of them as a subset of integers with nice names? |
23:07:39 | FromDiscord | <Elegantbeef> Yes |
23:08:02 | FromDiscord | <evoalg> Nice! ... and could this be done as an object instead of an enum? |
23:08:05 | FromDiscord | <Elegantbeef> And when you do `{Sat, Sun}` that's an efficient bitset so in this case it takes 1 byte to represent the entire data(7 entries) |
23:08:28 | FromDiscord | <evoalg> ah nice! |
23:08:53 | FromDiscord | <Elegantbeef> I suppose you could do it with an object but it'd be nowhere as nice |
23:13:22 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3FOJ they're quite simple to work with |
23:13:54 | FromDiscord | <Elegantbeef> Within a few lines of code we can easily get the next day of the week wrapped around(succ/pred over/underflow respectively from the stdlib) |
23:15:14 | FromDiscord | <evoalg> wow ... thank you, you're the best Elegantbeef ! |
23:15:37 | FromDiscord | <impbox [ftsf]> they are indeed the best Elegantbeef! |
23:15:47 | FromDiscord | <Elegantbeef> Well i'm also the worst |
23:15:48 | FromDiscord | <impbox [ftsf]> there is no comparison |
23:24:03 | arkanoid | which tools does nim have to graphically represent code? I want to think about the architecture of a program from an abtract point of view |
23:25:21 | FromDiscord | <impbox [ftsf]> i don't think there's anything nim specific for that? |
23:25:25 | FromDiscord | <impbox [ftsf]> is there something you have in mind? |
23:26:54 | arkanoid | well, the best would be a visualization of the places where shared mutation happens |
23:27:22 | FromDiscord | <Elegantbeef> Hax has https://github.com/haxscramper/nimtrail though no clue if it even approaches what you want |
23:28:49 | arkanoid | no, what I was thinking about what something out from nim compiler internal knowledge |
23:29:06 | FromDiscord | <impbox [ftsf]> what is the output you want? |
23:29:41 | FromDiscord | <impbox [ftsf]> that sourcetrail thing looks cool |
23:29:43 | arkanoid | well, call graph would be nice, also module dependencies |
23:30:14 | FromDiscord | <Elegantbeef> This is where i say the famous words of "PR welcomed" |
23:30:23 | arkanoid | :) |
23:30:31 | FromDiscord | <Elegantbeef> The information is of course there, docgen for instance generates module dependancies |
23:30:58 | FromDiscord | <Elegantbeef> Source trail might give the call graph but yea nothing in the compiler that i know of |
23:31:12 | FromDiscord | <impbox [ftsf]> https://github.com/petermora/nimTracelog |
23:32:10 | arkanoid | interesting |
23:36:14 | arkanoid | also --expandArc:f is something |
23:51:13 | * | adium joined #nim |