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:48 | ForumUpdaterBot | New thread by Spip: Capturing a context variable in public procs, see https://forum.nim-lang.org/t/7063 |
00:54:28 | lain | is 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:43 | FromDiscord | <nikki> `walkDir` already works in compile time IIRC |
01:46:31 | FromDiscord | <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:39 | FromDiscord | <nikki> but it seemed to just codegen a new type instead of just referencing the C one |
01:46:51 | FromDiscord | <nikki> when i changed it to `object` it worked correctly but then i couldn't use tuple initializers or destructure it |
01:47:20 | FromDiscord | <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:28 | lain | ah 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:19 | lain | I'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:36 | FromDiscord | <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:55 | FromDiscord | <nikki> just gives me control and lets me build other deps i add in a way i've been familiar with tho |
01:54:34 | FromDiscord | <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:01 | mipri | https://github.com/dom96/untar/blob/master/src/untar/gzip.nim - random example of os-specific compile directives |
01:56:40 | lain | nikki: 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:00 | lain | mipri: unfortunately that uses the os module, which it seems I can't use because this is a baremetal build |
01:57:10 | lain | I wonder if nimscript is the right answer here, I haven't really played with that |
01:57:13 | FromDiscord | <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:24 | lain | ah that makes sense |
01:58:39 | FromDiscord | <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:24 | lain | the 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:35 | lain | which makes sense, except that I only want to use the os stuff at compile time, hrm.. |
02:14:52 | mipri | try -d:weirdTarget |
02:17:02 | mipri | nah, that actually specifically excludes walkDirs |
02:17:28 | mipri | and 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:31 | FromDiscord | <nikki> yeah maybe you can just copy walkDirs into your module as a private thing and use that |
02:19:40 | FromDiscord | <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:34 | FromDiscord | <nikki> it seems like `=sink` on an `Option[T]` doesn't call `=destroy` on the element inside ๐ค |
02:37:42 | FromDiscord | <nikki> will try to repro in a minimal case |
02:40:38 | FromDiscord | <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:52 | FromDiscord | <Avatarfighter> What's the best way to overwrite specific areas of data in a StringStream? |
03:11:18 | FromDiscord | <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:22 | FromGitter | <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:37 | FromDiscord | <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:59 | disruptek | it doesn't have to be. |
04:55:24 | disruptek | ie. you don't need to use reference counting. it's optional. |
04:55:38 | FromDiscord | <Joe-23> @disruptek I see |
04:55:46 | FromDiscord | <Joe-23> By default it is enabled, right? |
04:55:49 | disruptek | what is your application? i'd be absolutely shocked if it mattered at all. |
04:56:06 | disruptek | the default gc is refc currently, yes. |
04:56:07 | FromDiscord | <Joe-23> I haven't made an application I am just curious to know |
04:56:17 | FromDiscord | <nikki> you get reference counts when you use 'managed' things like `ref T` or closures or strings or seqs |
04:56:17 | FromDiscord | <Joe-23> Ah I see |
04:56:26 | FromDiscord | <Joe-23> I see |
04:56:28 | FromDiscord | <nikki> but you can also just use views or ptrs and not have refcounts there |
04:56:37 | FromDiscord | <nikki> and also in many cases refcount changes are elided due to inferring moves |
04:56:45 | disruptek | --gc:none, --gc:arc, --gc:orc, --gc:refc, --gc:boehm, --gc:go, --gc:regions |
04:56:54 | disruptek | there are many ways to skin that cat. |
04:57:05 | FromDiscord | <Joe-23> THanks guys |
04:57:30 | FromDiscord | <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:44 | disruptek | oh, forgot --gc:markandsweep ๐ |
04:57:59 | FromDiscord | <nikki> some of those are being deprecated / decommissioned right? |
04:58:07 | FromDiscord | <Joe-23> @nikki Right |
04:58:46 | disruptek | i don't want to see any of them deprecated, except maybe go. |
04:58:51 | FromDiscord | <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:03 | FromDiscord | <nikki> by just defining `=copy` to `{.error.}` |
04:59:42 | FromDiscord | <Joe-23> @nikki Is this using reference counting, right? |
04:59:56 | FromDiscord | <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:35 | FromDiscord | <nikki> reference counting overhead is mainly during copies, which if you prevent, then there is no overhead |
05:00:59 | FromDiscord | <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:09 | disruptek | of course. |
05:03:40 | FromDiscord | <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:27 | disruptek | maybe 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:34 | FromDiscord | <Rika> Why so? |
05:49:07 | disruptek | because otherwise, they won't show up in docs. |
05:49:24 | disruptek | but, you're right. fuck those kids. |
05:49:29 | disruptek | they shoulda known better. |
05:50:26 | disruptek | zedeus: 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:06 | disruptek | hintDeclaredLoc seems to've broken the 1.4 branch. |
06:21:33 | Zevv | go to bed |
06:21:46 | disruptek | mornin' zevv. |
06:21:51 | FromDiscord | <Rika> zzz |
06:22:24 | * | brainproxy quit (Ping timeout: 256 seconds) |
06:22:35 | disruptek | i just saw my first ๐ข on an IC run. |
06:23:12 | FromDiscord | <Rika> oh wow thats great congrats |
06:23:14 | * | andinus quit (Remote host closed the connection) |
06:23:48 | * | andinus joined #nim |
06:24:04 | disruptek | it just means it loaded a module from cache. no complete builds yet. |
06:25:23 | FromDiscord | <Rika> ah, well its a step in the right direction, which module was it able to load? |
06:25:41 | disruptek | just `since`, which does almost nothing. ๐คฃ |
06:26:31 | disruptek | this has been so easy compared to the backend work, though. |
06:26:48 | disruptek | makes me want to write a new backend. |
06:30:21 | FromDiscord | <Rika> as a maybe-not-so-good nim programmer do you think i'd be able to understand the compiler code... |
06:30:41 | disruptek | of course. |
06:30:44 | disruptek | it's only nim. |
06:32:02 | disruptek | as 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:51 | FromDiscord | <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:13 | FromDiscord | <Joe-23> Is there artificial intelligence tools available for Nim? |
07:18:13 | * | tiorock joined #nim |
07:18:21 | FromDiscord | <Joe-23> I know Python is very good with aritificial intellience |
07:18:27 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> What're you looking for? |
07:25:26 | FromDiscord | <ElegantBeef> We've got if statements ๐ |
07:26:03 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/needed-libraries/issues/77 |
07:26:03 | disbot | โฅ [Meta] Are we scientists yet? |
07:26:08 | * | quadrassel4321 quit (Client Quit) |
07:29:26 | * | brainproxy joined #nim |
07:33:19 | FromGitter | <eagledot> Has anybody used arraymancer (https://github.com/mratsim/Arraymancer) with cuda support on windows? |
07:36:48 | FromDiscord | <ElegantBeef> I assume so, but I havent |
07:40:51 | FromGitter | <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:40 | FromDiscord | <ElegantBeef> Well, i hope someone who knows comes by and answers you question ๐ |
07:57:52 | FromDiscord | <Joe-23> @ElegantBeef Lol |
07:58:02 | FromDiscord | <Joe-23> @ElegantBeef Let me see |
07:58:07 | FromDiscord | <Joe-23> @ElegantBeef Image processing mate |
07:58:07 | FromDiscord | <Joe-23> ๐ |
08:08:32 | * | xet7 joined #nim |
08:11:07 | FromDiscord | <Recruit_main707> Cuda compilation may be broken because some flags passed by default being incompatible |
08:11:28 | FromDiscord | <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:25 | FromGitter | <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:08 | FromGitter | <eagledot> Also i called a function to get version for cudnn from precompiled ``cudnn64_7.dll`` on windows,it worked. |
08:27:25 | bung | what'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:35 | bung | also I noticed nimsugget.nim runCmd asign conf.writelnHook twice |
08:53:37 | * | brainproxy joined #nim |
08:55:33 | FromDiscord | <Joe-23> Just curious does Nim have smart pointers that are also present in C++? |
08:57:31 | FromDiscord | <lqdev> https://github.com/nim-lang/fusion/blob/master/src/fusion/smartptrs.nim |
08:58:17 | FromDiscord | <Joe-23> THanks |
09:00:05 | * | inamiyar[m] quit (Quit: Idle for 30+ days) |
09:08:47 | FromDiscord | <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:06 | FromDiscord | <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:25 | ForumUpdaterBot | New question by Michal Marลกá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:39 | Leaf73 | hi, I want to use the python 'print' function with nimpy, is it possible? |
11:49:22 | Leaf73 | and btw on top of this chat Latest version: 1.2.0 - https://nim-lang.org/install.html, it is 1.4 |
11:52:32 | PMunch | Yes 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:09 | Leaf73 | thx, but without f or fmt? |
11:54:23 | narimiran | Leaf73: use nim's strformat |
11:54:43 | Leaf73 | ok |
11:55:09 | PMunch | Ah f or fmt is probably their own procedures, or some Python magic stuff (no idea how they implement stuff over there) |
11:55:17 | PMunch | Those will be harder to import probably |
11:55:59 | Leaf73 | I want to use the python print to print big numbers, like fibonacci |
11:56:35 | narimiran | inb4 Zevv says that fibonacci has some small numbers like 1, 2, etc. |
11:56:42 | FromDiscord | <Rika> python f strings are different and unrelated to python print |
11:57:15 | PMunch | Uhm, Nims echo can print large numbers |
11:57:19 | Leaf73 | in nim I can only print fib 92 |
11:57:20 | PMunch | Or am I missing something here? |
11:57:38 | narimiran | PMunch: you're missing python's unlimited ints :) |
11:57:49 | PMunch | Oooh |
11:57:57 | Leaf73 | in Python I can print easyly fib 10_000_000 |
11:57:57 | PMunch | That large numbers |
11:58:34 | Leaf73 | with c++ and boost and gmp too |
11:58:49 | PMunch | What you probably want is https://github.com/status-im/nim-stint |
11:58:51 | FromDiscord | <Scarecrow> how do I turn int into string in nim? In python its just str(int) |
11:58:57 | narimiran | $int |
11:58:59 | FromDiscord | <Scarecrow> (edit) "str(int)" => "`str(int)`" |
11:59:00 | PMunch | In nim it's $ |
11:59:21 | PMunch | !eval echo typeof(100); echo typeof($100) |
11:59:21 | narimiran | and if you're echo'ing it, you don't even need $ |
11:59:23 | NimBot | intโตstring |
11:59:35 | Leaf73 | PMunch thx |
11:59:42 | PMunch | Leaf73, no problem |
11:59:54 | PMunch | Why are you printing such massive numbers anyways? |
12:00:02 | FromDiscord | <Scarecrow> Im trying to do equal of python's `str(int)[-1]` |
12:00:11 | narimiran | $int[^1] |
12:00:13 | Leaf73 | only for testing, performance.... |
12:00:18 | FromDiscord | <Scarecrow> thank |
12:00:36 | narimiran | Leaf73: oh, "benchmarking" time.... :P :D |
12:00:37 | PMunch | Right |
12:00:41 | PMunch | Haha :P |
12:00:54 | Leaf73 | I need with c++ boost gmp and fib 1_000_000_000 about 2 mins |
12:00:56 | FromDiscord | <Scarecrow> will $ convert any type of variable into string? |
12:01:01 | narimiran | yep |
12:01:14 | PMunch | *any type that has `$` declared for it |
12:01:21 | PMunch | (but you can declare your own) |
12:01:27 | narimiran | btw, how about `int mod 10` for your last decimal? ;) |
12:02:42 | Leaf73 | no idea ... |
12:02:47 | PMunch | Hmm is $123_456[^1] slower than $(123_456 mod 10)? |
12:03:04 | narimiran | PMunch: he might not need $ in the second case |
12:03:10 | PMunch | Leaf73, I think that was for Scarecrow |
12:03:11 | narimiran | *they |
12:03:24 | Leaf73 | ok |
12:03:42 | PMunch | Oh sure, I was just wondering what, if anything, the difference would be |
12:03:53 | PMunch | Of course if he needed a character then it might be worse |
12:04:31 | PMunch | Although 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:51 | PMunch | Hmm, I notice stint is dual license MIT and Apache, what are the key differences there? |
12:10:55 | Leaf73 | is there an example to use and print with stint... I'm looking now in test... |
12:11:25 | PMunch | Isn't it just to print the number? |
12:12:14 | PMunch | Or echo rather |
12:12:58 | PMunch | !eval import stint; echo 20182018.stint(64) |
12:13:02 | NimBot | 20182018 |
12:14:17 | PMunch | Leaf73 ^ |
12:14:22 | Leaf73 | jup works |
12:15:49 | Leaf73 | is not working import stint; echo 2018201811111111112333333333333333333333333333333333333333333.stint(256) |
12:15:50 | * | brainproxy quit (Ping timeout: 258 seconds) |
12:17:33 | Leaf73 | but this works echo i256("2018201811111111112333333333333333333333333333333333333333333") |
12:19:13 | FromDiscord | <Scarecrow> how do I python's `int % anotherint` in nim? |
12:19:18 | FromDiscord | <Rika> int mod anotherint |
12:21:39 | FromDiscord | <Scarecrow> ty |
12:22:51 | * | brainproxy joined #nim |
12:23:03 | * | leorize quit (Ping timeout: 240 seconds) |
12:23:58 | PMunch | Didn't we have a Python -> Nim document somewhere? |
12:23:58 | * | leorize joined #nim |
12:24:28 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
12:25:03 | PMunch | Leaf73, 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:57 | FromGitter | <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:12 | narimiran | criterion, maybe? |
12:26:29 | FromDiscord | <flywind> !repo golden |
12:26:30 | disbot | https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim ๐ 15 23โญ 0๐ด |
12:26:49 | narimiran | or that :) |
12:27:42 | FromGitter | <ynfle> Thanks @flywind. That was it |
12:27:54 | FromDiscord | <flywind> no problem |
12:30:30 | Zevv | narimiran: fibonawhat has what? |
12:30:48 | narimiran | Zevv: my poor attempt at joke. just ignore it |
12:31:22 | Zevv | I can't |
12:31:27 | Zevv | you will have to explain it to me now |
12:31:38 | narimiran | ok, here goes..... :P |
12:31:58 | Zevv | like, where do *I* come in here |
12:32:30 | Leaf73 | let txt = py.str("test1 = {num:.2f}")discard py.print(txt.format(num = 2018201811111111112333333333333333333333333333333333333333333.234)) |
12:32:31 | narimiran | you're the regular jokester around here.... |
12:32:37 | Leaf73 | test1 = 2018201811111111086739850115462643767812788014436128206618624.00 is thee result |
12:33:07 | Zevv | no no you're confusing me with whatstheirname |
12:34:31 | Leaf73 | PMunch: with small numbers it works with I think python str format |
12:34:54 | Leaf73 | txt.format(num = ... |
12:35:05 | PMunch | Seems to pass it in as a float and then loose precision from that for some reason |
12:35:30 | Leaf73 | is txt a py string? .... |
12:35:33 | PMunch | Oh yeah, you have .234 so obviously it's afloat :P |
12:35:45 | PMunch | txt should be a Python string yes |
12:36:20 | Leaf73 | so python big numbers not working |
12:36:44 | PMunch | Well you're passing it a float, not a bignum |
12:36:54 | Leaf73 | ? |
12:37:33 | PMunch | 2018201811111111112333333333333333333333333333333333333333333.234 is a double precision float |
12:37:58 | PMunch | And it double precision floats doesn't have enough precision to store that number, closest they can get is apparently 2018201811111111086739850115462643767812788014436128206618624.00 |
12:38:06 | Leaf73 | oh, I typed the same into python interpreter, same result |
12:38:12 | PMunch | Yeat |
12:38:14 | PMunch | Yeah* |
12:38:22 | PMunch | It's a hardware limitation of floating point numbers |
12:38:28 | * | brainproxy quit (Ping timeout: 260 seconds) |
12:38:46 | PMunch | https://docs.python.org/3/tutorial/floatingpoint.html |
12:39:03 | Leaf73 | if I remove the float to int I get an error |
12:39:14 | Leaf73 | Error: number out of range: |
12:39:46 | narimiran | how about benchmark fibonacci on some smaller numbers? :P |
12:39:56 | PMunch | Yeah, because 2018201811111111112333333333333333333333333333333333333333333 is too big to be an int64 (highest that Nim natively supports) |
12:40:03 | * | MyMind joined #nim |
12:40:07 | narimiran | and then use some other/better benchmark for something else? |
12:40:34 | PMunch | If you do: improt stint, nimpy; let txt = py.str("test1 = {num}"); discard py.print(txt.format(num = i256"2018201811111111112333333333333333333333333333333333333333333")) |
12:40:37 | PMunch | Then it should work |
12:41:10 | PMunch | Oh wait, txt.format might not be able to handle a stint.. |
12:41:23 | PMunch | Why do you want to use Pythons print/formatting anyways? |
12:41:25 | * | Sembei quit (Ping timeout: 240 seconds) |
12:41:39 | PMunch | Or rather, what are you actually trying to benchmark? |
12:41:45 | Leaf73 | hmmm, forgotten.... |
12:43:03 | * | leorize quit (Ping timeout: 240 seconds) |
12:43:05 | Leaf73 | def 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:05 | Leaf73 | needs 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:45 | Leaf73 | https://play.nim-lang.org/#ix=2DEc |
12:43:52 | Leaf73 | better to read |
12:44:06 | Leaf73 | want this into nim... |
12:44:41 | * | leorize joined #nim |
12:45:13 | Leaf73 | if someone says Python is slow, try it.... |
12:47:05 | * | brainproxy joined #nim |
12:47:36 | FromGitter | <ynfle> @Leaf73, you're probably looking for this proc https://nim-lang.org/docs/strutils.html#toBin%2CBiggestInt%2CPositive |
12:47:49 | PMunch | Not really |
12:48:07 | PMunch | The number he's trying to print is 86781 bytes long.. |
12:48:23 | PMunch | And not the string, the actual numeral |
12:48:25 | FromGitter | <ynfle> Why not? That's what `bin()` does in Python |
12:48:33 | Leaf73 | yup and the best trick is v1, v2, v3 = v1 * v1 + calc, (v1 + v3) * v2, calc + v3 * v3 |
12:49:09 | Leaf73 | <ynfle>: the result is to big |
12:49:37 | PMunch | Give me a sec |
12:49:45 | Leaf73 | the python assignment is tricky.... |
12:50:02 | * | xigoi[m] left #nim ("User left") |
12:50:10 | Leaf73 | this too, v1, v2, v3 = v1 + v2, v1, v2 |
12:50:45 | * | xet7 quit (Quit: Leaving) |
12:50:46 | FromGitter | <ynfle> You can wrap both sides in parentheses and it works |
12:52:35 | Leaf73 | ? |
12:52:38 | * | brainproxy quit (Ping timeout: 258 seconds) |
12:52:44 | ForumUpdaterBot | New 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:34 | FromGitter | <ynfle> (v1, v2, v3) = (v1 + v2, v1, v2) |
12:56:10 | * | Vladar joined #nim |
12:56:25 | PMunch | @ynfle, that's not the problem |
12:56:44 | PMunch | The problem is that he's dealing with incredibly large numbers, way too big to fit in an int |
12:57:04 | Zevv | put them in a float as if you just don't care! |
12:57:21 | PMunch | They're a bit too big for that as well |
12:57:55 | Leaf73 | n = 1,000,000 needs in Sublime Text v3.2.2 0.8s (208988 chars as int) |
12:58:08 | Leaf73 | 208988 chars as int |
12:58:16 | Leaf73 | biiiiiggg iiinnnnt... |
12:58:40 | Leaf73 | :] |
12:59:32 | Leaf73 | not really an int, a special conversion to a string |
13:01:54 | Leaf73 | https://stackoverflow.com/questions/33733511/c-print-first-million-fibonacci-numbers |
13:02:33 | Leaf73 | https://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:04 | FromGitter | <ynfle> Have you try a big int implementation library from nimble? |
13:08:52 | Leaf73 | stint |
13:09:22 | Leaf73 | and I tryed c++ and pybind11 and my python code.... it works |
13:09:41 | Leaf73 | pybind11 embed the python interpreter |
13:10:03 | FromGitter | <bung87> PMunch do you have idea speed up initNimsuggest? I feel slow. |
13:10:17 | PMunch | Yeah, don't recurse your entire filesystem.. |
13:10:25 | * | brainproxy quit (Ping timeout: 264 seconds) |
13:11:45 | FromGitter | <bung87> it will find first nimble close to that file |
13:12:10 | FromGitter | <bung87> I dont think that cause slow |
13:13:43 | * | leorize quit (Ping timeout: 240 seconds) |
13:14:26 | FromGitter | <bung87> and I only recurse when file relative to workspace folders |
13:14:42 | * | leorize joined #nim |
13:17:37 | FromGitter | <ynfle> @Leaf73 โ โ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5faa92f18d286f20769ef18f] |
13:19:14 | FromGitter | <bung87> https://github.com/bung87/nimlsp/commits/myver I go further now. |
13:19:28 | Leaf73 | <ynfle> great:] (y) |
13:19:41 | Leaf73 | :] |
13:20:08 | Leaf73 | what is bignum? I have installed, see it first time |
13:20:21 | FromGitter | <ynfle> It's a bigint library |
13:20:30 | FromGitter | <ynfle> Nim doesn't have one in the standard libe |
13:20:58 | FromGitter | <ynfle> https://github.com/nim-lang/Nim/issues/14696 |
13:20:59 | disbot | โฅ Add bigints to standard library |
13:20:59 | Leaf73 | wow 1_000_000 works eaasy too |
13:21:19 | FromGitter | <ynfle> Considerably faster than python |
13:22:39 | Leaf73 | there is an error I think try fib 5 |
13:22:50 | Leaf73 | I get 233 |
13:23:33 | Leaf73 | but I get big numbers for benchmarks.... =D |
13:23:43 | * | leorize quit (Ping timeout: 240 seconds) |
13:24:33 | * | leorize joined #nim |
13:25:15 | Leaf73 | the slicing? for rec in bin(n)[3:]: |
13:27:22 | FromGitter | <ynfle> You don't need to slice because toBin doesn't have the 0b prefix |
13:27:31 | Leaf73 | fib2(13) = 233 |
13:27:51 | PMunch | @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:06 | Leaf73 | you must slice 0b1 |
13:29:18 | PMunch | Tried to make a version with stint, but it's horribly slow for some reason: http://ix.io/2DEi |
13:29:43 | Leaf73 | print(bin(n)[3:]) and bin(n) you will see it |
13:31:02 | PMunch | Yeah changing his code to this works: http://ix.io/2DEj |
13:31:06 | PMunch | And it's crazy fast |
13:32:42 | FromGitter | <ynfle> @Leaf74, just remove the +1 from the for loop |
13:32:44 | FromGitter | <bung87> hmm let me try release mode |
13:32:51 | ForumUpdaterBot | New thread by Allin: GuildenStern 0.9: Modular multithreading web server for Linux, see https://forum.nim-lang.org/t/7065 |
13:33:02 | Leaf73 | yup looks very good |
13:33:08 | PMunch | Or that I guess :P |
13:33:37 | FromGitter | <ynfle> The slice I think would be slower |
13:34:51 | Leaf73 | yup works too, last digits by 1_000_000 must be ... 546875 .... |
13:35:42 | Leaf73 | echo fib2 10_000_000 about a second |
13:36:16 | FromGitter | <ynfle> If you remove the print statement it will be considerably faster |
13:36:26 | FromGitter | <ynfle> Also compile with `-d:relesea` |
13:36:30 | FromGitter | <ynfle> *release |
13:36:31 | Leaf73 | echo fib2 100_000_000 about 15 seconds, wsl 2 has to work hard |
13:36:57 | Leaf73 | I have -d:release |
13:37:15 | FromGitter | <ynfle> Change `echo` to `discard` |
13:37:20 | Leaf73 | echo remove? |
13:37:27 | Leaf73 | ok |
13:37:49 | Leaf73 | a second |
13:37:50 | FromGitter | <ynfle> 1_000_000_000 โ โ ```real 0m26.560s โ user 0m21.600s โ sys 0m1.114s``` [https://gitter.im/nim-lang/Nim?at=5faa97ae8d286f20769efe4b] |
13:38:02 | PMunch | Hmm, tried to do the same mask thing as I did in my stint thing in your bignum version |
13:38:17 | PMunch | And it's considerably slower.. |
13:39:14 | PMunch | I mean I can kinda see why, but it still irks me :P |
13:39:27 | Leaf73 | real 0m1,175suser 0m1,383ssys 0m0,263s |
13:39:35 | Leaf73 | discard fib2 100_000_000 |
13:40:01 | * | brainproxy joined #nim |
13:44:52 | Leaf73 | real 0m1,008suser 0m0,988ssys 0m0,020s |
13:44:54 | Leaf73 | discard fib2 100_000_000 |
13:45:04 | * | brainproxy quit (Ping timeout: 240 seconds) |
13:45:09 | PMunch | Oh wait, I was doing it wrong, it's about the same speed |
13:47:03 | PMunch | But damn, bignum is fast! |
13:47:08 | Leaf73 | Error: type mismatch: got <int64>but expected one of:func fib2(n: int): Int |
13:47:10 | Leaf73 | discard fib2 10_000_000_000 |
13:47:20 | Leaf73 | func fib2(n: int64): Int = |
13:48:27 | PMunch | Wait, are you on a 32 bit machine? |
13:48:34 | Leaf73 | no |
13:49:01 | PMunch | Then int should be 64-bit |
13:49:05 | Leaf73 | real 2m29,988suser 2m24,975ssys 0m4,530s |
13:49:09 | PMunch | int is always the same size as a pointer |
13:49:12 | Leaf73 | discard fib2 10_000_000_000 |
13:49:27 | Leaf73 | yeah, that's fast |
13:49:38 | Leaf73 | real 2m29,988suser 2m24,975ssys 0m4,530s |
13:50:05 | Leaf73 | never tryed the number with python.... |
13:50:15 | PMunch | Try it :P |
13:50:44 | PMunch | My guess is that they won't be particularly different here, Python probably also wraps bignum in its implementation |
13:50:45 | FromGitter | <ynfle> You can give us the answer tomorrow |
13:51:00 | Leaf73 | ok I started |
13:51:17 | Leaf73 | via sublime text without print |
13:51:30 | FromGitter | <ynfle> You can also try `pypy` |
13:52:27 | narimiran | PMunch: `for rec in n.toBin(floor(log2(n.float) + 1).int)[1..^1]:` -- why not separate this in two lines: |
13:52:39 | narimiran | `let nBin = n.toBin(floor(log2(n.float) + 1).int)[1..^1]` and `for rec in nBin:` |
13:52:51 | PMunch | That wasn't my code :P |
13:52:59 | narimiran | aha |
13:53:00 | PMunch | I used a bitmask instead |
13:53:06 | FromGitter | <ynfle> โ |
13:53:24 | narimiran | (oh, now i re-tried it, and it seems my improved version was just a noise.... eh) |
13:53:37 | Leaf73 | <ynfle> for pypy I must read the docs, new for me |
13:53:42 | narimiran | first time i tried it, it was 44 vs 30 |
13:53:48 | PMunch | That's what I did: http://ix.io/2DEr |
13:54:11 | PMunch | Yeah the performance will be the same |
13:54:28 | PMunch | I mean all of that is overshadowed by what is going on inside that loop |
13:55:14 | narimiran | PMunch: nice speed improvement with your version!! |
13:55:21 | PMunch | Really? |
13:55:32 | PMunch | For me it runs about the same as with the string thing |
13:55:46 | narimiran | i'm comparing http://ix.io/2DEj and http://ix.io/2DEr |
13:56:03 | narimiran | (with the same number, of course) |
13:56:23 | narimiran | and for n = 1_000_000, it is ~10x faster |
13:56:25 | PMunch | Yeah that's the same as I was comparing |
13:56:29 | PMunch | Really? |
13:56:35 | narimiran | really |
13:57:01 | narimiran | here goes, with `-d:danger`, three runs of each: |
13:57:09 | Leaf73 | I must wait, I'll test it after python fib |
13:57:14 | PMunch | Hmm, for 1_000_000 I get "0.00s" :P |
13:57:33 | PMunch | I have the Python version running with 10_000_000_000 |
13:57:34 | Leaf73 | that's very faaast |
13:57:42 | PMunch | Spoiler alert, it's not as fast as the Nim version :P |
13:57:54 | FromDiscord | <Rika> im surprised. |
13:57:56 | FromDiscord | <Rika> very. |
13:58:00 | narimiran | 37, 43, 47 millis, vs 10, 11, 10 |
13:58:06 | PMunch | Huh |
13:58:13 | narimiran | (i got 4 and 5 before) |
13:59:10 | narimiran | aaaaah, `echo` |
13:59:18 | PMunch | Haha |
13:59:19 | narimiran | without it, they're approximately the same speed |
13:59:22 | PMunch | Yeah I was about to say |
13:59:33 | narimiran | sorry for the confusion :) |
13:59:44 | PMunch | You had me confused there for a second :P |
13:59:59 | narimiran | that's a lot of time, relatively speaking! |
14:01:42 | PMunch | I should optimise my confusion |
14:01:50 | narimiran | rewrite it in rust!! |
14:01:55 | PMunch | But I fear that confusion with -d:danger is a bad idea.. |
14:02:02 | narimiran | now for even more confusion in less time! |
14:02:46 | PMunch | Hmm, I think I should convert stacklang to use bignum |
14:03:57 | Leaf73 | python fib is still running so I stop the program |
14:05:27 | PMunch | I'll let my run and see how long it takes :P |
14:08:10 | Leaf73 | real 2m38,143suser 2m33,097ssys 0m4,368s |
14:08:19 | Leaf73 | with the second version |
14:08:32 | Leaf73 | http://ix.io/2DEr |
14:08:56 | Leaf73 | is slower |
14:10:20 | Leaf73 | someone must get the last digits to compare if the result is correct ... :] |
14:11:19 | PMunch | And compare it against what? |
14:11:44 | * | oculuxe joined #nim |
14:12:30 | Leaf73 | hmmmmm..... |
14:13:21 | * | brainproxy joined #nim |
14:13:30 | Leaf73 | and this is fast too https://play.nim-lang.org/#ix=2DEv |
14:13:33 | * | oculux quit (Ping timeout: 260 seconds) |
14:13:42 | Leaf73 | but must converted to nim |
14:14:05 | FromGitter | <ynfle> Not very readable imo. That's why I like nim |
14:15:37 | Leaf73 | I 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:18 | FromGitter | <ynfle> @Leaf73, try Arraymancer |
14:16:22 | Leaf73 | but compiled with `danger` and not with `release |
14:16:24 | FromGitter | <ynfle> !repo arraymancer |
14:16:25 | disbot | https://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:21 | Leaf73 | I have tryed the first steps .... |
14:18:09 | Leaf73 | again the first solution: real 2m36,409suser 2m31,666ssys 0m4,304s |
14:18:32 | FromGitter | <ynfle> Python or Nim? |
14:18:36 | Leaf73 | nim |
14:18:49 | FromGitter | <ynfle> Which number? |
14:18:51 | Leaf73 | discard fib2 10_000_000_000 |
14:20:50 | Leaf73 | Pisano period is faster, but I don't know enough to work with it |
14:20:58 | * | kinkinkijkin quit (Ping timeout: 244 seconds) |
14:20:59 | Leaf73 | https://en.wikipedia.org/wiki/Pisano_period |
14:24:03 | Leaf73 | https://codeforces.com/blog/entry/14516 |
14:25:45 | * | shadowninja55 joined #nim |
14:26:11 | * | kinkinkijkin joined #nim |
14:26:13 | shadowninja55 | hello |
14:26:23 | PMunch | wb shadowninja55 |
14:26:27 | shadowninja55 | ty |
14:26:35 | shadowninja55 | im getting an oserror while trying to connect to a proxy on windows |
14:26:39 | shadowninja55 | any ideas why this is? |
14:26:48 | shadowninja55 | it's when i go to make a request with an httpclient i initialized with a proxy |
14:27:09 | PMunch | Hmm, does the OSError say anything? |
14:27:40 | shadowninja55 | "No connection could be made because the target machine actively refused it." |
14:28:24 | * | Leaf73 quit (Ping timeout: 245 seconds) |
14:28:24 | shadowninja55 | it has happened with multiple proxies i've tested |
14:28:27 | * | Leaf50 joined #nim |
14:28:54 | PMunch | Hmm, does the proxies require some kind of authentication? |
14:29:06 | PMunch | (I've never used proxies with httpclient) |
14:29:38 | shadowninja55 | i dont think so let me check |
14:30:58 | ForumUpdaterBot | New thread by Gcao: Catch Ctrl-C interruption, see https://forum.nim-lang.org/t/7066 |
14:31:03 | shadowninja55 | ah i just checked them and it seems many just don't work lol |
14:31:10 | shadowninja55 | im just scraping them from an open api so i guess that's to be expected |
14:31:16 | Leaf50 | PMunch and <ynfle>: thx for all, must go (find new faster fib code :] ), bye |
14:31:37 | PMunch | Bye |
14:31:41 | * | Leaf50 quit (Remote host closed the connection) |
14:36:21 | shadowninja55 | hmm maybe i should get some actual proxies lmaoo |
14:43:28 | * | abm joined #nim |
14:55:23 | PMunch | Hmm, why does this echo the AutoClose message twice? https://github.com/nim-lang/Nim/issues/13289#issuecomment-724383241 |
14:55:26 | disbot | โฅ 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:27 | Zevv | Yeah that one is funny PMunch |
15:39:02 | disruptek | hilarious. |
15:39:31 | Zevv | http://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:30 | FromDiscord | <Clyybber> because it doesn't check if the file is already closed |
16:21:39 | * | xet7 joined #nim |
16:22:11 | Zevv | no check the ix |
16:22:17 | Zevv | it's never opened, never instantiated |
16:22:19 | Zevv | but still it's there |
16:22:21 | Zevv | it's like |
16:22:23 | Zevv | *magic* |
16:22:45 | Zevv | the iterator is never called! |
16:26:00 | * | xet7 quit (Client Quit) |
16:30:23 | * | leorize quit (Ping timeout: 240 seconds) |
16:32:12 | disruptek | should it be? |
16:33:03 | * | leorize joined #nim |
16:33:40 | disruptek | clyybber: where are we on cps? |
16:37:36 | * | xet7 joined #nim |
16:37:57 | disruptek | Zevv: dude, this tuner thing. it works great. |
16:38:07 | disruptek | what 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:21 | PMunch | Zevv, huh that is super weird |
17:31:10 | Zevv | disruptek: unsubscribing |
17:31:16 | Zevv | PMunch: cool stuff eh |
17:31:43 | disruptek | Zevv: what are you doing to unsubcribe, though? |
17:33:06 | Zevv | my subscription to nimph |
17:33:24 | disruptek | what's the command you are typing, chucklehead? |
17:34:52 | Zevv | I don't know. It's months since I typed that |
17:35:08 | disruptek | just !detune disruptek nimph |
17:35:52 | Zevv | it's not helpful. Whenver I privmsg it it will just show me a tiny bit of help |
17:35:58 | Zevv | whatever I type |
17:36:10 | * | shadowninja55 joined #nim |
17:36:15 | Zevv | it just said okay |
17:36:17 | Zevv | is it really done? |
17:36:20 | disruptek | yes. |
17:36:22 | Zevv | btw, if you privmsg, why the '!' |
17:36:30 | shadowninja55 | ello |
17:36:37 | Zevv | ello shadowninja55 |
17:36:41 | disruptek | fucking ninjas. |
17:36:47 | shadowninja55 | my httpclient seems to not be able to use any proxies |
17:36:49 | shadowninja55 | i get oserror with any proxy |
17:37:13 | shadowninja55 | just making sure, the format is `newProxy("ip:port", "user:password")` correct? |
17:39:13 | Zevv | I think it's http://ip:port |
17:39:57 | shadowninja55 | oh shoot lemme try that |
17:40:54 | Zevv | the docs are not really clear on this I must admit |
17:40:57 | Zevv | /really not/ |
17:41:19 | Zevv | oh well, they are: https://nim-lang.github.io/Nim/httpclient.html#proxy |
17:41:26 | Zevv | just not at the proc itself |
17:41:49 | shadowninja55 | ye |
17:41:54 | shadowninja55 | they're not super detailed thats why im confused |
17:42:01 | shadowninja55 | but it worked with the http:// prefix thx |
17:42:31 | Zevv | cool |
17:57:27 | Zevv | I abandoned this interactive npeg graph idea |
17:57:48 | disruptek | oh yeah? |
17:57:50 | Zevv | the stuff is so thoroughly optimized for its purpose, everything I touch makes it worse in one way or the other |
17:58:02 | Zevv | I need an AST representation of the parser that survives to run time |
17:58:15 | disruptek | i imagine it's hard to figure out where to slow it down. |
17:58:17 | Zevv | but there is none. The only AST is nim ast, which gets compiled in to VM instructions in one pass |
17:58:31 | Zevv | and I can't lift NimNodes to run time. |
17:58:34 | Zevv | for some reason |
17:58:43 | Zevv | which is silly, actually |
17:59:03 | Zevv | it's not like I want to feed it back into nim. I just want to inspect it at run time |
17:59:09 | FromDiscord | <nikki> import compiler? |
17:59:14 | Zevv | no friggin' way |
17:59:26 | Zevv | what's so special about a NimNode anyway |
17:59:29 | FromDiscord | <nikki> import way |
17:59:31 | Zevv | that it can only live at compile time |
17:59:39 | disruptek | yeah, i'm facing the same problem. that's why i need to build the stupid introspection thing. |
18:00:00 | Zevv | can't we just fix this |
18:00:17 | disruptek | it works this way for hysterical reasons. |
18:04:44 | * | krux02 joined #nim |
18:06:31 | Zevv | hm I could make a hash of each nimnode and keep that around, and ref it from user space |
18:06:45 | Zevv | too bad they're not natively hashable |
18:07:29 | disruptek | const ast = frosty.freeze n |
18:07:41 | Zevv | bull |
18:07:45 | Zevv | one can not freeze a NimNode |
18:07:50 | disruptek | why not? |
18:07:57 | Zevv | what happens if I thaw it at run time? |
18:08:14 | disruptek | what? |
18:08:44 | Zevv | what happens if I thaw it at run time? |
18:09:02 | disruptek | are you worried about the blackhole information paradox? |
18:09:07 | disruptek | because, y'know, that shit is solved now. |
18:12:26 | * | Vladar joined #nim |
18:13:03 | Zevv | Did you ever freeze a nimnode? |
18:13:14 | Zevv | it crashes nim |
18:13:17 | Zevv | with a SIGSEGV |
18:13:42 | disruptek | it's the quickest way i've found to free memory. |
18:13:59 | FromGitter | <ynfle> What about getting the `repr` or `treerepr`? |
18:14:11 | Zevv | then the AST-ness is gone |
18:14:30 | Zevv | I could do listRepr and re-parse that, of course |
18:14:34 | * | mmohammadi9812 quit (Quit: Quit) |
18:14:38 | Zevv | disruptek: http://ix.io/2DG2 |
18:14:41 | disruptek | the key to this is to encode the typedness, not merely the literals. |
18:15:18 | * | Vladar quit (Client Quit) |
18:17:49 | disruptek | Zevv: is it a frosty bug? |
18:18:39 | Zevv | if X crashes the compiler with a sigsegv, is that a bug in X |
18:18:43 | Zevv | or a bug in the compiler |
18:18:46 | Zevv | I don't know man, you decide |
18:19:07 | Zevv | but you just told me something you never tried yourself |
18:19:13 | Zevv | it might have killed me, for all you know |
18:19:21 | disruptek | well, i'm not a masochist. |
18:19:25 | disruptek | i'm a sadist. |
18:19:26 | Zevv | I feel this is highly irresponsible of you. I do not forget lightly |
18:19:48 | disruptek | i freeze the ast in ic. |
18:19:58 | disruptek | but it's frontend ast. ๐ |
18:19:58 | Zevv | one 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:12 | disruptek | i'm counting on it. |
18:20:37 | Zevv | frotend AST is just normal stuff |
18:20:39 | Zevv | it's not magic |
18:20:55 | disruptek | you mean it's not broken. |
18:21:10 | Zevv | is it? |
18:21:19 | disruptek | not by design, no. |
18:21:32 | Zevv | so, what is the proposed alternative these days? |
18:21:59 | Zevv | hm still I don't have an unique ID for my nimnodes. |
18:22:09 | Zevv | they don't have an address, they are not hashable. |
18:22:12 | Zevv | what else can one do? |
18:22:18 | Zevv | just count them while traversing the tree? |
18:22:24 | disruptek | what do you mean, not hashable? |
18:22:46 | FromDiscord | <nikki> can you write a hash fn for them? go over each case, make composite nodes composite of child hashes |
18:22:48 | disruptek | please make a debug build the compiler and run the same program. |
18:22:53 | disruptek | ^ of |
18:23:08 | Zevv | โ hash[NimNode]() |
18:23:11 | disruptek | i would like frosty to work. |
18:23:30 | Zevv | nikki: probably, but that's work. |
18:23:32 | FromDiscord | <lqdev> zevv have you been smoking too much APL lately |
18:23:46 | FromDiscord | <nikki> Zevv but writing nim code is fun right |
18:24:10 | disruptek | i'm still confused on how zevv managed to make mathpipe faster in a nim impl than lua. |
18:24:15 | FromDiscord | <whisperdev> Will Nim work on new arm based macbooks? |
18:24:17 | Zevv | npeg |
18:24:19 | disruptek | yes. |
18:24:31 | Zevv | it just folds like a neat origami |
18:24:39 | disruptek | hmmph. |
18:24:49 | Zevv | it's utterly natural. I'm not overdoing it with typing and overloading and all, but that's just what happens |
18:24:56 | Zevv | s/not/now/ |
18:24:56 | FromDiscord | <nikki> nim works everywhere C works which is everywhere |
18:25:09 | disruptek | nim is /more/ portable than c. |
18:25:31 | Zevv | that *is* true, I'm afraid |
18:25:44 | FromDiscord | <nikki> it even runs in the nim compiler! |
18:25:47 | FromDiscord | <nikki> where c doesn't run |
18:26:11 | Zevv | it even used to run in PHP. but they burned that with hells eternal fire. |
18:26:20 | FromDiscord | <whisperdev> How about ARC? |
18:26:22 | disruptek | thank $deity. |
18:26:32 | disruptek | arc has nothing to do with arch. |
18:26:45 | FromDiscord | <nikki> arc is just pretty pure compute code |
18:26:49 | disruptek | Zevv: got your stacktrace yet? |
18:26:50 | FromDiscord | <nikki> should work errwhere too |
18:26:57 | FromDiscord | <whisperdev> ok dont kill me I am totally clueless about it |
18:27:02 | disruptek | ~arc |
18:27:03 | disbot | arc: 11a new memory manager for Nim; see https://forum.nim-lang.org/t/5734 -- disruptek |
18:27:03 | FromDiscord | <whisperdev> ๐ฉ |
18:27:43 | Zevv | bwah I can't even fieldPairs() a nimnode |
18:27:45 | Zevv | this is so silly |
18:27:54 | Zevv | disruptek: Nim stacktrace? |
18:28:06 | disruptek | compiler st for that flopper proggy. |
18:28:12 | Zevv | http://ix.io/2DG8 |
18:28:12 | Zevv | sure |
18:28:17 | FromDiscord | <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:38 | Zevv | ha good one |
18:28:40 | FromDiscord | <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:55 | disruptek | blame clyybber. |
18:29:01 | Zevv | does one ever expect to get it back out after none()ing it |
18:29:23 | FromDiscord | <nikki> is that related to the destructor call |
18:29:55 | FromDiscord | <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:56 | disruptek | it won't necessarily free it before you leave scope. |
18:30:05 | Zevv | well, if there would be a magic call "thing.getEvenThoughItSaysNone()", you would still need to keep it around |
18:30:19 | Zevv | so what you are proposing is probably to .reset() the thing on none() |
18:30:26 | Zevv | which makes perfect sense, imho |
18:30:29 | disruptek | no; it's more about the fact that the spec is undefined for when we free it. |
18:30:38 | disruptek | out of scope, it should be destroyed as expected. |
18:30:41 | Zevv | right. It now gets destructed whtn the option is thrown away |
18:30:58 | Zevv | I dare you to make a PR for this and see the fallout on that |
18:31:08 | FromDiscord | <nikki> i'd expect an option to behave like a seq of max len 1 |
18:31:14 | mipri | https://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:17 | Zevv | right, I was just typing that |
18:31:22 | Zevv | it's like emptying your seqs |
18:31:42 | disruptek | no seqs is hard, man. |
18:32:26 | Zevv | nikki: what do other languages do? |
18:33:00 | FromDiscord | <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:23 | FromDiscord | <nikki> mipri: huh i see. in some case i was testing it didn't happen |
18:33:41 | ForumUpdaterBot | New thread by Jlindsay: Publishing a nimble package, see https://forum.nim-lang.org/t/7067 |
18:33:41 | disruptek | it's not supposed to happen. |
18:33:48 | disruptek | the behavior is undefined by design. |
18:33:49 | FromDiscord | <Clyybber> disruptek: bit short on time rn and the untyped fix needs more work |
18:34:02 | disruptek | aight. |
18:34:25 | FromDiscord | <Clyybber> @nikki hey, whats the qeustion |
18:34:36 | disruptek | Zevv: frosty can be made to handle these nimnodes, i think. |
18:34:49 | Zevv | show me |
18:35:04 | Zevv | nikki: I think it's worth an issue or PR to force a decision on this |
18:35:07 | disruptek | it might take awhile. |
18:35:11 | Zevv | either we do or we dont, but it should be made explicit |
18:35:13 | FromDiscord | <Clyybber> disruptek: at least when its finished we get untyped overloading for free |
18:35:17 | Zevv | I'll vote for you |
18:35:21 | FromDiscord | <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:29 | disruptek | the decision was already made. we don't want to lock ourselves into a spec. |
18:35:36 | FromDiscord | <Clyybber> @nikki afaict yeah |
18:35:46 | Zevv | I trust Clyybber, not you |
18:35:52 | FromDiscord | <Clyybber> does it not do that? |
18:35:54 | disruptek | fair enough. |
18:35:59 | Zevv | we can just make a spec that says "this language does whatever" |
18:36:03 | Zevv | and throw out all the tests |
18:36:04 | disruptek | but, he's wrong. ๐ |
18:36:08 | Zevv | that woudl be nice and terse |
18:36:08 | FromDiscord | <Clyybber> options are not magic |
18:36:21 | FromDiscord | <nikki> @Clyybber it didn't in some case i had but i'll go check it again |
18:36:25 | Zevv | no, but it doesn't .reset() on none() |
18:36:31 | FromDiscord | <Clyybber> the autogenerated =destroy for a type calls destroy on all it fields |
18:36:53 | FromDiscord | <nikki> right but the autogen'd eqsink on option seems to not destroy the old contained element |
18:36:53 | Zevv | yeah but none() merely sets the "this thing as a value" to false |
18:37:00 | Zevv | ti does not throw out the thing it holds |
18:37:14 | FromDiscord | <Clyybber> @nikki are you sure? |
18:37:19 | FromDiscord | <Clyybber> can you give a repro |
18:37:42 | FromDiscord | <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:58 | FromDiscord | <nikki> will work on a repro |
18:38:09 | disruptek | just look at the codegen. you'll find it destroying between asgn and close of scope. |
18:38:37 | FromDiscord | <nikki> oh to clarify i'm talking about arc here |
18:38:42 | disruptek | of course. |
18:38:56 | FromDiscord | <Clyybber> @nikki are you n5m? |
18:39:20 | FromDiscord | <nikki> ๐ค๐ค are you asking if i go by that name elsewhere |
18:39:23 | disruptek | what's the best state in the US for beastiality? |
18:39:34 | FromDiscord | <Clyybber> @nikki yeah on github |
18:39:37 | Zevv | Vermont |
18:39:43 | FromDiscord | <nikki> nah i'm nikki93 on github haha |
18:39:46 | FromDiscord | <Clyybber> ah ok |
18:39:52 | disruptek | hole in one. |
18:40:01 | FromDiscord | <nikki> @Clyybber are you the destructor guy? other than ar4q of course |
18:40:05 | FromDiscord | <Clyybber> yeah |
18:40:07 | FromDiscord | <Clyybber> and cooldome |
18:40:18 | disruptek | everyone makes mistakes. |
18:40:19 | FromDiscord | <nikki> i'm relying on destructors for a few things so maybe i'll ping you as i run into stuff haha |
18:40:21 | FromDiscord | <nikki> cool |
18:40:28 | FromDiscord | <Clyybber> aight |
18:40:40 | FromDiscord | <nikki> yeah will look into a repro |
18:42:08 | FromDiscord | <Clyybber> Zevv: Hmm, I guess that is a funny impl detail of closure iters |
18:42:19 | Zevv | these are just weird |
18:42:23 | Zevv | they always have been |
18:42:53 | Zevv | they are a thing but they are not, until they get a name and then they exist by that name but not really |
18:43:03 | Zevv | I tried to explains someone once. I failed the Feynman test |
18:43:06 | shadowninja55 | is 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:07 | FromDiscord | <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:42 | FromDiscord | <nikki> do you want to statically link libc or some other dep? like what dll is the error about |
18:46:05 | disruptek | it's almost certainly due to pcre64.dll. |
18:46:08 | FromDiscord | <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:53 | Zevv | yeah this pcre64. someone should something to do pattern matching in native nim |
18:49:58 | FromDiscord | <nikki> maybe if we write an x86 interpreter in native nim we can just run the compiler pcre |
18:50:06 | FromDiscord | <nikki> compiled |
18:50:23 | Zevv | dude, that's soo meta |
18:50:34 | * | Vladar joined #nim |
18:57:45 | ForumUpdaterBot | New 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:06 | FromDiscord | <krisppurg> No answer? |
19:02:30 | shadowninja55 | its libcrypto |
19:02:57 | shadowninja55 | `(libcrypto-1_1-x64|libeay64).dll` |
19:03:36 | shadowninja55 | thats 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:28 | FromDiscord | <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:24 | FromDiscord | <alehander42> hey |
19:26:28 | FromDiscord | <alehander42> meta |
19:27:23 | * | rockcavera joined #nim |
19:31:25 | * | Prestige quit (Quit: Prestige) |
19:33:36 | * | habamax quit (Quit: leaving) |
19:34:38 | shadowninja55 | oh 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:08 | FromDiscord | <nikki> @Clyybber repro for ya: https://github.com/nim-lang/Nim/issues/15910 |
20:34:10 | disbot | โฅ Assignment to `Option[T]` doesn't call destructor on existing contained value ; snippet at 12https://play.nim-lang.org/#ix=2DGW |
20:36:15 | disruptek | hmm, that's fucked up. |
20:37:14 | * | kinkinkijkin quit (Remote host closed the connection) |
20:38:12 | disruptek | it's weird how broken that is in refc. |
20:39:59 | FromDiscord | <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:10 | FromDiscord | <nikki> or does refc say that destructors are at least called on exit or sth |
20:40:20 | FromDiscord | <nikki> i've mostly only familiarized myself with arc semantics so ... |
20:41:07 | disruptek | how is that okay? |
20:41:08 | FromDiscord | <alehander42> disruptek |
20:41:11 | FromDiscord | <alehander42> i didnt vote |
20:41:14 | FromDiscord | <alehander42> i remember you asked me |
20:41:15 | disruptek | you still can. |
20:41:23 | FromDiscord | <alehander42> did trump win EU |
20:41:30 | FromDiscord | <alehander42> we have 0 delegates ๐ฆ |
20:41:34 | FromDiscord | <alehander42> typical USA |
20:41:37 | disruptek | that's fucked up. |
20:41:48 | FromDiscord | <alehander42> you have army here |
20:41:57 | disruptek | if i define a destructor, i expect it to get called comprehensively. |
20:41:59 | FromDiscord | <alehander42> we could have 2-3 delegates |
20:42:28 | FromDiscord | <alehander42> but i plan on voting next year |
20:42:37 | FromDiscord | <alehander42> in our local elections |
20:42:43 | disruptek | that won't help me. |
20:43:22 | FromDiscord | <alehander42> hug |
20:43:23 | FromDiscord | <alehander42> ok |
20:43:43 | FromDiscord | <alehander42> are destructors on the end of scope or function in nim |
20:43:47 | disruptek | nikki: 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:04 | disruptek | otherwise, it's broken. |
20:44:07 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=2DH2 |
20:44:14 | FromDiscord | <nikki> in arc i think it's defined that an assignment does the eqsink which should call eqdestroy on the existing thing |
20:44:17 | FromDiscord | <nikki> at least according to the destructors article |
20:44:39 | disruptek | where does it say we'll destroy it immediately? |
20:44:43 | FromDiscord | <nikki> or like, does eqsink or eqcopy, but yeah |
20:45:14 | FromDiscord | <nikki> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqsink-hook |
20:45:30 | FromDiscord | <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:53 | disruptek | hmm, i think this is overspecified, honestly. |
20:46:00 | FromDiscord | <alehander42> hmm, thanks |
20:46:09 | FromDiscord | <nikki> sure, but that's a separate discussion i think (and i disagree lol) |
20:46:13 | FromDiscord | <alehander42> is it supposed to be deterministic |
20:46:57 | disruptek | but /what/ you determine can be more broad than this. |
20:47:36 | FromDiscord | <nikki> @krisppurg i think you may have to break up the messages into UDP-compatible sizes |
20:47:39 | disruptek | the language is pretty prescriptive afaict. |
20:47:45 | FromDiscord | <nikki> a library like netty may do this for you |
20:47:46 | disruptek | look at what expandArc says. |
20:47:59 | FromDiscord | <nikki> i'll try it |
20:48:09 | FromDiscord | <krisppurg> how would I do that though? |
20:48:30 | FromDiscord | <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:46 | FromDiscord | <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:04 | FromDiscord | <nikki> UDP is very low level |
20:49:50 | disruptek | rude. |
20:50:18 | FromDiscord | <nikki> udp is rude? ya some times it just doesn't send the msg, definitely rude |
20:50:42 | disruptek | it's hardly low-level. |
20:50:43 | disruptek | c'mon. |
20:50:52 | disruptek | it's just mean to suggest. |
20:51:04 | FromDiscord | <nikki> ha, well, everything is lower level than something else i guess |
20:51:14 | FromDiscord | <nikki> udp is lower level than "i want to send a huge bunch of data and make sure it gets there" |
20:51:28 | FromDiscord | <nikki> in any case disruptek i think the destructor issue may come down to the codegen for case objects? |
20:51:29 | disruptek | it's just different. |
20:51:53 | FromDiscord | <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:04 | disruptek | the codegen for case objects is pretty tricky when it comes to arc. this wouldn't be the first bug. |
20:52:27 | FromDiscord | <nikki> the expandArc for these test fns all makes sense |
20:52:30 | disruptek | tcp is a peer to udp. it doesn't encapsulate it; ergo, it is no more high-level than udp. |
20:52:50 | disruptek | expandArc is correct? |
20:53:03 | FromDiscord | <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:29 | disruptek | now apologize. |
20:53:32 | FromDiscord | <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:41 | FromDiscord | <nikki> i sent an apology but udp dropped it |
20:53:44 | disruptek | lol |
20:53:47 | FromDiscord | <nikki> it was a high level apology |
20:54:06 | FromDiscord | <nikki> i'll check expandArc for the =sink on the option |
20:54:25 | FromDiscord | <nikki> actually idk how to do that lol |
20:54:57 | FromDiscord | <nikki> disruptek: can you see images? if i were to post an image here |
20:55:18 | FromDiscord | <nikki> https://media.discordapp.net/attachments/371759389889003532/775825934019592242/unknown.png |
20:55:29 | FromDiscord | <nikki> you can see how eqsink for the option just ... assigns the fields of the contained obj |
20:55:44 | FromDiscord | <nikki> but doesn't actually call the eqsink on the obj. like it's going straight through to the fields |
20:57:37 | FromDiscord | <nikki> https://github.com/nim-lang/Nim/issues/15910#issuecomment-724961796 <-- non-image version |
20:57:38 | disbot | โฅ Assignment to `Option[T]` doesn't call destructor on existing contained value ; snippet at 12https://play.nim-lang.org/#ix=2DGW |
20:57:55 | disruptek | so it's an Option bug. |
20:58:12 | disruptek | i'm fine with that. |
20:58:38 | * | narimiran quit (Ping timeout: 260 seconds) |
20:59:09 | FromDiscord | <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:35 | disruptek | well, i'm not looking at your images. |
20:59:42 | disruptek | are you looking at the code in options.nim? |
20:59:57 | FromDiscord | <nikki> the last link i pasted is not an image |
21:00:01 | FromDiscord | <nikki> and is the same code |
21:00:18 | disruptek | where are you located? |
21:00:24 | FromDiscord | <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:39 | disruptek | ah, then you should fix the title. |
21:01:44 | FromDiscord | <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:53 | FromDiscord | <nikki> i'll amend the title tho |
21:05:17 | disruptek | https://github.com/nim-lang/Nim/issues/13102 |
21:05:18 | disbot | โฅ double free bug with arc, Result type, object refs, and iterators ; snippet at 12https://play.nim-lang.org/#ix=27kh |
21:06:00 | disruptek | #13149 |
21:06:01 | disbot | https://github.com/nim-lang/Nim/issues/13149 -- 5Destructors: case objects have issues ; snippet at 12https://play.nim-lang.org/#ix=27qe |
21:07:59 | FromDiscord | <nikki> nice looking at these |
21:08:23 | disruptek | probably not super relevant, but it gives some backstory. |
21:08:24 | FromDiscord | <nikki> i might've jumped on the destructors train too early lol but it's fun |
21:08:46 | disruptek | it's not early. the train needs more passengers. |
21:08:49 | FromDiscord | <nikki> the lesson so far is to just use dumb objects and refs only and maybe seqs, but not case objects yet |
21:08:54 | FromDiscord | <nikki> cool, count me in |
21:09:02 | disruptek | wut no that's bullshit. |
21:09:19 | disruptek | but do use refs only for inheritance. |
21:09:37 | FromDiscord | <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:50 | disruptek | right. |
21:10:07 | FromDiscord | <nikki> i just meant like, maybe ref as a workaround for optionT for now where i use nil / non-nil |
21:10:16 | FromDiscord | <nikki> i found that that calls the destructors reliably |
21:10:29 | disruptek | yes, but options should be fixed. as should variant objs. |
21:10:30 | FromDiscord | <nikki> obv that causes heap alloc / counts but ... /shrug |
21:10:50 | disruptek | variants are kinda central to nim-1. |
21:11:15 | FromDiscord | <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:23 | disruptek | weird. |
21:11:27 | FromDiscord | <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:54 | FromDiscord | <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:18 | disruptek | if you don't destroy them in your hooks, yes. |
21:14:36 | FromDiscord | <nikki> oh i meant like; since option / case doesn't destroy them in the hooks (as seen in the issue) |
21:14:44 | disruptek | that's a bug. |
21:14:50 | disruptek | that's /the/ bug. |
21:15:09 | FromDiscord | <nikki> yes. i meant does this bug cause arc refs to leak |
21:15:14 | disruptek | yes. |
21:15:27 | disruptek | well, actually, i'm not sure about that. |
21:15:42 | FromDiscord | <nikki> ya, the q was to get another opinion on how sure to be |
21:15:50 | FromDiscord | <nikki> i wasn't actually asking if it was intended behavior for arc refs in options to leak |
21:15:54 | disruptek | run -d:useMalloc and --gc:arc under valgrind to see. |
21:15:59 | FromDiscord | <nikki> yeah about to try |
21:16:19 | FromDiscord | <nikki> what's a good way to make a definitely heapalloced ref. make a string and then `.add(...)` to it? |
21:16:38 | FromDiscord | <nikki> guess i could just use a ref obj with a big array |
21:16:40 | disruptek | what would the add do? |
21:16:52 | disruptek | any runtime string/seq is a ref. |
21:16:58 | FromDiscord | <nikki> the add makes sure to cause a heapalloc |
21:17:01 | FromDiscord | <nikki> the add makes it runtime yeah |
21:17:07 | FromDiscord | <nikki> cuz if i just used a stringliteral it doesn't |
21:17:34 | disruptek | that's... surprising. |
21:17:43 | disruptek | you're telling me we lift to const? |
21:18:15 | FromDiscord | <nikki> yeah if you just made an obj and then stored a string froma stringliteral in it, no heapalloc |
21:18:30 | disruptek | ah, but that's different from just a rando string. |
21:18:31 | FromDiscord | <nikki> and the free on refcount decrease checks if it was a literal, doesn't free if so |
21:18:41 | disruptek | yeah. try not to cheat so hard. |
21:18:41 | FromDiscord | <nikki> yah, so the add is to make it rando |
21:18:56 | FromDiscord | <nikki> add is for uncheatin |
21:19:00 | disruptek | okay. |
21:19:02 | FromDiscord | <nikki> i'm going with a ref object with an array in it tho |
21:19:15 | disruptek | whatever peels your banana. |
21:20:07 | * | brainproxy quit (Ping timeout: 246 seconds) |
21:20:13 | FromDiscord | <nikki> lol doesn't leak. crazy |
21:20:32 | FromDiscord | <nikki> ah taht's right cuz it calls eqsink on the ref inside |
21:21:35 | FromDiscord | <nikki> cool yeah no leak ๐ |
21:21:49 | disruptek | that's why it wasn't discovered sooner. |
21:21:59 | disruptek | but it's still wrong. |
21:22:15 | FromDiscord | <nikki> yeah i figured if refs inside cases leaked that would be a major early bug |
21:23:20 | disruptek | this 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:09 | FromDiscord | <nikki> omg i'm dumb, options do not use case objects at all. silly me |
21:25:31 | FromDiscord | <William_CTO> Is there a way to make mutexes compatible with async functions in Nim? |
21:25:34 | disruptek | time to update the title yet again. |
21:25:43 | disruptek | william: that doesn't make any sense. |
21:26:01 | disruptek | async is not multi-threaded. |
21:26:09 | FromDiscord | <William_CTO> right |
21:26:23 | * | leorize quit (Ping timeout: 240 seconds) |
21:26:46 | disruptek | didn't we talk about this not long ago? |
21:27:16 | FromDiscord | <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:34 | disruptek | how is that possible? |
21:27:46 | FromDiscord | <William_CTO> How is what possible? |
21:27:56 | disruptek | how can you have a race condition in a single thread? |
21:29:07 | FromDiscord | <ElegantBeef> Very carefully |
21:30:10 | FromDiscord | <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:36 | disruptek | so use waitfor in your parsing. |
21:31:05 | disruptek | your "mutex" can be a bool or whatever you want. |
21:31:51 | FromDiscord | <William_CTO> thank you, I'll try that out |
21:32:11 | disruptek | don't be afraid to tell people that tell you you cannot use waitfor that they are stupid. |
21:32:22 | disruptek | tell them disruptek said it was okay. |
21:32:31 | FromDiscord | <William_CTO> noted |
21:33:26 | FromDiscord | <nikki> disruptek: i got it down to this: https://gist.github.com/nikki93/e46e1fd637ac97818de719e67e973bf7 |
21:33:45 | disruptek | my eyes |
21:33:49 | FromDiscord | <nikki> after noting that option doesnt' use case objects at all and is just a normal object containing an object |
21:34:17 | disruptek | just remove everything that works correctly and use an assertion that fails in the event that it's broken. |
21:34:26 | disruptek | no one cares about working code. |
21:34:33 | disruptek | !repo dust |
21:34:34 | disbot | https://github.com/disruptek/dust -- 9dust: 11DUST is Unattended Syntax Truncation 15 5โญ 0๐ด 7& 1 more... |
21:34:42 | disruptek | maybe you can fix dust for devel while you're at it. |
21:35:35 | * | mbomba joined #nim |
21:36:25 | disruptek | this doesn't make sense. |
21:36:51 | disruptek | you'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:58 | disruptek | are we generating a different destructor for it? |
21:38:35 | disruptek | oh it's eqsink is isn't calling it, right? |
21:39:40 | FromDiscord | <nikki> yeah i believe so ๐ค |
21:39:56 | FromDiscord | <nikki> and yeah i'll go the assertion route for next ones |
21:40:05 | disruptek | feels like it's intentional but i don't understand why it wouldn't use the same codepath. |
21:40:17 | ForumUpdaterBot | New thread by Peter: Type problem with 1.4.0, see https://forum.nim-lang.org/t/7070 |
21:41:13 | FromDiscord | <nikki> lemme see what happens when i define eqsink to propagate |
21:41:37 | FromDiscord | <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:43 | disruptek | yes. |
21:42:00 | * | hpyc9 joined #nim |
21:42:14 | FromDiscord | <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:52 | FromDiscord | <ElegantBeef> Currently trying to recursively generate setter procs for all of their settings |
21:49:45 | FromGitter | <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:01 | FromDiscord | <ElegantBeef> It's one of the suggested impls |
21:50:03 | disruptek | i think it sucks. |
21:50:13 | FromGitter | <iffy> hehe |
21:50:59 | * | brainproxy joined #nim |
21:53:13 | FromDiscord | <lqdev> disruptek me too |
21:53:44 | FromGitter | <iffy> For those that frown on it, what would you rather do? concepts? |
21:53:48 | disruptek | yes. |
21:54:00 | disruptek | even 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:00 | FromDiscord | <ElegantBeef> Is there a way to write a file during compiletime? |
22:05:16 | FromDiscord | <ElegantBeef> I know we have static read, but i dont see a write equivlent |
22:05:32 | FromDiscord | <nikki> i thiiiiiink you could staticExec sth that writes files |
22:05:38 | disruptek | static: writeFile |
22:05:43 | FromDiscord | <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:46 | FromDiscord | <Recruit_main707> there should be a mkDir proc for compile time, change my mind |
22:15:51 | * | leorize joined #nim |
22:16:02 | disruptek | there should be a getCurrentDir proc first. |
22:18:15 | * | gangstacat quit (Ping timeout: 272 seconds) |
22:24:35 | disruptek | omg i'm such an idiot. |
22:27:42 | * | gangstacat joined #nim |
22:28:23 | FromGitter | <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:48 | FromDiscord | <ElegantBeef> It means it has an ordinal and a string representation |
22:29:15 | FromDiscord | <Recruit_main707> disruptek: why |
22:32:00 | FromGitter | <deech> ElegantBeef: interesting, is the string repr just for display purposes? |
22:32:10 | disruptek | it's for $ purposes. |
22:32:45 | disruptek | recruit: i thought since the weather was getting cooler maybe i could fit into a large. |
22:32:59 | disruptek | nope; it's still magnums for me. |
22:44:02 | * | Vladar quit (Quit: Leaving) |
22:46:15 | disruptek | kinda amazing how much maintenance the docs require. not the strings, but the actual mechanics of the thing. |
22:46:26 | disruptek | i would have abandoned them for something 3rd party long ago. |
22:46:32 | disruptek | who needs this shit? |
22:49:52 | * | tane quit (Quit: Leaving) |
22:54:21 | * | Jesin quit (Quit: Leaving) |
22:54:29 | ForumUpdaterBot | New thread by DataPulverizer: Kernel Matrix Calculation in Nim, see https://forum.nim-lang.org/t/7071 |
22:57:19 | shadowninja55 | how can you write a uint32 to a stream? |
22:57:23 | shadowninja55 | similar to the way you can read it |
22:57:28 | disruptek | indeed. |
22:57:40 | shadowninja55 | preferably without manually converting it to a char using a memory copy or something |
22:57:42 | shadowninja55 | *char array |
23:03:32 | FromDiscord | <shadow.> i mean you can convert it using bit shifting rather than a memory copy |
23:03:45 | disruptek | you're blowin' my mind right now. |
23:03:55 | shadowninja55 | i guess i was just wondering if there's a builtin |
23:04:00 | disruptek | a what? |
23:04:09 | FromDiscord | <shadow.> yeah no i don't think there is |
23:04:21 | shadowninja55 | like a proc using file to write uint32 |
23:04:40 | shadowninja55 | like there stream.readUint32() |
23:04:47 | shadowninja55 | so i was wondering if theres stream.writeUint32() |
23:04:50 | shadowninja55 | but not that i can see |
23:05:10 | disruptek | you just write(stream, foo.uint32) |
23:05:19 | disruptek | the manual will help. |
23:05:27 | disruptek | or see how i do it here: |
23:05:30 | disruptek | !repo frosty |
23:05:31 | disbot | https://github.com/disruptek/frosty -- 9frosty: 11serialize native Nim types to strings, streams, or sockets โ 15 16โญ 0๐ด |
23:05:44 | shadowninja55 | does it write big or little endian |
23:05:49 | disruptek | who cares? |
23:05:57 | shadowninja55 | lmao fair enough |
23:06:04 | shadowninja55 | OH RIGHT |
23:06:06 | shadowninja55 | i see now |
23:06:15 | shadowninja55 | theres no reason to specify type because you're passing it anyways lmaoo |
23:06:19 | shadowninja55 | alright thanks |
23:06:22 | disruptek | sure. |
23:06:24 | shadowninja55 | so just the generic write proc works? |
23:06:26 | shadowninja55 | alr 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:01 | shadowninja55 | how can i write a uint32 using 24 bits of space? |
23:27:12 | shadowninja55 | like 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:27 | shadowninja55 | im 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:03 | FromDiscord | <ElegantBeef> `write((a or 0xff).byte)` `write(((a shr 8) or 0xff).byte)` and guess the last ๐ |
23:37:09 | FromDiscord | <ElegantBeef> Atleast... that's one way |
23:37:32 | FromDiscord | <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:04 | FromDiscord | <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:18 | shadowninja55 | well |
23:38:21 | FromDiscord | <ElegantBeef> (edit) "bool" => "byte" |
23:38:24 | shadowninja55 | im writing uint32 (colors) into a bitmap file |
23:38:35 | shadowninja55 | so i have to write it in RRGGBB format which is yk 3 bytes |
23:38:49 | * | brainproxy joined #nim |
23:38:51 | FromDiscord | <ElegantBeef> Well that makes more sense ๐ |
23:39:15 | FromDiscord | <ElegantBeef> also i messed up it's `and` not `or` |
23:39:16 | shadowninja55 | hmm |
23:39:23 | shadowninja55 | wouldnt .byte convert it to one byte instead of 3 |
23:39:33 | FromDiscord | <ElegantBeef> that's the point |
23:39:50 | shadowninja55 | so how would i write the uint32 with 3 bytes? |
23:39:50 | * | Jesin joined #nim |
23:39:52 | shadowninja55 | (24 bits) |
23:40:07 | FromDiscord | <ElegantBeef> Doing what i suggested for each byte, i only did the first two |
23:40:21 | shadowninja55 | ahh ok so then i can just bit shift out the bb gg rr values lol? |
23:40:27 | FromDiscord | <ElegantBeef> Yea |
23:40:31 | shadowninja55 | smart thanks |
23:40:53 | FromDiscord | <ElegantBeef> Alternatively you could make an `int24` and have a converter from 32 -> 24 |
23:41:03 | shadowninja55 | i doubt im smart enough for that lmaoo |
23:41:45 | FromDiscord | <ElegantBeef> The quick way is a `array[3, byte]` |
23:42:06 | shadowninja55 | so that would work? |
23:42:20 | shadowninja55 | `cast[array[3, uint8]](pixel)` |
23:42:23 | shadowninja55 | oh wait byte not uint8 |
23:42:29 | FromDiscord | <ElegantBeef> well same thinng |
23:42:30 | FromDiscord | <ElegantBeef> (edit) "thinng" => "thing" |
23:42:33 | shadowninja55 | lol ye |
23:42:36 | FromDiscord | <ElegantBeef> byte is just aliased uint8 |
23:42:40 | shadowninja55 | oh fair |
23:42:53 | FromDiscord | <ElegantBeef> I dont know if the casting would work |
23:43:11 | shadowninja55 | ill try it lol |
23:45:49 | shadowninja55 | hmm well the resulting bitmap is corrupt but that could be a number of things |
23:47:38 | FromDiscord | <ElegantBeef> You can always do something like this silliness ๐ https://play.nim-lang.org/#ix=2DIf |
23:47:54 | FromDiscord | <ElegantBeef> Most of my solutions should be ignored |
23:49:39 | shadowninja55 | lmaooo |
23:49:51 | shadowninja55 | would you mind if i dm you on discord to send you code and further explain what im tryna do? |
23:50:16 | FromDiscord | <ElegantBeef> I personally prefer helping in public as i'm clearly not all knowing |
23:50:18 | * | kinkinkijkin joined #nim |
23:50:22 | shadowninja55 | lol fair enough |
23:51:27 | shadowninja55 | ah i have a good idea |
23:51:37 | shadowninja55 | ill just compare it to the same bitmap in a hex editor and see whats wrong |
23:51:51 | shadowninja55 | FML |
23:52:05 | shadowninja55 | literally everything is working i just wrote "bm" as the file signature instead of "BM" |
23:52:10 | shadowninja55 | LMAOOO |
23:52:42 | shadowninja55 | ok it worked tyvm |
23:53:42 | FromDiscord | <ElegantBeef> Lol grats |
23:54:02 | shadowninja55 | ty |
23:54:02 | * | leorize joined #nim |
23:54:10 | shadowninja55 | has there been a bitmap reading library made before? |
23:54:14 | shadowninja55 | if not i could post it lool |
23:56:28 | FromDiscord | <ElegantBeef> I have no clue what formats these support https://nimble.directory/search?query=image |
23:56:57 | shadowninja55 | lmao fair enough |
23:57:11 | FromDiscord | <ElegantBeef> Although it could be the first purenim implementation |
23:57:17 | shadowninja55 | ive been using period my whole life for type literals should i be using apostrophe lmao |
23:57:20 | FromDiscord | <ElegantBeef> But no clue with that |
23:57:35 | FromDiscord | <Rika> period for what |
23:57:39 | FromDiscord | <ElegantBeef> you can do `10u8` |
23:57:46 | shadowninja55 | like 0.uint8 vs 0'uint8 |
23:57:46 | FromDiscord | <ElegantBeef> you dont nee `'` or `.uint8` |
23:57:48 | shadowninja55 | WHAT |
23:57:52 | shadowninja55 | fml |
23:57:58 | FromDiscord | <Rika> 0u8 will work |
23:58:07 | shadowninja55 | does that work with binary like 0xffffff |
23:58:09 | shadowninja55 | *hex |
23:58:13 | FromDiscord | <Rika> almost looks like an owo face |
23:58:19 | FromDiscord | <ElegantBeef> no you need the `'` for hex i believe |
23:58:27 | shadowninja55 | ah ok |
23:58:27 | FromDiscord | <Rika> for hex only if ambiguou |
23:58:28 | FromDiscord | <Rika> s |
23:58:45 | FromDiscord | <ElegantBeef> Ah i was wrong depends on the type |
23:58:54 | FromDiscord | <ElegantBeef> So i tend to just stick with `'` |
23:59:20 | shadowninja55 | fair enough |