<< 22-11-2021 >>

00:00:13*tk quit (Quit: Well, this is unexpected.)
00:00:37*tk joined #nim
00:04:45FromDiscord<gibson> Yes, it just seems unnecessary, and means the syntax cleanliness comes with a non-zero cost.
00:04:59anddamconsidering this definition https://github.com/nimgl/imgui/blob/de9928dd091c29e4a6d9fa43e50219878730eb66/src/imgui.nim#L3016
00:05:12FromDiscord<Yardanico> In reply to @gibson "Yes, it just seems": do you mean something like int(myEnumValue) ?
00:05:28FromDiscord<gibson> @Yardanico exactly.
00:05:29FromDiscord<Yardanico> this will be zero-cost with a normal C compiler like GCC or Clang
00:05:34FromDiscord<Yardanico> or most others
00:05:43FromDiscord<gibson> Oh really? okay, great.
00:05:45anddamthis block https://github.com/nimgl/imgui#usage should actually have `igSliderFloat("float", addr(f), 0.0f, 1.0f)` with addr() right?
00:05:59FromDiscord<Yardanico> In reply to @anddam "this block https://github.com/nimgl/imgui#usage ": yes, that example is largely outdated
00:06:09FromDiscord<Yardanico> you should check tests/test.nim
00:06:17anddamYardanico: ok but I have to start somewhere
00:06:24anddamoh thanks for the pointer
00:07:53anddamwhy 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:57FromDiscord<Elegantbeef> Those are talking about symbol operators and `addr` is not a symbol operator πŸ˜€
00:09:38FromDiscord<Elegantbeef> Oh i missed the other operators, i think it's not overridable
00:09:45FromDiscord<Elegantbeef> As such it doesnt need to be mentioned there
00:15:39anddamlast question (for tonight) the executables cannot load cimgui.so, shouldn't the nimgl/imgui package I installed have built that object?
00:19:23FromDiscord<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:18FromDiscord<Yardanico> yes, you're right
00:20:31FromDiscord<Yardanico> imgui is a C++ library and cimgui provides a C interface for that, so you need to build it yourself
00:20:38FromDiscord<Yardanico> or use Nim's C++ backend, then it'll use imgui directly
00:28:17anddamYardanico: with cpp I then get errors since imageguie functions are not declared, https://termbin.com/ptcj
00:29:07anddamcould 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:07FromDiscord<Yardanico> weird, it shouldn't use cimgui when compiling with C++
00:30:24FromDiscord<Elegantbeef> `importC` is just "importBackend" basically
00:31:30anddamI see, I built the cmimgui carried by imgui nim package
00:31:36anddamat /home/anddam/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui
00:32:20*yarrie quit (Read error: Connection reset by peer)
00:32:47FromDiscord<Yardanico> and how did you install imgui itself?
00:33:07FromDiscord<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:01FromDiscord<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:33anddamI did not install imgui at all, it's in cimgui
00:38:06FromDiscord<Yardanico> huh?
00:38:11FromDiscord<Yardanico> nonono, you didn't understand
00:38:17FromDiscord<Yardanico> cimgui is only needed if you compile with the C backend
00:38:27FromDiscord<Yardanico> if you compile with the C++ backend you just install imgui and use it
00:39:43anddamYardanico: ok, but since that did not work, with the C++ backend I tried to build cimgui and use the C backend
00:42:23anddamthis is with -f https://termbin.com/cz0s
00:42:59anddamoh, my bad, I was trying back the "minimal" example of README
00:43:06anddamtest.nim does actually build
00:43:13anddamand works too
00:45:44anddamjust 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:55anddamwhat would be a proper way to use the C backend?
00:46:15FromDiscord<Yardanico> In reply to @anddam "just for the sake": as in?
00:46:30FromDiscord<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:51FromDiscord<Yardanico> with LD_LIBRARY_PATH for example
00:47:01FromDiscord<Yardanico> `LD_LIBRARY_PATH=. ./mybinary`
00:48:59anddamor place some dir where ld looks
00:49:11anddamI guess ~/.local/lib fits
00:49:38FromDiscord<Yardanico> nope
00:51:07anddamLD_LIBRARY_PATH=. I get the same segfault that I do without
00:51:25FromDiscord<Yardanico> what's the error message?
00:51:28FromDiscord<Yardanico> assuming you compiled in debug mode
00:51:42anddam$ file cimgui.so
00:51:45anddamcimgui.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7e1f2d3a229c937fe8df1c62675b9404461fcb8a, with debug_info, not stripped
00:52:12anddamhttps://termbin.com/ljxd
00:52:44anddamoh wait, I am a double-idiot
00:52:44FromDiscord<Yardanico> well because the code in that readme is not valid as I've said before
00:52:46FromDiscord<Yardanico> how did you modify it?
00:52:54FromDiscord<Yardanico> did you do `var f: ptr float32` by any chance?
00:53:12FromDiscord<Yardanico> the proper way would be to do igSliderFloat("float", addr f, ...) instead and just have it the same value
00:55:07anddamI went with the latter, addr(f)
00:55:13FromDiscord<Yardanico> hm
00:55:33*rockcavera joined #nim
00:55:33*rockcavera quit (Changing host)
00:55:33*rockcavera joined #nim
00:55:37FromDiscord<Yardanico> in any case, that example is not really usable as you don't even have a drawing loop
00:55:48FromDiscord<Yardanico> it's segfaulting because you didn't set up any contexts and stuff
00:56:18FromDiscord<Yardanico> so just use the example from tests/tests.nim and simplify it to your needs
00:57:17FromDiscord<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:46anddamYardanico: 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:48FromDiscord<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:58anddamYardanico: so I am stripping down the example
00:58:01FromDiscord<gibson> Yup! That's why I had to check with O3.
00:58:04anddamthanks *a lot*
00:58:44FromDiscord<gibson> It wasn't clear because with -d:release nim still generates the C code function call etc.
00:58:58FromDiscord<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:02FromDiscord<Yardanico> `typedef NU8 tyEnum_DataCuDfe3rZKZRY6AsMu2JJnw;`
00:59:15FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/912145168419917844/unknown.png
00:59:50FromDiscord<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:01FromDiscord<Yardanico> i'm far from being an expert :)
01:00:17FromDiscord<gibson> I scraped together all the typedefs and defines from nimbase etc. so my small example actually runs.
01:00:32FromDiscord<Yardanico> i don't know most of the stuff what compilers do either
01:00:34FromDiscord<Yardanico> In reply to @gibson "I scraped together all": heh
01:01:07FromDiscord<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:18anddamjust as info 1.6.0 is ready to merge on Void https://github.com/void-linux/void-packages/pull/34106
01:02:30FromDiscord<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:00FromDiscord<Yardanico> also I'd recommend you to use `-d:danger --gc:arc` when checking stuff on godbolt for minimum assembly size
01:03:21FromDiscord<Yardanico> maybe even with LTO
01:03:24*xet7 quit (Remote host closed the connection)
01:03:31FromDiscord<gibson> Good pointers, thanks.
01:04:30*xet7 joined #nim
01:04:57FromDiscord<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:19FromDiscord<Yardanico> and if you return `int8` instead it's just a simple `mov`
01:06:04FromDiscord<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:27FromDiscord<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:33FromDiscord<Yardanico> which might be pretty confusing
01:07:38FromDiscord<gibson> Yes, I see that. Good and bad, because it definitely reduces the output, which is nice most of the time.
01:08:00FromDiscord<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:15FromDiscord<Yardanico> i mean, even with a couple more assembly instructions the speed will probably be the same :)
01:10:52FromDiscord<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:48FromDiscord<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:56FromDiscord<Yardanico> converters are what's used to implicitly convert types in Nim
01:12:16FromDiscord<Yardanico> hm, actually it might with a const, lemme see
01:12:19FromDiscord<gibson> I was naively trying to put `{.compileTime.}` on the converter.
01:12:43FromDiscord<Yardanico> that makes it only work in compileTime, so when you're compiling the program
01:12:59FromDiscord<gibson> Yeah, I wanted the literals transformed.
01:13:28FromDiscord<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:13FromDiscord<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:51FromDiscord<Yardanico> What happens if you add {.inline.} to the converter?
01:44:49FromDiscord<gibson> Then it indeed inlines the instruction obviating a jump, but otherwise it's the same outcome.
01:45:13FromDiscord<Yardanico> well, that's to be expected, converters are normal functions except called implicitly in nim
01:45:51FromDiscord<Yardanico> Usually it's recommended to avoid them, but they can be useful, yes
01:46:03FromDiscord<gibson> What I really want is a `template converter` πŸ˜†
01:47:06FromDiscord<gibson> It is definitely clearer to write `int(thing)` everywhere, but starts to add visual noise.
01:47:48FromDiscord<gibson> I'll just refactor to reduce.
01:57:29FromDiscord<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:00FromDiscord<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:55FromDiscord<Elegantbeef> best to use `gdb` or similar and build it with `--debugger:native`
01:59:38FromDiscord<impbox [ftsf]> ack, will try that
01:59:52FromDiscord<impbox [ftsf]> i seem to recall getting stacktraces for segfaults in nim in the past, or am i imagining that?
02:00:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKr
02:00:52FromDiscord<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:53FromDiscord<Elegantbeef> So it should happen if it's caused by nim code
02:08:40*arkurious quit (Quit: Leaving)
02:54:39FromDiscord<π™§π™šπ™’> how do i create a table from constant data
02:54:51FromDiscord<π™§π™šπ™’> eg this should be a table
02:54:51FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=3FKz
02:55:42FromDiscord<Elegantbeef> `.toTable`
02:56:05FromDiscord<Elegantbeef> `{"a": "b"}` creates an array of tuples
02:56:07FromDiscord<π™§π™šπ™’> does .newTable work to?
02:56:27FromDiscord<Elegantbeef> well they're different semantics
02:56:36FromDiscord<Elegantbeef> `new` implies a ref Table
02:56:55FromDiscord<Elegantbeef> the table is kinda useless anyway
02:57:07FromDiscord<π™§π™šπ™’> ah ok
02:57:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKA
02:59:46FromDiscord<π™§π™šπ™’> thats a lot better damn
03:00:04FromDiscord<π™§π™šπ™’> im kinda doing this atm, any better way?
03:00:08FromDiscord<π™§π™šπ™’> sorry for the spam
03:00:10FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=3FKB
03:00:11FromDiscord<π™§π™šπ™’> im kinda doing this atm, any better way?
03:01:07FromDiscord<Elegantbeef> `const Keywords = {tkConst..tkWhile}` ... `of Keywords`
03:01:18FromDiscord<π™§π™šπ™’> wdym
03:01:32FromDiscord<Elegantbeef> make a bitset for keywords instead of manually making trees
03:01:36FromDiscord<Elegantbeef> same for operators
03:01:43FromDiscord<π™§π™šπ™’> could u give an example
03:01:46FromDiscord<Elegantbeef> `const operators = {tkPlus .. tkGreaterEqual}`
03:02:05FromDiscord<π™§π™šπ™’> i struggle to see how this is cleaner
03:02:22FromDiscord<π™§π™šπ™’> could u provide a full example pls?
03:03:05FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3FKE
03:03:21FromDiscord<π™§π™šπ™’> ah i see
03:03:24FromDiscord<π™§π™šπ™’> thats a lot nicer
03:04:13FromDiscord<Elegantbeef> Then you can also do things like `someKind in Operators` or `someKind in Keywords` or `someKind notin (Operators + Keywords)` πŸ˜›
03:04:20FromDiscord<π™§π™šπ™’> ahhh
03:04:21FromDiscord<π™§π™šπ™’> i see
03:04:42FromDiscord<Elegantbeef> It's how we do bitflags in Nim
03:04:53FromDiscord<π™§π™šπ™’> wdym by that
03:05:27FromDiscord<Elegantbeef> Instead of `tkPlus or tkMinus or tkStar`.... we can do a set of the range which takes bit per value
03:05:36FromDiscord<π™§π™šπ™’> ohh i see
03:05:38FromDiscord<π™§π™šπ™’> thats cool
03:05:52FromDiscord<Elegantbeef> And then when checking if it's in it you do `tkPlus in yourSet` instead of `tkPlus and yourSet == tkPlus`
03:06:47FromDiscord<π™§π™šπ™’> how do i check if the string is a member of keywords tho?
03:07:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKG
03:08:32FromDiscord<π™§π™šπ™’> do i need to do `tkConst = "const"`
03:08:35FromDiscord<π™§π™šπ™’> in my enum?
03:08:37FromDiscord<Elegantbeef> Yes
03:09:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FKH
03:10:23FromDiscord<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:55FromDiscord<Hamid Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3FKN
04:16:48FromDiscord<Hamid Bluri> isn't it wierd : /
04:16:51FromDiscord<Hamid Bluri> (edit) "isn't it wierd : / ... " added "?"
04:19:57FromDiscord<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:15FromDiscord<creikey> Is there a difference between `pointer` and `ptr object`
06:05:18FromDiscord<Elegantbeef> What's the context?
06:05:25FromDiscord<Elegantbeef> `pointer` is a void pointer which accepts any pointer
06:06:35*Ekho joined #nim
06:07:46FromDiscord<creikey> In reply to @Elegantbeef "What's the context?": https://livebook.manning.com/book/nim-in-action/chapter-8/151
06:08:31FromDiscord<creikey> difference between `proc pollEvent(event: pointer)` and `proc pollEvent(event: ptr object)`
06:08:48FromDiscord<creikey> when using the importc pragma and linking to a dynlib (sdl)
06:09:10FromDiscord<Elegantbeef> In that case `ptr object` should be a constraint of any `ptr object`
06:09:15FromDiscord<Elegantbeef> Atleast afaik
06:10:12FromDiscord<creikey> In reply to @Elegantbeef "In that case `ptr": what
06:11:08FromDiscord<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:10FromDiscord<creikey> (edit) "typ" => "type"
06:11:19FromDiscord<Elegantbeef> `proc pollEvent(event: ptr object)` is a generic equivlent to `proc pollEvent[T](event: ptr T)`
06:11:25FromDiscord<creikey> (edit) "fields," => "fields then used later like `ptr SdlWindowPtr`,"
06:12:01FromDiscord<creikey> In reply to @Elegantbeef "`proc pollEvent*(event: ptr object)`": how does this compare to `pointer`?
06:12:13FromDiscord<Elegantbeef> pointer takes any `ptr T`
06:12:19FromDiscord<Elegantbeef> so even `ptr int`
06:12:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL2
06:13:17FromDiscord<Elegantbeef> B is an object definition that is a `ptr` not an alias, which i guess is confusing
06:13:33FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3FL3
06:13:38FromDiscord<creikey> so it is ptr object
06:13:41FromDiscord<creikey> but it's not the address
06:13:51FromDiscord<creikey> but the address is ptr object so why is it not B if B is ptr object
06:14:11FromDiscord<Elegantbeef> B is a unique type
06:14:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL4
06:14:37FromDiscord<Elegantbeef> That's valid for instance
06:14:58FromDiscord<Elegantbeef> as a parameter `ptr object` is just like `object` it will only take a pointer to an object
06:14:59FromDiscord<creikey> In reply to @Elegantbeef "B is a unique": so `B is ptr object` but `ptr object isnot B`
06:15:53FromDiscord<Elegantbeef> just like `proc doThing(a: object)` will take any object
06:16:05FromDiscord<Elegantbeef> It's a generic in this context
06:17:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FL5
06:17:54FromDiscord<Rika> Should have made y a string
06:17:55FromDiscord<creikey> those both work?
06:18:21FromDiscord<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:27FromDiscord<Elegantbeef> Yes cause `object` is a implict generic
06:18:32FromDiscord<Elegantbeef> it's a generic typeclass
06:19:25FromDiscord<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:45FromDiscord<creikey> so `proc doThing(a: pointer) = echo a` can take `addr(5)` but `proc doThing(a: ptr object) = echo a` can't
06:19:55FromDiscord<creikey> ptr to generic type
06:20:42FromDiscord<Elegantbeef> yep
06:20:49FromDiscord<Elegantbeef> cause `int isnot object`
06:20:53FromDiscord<creikey> right
06:20:58FromDiscord<creikey> so it's not a generic that can take any type
06:21:01FromDiscord<creikey> only things that `is object`
06:21:38FromDiscord<Elegantbeef> yea i messed up it should've been `proc doThing[T: object](a: ptr[T])`
06:21:59FromDiscord<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:12FromDiscord<Rika> No
06:22:30FromDiscord<Rika> Well β€œno”
06:22:41FromDiscord<Elegantbeef> There are concepts which do that
06:22:43FromDiscord<creikey> oh you gotta use objects for polymorphism
06:22:46FromDiscord<creikey> like inheritance
06:22:52FromDiscord<creikey> and there isn't multiple inheritance or interfaces
06:23:02FromDiscord<Rika> Object and others are special cases, otherwise you need to β€œor” types if you want to limit them
06:23:22FromDiscord<Rika> Concepts are experimental
06:23:26FromDiscord<creikey> concepts lol
06:23:39FromDiscord<creikey> In reply to @Rika "Concepts are experimental": it's still conceptual
06:23:50FromDiscord<Rika> It is not, it is implemented
06:24:04FromDiscord<creikey> I would be very concerned if concepts aren't conceptual
06:24:07FromDiscord<creikey> then they must've done something wrong
06:25:05*theoroer joined #nim
06:25:10FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3FL8
06:25:24theoroerwhy are `dup` in `sugar` and `with` in `std/with` named differently and in different modules when they have the same implementation
06:25:25FromDiscord<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:45FromDiscord<Rika> They aren’t the same
06:26:13FromDiscord<Rika> In reply to @creikey "what if I have": Needs ref objects and inheritance. Concepts are compile time
06:26:18FromDiscord<Elegantbeef> Single parent inheritance might be the solutio nthere crikey
06:26:45theoroerhttps://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:18FromDiscord<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:31FromDiscord<Rika> Look again, with is a statement, dup is an expression is it not?
06:27:50FromDiscord<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:06FromDiscord<Rika> Concepts do not exist on runtime
06:28:13theoroerstmtlistexpr and stmtlist are semantically the same
06:28:26FromDiscord<Elegantbeef> They do different things
06:28:48theoroerbut they both use an std/private module when they could just both be in the same module
06:28:54FromDiscord<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:04FromDiscord<Elegantbeef> Sure they could be it's bad that they're seperated
06:29:21FromDiscord<Rika> The reason they are in other modules is because of a lot of things
06:29:45theoroerif im not mistaken you could literally define dup as a template over with
06:29:57FromDiscord<Rika> I would have personally called β€œwith” β€œexpand fields” instead
06:30:31theoroerwhat do you mean, it doesn't deal with fields at all
06:30:58FromDiscord<Rika> Am I thinking of another with then
06:31:07FromDiscord<Rika> See this is why it’s a bad name
06:31:12theoroerhttps://nim-lang.org/docs/with.html#with.m%2Ctyped%2Cvarargs%5Buntyped%5D
06:33:00FromDiscord<Rika> Okay yes this is a different with from what I remember
06:33:01theoroerlol, 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:08FromDiscord<Rika> Yes
06:33:13FromDiscord<Rika> It fucks with your head
06:33:19FromDiscord<Rika> I just checked the standard with
06:33:26FromDiscord<Rika> Yeah I don’t see how this is much different from dup
06:34:04theoroerweirdest decision ever to do it like this
06:34:18FromDiscord<Rika> I assume they were implemented at other times
06:34:26FromDiscord<Rika> I mean different times
06:35:13FromDiscord<Elegantbeef> Luckily `std/with` sucks anyway afaik
06:35:19FromDiscord<Elegantbeef> Not that I have really used it
06:37:59FromDiscord<creikey> https://media.discordapp.net/attachments/371759389889003532/912230411395006484/unknown.png
06:38:55*theoroer quit (Ping timeout: 256 seconds)
06:39:20FromDiscord<Rika> Nice
06:40:00FromDiscord<Elegantbeef> https://nim-lang.org/docs/theindex.html save yourself from an embarrassing search history πŸ˜›
06:40:41FromDiscord<creikey> nim supports peg??
06:40:48FromDiscord<creikey> (edit) "peg??" => "peg matching??"
06:41:41FromDiscord<creikey> the code isn't even that complicatd
06:41:43FromDiscord<creikey> (edit) "complicatd" => "complicated"
06:41:58FromDiscord<Elegantbeef> There's an even cooler implementation in https://github.com/zevv/npeg
06:42:07FromDiscord<Elegantbeef> But yes the stdlib has `PEG`
06:42:19FromDiscord<creikey> it's like 2k lines and it looks just like peg but it's in nim
06:55:36Zevv1.5k, effectively :)
07:00:25*theoroer joined #nim
07:20:04*theoroer quit (Quit: Client closed)
07:21:50FromDiscord<claude> are identifiers as template calls documented? they're everywhere but I don't remember seeing the documentation for them anywhere
07:22:41FromDiscord<Rika> What?
07:23:31FromDiscord<Elegantbeef> Give a concrete example and we might be able to help
07:23:38FromDiscord<Elegantbeef> There are two things you may be talking about
07:25:20FromDiscord<claude> `template name: untyped = 3; echo name 3`
07:26:01FromDiscord<Elegantbeef> Ah yea that's what i thought, i dont think it's documented specifically anywhere
07:26:01FromDiscord<Rika> Why would you do that over a constant?
07:26:15FromDiscord<Elegantbeef> It's just an example rika, you can do it for anything
07:26:22FromDiscord<claude> for the sake of the example
07:26:33FromDiscord<Rika> I know but even expanding outward I do not see a reason
07:27:12FromDiscord<claude> would you have preferred i write it out longer
07:27:18FromDiscord<Elegantbeef> I use it in the nimscript interop so you dont have to do `time()`
07:28:05FromDiscord<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:12FromDiscord<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:41NimEventerNew 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:42advesperacitDoes 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:19FromDiscord<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:27FromDiscord<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:37FromDiscord<Yardanico> for libressl you can compile it statically and compile your nim code with flags like this
11:00:45FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3FMi
11:01:24FromDiscord<Yardanico> (threads:on enables pthreads which seem to be required for libressl)
11:02:14FromDiscord<lenis> pretty annoying that threads:on doesnt work with librtl
11:02:24advesperacitThanks! I'll try to get it working with that. I'm using both threads and ssl.
11:08:43FromDiscord<lenis> does anyone know how arc/orc performs relative to refc or markAndSweep
11:09:16FromDiscord<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:18FromDiscord<lenis> (edit) "countingh" => "counting"
11:09:21FromDiscord<Yardanico> the answer is - it depends
11:09:28FromDiscord<Yardanico> see https://nim-lang.org/blog/2020/12/08/introducing-orc.html
11:09:33FromDiscord<Yardanico> arc itself is just refcounting with RAII and other nice stuff
11:09:36FromDiscord<Rika> Do you aim for latency, throughput, or (I forgot the last one)
11:09:45FromDiscord<Yardanico> In reply to @Rika "Do you aim for": memory usage
11:09:46FromDiscord<Yardanico> (edit) "usage" => "usage?"
11:09:50FromDiscord<Rika> Not sure
11:09:55FromDiscord<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:56FromDiscord<lenis> memory usage should be ARC/ORC, especially with useMalloc
11:11:03FromDiscord<lenis> but i mean throughput
11:11:32FromDiscord<Yardanico> i think for throughput markAndSweep might be faster, but you should always benchmark for your specific case
11:12:12FromDiscord<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:40FromDiscord<Yardanico> this is a bit of a biased example of course, but still
11:12:43FromDiscord<Yardanico> always check for yourself :)
11:14:47FromDiscord<Yardanico> but yes, arc/orc are really good for any kind of interop or for more "weird" targets like webassembly
11:15:02FromDiscord<Yardanico> refc won't work on things like webassembly at all, not sure about m&s
11:20:18FromDiscord<lenis> lol, the first example in that post runs a full gc every 10 requests
11:20:38FromDiscord<lenis> yeah so the second is about what i'd expect. but the difference is surprisingly small
11:20:42FromDiscord<Rika> It can happen
11:21:02FromDiscord<Rika> It’s not small I’d say
11:21:22FromDiscord<Yardanico> In reply to @Rika "It’s not small I’d": it is
11:21:29FromDiscord<Yardanico> orc and m&s are very different so that difference is quite small
11:21:31FromDiscord<Rika> Is it that small?
11:21:41FromDiscord<Yardanico> 35k vs 40k req/sec in that post
11:21:48FromDiscord<Rika> Oh you mean throughput
11:21:51FromDiscord<lenis> 13% slower on ORC
11:21:54FromDiscord<Rika> Yeah I guess
11:22:01FromDiscord<Yardanico> and latency is much much lower on ORC
11:22:03FromDiscord<Yardanico> along with memory
11:22:12FromDiscord<lenis> and that benchmark is quite harsh in memory allocation
11:22:27FromDiscord<lenis> all data is allocated in the heap and short lived
11:28:12FromDiscord<lenis> I do wonder how it compares to refc with GC_step control
11:28:30FromDiscord<Rika> Benchmark time
11:54:03FromDiscord<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:53FromDiscord<lenis> In reply to @Rika "Benchmark time": I have been compiling wrk for the last 15 min
11:58:54FromDiscord<lenis> kms
11:59:21FromDiscord<lenis> I should have preinstalled libssl
11:59:51FromDiscord<Rika> In reply to @Fish-Face "Is there type that": https://nim-lang.github.io/Nim/jsbigints.html ?
12:00:27FromDiscord<lenis> In reply to @Fish-Face "Is there type that": I believe it was just added in nim 1.6
12:02:18FromDiscord<Yardanico> In reply to @Fish-Face "Is there type that": as I've mentioned before, you can use bigints
12:04:57FromDiscord<lenis> @RikaWow
12:05:30FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FMC
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:02FromDiscord<Yardanico> arc will leak memory
12:06:07FromDiscord<Yardanico> sent a code paste, see https://paste.rs/jP9
12:06:13FromDiscord<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:16FromDiscord<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:22FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=3FMF
12:07:22FromDiscord<Yardanico> In reply to @lenis "this is with ORC": nice
12:09:35FromDiscord<lenis> ORC seems to cap out at 39.9K requests/s
12:10:52FromDiscord<lenis> ARC caps at 42.9K requests/s
12:11:45FromDiscord<lenis> REFC only 1412req/s
12:13:20FromDiscord<lenis> correction, refc can go up to 42.0K req/s
12:13:49FromDiscord<lenis> so, it seems that, in this specific benchmark. arc > refc > orc for throughput
12:15:31FromDiscord<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:36FromDiscord<Yardanico> orc has to actually check cycles
12:15:39FromDiscord<Yardanico> and collect them
12:15:48FromDiscord<Yardanico> so if you're fine with memory leaking, you can use arc, yes :)
12:15:51FromDiscord<Yardanico> (for async)
12:17:40NimEventerNew thread by Miran: Nim Community Survey 2021, see https://forum.nim-lang.org/t/8647
12:36:22FromDiscord<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:28FromDiscord<Yardanico> exactly :)
12:37:17FromDiscord<lenis> in the 10s test the cycle collector seems to run about 10 times
12:37:44FromDiscord<lenis> but the interesting part is that the cycle collector on refc/markAndSweep is about 30-40x slower
12:38:24FromDiscord<lenis> ORC's mac response time is just over 1ms, while refc/markAndSweep have about 35ms
12:39:09FromDiscord<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:21FromDiscord<Yardanico> In reply to @lenis "I believe thats because": yes, you can also give it hints yourself
12:39:33FromDiscord<Yardanico> if you mark an object that can potentially be cyclic as `{.acyclic.}` ORC won't check it for cycles
12:41:39FromDiscord<lenis> pretty awesome
12:41:48FromDiscord<lenis> I like that you can do microoptimizations like that in nim
12:42:08FromDiscord<lenis> just like how you can use `likely` to improve branch prediction
12:42:21FromDiscord<lenis> it actually makes a substantial difference on performance sensitive code
12:42:57FromDiscord<lenis> I was able to improve the performance of a big loop I had by about 30% using likely/unlikely
12:43:47FromDiscord<Yardanico> In reply to @lenis "I was able to": you should also try using PGO, it can optimize that stuff automatically
12:44:08FromDiscord<Yardanico> and yeah, `likely` is a hint to the C compiler, in some cases it can make the code slower
12:45:02FromDiscord<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:36FromDiscord<lenis> so i already know compile time there is only a 1% chance or so that it will enter that branch
12:46:01FromDiscord<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:08FromDiscord<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:33FromDiscord<hmmm> bois wot is dis hint: Hint: 'parse' cannot raise 'Defect'
12:48:53FromDiscord<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:00FromDiscord<Yardanico> or something similar
12:49:11FromDiscord<hmmm> I'm doing a try parse datetime except TimeParseError and it works fine but get the hint
12:49:17FromDiscord<hmmm> no I'm not using curly braces at all
12:49:46FromDiscord<Yardanico> interesting
12:49:51FromDiscord<Yardanico> can you show the code?
12:49:52FromDiscord<hmmm> hmmm
12:50:01FromDiscord<hmmm> wait I try to clean up the mess lol
12:51:51FromDiscord<Yardanico> yeah I see the hint too
12:52:35FromDiscord<hmmm> ah ok
12:52:52FromDiscord<hmmm> how do I paste code thingies in the code block of discord
12:53:51FromDiscord<Yardanico> triple quotes newline code newline triplequotes
12:53:56FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=1pIT
12:54:08FromDiscord<hmmm> """
12:54:11FromDiscord<hmmm> hmmm
12:54:22FromDiscord<Yardanico> backticks
12:54:39FromDiscord<Yardanico> and you don't need to post, I already found out what you're talking about
12:54:53FromDiscord<hmmm> okok it was just for general knowledge lol
12:55:02FromDiscord<lenis> sent a code paste, see https://play.nim-lang.org/#ix=
12:55:02FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=1pIT
12:55:14FromDiscord<hmmm> oh yiss I'm a genius
13:01:41FromDiscord<hmmm> can I name an type thingy = enum with lowercase or nim gets angry?
13:02:09*TechAspirer joined #nim
13:03:00FromDiscord<Yardanico> yes you can
13:03:06FromDiscord<Yardanico> PascalCase for types is just a convention
13:03:10FromDiscord<Yardanico> so it's easier to understand that it's a type
13:04:14FromDiscord<hmmm> πŸ‘
13:04:29*kayabaNerve_ quit (Ping timeout: 250 seconds)
13:05:31PMunchThose "hello" messages was sent over the Discord bridge as links to the playground :P
13:07:10FromDiscord<Yardanico> yeah the bridge treats all triple backticks code blocks as code pastes
13:07:16FromDiscord<Yardanico> Because they're almost always multi line
13:07:32FromDiscord<Yardanico> `we have single backticks for inline code`
13:14:34PMunchBy the way, sometimes people send a short message and some code, and it all gets turned into a paste
13:14:42PMunchThis is a bit awkward
13:14:50FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3FMZ
13:15:21PMunchCase in point: https://play.nim-lang.org/#ix=3FMZ
13:15:38PMunchAnd why does it convert * to those weird circle things?
13:16:04PMunchIt means that everything with an export marker needs to be rewritten to run on the playground
13:16:13FromDiscord<hmmm> hmm how do I print all the possible enums of an enum
13:18:02PMunchcat mycodefile.nim | grep "MyEnum = enum"
13:20:19supakeenohno
13:21:48FromDiscord<hmmm> nu wait the real question was how do I set an enum with his ord number instead of name
13:22:06PMunch100.MyEnum?
13:22:19FromDiscord<hmmm> hmmmmmmmmm
13:22:26FromDiscord<hmmm> maybe!
13:22:27FromDiscord<hmmm> wait
13:24:43FromDiscord<hmmm> it worked 🀨
13:24:50FromDiscord<hmmm> never imagined it would lol
13:26:10PMunchWhy wouldn't it? :P
13:26:27*src joined #nim
13:27:35FromDiscord<hmmm> no fkn idea lol πŸ˜…
13:30:52FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3FN9
13:37:57PMunchThat makes no sense, 3 is an int, not an enum type
13:38:28PMunchBut 3.Enummie explicitly converts it to one
13:41:54FromDiscord<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:58FromDiscord<ag> (I mainly use Windows)
13:46:33FromDiscord<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:12PMunchNim already outputs debugging information which means you will see Nim source lines and such in GDB
13:52:22PMunchI'm using it right now
14:01:45*arkurious joined #nim
14:03:16FromDiscord<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:04FromDiscord<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:48PMunchHmm, 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:01FromDiscord<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:22FromDiscord<IsaacPaul> (edit) "in" => "(in" | "cases" => "cases)"
15:03:16*PMunch quit (Quit: Leaving)
15:04:41FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3FNW
15:06:07FromDiscord<Rika> thats one high resolution image of text
15:11:57FromDiscord<Marisol> There are 3 nim extensions in vscode, which one is recommended?
15:12:07nrds<Prestige99> saem's
15:12:38FromDiscord<Marisol> Oh i installed the right one then! Thanks
15:13:12FromDiscord<gdquest> sent a long message, see http://ix.io/3FO0
15:13:32FromDiscord<Recruit_main707> In reply to @Marisol "There are 3 nim": Is there one that is from Gary M?
15:13:44FromDiscord<Marisol> In reply to @Recruit_main707 "Is there one that": Yeah, why?
15:14:25FromDiscord<Recruit_main707> I used that because it fixed slight syntax highlight issues the main plugin had/(has)
15:14:57FromDiscord<Recruit_main707> I don’t know if either is up to date tho
15:16:16FromDiscord<Marisol> Just realized. Gary's one last update is 2 years ago
15:16:36FromDiscord<Marisol> saem's is the updated one
15:17:26nrds<Prestige99> If you spot a bug in the new plugin, please make a bug report
15:17:31FromDiscord<Recruit_main707> Damn, time flies, yeah we talked about testing stuff back in 04/2020
15:19:12FromDiscord<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:05NimEventerNew post on r/nim by miran1: Nim Community Survey 2021, see https://reddit.com/r/nim/comments/qznwhm/nim_community_survey_2021/
15:27:10FromDiscord<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:03FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=16em
15:29:28FromDiscord<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:25FromDiscord<Rika> doesnt work if your enum has holes
15:33:42FromDiscord<hmmm> who is the psycho that creates enums with holes
15:33:56FromDiscord<Rika> In reply to @gdquest "Do you know an": count all line breaks before a character? no other way around it
15:34:11FromDiscord<Rika> i dont think theres anything more efficient than O(n)
15:34:13FromDiscord<Rika> might be wrong of course
15:34:20FromDiscord<Rika> In reply to @hmmm "who is the psycho": plenty
15:34:31FromDiscord<Rika> i'd personally just reserve them though
15:34:43FromDiscord<Rika> if ever i do need to make a gap for some damn reaosn
15:37:01NimEventerNew Nimble package! zlib - zlib wrapper for Nim, see https://github.com/status-im/nim-zlib
15:45:49FromDiscord<ag> sent a code paste, see https://play.nim-lang.org/#ix=1qeH
15:46:53FromDiscord<ag> (edit) "https://play.nim-lang.org/#ix=1qeH" => "https://play.nim-lang.org/#ix=1CzY"
15:47:07FromDiscord<hmmm> hmm
15:47:13FromDiscord<hmmm> and what would shl be?
15:47:16FromDiscord<hmmm> πŸ‘€
15:47:28FromDiscord<Marisol> bit shift left?
15:47:33FromDiscord<hmmm> jesus
15:47:37FromDiscord<hmmm> I'm not touching that thing
15:48:11FromDiscord<Marisol> Me too. I just guessing actually. Coming from pascal like uhh 15 years ago
15:48:51FromDiscord<ag> yeah that's bitshift left
15:49:20*xet7 quit (Remote host closed the connection)
15:49:25FromDiscord<Marisol> But it's like 1, 10, 100, 1000, 10000, 100000 right. Not that complicated
15:50:25FromDiscord<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:55FromDiscord<narimiran> i.e. don't write C with Nim's syntax πŸ˜‰
15:51:57FromDiscord<ag> sent a code paste, see https://play.nim-lang.org/#ix=1FGL
15:52:57FromDiscord<ag> (edit) "https://play.nim-lang.org/#ix=1FGL" => "https://play.nim-lang.org/#ix=1MhK"
15:55:06FromDiscord<ag> In reply to @narimiran "see https://nim-lang.org/blog/2021/11/15/zen-of-nim": Very nice
15:55:27FromDiscord<Marisol> Haha cool
16:00:44FromDiscord<lenis> seems like arc/orc is pretty slow when you do a lot of ref object allocation
16:01:07FromDiscord<Rika> compared to
16:01:13FromDiscord<Rika> refc or m&s?
16:01:32FromDiscord<lenis> both
16:02:14FromDiscord<lenis> I started benchmarking with benchy instead, and showing max delta which is useful for capturing latency concerns.
16:03:52FromDiscord<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:31FromDiscord<Rika> refc's max latency is?
16:05:53FromDiscord<lenis> 1ms. avg time time is 0.1ms
16:06:08FromDiscord<lenis> but on arc/orc im getting as high as 2.5ms
16:06:15FromDiscord<lenis> and 35ms on mas
16:07:46FromDiscord<Rika> these are short lived? i assume its that since arc/orc is deterministic
16:08:17FromDiscord<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:30FromDiscord<Rika> needs to -> can
16:10:49FromDiscord<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:29FromDiscord<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:34FromDiscord<ag> I wonder if the same thing would work here
16:13:00FromDiscord<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:38FromDiscord<lenis> in fact i can see that it did 24 gc cycles
16:14:11FromDiscord<Rika> i know
16:14:13FromDiscord<Rika> thats not what i mean
16:14:41FromDiscord<Rika> arc orc is probably doing all of those deallocs and not batching them is what i mean
16:14:59FromDiscord<Rika> still doesnt explain the max i guess
16:15:19FromDiscord<lenis> yes but even for avg its a bit disappointing
16:15:45FromDiscord<lenis> I guess if you are dealing with a lot of short-lived heap objects you are better off using refc
16:18:44FromDiscord<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:38FromDiscord<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:58FromDiscord<ag> Fusion has a pool for that exact purpose: https://nim-lang.github.io/fusion/src/fusion/pools.html
16:21:10FromDiscord<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:38FromDiscord<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:26FromDiscord<Rika> nice
16:45:09FromDiscord<gdquest> sent a code paste, see https://play.nim-lang.org/#ix=2rcS
16:46:03FromDiscord<enthus1ast> @gdquest\: i found memory mapped files really fast for this kind of workload
16:46:20FromDiscord<enthus1ast> https://github.com/enthus1ast/countFasta/blob/8127028eee4c721fbc11308deac3c414ca16af31/fastalib.nim#L8
16:49:19FromDiscord<enthus1ast> I think sort is the in place version
16:49:41FromDiscord<gdquest> Ah! I was wondering seeing the no side effect pragma in the definition
16:49:53FromDiscord<gdquest> Yeah right that's why then
16:51:13FromDiscord<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:13FromDiscord<enthus1ast> guess you want `sorted` https://nim-lang.org/docs/algorithm.html#sorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29
16:51:18FromDiscord<gdquest> Yup thanks!
16:52:17FromDiscord<enthus1ast> what do you mean?
16:52:48FromDiscord<gdquest> I think I have different requirements than you perhaps, not sure
16:53:20FromDiscord<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:41FromDiscord<gdquest> So I'm unsure if a memory-mapped file would have benefits over just working on strings
16:53:52FromDiscord<enthus1ast> loading entire files can be very fast as well (if they fit in your memory)
16:54:07FromDiscord<gdquest> Yeah it's all pretty small, at most a couple mb loading the entire project
16:54:23FromDiscord<enthus1ast> but eg fasta files can be very large so better not do this \:)
16:54:33FromDiscord<gdquest> Ah gotcha πŸ™‚ Thanks for sharing
16:55:32FromDiscord<π™§π™šπ™’> whyd i get this error
16:55:34FromDiscord<π™§π™šπ™’> ` self.error(&"Invalid base specifier {baseSpec}, expected 0x or 0b.")↡`
16:55:36FromDiscord<π™§π™šπ™’> wait
16:55:39FromDiscord<π™§π™šπ™’> fucking copy paste on linux
16:55:50FromDiscord<π™§π™šπ™’> `'scanCharLiteral' cannot raise 'LexerDefect' [XCannotRaiseY]`
16:55:51FromDiscord<π™§π™šπ™’> this erorr
16:56:19FromDiscord<π™§π™šπ™’> sent a code paste, see https://play.nim-lang.org/#ix=2rRp
16:56:22FromDiscord<π™§π™šπ™’> `type LexerDefect = object of Defect`
16:56:26FromDiscord<π™§π™šπ™’> what am i doing wrong here
16:59:26FromDiscord<π™§π™šπ™’> ig i cant raise Defects since I changed it to be an Exception and that works fine?
16:59:27FromDiscord<π™§π™šπ™’> weird
17:01:11FromDiscord<hmmm> πŸ€”
17:01:25FromDiscord<hmmm> apparently our pop is the underwhelming "delete"
17:01:46FromDiscord<hmmm> rika let's make an rfc to change delete to pop
17:02:49FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2tyE
17:03:13FromDiscord<Rika> defect can mean "crash the program here without letting anything catch it" in some contexts
17:04:31FromDiscord<π™§π™šπ™’> ahhh
17:04:43nrds<Prestige99> how is pop delete?
17:04:45FromDiscord<π™§π™šπ™’> ill never catch this anyway because its a lexer error, if you get it you done goofed
17:04:58FromDiscord<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:06FromDiscord<Rika> yes, some people (namely hax i guess) are very vocal about using Defect though
17:05:20FromDiscord<Rika> someone failed copying a link it seems
17:06:37FromDiscord<haxscramper> yeah, imagine someone using your parser as a library
17:07:08FromDiscord<π™§π™šπ™’> its for a shitty language im making
17:07:12FromDiscord<π™§π™šπ™’> its not a library
17:07:45FromDiscord<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:01NimEventerNew thread by 12398890: Seems memory leaks in protobuf-nim or nim's GC, see https://forum.nim-lang.org/t/8648
18:29:39FromDiscord<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:04FromDiscord<hmmm> woa, my brain melts at 2D chess and now people want me to learn 4D chess
19:15:15FromDiscord<hmmm> it will never end 🧐
19:15:51FromDiscord<hmmm> looks fun as hell tbh
19:16:54FromDiscord<hmmm> put some warp pads in the middle 4 squares to teleport pieces around and you got a blockbuster in your hands
19:22:30FromDiscord<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:15FromDiscord<IsaacPaul> I remember reading you can forward declare a ref type somehow.. there is also this pragma: `{.experimental: "codeReordering".}`
19:32:40FromDiscord<IsaacPaul> usually cyclic dependencies is a code smell
19:32:55*Vladar joined #nim
19:33:08FromDiscord<π™§π™šπ™’> how would i implement visitor pattern in nim idiomatically?
19:36:53FromDiscord<Smarc> In reply to @Solitude "move Board type into": You are right, my bad! It is up now!
19:38:45FromDiscord<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:53FromDiscord<π™§π™šπ™’> basically this
19:38:54FromDiscord<π™§π™šπ™’> https://www.baeldung.com/java-visitor-pattern
19:39:00FromDiscord<π™§π™šπ™’> im tryign to write an ast for my crappy language
19:39:14FromDiscord<Solitude> In reply to @Smarc "You are right, my": move movement import below Board type
19:41:04FromDiscord<IsaacPaul> the visitor pattern to me just looks its supporting an interface within an interface.
19:43:35FromDiscord<π™§π™šπ™’> so how would i implement this in nim
19:43:39FromDiscord<π™§π™šπ™’> could u gimme a code example?
19:44:18FromDiscord<IsaacPaul> I can't atm; workin
19:44:45FromDiscord<π™§π™šπ™’> could anyone else?
20:00:02FromDiscord<ag> Is visitor pattern even considered idiomatic in Nim?
20:00:29FromDiscord<ag> In reply to @π™§π™šπ™’ "im tryign to write": Are you trying to implement the Java part of Crafting Interpreters using Nim?
20:00:56FromDiscord<π™§π™šπ™’> not reading that book but i want to implement an AST / visitor pattenr type thing
20:01:09FromDiscord<π™§π™šπ™’> (edit) "not reading that book but i want to implement an AST / visitor pattenr type thing ... " added "yes"
20:02:58FromDiscord<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:43FromDiscord<ag> See here: https://nim-lang.org/docs/manual.html#types-object-variants
20:03:59FromDiscord<ag> That's how the AST is done in the Nim compiler I guess
20:05:44FromDiscord<π™§π™šπ™’> hmm this would work
20:06:03FromDiscord<π™§π™šπ™’> but how can i do smth to traverse the node or would i check the node kind?
20:07:31FromDiscord<ag> Your node would need a `kind` field in it, and you'd check that when traversing
20:08:32madprops"Have you made code contributions to the Nim project in the past?"
20:08:37madpropsdoes it mean the compiler?
20:08:55FromDiscord<Smarc> In reply to @Solitude "move movement import below": That did the trick! Can you explain me why this is important?
20:13:24FromDiscord<Solitude> In reply to @Smarc "That did the trick!": it breaks the dependency cycle?
20:28:00FromDiscord<IsaacPaul> In reply to @madprops "does it mean the": I assumed anything in the nim repo (c2nim, nimpretty, nim, ect)
20:32:42FromDiscord<IsaacPaul> sent a code paste, see https://paste.rs/Fwl
20:34:03FromDiscord<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:44FromDiscord<Smarc> In reply to @Solitude "it breaks the dependency": Yes it did
20:35:22FromDiscord<Smarc> In reply to @IsaacPaul "Compilation works from the": Interesting, never had any problems with that yet. Thanks for clarification!
20:35:58FromDiscord<ag> In reply to @IsaacPaul "If you create the": Are any plans to change this? This seems like an unnecessary limitation
20:36:04FromDiscord<ag> (edit) "In reply to @IsaacPaul "If you create the": Are ... any" added "there"
20:36:23FromDiscord<IsaacPaul> In reply to @ag "Are there any plans": There is already this: `{.experimental: "codeReordering".}`
20:36:32FromDiscord<ag> Cool
20:36:57FromDiscord<Smarc> How/Where to use it actually?
20:37:39FromDiscord<IsaacPaul> Place it at the top of your file or pass it as a flag in the compiler
20:37:54FromDiscord<IsaacPaul> (edit) "in the compiler" => "when compiling"
20:38:44FromDiscord<IsaacPaul> It's not perfect tho: https://github.com/nim-lang/Nim/issues/10867
20:39:26FromDiscord<Smarc> Mh, I'm kinda confused now
20:41:07FromDiscord<Yardanico> In reply to @IsaacPaul "There is already this:": That's not for cyclic dependencies
20:41:18FromDiscord<IsaacPaul> oh
20:41:20FromDiscord<IsaacPaul> lmbo
20:41:39FromDiscord<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:12FromDiscord<IsaacPaul> In reply to @ag "Cool": Sorry I lied. lol
20:47:14*vicfred joined #nim
20:57:12NimEventerNew thread by Devosalain2: Garbage collection of nim vs pony language, see https://forum.nim-lang.org/t/8649
21:49:25FromDiscord<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:32FromDiscord<Lemon Pecan Pie> does anyone know what i should do?
21:49:37FromDiscord<Lemon Pecan Pie> thx in advance
21:53:45FromDiscord<Solitude> You should just build nim from git.
21:56:07FromDiscord<Lemon Pecan Pie> k thx
21:56:48FromDiscord<Elegantbeef> I mean choosenim should work, but could just be an issue with `/tmp`
21:57:27FromDiscord<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:50FromDiscord<Elegantbeef> Yea it really should be, i've not had that issue before
21:58:02FromDiscord<pyautogui> Hi - I am interested in contributing to the stdlib. Where should I get started?
21:58:43FromDiscord<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:01FromDiscord<Lemon Pecan Pie> In reply to @Elegantbeef "Yea it really should": would it help if i screenshotted my tmp directory?
21:59:20FromDiscord<pyautogui> Got it. Is there any module specifically that could use work?
21:59:34FromDiscord<Elegantbeef> I mean you can just check if `choosenim-0.8.2_linux_amd64` exists
21:59:48FromDiscord<Elegantbeef> You can look at the github issue tracker and find stdlib related issues and work on them
21:59:54FromDiscord<pyautogui> Thanks
22:00:03FromDiscord<Lemon Pecan Pie> In reply to @Elegantbeef "I mean you can": not in `tmp`
22:00:19FromDiscord<Elegantbeef> Does it happen if you run it again?
22:00:43FromDiscord<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:47FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AStdlib here you go py
22:01:05FromDiscord<pyautogui> Thank you.
22:01:12FromDiscord<Elegantbeef> Ok can you try a different directory like \~?
22:01:22FromDiscord<Elegantbeef> I'm just guessing it's playing dumb
22:02:51FromDiscord<dom96> yeah, try another dir. Why are you running it from /tmp anyway? πŸ™‚
22:04:03FromDiscord<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:22FromDiscord<Lemon Pecan Pie> https://media.discordapp.net/attachments/371759389889003532/912463540965744701/Screenshot_from_2021-11-22_17-04-08.png
22:05:04FromDiscord<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:03FromDiscord<dom96> do you have `curl` and/or `wget`?
22:06:13FromDiscord<dom96> I mean you must
22:06:19FromDiscord<dom96> since you're using it for the script lol
22:06:29FromDiscord<Lemon Pecan Pie> In reply to @dom96 "since you're using it": i probably do : )
22:06:35FromDiscord<dom96> https://github.com/dom96/choosenim/blob/master/scripts/choosenim-unix-init.sh#L61
22:06:44FromDiscord<dom96> the script is pretty simple to follow if you want to diagnose it
22:07:35FromDiscord<Lemon Pecan Pie> In reply to @dom96 "the script is pretty": i'll give it a shot, thx
22:07:56FromDiscord<Lemon Pecan Pie> oh
22:08:01FromDiscord<Lemon Pecan Pie> ok
22:08:07FromDiscord<Lemon Pecan Pie> i ran `sudo apt-get install curl`
22:08:12FromDiscord<Lemon Pecan Pie> curl installed
22:08:17FromDiscord<Lemon Pecan Pie> i ran the original command again
22:08:19FromDiscord<Lemon Pecan Pie> and it worked
22:08:26FromDiscord<Lemon Pecan Pie> πŸ˜„ thx so much for the help!
22:08:27FromDiscord<Elegantbeef> Lol not checking if curl is in the path
22:08:41FromDiscord<dom96> huh
22:08:46FromDiscord<Elegantbeef> Wait how the fuck did run choosenim
22:08:50FromDiscord<dom96> but you've used `curl` to get the init.sh script
22:08:51FromDiscord<Elegantbeef> Rather the init
22:09:17FromDiscord<Lemon Pecan Pie> https://media.discordapp.net/attachments/371759389889003532/912464778511925269/Screenshot_from_2021-11-22_17-09-00.png
22:09:30FromDiscord<Elegantbeef> Hmmm interesting bug....
22:10:24FromDiscord<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:25FromDiscord<dom96> whatttt, what was the original `curl` then
22:11:05FromDiscord<Lemon Pecan Pie> In reply to @dom96 "whatttt, what was the": idk, i'm completely clueless as to what just happened
22:11:22FromDiscord<Lemon Pecan Pie> but it works : D
22:11:32FromDiscord<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:47FromDiscord<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:13FromDiscord<IsaacPaul> I really hope it's fixed πŸ˜‚
22:20:33FromDiscord<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:02FromDiscord<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:36FromDiscord<IsaacPaul> yea
22:52:06FromDiscord<Elegantbeef> Yes you can even make it output to a specific folder with `--nimCache:someDir`
22:52:07FromDiscord<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:23FromDiscord<Elegantbeef> Otherwise it's in `.cache/nim/projectnam_somesymbols`
22:52:55FromDiscord<evoalg> Nice thank you ... gosh I hope I'd never actually have to look at them ever πŸ˜‰
22:54:23FromDiscord<Elegantbeef> Hey it's fun "What the fuck is this code" is like a murder mystery written by the Nim compiler
22:54:38FromDiscord<evoalg> hehehe
22:57:45FromDiscord<Elegantbeef> It does help when compiler devving πŸ˜›
22:58:14FromDiscord<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:36FromDiscord<Elegantbeef> No no no evol
22:58:41FromDiscord<Elegantbeef> We dont do that here!
22:59:00FromDiscord<Elegantbeef> That's the Nim way
22:59:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FOE
22:59:05FromDiscord<evoalg> oh!
22:59:15FromDiscord<Elegantbeef> It's identical to what you wanted, just not such a pain in the arse!
22:59:37FromDiscord<Elegantbeef> So now you can do things like `assert Mon notin weekend`
22:59:47FromDiscord<Elegantbeef> Worth noting in this case `const` is preferable to \`let
23:01:44FromDiscord<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:05FromDiscord<Elegantbeef> Which part?
23:02:39FromDiscord<evoalg> I mean that enum example, ... I guess I'm wondering: why do people use these things?
23:04:14FromDiscord<Elegantbeef> They're the best method and cleanest to represent fixed sizes
23:04:14FromDiscord<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:15FromDiscord<Elegantbeef> And now you have to document it
23:04:15FromDiscord<Elegantbeef> With the Enum you know `Monday` is `0`
23:04:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3FOG
23:05:17FromDiscord<Elegantbeef> So now you have a efficient data type with stringification that makes your life so simple
23:05:24FromDiscord<Elegantbeef> Enums afterall are just integers
23:07:23FromDiscord<evoalg> So I can think of them as a subset of integers with nice names?
23:07:39FromDiscord<Elegantbeef> Yes
23:08:02FromDiscord<evoalg> Nice! ... and could this be done as an object instead of an enum?
23:08:05FromDiscord<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:28FromDiscord<evoalg> ah nice!
23:08:53FromDiscord<Elegantbeef> I suppose you could do it with an object but it'd be nowhere as nice
23:13:22FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3FOJ they're quite simple to work with
23:13:54FromDiscord<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:14FromDiscord<evoalg> wow ... thank you, you're the best Elegantbeef !
23:15:37FromDiscord<impbox [ftsf]> they are indeed the best Elegantbeef!
23:15:47FromDiscord<Elegantbeef> Well i'm also the worst
23:15:48FromDiscord<impbox [ftsf]> there is no comparison
23:24:03arkanoidwhich 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:21FromDiscord<impbox [ftsf]> i don't think there's anything nim specific for that?
23:25:25FromDiscord<impbox [ftsf]> is there something you have in mind?
23:26:54arkanoidwell, the best would be a visualization of the places where shared mutation happens
23:27:22FromDiscord<Elegantbeef> Hax has https://github.com/haxscramper/nimtrail though no clue if it even approaches what you want
23:28:49arkanoidno, what I was thinking about what something out from nim compiler internal knowledge
23:29:06FromDiscord<impbox [ftsf]> what is the output you want?
23:29:41FromDiscord<impbox [ftsf]> that sourcetrail thing looks cool
23:29:43arkanoidwell, call graph would be nice, also module dependencies
23:30:14FromDiscord<Elegantbeef> This is where i say the famous words of "PR welcomed"
23:30:23arkanoid:)
23:30:31FromDiscord<Elegantbeef> The information is of course there, docgen for instance generates module dependancies
23:30:58FromDiscord<Elegantbeef> Source trail might give the call graph but yea nothing in the compiler that i know of
23:31:12FromDiscord<impbox [ftsf]> https://github.com/petermora/nimTracelog
23:32:10arkanoidinteresting
23:36:14arkanoidalso --expandArc:f is something
23:51:13*adium joined #nim