<< 16-02-2021 >>

00:23:32*asdflkj_ quit (Ping timeout: 272 seconds)
00:23:37*Tanger quit (Ping timeout: 256 seconds)
00:24:22*asdflkj_ joined #nim
00:31:18*Generic2 joined #nim
00:32:00*abm quit (Read error: Connection reset by peer)
00:46:39*asdflkj_ quit (Quit: WeeChat 2.8)
00:46:55*asdflkj_ joined #nim
00:47:36*j is now known as jess
00:54:06*Tanger joined #nim
00:57:46*vicfred quit (Quit: Leaving)
01:13:06*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:13:27*njoseph joined #nim
02:15:07*vsantana joined #nim
02:20:53FromDiscord<Varriount> How much forethought was given to the design of fusion's API?
02:28:56*mwbrown quit (Ping timeout: 272 seconds)
02:33:43*mwbrown joined #nim
02:37:39FromDiscord<ElegantBeef> Probably not much 😄
02:37:40FromDiscord<Hi02Hi> does anyone know why some langs have immutable strings? i cant see any benefits over having mutable strings but an immutable variable
02:42:48FromDiscord<claude> some languages only have references, when your strings are immutable you can intern them etc
02:56:35FromDiscord<Hi02Hi> intern?
02:56:42FromDiscord<Varriount> Cache them
02:57:15*giaco joined #nim
03:00:24FromDiscord<Varriount> @Hi02Hi With a mutable string implementation, you either have to do one of the following:↵ - Keep track of all locations in memory the string's address is held at.↵ - Represent strings as double pointers (a pointer to a pointer of string data).↵ - Copy the string on assignment (make sure there is only ever one reference to it in memory.
03:02:47FromDiscord<Varriount> This is because the location a string's data is held at can change, if the string is reallocated (which is often done when adding to the string).
03:03:58FromDiscord<Varriount> The location an immutable string's data is held at is constant, so none of the above is needed.
03:06:02FromDiscord<Varriount> As an example, I believe that (from a very simplified point of view) Python's lists use double pointers, while the strings use single pointers.
03:07:48FromDiscord<Varriount> @ElegantBeef Did I miss anything?
03:07:53FromDiscord<ElegantBeef> About?
03:08:12*Generic2 quit (Quit: Generic2)
03:08:15FromDiscord<Varriount> Mutable vs immutable strings
03:08:23FromDiscord<ElegantBeef> I'm not that smart to know anything
03:17:17*vicfred joined #nim
03:23:45FromDiscord<ElegantBeef> What's the proper way around this? https://play.nim-lang.org/#ix=2PA5
03:26:41FromDiscord<flywind> related https://github.com/nim-lang/Nim/issues/7831
03:26:42FromDiscord<ElegantBeef> Proper minification https://play.nim-lang.org/#ix=2PA6
03:27:22FromDiscord<flywind> It seems that closure iterators don't support openarray/varargs.
03:29:04PrestigeWell that's interesting
03:30:02*a_chou joined #nim
03:43:56*asdflkj_ quit (Ping timeout: 240 seconds)
03:51:10FromDiscord<ElegantBeef> Isnt this a better solution? https://play.nim-lang.org/#ix=2PA8
04:13:00*pbb quit (Remote host closed the connection)
04:14:25*pbb joined #nim
04:31:42ForumUpdaterBotNew thread by Halloleo: Exception hierarchy, see https://forum.nim-lang.org/t/7513
04:33:42ForumUpdaterBotNew thread by Halloleo: Defects and CatchableErrors, see https://forum.nim-lang.org/t/7514
04:35:49FromGitter<offbeat-stuff> Hi I have a list of constanst of form vkErrorName
04:37:06*a_chou quit (Remote host closed the connection)
04:37:15FromGitter<offbeat-stuff> if want to genCode like this ` ⏎ proc error(x: VkResult)= # type of these error ⏎ ⏎ ``` case x ⏎ of vkErrorName: echo "[Vk Error] Name"``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=602b4bfb7ba8124e546a5928]
05:04:41*sz0 quit (Quit: Connection closed for inactivity)
05:24:42FromGitter<offbeat-stuff> Hi This fails to compile https://play.nim-lang.org/#ix=2PAq ⏎ Saying that error can only be done at compile time
05:33:40FromGitter<offbeat-stuff> Here I set it up for the playground ⏎ https://play.nim-lang.org/#ix=2PAr
05:44:30*haxscramper joined #nim
05:45:51ForumUpdaterBotNew thread by Halloleo: Access to the lines numbers in the trace of an exception, see https://forum.nim-lang.org/t/7515
05:48:32*sz0 joined #nim
05:48:45FromDiscord<haxscramper> In reply to @Varriount "How much forethought was": For pattern matching we have an RFC that was discussed on and off for a couple of months, and other libraries are not that big, but they do have quite clean API in my opinion, because fusion is designed to be an "extended stdlib" and so some standard of quality is expected still
05:49:28FromDiscord<haxscramper> In reply to @ElegantBeef "Probably not much 😄": So that is not correct, at least for the fusion parts I'm familliar with
05:52:17*vicfred quit (Quit: Leaving)
05:53:09FromDiscord<PizzaFox> is there not a way to combine two `Table`s?
05:55:31FromDiscord<haxscramper> there is `merge` for count tables, but for regular ones I'm afraid you would have to add elements one-by-one
05:59:16*avanderneut quit (Read error: Connection reset by peer)
06:02:32*j-james joined #nim
06:05:17*waleee-cl quit (Quit: Connection closed for inactivity)
06:19:41*ddevault_ joined #nim
06:19:48*ddevault quit (Ping timeout: 260 seconds)
06:21:25*ddevault_ is now known as ddevault
06:23:53FromGitter<awr1> has generated Nim C code ever discovered gcc/clang/etc. compiler bugs
06:37:05haxscramperMost likely no, gcc/clang are really stable compilers
06:39:56haxscramperIs there a way to show sink inference annotations like with `--expandArc`?
06:46:24FromDiscord<Gaz> What does doAssert do?
06:47:03*j-james quit (Quit: WeeChat 3.0)
06:53:58FromDiscord<haxscramper> Same as `assert` but is always turned on
06:54:21FromDiscord<haxscramper> Regular `assert` can be disabled with `--assertions:off`
07:04:13FromDiscord<impbox> hmm what's a nice way to take say three (or more) seqs A,B,C, and produce all possible combinations of them. A1,B1,C1, A1,B1,C2, A1,B2,C1, etc...
07:05:29FromDiscord<impbox> I think maybe that's what zip does?
07:08:46FromDiscord<impbox> `A = @[a1,a2,a3]; B = @[b1,b2,b3]; C = @[c1,c2]; ` and I want to get `@[a1,b1,c1], @[a1,b1,c2], @[a1,b2,c1], @[a1,b2,c2], @[a1,b3,c1] ... etc`
07:11:59FromDiscord<haxscramper> For getting all permutations we have https://nim-lang.org/docs/algorithm.html#nextPermutation%2CopenArray%5BT%5D , though you probably need to loop through all possible index combinations
07:13:12FromDiscord<haxscramper> which we don't have built-in stdlib iterator for
07:13:26FromDiscord<impbox> ok, thanks, i'll implement one
07:19:11*Tanger quit (Quit: Leaving)
07:34:25*wasted_youth2 quit (Quit: Leaving)
07:44:55*teasea quit (Quit: teasea)
07:45:18*teasea joined #nim
07:47:36FromDiscord<Varriount> timotheecour: is there anything regarding my commentary on isAdmin[0] that I should know?↵[0] https://github.com/nim-lang/Nim/pull/17012#issuecomment-778834934
07:57:51haxscramper`fusion/smartptrs` does not allow creation of the new shared/unique pointers from existing ones - I think this should be allowed too, especially considering this would allow to hook up desctructors to C libraries, which IMO is kind of useful. Right now creating unique pointer from pointer creates `UniquePtr[ptr T]` and destructor is not recognized.
07:58:43haxscramperAnd in general it does not make much sense to create unique pointer to pointer, so adding overload for `newUniquePtr(p: sink ptr T)` make sense to me
08:21:20haxscramperAlso now we have **four** different set implementations in stdlib - built-in `set`, `IntSet`, `PacketSet[T]` and `HashSet[T]`
08:21:30*PMunch joined #nim
08:42:03FromDiscord<mratsim> what's a packedset?
08:43:06haxscramperhttps://nim-lang.github.io/Nim/packedsets.html
08:43:07haxscramper> The packedsets module implements an efficient Ordinal set implemented as a sparse bit set.
08:43:16haxscramperIdentical to `set[T]` but for larger ordinals
08:44:37FromDiscord<mratsim> it's identical to intsets not to set
08:44:52haxscramperYou can add arbitrary ordinals to `IntSet`?
08:44:53haxscramper
08:45:00FromDiscord<Gaz> In reply to @haxscramper "Same as `assert` but": So what does assert do?
08:45:28haxscramperIIRC you can't add any ordinal to `IntSet`, at least without casting to `int` first
08:45:40FromDiscord<haxscramper> In reply to @Gaz "So what does assert": https://nim-lang.org/docs/assertions.html#assert.t%2Cuntyped%2Cstring
08:45:44FromDiscord<mratsim> In reply to @haxscramper "You can add arbitrary": it's basically a copy of intset, look at the datastructures
08:46:07FromDiscord<mratsim> replace "int" by "T"
08:46:26haxscramperyes I know it is implemented similarly internally, but this does not mean two different modules are the same etc.
08:46:38haxscramperBut `IntSet` is/should-be deprecated then
08:46:42FromDiscord<mratsim> we're missing as an actual packed set that is not sparse https://github.com/mratsim/constantine/blob/master/constantine/elliptic/ec_endomorphism_accel.nim#L148-L181
08:46:49FromDiscord<mratsim> packed set is misleading
08:54:09FromDiscord<mratsim> raised an issue: https://github.com/nim-lang/Nim/issues/17057
09:08:56*vsantana quit (Ping timeout: 240 seconds)
09:21:13*wasted_youth2 joined #nim
09:32:59FromDiscord<tomck> Hello↵Setting --gc=arc for some reason removes deepCopy, which means i can't compile any libs which use deepCopy (e.g. parsetoml)↵any mention of this / workarounds?
09:35:42FromDiscord<ElegantBeef> `--deepcopy:on|off`
09:40:46FromDiscord<tomck> ah - any reason why this is off on arc builds
09:40:52FromDiscord<tomck> (edit) "builds" => "builds?"
09:41:31FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2PB9
09:41:48FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2PBa
09:42:04FromDiscord<tomck> same error for `--deepcopy=on` (with = instead of 🙂
09:42:08FromDiscord<tomck> (edit) "🙂" => ": )"
09:46:09FromDiscord<Solitude> whats your nim version?
09:46:32FromDiscord<tomck> 1.3.5
09:46:40FromDiscord<Solitude> its in 1.4.0
09:46:49FromDiscord<tomck> a h
09:46:50FromDiscord<Solitude> why are you on old devel?
09:47:10FromDiscord<tomck> err i needed a compiler fix for something a while back, never upgraded further
09:50:22FromDiscord<Clyybber> Intset is nothing more than an alias to PackedSet[int]
09:52:08*abm joined #nim
09:58:21FromDiscord<Gaz> sent a long message, see https://paste.rs/qm3
09:58:27FromDiscord<Gaz> (edit) "http://ix.io/2PBg" => "http://ix.io/2PBf"
09:58:38FromDiscord<ElegantBeef> Yes we use type inference in Nim
09:59:20FromDiscord<ElegantBeef> It'd be more correct to do `let name = readlineStuffHere`
09:59:33FromDiscord<ElegantBeef> Since you will probably not have any need to mutate name
10:08:52*Vladar joined #nim
10:10:19*pietroppeter joined #nim
10:47:39*quadrassel4321 joined #nim
10:47:47*quadrassel4321_ joined #nim
10:48:00*quadrassel4321_ quit (Client Quit)
10:48:09FromDiscord<haxscramper> sent a long message, see http://ix.io/2PBw
10:48:16*quadrassel4321 quit (Client Quit)
10:48:27FromDiscord<haxscramper> Also, should `xmltree` from fusion be preferred over the one in stdlib? (`IIRC` parsehtml was moved from stdlib to fusion, but I'm not sure about other XML-related parts)
10:48:37*quadrassel4321 joined #nim
10:53:01FromDiscord<haxscramper> In reply to @haxscramper "I'm writing fusion article": Maybe there is some rawsugar library on nimble already (or maybe some library has helpers like that)
11:02:26FromDiscord<iWonderAboutTuatara> So I have a question about using the compiler output
11:02:48FromDiscord<iWonderAboutTuatara> When trying to run the c output manually, it says it can't find nimbase.h
11:02:54FromDiscord<iWonderAboutTuatara> where is it?
11:03:07FromDiscord<iWonderAboutTuatara> and is there any way to make a dependencyless output file?
11:03:17FromDiscord<iWonderAboutTuatara> of c or cpp
11:03:27FromDiscord<iWonderAboutTuatara> alternatively can I make stdin work with nimjs
11:25:03FromDiscord<Yardanico> @iWonderAboutTuatara nimbase.h is in <your nim directory>/lib
11:25:14FromDiscord<Yardanico> and yes, you can make stdin work with nimjs, you just need to wrap a bit of nodejs specific code
11:46:04FromDiscord<tomck> How do closures work in arc?
11:46:37FromDiscord<tomck> Can i explicitly move a ref into a closure? I'm getting a segfault, looks like my data is being freed b/c it doesn't see the closure as a shared owner
11:47:52FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2PBP
11:48:17FromDiscord<tomck> I'm expecting myData to have the refcount incremented when my anonymous proc is created on line 3, instead i just get a segfault
11:48:20FromDiscord<tomck> works with normal gc
11:48:35FromDiscord<tomck> also works with orc, hmm
11:49:41qwrweird, the difference between orc and arc should be that arc may leak cycles, not segfaults (sounds like bug)
11:50:09FromDiscord<tomck> interesting, ok - any workarounds you're aware of?
11:50:32FromDiscord<tomck> i can't just manually increment the refcount since my callback might not be called, so that'd leak memor
11:50:38qwryou found workaround (orc) ;)
11:50:48FromDiscord<tomck> rip
11:51:17FromDiscord<tomck> how does nim determine what vars get captured? just by analysing the anonymous function? or is there some syntax to specify a capture?
11:51:43FromDiscord<tomck> e.g. in c++ you can specify a capture `[myData]() { std::cout << myData[0]; }`
11:51:51FromDiscord<tomck> (edit) "e.g. in c++ you can specify a capture `[myData]() { std::cout << myData[0]; }` ... " added "in the `[myData]` part"
11:51:55qwrnim should do it automatically
11:55:52PMunch@tomck, why are you creating myData as a ref seq`
11:55:54PMunch?*
11:56:02*Vladar quit (Remote host closed the connection)
11:56:08FromDiscord<tomck> to capture it without copying
11:56:23PMunchseqs are already references
11:56:26FromDiscord<tomck> hang on, i don't think this is a compiler bug, i think this probably should segfault in orc too
11:56:32FromDiscord<tomck> eh? seqs are value types i though
11:56:32PMunchSo it won't be copied
11:57:06PMunchWell, they are, but they are len, cap, and data where data is a reference
11:57:20PMunchSo it will only copy three times sizeof(int)
11:57:44FromDiscord<tomck> hmmm, not sure that's true https://play.nim-lang.org/#ix=2PBS
11:58:06FromDiscord<tomck> looks like it's copying the seq, as in a full copy of all the elements in the seq
11:58:12PMunchThat's because Nim detects that you want a copy of it
11:58:25PMunchAh, I see what you mean
11:58:34FromDiscord<tomck> do you mean captures are refs by default
11:58:37PMunchYou want to have a reference to the same sequence from multiple places
11:58:42FromDiscord<tomck> yes
11:59:59*Vladar joined #nim
12:01:37PMunchI mean the example you shared could just access the global variable and you'd be fine
12:02:26FromDiscord<tomck> myData falls out of scope in my real code
12:02:43FromDiscord<Zachary Carter> https://play.nim-lang.org/#ix=2PBW there
12:03:02PMunchBut now b is a pointer
12:03:08FromDiscord<Zachary Carter> no one said that was against the rules
12:03:14PMunchWhich won't be picked up by the ARC
12:03:19FromDiscord<Zachary Carter> well then just box it
12:03:39FromDiscord<Zachary Carter> or pass it as a var seq
12:03:52FromDiscord<Zachary Carter> or just use a pointer
12:04:15PMunch@tomck, how are you passing the variable in? Just letting it get captured by a closure?
12:04:51PMunchKinda hard to tell if you're doing something weird or if this is an actual bug without seeing your code
12:05:12FromDiscord<tomck> the variable is just being captured, as in my example
12:05:15FromDiscord<tomck> it's just inside a scope
12:05:37FromDiscord<tomck> i'm trying to reproduce with a smaller example, but it doesn't segfault, so either an error with my code or it's something else that's causing it to be freed
12:05:45FromDiscord<tomck> hang on, i'll be back probably
12:05:55FromDiscord<Zachary Carter> sounds ominous
12:08:23haxscramperIs there any **C** library that could benefit from RAII-style API? I want to make exaple out of it with smart pointers and custom wrappers (and also some helper functions for `fusion/pointers` while I'm at it)
12:08:38haxscramperJust any library, only not too big/convoluted
12:08:57haxscramperTo avoid coming up with completely synthetic examples
12:10:27*xet7 quit (Remote host closed the connection)
12:11:21*xet7 joined #nim
12:11:32haxscramperIt might be something that already wrapped even
12:11:50FromDiscord<Zachary Carter> maybe you could do it with sdl2 / glfw3
12:12:00FromDiscord<Zachary Carter> and just wrap like context and window creation / destruction
12:13:51FromDiscord<Zachary Carter> or I can find you another C library that has cleanup procedures for you if those don't work
12:14:05haxscramperNo, those are fine probably
12:14:55haxscramperAt least basic sdl2 examples look like exactly what I need - not overly verbose, but somewhat annoying with all `SDL_DestroyWindow` cals
12:15:00haxscrampercalls*
12:15:31*Tanger joined #nim
12:16:06haxscramperThough I realized that I'm not sure what the benefit of `sharedPtr[T]` over `ref T` is. It avoids double dereference, but those are not **that** expensive, right?
12:16:58krux02haxscramper, yes SDL2 works pretty nicely.
12:17:09FromDiscord<Zachary Carter> I haven't really used sharedptr but I have used uniqueptr
12:17:22krux02the surface is I think the best type to benefit from RAII.
12:17:43krux02program level RAII can be done with `atexit` in C as well.
12:18:56krux02haxscramper, sharedPtr[T] is AFIK the C++ class for shared pointers
12:20:23krux02and ref[T] technically compile to a c++ sharedPtr. But it is the pointer type that the compiler knows about unlike sharedPtr that is just a library thing.
12:21:01FromDiscord<hamidb80> https://web.eecs.utk.edu/~azh/blog/pythonstringsaremutable.html ↵damn python 😕
12:33:06FromDiscord<tomck> ok lol i managed to reproduce
12:33:32FromDiscord<tomck> https://play.nim-lang.org/#ix=2PC2
12:34:26FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2PC3
12:36:25FromDiscord<tomck> Interestingly, if you remove the first `echo` on line 29, len prints out fine?? So i'm guessing something it messing up with the captuer, or there's a dumb error i've made here
12:37:19PMunchHmm, curious that it doesn't properly print the kind for the third element either
12:38:31FromDiscord<tomck> yeah, which is doubly weird b/c that' s in a totally separate memory block to the array len, so it's not like there's a single buffer overrun somewhere
12:39:26FromDiscord<tomck> If i wrap that whole if branch in a proc & call it, it works perfectly in this example
12:39:27PMunchI mean that might just be a bug in the stringification
12:39:44FromDiscord<tomck> unsure, i get a segfault if i try to print the 3rd element
12:39:49PMunchThe body of if x == 500?
12:39:57PMunchOoh, interesting
12:40:44FromDiscord<tomck> oh lol, ok the plot thickens↵yes, the body of x == 500
12:41:24PMunchThis definitely looks like an ARC capture bug
12:41:57FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2PC7
12:41:58FromDiscord<tomck> does echo write any data?
12:42:24FromDiscord<tomck> where do you want me to put this, do i just submit an issue with the code?
12:42:37PMunchIt segfaults for me
12:42:44PMunchWhen I flip it
12:42:47FromDiscord<Rika> Did you put this through calf ribs
12:42:47FromDiscord<Rika> Ugh
12:42:50FromDiscord<Rika> Valgrind
12:43:00FromDiscord<tomck> calf ribs
12:43:01PMunchProbably just a bit of raciness with the collection
12:43:09FromDiscord<Rika> Blame the phone
12:43:12FromDiscord<tomck> oh weird, nvm then
12:43:13PMunchHaha :P
12:43:27FromDiscord<Rika> I can’t not rely on autocorrect right now because my fingers are freezing
12:45:07FromDiscord<tomck> is it cold where you are too? we've gotten an uncharacteristic 5 inches of snow
12:46:05FromDiscord<tomck> ran it through valgrind, just a single invalid read, at `colonanonymous_hH9a1MweJ3WqlrBXmvnzuag`
12:46:23FromDiscord<Rika> Try using it with debugger native
12:46:45FromDiscord<hamidb80> debugger native?
12:46:51FromDiscord<Rika> It’s above ankle height snow here right now but the snowing is heavy so I expect it to be knee height tomorrow
12:47:10FromDiscord<Rika> - -debugger:nativew
12:47:18FromDiscord<Rika> Without the w
12:47:22FromDiscord<Rika> And the space
12:47:31PMunchWe've got 2" 10'..
12:47:50PMunchEer, wait 2' 10"
12:47:55PMunch85cm
12:47:56FromDiscord<tomck> rip, where are you guys are getting knee height snow?
12:47:57FromDiscord<Rika> Leave me be! My fingers are dying!
12:48:07FromDiscord<tomck> @Rika same with --debugger:native
12:48:08FromDiscord<Rika> I live in a mountain basin so
12:48:10PMunchNorthern Norway :P
12:48:14FromDiscord<hamidb80> here we didn't get snow in this winter.
12:48:26FromDiscord<hamidb80> (edit) "here we didn't get ... snow" added "any"
12:48:27FromDiscord<tomck> @hamidb80 there's still time
12:49:03FromDiscord<Rika> Does valgrind not look at debug data whatsoever or what
12:50:01*pietroppeter quit (Quit: Connection closed for inactivity)
12:51:10*lritter joined #nim
12:56:56FromDiscord<tomck> i have no idea how debuggers work
12:57:36FromDiscord<tomck> i'm pretty sure the 'anonymous' part means it's just segfaulting in the lambda somewhere, so it's not like it's a buffer overrun outside of the fn
12:59:38*abm quit (Quit: Leaving)
13:14:08FromDiscord<Zachary Carter> We have about 4 inches of snow in Austin TX and the world is ending
13:14:32FromDiscord<Recruit_main707> Btc reached 50k lads
13:19:09*spiderstew_ quit (Read error: Connection reset by peer)
13:20:26*spiderstew joined #nim
13:23:14FromDiscord<Zachary Carter> Does that mean I get 50k?
13:26:31*zazi[m] joined #nim
13:29:51haxscramperIn the end I think tha writing standalone article for fusion is not going to be particularly interesting, mainly because there is not a lot of thing that can be made into something interesting enough. Instead it would be better to add section in new changelog that would discuss fusion - how it can be installed (because it changed in current version anyway), what modules are there and so on
13:31:04haxscramperI've just spent last couple of hours thinking of some coherent way to present all modules, but it just that - collection of good helper libraries, each one not having particular wow-effect
13:31:20*NimBot joined #nim
14:05:11Clonkk[m]What's the catch to be able to cast a ``pointer`` into a ``proc`` (assuming prototype known)
14:05:23FromDiscord<mratsim> no catch
14:05:26Clonkk[m]I get a ``expression cannot be cast to ...``
14:05:48Clonkk[m]Oh I forgot a ``ptr``
14:05:52Clonkk[m]Nevermind, carry on
14:06:02Clonkk[m] * Nevermind, carry on. Nothing to see here
14:10:07*xet7 quit (Remote host closed the connection)
14:10:59*xet7 joined #nim
14:16:25*xet7 quit (Remote host closed the connection)
14:17:09*xet7 joined #nim
14:26:07*xet7 quit (Remote host closed the connection)
14:26:58*xet7 joined #nim
14:28:18*xet7 quit (Remote host closed the connection)
14:29:02*xet7 joined #nim
14:30:11*abm joined #nim
14:34:17planetis[m]why is return frowned upon? what kind of optimization is not possible when using it, for example in a shortest path proc? Does it worth changing to not use return?
14:36:17FromDiscord<haxscramper> IT IS NOT FROWNED UPON
14:36:26FromDiscord<haxscramper> just some people prefer writing code differently
14:36:35FromDiscord<mratsim> i like return
14:36:54FromDiscord<Cypheriel> Pretty sure it's just semantics if anything
14:37:09FromDiscord<mratsim> There is something in embedded about only having a sigle return point in functions.
14:37:15FromDiscord<mratsim> (edit) "sigle" => "single"
14:38:12FromDiscord<mratsim> but if it's not imposed by some kind of standards like MISRA, i preffer to use early return to exit out of a function if some preconditions are not met (like having elements in a sequence for example before doing work on it).
14:43:29*xet7 quit (Remote host closed the connection)
14:43:37planetis[m]ok thank you, because changing it to the other style, gives me ptsd from the days we were writing algoriths in paper in a shitty pascal inspired lang without break or return
14:44:09planetis[m]that thappened in school not in my imagination
14:44:17*xet7 joined #nim
14:45:31*xet7 quit (Remote host closed the connection)
14:50:30*waleee-cl joined #nim
14:52:18*xet7 joined #nim
15:01:01FromDiscord<zetashift> I sometimes program in Scala, which does not have an explicit return/break/continue mechanism
15:02:08FromDiscord<zetashift> I don't mind the use return to exit early out of a function if a precondition is not met, it's almost the only time I use return like that.
15:07:34ForumUpdaterBotNew thread by Serge: Nlftk : FLTK for Nim : how do you associate a callback to a button? , see https://forum.nim-lang.org/t/7516
15:09:34*xace quit (Ping timeout: 272 seconds)
15:11:15*xace joined #nim
15:12:59saemI replicated likely the same capture bug last night. I need to bisect the commits and see if I can find culprit though I suspect it's not a direct cause but more exposed issues elsewhere sort of situation.
15:20:47*xet7 quit (Remote host closed the connection)
15:21:22*xet7 joined #nim
15:22:45FromDiscord<Rika> @planetis NRVO cannot be easily done by the compiler if you use return i believe?
15:23:25FromDiscord<Rika> (and yes it can produce some observable differences
15:23:28FromDiscord<Rika> in speed)
15:26:57FromDiscord<mratsim> I have never seen the codegen difference between NRVO and no NRVO.
15:26:57*xet7 quit (Remote host closed the connection)
15:29:01*xet7 joined #nim
15:30:10*xet7 quit (Remote host closed the connection)
15:32:02*xet7 joined #nim
15:32:42*xet7 quit (Remote host closed the connection)
15:33:57*xet7 joined #nim
15:34:20*xet7 quit (Remote host closed the connection)
15:41:16*qwertfisch quit (Ping timeout: 240 seconds)
15:56:19*qwertfisch joined #nim
16:00:01*himup[m] quit (Quit: Idle for 30+ days)
16:02:07*tane joined #nim
16:07:09*xace quit (Ping timeout: 264 seconds)
16:07:47*xace joined #nim
16:09:16*xet7 joined #nim
16:26:02*xet7 quit (Remote host closed the connection)
16:26:39*xet7 joined #nim
16:38:03federico3https://vlang.io/ V's landing page provide a good overview of its features without having to dig around the website
16:38:41haxscramperfor god's sake
16:38:43FromDiscord<mratsim> so much white, my eyes ...
16:39:06FromDiscord<mratsim> why is their doom still on the front page? Such a lie
16:39:24federico3I guess you use dark backgrounds?
16:39:26haxscramperThe whole idea of this website is to advertise as much as possible
16:39:35haxscramperSHoving everything the could
16:39:55*asdflkj_ joined #nim
16:39:58haxscramperI would rather compare to rust/go/D/Qt
16:39:59FromDiscord<konsumlamm> even the features that aren't even implemented
16:40:13FromDiscord<mratsim> yes I use darker UI
16:40:25FromDiscord<Rika> the is v still fast page is a good idea prolly
16:40:32federico3I'm aware of the exaggerations and so on, but I'm talking about the layout where viewers can scroll and get a good overview. It's quite welcoming
16:41:21FromDiscord<mratsim> so you want this on the landing page? https://nim-lang.org/features.html
16:42:40*xet7 quit (Remote host closed the connection)
16:42:55federico3yes, but with more info (and possibly less empty space)
16:43:08FromDiscord<mratsim> Maybe just above recent articles we can put a link "Nim features" or get even more targeted "Nim for the Python dev" "Nim for the team lead" "Nim for the C dev" "Nim for the Rust dev".
16:43:13*xet7 joined #nim
16:43:36FromDiscord<mratsim> "Nim for the Ada dev" "Nim for the correctness conscious dev"
16:43:46FromDiscord<mratsim> "Nim for the gamedev".
16:44:01FromDiscord<mratsim> That would allow us to get stats on where do people come from
16:44:09FromDiscord<mratsim> and also target the message depending on the demography.
16:44:12federico3+1
16:44:32FromDiscord<haxscramper> https://nim-lang.org/learn.html has this, but needs restructuring
16:44:44PrestigeNim for Noobs would be good too, imo. The defaults docs are not super friendly
16:44:44FromDiscord<haxscramper> Right now it all split into multiple pages
16:44:55FromDiscord<mratsim> learn should be a Call To Action below as well.
16:45:58FromDiscord<mratsim> "learn Nim now" and maybe a playground link example.
16:46:07*xet7_ joined #nim
16:46:08YardanicoPrestige: did you check nim basics?
16:46:09*xet7 quit (Remote host closed the connection)
16:46:21Yardanicohttps://narimiran.github.io/nim-basics/ imo this is "nim for noobs" you want :P
16:47:29PrestigeIt's pretty good but I think people these days are intimidated by having to read a page with so much text that they have to scroll. I think there's a go site that has tiny single-page examples that was done well
16:47:34Prestigejust my 2 cents
16:48:15*xet7_ quit (Excess Flood)
16:48:44*xet7_ joined #nim
16:50:45PrestigeI think https://www.learn-golang.org/ is what I saw before
16:54:18FromDiscord<Goel> As a noob i prefer a Tutorial with lot of short chapters to study instead of a monolithic single page (and most Tutorial and guides in fact are just like that, split in 30+ simple chapters)
16:54:35PrestigeYeah, I agree
16:59:01*evbo joined #nim
16:59:23*evbo quit (Remote host closed the connection)
17:00:11*fputs joined #nim
17:05:30asdflkj_me three
17:05:40FromDiscord<gollark> I mostly learn things by writing simple things in them using example code, manuals and in Nim's case the big table of stdlib functions.
17:06:01FromDiscord<gollark> The manual seems to be missing some things though, like slices.
17:06:58Clonkk[m]http://ssalewski.de/nimprogramming.html is also super useful I think
17:20:09FromDiscord<no name fits> Thanks Clonk
17:20:46*a_chou joined #nim
17:30:06FromDiscord<JSGRANT> In reply to @Clonkk "http://ssalewski.de/nimprogramming.html is also sup": That's more a general-purpose introduction to 'programming' in Nim; Also find it super-useful just not as a general introduction to Nim. lol
17:31:08FromDiscord<JSGRANT> It's been a GREAT reference to figure out how I want to structure my book / lesson-plan that I eventually want to make a video-course around
17:34:29FromDiscord<JSGRANT> In reply to @Goel "As a noob i": This is actually the only issue I really have with that link I replied to. It's a freakin' tome. Would benefit a lot I think by being split up in pages even though there are already proper chapters.
17:44:39*fputs quit (Remote host closed the connection)
17:45:52*natrys joined #nim
17:51:32*al1ranger joined #nim
17:52:28*fputs joined #nim
18:09:45*al1ranger quit (Quit: Leaving)
18:32:24FromDiscord<iWonderAboutTuatara> @Yardanico FOUND IT
18:32:32FromDiscord<iWonderAboutTuatara> oops sorry for caps
18:32:38FromDiscord<Yardanico> found wat
18:32:38FromDiscord<iWonderAboutTuatara> didn't realize I was on capslock
18:32:40FromDiscord<Yardanico> 🤔
18:32:42FromDiscord<iWonderAboutTuatara> nimbase.h
18:32:52FromDiscord<iWonderAboutTuatara> I still get a bunch of errors when I try to compile though
18:32:57FromDiscord<Yardanico> for example?
18:33:04FromDiscord<Yardanico> you might need to provide additional flags to the linker
18:33:06FromDiscord<Yardanico> check the json file
18:33:41FromDiscord<iWonderAboutTuatara> https://paste.myst.rs/xk7ssdz0
18:33:47FromDiscord<Yardanico> @iWonderAboutTuatara nim saves the json file in the nimcache folder with all the compilation commands
18:33:55FromDiscord<Yardanico> oh, this
18:34:00FromDiscord<iWonderAboutTuatara> oh I see, what do I do with it?
18:34:10FromDiscord<Yardanico> check the json file to see how it compiles stuff
18:34:18FromDiscord<iWonderAboutTuatara> and run those commands?
18:34:18FromDiscord<Yardanico> also there's a way to create nim c files automatically
18:34:19FromDiscord<Yardanico> niminst
18:34:21FromDiscord<Yardanico> not sure if it still works
18:34:26FromDiscord<iWonderAboutTuatara> niminst?
18:34:29FromDiscord<Yardanico> https://github.com/nim-lang/niminst
18:34:56FromDiscord<iWonderAboutTuatara> oh I see
18:35:12FromDiscord<iWonderAboutTuatara> I was hoping I'd be able to make a standalone c file that compiles using a regular compile command
18:35:13FromDiscord<Yardanico> https://nim-lang.org/docs/niminst.html
18:35:16FromDiscord<iWonderAboutTuatara> for submission to a contest
18:35:21FromDiscord<iWonderAboutTuatara> but that doesn't seem to be possible
18:35:37FromDiscord<Yardanico> you might be able to do it with some tools
18:35:45FromDiscord<Yardanico> but are you sure that things like that are allowed on the contest? :D
18:35:55FromDiscord<iWonderAboutTuatara> yeah
18:36:00FromDiscord<iWonderAboutTuatara> the site just doesn't accept nim files
18:36:05FromDiscord<Yardanico> yeah that's sad
18:36:12FromDiscord<iWonderAboutTuatara> it's unfortunate
18:36:21FromDiscord<iWonderAboutTuatara> there's beena proposal on codeforces to support nim for a while not
18:36:27FromDiscord<iWonderAboutTuatara> but they haven't and probably won't be implmeneting it
18:36:29FromDiscord<Yardanico> yes
18:36:55FromDiscord<haxscramper> too much power
18:37:23FromDiscord<Yardanico> I think there are tools like that
18:37:48FromDiscord<Yardanico> even sqlite does amalgamation (to combine all of sqlite in a single file)
18:38:18FromDiscord<Yardanico> it would be useful for some things I guess, I know contest sites that don't accept nim too
18:47:21*a_chou quit (Ping timeout: 264 seconds)
18:47:47FromDiscord<mratsim> "cat .c" 😛
18:47:57FromDiscord<mratsim> just remove the include for nimbase.h
18:48:30FromDiscord<mratsim> The pakku package manager for archlinux has some kind of trick to package pakku as C files as well
18:56:26FromDiscord<Varriount> In reply to @mratsim "The pakku package manager": pakku?
18:56:38FromDiscord<Yardanico> yes
18:56:40FromDiscord<Yardanico> aur helper in nim
18:57:02FromDiscord<Yardanico> https://github.com/kitsunyan/pakku
18:57:56FromDiscord<Varriount> Eh, 123 stars, not bad
18:59:30FromDiscord<Yardanico> if you want to check most starred nim projects - https://github.com/search?o=desc&q=language%3Anim+stars%3A%3E5&s=stars&type=Repositories
18:59:41FromDiscord<Yardanico> second most starred nim repo is this https://media.discordapp.net/attachments/371759389889003532/811310849334575114/unknown.png
18:59:44FromDiscord<Yardanico> :)
19:00:53FromDiscord<haxscramper> How I can declare array with enum and immediately fill it with key-value pairs? Something like `const mapping: array[Enum, string] = { key: "val" } `. Actual code is here - https://play.nim-lang.org/#ix=2PEE - I know that `{ : }` is an array of different size, but IIRC there was a way to make initialization directly
19:00:58FromDiscord<haxscramper> Using brace-init syntax
19:02:08FromDiscord<Yardanico> arrays use []
19:02:58FromDiscord<Yardanico> or you want to partially init an array ?
19:03:07FromDiscord<haxscramper> Yes, partially init
19:03:21FromDiscord<Yardanico> hm, not really know if that's possible in this case
19:03:31FromDiscord<Yardanico> without doing separately for each line
19:08:10FromDiscord<iWonderAboutTuatara> is there any way to get js to work with stdin?
19:08:24FromDiscord<iWonderAboutTuatara> the site accepts js but compilation fails because it relies on stdin
19:08:46FromDiscord<carpal> se parlo italiano qualcuno mi capisce?
19:10:46ForumUpdaterBotNew thread by Jan0sc: .mjs import behaviour in node.js, see https://forum.nim-lang.org/t/7517
19:11:48FromDiscord<Yardanico> @carpal if you want italian, there's #italiano :P
19:11:55FromDiscord<carpal> hahaha
19:12:04FromDiscord<Yardanico> @iWonderAboutTuatara yes, but you need to wrap a bit of nodejs stuff
19:12:18FromDiscord<carpal> I was only trying to see if there were italian people
19:12:20FromDiscord<Yardanico> and I wouldn't recommend using the JS backend because then you'll be at loss w.r.t to performance
19:12:42FromDiscord<Yardanico> in this case
19:14:31*a_chou joined #nim
19:15:22FromDiscord<hamidb80> In reply to @Yardanico "if you want to": the Q & A section hurts me https://media.discordapp.net/attachments/371759389889003532/811314797324140604/unknown.png
19:15:31FromDiscord<Yardanico> that's the point :D
19:24:54FromDiscord<Varriount> In reply to @iWonderAboutTuatara "the site accepts js": What part is relying on stdin?
19:30:11FromDiscord<iWonderAboutTuatara> the judge uses stdin
19:30:16FromDiscord<iWonderAboutTuatara> and I'm reading from stdin etc
19:30:26FromDiscord<Varriount> In reply to @Yardanico "second most starred nim": I am not ashamed to say it, that is too much power for me.
19:30:43FromDiscord<iWonderAboutTuatara> In reply to @Yardanico "<@!284835054633353226> yes, but you": how do I do this?
19:30:49FromDiscord<iWonderAboutTuatara> performance isn't too important for me yet
19:31:03FromDiscord<Yardanico> I did it in the past, you can just use importjs + jsffi + emit (to emit JS code directly)
19:31:12FromDiscord<iWonderAboutTuatara> oh I see
19:31:14FromDiscord<iWonderAboutTuatara> that works?
19:32:17FromDiscord<Yardanico> well why wouldn't it?
19:32:26FromDiscord<Yardanico> when compiling to JS you can interface with any JS code
19:32:32FromDiscord<Yardanico> or, at the worst case, emit JS code directly
19:32:34FromDiscord<Yardanico> (edit) "at" => "in"
19:33:13FromDiscord<Yardanico> btw, for those who haven't seen it - my lightweight read-only static html frontend for the nim forum - https://forum.my-toolbox.xyz/
19:33:23FromDiscord<Yardanico> might be useful in some cases I guess
19:33:40FromDiscord<Yardanico> it's something like nitter but for nim forum :P
19:38:03PrestigeNice
19:38:12FromDiscord<Yardanico> source code is in https://github.com/Yardanico/kuforum/ (it's really simple, I just copied the types from the nim forum and do the same thing nim forum does client-side)
19:43:15*abm quit (Ping timeout: 246 seconds)
20:14:37FromDiscord<enimatek> so i bought one of those M1 macbooks but doing a `brew install nim` doesnt work also building it from source (through brew) doesnt work, is this still in the works, i noticed that there is an issue on the github about building the source on M1, which is possible, but i'd like to use brew as a base
20:15:46*letto quit (Quit: Konversation terminated!)
20:16:12FromDiscord<Yardanico> it should work on latest devel
20:16:22FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/16211
20:16:27*letto joined #nim
20:16:36FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/811330207810060288/unknown.png
20:16:37FromDiscord<Yardanico> try this
20:17:09FromDiscord<enimatek> yes, but through brew is not supported yet? thought maybe this was also possible
20:17:48FromDiscord<Yardanico> well, isn't brew for stable versions?
20:18:00FromDiscord<Yardanico> anyway, you might want to contact brew maintainers about that
20:19:46FromDiscord<enimatek> you can run it with --HEAD and it checks out the git repo and tries to build it from source
20:20:35FromDiscord<Yardanico> but you need csources_v1 and not the original csources
20:21:18FromDiscord<enimatek> hm `==> Cloning https://github.com/nim-lang/csources.git`
20:21:26FromDiscord<Yardanico> csources is not csources_v1
20:21:43FromDiscord<enimatek> ok so it wont work
20:21:56FromDiscord<Yardanico> you can just change csources to csources_v1 in the brew build script and it should work
20:24:25FromDiscord<enimatek> ok i will look into pr's for homebrew
20:24:44*haxscramper quit (Remote host closed the connection)
20:27:42*letto quit (Quit: Konversation terminated!)
20:28:18*letto joined #nim
21:07:13FromDiscord<VVX7> anyone have a similar issue to this? https://github.com/byt3bl33d3r/OffensiveNim/issues/16
21:08:03FromDiscord<VVX7> trying to debug why it's failing. I think it's killing the thread when the inline asm executes, but not really sure how to deal with that correctly
21:15:31FromGitter<deech> Do I understand correctly from this guide that writing a C++ binding with the C++ backend forced anyone using to also use the C++ backend? https://status-im.github.io/nim-style-guide/05_libraries.html#wrappers
21:17:12FromDiscord<Yardanico> Yes, if you need to interface with C++ libraries it's much much much easier to just use the C++ backend
21:17:19FromDiscord<Yardanico> there _are_ ways to interface with C++ from C, but they're not pretty
21:17:41FromDiscord<Yardanico> Check https://github.com/cimgui/cimgui for example (a C interface for ImGui which is C++)
21:18:08FromGitter<deech> Yes I've found that myself but my question is if I publish it is everyone who uses it forced to also use the C++ backend?
21:18:43FromDiscord<Yardanico> yes
21:18:51FromDiscord<Yardanico> because otherwise it just won't compile for them
21:19:09FromGitter<deech> Hmm, that's not ideal, I was hoping Nim had a backend independant ABI.
21:19:20FromGitter<deech> At least for non-JS targets.
21:19:42FromDiscord<Yardanico> Nim doesn't have it's own full-blown ABI really
21:34:32*quadrassel4321 quit (Quit: Leaving)
21:44:24krux02@deech: It has nothing to do with ABI. When you wrap (or explain) a c++ library to nim, the generated code needs to include the c++ header files as well, therefore compile with a compiler that understands it.
21:44:50*lritter quit (Quit: Leaving)
21:45:33krux02Some c++ libraries have a header that is C compatible, therefore the library compiles with c++, but the header works on C and C++.
21:45:40krux02Pretty neat isn't it?
21:46:00krux02ok, that is an exageration
21:55:09FromGitter<deech> krux02, by C compatible header to do you mean all the C++ functions are `extern`ed?
22:00:12*PMunch quit (Quit: leaving)
22:01:29FromDiscord<ache of head> !eval 10.3.floor.int.mod 2
22:01:32NimBotCompile failed: /usercode/in.nim(1, 5) Error: undeclared field: 'floor' for type system.float64 [declared in /playground/nim/lib/system.nim(28, 3)]
22:01:38FromDiscord<ache of head> ooooh
22:01:53krux02@deech pretty much, yes
22:02:34krux02can be done through a top level "extern C {"
22:06:32FromDiscord<Solitude> !eval import math; 0.3.floor.int.mod 2
22:06:34NimBotCompile failed: /usercode/in.nim(1, 27) Error: expression 'mod(int(floor(0.3)), 2)' is of type 'int' and has to be used (or discarded)
22:15:51FromDiscord<ache of head> oh nice
22:31:13ForumUpdaterBotNew thread by Geekrelief: Composing templates / macros?, see https://forum.nim-lang.org/t/7518
22:44:34FromDiscord<no name fits> I'm not sure where this sort of question fits, but how do you guys schedule the stuff you need to learn, and how do you deal with feeling like you're learning too slowly or afraid you're wasting your time?
22:54:00*natrys quit (Ping timeout: 246 seconds)
22:54:27*natrys joined #nim
22:56:00*tane quit (Quit: Leaving)
23:04:56*a_chou quit (Ping timeout: 240 seconds)
23:13:10FromDiscord<Hi02Hi> wdym by learning too slowly?↵if you are tired, get rest↵if you arent understanding, thats fine, ask questions↵the way i learn is by making little snippets of code, bc using newfound knowledge makes it stick
23:14:27FromDiscord<Hi02Hi> even if its 25 lines of code, i can get plenty of bugs, and that makes me learn more than the docs could say
23:14:57FromDiscord<Hi02Hi> also, nice pfp
23:15:39saemWhen it comes to learning I'd recommend spaced repetition and forced recall (a very particular form of practice). Personally I found the online course "learning how to learn" really useful.
23:32:37FromDiscord<no name fits> https://www.coursera.org/learn/learning-how-to-learn this thing?
23:32:47FromDiscord<no name fits> In reply to @Hi02Hi "also, nice pfp": ty
23:40:40*jess quit (Quit: brb)
23:41:41*jess joined #nim
23:45:27*natrys quit (Ping timeout: 246 seconds)
23:53:14*abm joined #nim