<< 10-11-2020 >>

00:00:38*opal joined #nim
00:05:23*leorize quit (Ping timeout: 240 seconds)
00:11:49*leorize joined #nim
00:20:29*opal quit (Remote host closed the connection)
00:21:36*opal joined #nim
00:52:48ForumUpdaterBotNew thread by Spip: Capturing a context variable in public procs, see https://forum.nim-lang.org/t/7063
00:54:28lainis there a compile-time walkFiles()?
01:03:49*Cthalupa quit (Ping timeout: 264 seconds)
01:06:11*Cthalupa joined #nim
01:21:13*Tanger joined #nim
01:33:23*a_b_m quit (Read error: Connection reset by peer)
01:44:43FromDiscord<nikki> `walkDir` already works in compile time IIRC
01:46:31FromDiscord<nikki> it seems like `importc` doesn't apply cleanly to `tuple` types does it? i had eg. `type Foo {.importc: "CType", header: "blah.h".} = tuple ...` with some fields
01:46:39FromDiscord<nikki> but it seemed to just codegen a new type instead of just referencing the C one
01:46:51FromDiscord<nikki> when i changed it to `object` it worked correctly but then i couldn't use tuple initializers or destructure it
01:47:20FromDiscord<nikki> by adding a `converter` from tuples i was able to initialize it from tuples, but adding a `converter` to tuples doesn't make destructuring work automatically (still have to add `.toTuple`)
01:48:28lainah sorry I forgot to provide context: walkDir does work at compile time, but this is a cross-compile for os:any (baremetal). as far as I can tell, I can't "import os" because import doesn't work in a static block, and it won't work at top level because of os:any
01:49:19lainI'm trying to augment the build a bit, I have some C files I need to {.compile.}, but which ones I use depends on the target arch. maybe there's a better way to do what I want, without resorting to makefiles?
01:53:36FromDiscord<nikki> personally; i have a CMake setup that does the whole build, and just includes the nim-generated C code as part of it, but that may not be idiomatic
01:53:55FromDiscord<nikki> just gives me control and lets me build other deps i add in a way i've been familiar with tho
01:54:34FromDiscord<nikki> so i use the nim compiler with `--compileOnly` and give a `--nimcache:` that's under the 'build/' directory (then make CMake pick up source files from there)
01:55:01miprihttps://github.com/dom96/untar/blob/master/src/untar/gzip.nim - random example of os-specific compile directives
01:56:40lainnikki: thanks; and yeah, adding in make, cmake, meson, or etc is what I'm trying to avoid just for the sake of simplicity
01:57:00lainmipri: unfortunately that uses the os module, which it seems I can't use because this is a baremetal build
01:57:10lainI wonder if nimscript is the right answer here, I haven't really played with that
01:57:13FromDiscord<nikki> yeah makes sense. for me it was only sensible bc. i actually already had a CMake setup for the project that i was planning to try to reimpl in nim
01:57:24lainah that makes sense
01:58:39FromDiscord<nikki> i wonder if you can look into the OS module and see what the magic pragmas it has are that make eg. `walkDir` work / be picked up by the nim VM -- but maybe that only works in the os module
01:59:47*lain takes a peek :3
02:00:19*tefter joined #nim
02:09:24lainthe build errors if I import os because of: https://github.com/nim-lang/Nim/blob/v1.4.0/lib/pure/os.nim#L76
02:10:35lainwhich makes sense, except that I only want to use the os stuff at compile time, hrm..
02:14:52mipritry -d:weirdTarget
02:17:02miprinah, that actually specifically excludes walkDirs
02:17:28mipriand looking around, there's just a lot of os required. I suggest going with something like nikki's solution instead
02:18:46*brainproxy quit (Ping timeout: 246 seconds)
02:19:31FromDiscord<nikki> yeah maybe you can just copy walkDirs into your module as a private thing and use that
02:19:40FromDiscord<nikki> along with the magic pragmas that make it work
02:21:15*apahl quit (Ping timeout: 272 seconds)
02:22:52*apahl joined #nim
02:23:57*brainproxy joined #nim
02:30:17*brainproxy quit (Ping timeout: 260 seconds)
02:37:34FromDiscord<nikki> it seems like `=sink` on an `Option[T]` doesn't call `=destroy` on the element inside ๐Ÿค”
02:37:42FromDiscord<nikki> will try to repro in a minimal case
02:40:38FromDiscord<nikki> yea it totally doesn't ๐Ÿ˜ฎ gonna use a `ref T` for now
02:57:03*leorize quit (Ping timeout: 240 seconds)
03:00:33*leorize joined #nim
03:00:55*brainproxy joined #nim
03:05:57*muffindrake quit (Ping timeout: 260 seconds)
03:08:02*muffindrake joined #nim
03:08:52FromDiscord<Avatarfighter> What's the best way to overwrite specific areas of data in a StringStream?
03:11:18FromDiscord<ElegantBeef> `setPosition` `write`
03:13:25*mmohammadi9812 quit (Ping timeout: 264 seconds)
03:13:58*mmohammadi9812 joined #nim
03:36:01*tefter quit (Quit: WeeChat 2.9)
03:38:43*leorize quit (Ping timeout: 240 seconds)
03:42:11*leorize joined #nim
04:03:02*muffindrake quit (Ping timeout: 264 seconds)
04:03:23*leorize quit (Ping timeout: 240 seconds)
04:05:18*muffindrake joined #nim
04:06:02*supakeen quit (Quit: WeeChat 2.9)
04:06:18*a_chou joined #nim
04:06:35*supakeen joined #nim
04:08:24*bacterio quit (Ping timeout: 272 seconds)
04:10:58*leorize joined #nim
04:32:23*leorize quit (Ping timeout: 240 seconds)
04:39:22FromGitter<bung87> https://dropfiles.org/pZkvAW5k when developing nimlsp, found nimsuggest randomly work with two files ,dont know why , others work well.
04:48:59*leorize joined #nim
04:54:37FromDiscord<Joe-23> Hi I wanted to ask that since Nim uses referencing counting, wouldn't Nim be slightly slower than C, C++ and Rust?
04:54:59disruptekit doesn't have to be.
04:55:24disruptekie. you don't need to use reference counting. it's optional.
04:55:38FromDiscord<Joe-23> @disruptek I see
04:55:46FromDiscord<Joe-23> By default it is enabled, right?
04:55:49disruptekwhat is your application? i'd be absolutely shocked if it mattered at all.
04:56:06disruptekthe default gc is refc currently, yes.
04:56:07FromDiscord<Joe-23> I haven't made an application I am just curious to know
04:56:17FromDiscord<nikki> you get reference counts when you use 'managed' things like `ref T` or closures or strings or seqs
04:56:17FromDiscord<Joe-23> Ah I see
04:56:26FromDiscord<Joe-23> I see
04:56:28FromDiscord<nikki> but you can also just use views or ptrs and not have refcounts there
04:56:37FromDiscord<nikki> and also in many cases refcount changes are elided due to inferring moves
04:56:45disruptek--gc:none, --gc:arc, --gc:orc, --gc:refc, --gc:boehm, --gc:go, --gc:regions
04:56:54disruptekthere are many ways to skin that cat.
04:57:05FromDiscord<Joe-23> THanks guys
04:57:30FromDiscord<nikki> yeah also you can just use refcounts for only parts of your application, by deciding to use `ref` where you want those semantics
04:57:44disruptekoh, forgot --gc:markandsweep ๐Ÿ˜
04:57:59FromDiscord<nikki> some of those are being deprecated / decommissioned right?
04:58:07FromDiscord<Joe-23> @nikki Right
04:58:46disrupteki don't want to see any of them deprecated, except maybe go.
04:58:51FromDiscord<nikki> the main thing is; you can create move-only types and get basically similar overhead as the move-only types in rust / c++
04:59:03FromDiscord<nikki> by just defining `=copy` to `{.error.}`
04:59:42FromDiscord<Joe-23> @nikki Is this using reference counting, right?
04:59:56FromDiscord<nikki> the stuff you can do with `ref` is just inexpressible or harder to express elsewhere -- `std::shared_ptr` or `Rc` are just not as ergonomic as nim's understanding built into the compiler
05:00:35FromDiscord<nikki> reference counting overhead is mainly during copies, which if you prevent, then there is no overhead
05:00:59FromDiscord<nikki> i guess there's still the one decrement + check that happens close to the dealloc but that's minor price over the dealloc itself
05:01:09disruptekof course.
05:03:40FromDiscord<Joe-23> I see
05:06:45*brainproxy quit (Ping timeout: 240 seconds)
05:11:25*kinkinkijkin joined #nim
05:27:05*mwbrown quit (Ping timeout: 240 seconds)
05:27:12*waleee-cl quit (Quit: Connection closed for inactivity)
05:30:27disruptekmaybe runnableExamples: in an unexported proc should be a warning.
05:31:44*mwbrown joined #nim
05:45:45*Cthalupa quit (Ping timeout: 265 seconds)
05:48:24*Cthalupa joined #nim
05:48:34FromDiscord<Rika> Why so?
05:49:07disruptekbecause otherwise, they won't show up in docs.
05:49:24disruptekbut, you're right. fuck those kids.
05:49:29disruptekthey shoulda known better.
05:50:26disruptekzedeus: do me a favor some time and contribute a socket test for frosty?
05:53:43*solitudesf joined #nim
06:07:28*brainproxy joined #nim
06:08:01*tsujp quit (Ping timeout: 264 seconds)
06:10:47*tsujp joined #nim
06:13:48*a_chou quit (Quit: a_chou)
06:15:06disruptekhintDeclaredLoc seems to've broken the 1.4 branch.
06:21:33Zevvgo to bed
06:21:46disruptekmornin' zevv.
06:21:51FromDiscord<Rika> zzz
06:22:24*brainproxy quit (Ping timeout: 256 seconds)
06:22:35disrupteki just saw my first ๐ŸŸข on an IC run.
06:23:12FromDiscord<Rika> oh wow thats great congrats
06:23:14*andinus quit (Remote host closed the connection)
06:23:48*andinus joined #nim
06:24:04disruptekit just means it loaded a module from cache. no complete builds yet.
06:25:23FromDiscord<Rika> ah, well its a step in the right direction, which module was it able to load?
06:25:41disruptekjust `since`, which does almost nothing. ๐Ÿคฃ
06:26:31disruptekthis has been so easy compared to the backend work, though.
06:26:48disruptekmakes me want to write a new backend.
06:30:21FromDiscord<Rika> as a maybe-not-so-good nim programmer do you think i'd be able to understand the compiler code...
06:30:41disruptekof course.
06:30:44disruptekit's only nim.
06:32:02disruptekas with most codebases, the older the code, the less sense it makes.
06:32:23*leorize quit (Ping timeout: 240 seconds)
06:34:28*leorize joined #nim
06:35:51FromDiscord<ElegantBeef> I've looked at VM code for like an hour or two , so i'm something of an expert myself
06:36:25*mmohammadi9812 quit (Ping timeout: 240 seconds)
06:37:23*mmohammadi9812 joined #nim
06:44:35*habamax joined #nim
06:56:04*brainproxy joined #nim
06:56:41*natrys joined #nim
07:00:22*brainproxy quit (Ping timeout: 256 seconds)
07:01:55*narimiran joined #nim
07:02:36*bung quit (Read error: Connection reset by peer)
07:02:52*bung joined #nim
07:03:36*oculux joined #nim
07:03:38*oculuxe quit (Ping timeout: 260 seconds)
07:07:31*Cthalupa quit (Ping timeout: 246 seconds)
07:09:21*Cthalupa joined #nim
07:16:08*tiorock joined #nim
07:16:08*rockcavera is now known as Guest42622
07:16:08*Guest42622 quit (Killed (tepper.freenode.net (Nickname regained by services)))
07:16:08*tiorock is now known as rockcavera
07:18:13FromDiscord<Joe-23> Is there artificial intelligence tools available for Nim?
07:18:13*tiorock joined #nim
07:18:21FromDiscord<Joe-23> I know Python is very good with aritificial intellience
07:18:27FromDiscord<Joe-23> is this the same case with Nim?
07:21:24*rockcavera quit (Ping timeout: 256 seconds)
07:24:22*quadrassel4321 joined #nim
07:25:21FromDiscord<ElegantBeef> What're you looking for?
07:25:26FromDiscord<ElegantBeef> We've got if statements ๐Ÿ˜›
07:26:03FromDiscord<ElegantBeef> https://github.com/nim-lang/needed-libraries/issues/77
07:26:03disbotโžฅ [Meta] Are we scientists yet?
07:26:08*quadrassel4321 quit (Client Quit)
07:29:26*brainproxy joined #nim
07:33:19FromGitter<eagledot> Has anybody used arraymancer (https://github.com/mratsim/Arraymancer) with cuda support on windows?
07:36:48FromDiscord<ElegantBeef> I assume so, but I havent
07:40:51FromGitter<eagledot> Just wanted to understand if i need ``nvcc compiler and headers`` stuff to make arraymancer work on windows as pointed in corresponding configuration file. Can't i just get away by using compiled DLLs?
07:48:38*brainproxy quit (Ping timeout: 264 seconds)
07:53:40FromDiscord<ElegantBeef> Well, i hope someone who knows comes by and answers you question ๐Ÿ˜„
07:57:52FromDiscord<Joe-23> @ElegantBeef Lol
07:58:02FromDiscord<Joe-23> @ElegantBeef Let me see
07:58:07FromDiscord<Joe-23> @ElegantBeef Image processing mate
07:58:07FromDiscord<Joe-23> ๐Ÿ˜„
08:08:32*xet7 joined #nim
08:11:07FromDiscord<Recruit_main707> Cuda compilation may be broken because some flags passed by default being incompatible
08:11:28FromDiscord<Recruit_main707> There was an issue with that, I donโ€™t remember if it was exactly that
08:16:19*brainproxy joined #nim
08:20:25FromGitter<eagledot> i guess arraymancer is using nimcuda (https://github.com/unicredit/nimcuda) for cuda operations, but in nimcuda flags are being passed as this (https://github.com/unicredit/nimcuda/blob/babb607989eeed30279b9eb1159f6fdeb0f59ade/nimcuda/cudnn.nim#L4) , rather than i am used to using a DLL with ``dynlib`` pragma.
08:20:40*brainproxy quit (Ping timeout: 246 seconds)
08:22:08FromGitter<eagledot> Also i called a function to get version for cudnn from precompiled ``cudnn64_7.dll`` on windows,it worked.
08:27:25bungwhat's wrong here when nimsuggset run ideDef command it write to stderr with two procname and filename,returns empty seq ? https://pastebin.com/69Rb656Z
08:29:35bungalso I noticed nimsugget.nim runCmd asign conf.writelnHook twice
08:53:37*brainproxy joined #nim
08:55:33FromDiscord<Joe-23> Just curious does Nim have smart pointers that are also present in C++?
08:57:31FromDiscord<lqdev> https://github.com/nim-lang/fusion/blob/master/src/fusion/smartptrs.nim
08:58:17FromDiscord<Joe-23> THanks
09:00:05*inamiyar[m] quit (Quit: Idle for 30+ days)
09:08:47FromDiscord<nikki> also `ref`s are like shared ptr but with refcount non atomic (which is fine since heaps are meant to be thread-local)
09:23:06FromDiscord<Joe-23> @nikki I see
09:24:56*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:26:43*ehmry joined #nim
09:28:29*brainproxy quit (Ping timeout: 256 seconds)
09:59:28*brainproxy joined #nim
10:04:25*brainproxy quit (Ping timeout: 264 seconds)
10:04:25ForumUpdaterBotNew question by Michal Marลก&#225;lek: How to get a stream of a ndjson response, see https://stackoverflow.com/questions/64766727/how-to-get-a-stream-of-a-ndjson-response
10:07:27*PMunch joined #nim
10:11:27*brainproxy joined #nim
10:20:23*leorize quit (Ping timeout: 240 seconds)
10:22:48*leorize joined #nim
10:24:45*nikki93 quit (Read error: Connection reset by peer)
10:24:59*rayman22201 quit (Read error: Connection reset by peer)
10:25:11*zielmicha__ quit (Read error: Connection reset by peer)
10:25:57*nikki93 joined #nim
10:26:32*zielmicha__ joined #nim
10:26:51*brainproxy quit (Ping timeout: 256 seconds)
10:27:01*l1x quit (Ping timeout: 272 seconds)
10:27:12*rayman22201 joined #nim
10:28:03*l1x joined #nim
10:30:43*leorize quit (Ping timeout: 240 seconds)
10:31:10*Kaivo quit (Ping timeout: 256 seconds)
10:33:45*Kaivo joined #nim
10:34:13*mmohammadi9812 quit (Ping timeout: 256 seconds)
10:43:58*mmohammadi9812 joined #nim
10:44:00*mmohammadi9812 quit (Read error: Connection reset by peer)
10:45:28*mmohammadi9812 joined #nim
11:02:02*brainproxy joined #nim
11:07:28*brainproxy quit (Ping timeout: 260 seconds)
11:10:25*leorize joined #nim
11:18:55*beatmox quit (Remote host closed the connection)
11:28:25*beatmox joined #nim
11:31:23*leorize quit (Ping timeout: 240 seconds)
11:33:43*leorize joined #nim
11:42:43*xigoi[m] joined #nim
11:42:44*brainproxy joined #nim
11:45:12*Leaf73 joined #nim
11:46:39Leaf73hi, I want to use the python 'print' function with nimpy, is it possible?
11:49:22Leaf73and btw on top of this chat Latest version: 1.2.0 - https://nim-lang.org/install.html, it is 1.4
11:52:32PMunchYes you can use print: http://ix.io/2DDZ
11:52:33*tiorock is now known as rockcavera
11:52:33*rockcavera quit (Changing host)
11:52:33*rockcavera joined #nim
11:54:09Leaf73thx, but without f or fmt?
11:54:23narimiranLeaf73: use nim's strformat
11:54:43Leaf73ok
11:55:09PMunchAh f or fmt is probably their own procedures, or some Python magic stuff (no idea how they implement stuff over there)
11:55:17PMunchThose will be harder to import probably
11:55:59Leaf73I want to use the python print to print big numbers, like fibonacci
11:56:35narimiraninb4 Zevv says that fibonacci has some small numbers like 1, 2, etc.
11:56:42FromDiscord<Rika> python f strings are different and unrelated to python print
11:57:15PMunchUhm, Nims echo can print large numbers
11:57:19Leaf73in nim I can only print fib 92
11:57:20PMunchOr am I missing something here?
11:57:38narimiranPMunch: you're missing python's unlimited ints :)
11:57:49PMunchOooh
11:57:57Leaf73in Python I can print easyly fib 10_000_000
11:57:57PMunchThat large numbers
11:58:34Leaf73with c++ and boost and gmp too
11:58:49PMunchWhat you probably want is https://github.com/status-im/nim-stint
11:58:51FromDiscord<Scarecrow> how do I turn int into string in nim? In python its just str(int)
11:58:57narimiran$int
11:58:59FromDiscord<Scarecrow> (edit) "str(int)" => "`str(int)`"
11:59:00PMunchIn nim it's $
11:59:21PMunch!eval echo typeof(100); echo typeof($100)
11:59:21narimiranand if you're echo'ing it, you don't even need $
11:59:23NimBotintโ†ตstring
11:59:35Leaf73PMunch thx
11:59:42PMunchLeaf73, no problem
11:59:54PMunchWhy are you printing such massive numbers anyways?
12:00:02FromDiscord<Scarecrow> Im trying to do equal of python's `str(int)[-1]`
12:00:11narimiran$int[^1]
12:00:13Leaf73only for testing, performance....
12:00:18FromDiscord<Scarecrow> thank
12:00:36narimiranLeaf73: oh, "benchmarking" time.... :P :D
12:00:37PMunchRight
12:00:41PMunchHaha :P
12:00:54Leaf73I need with c++ boost gmp and fib 1_000_000_000 about 2 mins
12:00:56FromDiscord<Scarecrow> will $ convert any type of variable into string?
12:01:01narimiranyep
12:01:14PMunch*any type that has `$` declared for it
12:01:21PMunch(but you can declare your own)
12:01:27narimiranbtw, how about `int mod 10` for your last decimal? ;)
12:02:42Leaf73no idea ...
12:02:47PMunchHmm is $123_456[^1] slower than $(123_456 mod 10)?
12:03:04narimiranPMunch: he might not need $ in the second case
12:03:10PMunchLeaf73, I think that was for Scarecrow
12:03:11narimiran*they
12:03:24Leaf73ok
12:03:42PMunchOh sure, I was just wondering what, if anything, the difference would be
12:03:53PMunchOf course if he needed a character then it might be worse
12:04:31PMunchAlthough I guess chr(ord(0)+(num mod 10)) could be faster still
12:06:02*supakeen quit (Quit: WeeChat 2.9)
12:06:34*supakeen joined #nim
12:07:51PMunchHmm, I notice stint is dual license MIT and Apache, what are the key differences there?
12:10:55Leaf73is there an example to use and print with stint... I'm looking now in test...
12:11:25PMunchIsn't it just to print the number?
12:12:14PMunchOr echo rather
12:12:58PMunch!eval import stint; echo 20182018.stint(64)
12:13:02NimBot20182018
12:14:17PMunchLeaf73 ^
12:14:22Leaf73jup works
12:15:49Leaf73is not working import stint; echo 2018201811111111112333333333333333333333333333333333333333333.stint(256)
12:15:50*brainproxy quit (Ping timeout: 258 seconds)
12:17:33Leaf73but this works echo i256("2018201811111111112333333333333333333333333333333333333333333")
12:19:13FromDiscord<Scarecrow> how do I python's `int % anotherint` in nim?
12:19:18FromDiscord<Rika> int mod anotherint
12:21:39FromDiscord<Scarecrow> ty
12:22:51*brainproxy joined #nim
12:23:03*leorize quit (Ping timeout: 240 seconds)
12:23:58PMunchDidn't we have a Python -> Nim document somewhere?
12:23:58*leorize joined #nim
12:24:28FromDiscord<flywind> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers
12:25:03PMunchLeaf73, yeah that's because when you have it as a number literal the Nim compiler will try to pass it as an int to the stint function which obviously doesn't work
12:25:57FromGitter<ynfle> Someone shared a benchmarking binary for nim code that also benchmarks compiling it recently. Does remember the name? It could be it was made disruptek
12:26:12narimirancriterion, maybe?
12:26:29FromDiscord<flywind> !repo golden
12:26:30disbothttps://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim ๐Ÿ† 15 23โญ 0๐Ÿด
12:26:49narimiranor that :)
12:27:42FromGitter<ynfle> Thanks @flywind. That was it
12:27:54FromDiscord<flywind> no problem
12:30:30Zevvnarimiran: fibonawhat has what?
12:30:48narimiranZevv: my poor attempt at joke. just ignore it
12:31:22ZevvI can't
12:31:27Zevvyou will have to explain it to me now
12:31:38narimiranok, here goes..... :P
12:31:58Zevvlike, where do *I* come in here
12:32:30Leaf73let txt = py.str("test1 = {num:.2f}")discard py.print(txt.format(num = 2018201811111111112333333333333333333333333333333333333333333.234))
12:32:31narimiranyou're the regular jokester around here....
12:32:37Leaf73test1 = 2018201811111111086739850115462643767812788014436128206618624.00 is thee result
12:33:07Zevvno no you're confusing me with whatstheirname
12:34:31Leaf73PMunch: with small numbers it works with I think python str format
12:34:54Leaf73txt.format(num = ...
12:35:05PMunchSeems to pass it in as a float and then loose precision from that for some reason
12:35:30Leaf73is txt a py string? ....
12:35:33PMunchOh yeah, you have .234 so obviously it's afloat :P
12:35:45PMunchtxt should be a Python string yes
12:36:20Leaf73so python big numbers not working
12:36:44PMunchWell you're passing it a float, not a bignum
12:36:54Leaf73?
12:37:33PMunch2018201811111111112333333333333333333333333333333333333333333.234 is a double precision float
12:37:58PMunchAnd it double precision floats doesn't have enough precision to store that number, closest they can get is apparently 2018201811111111086739850115462643767812788014436128206618624.00
12:38:06Leaf73oh, I typed the same into python interpreter, same result
12:38:12PMunchYeat
12:38:14PMunchYeah*
12:38:22PMunchIt's a hardware limitation of floating point numbers
12:38:28*brainproxy quit (Ping timeout: 260 seconds)
12:38:46PMunchhttps://docs.python.org/3/tutorial/floatingpoint.html
12:39:03Leaf73if I remove the float to int I get an error
12:39:14Leaf73Error: number out of range:
12:39:46narimiranhow about benchmark fibonacci on some smaller numbers? :P
12:39:56PMunchYeah, because 2018201811111111112333333333333333333333333333333333333333333 is too big to be an int64 (highest that Nim natively supports)
12:40:03*MyMind joined #nim
12:40:07narimiranand then use some other/better benchmark for something else?
12:40:34PMunchIf you do: improt stint, nimpy; let txt = py.str("test1 = {num}"); discard py.print(txt.format(num = i256"2018201811111111112333333333333333333333333333333333333333333"))
12:40:37PMunchThen it should work
12:41:10PMunchOh wait, txt.format might not be able to handle a stint..
12:41:23PMunchWhy do you want to use Pythons print/formatting anyways?
12:41:25*Sembei quit (Ping timeout: 240 seconds)
12:41:39PMunchOr rather, what are you actually trying to benchmark?
12:41:45Leaf73hmmm, forgotten....
12:43:03*leorize quit (Ping timeout: 240 seconds)
12:43:05Leaf73def fib2(n): v1, v2, v3 = 1, 1, 0 # initialise a matrix [[1,1],[1,0]] for rec in bin(n)[3:]: # perform fast exponentiation of the matrix (quickly raise it to the nth power) calc = v2 * v2 v1, v2, v3 = v1 * v1 + calc, (v1 + v3) * v2, calc + v3 * v3 if rec == '1': v1, v2, v3 = v1 + v2, v1, v2 return v2 # Very, very fast!# n = 1,000,000
12:43:05Leaf73needs in Sublime Text v3.2.2 0.8s (208988 chars)# n = 10,000,000 needs about 3.0s (not printed, only stored in variable)
12:43:45Leaf73https://play.nim-lang.org/#ix=2DEc
12:43:52Leaf73better to read
12:44:06Leaf73want this into nim...
12:44:41*leorize joined #nim
12:45:13Leaf73if someone says Python is slow, try it....
12:47:05*brainproxy joined #nim
12:47:36FromGitter<ynfle> @Leaf73, you're probably looking for this proc https://nim-lang.org/docs/strutils.html#toBin%2CBiggestInt%2CPositive
12:47:49PMunchNot really
12:48:07PMunchThe number he's trying to print is 86781 bytes long..
12:48:23PMunchAnd not the string, the actual numeral
12:48:25FromGitter<ynfle> Why not? That's what `bin()` does in Python
12:48:33Leaf73yup and the best trick is v1, v2, v3 = v1 * v1 + calc, (v1 + v3) * v2, calc + v3 * v3
12:49:09Leaf73<ynfle>: the result is to big
12:49:37PMunchGive me a sec
12:49:45Leaf73the python assignment is tricky....
12:50:02*xigoi[m] left #nim ("User left")
12:50:10Leaf73this too, v1, v2, v3 = v1 + v2, v1, v2
12:50:45*xet7 quit (Quit: Leaving)
12:50:46FromGitter<ynfle> You can wrap both sides in parentheses and it works
12:52:35Leaf73?
12:52:38*brainproxy quit (Ping timeout: 258 seconds)
12:52:44ForumUpdaterBotNew thread by Mrhdias: How to prevent a program from crashing when the "OSError: Too many open files" error occurs?, see https://forum.nim-lang.org/t/7064
12:53:34FromGitter<ynfle> (v1, v2, v3) = (v1 + v2, v1, v2)
12:56:10*Vladar joined #nim
12:56:25PMunch@ynfle, that's not the problem
12:56:44PMunchThe problem is that he's dealing with incredibly large numbers, way too big to fit in an int
12:57:04Zevvput them in a float as if you just don't care!
12:57:21PMunchThey're a bit too big for that as well
12:57:55Leaf73n = 1,000,000 needs in Sublime Text v3.2.2 0.8s (208988 chars as int)
12:58:08Leaf73208988 chars as int
12:58:16Leaf73biiiiiggg iiinnnnt...
12:58:40Leaf73:]
12:59:32Leaf73not really an int, a special conversion to a string
13:01:54Leaf73https://stackoverflow.com/questions/33733511/c-print-first-million-fibonacci-numbers
13:02:33Leaf73https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
13:02:43*leorize quit (Ping timeout: 240 seconds)
13:04:12*brainproxy joined #nim
13:04:34*leorize joined #nim
13:06:04FromGitter<ynfle> Have you try a big int implementation library from nimble?
13:08:52Leaf73stint
13:09:22Leaf73and I tryed c++ and pybind11 and my python code.... it works
13:09:41Leaf73pybind11 embed the python interpreter
13:10:03FromGitter<bung87> PMunch do you have idea speed up initNimsuggest? I feel slow.
13:10:17PMunchYeah, don't recurse your entire filesystem..
13:10:25*brainproxy quit (Ping timeout: 264 seconds)
13:11:45FromGitter<bung87> it will find first nimble close to that file
13:12:10FromGitter<bung87> I dont think that cause slow
13:13:43*leorize quit (Ping timeout: 240 seconds)
13:14:26FromGitter<bung87> and I only recurse when file relative to workspace folders
13:14:42*leorize joined #nim
13:17:37FromGitter<ynfle> @Leaf73 โŽ โŽ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5faa92f18d286f20769ef18f]
13:19:14FromGitter<bung87> https://github.com/bung87/nimlsp/commits/myver I go further now.
13:19:28Leaf73<ynfle> great:] (y)
13:19:41Leaf73:]
13:20:08Leaf73what is bignum? I have installed, see it first time
13:20:21FromGitter<ynfle> It's a bigint library
13:20:30FromGitter<ynfle> Nim doesn't have one in the standard libe
13:20:58FromGitter<ynfle> https://github.com/nim-lang/Nim/issues/14696
13:20:59disbotโžฅ Add bigints to standard library
13:20:59Leaf73wow 1_000_000 works eaasy too
13:21:19FromGitter<ynfle> Considerably faster than python
13:22:39Leaf73there is an error I think try fib 5
13:22:50Leaf73I get 233
13:23:33Leaf73but I get big numbers for benchmarks.... =D
13:23:43*leorize quit (Ping timeout: 240 seconds)
13:24:33*leorize joined #nim
13:25:15Leaf73the slicing? for rec in bin(n)[3:]:
13:27:22FromGitter<ynfle> You don't need to slice because toBin doesn't have the 0b prefix
13:27:31Leaf73fib2(13) = 233
13:27:51PMunch@bung87, and what are your workspace folders? Did you compile nimlsp with -d:release? Other than that I'm not quite sure why it would be slow, I guess you'll have to profile it to find out
13:29:06Leaf73you must slice 0b1
13:29:18PMunchTried to make a version with stint, but it's horribly slow for some reason: http://ix.io/2DEi
13:29:43Leaf73print(bin(n)[3:]) and bin(n) you will see it
13:31:02PMunchYeah changing his code to this works: http://ix.io/2DEj
13:31:06PMunchAnd it's crazy fast
13:32:42FromGitter<ynfle> @Leaf74, just remove the +1 from the for loop
13:32:44FromGitter<bung87> hmm let me try release mode
13:32:51ForumUpdaterBotNew thread by Allin: GuildenStern 0.9: Modular multithreading web server for Linux, see https://forum.nim-lang.org/t/7065
13:33:02Leaf73yup looks very good
13:33:08PMunchOr that I guess :P
13:33:37FromGitter<ynfle> The slice I think would be slower
13:34:51Leaf73yup works too, last digits by 1_000_000 must be ... 546875 ....
13:35:42Leaf73echo fib2 10_000_000 about a second
13:36:16FromGitter<ynfle> If you remove the print statement it will be considerably faster
13:36:26FromGitter<ynfle> Also compile with `-d:relesea`
13:36:30FromGitter<ynfle> *release
13:36:31Leaf73echo fib2 100_000_000 about 15 seconds, wsl 2 has to work hard
13:36:57Leaf73I have -d:release
13:37:15FromGitter<ynfle> Change `echo` to `discard`
13:37:20Leaf73echo remove?
13:37:27Leaf73ok
13:37:49Leaf73a second
13:37:50FromGitter<ynfle> 1_000_000_000 โŽ โŽ ```real 0m26.560s โŽ user 0m21.600s โŽ sys 0m1.114s``` [https://gitter.im/nim-lang/Nim?at=5faa97ae8d286f20769efe4b]
13:38:02PMunchHmm, tried to do the same mask thing as I did in my stint thing in your bignum version
13:38:17PMunchAnd it's considerably slower..
13:39:14PMunchI mean I can kinda see why, but it still irks me :P
13:39:27Leaf73real 0m1,175suser 0m1,383ssys 0m0,263s
13:39:35Leaf73discard fib2 100_000_000
13:40:01*brainproxy joined #nim
13:44:52Leaf73real 0m1,008suser 0m0,988ssys 0m0,020s
13:44:54Leaf73discard fib2 100_000_000
13:45:04*brainproxy quit (Ping timeout: 240 seconds)
13:45:09PMunchOh wait, I was doing it wrong, it's about the same speed
13:47:03PMunchBut damn, bignum is fast!
13:47:08Leaf73Error: type mismatch: got <int64>but expected one of:func fib2(n: int): Int
13:47:10Leaf73discard fib2 10_000_000_000
13:47:20Leaf73func fib2(n: int64): Int =
13:48:27PMunchWait, are you on a 32 bit machine?
13:48:34Leaf73no
13:49:01PMunchThen int should be 64-bit
13:49:05Leaf73real 2m29,988suser 2m24,975ssys 0m4,530s
13:49:09PMunchint is always the same size as a pointer
13:49:12Leaf73discard fib2 10_000_000_000
13:49:27Leaf73yeah, that's fast
13:49:38Leaf73real 2m29,988suser 2m24,975ssys 0m4,530s
13:50:05Leaf73never tryed the number with python....
13:50:15PMunchTry it :P
13:50:44PMunchMy guess is that they won't be particularly different here, Python probably also wraps bignum in its implementation
13:50:45FromGitter<ynfle> You can give us the answer tomorrow
13:51:00Leaf73ok I started
13:51:17Leaf73via sublime text without print
13:51:30FromGitter<ynfle> You can also try `pypy`
13:52:27narimiranPMunch: `for rec in n.toBin(floor(log2(n.float) + 1).int)[1..^1]:` -- why not separate this in two lines:
13:52:39narimiran`let nBin = n.toBin(floor(log2(n.float) + 1).int)[1..^1]` and `for rec in nBin:`
13:52:51PMunchThat wasn't my code :P
13:52:59narimiranaha
13:53:00PMunchI used a bitmask instead
13:53:06FromGitter<ynfle> โœ‹
13:53:24narimiran(oh, now i re-tried it, and it seems my improved version was just a noise.... eh)
13:53:37Leaf73<ynfle> for pypy I must read the docs, new for me
13:53:42narimiranfirst time i tried it, it was 44 vs 30
13:53:48PMunchThat's what I did: http://ix.io/2DEr
13:54:11PMunchYeah the performance will be the same
13:54:28PMunchI mean all of that is overshadowed by what is going on inside that loop
13:55:14narimiranPMunch: nice speed improvement with your version!!
13:55:21PMunchReally?
13:55:32PMunchFor me it runs about the same as with the string thing
13:55:46narimirani'm comparing http://ix.io/2DEj and http://ix.io/2DEr
13:56:03narimiran(with the same number, of course)
13:56:23narimiranand for n = 1_000_000, it is ~10x faster
13:56:25PMunchYeah that's the same as I was comparing
13:56:29PMunchReally?
13:56:35narimiranreally
13:57:01narimiranhere goes, with `-d:danger`, three runs of each:
13:57:09Leaf73I must wait, I'll test it after python fib
13:57:14PMunchHmm, for 1_000_000 I get "0.00s" :P
13:57:33PMunchI have the Python version running with 10_000_000_000
13:57:34Leaf73that's very faaast
13:57:42PMunchSpoiler alert, it's not as fast as the Nim version :P
13:57:54FromDiscord<Rika> im surprised.
13:57:56FromDiscord<Rika> very.
13:58:00narimiran37, 43, 47 millis, vs 10, 11, 10
13:58:06PMunchHuh
13:58:13narimiran(i got 4 and 5 before)
13:59:10narimiranaaaaah, `echo`
13:59:18PMunchHaha
13:59:19narimiranwithout it, they're approximately the same speed
13:59:22PMunchYeah I was about to say
13:59:33narimiransorry for the confusion :)
13:59:44PMunchYou had me confused there for a second :P
13:59:59narimiranthat's a lot of time, relatively speaking!
14:01:42PMunchI should optimise my confusion
14:01:50narimiranrewrite it in rust!!
14:01:55PMunchBut I fear that confusion with -d:danger is a bad idea..
14:02:02narimirannow for even more confusion in less time!
14:02:46PMunchHmm, I think I should convert stacklang to use bignum
14:03:57Leaf73python fib is still running so I stop the program
14:05:27PMunchI'll let my run and see how long it takes :P
14:08:10Leaf73real 2m38,143suser 2m33,097ssys 0m4,368s
14:08:19Leaf73with the second version
14:08:32Leaf73http://ix.io/2DEr
14:08:56Leaf73is slower
14:10:20Leaf73someone must get the last digits to compare if the result is correct ... :]
14:11:19PMunchAnd compare it against what?
14:11:44*oculuxe joined #nim
14:12:30Leaf73hmmmmm.....
14:13:21*brainproxy joined #nim
14:13:30Leaf73and this is fast too https://play.nim-lang.org/#ix=2DEv
14:13:33*oculux quit (Ping timeout: 260 seconds)
14:13:42Leaf73but must converted to nim
14:14:05FromGitter<ynfle> Not very readable imo. That's why I like nim
14:15:37Leaf73I started the first one again: real 2m39,156suser 2m33,374ssys 0m5,312s
14:15:48*kinkinkijkin quit (Ping timeout: 244 seconds)
14:16:05*kinkinkijkin joined #nim
14:16:18FromGitter<ynfle> @Leaf73, try Arraymancer
14:16:22Leaf73but compiled with `danger` and not with `release
14:16:24FromGitter<ynfle> !repo arraymancer
14:16:25disbothttps://github.com/mratsim/Arraymancer -- 9Arraymancer: 11A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends 15 738โญ 62๐Ÿด 7& 6 more...
14:17:21Leaf73I have tryed the first steps ....
14:18:09Leaf73again the first solution: real 2m36,409suser 2m31,666ssys 0m4,304s
14:18:32FromGitter<ynfle> Python or Nim?
14:18:36Leaf73nim
14:18:49FromGitter<ynfle> Which number?
14:18:51Leaf73discard fib2 10_000_000_000
14:20:50Leaf73Pisano period is faster, but I don't know enough to work with it
14:20:58*kinkinkijkin quit (Ping timeout: 244 seconds)
14:20:59Leaf73https://en.wikipedia.org/wiki/Pisano_period
14:24:03Leaf73https://codeforces.com/blog/entry/14516
14:25:45*shadowninja55 joined #nim
14:26:11*kinkinkijkin joined #nim
14:26:13shadowninja55hello
14:26:23PMunchwb shadowninja55
14:26:27shadowninja55ty
14:26:35shadowninja55im getting an oserror while trying to connect to a proxy on windows
14:26:39shadowninja55any ideas why this is?
14:26:48shadowninja55it's when i go to make a request with an httpclient i initialized with a proxy
14:27:09PMunchHmm, does the OSError say anything?
14:27:40shadowninja55"No connection could be made because the target machine actively refused it."
14:28:24*Leaf73 quit (Ping timeout: 245 seconds)
14:28:24shadowninja55it has happened with multiple proxies i've tested
14:28:27*Leaf50 joined #nim
14:28:54PMunchHmm, does the proxies require some kind of authentication?
14:29:06PMunch(I've never used proxies with httpclient)
14:29:38shadowninja55i dont think so let me check
14:30:58ForumUpdaterBotNew thread by Gcao: Catch Ctrl-C interruption, see https://forum.nim-lang.org/t/7066
14:31:03shadowninja55ah i just checked them and it seems many just don't work lol
14:31:10shadowninja55im just scraping them from an open api so i guess that's to be expected
14:31:16Leaf50PMunch and <ynfle>: thx for all, must go (find new faster fib code :] ), bye
14:31:37PMunchBye
14:31:41*Leaf50 quit (Remote host closed the connection)
14:36:21shadowninja55hmm maybe i should get some actual proxies lmaoo
14:43:28*abm joined #nim
14:55:23PMunchHmm, why does this echo the AutoClose message twice? https://github.com/nim-lang/Nim/issues/13289#issuecomment-724383241
14:55:26disbotโžฅ Closure iterators can leak resources and there is no easy way to prevent it ; snippet at 12https://play.nim-lang.org/#ix=2DEJ
15:25:55*vicfred joined #nim
15:30:32*Vladar quit (Remote host closed the connection)
15:30:46*waleee-cl joined #nim
15:32:27*shadowninja55 quit (Quit: Connection closed)
15:32:48*Vladar joined #nim
15:36:27ZevvYeah that one is funny PMunch
15:39:02disruptekhilarious.
15:39:31Zevvhttp://ix.io/2DF5
15:55:17*habamax quit (Ping timeout: 260 seconds)
16:04:08*xet7 joined #nim
16:05:37*xet7 quit (Read error: Connection reset by peer)
16:07:23*xet7 joined #nim
16:10:26*Cthalupa quit (Ping timeout: 258 seconds)
16:12:13*Cthalupa joined #nim
16:12:41*xet7 quit (Remote host closed the connection)
16:21:30FromDiscord<Clyybber> because it doesn't check if the file is already closed
16:21:39*xet7 joined #nim
16:22:11Zevvno check the ix
16:22:17Zevvit's never opened, never instantiated
16:22:19Zevvbut still it's there
16:22:21Zevvit's like
16:22:23Zevv*magic*
16:22:45Zevvthe iterator is never called!
16:26:00*xet7 quit (Client Quit)
16:30:23*leorize quit (Ping timeout: 240 seconds)
16:32:12disruptekshould it be?
16:33:03*leorize joined #nim
16:33:40disruptekclyybber: where are we on cps?
16:37:36*xet7 joined #nim
16:37:57disruptekZevv: dude, this tuner thing. it works great.
16:38:07disruptekwhat isn't working for you?
16:42:49*habamax joined #nim
16:47:39*xet7 quit (Quit: Leaving)
16:55:20*Vladar quit (Quit: Leaving)
16:58:02*xet7 joined #nim
16:59:40*hnOsmium0001 joined #nim
17:15:26*tane joined #nim
17:19:29*natrys quit (Quit: natrys)
17:22:03*leorize quit (Ping timeout: 240 seconds)
17:23:25*leorize joined #nim
17:30:21PMunchZevv, huh that is super weird
17:31:10Zevvdisruptek: unsubscribing
17:31:16ZevvPMunch: cool stuff eh
17:31:43disruptekZevv: what are you doing to unsubcribe, though?
17:33:06Zevvmy subscription to nimph
17:33:24disruptekwhat's the command you are typing, chucklehead?
17:34:52ZevvI don't know. It's months since I typed that
17:35:08disruptekjust !detune disruptek nimph
17:35:52Zevvit's not helpful. Whenver I privmsg it it will just show me a tiny bit of help
17:35:58Zevvwhatever I type
17:36:10*shadowninja55 joined #nim
17:36:15Zevvit just said okay
17:36:17Zevvis it really done?
17:36:20disruptekyes.
17:36:22Zevvbtw, if you privmsg, why the '!'
17:36:30shadowninja55ello
17:36:37Zevvello shadowninja55
17:36:41disruptekfucking ninjas.
17:36:47shadowninja55my httpclient seems to not be able to use any proxies
17:36:49shadowninja55i get oserror with any proxy
17:37:13shadowninja55just making sure, the format is `newProxy("ip:port", "user:password")` correct?
17:39:13ZevvI think it's http://ip:port
17:39:57shadowninja55oh shoot lemme try that
17:40:54Zevvthe docs are not really clear on this I must admit
17:40:57Zevv /really not/
17:41:19Zevvoh well, they are: https://nim-lang.github.io/Nim/httpclient.html#proxy
17:41:26Zevvjust not at the proc itself
17:41:49shadowninja55ye
17:41:54shadowninja55they're not super detailed thats why im confused
17:42:01shadowninja55but it worked with the http:// prefix thx
17:42:31Zevvcool
17:57:27ZevvI abandoned this interactive npeg graph idea
17:57:48disruptekoh yeah?
17:57:50Zevvthe stuff is so thoroughly optimized for its purpose, everything I touch makes it worse in one way or the other
17:58:02ZevvI need an AST representation of the parser that survives to run time
17:58:15disrupteki imagine it's hard to figure out where to slow it down.
17:58:17Zevvbut there is none. The only AST is nim ast, which gets compiled in to VM instructions in one pass
17:58:31Zevvand I can't lift NimNodes to run time.
17:58:34Zevvfor some reason
17:58:43Zevvwhich is silly, actually
17:59:03Zevvit's not like I want to feed it back into nim. I just want to inspect it at run time
17:59:09FromDiscord<nikki> import compiler?
17:59:14Zevvno friggin' way
17:59:26Zevvwhat's so special about a NimNode anyway
17:59:29FromDiscord<nikki> import way
17:59:31Zevvthat it can only live at compile time
17:59:39disruptekyeah, i'm facing the same problem. that's why i need to build the stupid introspection thing.
18:00:00Zevvcan't we just fix this
18:00:17disruptekit works this way for hysterical reasons.
18:04:44*krux02 joined #nim
18:06:31Zevvhm I could make a hash of each nimnode and keep that around, and ref it from user space
18:06:45Zevvtoo bad they're not natively hashable
18:07:29disruptekconst ast = frosty.freeze n
18:07:41Zevvbull
18:07:45Zevvone can not freeze a NimNode
18:07:50disruptekwhy not?
18:07:57Zevvwhat happens if I thaw it at run time?
18:08:14disruptekwhat?
18:08:44Zevvwhat happens if I thaw it at run time?
18:09:02disruptekare you worried about the blackhole information paradox?
18:09:07disruptekbecause, y'know, that shit is solved now.
18:12:26*Vladar joined #nim
18:13:03ZevvDid you ever freeze a nimnode?
18:13:14Zevvit crashes nim
18:13:17Zevvwith a SIGSEGV
18:13:42disruptekit's the quickest way i've found to free memory.
18:13:59FromGitter<ynfle> What about getting the `repr` or `treerepr`?
18:14:11Zevvthen the AST-ness is gone
18:14:30ZevvI could do listRepr and re-parse that, of course
18:14:34*mmohammadi9812 quit (Quit: Quit)
18:14:38Zevvdisruptek: http://ix.io/2DG2
18:14:41disruptekthe key to this is to encode the typedness, not merely the literals.
18:15:18*Vladar quit (Client Quit)
18:17:49disruptekZevv: is it a frosty bug?
18:18:39Zevvif X crashes the compiler with a sigsegv, is that a bug in X
18:18:43Zevvor a bug in the compiler
18:18:46ZevvI don't know man, you decide
18:19:07Zevvbut you just told me something you never tried yourself
18:19:13Zevvit might have killed me, for all you know
18:19:21disruptekwell, i'm not a masochist.
18:19:25disrupteki'm a sadist.
18:19:26ZevvI feel this is highly irresponsible of you. I do not forget lightly
18:19:48disrupteki freeze the ast in ic.
18:19:58disruptekbut it's frontend ast. ๐Ÿ˜
18:19:58Zevvone day, in many years, when you are silently farting in the corner of the room in your wheelchair. I will be there to let the air out of your left tire.
18:20:12disrupteki'm counting on it.
18:20:37Zevvfrotend AST is just normal stuff
18:20:39Zevvit's not magic
18:20:55disruptekyou mean it's not broken.
18:21:10Zevvis it?
18:21:19disrupteknot by design, no.
18:21:32Zevvso, what is the proposed alternative these days?
18:21:59Zevvhm still I don't have an unique ID for my nimnodes.
18:22:09Zevvthey don't have an address, they are not hashable.
18:22:12Zevvwhat else can one do?
18:22:18Zevvjust count them while traversing the tree?
18:22:24disruptekwhat do you mean, not hashable?
18:22:46FromDiscord<nikki> can you write a hash fn for them? go over each case, make composite nodes composite of child hashes
18:22:48disruptekplease make a debug build the compiler and run the same program.
18:22:53disruptek^ of
18:23:08Zevvโˆ„ hash[NimNode]()
18:23:11disrupteki would like frosty to work.
18:23:30Zevvnikki: probably, but that's work.
18:23:32FromDiscord<lqdev> zevv have you been smoking too much APL lately
18:23:46FromDiscord<nikki> Zevv but writing nim code is fun right
18:24:10disrupteki'm still confused on how zevv managed to make mathpipe faster in a nim impl than lua.
18:24:15FromDiscord<whisperdev> Will Nim work on new arm based macbooks?
18:24:17Zevvnpeg
18:24:19disruptekyes.
18:24:31Zevvit just folds like a neat origami
18:24:39disruptekhmmph.
18:24:49Zevvit's utterly natural. I'm not overdoing it with typing and overloading and all, but that's just what happens
18:24:56Zevv s/not/now/
18:24:56FromDiscord<nikki> nim works everywhere C works which is everywhere
18:25:09disrupteknim is /more/ portable than c.
18:25:31Zevvthat *is* true, I'm afraid
18:25:44FromDiscord<nikki> it even runs in the nim compiler!
18:25:47FromDiscord<nikki> where c doesn't run
18:26:11Zevvit even used to run in PHP. but they burned that with hells eternal fire.
18:26:20FromDiscord<whisperdev> How about ARC?
18:26:22disruptekthank $deity.
18:26:32disruptekarc has nothing to do with arch.
18:26:45FromDiscord<nikki> arc is just pretty pure compute code
18:26:49disruptekZevv: got your stacktrace yet?
18:26:50FromDiscord<nikki> should work errwhere too
18:26:57FromDiscord<whisperdev> ok dont kill me I am totally clueless about it
18:27:02disruptek~arc
18:27:03disbotarc: 11a new memory manager for Nim; see https://forum.nim-lang.org/t/5734 -- disruptek
18:27:03FromDiscord<whisperdev> ๐Ÿ’ฉ
18:27:43Zevvbwah I can't even fieldPairs() a nimnode
18:27:45Zevvthis is so silly
18:27:54Zevvdisruptek: Nim stacktrace?
18:28:06disruptekcompiler st for that flopper proggy.
18:28:12Zevvhttp://ix.io/2DG8
18:28:12Zevvsure
18:28:17FromDiscord<nikki> yo guys while ur here. if i have a some in an Option[T], and then i assign = none(T) to it; you'd expect it to call the destructor on the T that was in there, right?
18:28:38Zevvha good one
18:28:40FromDiscord<nikki> it doesn't rn i think but i'm checking if you'd expect that. if so i'll make a repro and post an issue
18:28:55disruptekblame clyybber.
18:29:01Zevvdoes one ever expect to get it back out after none()ing it
18:29:23FromDiscord<nikki> is that related to the destructor call
18:29:55FromDiscord<nikki> the destructor call would happen before the assignment. well really assignment would be a eqcopy or eqsink both of which should destroy the old value
18:29:56disruptekit won't necessarily free it before you leave scope.
18:30:05Zevvwell, if there would be a magic call "thing.getEvenThoughItSaysNone()", you would still need to keep it around
18:30:19Zevvso what you are proposing is probably to .reset() the thing on none()
18:30:26Zevvwhich makes perfect sense, imho
18:30:29disruptekno; it's more about the fact that the spec is undefined for when we free it.
18:30:38disruptekout of scope, it should be destroyed as expected.
18:30:41Zevvright. It now gets destructed whtn the option is thrown away
18:30:58ZevvI dare you to make a PR for this and see the fallout on that
18:31:08FromDiscord<nikki> i'd expect an option to behave like a seq of max len 1
18:31:14miprihttps://play.nim-lang.org/#ix=2DG9 <- by default, you see 3, 2, 1 destroyed in that order. with -d:trynone, you see 1 destroyed first
18:31:17Zevvright, I was just typing that
18:31:22Zevvit's like emptying your seqs
18:31:42disruptekno seqs is hard, man.
18:32:26Zevvnikki: what do other languages do?
18:33:00FromDiscord<nikki> c++ destroys old value. idk abt rust. and then outside of that not many langs have deterministic destructors and also options. maybe swift?
18:33:23FromDiscord<nikki> mipri: huh i see. in some case i was testing it didn't happen
18:33:41ForumUpdaterBotNew thread by Jlindsay: Publishing a nimble package, see https://forum.nim-lang.org/t/7067
18:33:41disruptekit's not supposed to happen.
18:33:48disruptekthe behavior is undefined by design.
18:33:49FromDiscord<Clyybber> disruptek: bit short on time rn and the untyped fix needs more work
18:34:02disruptekaight.
18:34:25FromDiscord<Clyybber> @nikki hey, whats the qeustion
18:34:36disruptekZevv: frosty can be made to handle these nimnodes, i think.
18:34:49Zevvshow me
18:35:04Zevvnikki: I think it's worth an issue or PR to force a decision on this
18:35:07disruptekit might take awhile.
18:35:11Zevveither we do or we dont, but it should be made explicit
18:35:13FromDiscord<Clyybber> disruptek: at least when its finished we get untyped overloading for free
18:35:17ZevvI'll vote for you
18:35:21FromDiscord<nikki> @Clyybber the question is if you have an Option[T] that isn't none, and then you assign = none(T) to it, should it call destructor on old element
18:35:29disruptekthe decision was already made. we don't want to lock ourselves into a spec.
18:35:36FromDiscord<Clyybber> @nikki afaict yeah
18:35:46ZevvI trust Clyybber, not you
18:35:52FromDiscord<Clyybber> does it not do that?
18:35:54disruptekfair enough.
18:35:59Zevvwe can just make a spec that says "this language does whatever"
18:36:03Zevvand throw out all the tests
18:36:04disruptekbut, he's wrong. ๐Ÿ˜
18:36:08Zevvthat woudl be nice and terse
18:36:08FromDiscord<Clyybber> options are not magic
18:36:21FromDiscord<nikki> @Clyybber it didn't in some case i had but i'll go check it again
18:36:25Zevvno, but it doesn't .reset() on none()
18:36:31FromDiscord<Clyybber> the autogenerated =destroy for a type calls destroy on all it fields
18:36:53FromDiscord<nikki> right but the autogen'd eqsink on option seems to not destroy the old contained element
18:36:53Zevvyeah but none() merely sets the "this thing as a value" to false
18:37:00Zevvti does not throw out the thing it holds
18:37:14FromDiscord<Clyybber> @nikki are you sure?
18:37:19FromDiscord<Clyybber> can you give a repro
18:37:42FromDiscord<nikki> yeah i'll check again. was just clarifying that i'm not talking about the pure destruction and mainly the eqsink or eqcopy
18:37:58FromDiscord<nikki> will work on a repro
18:38:09disruptekjust look at the codegen. you'll find it destroying between asgn and close of scope.
18:38:37FromDiscord<nikki> oh to clarify i'm talking about arc here
18:38:42disruptekof course.
18:38:56FromDiscord<Clyybber> @nikki are you n5m?
18:39:20FromDiscord<nikki> ๐Ÿค”๐Ÿค” are you asking if i go by that name elsewhere
18:39:23disruptekwhat's the best state in the US for beastiality?
18:39:34FromDiscord<Clyybber> @nikki yeah on github
18:39:37ZevvVermont
18:39:43FromDiscord<nikki> nah i'm nikki93 on github haha
18:39:46FromDiscord<Clyybber> ah ok
18:39:52disruptekhole in one.
18:40:01FromDiscord<nikki> @Clyybber are you the destructor guy? other than ar4q of course
18:40:05FromDiscord<Clyybber> yeah
18:40:07FromDiscord<Clyybber> and cooldome
18:40:18disruptekeveryone makes mistakes.
18:40:19FromDiscord<nikki> i'm relying on destructors for a few things so maybe i'll ping you as i run into stuff haha
18:40:21FromDiscord<nikki> cool
18:40:28FromDiscord<Clyybber> aight
18:40:40FromDiscord<nikki> yeah will look into a repro
18:42:08FromDiscord<Clyybber> Zevv: Hmm, I guess that is a funny impl detail of closure iters
18:42:19Zevvthese are just weird
18:42:23Zevvthey always have been
18:42:53Zevvthey are a thing but they are not, until they get a name and then they exist by that name but not really
18:43:03ZevvI tried to explains someone once. I failed the Feynman test
18:43:06shadowninja55is there any way to statically compile nim in c gcc mode? my friend's getting a "could not load dll" error on his pc trying to run a program i made
18:43:07FromDiscord<krisppurg> Hello, is there any procedure that does not prepend `nonce` to `msg` in `nim-libsodium`?
18:43:47*xet7 quit (Remote host closed the connection)
18:45:08*xet7 joined #nim
18:45:42FromDiscord<nikki> do you want to statically link libc or some other dep? like what dll is the error about
18:46:05disruptekit's almost certainly due to pcre64.dll.
18:46:08FromDiscord<nikki> in any case you can add custom compiler and linker flags (there's some pragmas for that) or just compile and link the gen'd C yourself too
18:47:53Zevvyeah this pcre64. someone should something to do pattern matching in native nim
18:49:58FromDiscord<nikki> maybe if we write an x86 interpreter in native nim we can just run the compiler pcre
18:50:06FromDiscord<nikki> compiled
18:50:23Zevvdude, that's soo meta
18:50:34*Vladar joined #nim
18:57:45ForumUpdaterBotNew thread by Akito: To slice or to stream?, see https://forum.nim-lang.org/t/7068
19:01:44*Kaivo quit (Ping timeout: 256 seconds)
19:02:06FromDiscord<krisppurg> No answer?
19:02:30shadowninja55its libcrypto
19:02:57shadowninja55`(libcrypto-1_1-x64|libeay64).dll`
19:03:36shadowninja55thats the one that wont compile in
19:04:07*Kaivo joined #nim
19:05:37*NimBot joined #nim
19:08:03*rockcavera quit (Ping timeout: 256 seconds)
19:16:28FromDiscord<shashlick> shadowninja55 - see choosenim - it compiles in ssl on windows - https://github.com/dom96/choosenim/blob/master/src/choosenim.nims#L3
19:22:43*brainproxy quit (Ping timeout: 256 seconds)
19:26:24FromDiscord<alehander42> hey
19:26:28FromDiscord<alehander42> meta
19:27:23*rockcavera joined #nim
19:31:25*Prestige quit (Quit: Prestige)
19:33:36*habamax quit (Quit: leaving)
19:34:38shadowninja55oh ty
19:39:53*cgfuh joined #nim
19:42:49*Prestige joined #nim
19:52:21*brainproxy joined #nim
19:57:46*brainproxy quit (Ping timeout: 272 seconds)
20:34:08FromDiscord<nikki> @Clyybber repro for ya: https://github.com/nim-lang/Nim/issues/15910
20:34:10disbotโžฅ Assignment to `Option[T]` doesn't call destructor on existing contained value ; snippet at 12https://play.nim-lang.org/#ix=2DGW
20:36:15disruptekhmm, that's fucked up.
20:37:14*kinkinkijkin quit (Remote host closed the connection)
20:38:12disruptekit's weird how broken that is in refc.
20:39:59FromDiscord<nikki> disruptek: in what way is it broken? in refc the option case has same output as the plain case, but the seq case doesn't show destructors for second or third -- and i thought that was ok? like destructors aren't reliably called
20:40:10FromDiscord<nikki> or does refc say that destructors are at least called on exit or sth
20:40:20FromDiscord<nikki> i've mostly only familiarized myself with arc semantics so ...
20:41:07disruptekhow is that okay?
20:41:08FromDiscord<alehander42> disruptek
20:41:11FromDiscord<alehander42> i didnt vote
20:41:14FromDiscord<alehander42> i remember you asked me
20:41:15disruptekyou still can.
20:41:23FromDiscord<alehander42> did trump win EU
20:41:30FromDiscord<alehander42> we have 0 delegates ๐Ÿ˜ฆ
20:41:34FromDiscord<alehander42> typical USA
20:41:37disruptekthat's fucked up.
20:41:48FromDiscord<alehander42> you have army here
20:41:57disruptekif i define a destructor, i expect it to get called comprehensively.
20:41:59FromDiscord<alehander42> we could have 2-3 delegates
20:42:28FromDiscord<alehander42> but i plan on voting next year
20:42:37FromDiscord<alehander42> in our local elections
20:42:43disruptekthat won't help me.
20:43:22FromDiscord<alehander42> hug
20:43:23FromDiscord<alehander42> ok
20:43:43FromDiscord<alehander42> are destructors on the end of scope or function in nim
20:43:47disrupteknikki: anyway, as i said, the order is undefined by design, as is the /when/ -- as long as it's destroyed after the scope is exited, it's "correct."
20:44:04disruptekotherwise, it's broken.
20:44:07FromDiscord<krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=2DH2
20:44:14FromDiscord<nikki> in arc i think it's defined that an assignment does the eqsink which should call eqdestroy on the existing thing
20:44:17FromDiscord<nikki> at least according to the destructors article
20:44:39disruptekwhere does it say we'll destroy it immediately?
20:44:43FromDiscord<nikki> or like, does eqsink or eqcopy, but yeah
20:45:14FromDiscord<nikki> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqsink-hook
20:45:30FromDiscord<nikki> in both eqsink and eqcopy it says destroys old value, i'll admit that the language seems suggestive and not prescriptive tho
20:45:53disruptekhmm, i think this is overspecified, honestly.
20:46:00FromDiscord<alehander42> hmm, thanks
20:46:09FromDiscord<nikki> sure, but that's a separate discussion i think (and i disagree lol)
20:46:13FromDiscord<alehander42> is it supposed to be deterministic
20:46:57disruptekbut /what/ you determine can be more broad than this.
20:47:36FromDiscord<nikki> @krisppurg i think you may have to break up the messages into UDP-compatible sizes
20:47:39disruptekthe language is pretty prescriptive afaict.
20:47:45FromDiscord<nikki> a library like netty may do this for you
20:47:46disrupteklook at what expandArc says.
20:47:59FromDiscord<nikki> i'll try it
20:48:09FromDiscord<krisppurg> how would I do that though?
20:48:30FromDiscord<nikki> by allocating two chunks, writing part of the message to one, and the rest to the other? generalized to more than two too
20:48:46FromDiscord<nikki> and you'll need to identify on the other end what chunk is what. it's a whole thing. things like netty do all of that
20:49:04FromDiscord<nikki> UDP is very low level
20:49:50disruptekrude.
20:50:18FromDiscord<nikki> udp is rude? ya some times it just doesn't send the msg, definitely rude
20:50:42disruptekit's hardly low-level.
20:50:43disruptekc'mon.
20:50:52disruptekit's just mean to suggest.
20:51:04FromDiscord<nikki> ha, well, everything is lower level than something else i guess
20:51:14FromDiscord<nikki> udp is lower level than "i want to send a huge bunch of data and make sure it gets there"
20:51:28FromDiscord<nikki> in any case disruptek i think the destructor issue may come down to the codegen for case objects?
20:51:29disruptekit's just different.
20:51:53FromDiscord<nikki> well, it's lower level in that a lot of the impls of the quoted bit are written in terms of udp, but also yeah it's different too
20:52:04disruptekthe codegen for case objects is pretty tricky when it comes to arc. this wouldn't be the first bug.
20:52:27FromDiscord<nikki> the expandArc for these test fns all makes sense
20:52:30disruptektcp is a peer to udp. it doesn't encapsulate it; ergo, it is no more high-level than udp.
20:52:50disruptekexpandArc is correct?
20:53:03FromDiscord<nikki> hmm, well, the problem is that this is a partial order, to that end i agree yeah. like there's no strong order in level between tcp and udp bc. neither is encapsulating the other as you say
20:53:29disrupteknow apologize.
20:53:32FromDiscord<nikki> so without that strong link it boils down to stuff like -- does this have more application level logic or nah. tcp for example is reliable + ordered. that feels kinda higher level
20:53:41FromDiscord<nikki> i sent an apology but udp dropped it
20:53:44disrupteklol
20:53:47FromDiscord<nikki> it was a high level apology
20:54:06FromDiscord<nikki> i'll check expandArc for the =sink on the option
20:54:25FromDiscord<nikki> actually idk how to do that lol
20:54:57FromDiscord<nikki> disruptek: can you see images? if i were to post an image here
20:55:18FromDiscord<nikki> https://media.discordapp.net/attachments/371759389889003532/775825934019592242/unknown.png
20:55:29FromDiscord<nikki> you can see how eqsink for the option just ... assigns the fields of the contained obj
20:55:44FromDiscord<nikki> but doesn't actually call the eqsink on the obj. like it's going straight through to the fields
20:57:37FromDiscord<nikki> https://github.com/nim-lang/Nim/issues/15910#issuecomment-724961796 <-- non-image version
20:57:38disbotโžฅ Assignment to `Option[T]` doesn't call destructor on existing contained value ; snippet at 12https://play.nim-lang.org/#ix=2DGW
20:57:55disruptekso it's an Option bug.
20:58:12disrupteki'm fine with that.
20:58:38*narimiran quit (Ping timeout: 260 seconds)
20:59:09FromDiscord<nikki> i don't think that's clear--this code is generated by the case object logic that option uses. so it may be an issue with the codegen for that
20:59:35disruptekwell, i'm not looking at your images.
20:59:42disruptekare you looking at the code in options.nim?
20:59:57FromDiscord<nikki> the last link i pasted is not an image
21:00:01FromDiscord<nikki> and is the same code
21:00:18disruptekwhere are you located?
21:00:24FromDiscord<nikki> well, options.nim really doesn't do any specific hook stuff -- it's just a case object. the generated `=sink` is the automatically gen'd stuff for a case object
21:00:39disruptekah, then you should fix the title.
21:01:44FromDiscord<nikki> hmm good point. i'm not sure i guess if it's options or case objects lol, but at least it's definitely a problem with options (whether it should be fixed by fixing options code or case object code)
21:01:53FromDiscord<nikki> i'll amend the title tho
21:05:17disruptekhttps://github.com/nim-lang/Nim/issues/13102
21:05:18disbotโžฅ double free bug with arc, Result type, object refs, and iterators ; snippet at 12https://play.nim-lang.org/#ix=27kh
21:06:00disruptek#13149
21:06:01disbothttps://github.com/nim-lang/Nim/issues/13149 -- 5Destructors: case objects have issues ; snippet at 12https://play.nim-lang.org/#ix=27qe
21:07:59FromDiscord<nikki> nice looking at these
21:08:23disruptekprobably not super relevant, but it gives some backstory.
21:08:24FromDiscord<nikki> i might've jumped on the destructors train too early lol but it's fun
21:08:46disruptekit's not early. the train needs more passengers.
21:08:49FromDiscord<nikki> the lesson so far is to just use dumb objects and refs only and maybe seqs, but not case objects yet
21:08:54FromDiscord<nikki> cool, count me in
21:09:02disruptekwut no that's bullshit.
21:09:19disruptekbut do use refs only for inheritance.
21:09:37FromDiscord<nikki> oh i mean for code where i need it to work reliably. yeah my stuff right now doesn't use refs much except when i want the refcount
21:09:50disruptekright.
21:10:07FromDiscord<nikki> i just meant like, maybe ref as a workaround for optionT for now where i use nil / non-nil
21:10:16FromDiscord<nikki> i found that that calls the destructors reliably
21:10:29disruptekyes, but options should be fixed. as should variant objs.
21:10:30FromDiscord<nikki> obv that causes heap alloc / counts but ... /shrug
21:10:50disruptekvariants are kinda central to nim-1.
21:11:15FromDiscord<nikki> i don't disagree with that. i just want to use the thiing that works right now for the thing i'm working on right now
21:11:23disruptekweird.
21:11:27FromDiscord<nikki> but ya case objs are pretty important and should work
21:12:39*lritter joined #nim
21:13:27*brainproxy joined #nim
21:13:54FromDiscord<nikki> quick q tho -- since arc for refs is implemented through the destruct, sink and copy hooks -- does this mean that arc refs contained in case objs / options could leak
21:14:18disruptekif you don't destroy them in your hooks, yes.
21:14:36FromDiscord<nikki> oh i meant like; since option / case doesn't destroy them in the hooks (as seen in the issue)
21:14:44disruptekthat's a bug.
21:14:50disruptekthat's /the/ bug.
21:15:09FromDiscord<nikki> yes. i meant does this bug cause arc refs to leak
21:15:14disruptekyes.
21:15:27disruptekwell, actually, i'm not sure about that.
21:15:42FromDiscord<nikki> ya, the q was to get another opinion on how sure to be
21:15:50FromDiscord<nikki> i wasn't actually asking if it was intended behavior for arc refs in options to leak
21:15:54disruptekrun -d:useMalloc and --gc:arc under valgrind to see.
21:15:59FromDiscord<nikki> yeah about to try
21:16:19FromDiscord<nikki> what's a good way to make a definitely heapalloced ref. make a string and then `.add(...)` to it?
21:16:38FromDiscord<nikki> guess i could just use a ref obj with a big array
21:16:40disruptekwhat would the add do?
21:16:52disruptekany runtime string/seq is a ref.
21:16:58FromDiscord<nikki> the add makes sure to cause a heapalloc
21:17:01FromDiscord<nikki> the add makes it runtime yeah
21:17:07FromDiscord<nikki> cuz if i just used a stringliteral it doesn't
21:17:34disruptekthat's... surprising.
21:17:43disruptekyou're telling me we lift to const?
21:18:15FromDiscord<nikki> yeah if you just made an obj and then stored a string froma stringliteral in it, no heapalloc
21:18:30disruptekah, but that's different from just a rando string.
21:18:31FromDiscord<nikki> and the free on refcount decrease checks if it was a literal, doesn't free if so
21:18:41disruptekyeah. try not to cheat so hard.
21:18:41FromDiscord<nikki> yah, so the add is to make it rando
21:18:56FromDiscord<nikki> add is for uncheatin
21:19:00disruptekokay.
21:19:02FromDiscord<nikki> i'm going with a ref object with an array in it tho
21:19:15disruptekwhatever peels your banana.
21:20:07*brainproxy quit (Ping timeout: 246 seconds)
21:20:13FromDiscord<nikki> lol doesn't leak. crazy
21:20:32FromDiscord<nikki> ah taht's right cuz it calls eqsink on the ref inside
21:21:35FromDiscord<nikki> cool yeah no leak ๐Ÿ‘
21:21:49disruptekthat's why it wasn't discovered sooner.
21:21:59disruptekbut it's still wrong.
21:22:15FromDiscord<nikki> yeah i figured if refs inside cases leaked that would be a major early bug
21:23:20disruptekthis is a good find, though. nice work.
21:23:57*hpyc9 quit (Remote host closed the connection)
21:23:58*blackbeard420 quit (Remote host closed the connection)
21:25:09FromDiscord<nikki> omg i'm dumb, options do not use case objects at all. silly me
21:25:31FromDiscord<William_CTO> Is there a way to make mutexes compatible with async functions in Nim?
21:25:34disruptektime to update the title yet again.
21:25:43disruptekwilliam: that doesn't make any sense.
21:26:01disruptekasync is not multi-threaded.
21:26:09FromDiscord<William_CTO> right
21:26:23*leorize quit (Ping timeout: 240 seconds)
21:26:46disruptekdidn't we talk about this not long ago?
21:27:16FromDiscord<William_CTO> I have a count variable that needs to be read (and later written to) in an async function, but I'm running into race conditions when the async function gets called over and over quickly
21:27:34disruptekhow is that possible?
21:27:46FromDiscord<William_CTO> How is what possible?
21:27:56disruptekhow can you have a race condition in a single thread?
21:29:07FromDiscord<ElegantBeef> Very carefully
21:30:10FromDiscord<William_CTO> This is a discord bot, so when multiple messages are sent at the same time or extremely close together the count variable will have a value of 4 for the first and will still have a value of 4 for the second because the first hasn't finished parsing the message and updating the count variable
21:30:12*blackbeard420 joined #nim
21:30:36disruptekso use waitfor in your parsing.
21:31:05disruptekyour "mutex" can be a bool or whatever you want.
21:31:51FromDiscord<William_CTO> thank you, I'll try that out
21:32:11disruptekdon't be afraid to tell people that tell you you cannot use waitfor that they are stupid.
21:32:22disruptektell them disruptek said it was okay.
21:32:31FromDiscord<William_CTO> noted
21:33:26FromDiscord<nikki> disruptek: i got it down to this: https://gist.github.com/nikki93/e46e1fd637ac97818de719e67e973bf7
21:33:45disruptekmy eyes
21:33:49FromDiscord<nikki> after noting that option doesnt' use case objects at all and is just a normal object containing an object
21:34:17disruptekjust remove everything that works correctly and use an assertion that fails in the event that it's broken.
21:34:26disruptekno one cares about working code.
21:34:33disruptek!repo dust
21:34:34disbothttps://github.com/disruptek/dust -- 9dust: 11DUST is Unattended Syntax Truncation 15 5โญ 0๐Ÿด 7& 1 more...
21:34:42disruptekmaybe you can fix dust for devel while you're at it.
21:35:35*mbomba joined #nim
21:36:25disruptekthis doesn't make sense.
21:36:51disruptekyou're telling me that we don't destroy elem field in the generated destructor for Contained?
21:37:09*PMunch quit (Quit: leaving)
21:37:58disruptekare we generating a different destructor for it?
21:38:35disruptekoh it's eqsink is isn't calling it, right?
21:39:40FromDiscord<nikki> yeah i believe so ๐Ÿค”
21:39:56FromDiscord<nikki> and yeah i'll go the assertion route for next ones
21:40:05disruptekfeels like it's intentional but i don't understand why it wouldn't use the same codepath.
21:40:17ForumUpdaterBotNew thread by Peter: Type problem with 1.4.0, see https://forum.nim-lang.org/t/7070
21:41:13FromDiscord<nikki> lemme see what happens when i define eqsink to propagate
21:41:37FromDiscord<nikki> what's a good way to do asserts here? it's about hooks so -- accumulate to some global / other outside var and then make sure it's the right value?
21:41:43disruptekyes.
21:42:00*hpyc9 joined #nim
21:42:14FromDiscord<ElegantBeef> Also nikki as i wanted to lessen the code and burden to implement more features i did abandon the big ol' copy pasta
21:42:52FromDiscord<ElegantBeef> Currently trying to recursively generate setter procs for all of their settings
21:49:45FromGitter<iffy> Is the method https://nim-lang.org/docs/streams.html#StreamObj uses for providing a common interface for various implementations (with the object holding the impl procs) smiled upon? Frowned upon?
21:50:01FromDiscord<ElegantBeef> It's one of the suggested impls
21:50:03disrupteki think it sucks.
21:50:13FromGitter<iffy> hehe
21:50:59*brainproxy joined #nim
21:53:13FromDiscord<lqdev> disruptek me too
21:53:44FromGitter<iffy> For those that frown on it, what would you rather do? concepts?
21:53:48disruptekyes.
21:54:00disruptekeven if they are broken, they are at least idiomatic.
21:54:04*lritter quit (Ping timeout: 246 seconds)
21:57:19*brainproxy quit (Ping timeout: 260 seconds)
22:05:00FromDiscord<ElegantBeef> Is there a way to write a file during compiletime?
22:05:16FromDiscord<ElegantBeef> I know we have static read, but i dont see a write equivlent
22:05:32FromDiscord<nikki> i thiiiiiink you could staticExec sth that writes files
22:05:38disruptekstatic: writeFile
22:05:43FromDiscord<nikki> that too
22:08:59*mbomba quit (Ping timeout: 260 seconds)
22:11:01*mbomba joined #nim
22:11:40*mbomba quit (Client Quit)
22:13:05*solitudesf quit (Ping timeout: 240 seconds)
22:15:46FromDiscord<Recruit_main707> there should be a mkDir proc for compile time, change my mind
22:15:51*leorize joined #nim
22:16:02disruptekthere should be a getCurrentDir proc first.
22:18:15*gangstacat quit (Ping timeout: 272 seconds)
22:24:35disruptekomg i'm such an idiot.
22:27:42*gangstacat joined #nim
22:28:23FromGitter<deech> What does it mean for an `enum` to have a non-integer value? https://github.com/nim-lang/Nim/blob/devel/tests/metatype/ttypetraits.nim#L322
22:28:48FromDiscord<ElegantBeef> It means it has an ordinal and a string representation
22:29:15FromDiscord<Recruit_main707> disruptek: why
22:32:00FromGitter<deech> ElegantBeef: interesting, is the string repr just for display purposes?
22:32:10disruptekit's for $ purposes.
22:32:45disruptekrecruit: i thought since the weather was getting cooler maybe i could fit into a large.
22:32:59disrupteknope; it's still magnums for me.
22:44:02*Vladar quit (Quit: Leaving)
22:46:15disruptekkinda amazing how much maintenance the docs require. not the strings, but the actual mechanics of the thing.
22:46:26disrupteki would have abandoned them for something 3rd party long ago.
22:46:32disruptekwho needs this shit?
22:49:52*tane quit (Quit: Leaving)
22:54:21*Jesin quit (Quit: Leaving)
22:54:29ForumUpdaterBotNew thread by DataPulverizer: Kernel Matrix Calculation in Nim, see https://forum.nim-lang.org/t/7071
22:57:19shadowninja55how can you write a uint32 to a stream?
22:57:23shadowninja55similar to the way you can read it
22:57:28disruptekindeed.
22:57:40shadowninja55preferably without manually converting it to a char using a memory copy or something
22:57:42shadowninja55*char array
23:03:32FromDiscord<shadow.> i mean you can convert it using bit shifting rather than a memory copy
23:03:45disruptekyou're blowin' my mind right now.
23:03:55shadowninja55i guess i was just wondering if there's a builtin
23:04:00disrupteka what?
23:04:09FromDiscord<shadow.> yeah no i don't think there is
23:04:21shadowninja55like a proc using file to write uint32
23:04:40shadowninja55like there stream.readUint32()
23:04:47shadowninja55so i was wondering if theres stream.writeUint32()
23:04:50shadowninja55but not that i can see
23:05:10disruptekyou just write(stream, foo.uint32)
23:05:19disruptekthe manual will help.
23:05:27disruptekor see how i do it here:
23:05:30disruptek!repo frosty
23:05:31disbothttps://github.com/disruptek/frosty -- 9frosty: 11serialize native Nim types to strings, streams, or sockets โ›„ 15 16โญ 0๐Ÿด
23:05:44shadowninja55does it write big or little endian
23:05:49disruptekwho cares?
23:05:57shadowninja55lmao fair enough
23:06:04shadowninja55OH RIGHT
23:06:06shadowninja55i see now
23:06:15shadowninja55theres no reason to specify type because you're passing it anyways lmaoo
23:06:19shadowninja55alright thanks
23:06:22disrupteksure.
23:06:24shadowninja55so just the generic write proc works?
23:06:26shadowninja55alr ye
23:14:05*krux02 quit (Remote host closed the connection)
23:15:14*brainproxy joined #nim
23:20:09*brainproxy quit (Ping timeout: 260 seconds)
23:27:01shadowninja55how can i write a uint32 using 24 bits of space?
23:27:12shadowninja55like a number that will fit in 3 bytes but that is stored in my code as a uint32
23:28:03*leorize quit (Ping timeout: 240 seconds)
23:30:27*leorize joined #nim
23:33:27shadowninja55im going to assume casting it into an array of 3 uint8's is not the way to go lol
23:36:23*leorize quit (Ping timeout: 240 seconds)
23:37:03FromDiscord<ElegantBeef> `write((a or 0xff).byte)` `write(((a shr 8) or 0xff).byte)` and guess the last ๐Ÿ˜„
23:37:09FromDiscord<ElegantBeef> Atleast... that's one way
23:37:32FromDiscord<ElegantBeef> Idk why you'd want to do it really, since that means you have to know that the next value is onyl 3 bytes instead of the typical 4
23:38:04FromDiscord<ElegantBeef> so you store a bool in the byte before of the size, and then if it's 3 bytes you save 0 memory, only if it's 2 or 1 you save memory
23:38:18shadowninja55well
23:38:21FromDiscord<ElegantBeef> (edit) "bool" => "byte"
23:38:24shadowninja55im writing uint32 (colors) into a bitmap file
23:38:35shadowninja55so i have to write it in RRGGBB format which is yk 3 bytes
23:38:49*brainproxy joined #nim
23:38:51FromDiscord<ElegantBeef> Well that makes more sense ๐Ÿ˜„
23:39:15FromDiscord<ElegantBeef> also i messed up it's `and` not `or`
23:39:16shadowninja55hmm
23:39:23shadowninja55wouldnt .byte convert it to one byte instead of 3
23:39:33FromDiscord<ElegantBeef> that's the point
23:39:50shadowninja55so how would i write the uint32 with 3 bytes?
23:39:50*Jesin joined #nim
23:39:52shadowninja55(24 bits)
23:40:07FromDiscord<ElegantBeef> Doing what i suggested for each byte, i only did the first two
23:40:21shadowninja55ahh ok so then i can just bit shift out the bb gg rr values lol?
23:40:27FromDiscord<ElegantBeef> Yea
23:40:31shadowninja55smart thanks
23:40:53FromDiscord<ElegantBeef> Alternatively you could make an `int24` and have a converter from 32 -> 24
23:41:03shadowninja55i doubt im smart enough for that lmaoo
23:41:45FromDiscord<ElegantBeef> The quick way is a `array[3, byte]`
23:42:06shadowninja55so that would work?
23:42:20shadowninja55`cast[array[3, uint8]](pixel)`
23:42:23shadowninja55oh wait byte not uint8
23:42:29FromDiscord<ElegantBeef> well same thinng
23:42:30FromDiscord<ElegantBeef> (edit) "thinng" => "thing"
23:42:33shadowninja55lol ye
23:42:36FromDiscord<ElegantBeef> byte is just aliased uint8
23:42:40shadowninja55oh fair
23:42:53FromDiscord<ElegantBeef> I dont know if the casting would work
23:43:11shadowninja55ill try it lol
23:45:49shadowninja55hmm well the resulting bitmap is corrupt but that could be a number of things
23:47:38FromDiscord<ElegantBeef> You can always do something like this silliness ๐Ÿ˜› https://play.nim-lang.org/#ix=2DIf
23:47:54FromDiscord<ElegantBeef> Most of my solutions should be ignored
23:49:39shadowninja55lmaooo
23:49:51shadowninja55would you mind if i dm you on discord to send you code and further explain what im tryna do?
23:50:16FromDiscord<ElegantBeef> I personally prefer helping in public as i'm clearly not all knowing
23:50:18*kinkinkijkin joined #nim
23:50:22shadowninja55lol fair enough
23:51:27shadowninja55ah i have a good idea
23:51:37shadowninja55ill just compare it to the same bitmap in a hex editor and see whats wrong
23:51:51shadowninja55FML
23:52:05shadowninja55literally everything is working i just wrote "bm" as the file signature instead of "BM"
23:52:10shadowninja55LMAOOO
23:52:42shadowninja55ok it worked tyvm
23:53:42FromDiscord<ElegantBeef> Lol grats
23:54:02shadowninja55ty
23:54:02*leorize joined #nim
23:54:10shadowninja55has there been a bitmap reading library made before?
23:54:14shadowninja55if not i could post it lool
23:56:28FromDiscord<ElegantBeef> I have no clue what formats these support https://nimble.directory/search?query=image
23:56:57shadowninja55lmao fair enough
23:57:11FromDiscord<ElegantBeef> Although it could be the first purenim implementation
23:57:17shadowninja55ive been using period my whole life for type literals should i be using apostrophe lmao
23:57:20FromDiscord<ElegantBeef> But no clue with that
23:57:35FromDiscord<Rika> period for what
23:57:39FromDiscord<ElegantBeef> you can do `10u8`
23:57:46shadowninja55like 0.uint8 vs 0'uint8
23:57:46FromDiscord<ElegantBeef> you dont nee `'` or `.uint8`
23:57:48shadowninja55WHAT
23:57:52shadowninja55fml
23:57:58FromDiscord<Rika> 0u8 will work
23:58:07shadowninja55does that work with binary like 0xffffff
23:58:09shadowninja55*hex
23:58:13FromDiscord<Rika> almost looks like an owo face
23:58:19FromDiscord<ElegantBeef> no you need the `'` for hex i believe
23:58:27shadowninja55ah ok
23:58:27FromDiscord<Rika> for hex only if ambiguou
23:58:28FromDiscord<Rika> s
23:58:45FromDiscord<ElegantBeef> Ah i was wrong depends on the type
23:58:54FromDiscord<ElegantBeef> So i tend to just stick with `'`
23:59:20shadowninja55fair enough