00:00:46 | FromDiscord | <Recruit_main707> disruptek, (or anyone else): you said i could get the pragmas applied to a typed object, but can i do it this way somehow?↵https://play.nim-lang.org/#ix=2K39 |
00:01:49 | disruptek | the pragma goes after the `object` keyword. |
00:02:20 | FromDiscord | <Recruit_main707> ah, ty |
00:03:00 | FromDiscord | <sealmove> @disruptek it seems to be an issue when nesting tuples more than 2 levels |
00:03:15 | disruptek | neat. |
00:03:29 | disruptek | if you produce a bug report, i will produce a fix. |
00:03:36 | disruptek | but, json is not really human-readable. |
00:04:28 | disruptek | and, further, jason does not include a deserializer (yet). |
00:04:38 | FromDiscord | <sealmove> https://play.nim-lang.org/#ix=2K3b |
00:05:06 | FromDiscord | <sealmove> ok but there are deserializers for json |
00:06:20 | FromDiscord | <mratsim> nim-json-serialization should work fine btw |
00:06:25 | FromDiscord | <mratsim> we use it very often |
00:06:53 | FromDiscord | <Deleted User 5bd78114> I meant 32- |
00:07:23 | disruptek | i was gonna benchmark nim-json-serialization until i got a look at the dependencies. |
00:07:27 | FromDiscord | <mratsim> the call is just JSON.encode(data, file) and Json.decode(...) |
00:07:29 | FromDiscord | <Deleted User 5bd78114> ~~Also, has someone written a C compiler in Nim?-~~ |
00:08:19 | FromDiscord | <mratsim> the dependencies should be stew and nim-serialization I think |
00:08:57 | FromDiscord | <mratsim> unless faststreams was added |
00:12:00 | FromDiscord | <Deleted User 5bd78114> ~~And yes this is for the JVM thing, and in a be adding extra functions to the compiler thAt normal compilers can't use, so kinda like a superset of C in a way-~~ |
00:16:10 | FromDiscord | <Deleted User 5bd78114> Actually, so I can learn something useful, I'm gonna rewrite a compiler in Nim- (probably TCC) |
00:16:53 | * | Vladar quit (Quit: Leaving) |
00:23:55 | FromDiscord | <mratsim> have a look at nanopass @Deleted User 5bd78114 that might help you do it step by step |
00:27:32 | FromDiscord | <sealmove> mratsim, nim-json-serialization seems to work nicely :) thanks for pointing it out, I hadn't heard of this repo |
00:27:50 | * | krux02 quit (Remote host closed the connection) |
00:28:48 | FromDiscord | <sealmove> one question: `toJson` outputs a string instead of `JsonNode`. This string is not prettified. Is there a way to get it prettified? |
00:29:07 | FromDiscord | <ElegantBeef> `.pretty` atleast in the stdlib |
00:29:34 | FromDiscord | <sealmove> stdlib's `pretty` takes a `JsonNode`, not `string... |
00:30:02 | FromDiscord | <ElegantBeef> Seems like a case of "well yea" |
00:30:51 | FromDiscord | <sealmove> oh, nvm, nim-json-serialization's `toJson` can take a named argument to configure this, just saw in tests. |
00:30:52 | FromDiscord | <ElegantBeef> The package you mentioned has a optional argument of `pretty` |
00:30:59 | FromDiscord | <sealmove> yeah just noticed, nice |
00:31:59 | FromDiscord | <mratsim> it's for serialization only and JsonNode are not necessary for serialization |
00:32:01 | FromDiscord | <mratsim> we directly output the string |
00:36:11 | FromDiscord | <sealmove> everything works nicely combined with stdlib's json :) I am pretty happy |
00:36:20 | FromDiscord | <Deleted User 5bd78114> Thanks! |
00:37:31 | FromDiscord | <sealmove> with this + binarylang I can allow a user to edit an arbitrary file in json format!! |
00:37:45 | FromDiscord | <sealmove> you can edit an elf file in json format :P |
00:41:20 | stefantalpalaru | How do I print a table from gdb? |
00:44:12 | FromGitter | <ynfle> Are you using `nim-gdb`? |
00:50:35 | stefantalpalaru | No. |
00:53:03 | stefantalpalaru | I found the corresponding "dollar___...." function that I can call on the table struct pointer and that works. |
00:55:42 | FromGitter | <ynfle> I suggest look at the `nim-gdb` executable in your nim installation |
00:56:38 | FromDiscord | <ElegantBeef> @sealmove what does/is binarylang 😄 |
00:57:33 | FromDiscord | <sealmove> It's a fork of binaryparse. A DSL for parsing binary data in Nim tuples. |
00:58:29 | FromDiscord | <sealmove> I've achieved: binary <-> nim <-> json :) |
01:00:02 | FromDiscord | <ElegantBeef> So a shitty example is png, you can parse it into json, then modify colours by hand and convert back to a usable png? |
01:00:31 | FromDiscord | <ElegantBeef> Or is it for more primitive file types |
01:01:33 | FromDiscord | <sealmove> now writing a simple cli tool which leverages those. so you can just do `binaryedit --parse-to-json myFormat myFile` and get a json with its structured info, and `binaryedit --encode-from-json myFormat myJsonFile`, something like that. |
01:01:46 | FromDiscord | <sealmove> ElegantBeef yeah exactly |
01:02:00 | FromDiscord | <sealmove> no, you can definately do png or anything else :) |
01:02:36 | FromDiscord | <Deleted User 5bd78114> Oo interesting! But I'm assuming it'll be hard to automate anything like that (automatically editing files via your code with specific values) |
01:05:59 | FromDiscord | <sealmove> not at all |
01:06:06 | FromDiscord | <sealmove> for automation you wouldn't use json |
01:06:16 | FromDiscord | <sealmove> you can operate directly on the nim tuples |
01:06:33 | planetis[m] | how does the status json lib deals with partially constructed objects? |
01:07:25 | planetis[m] | also what time it is seal? 😉 |
01:07:53 | FromDiscord | <Deleted User 5bd78114> Oh? |
01:07:53 | FromDiscord | <sealmove> you know what time it is :P we live in the same country |
01:08:24 | planetis[m] | haha gn |
01:08:35 | FromDiscord | <sealmove> gn! |
01:22:15 | FromDiscord | <!!WalrusNoj> hey guys idk but i am trying to prank my friend and this code is not working, any ideas why? |
01:22:25 | FromDiscord | <!!WalrusNoj> sent a code paste, see https://play.nim-lang.org/#ix=2K3o |
01:25:30 | FromDiscord | <shadow.> try running it with `-d:release` |
01:25:32 | FromDiscord | <ElegantBeef> Not working isnt very descriptive |
01:25:45 | FromDiscord | <!!WalrusNoj> the browser will not open |
01:26:11 | FromDiscord | <!!WalrusNoj> uhh `-d:release` changed nothing |
01:26:15 | FromDiscord | <shadow.> twas a joke |
01:26:24 | FromDiscord | <!!WalrusNoj> oh |
01:26:32 | FromDiscord | <shadow.> is there an error message |
01:26:33 | FromDiscord | <!!WalrusNoj> it wasn't a very good joke fyi |
01:26:36 | FromDiscord | <!!WalrusNoj> no |
01:26:37 | FromDiscord | <shadow.> i know. |
01:26:39 | FromDiscord | <shadow.> what |
01:26:42 | FromDiscord | <shadow.> no error message |
01:26:53 | FromDiscord | <!!WalrusNoj> no error message |
01:26:55 | FromDiscord | <shadow.> LeT mE tEsT iT LoCaLLy |
01:27:03 | FromDiscord | <!!WalrusNoj> just will not open the browser |
01:27:04 | FromDiscord | <ElegantBeef> What OS? |
01:27:28 | FromDiscord | <!!WalrusNoj> hanana montana linux |
01:27:37 | FromDiscord | <shadow.> dyou mean hannah my guy |
01:27:39 | FromDiscord | <!!WalrusNoj> no |
01:27:57 | FromDiscord | <ElegantBeef> Well it'll only work if `xdg-open` is set for urls |
01:28:23 | FromDiscord | <!!WalrusNoj> is XDG a crypto curency? |
01:28:30 | FromDiscord | <shadow.> go check |
01:28:40 | FromDiscord | <ElegantBeef> if `xdg-open "https://nim-lang.org"` doesnt open a browser, nim cannot |
01:28:41 | mipri | https://freedesktop.org/wiki/Software/xdg-utils/ |
01:29:35 | mipri | literally: const osOpenCmd* = when defined(macos) or defined(macosx) or defined(windows): "open" else: "xdg-open" |
01:30:04 | FromDiscord | <!!WalrusNoj> does nim pass the URL directly to system? |
01:30:23 | mipri | discard startProcess(command = b, args = [url], options = {poUsePath}) |
01:31:08 | FromDiscord | <!!WalrusNoj> oh ok gotcha it all makes sense now, i think it is because i ran it with python |
01:31:15 | FromDiscord | <shadow.> try ruby instead |
01:31:24 | mipri | well after execShellCmd(osOpenCmd & " " & u) , which isn't as nice, it relies on quoteShell |
01:31:24 | FromDiscord | <shadow.> ive heard it gives good results for interpreting nim |
01:32:52 | FromDiscord | <ElegantBeef> Not nearly aswell as common lisp |
01:33:20 | FromDiscord | <shadow.> i prefer clojure for my nim projects |
01:34:03 | FromDiscord | <!!WalrusNoj> uhh guys so i think i am suppost to add nim into my NGINX config file for it to run on peoples browsers? |
01:34:40 | FromDiscord | <ElegantBeef> "run on peoples browsers"? |
01:34:56 | FromDiscord | <shadow.> what if it wants to walk instead |
01:35:03 | FromDiscord | <!!WalrusNoj> yes |
01:35:13 | FromDiscord | <!!WalrusNoj> like how HTML runs on peoples browsers |
01:35:16 | FromDiscord | <shadow.> goodbye |
01:36:31 | FromDiscord | <ElegantBeef> Cant tell if they're being real, or just trolling/wasting time |
01:37:04 | FromDiscord | <shadow.> hm |
01:37:07 | FromDiscord | <shadow.> well |
01:37:15 | FromDiscord | <shadow.> try decoding the string in his example |
01:37:31 | FromDiscord | <shadow.> might help clear that up 💀 |
01:37:38 | mipri | why are you citing the only real part of the conversation as proof that it was fake? |
01:38:02 | mipri | the video makes sense as a thing to prank a friend with. |
01:38:18 | FromDiscord | <shadow.> fair enough |
01:38:19 | mipri | it was all non-real from there. |
01:38:43 | FromDiscord | <shadow.> disruptek would have a blast if he were here |
01:38:48 | * | clyybber quit (Quit: WeeChat 3.0) |
01:39:09 | FromDiscord | <ElegantBeef> Seems they were introduced to nim, and decided "Oh shit it's funny how it has features like style insensitivity, let's go annoy them with it" |
01:39:27 | FromDiscord | <shadow.> yeah fair enough |
01:42:02 | FromDiscord | <!!WalrusNoj> no nim is cool i am just being silly sorrty |
01:43:51 | FromDiscord | <Deleted User 5bd78114> No, the NGINX config is something different, you need to set it up to work with the correct address and port, you don't add Nim to it for it to work |
01:44:13 | FromDiscord | <Deleted User 5bd78114> I know I'm not the smartest, but he was definitely genuinely confused |
01:44:28 | FromDiscord | <shadow.> hm |
01:44:48 | FromDiscord | <shadow.> @!!WalrusNoj can we see your hannah montana linux |
01:45:01 | FromDiscord | <!!WalrusNoj> yeah ill call you and i can screen share |
01:45:03 | FromDiscord | <!!WalrusNoj> ok> |
01:45:08 | FromDiscord | <shadow.> lol im good |
01:45:11 | FromDiscord | <!!WalrusNoj> oh ok |
01:45:16 | FromDiscord | <!!WalrusNoj> it's really cool tho |
01:45:43 | FromDiscord | <!!WalrusNoj> like its basically just ubuntu... but better |
02:03:35 | FromDiscord | <Deleted User 5bd78114> Hah, you use an OS? I just use the Linux kernel directly- |
02:09:28 | FromDiscord | <shadow.> you use a kernel? i just execute my nim by hand |
02:09:49 | FromDiscord | <Deleted User 5bd78114> Woah- |
02:11:14 | FromDiscord | <shadow.> wtf is a stack and a heap i just use my hippcampus |
02:11:37 | FromDiscord | <shadow.> (edit) "hippcampus" => "hippocampus" |
02:14:49 | FromDiscord | <shadow.> lol |
02:14:50 | FromDiscord | <Deleted User 5bd78114> Wtf is a brain I just use oxygen- |
02:14:53 | FromDiscord | <Deleted User 5bd78114> XD |
02:15:05 | FromDiscord | <shadow.> damnn wtf im anaeroebic imagine needing o2 cringe |
02:20:17 | FromDiscord | <Deleted User 5bd78114> Oh, I don't breathe it, I just idly break down the atoms for energy so I don't need food- |
02:27:47 | FromDiscord | <Meowz> If anyone is bored I'm not sure how I could solve it: https://play.nim-lang.org/#ix=2K3y |
02:31:06 | mipri | solve what? |
02:36:38 | mipri | 1. "I can't import fmt", the name of the module is strformat. 2. "I get an error on get_module", you're not calling passing the pid argument. 3. "I don't know how to get the right pid", you're already depending on the /proc filesystem, try scanning it to decide. 4. "it's not using libnettle.so", you're not doing anything with that argument. 5. "this doesn't work on windows", don't use the /proc filesystem then. 6. "my code is hard to read because of this gian |
02:44:23 | FromDiscord | <Meowz> Well, of course this code isn't ready to run and doesn't does anything. Sorry I thought it's pretty clear what I'm trying to do: I'm trying to parse the load modules of a linux process. Which are listed in the maps file located in /proc/pid/maps. The expected output is at the end of the code. |
02:46:21 | mipri | https://nim-lang.org/docs/strscans.html use $h |
02:56:43 | FromDiscord | <ElegantBeef> Cant wait for 1.6 so scanTuple can be used 😄 |
03:18:29 | FromDiscord | <shadow.> exactly |
03:18:42 | FromDiscord | <shadow.> its so much cleaner lol |
03:34:16 | FromDiscord | <Deleted User 5bd78114> What's scanTuple? |
03:34:17 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:34:37 | FromDiscord | <ElegantBeef> Scanf but without predeclaring variables |
03:34:51 | FromDiscord | <Deleted User 5bd78114> Oo nice |
03:35:10 | FromDiscord | <ElegantBeef> https://nim-lang.github.io/Nim/strscans.html#scanTuple.m%2Cuntyped%2Cstatic%5Bstring%5D%2Cvarargs%5Buntyped%5D dev logs if you want a usecase |
03:35:22 | FromDiscord | <ElegantBeef> dev docs |
03:37:15 | FromDiscord | <Deleted User 5bd78114> Thanks! |
03:41:32 | * | abm quit (Read error: Connection reset by peer) |
03:46:59 | * | audiofile joined #nim |
03:55:09 | leorize | ls |
03:55:11 | leorize | oops |
03:55:22 | FromDiscord | <ElegantBeef> This isnt your terminal |
03:55:43 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:56:38 | FromDiscord | <Deleted User 5bd78114> `/usr/bin/nim` |
03:56:45 | FromDiscord | <Deleted User 5bd78114> It is now- |
03:57:43 | * | muffindrake joined #nim |
04:32:45 | * | vicfred quit (Quit: Leaving) |
04:45:05 | * | spiderstew joined #nim |
04:45:14 | FromDiscord | <shadow.> hm |
04:45:51 | FromDiscord | <shadow.> :(){ :|:& };: |
04:45:55 | FromDiscord | <shadow.> darn. |
04:46:37 | * | spiderstew_ quit (Ping timeout: 260 seconds) |
05:07:14 | * | disruptek is now known as asd |
05:08:49 | asd | leorize: ping |
05:10:28 | leorize[m] | o/ |
05:10:46 | asd | hey i got something weird, wonder if you have seen it before. |
05:10:58 | asd | https://github.com/disruptek/jason/pull/2/checks?check_run_id=1615901447 |
05:10:58 | disbot | ➥ especially nested tuples do not compile |
05:11:13 | asd | on osx, a test failure does not seem to raise in nimble. |
05:12:08 | asd | nim seems to know that it failed, and testes knows, but a `quit 1` doesn't seem to reach nimble. |
05:13:45 | leorize[m] | i have never seen anything like this |
05:14:10 | leorize[m] | either nimble is broken or something is wrong with github's bash on osx |
05:14:18 | asd | i'm not crazy, right? |
05:14:21 | leorize[m] | and, uh, my bets are on nimble |
05:15:46 | asd | i guess i will rtfs. |
05:15:59 | asd | thanks. |
05:38:11 | * | a_chou joined #nim |
05:55:00 | * | kungtotte quit (Read error: Connection reset by peer) |
05:55:44 | * | kungtotte joined #nim |
06:11:05 | * | narimiran joined #nim |
06:13:54 | * | NimBot joined #nim |
06:21:18 | * | habamax joined #nim |
06:22:25 | * | narimiran quit (Ping timeout: 264 seconds) |
06:23:00 | * | narimiran joined #nim |
06:30:22 | FromDiscord | <flywind> Can Nim repo open discussion in Github? It may be more friendly for newcomers and make link cross referencing better. |
06:37:48 | asd | i'd prefer it but i doubt araq or dom will go for it, due to a sense of propriety towards their product. |
06:38:21 | Araq | huh? |
06:39:02 | mipri | is there a "you transfer ownership of your project to Microsoft" clause that's signed when discussions are opened? |
06:40:08 | asd | araq: you don't want to replace the web-site with something not written in nim, regardless of how much superior it might be. 😉 |
06:40:17 | Araq | we have our forum for discussions and that's why I mind github "discussion" |
06:41:02 | FromDiscord | <ElegantBeef> it does seem pretty redundant considering the forum exists and is usable |
06:41:20 | asd | i'm not a fan. |
06:42:37 | Araq | that's fine. |
06:48:37 | asd | suit yourself. but if github's product is not already superior, it will be soon, and when you finally migrate you'll have more legacy data. |
06:49:18 | Araq | and when the "when" is never i will never have any legacy data. |
06:50:54 | mipri | that's a weakness in itself: it's a product that you can't migrate legacy data to because you don't control the database. |
06:51:15 | asd | i don't care. |
06:52:01 | asd | there's nothing in the database that i care about, and at this rate, there never will be. |
06:52:04 | mipri | there's another useless factoid about your opinions that I've gained. |
06:54:35 | Araq | look how much I care about your opinion. |
07:02:15 | Araq | it's a forum software, it works well, it's open source, it can be improved. "superior product over there", give me a break. it's a forum, not an AI powered car. |
07:20:28 | Avahe[m] | Open source and controlled by the Nim team wins for me. MS could paywall or delete GitHub overnight |
07:30:28 | FromDiscord | <ElegantBeef> So you use every single platform to talk here? |
07:30:35 | FromDiscord | <ElegantBeef> Matrix, discord, and irc 😄 |
07:31:24 | FromDiscord | <Rika> Am I being demented or have I not seen this asd person before a few days ago |
07:31:29 | FromDiscord | <ElegantBeef> It's disruptek |
07:31:53 | FromDiscord | <Rika> I still don’t believe you |
07:32:01 | FromDiscord | <ElegantBeef> https://discord.com/channels/371759389889003530/371759389889003532/792982860160172053 |
07:32:40 | FromDiscord | <Rika> Why would disruptek change his beautiful name |
07:33:37 | asd | spite and vanity. |
07:34:34 | asd | someone keeps attempting to login on my altnick and sometimes they actually succeed, so i'm trying to thwart them. |
07:35:25 | asd | plus, i got worried that mipri had blocked me because i hadn't heard a snarky remark in a week or so. |
07:36:56 | FromDiscord | <Rika> I have to agree with bdfl on the forum issue, though it would be nice if we could mirror stuff from GitHub -> Forum |
07:37:11 | FromDiscord | <Rika> If we were to use GitHub discussions I mean |
07:37:40 | mipri | no blocks here. it's been a week of productive talk about cps as I recall, anyway |
07:37:41 | asd | that actually makes a lot of sense. |
07:37:57 | asd | why don't you impl it? |
07:38:08 | asd | !repo disruptek/github |
07:38:08 | disbot | https://github.com/disruptek/github -- 9github: 11github api v3 for nim 15 7⭐ 0🍴 |
07:38:11 | * | superbia joined #nim |
07:38:30 | * | superbia quit (Client Quit) |
07:39:30 | FromDiscord | <Rika> Because I’m too dumb for it lol |
07:39:46 | asd | unlikely. |
07:39:53 | Avahe[m] | Beef - I'm locked out of Discord cuz they want my phone number. On vacation, so I can't access irc (have an IP address whitelist) |
07:39:57 | FromDiscord | <Rika> Nor do I exactly have the time for it (maybe I do for this week but not after) |
07:40:16 | FromDiscord | <Rika> I’ll think about it when I’m bored |
07:42:52 | asd | i need the new openapi schema impl before i can generate the new github api to support discussions. 🙁 |
07:43:04 | asd | !repo disruptek/openapi |
07:43:05 | disbot | query failed 😢 |
07:43:14 | asd | disbot: are you high? |
07:43:15 | disbot | you may rely on it. |
07:43:18 | asd | !repo openapi |
07:43:19 | disbot | query failed 😢 |
07:45:41 | * | notchris quit (Read error: Connection reset by peer) |
07:45:42 | asd | disbot: will you let me know when github is up? |
07:45:43 | disbot | ask again later. |
07:45:55 | asd | disbot: yeah, that's what i'm saying. ping me. |
07:45:56 | disbot | 😕 |
07:46:01 | asd | DO IT. |
07:47:15 | * | notchris joined #nim |
07:48:08 | Zevv | disruptek |
07:49:37 | * | letto quit (Quit: Konversation terminated!) |
07:49:47 | asd | disbot: is it really up? |
07:49:48 | disbot | signs point to yes. |
07:50:04 | asd | !repo openapi |
07:50:05 | disbot | https://github.com/disruptek/openapi -- 9openapi: 11OpenAPI Code Generator for Nim 15 35⭐ 2🍴 7& 5 more... |
07:50:08 | asd | nice. |
07:51:21 | FromDiscord | <ElegantBeef> Do you ever speak to bentley and expect a response in english? |
07:51:55 | asd | nah; he doesn't talk to me anymore. |
07:52:11 | asd | i think he must be pissed that i gave up ketamine. |
07:52:44 | asd | believe me, it wasn't by choice. |
07:52:50 | * | letto joined #nim |
07:54:02 | FromDiscord | <ElegantBeef> The depth of "where does the joke end and sincerity begin" |
07:55:44 | asd | there's nothing funny about ketamine withdrawal. |
08:00:58 | * | PMunch joined #nim |
08:03:32 | * | a_chou quit (Remote host closed the connection) |
08:04:46 | Zevv | disruptek: do you properly understand mamys new changes yet? |
08:07:19 | Avahe[m] | 4raq's comment at the end is interesting https://forum.nim-lang.org/t/7283 but I wonder how many people are using nimscript for places where speed matters |
08:08:05 | Zevv | it influences compilation time |
08:08:27 | FromDiscord | <ElegantBeef> Pretty much nowhere as it's not overly capable without the libffi flag |
08:08:43 | Avahe[m] | Zevv: good point |
08:09:34 | FromDiscord | <ElegantBeef> Doesnt it only influence compilation for macros? |
08:09:42 | Zevv | If full of good points. I'm just reluctant to let them out too often |
08:09:55 | Zevv | ElegantBeef: true |
08:10:14 | FromDiscord | <ElegantBeef> Well anything that is compile-time is more accurate, static and the like |
08:10:58 | FromDiscord | <ElegantBeef> But i generally dont think many people are using nimscript in performance heavy situations, since it's not capable with stable release nim |
08:10:59 | Zevv | let me see, I added profiling to the VM some time ago |
08:11:02 | * | Jjp137 quit (Ping timeout: 260 seconds) |
08:11:12 | Zevv | ah --profileVM:on |
08:11:18 | * | Jjp137 joined #nim |
08:18:29 | Zevv | asd |
08:29:19 | FromDiscord | <tomck> Hello! Is there a slice type in nim that's not openArray? |
08:29:40 | PMunch | Depends on hat you want it for |
08:29:43 | PMunch | what* |
08:30:05 | FromDiscord | <tomck> I'm trying to use an `Option[openArray[T]]`, and it's not letting me use `get` because `result cannot be assigned to` within the implementation |
08:30:15 | FromDiscord | <tomck> literally just an pointer + a length |
08:31:12 | FromDiscord | <tomck> openarray also has weird problems inside closures, which is understandable if it can only be used as a parameter type for whatever reason |
08:31:33 | FromDiscord | <tomck> but since openArray is basically unusable for some cases, that leaves nim with no good way to pass around non-owned lists of stuff |
08:32:08 | FromDiscord | <tomck> which is quite shit for recursive algorithms that recursively call with a subslice of the input each time |
08:32:21 | PMunch | Well you can pass a pointer and an offset/length.. |
08:32:35 | FromDiscord | <tomck> yeah so far i've just been doing that, but that's pretty ugly |
08:32:50 | PMunch | Make a module out of it :) |
08:33:07 | PMunch | Like I did for string slices: https://github.com/PMunch/strslice |
08:33:13 | FromDiscord | <tomck> Yeah, but something fundamental like a slice type is useless in a module |
08:33:23 | Zevv | mratsim: can you explain the reason why this setlen / [^1] = move is there? Simply doing an .add breaks things, but I don't see yet why |
08:34:55 | FromDiscord | <tomck> Is there another way to pass an optional openArray? |
08:35:15 | PMunch | An openArray and a separate bool I guess |
08:35:28 | FromDiscord | <tomck> what, then pass [] in place of the openArray? |
08:35:33 | PMunch | It's a bit weird that it doesn't work in the Option type tough |
08:35:59 | mipri | the good way to pass around non-owned lists of stuff is {.experimental: "views".}, but it's not there yet. |
08:36:05 | FromDiscord | <tomck> Is there any plan for an actual official slice type? this is probably the biggest problem i've had with nim so far |
08:36:38 | FromDiscord | <ElegantBeef> Views are on their way, which will encourage the non coping style stuff in the stdlib |
08:36:55 | FromDiscord | <tomck> is the reason why openArray can only be used as a parameter because nim wants to do some extra optimisations for the case where an array isn't in memory (& therefore can't be a ptr + len)? |
08:37:19 | mipri | https://nim-lang.org/docs/manual_experimental.html#view-types . part of it is removing the restrictions on openArray |
08:37:23 | FromDiscord | <tomck> will views make openArray a first class type? |
08:37:26 | FromDiscord | <tomck> right, i see |
08:37:26 | FromDiscord | <ElegantBeef> Yes |
08:37:45 | FromDiscord | <tomck> how 'experimental' is this lol |
08:37:46 | FromDiscord | <ElegantBeef> same with `var T` |
08:38:15 | FromDiscord | <tomck> are we talking 'probably won't work', or 'basically works, just not merged'? |
08:38:35 | mipri | experimental to the point that you'll run easily run into nasty codegen bugs, behavior-changing ones that don't error out at the worst. |
08:38:46 | FromDiscord | <tomck> righto |
08:38:52 | FromDiscord | <tomck> i shall be making my own slice type;) |
08:39:12 | FromDiscord | <ElegantBeef> Good times will come with views 😄 |
08:41:47 | FromDiscord | <ElegantBeef> It's sad that all the current string operations return new strings, do like to see the strslice pmunch, but i guess i need to make some PRs for iterators 😄 |
08:42:34 | FromDiscord | <tomck> is that strslice module the only way to handle non-owned strings atm? |
08:42:42 | FromDiscord | <tomck> i'm not going to start using openArray[char] lol |
08:43:35 | FromDiscord | <ElegantBeef> It's probably one of the best ways, though idk about `start/stop` when we have a slice type 😄 |
08:45:45 | FromDiscord | <tomck> start/stop? |
08:47:21 | * | Torro joined #nim |
08:47:57 | FromDiscord | <ElegantBeef> his name for the index for the begining and end of the slice |
08:50:08 | saem | And that's all the attention I'm probably willing to give GDB for now. it seems better (\o/) because it shows more info, so that's a win? |
08:51:02 | * | Jjp137 quit (Ping timeout: 260 seconds) |
08:51:24 | FromDiscord | <ElegantBeef> "you've fucked up" is technically more info |
08:51:25 | saem | Anyone who uses GDB with Nim, mind giving it a whirl and letting me know if it's better/worse/same compared to their prior experience? https://github.com/nim-lang/Nim/pull/16479 -- just grab nim-gdb.py. |
08:51:26 | disbot | ➥ Attempts at improving nim-gdb.py |
08:51:30 | FromDiscord | <asie> one thing I've ran into with porting the 1991 game engine to Nim is that said game engine, being written in the Turbo Pascal days, is built pretty much entirely on uint8s and int16s... which necessiate a lot of casting/conversion in Nim, it seems |
08:52:10 | PMunch | @asie, sometimes you just end up throwing a `converter` in there |
08:52:13 | saem | Instructions are in there for setting it up with VS Code |
08:52:32 | FromDiscord | <asie> huh |
08:53:14 | FromDiscord | <ElegantBeef> converter are for implict conversions and as such are dangerous |
08:53:49 | PMunch | True, but the ergonomics of casting everywhere is just painful |
08:53:54 | FromDiscord | <ElegantBeef> Yea |
08:54:06 | FromDiscord | <asie> I am aware; an uint8->int16 conversion is, however, safe |
08:54:10 | FromDiscord | <asie> (edit) "I am aware; an uint8->int16 conversion is, however, ... safeone" added "a" | "asafe ... " added "one" |
08:54:12 | FromDiscord | <asie> (edit) "I am aware; an uint8->int16 conversion is, however, a safe one ... " added "in range" |
08:54:25 | * | Jjp137 joined #nim |
08:54:27 | FromDiscord | <ElegantBeef> Yes, but not always type safe |
08:54:31 | FromDiscord | <asie> and since that's the two types the codebase works with (Byte and Integer), well |
08:54:57 | FromDiscord | <ElegantBeef> But yea you might use them just to make it less painful |
08:54:58 | FromDiscord | <asie> yes, but I'm not going to write explicit casts into the entire codebase - I'm evaluating porting something that's 30 years old with thousands of user-created worlds; breakage is not an option and behaviour must be adhered to closely |
08:55:07 | FromDiscord | <asie> (edit) "yes, but I'm not going to write explicit casts into the entire codebase - I'm evaluating porting something that's 30 years old with thousands of user-created worlds; breakage is not an option and behaviour must be adhered to ... closely" added "incredibly" |
08:55:16 | FromDiscord | <ElegantBeef> I'm not saying dont use them, just pointing out possible pain points 😄 |
08:55:30 | FromDiscord | <asie> if I suffer it's on me; previous attempts included C++ without STL to minimize executable size |
08:55:31 | PMunch | Unfortunately not really possible IIRC, but it would be neat if Nim could do a forward type-inference for ints :P |
08:56:00 | FromDiscord | <ElegantBeef> Yea one fancy thing from Rust i've seen and liked |
08:56:43 | FromDiscord | <ElegantBeef> Just think about being able to do it with sequences so `var thisIsASeq = @[]` wouldnt complain 😄 |
08:58:14 | FromDiscord | <asie> doing `for i in (0'i16 + 1'i16) .. (ts.count + 1'i16):` is kind of annoying too, but I don't see a better way |
08:58:31 | FromDiscord | <ElegantBeef> 0i16 |
08:58:42 | FromDiscord | <ElegantBeef> removes 1 `'` 😄 |
08:58:43 | FromDiscord | <asie> I don't think the `'` is my problem here 😄 |
08:59:00 | FromDiscord | <asie> I mean I could return an int here; it's just that I'm trying to transcribe an old codebase with minimal changes |
08:59:01 | FromDiscord | <asie> (edit) "I mean I could return an int here; it's just that I'm trying to transcribe an old codebase with minimal changes ... " added "first" |
08:59:08 | FromDiscord | <ElegantBeef> why are you doing `0 + 1` there? |
08:59:44 | FromDiscord | <asie> I'm using a `ptr UncheckedArray[Stat]` and `[]`/`[]=` operator overloads to hide certain edge cases |
09:00:12 | FromDiscord | <asie> for instance, the engine likes to return `-1` for a Stat which is not found; on DOS, this just reads outside the bounds of the Stat array (`[0... MAX_STAT + 1]`) |
09:00:30 | FromDiscord | <asie> but on a modern machine this would just break, so I make a slightly bigger array which also covers -1, hardcode the expected values, and prevent writes to it |
09:00:40 | FromDiscord | <asie> and before you ask - yes, user-created worlds do depend on this behaviour too |
09:00:55 | FromDiscord | <asie> (edit) "values," => "values (that area of memory just happens to be constant)" |
09:01:19 | FromDiscord | <asie> this lets me make things like element logic look identical to what they did in the original Pascal, hiding the ugly details in a `StatStore` object |
09:01:22 | * | saem_ joined #nim |
09:01:52 | FromDiscord | <asie> (on a modern machine or with any memory layout other than the original executable's. it was last updated in 1992 and the source code only reconstructed in 2020) |
09:02:01 | FromDiscord | <asie> (edit) "2020)" => "2020; so people rely on literally every trick in the book there is)" |
09:02:25 | * | saem quit (Remote host closed the connection) |
09:02:25 | * | saem_ is now known as saem |
09:02:38 | FromDiscord | <asie> for additional context: the game's ZZT and the original code was made with Turbo Pascal 5.5 |
09:05:11 | FromDiscord | <asie> it is an edge case; C++/STL and Nim are in the runnings; Rust and co. are LLVM-only and so provide insufficient portability for my plans (particularly regarding old game consoles like Dreamcast - SuperH - or old microcomputers based on the 68000 architecture) |
09:05:23 | FromDiscord | <asie> (edit) "architecture)" => "architecture), while C is a bit too annoying to work with for string-heavy stuff" |
09:11:11 | saem | IRCCloud on my phone, what could possibly go wrong? |
09:13:05 | FromDiscord | <ElegantBeef> The cloud could rain and damage your phone |
09:19:13 | saem | Nah, that's what the firewall is for |
09:19:26 | saem | Fire makes the water go away |
09:19:32 | FromDiscord | <Rika> That’s just a wall, not a ceiling |
09:22:04 | saem | I'm Canadian, we live in igloos... walls, ceiling, all the same thing. |
09:22:19 | FromDiscord | <flywind> https://dev.to/xflywind/wrap-const-char-in-the-nim-language-53no |
09:22:28 | FromDiscord | <Rika> Bet y’all use the heretic Robertson screw as well (/s) |
09:23:54 | saem | Oh yeah, the Robertson's are my neighbors. |
09:39:03 | FromDiscord | <ElegantBeef> You're damn right we do |
09:39:08 | FromDiscord | <ElegantBeef> And we're proud of it |
09:39:23 | * | krux02 joined #nim |
09:42:41 | FromDiscord | <ElegantBeef> Next rika will say something like "Bet you like poutine" |
09:43:07 | PMunch | I tried to make Poutine once |
09:43:10 | PMunch | Pretty good stuff |
09:43:28 | FromDiscord | <ElegantBeef> Accidentally made a pizza instead, eh? 😛 |
09:43:39 | PMunch | Didn't have the correct cheese stuff though, so ended up using Mozzarella |
09:44:02 | PMunch | Nonono, fried my own fries, made the gravy |
09:44:06 | FromDiscord | <ElegantBeef> Cheese curds are proper, but rarely i see |
09:44:22 | FromDiscord | <ElegantBeef> (edit) "Cheese curds are proper, but rarely i see ... " added "them used" |
09:44:30 | PMunch | Oh really? |
09:44:39 | PMunch | I thought that was the default in Canada |
09:45:36 | FromDiscord | <ElegantBeef> I mean i'm on the west side of the country, not really near the populace of quebec |
09:46:12 | PMunch | Ah right |
09:46:18 | FromDiscord | <ElegantBeef> This is rural Canada where things arent done properly |
09:46:20 | FromDiscord | <mratsim> I didn't check "add", I'm surprised that it doesn't work. The setLen + move is a reminder that we want Isolated and enforce unique instance of continuation. |
09:46:58 | FromDiscord | <ElegantBeef> So saem, is nim suggest next? |
09:47:32 | FromDiscord | <mratsim> The reason why it's experimental is because safe usage of views require a borrow checker to avoid capturing a memory location and the capture outlives the owner.↵And borrow checkers take a long time to develop and to iron out bugs. |
09:49:04 | saem | I'm also on the west coast, hard to find proper poutine. My favorite place that did it justice closed down. |
09:49:43 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:51:55 | saem | ElegantBeef: yeah, I can now start poking at some of the crashes with GDB. Before that I can see at least two improvements to get my feet wet. 1. Bug I haven't reported in findProjectNimFile and 2. Make suggestions take deprecation into account for prioritization. |
09:52:07 | FromDiscord | <ElegantBeef> No one said the "west coast" |
09:52:18 | FromDiscord | <ElegantBeef> I'm in Alberta |
09:52:20 | FromDiscord | <mratsim> @tomck here is my custom owned slice type for tensors: https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/laser/tensor/datatypes.nim#L28-L40↵with sanitized access so that you don't mutate a tensor declared "let" https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/laser/tensor/datatypes.nim#L133-L210 |
09:52:23 | FromDiscord | <ElegantBeef> We exist |
09:52:43 | FromDiscord | <ElegantBeef> Ah nice |
09:53:19 | saem | We both no that's not true it goes Ontario, the void, and Vancouver. |
09:53:20 | FromDiscord | <ElegantBeef> Seeing cachelines and the size mentioned in comments is new 😛 |
09:54:11 | FromDiscord | <ElegantBeef> I mean that's what the most vocal albertans i hear say yall think of alberta 😛 |
09:54:12 | FromDiscord | <mratsim> you have to in high performance computing |
09:55:24 | FromDiscord | <mratsim> here you have register size mentioned: https://github.com/numforge/laser/blob/master/laser/primitives/matrix_multiplication/gemm_tiling.nim#L111-L146 |
09:55:56 | FromDiscord | <mratsim> Here the TLB, L1 and L2 cache: https://github.com/numforge/laser/blob/master/laser/primitives/matrix_multiplication/gemm_tiling.nim#L111-L146 |
09:56:32 | FromDiscord | <mratsim> the speed differences are easily in the 10 to 30% by changing the parameters |
09:56:46 | FromDiscord | <mratsim> and not doing thoe optimization will make your code 100x slower |
09:57:14 | FromDiscord | <ElegantBeef> Yea i know it matters, was just interesting to see |
09:57:45 | FromDiscord | <mratsim> so I need to have the sizes take little space so that they don't pollute memory. |
09:58:12 | FromDiscord | <mratsim> and the multihthreading runtime also needs to have low memory overhead so that it doesn't pollut my memory as well |
09:58:20 | FromDiscord | <mratsim> and the GC ... you get the gist 😉 |
09:59:15 | FromDiscord | <mratsim> the worst offender though is hyperthreading. Because if 2 different "panels" (chunk of memory to process in batch) are hyperthreaded on the same CPU |
09:59:28 | FromDiscord | <mratsim> they will compete for the CPU memory bandwidth and flush each other out. |
10:03:21 | * | fanta1 joined #nim |
10:05:08 | saem | Is the approach for that scenario: shrink panel size and hope access is linear enough that prefetching is your friend with smooth eviction? |
10:05:45 | FromDiscord | <ElegantBeef> I'd wager getting a bigger computer case so you get bigger panels is easier |
10:05:58 | saem | And RGB |
10:09:33 | FromDiscord | <mratsim> I am sad I am forced to have RGB lights on high end motherboards |
10:10:48 | FromDiscord | <mratsim> @saem, I don't hope for linear access, I enforce it. I hope it's in the hot cache though 😉 |
10:11:52 | FromDiscord | <mratsim> basically CPU with fused-multiply-add can issue 2 FMA per cycle. |
10:12:08 | FromDiscord | <mratsim> But they can also do only 2 memory load per cycle and 1 memory store. |
10:12:40 | FromDiscord | <mratsim> and for a memory load to take less than a cycle, it needs to be in L1 cache. |
10:13:11 | FromDiscord | <mratsim> so if I want to maximize throughput and the use of my CPU capacity, I need to make sure everything I need is properly in the L1 cache |
10:13:28 | FromDiscord | <mratsim> prefetch does help by about 10% |
10:13:54 | FromDiscord | <ElegantBeef> Yea i got a gpu with lights, and disabled it first thing |
10:15:32 | FromDiscord | <mratsim> I have an Asus Aura motherboard. It's disabled when the PC is running but I can't seem to disable the lights when the PC is off >_> |
10:16:33 | FromDiscord | <jseb> that's the problem when you have a tuning2000 transparent glass tower 😁 |
10:18:08 | FromDiscord | <mratsim> Well, I asked for an opaque but the builder said that for watercooling it's important to have a side transparent |
10:18:45 | FromDiscord | <jseb> ah if it's for doing an aquarium, i've said nothing |
10:19:02 | FromDiscord | <ElegantBeef> Well the important part of watercooling is that it's cool |
10:19:41 | FromDiscord | <mratsim> It's the silent, cool type of computer :p |
10:19:54 | FromDiscord | <mratsim> I don't want a jet engine in my house. |
10:20:52 | FromDiscord | <ElegantBeef> Just run any code i write and your PC will turn into one |
10:21:29 | FromDiscord | <mratsim> You just need to run Perl 😉 |
10:21:32 | FromDiscord | <jseb> well, more seriously, do you think it is possible to have a javascript module written in Nim, which could «talk» to a pure javascript running as main program ? |
10:21:38 | FromDiscord | <ElegantBeef> Yes |
10:21:42 | FromDiscord | <mratsim> sure |
10:21:52 | FromDiscord | <ElegantBeef> Small example here https://github.com/beef331/mrapi/blob/master/src/mrapi.nim |
10:21:56 | FromDiscord | <jseb> but can i share buffers between the two |
10:21:57 | FromDiscord | <mratsim> use sockets or any other IPC solution. |
10:22:13 | FromDiscord | <ElegantBeef> Unless i misunderstood |
10:22:31 | FromDiscord | <mratsim> meh, sharing memory between processes is not very portable bewteen MacOS, Windows and Linux |
10:22:36 | FromDiscord | <jseb> local buffer (directly shared memory) is impossible ? |
10:22:37 | FromDiscord | <mratsim> it's also a security issue. |
10:22:50 | FromDiscord | <jseb> ah excuse me, i was not clear |
10:22:53 | FromDiscord | <mratsim> not sure if JS allows you that. |
10:23:03 | FromDiscord | <ElegantBeef> I was going to say we're talking about JS 😄 |
10:23:24 | FromDiscord | <ElegantBeef> I dont know where this "pure JS" takes place |
10:23:30 | FromDiscord | <jseb> i was thinking of a nim compiled as a javascript module, and this module loaded by the «main» javascript running in the browesr |
10:23:37 | FromDiscord | <jseb> (edit) "browesr" => "browser" |
10:23:41 | FromDiscord | <ElegantBeef> So then exactly what i do |
10:23:56 | FromDiscord | <ElegantBeef> But using the `import` syntax in js |
10:24:42 | FromDiscord | <jseb> i'm looking at your link ElegantBeef |
10:24:51 | FromDiscord | <ElegantBeef> I mean it's just wrapping JS stuff |
10:25:09 | FromDiscord | <ElegantBeef> But the same thing applies, that outputs JS code which then you could use from `import` in the main file |
10:25:20 | FromDiscord | <ElegantBeef> It outputs proper js so it's not like it's limited |
10:25:36 | FromDiscord | <ElegantBeef> Aslong as you `exportc` your exposed API you'll be fine |
10:25:48 | FromDiscord | <jseb> yes theorically i can do what i could do with a javascript module |
10:26:09 | Zevv | mratsim: when I change the setlen + [^] into `scheduler.add bindCallerContinuation()`, it counts to 4 and then never exits |
10:26:14 | * | Vladar joined #nim |
10:26:32 | FromDiscord | <mratsim> the "iterator.nim" with Mutant does the same |
10:26:48 | FromDiscord | <mratsim> it skips 1 and 2 starts at 3, loops 3 times and never exist |
10:26:56 | FromDiscord | <mratsim> I assume it's the same bug :p |
10:27:04 | Zevv | ok, cool |
10:27:16 | FromDiscord | <mratsim> not sure why though, maybe because it's not moved and so there is a =destroy missing |
10:28:05 | FromDiscord | <mratsim> the main idea was to show that we can do everything without confusing users with the raw continuation. |
10:28:27 | Zevv | I'm very much confused by the lack of the raw continuation :) |
10:28:41 | saem | jseb: is this what you're looking for in terms of Nim to JS module? https://github.com/saem/vscode-nim/blob/master/src/nimvscode.nim |
10:30:08 | FromDiscord | <ElegantBeef> My uncertainty scared them off |
10:30:12 | FromDiscord | <jseb> excuse me saem, i don't understand |
10:31:00 | FromDiscord | <CodeHz> Is there a better way to copy a string(force)? or is it a bug?↵if I don't use `& ""` and enable arc/orc, the string will not be clone and I got wrong value when process xmlElementEnd. https://media.discordapp.net/attachments/371759389889003532/793063442050580520/unknown.png |
10:31:37 | saem | As in compile Nim using the JS target, and have that be either a module or the primary JS code? |
10:31:56 | FromDiscord | <jseb> the idea is to keep the «lib part» (things hard to wrap like phaser or threejs) inside a pure javascript source, and doing intensive things with nim |
10:32:21 | saem | Yes |
10:32:54 | saem | I did lots of vs code and node API mapping |
10:33:12 | saem | It's an extension but it could just as well be the core |
10:33:36 | FromDiscord | <ElegantBeef> Why would you do intensive things with Nim in that case it's still JS at the end of the day there |
10:33:48 | FromDiscord | <ElegantBeef> Unless you use WASM or make a JS intepreter in Nim 😄 |
10:34:19 | FromDiscord | <jseb> well i've read the «nim in action» javascript wrapping, and the official documentation, but a simple example is still missing for me |
10:34:32 | saem | Same reason as typescript, people don't want to write JavaScript directly |
10:34:42 | FromDiscord | <ElegantBeef> Mrapi is a simple example |
10:34:53 | FromDiscord | <ElegantBeef> Well it's more i thought they were relying on js for non intensive |
10:34:54 | saem | Good night |
10:34:59 | FromDiscord | <ElegantBeef> Buh bye |
10:35:01 | FromDiscord | <jseb> yes it's for avoiding doing javascript directly. And maybe wasm later |
10:35:01 | * | saem waves |
10:35:29 | FromDiscord | <ElegantBeef> Ah then yea refer to https://github.com/juancarlospaco/nodejs or other js libraries |
10:35:52 | FromDiscord | <flywind> and look at nim-lang/fusion |
10:35:56 | FromDiscord | <ElegantBeef> Mrapi does what you suggest though |
10:36:41 | FromDiscord | <ElegantBeef> But anywho i should sleep aswell |
10:36:55 | FromDiscord | <jseb> thank you , and good night 🙂 |
10:39:00 | FromDiscord | <jseb> i have to think of all of this now |
10:42:56 | FromDiscord | <mratsim> JS can call nim libraries. |
10:43:09 | FromDiscord | <mratsim> just make them the same process. JS loads Nim like a DLL |
10:44:25 | FromDiscord | <mratsim> because if they are from different process I think you have to play with mmap: https://www.guru99.com/inter-process-communication-ipc.html |
10:44:26 | Zevv | arc doesn't compile for js |
10:45:26 | Zevv | mratsim: will this casting trick work with JS? |
10:46:43 | FromDiscord | <mratsim> I have outline the stuff here: https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/cps/core/spec.nim#L58-L60 |
10:47:17 | FromDiscord | <mratsim> I will use rootobj conversion on JS probably |
10:48:07 | FromDiscord | <jseb> @mratsim : IPC would be useful for calling functions from a nim server running outside the browser, wouldn't be ? |
10:48:34 | FromDiscord | <mratsim> I have to test more conversion technique https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex02_type_system_hack.nim#L1-L12↵↵Because in the case we hold ref and it escapes we would allocate twice, one for the continuation and one for the envs. |
10:48:48 | Zevv | right |
10:48:52 | FromDiscord | <mratsim> though Isolating the continuation and refing the env should be enough |
10:49:23 | FromDiscord | <mratsim> that way continuation is always a stack object, and the env may be a ref. |
10:49:48 | FromDiscord | <mratsim> @jseb IPC is used anywhere you talk with the "outside". |
10:50:18 | FromDiscord | <mratsim> unix pipes with | are a form of IPC. |
10:50:25 | FromDiscord | <mratsim> a socket is an IPC. |
10:50:31 | FromDiscord | <mratsim> a message queue as well |
10:50:50 | Zevv | aah that took me longer then I'd like to admit |
10:50:56 | FromDiscord | <mratsim> the issue with shared memory between processes is that you need to tinker with the address space. |
10:51:05 | Zevv | you reffed only the env fron the continuation, so the continuation itself can be on the stack |
10:51:20 | Zevv | https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex02_type_system_hack.nim#L12 |
10:51:22 | FromDiscord | <mratsim> and then put some locks in that shared memory |
10:51:55 | FromDiscord | <jseb> yes, i understand this, but i mean: i'd rather like sharing tables, buffers… because IPC seems a bit overweight for lot of buffer access |
10:52:05 | FromDiscord | <mratsim> technically in the ex03 demo, the continuation is still a ref outside: but stack inside. but that can easily be changed. |
10:52:48 | FromDiscord | <mratsim> @jseb it's costly but deliver something that works, and then it's easier to test that your optimization doesn't break. |
10:53:53 | FromDiscord | <mratsim> that's always how I start with optimization. I start from a base case that serves as a baseline: both in terms of speed and correctness. |
10:54:00 | FromDiscord | <mratsim> then I change the internals incrementally |
10:54:18 | FromDiscord | <jseb> ok i understand what you mean, then |
10:54:40 | FromDiscord | <mratsim> this is my "textbook" example: https://github.com/numforge/laser/blob/master/benchmarks/transpose/transpose_bench.nim#L91-L96 |
10:54:56 | FromDiscord | <mratsim> I start with just naive transposition of matrices. |
10:55:10 | FromDiscord | <mratsim> and then 6~7 refinements after, checking that the results are correct |
10:55:14 | FromDiscord | <mratsim> I get 3.5x speed |
10:55:31 | FromDiscord | <mratsim> And I do the same for data science / machine learning |
10:55:44 | FromDiscord | <mratsim> start from a dumb model, and then switch out the internals |
10:56:16 | FromDiscord | <mratsim> also because often, we can lose a looooooot of time with external integration. Just producing a result in the expected format. |
10:56:32 | FromDiscord | <jseb> yes i had a similar idea for javascript, except i was thinking of outputting data to terminal, before doing the javascript conversion pour display |
10:56:37 | FromDiscord | <jseb> (edit) "pour" => "for" |
10:56:38 | FromDiscord | <mratsim> so better tackle that first, and then you see how much time left you have for perf |
10:57:03 | FromDiscord | <mratsim> and if you don't have enough time, well you through more machines at it. |
10:58:35 | FromDiscord | <mratsim> also @zevv the ref inside still requires a ref wrapper outside for schedulers |
10:59:04 | Zevv | I'm trying to follow all that, give me a few weeks |
10:59:41 | FromDiscord | <mratsim> We can make stuff "object of RootObj" and let users use ref for type erasure or nothing if not necessary |
10:59:56 | FromDiscord | <mratsim> but I'm ensure what the representation becomes |
11:00:27 | FromDiscord | <mratsim> it would be nice if a C library could call cont.fn(cont) |
11:06:53 | * | beatmox quit (Read error: Connection reset by peer) |
11:06:58 | * | beatmox- joined #nim |
11:08:47 | * | Arrrrrrrr joined #nim |
11:13:47 | * | tane joined #nim |
11:20:03 | Zevv | in your example a and b have different types |
11:28:08 | FromDiscord | <mratsim> yes, but if the env is an union that wouldn't work with a ref EnvBase. |
11:29:49 | FromDiscord | <mratsim> That said, if we have isolated ref, and the benefits of continuation manifest in Weave |
11:30:05 | FromDiscord | <mratsim> I wouldn't need the memory pool, and using the GC might be possible. |
11:31:06 | FromDiscord | <mratsim> the ideal would be to have the VTable of concepts. We just need type erasure, no inheritance or RTTI stuff that creates hidden C fields. |
11:51:21 | FromDiscord | <mratsim> @Clyybber do you know what the RTTI stores with gc:arc? |
11:51:56 | * | habamax quit (Ping timeout: 240 seconds) |
11:52:04 | FromDiscord | <mratsim> and the C representation? is it in the data structure or in the GC |
11:52:20 | FromDiscord | <mratsim> for exaple if I do "object of RootObj" is it the same as a plain "object"? |
11:52:24 | FromDiscord | <Clyybber> No |
11:52:35 | FromDiscord | <Clyybber> It has a special header AfAiK |
11:53:01 | FromDiscord | <Clyybber> But arc has two RTTI |
11:53:20 | FromDiscord | <Clyybber> the old one is enabled with --deepcopy I think |
11:56:06 | FromDiscord | <dom96> Can we just use this for all Nim programs automatically? 😄 https://justine.lol/cosmopolitan/index.html |
11:57:19 | FromDiscord | <mratsim> eh, that's actually very interesting |
12:00:23 | FromDiscord | <dom96> like, this is actually magic |
12:00:51 | FromDiscord | <mratsim> That's what people thing when they read your async/await macro transformations |
12:00:55 | FromDiscord | <mratsim> think |
12:01:08 | FromDiscord | <mratsim> or CPS for that matter :p |
12:02:36 | FromDiscord | <dom96> I'm sure they do |
12:03:03 | FromDiscord | <mratsim> btw, I've done a lot of experiments on both better closure iterators (introducing `coro count(start, stop: int): int` syntax for example), and CPS. Raw continuations are worth having, and will significantly simplify async/await. |
12:03:34 | FromDiscord | <mratsim> in particular, async just becomes "myScheduler.enqueue(bindCallerContinuation)". |
12:03:40 | PMunch | @dom96, huh, that is actually really cool |
12:04:40 | PMunch | Have you tried it on Nim? |
12:04:48 | FromDiscord | <mratsim> this means the difference between chronos and asyncdispatch become just around futures/timers/event loop and transport.↵But then all of that can be unified efficiently around either coroutines (for streams and futures and transports) or continuations (for raw IO like sockets connection) |
12:05:08 | FromDiscord | <dom96> PMunch: not yet, but I will in a second 😄 |
12:05:31 | FromDiscord | <mratsim> this means that as we progress we can have unified streaming API, that is very efficient, without waiting for interfaces/vtables/traits. |
12:05:50 | FromDiscord | <mratsim> and it can be passed from event loop to event loops. |
12:05:58 | FromDiscord | <mratsim> no need to choose one. |
12:06:10 | FromDiscord | <mratsim> including threadpools or Weave to asyncdispatch. |
12:07:36 | FromDiscord | <mratsim> this is my first design iterations with coroutines only: https://github.com/weavers-guild/weave-io/blob/master/design/design_1_coroutines.md↵and the second with exposing continuations: https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md |
12:11:00 | FromDiscord | <mratsim> Also cancellation = not running the continuation. |
12:11:19 | FromDiscord | <mratsim> drop it and the destructors/finalizers are called. |
12:13:30 | Zevv | thats how it should be |
12:13:38 | Zevv | i love it when a plan comes together |
12:14:21 | FromDiscord | <mratsim> Usually when we reach that points, that's when ugly compiler bugs rear their ugly heads :p |
12:15:31 | FromDiscord | <mratsim> And this is the part of the stdlib that I can see being straightforward to upgrade with coroutines and CPS: https://github.com/disruptek/cps/tree/mratsim-public-api-proposal/cps/stdlib |
12:16:19 | FromDiscord | <mratsim> note: for strutils and sequtils we might want 2 implementations. One in-place to use with `dup`, and one coroutines-based, to allow streaming and lazy producer-consumer workflows. |
12:17:09 | FromDiscord | <mratsim> people might complain about color but I don't think there is a one size fits all there. |
12:17:14 | * | fanta1 quit (Quit: fanta1) |
12:17:18 | FromDiscord | <dom96> coroutines for strutils? Why? |
12:17:46 | FromDiscord | <mratsim> Because I'm tired of seeing "why is Nim so slow when processing CSV, advent of code, ..." |
12:18:31 | FromDiscord | <mratsim> strutils right know encourages 2 things: allocating intermediate buffers (solved with dup) and doing multiple loops over the data (not solved with dup) |
12:18:51 | FromDiscord | <mratsim> also that would make strutils compose with streams. |
12:19:44 | FromDiscord | <mratsim> you create your lazy processing, read stream chunk, maybe you search for a substring inside, output it to another coroutine that transforms it, and only then you allocate the final buffer. |
12:19:55 | FromDiscord | <mratsim> append to |
12:20:21 | FromDiscord | <dom96> hmm: `/usr/bin/ld: crt.o: unable to initialize decompress status for section .debug_aranges` |
12:20:22 | FromDiscord | <mratsim> so it's a functional alternative to collect, or similar to iterutils. |
12:22:12 | FromDiscord | <dom96> Oh well, no cosmopolitan for me |
12:26:00 | PMunch | @dom96, what does that mean? |
12:26:23 | FromDiscord | <dom96> no idea |
12:26:33 | FromDiscord | <dom96> Can you give it a try? Maybe you'll have better luck |
12:26:43 | FromDiscord | <dom96> This is just with their hello world example |
12:31:11 | PMunch | Oh, I got their hello world thing to work |
12:31:22 | PMunch | But it's pretty weird |
12:32:10 | PMunch | Like have a look at this: http://ix.io/2K5C |
12:32:28 | PMunch | Compiles fine, file struggles a bit with figuring out what it is |
12:32:44 | PMunch | Then after running it through bash it rewrites the binary to the actual program |
12:32:57 | PMunch | Which means that after I have run it I probably can't copy it anywhere |
12:33:19 | PMunch | And now I need to run it as a normal program and not via bash |
12:33:30 | FromDiscord | <dom96> wow, interesting |
12:33:33 | PMunch | Whereas that didn't work before I ran bash on it |
12:34:19 | FromDiscord | <dom96> Can you check out what the file looks like before calling `bash` on it? |
12:35:22 | qwr | testing the wonderful/terrible cosmopolitan libc hack? |
12:35:36 | FromDiscord | <dom96> yep |
12:36:24 | Zevv | dom96: we gain lazy evaluation and efficient functional programming |
12:36:33 | PMunch | @dom96, http://ix.io/2K5G |
12:36:42 | PMunch | From hexdump -C ./hello.com | head -n 100 | ix |
12:37:16 | FromDiscord | <juliuskiesian> just found out nim has a secret repl. 🙂 |
12:37:27 | FromDiscord | <lqdev> yeah |
12:37:30 | FromDiscord | <juliuskiesian> sent a code paste, see https://play.nim-lang.org/#ix=2K5H |
12:37:36 | FromDiscord | <lqdev> but it runs things in the NimVM |
12:37:49 | FromDiscord | <lqdev> so it's not like real Nim |
12:38:22 | FromDiscord | <juliuskiesian> ok. so it's interpreted and slower? |
12:38:33 | FromDiscord | <lqdev> yeah |
12:38:34 | FromDiscord | <dom96> PMunch: yeah, that smells like far too much of a hack. Would be better if there was a separate script to do the conversion that can be reviewed. |
12:38:47 | FromDiscord | <lqdev> and also has some limitations namely with pointers and such |
12:38:59 | FromDiscord | <mratsim> @zevv: we get a syntax that doesn't eat your brain. |
12:42:11 | Zevv | \o/ |
12:46:32 | PMunch | @dom96, what do you mean a separate script? |
12:47:20 | FromDiscord | <dom96> PMunch: the one you're running to get the binary, it shouldn't hide inside the binary |
12:47:58 | PMunch | Aah |
12:48:10 | PMunch | Well I guess they wanted a single file thing |
12:50:15 | PMunch | I mean this is the thing it attaches: https://raw.githubusercontent.com/jart/cosmopolitan/467504308a103865c058f9a0ac858cc22e72240e/ape/ape.S |
12:51:14 | PMunch | Basically some hack that allows it to execute "something" for each platform. And that something is fix-this-to-actually-be-executable |
12:52:13 | FromDiscord | <cybertim> So i'm progressing with 'my first' nim project, currently using halonium inside jester, but this results in gc-safe errors, my solution for now is --threadAnalysis:off (everything seems to work fine) and from my simple understanding (as a async/await person) this is due to the fact that halonium spawns threads, does this mean that halonium needs a rewrite or is it possible to 'wrap' the whole thing inside some function that is gc-safe an |
12:52:22 | PMunch | What I thought this would be cool for, a utility USB that can run on all platforms, unfortunately wouldn't work to well since it rewrites the binary |
13:00:30 | * | saem quit (Quit: Connection closed for inactivity) |
13:01:17 | * | Arrrrrrrr quit (Ping timeout: 265 seconds) |
13:01:48 | * | Arrrrrrrr joined #nim |
13:23:07 | FromDiscord | <mratsim> I think there is a post about this. it's just that we need better gcsafe escape analysis. |
13:23:46 | FromDiscord | <mratsim> the escape hacth is using cast({.gcsafe.}): yourProblem. |
13:24:00 | FromDiscord | <mratsim> I don't remember the exact syntax |
13:24:48 | FromDiscord | <mratsim> the old one was `{.gcsafe.}: yourProblem` but we wanted to ensure that all unsafe uses could be greped with either `cast` or `unsafe` or `addr`. |
13:25:16 | * | lritter joined #nim |
13:26:04 | Zevv | gcsafe is a big pain in the derriere |
13:26:39 | FromDiscord | <lqdev> @mratsim i think the syntax was {.cast(gcsafe).} |
13:28:40 | * | habamax joined #nim |
13:39:19 | FromDiscord | <cybertim> yes i read about {.cast(gcsafe).} it's in the docs but it's only ~4 lines describing it, so it wasn't (and isn't) very clear, because just casting the whole thing to gcsafe doesn't mean it is safe, right? 😛 |
13:47:18 | FromDiscord | <haxscramper> Is it possible to avoid |
13:48:21 | FromDiscord | <haxscramper> Is it possible to avoid `template instantiationt too nested`error when using dot operators in case of fields that are completely missing? I understand that this should cause this error |
13:48:45 | FromDiscord | <haxscramper> But maybe there is some workaround for checking if field is present in object |
13:48:57 | FromDiscord | <haxscramper> Without triggering ``.`` operator |
13:49:10 | FromDiscord | <mratsim> macros |
13:49:30 | FromDiscord | <mratsim> I had that issue in stint, build a macro that unroll your type recursively |
13:52:35 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2K63 |
14:14:20 | narimiran | anybody interested in proof-reading our 2020 recap article? https://github.com/nim-lang/website/blob/c7caf9ae3555c8fd7ec9ac371dda27f987d1d66c/jekyll/_posts/2020-12-28-nim-in-2020-a-short-recap.md |
14:14:41 | narimiran | (don't worry about the image not showing up, and that embedded iframe) |
14:23:10 | cmc[m] | Is there a way for a proc to accept "any object with field foo:string and bar:int"- or, alternatively, "any object with foo:string and bar:int as the first two fields? |
14:24:44 | Zevv | concepts |
14:26:29 | * | nyd joined #nim |
14:27:52 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
14:28:36 | cmc[m] | <Zevv "concepts"> cool, thanks! |
14:29:21 | FromDiscord | <sealmove> is it possible to accept a name of a nim module from the command line and import it at runtime? |
14:30:54 | cmc[m] | <FromDiscord "<sealmove> is it possible to acc"> No- at runtime, the binary has already been compiled, so you cannot import modules any more. |
14:31:47 | * | Gustavo6046 joined #nim |
14:32:29 | FromDiscord | <sealmove> hmm, what if I compile my modules to dll? can i choose them at load then? |
14:32:37 | FromDiscord | <sealmove> can I load them at runtime then |
14:33:38 | FromDiscord | <VVX7> import it as a shared library with Nim's FFI? |
14:34:58 | cmc[m] | <FromDiscord "<sealmove> can I load them at ru"> Yes, if you compile your modules to DLLs, then you can load them at runtime. |
14:35:37 | FromDiscord | <sealmove> nice. ok, now I have to learn how to do this. never made dlls before |
14:43:07 | FromDiscord | <haxscramper> narimiran: "600 new commits which have not already been backported" should probably be have already been, everything else looks good to me |
14:43:57 | narimiran | @haxscramper no, it is indeed commits which haven't been backported to the patches of earlier versions |
14:44:08 | FromDiscord | <haxscramper> oh |
14:44:58 | FromDiscord | <sealmove> `nim c -d:useNimRtl myprog.nim` generates a `.exe` instead of a `.dll` |
14:50:19 | Zevv | nim c -d:release lib/nimrtl.nim |
14:51:06 | Zevv | I think with arc you can do without librtl |
14:54:11 | Zevv | mratsim: "casting "ref object" to "ref object of RootObj" defined behavior"; I think that's funny to do. inheritable objects get a RootObj as first member with `TNimType* m_type` in there |
14:56:33 | FromDiscord | <mratsim> @Zevv, yep I checked the code and codegen |
14:56:40 | Zevv | right |
14:56:44 | FromDiscord | <mratsim> it's not funny it's undefined behaviour :p |
14:56:58 | Zevv | I find undefined behaviour pretty funny |
14:57:03 | FromDiscord | <mratsim> anyway, I have found a type erasure scheme that should be satisfactory to all. |
14:57:24 | Zevv | I still try to understand why the move needs to be explicitly there |
14:57:26 | FromDiscord | <mratsim> the cost is 8 bytes of space and an extra assign on object creation. |
14:57:35 | Zevv | if I take that out there is no suspending happening at all |
14:57:55 | Zevv | The rootObj also takes 8 bytes, so that's the same |
14:57:56 | FromDiscord | <mratsim> you need to wasMoved the type |
14:58:18 | FromDiscord | <mratsim> it's via rootObj |
14:58:30 | FromDiscord | <mratsim> but don't make it ref by default |
14:58:34 | Zevv | riight. So, with your new scheme that drops? |
14:58:47 | FromDiscord | <mratsim> anyway pushing, 2 versions, the codegen is equivalent |
14:59:14 | FromDiscord | <mratsim> except that one is triggering the borrow checker because a copy happen even though there shouldn't be any copy. |
15:00:50 | Zevv | ok, I need to dive in more to understand that I guess |
15:01:05 | FromDiscord | <mratsim> https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex04_type_erasure.nim |
15:01:45 | Zevv | yeah was just reading |
15:01:49 | * | beatmox- quit (Quit: ZNC 1.8.0 - https://znc.in) |
15:02:00 | * | beatmox joined #nim |
15:04:34 | * | Arrrrrrrr quit (Remote host closed the connection) |
15:05:37 | FromDiscord | <mratsim> I have to check also the codegen for ref but it might be that the union trick is unnecessary |
15:06:50 | FromDiscord | <mratsim> but it's easier to avoid reallocating with an union that autoinfers the maxsize |
15:07:14 | FromDiscord | <mratsim> instead of disruptek tricks to reparent the frames. |
15:07:14 | Zevv | it all feels pretty elaborate and complicated somehow |
15:07:15 | Zevv | but hey |
15:07:31 | FromDiscord | <mratsim> it's complicated because I'm exhaustively checking for stuff |
15:07:40 | Zevv | yeah I understand :) |
15:09:02 | FromDiscord | <mratsim> do you know if there is already a way to do "continuation contains CPS call"? |
15:09:11 | FromDiscord | <mratsim> the "isFinished" issue is bugging me. |
15:09:36 | Zevv | yeah same here, I don't know yet |
15:09:54 | Zevv | where's disruptek, is he now asd? |
15:11:32 | Zevv | I think we had "Contains CP call" once, but the logic was crude |
15:11:35 | Zevv | because, what's a CPS call |
15:12:38 | FromGitter | <gogolxdong> @mratsim is your cps lock-free and gc-free? |
15:12:49 | Zevv | all CPS is lock-free |
15:12:53 | Zevv | CPS does not know what a lock is |
15:13:18 | FromGitter | <gogolxdong> good to know |
15:14:01 | FromDiscord | <mratsim> If I have a say it's also GC free, and allows you to do your own memory management in your scheduler (asyncdispatch, chronos, weave threadpool) |
15:14:24 | Zevv | and disruptek and me are keeping him from concentrating on that too much |
15:14:51 | FromDiscord | <mratsim> CPS is a technique to transform code into callback hell in the backend. |
15:15:00 | FromGitter | <gogolxdong> not on gc-free? |
15:15:15 | FromDiscord | <mratsim> they want to use ref meeeh |
15:15:24 | Zevv | no. because according to my calculations, approximately 94.7% of the users don't care about that |
15:15:44 | Zevv | and, hey, we don't GC in 2020 |
15:15:46 | Zevv | we ARC |
15:15:53 | Zevv | oooh, "heap free" you mean |
15:15:53 | FromDiscord | <mratsim> given that 70% of statistics are made-up i don't believe you |
15:16:34 | FromDiscord | <mratsim> I want composability, and that requires allowing people to choose how they want the memory to be managed. |
15:16:53 | Zevv | composability++ |
15:16:57 | FromDiscord | <mratsim> anyway, I think the problem is solved |
15:18:13 | FromDiscord | <mratsim> provide "object of RootObj" continuations, and convenience proc to produce type-erased ref object of RootObj for schedulers |
15:18:34 | FromDiscord | <mratsim> and for manual memory management, provide a "sizeofContinuation" shim so that they can properly do allocation. |
15:18:52 | Zevv | so, that was kind of what you started with, right |
15:19:49 | FromDiscord | <mratsim> yes the original code is OK if we remove the ref. |
15:21:55 | FromDiscord | <mratsim> Also there is no "alloca" issue I think. |
15:21:55 | FromDiscord | <mratsim> what I don't understand is your "typed" continuations, I don't see overhead in the untyped continuations. |
15:23:59 | Zevv | "typed"? |
15:24:48 | FromDiscord | <mratsim> the typed branch that broke everything |
15:25:06 | Zevv | you mean why we want to go typed in the first place? |
15:25:37 | asd | you can't infer types in the env w/o typed. |
15:25:44 | Zevv | because of `var i: int = lo` |
15:25:46 | Zevv | right |
15:25:47 | asd | ^ |
15:25:54 | Zevv | disruptek, can you *please* renick |
15:26:17 | FromDiscord | <mratsim> ah |
15:26:22 | FromDiscord | <mratsim> it's about typed macro |
15:26:25 | Zevv | yes |
15:26:34 | FromDiscord | <mratsim> I thought it was about having Continuation[T] instead of Continuation |
15:26:39 | FromDiscord | <mratsim> okay makes sense |
15:26:39 | Zevv | but the AST we get then is half baked and broken in interestng ways |
15:27:27 | FromDiscord | <mratsim> When I need types in a macro, the first thing I do is an AST rebuilder to remove all the symbols, the overloads, the "in" that became "contains" |
15:27:30 | cmc[m] | <FromDiscord "<sealmove> nice. ok, now I have "> I made an unfinished invoice generator with a plugin system, this is pretty much what you want, it also has a nimble script |
15:27:51 | FromDiscord | <mratsim> or i split the code into typed and untyped and i do as much as possible in untyped. |
15:28:09 | Zevv | mratsim: yeah, my hunch was that we could do that as well, but I never got it to work |
15:28:10 | FromDiscord | <mratsim> until the code is called in generic procs that is, but that doesn't happen for CPS. |
15:28:27 | asd | it's hard to create a type without having types. |
15:28:28 | Zevv | so this is primarily about collecting the env frames with the right type in there |
15:28:59 | FromDiscord | <mratsim> this is my basic AST rebuilder https://github.com/mratsim/weave/blob/master/weave/parallel_macros.nim#L19-L71 |
15:29:17 | Zevv | yeah I saw that. It makes me cry |
15:29:41 | * | PMunch quit (Quit: leaving) |
15:30:09 | Zevv | oh no, it's not that one |
15:30:10 | FromDiscord | <mratsim> and another one that extract the proper overload depending on the parameter types https://github.com/numforge/laser/blob/master/laser/lux_compiler/frontend/lux_sigmatch.nim#L16-L57 |
15:30:12 | Zevv | this one does not make me cry |
15:30:51 | FromDiscord | <Clyybber> asd: why are you asd |
15:31:08 | FromDiscord | <mratsim> sad |
15:31:28 | cmc[m] | <FromDiscord "<sealmove> nice. ok, now I have "> @sealmove Here is the code, it also has a nimble file to compile the dynamic lib plugins. The code doesn't run with current nim but you should be able to extract the relevant parts, look for "format" capocasa.net/nimvoice.zip |
15:33:00 | FromDiscord | <sealmove> It seems what I am trying to do is impossible after all :| |
15:33:37 | FromDiscord | <mratsim> Also one thing really annoying is the typedesc becoming NimNode in macro and no way to turn a NimNode into a typedesc |
15:39:53 | * | asd is now known as sad |
15:40:34 | sad | i'm thinking about the continuation wrapping a ref to the env. |
15:40:42 | * | sad is now known as asd |
15:41:27 | FromDiscord | <mratsim> it's better to have it inline, so that on stack there is zero alloc and for schedulers there is only one |
15:41:53 | asd | as i said, i don't disagree. but, one thing (think) at a time. |
15:42:05 | FromDiscord | <mratsim> I solved that problem |
15:42:16 | * | Torro quit (Quit: bye) |
15:42:31 | FromDiscord | <mratsim> you can play with the different versions here: https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex04_type_erasure.nim |
15:46:07 | asd | union breaks js. |
15:46:49 | asd | it's a clever solution to the net problem, but 1) it doesn't work today, 2) i worry about it working tomorrow. |
15:46:55 | FromDiscord | <Clyybber> we want to keep cps agnostic of that, no? |
15:47:46 | FromDiscord | <mratsim> I've said that for ref we use plain inheritance |
15:48:06 | FromDiscord | <mratsim> but unions avoid having all the lines of code for reparenting that are very hard to follow |
15:48:25 | asd | well, the reparenting can be rewritten. |
15:48:34 | FromDiscord | <mratsim> and they also are properly sized to avoid creating new objects if the new frame doesn't fit |
15:48:45 | asd | also, i would sooner dump inheritance than dump js. |
15:48:58 | FromDiscord | <mratsim> I don't want to dump js |
15:49:08 | asd | i'm just saying, for comparison... |
15:49:09 | FromDiscord | <mratsim> having proper VTable would be really nice |
15:49:12 | asd | agree. |
15:49:18 | FromDiscord | <mratsim> it's littered in my code |
15:49:19 | * | asd is now known as disruptek |
15:49:55 | FromDiscord | <Clyybber> type erasure for js can be done in a js specific way |
15:50:08 | FromDiscord | <Clyybber> later |
15:50:18 | FromDiscord | <mratsim> https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex04_type_erasure.nim#L37-L38↵https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/cps/core/public_api.nim#L16 |
15:50:22 | disruptek | maybe the better solution is to keep inheritance as a ct option so that it continues to work in tests. |
15:50:34 | FromDiscord | <mratsim> I plan to keep both |
15:50:36 | FromDiscord | <Clyybber> yeah; all this shouldn't be set in stone |
15:50:41 | FromDiscord | <mratsim> you can't do union with ref types |
15:50:56 | FromDiscord | <mratsim> I'm pretty sure that's broken |
15:51:16 | disruptek | no, i'm talking about removing the reparenting for complexity reasons. |
15:51:51 | disruptek | this is just an escape hatch for if we decide to dump inheritance. |
15:52:25 | disruptek | i wish more of your branch's changes were behind a ct flag. |
15:53:11 | disruptek | or, like, 6 flags. 😁 |
15:53:31 | FromDiscord | <mratsim> yeah but that would significantly hinder my ability to explore the design space in a short time |
15:53:55 | disruptek | not my problem. 🤣 |
15:53:58 | FromDiscord | <mratsim> that's also why I removed mutant, it had a lot of code. |
15:54:06 | FromDiscord | <mratsim> well, i solved my problem. |
15:54:09 | FromDiscord | <mratsim> 😛 |
15:54:12 | disruptek | you mean, you removed un-mutant? |
15:54:19 | FromDiscord | <mratsim> yes |
15:54:29 | disruptek | because, y'know, i think we need un-mutant. |
15:54:37 | disruptek | there's a reason we didn't just embrance mutant instantly. |
15:54:58 | FromDiscord | <mratsim> do you remember it? 😉 |
15:55:00 | disruptek | we can probably keep both, though. |
15:55:42 | FromDiscord | <mratsim> unmutant is likely to introduce a lot of copy if we want the base continuation to be object of RootObj |
15:55:49 | disruptek | as i said before, i want to be able to return a B from an A continuation. |
15:55:57 | FromDiscord | <mratsim> we can't trust =sink fully yet |
15:56:05 | disruptek | that's a separate problem. |
15:56:18 | FromDiscord | <mratsim> but for what use-case? |
15:56:29 | disruptek | composition. |
15:56:57 | disruptek | but i need to shovel snow and consume coffee. bbiab. |
15:57:08 | FromDiscord | <mratsim> you can already compose. "jield" is basically taking the CPS continuation and switching it to the caller continuation. |
15:57:35 | FromDiscord | <mratsim> and the "resume" is switching the caller continuation to switch to the CPS one. |
15:58:00 | FromDiscord | <mratsim> and this is enough to represent all control flow. |
15:58:43 | FromDiscord | <mratsim> switching to any continuation is similar to asymmetric coroutines (that can only return to the caller) vs symmetric coroutines |
15:59:32 | FromDiscord | <mratsim> you can implement symmetric coroutines in terms of asymetric coroutines, by storing the current continuation in a scheduler, exit and pop the one you want from the scheduler and resume it. |
16:02:17 | FromDiscord | <Clyybber> disruptek: Ok, taste.nim should work again |
16:02:55 | FromDiscord | <mratsim> Ultimately we can provide a lua "switchTo(Continuation)" syntax sugar but we shouldn't expose the low-level continuation parameter. |
16:03:23 | Zevv | i dont really care, i can live with both |
16:03:43 | Zevv | so we're sert then: for the ref types we just use what we had, which also is fine for js |
16:03:45 | FromDiscord | <mratsim> I'd rather have a very small API and provide an example for swapping to arbitrary continuation. |
16:04:16 | Zevv | for the object type mratsim does whatever tricks he finds are needed, but the ref people are not impacted by that |
16:04:20 | FromDiscord | <mratsim> yes, though I'd like to see if it's possible to avoid the reparenting business. |
16:04:21 | Zevv | that sums it up? |
16:04:28 | Zevv | fair enogugh |
16:04:30 | FromDiscord | <Clyybber> Why don't we built this small API on top? So that we can keep doing these low-level fun things |
16:04:43 | Zevv | thats basically what mrarsim did |
16:04:50 | FromDiscord | <mratsim> otherwise we hide a variant and no union and no reparenting and no need to guess the size. |
16:04:59 | Zevv | he hides the gory details in 3 exports, basically |
16:05:25 | FromDiscord | <Clyybber> My point is that we should keep unmutant in reserve |
16:05:26 | FromDiscord | <mratsim> disruptek likes the gor |
16:05:40 | Zevv | good for him. |
16:05:43 | FromDiscord | <Clyybber> it shouldn't be too hard to keep it around no? |
16:05:49 | Zevv | im agnostic to gore |
16:05:54 | FromDiscord | <mratsim> it's a lot of noisy code |
16:06:03 | FromDiscord | <Clyybber> Zevv: Did your tzevv pass for you? |
16:06:11 | Zevv | once it did |
16:06:11 | FromDiscord | <Clyybber> Fails with invalid ast () for me |
16:06:38 | Zevv | but disruptek kept breaking so many things that i long gave up on that |
16:06:38 | Zevv | the repo is a total wreck as it is now |
16:07:00 | Zevv | we just kept the fuel tank from igniting |
16:07:04 | * | oculux quit (Ping timeout: 260 seconds) |
16:07:17 | Zevv | so mratism could do some forensics and hide the bodies |
16:07:19 | FromDiscord | <mratsim> yeah, I repaired one example, iterator, (somewhat) and only worked with that. |
16:07:46 | Zevv | thats mratsim. he solves problems. |
16:08:13 | FromDiscord | <mratsim> I just want to finish the coroutines API as well, get on reimplementing the stdlib as a showcase, agree on the public API and then we can reset the stuff when we confirm that's OK for everyone. |
16:08:47 | FromDiscord | <mratsim> basically this: https://github.com/disruptek/cps/tree/mratsim-public-api-proposal/cps/stdlib |
16:09:19 | FromDiscord | <mratsim> Codename: Unyielding↵_Resistance is futile, you will be assimilated_ |
16:10:35 | FromDiscord | <Clyybber> disruptek: Oh, I think your testes is trying to tell me that taste is failing; at least it compiles now. Compiles as in doesn't crash the compiler :p |
16:11:43 | * | clyybber joined #nim |
16:12:04 | clyybber | disruptek: ping ^ |
16:12:07 | * | clyybber quit (Client Quit) |
16:12:34 | FromDiscord | <mratsim> I have a strange codegen bug for you btw: with inheritance, the thing that works on JS and for ref types, Nim doesn't close some "}": https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex04_type_erasure.nim#L122-L131 |
16:12:45 | FromDiscord | <mratsim> this is blocking 😉 |
16:13:04 | Zevv | mratsim: funny you dare touching the stdlib already |
16:13:17 | Zevv | I was thinking of silently creating a shadow implementation as well |
16:13:19 | FromDiscord | <mratsim> why? |
16:13:27 | Zevv | because it well cause Resistance, likely |
16:13:42 | Zevv | so I thought it safer to just do it and then show it when it's in a reasonable working state |
16:15:15 | ForumUpdaterBot | New thread by Nim_zwei: How to sum the values of a table?, see https://forum.nim-lang.org/t/7299 |
16:16:13 | * | waleee-cl joined #nim |
16:16:20 | FromDiscord | <mratsim> I've said it to dom but we will likely have 2 "color" in our stdlib in the future for strutils and sequtils.↵One with in-place mutation, with dup for chaining. Advantage of convenience, reasonably fast, but multiple pass over the data.↵One with streams thanks to coroutines, chain is native. |
16:17:01 | FromDiscord | <mratsim> That is unless timetheecour aliassym doesn't introduce a third way with chainable inline iterators |
16:18:37 | FromDiscord | <mratsim> or we can separate into strutils, strstreams, striters and sequtils, seqstreams, seqiters |
16:19:38 | Zevv | one thing at a time |
16:24:18 | * | filcuc joined #nim |
16:29:29 | Zevv | clyybbeer: what's the taste-the-tast then |
16:30:17 | Zevv | clyybber: I just checked: tzevv is ok in 0.0.13 |
16:38:00 | disruptek | taste test is tests/taste. |
16:39:02 | disruptek | clyybber: nice! kinda huge. |
16:39:53 | Zevv | heey he's back \o/ hooray |
16:41:24 | disruptek | hmm. it doesn't work. |
16:45:34 | * | saem joined #nim |
16:48:46 | disruptek | mratsim: my use-case is that i'm in continuation A and i want to emit an "error" continuation B as opposed to continuing with A. |
16:50:15 | disruptek | clyybber: why don't my procs have return types now? |
16:50:51 | * | rockcavera joined #nim |
16:55:39 | disruptek | clyybber: in the cps macro, you result = transform; result = workaround(n). don't you want to workaround(result)? |
16:56:23 | FromDiscord | <Clyybber> oh yeah lol |
16:56:32 | disruptek | well, that crashes the compiler. |
16:57:55 | disruptek | please try to newNimNode(kind, n) so we keep the lineinfo. |
17:06:34 | disruptek | zevv: we should come to a decision about inheritance, i guess. |
17:07:03 | Zevv | so, what's the cost to throw it out |
17:08:05 | Zevv | do you have warm feelings about inheritence? |
17:08:15 | disruptek | of course not. |
17:08:39 | Zevv | surprise |
17:09:30 | disruptek | it produces "correct by construction" type associations with single source of truth for any given symbol. |
17:09:57 | Zevv | sure. but this is generated code. |
17:10:04 | Zevv | I'm willing to believe it's alternate truth |
17:10:08 | disruptek | i agree. but what else does it do for us? |
17:10:24 | Zevv | I don't know yet |
17:10:42 | Zevv | but we keep it if we want to go js, right? |
17:10:53 | disruptek | we don't have a liftlocals pass like normal folks. we do it iteratively. |
17:11:00 | disruptek | during the recursion. |
17:11:25 | disruptek | i don't know how it affects js. |
17:12:15 | Zevv | your single source of truth does help debugability I suppose |
17:13:12 | * | audiofile quit (Ping timeout: 272 seconds) |
17:14:41 | disruptek | if this was one of my private projects, i'd refactor it to an A/B impl with plain objects and let the tests keep them both honest. |
17:15:29 | Zevv | well, it *is* one of your private projects if you want it to be |
17:15:33 | disruptek | they are never going to be full equivalent, so the best solution would be a separate abstraction. |
17:18:20 | Zevv | actually I just can't tell the implications at this time |
17:18:34 | disruptek | yes, that's the problem. |
17:19:05 | disruptek | it's not an equivalent abstraction. so we should make one that /is/. |
17:19:10 | FromDiscord | <mratsim> I think we should keep inheritance just for the base cotninuation for type erasure |
17:19:20 | FromDiscord | <mratsim> but all the inner inheritance are unnecessary I think |
17:19:37 | Zevv | but does it hurt |
17:19:40 | FromDiscord | <mratsim> you can just: https://github.com/disruptek/cps/blob/mratsim-public-api-proposal/mratsim/ex04_type_erasure.nim#L105-L109 |
17:20:02 | FromDiscord | <mratsim> personally I find it hard to find which frame has what fields with inheritance. |
17:20:46 | disruptek | why is that important? |
17:20:54 | Zevv | On the on hand the nice thing is that the inheritence reflects the scopes and all. On the other hand, I don't care about that, since it will be correct-by-default |
17:20:55 | FromDiscord | <mratsim> debugging. |
17:21:04 | Zevv | yeah, that was my point above here |
17:21:07 | Zevv | debugability |
17:21:09 | FromDiscord | <mratsim> just generate the frame after the function |
17:21:15 | FromDiscord | <mratsim> after the function name |
17:21:24 | FromDiscord | <mratsim> instead of env_1234 for every scope |
17:21:34 | FromDiscord | <mratsim> frame_while_loop_1234 |
17:21:38 | Zevv | we lose some potential for smaller frames |
17:21:52 | Zevv | stuff can drop out of scope, but we keep it around |
17:23:04 | FromDiscord | <mratsim> but don't we always need to use the bigger frame anyway? |
17:23:08 | disruptek | we could eventually have a shrink operation. |
17:23:11 | disruptek | no, we don't. |
17:23:13 | FromDiscord | <mratsim> to avoid realloc |
17:23:14 | Zevv | mratsim: no we don't |
17:23:24 | * | a_chou joined #nim |
17:23:41 | Zevv | you can have something in an inner scope, and something else in a following inner scope |
17:23:48 | Zevv | these can take the same location in memory because they do not exist at the stame time |
17:23:52 | Zevv | just like they would on the real stack |
17:24:17 | Zevv | we deduce the max possible frame size at compile time, and the inheritance brings it all "naturally" |
17:24:18 | * | a_chou quit (Client Quit) |
17:24:28 | Zevv | for C, unions and casting would do as well, but we lose JS |
17:24:40 | FromDiscord | <mratsim> I would expect that if the compiler sees that they have the same size and the previous object is destroyed, it reuses the space, especially if it's var inpu mutated in place |
17:25:04 | Zevv | it's not destroyed. It's reusing the same block. Are we talking about the same thing here? |
17:25:07 | Zevv | Hmm diner time, bbl |
17:25:11 | FromDiscord | <mratsim> but I think the more important thing here is nailing usability |
17:25:21 | FromDiscord | <mratsim> destroyed as in frame replaced by another |
17:25:28 | disruptek | well, i don't care about people trying to debug cps. |
17:25:32 | FromDiscord | <mratsim> because if we show how wide it's applicable |
17:25:44 | FromDiscord | <mratsim> then maybe we get better way for type erasure. |
17:26:09 | disruptek | my concern is really more about longevity of the solution. |
17:26:23 | FromDiscord | <mratsim> I care because we will have bug and maintenance for a couple months to do, and we need help given how it involves non-local control flow |
17:26:29 | disruptek | i don't want to find that we overlooked something and in fixing it, we have to break the entire stdlib. 🤣 |
17:26:39 | FromDiscord | <mratsim> yes |
17:27:35 | FromDiscord | <mratsim> that's why I think we need to forget about the internals for now, we can use what we have, and only change what is preventing us for moving ahead. |
17:29:49 | disruptek | i agree, but only if the abstraction is tight enough. i'm not sure about mutant, still. |
17:49:52 | Zevv | why not |
17:51:15 | disruptek | because i don't understand the ergonomics of the continuation chain when we have to substitute a new continuation. do we just substitute the env? the whole continuation with our metadata? what does the user enter into their editor? |
17:51:53 | Zevv | but is the alterative copying? |
17:52:00 | disruptek | no. |
17:52:26 | Zevv | then I'm once again missing something |
17:52:40 | disruptek | unlikely. |
17:53:01 | disruptek | !mutant is the cps you knew and loved. |
17:53:12 | disruptek | mutant is continuations without a return-type. |
17:53:40 | Zevv | yeah and you're not sure about that? |
17:53:50 | disruptek | correct. |
17:54:07 | Zevv | ok, what alternative *are* you sure about then? |
17:54:22 | disruptek | i'm sure !mutant works. |
17:55:29 | Zevv | you're not talking about creating a new continuation & env at each suspend, right |
17:55:35 | Zevv | like the very first thing we had |
17:56:19 | Zevv | return Env_xxxx(fn: ..., ...) |
17:56:21 | disruptek | !mutant works by simply returning the input continuation, generally, after changing the fn pointer. |
17:57:09 | disruptek | you can chain to literally /any/ other continuation. |
17:57:50 | Zevv | right |
17:58:32 | disruptek | you can also chain to nothing at all. without modifying memory. |
17:58:45 | disruptek | this is not the case with mutant. |
17:59:57 | Zevv | hmm true |
18:00:03 | Zevv | and that might prove handy |
18:04:07 | disruptek | it seems a little nuts to assert that we will never support continuations with immutable input. |
18:11:20 | Zevv | which reminds me. We never did boxing |
18:13:41 | * | Arrrrrrrr joined #nim |
18:15:23 | disruptek | what would it buy us? |
18:18:44 | Zevv | lifting pointers to lacals |
18:18:46 | Zevv | locals |
18:18:55 | Zevv | not your typical use case |
18:18:58 | * | filcuc quit (Ping timeout: 256 seconds) |
18:20:14 | disruptek | iirc i couldn't think of a use at all. |
18:26:08 | Zevv | just sayin' |
18:26:18 | Zevv | t'was in the cpc paper |
18:28:02 | disruptek | the papers were inspirational, but that is all. |
18:29:09 | FromDiscord | <cybertim> which ircbot is being used to connect discord and irc for this channel? anyone knows? |
18:29:32 | ForumUpdaterBot | New thread by Xigoi: Compile to a single C file?, see https://forum.nim-lang.org/t/7300 |
18:30:00 | disruptek | cybertim: i think it's in yardanico's repos. |
18:30:24 | FromDiscord | <dk> What's the best alternative to `std/marshal` that also works on JS backend? |
18:30:52 | FromDiscord | <dk> `jsony` seems to not to work with case fields, so it doesn't even work with `Option[T]` |
18:30:53 | disruptek | cybertim: |
18:30:56 | disruptek | !repo ircord |
18:30:56 | disbot | https://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 12⭐ 2🍴 |
18:31:14 | disruptek | !repo jason |
18:31:15 | disbot | query failed 😢 |
18:31:19 | disruptek | !repo disruptek/jason |
18:31:19 | disbot | query failed 😢 |
18:31:21 | disruptek | !repo disruptek/jason |
18:31:22 | disbot | query failed 😢 |
18:31:32 | Zevv | try saying "please" |
18:31:37 | disruptek | disbot: please tell me when github is back? |
18:31:38 | disbot | concentrate and ask again. |
18:31:46 | disruptek | disbot: please, ffs, tell me when github is back? |
18:31:47 | disbot | signs point to yes. |
18:32:15 | disruptek | !repo disruptek/jason |
18:32:15 | disbot | https://github.com/disruptek/jason -- 9jason: 11JSON done right 🤦 15 38⭐ 1🍴 |
18:36:34 | disruptek | github is rapidly acquiring the hallmarks of a microsoft product. |
18:36:55 | FromDiscord | <cybertim> thanks for the bot info 🙂 |
18:38:21 | * | leorize quit (Remote host closed the connection) |
18:39:41 | * | leorize joined #nim |
18:41:11 | Oddmonger | nim strings become arrays in js, and it seems by design (https://forum.nim-lang.org/t/1826#11425) , but maybe there is another option 5 years later ? |
18:41:41 | disruptek | !repo nodejs |
18:41:42 | disbot | https://github.com/juancarlospaco/nodejs -- 9nodejs: 11NodeJS Standard Library for Nim 15 39⭐ 1🍴 7& 4 more... |
18:43:06 | disruptek | i could be wrong, but i think they are fixed in there. |
18:43:15 | Oddmonger | of course, i could use toString() … |
18:43:41 | disruptek | this is a good application for term-rewriting macros, and i don't say that lightly. |
18:44:48 | Oddmonger | is the «term rewriting macro» the thing evoked by araq in the link above ? |
18:45:13 | disruptek | i dunno; links are a thing other people enjoy. |
18:46:07 | Oddmonger | ah, riddles again |
18:47:35 | disruptek | the answer is `no`. |
18:47:49 | Zevv | aw now you sound like an eight ball |
18:48:11 | disruptek | an eight ball does sound good right about now. |
18:53:08 | Oddmonger | so the macro in js in not «free» i guess ? (as there is no compile time), so would it be a real benefit versus just concatenates the array to a string with a js function ? |
18:54:06 | disruptek | yes. |
18:54:43 | disruptek | the macro gets executed in nim's compile-time, so it rewrites a string to toString(string). |
18:54:49 | disruptek | or whateverthefuck you need. |
18:55:58 | * | saem_ joined #nim |
18:56:06 | * | saem_ waves |
18:56:42 | Oddmonger | ah ok, so it's putting the js dust under the carpet , but the time to sweep will still be the same at the end |
18:57:34 | disruptek | i doubt it. if you care that js treats strings as Strings, then you probably want this. |
18:57:55 | disruptek | anyway, who the fuck sweeps under their carpets? |
18:57:55 | Oddmonger | yes i do agree i need this |
18:58:33 | Oddmonger | people with a magic carpet |
18:59:02 | Oddmonger | thank you for the answer, now i know i must read the macro part of the nim doc |
18:59:13 | Oddmonger | i had successfully avoided until now |
18:59:24 | disruptek | it will doubtless help your nim programming. |
19:09:46 | FromDiscord | <acek7> disruptek do you ever sleep |
19:10:15 | disruptek | i have to wait for you to turn your head. |
19:13:27 | FromDiscord | <acek7> hows the GUI dev coming in nim, been a few months since i checked in on it |
19:13:51 | Zevv | still in a sorry state |
19:14:13 | FromDiscord | <Recruit_main707> there is fidget |
19:14:15 | Zevv | we got figlet |
19:14:18 | Zevv | oh fidget sorry |
19:14:43 | disruptek | it's getting rewritten, so... yeah, don't bother messing with it. |
19:15:03 | FromDiscord | <acek7> fidget made any good progress? I had some issues it didnt like some of the stuff i designed and tried to implement lol |
19:15:08 | FromDiscord | <acek7> oh rewritten then |
19:15:52 | * | nyd quit (Ping timeout: 265 seconds) |
19:17:27 | * | nyd joined #nim |
19:22:48 | * | Jesin quit (Quit: Leaving) |
19:25:15 | FromDiscord | <acek7> since alot of people here like Nim, are anyone big fans of the languages it takes inspiration from. Such as python etc. |
19:26:15 | * | Jesin joined #nim |
19:29:51 | FromDiscord | <mratsim> @acek7 Nim takes more from Pascal, Modula2 and Oberon than from Python |
19:30:28 | FromDiscord | <mratsim> then again Python is inspired by the same for the syntax, but they didn't take all like the record declaration |
19:30:37 | FromDiscord | <mratsim> in fact Nim was bootstrapped from Pascal |
19:31:03 | FromDiscord | <exelotl> I never really learned python, but I did use turbo pascal for a year in school |
19:31:29 | FromDiscord | <exelotl> probably mentioned this before but I was really impressed how such an old language got so many things right |
19:31:40 | ForumUpdaterBot | New thread by Mantielero: Problem related with scope, see https://forum.nim-lang.org/t/7301 |
19:31:50 | FromDiscord | <exelotl> like, it predates C, but it has a proper module system, a rock solid type system, nested procedures, etc. |
19:32:26 | FromDiscord | <exelotl> makes me feel like C has no business being as successful and influential as it is... |
19:33:06 | FromDiscord | <acek7> i just said python since its syntax is similar, never used any of the others thats kinda why i asked if anyone used the others because im curious what brought people in |
19:35:28 | FromDiscord | <mratsim> I wanted Python, with types and speed. |
19:35:44 | FromDiscord | <haxscramper> In my experience it is closer to C++ and LISP. I don't have experience with pascal so can't really commen on this |
19:36:16 | FromDiscord | <haxscramper> But some books that I've read and used ALGOL as example language had very similar syntax |
19:37:19 | FromDiscord | <haxscramper> Even closer than python for most parts, except for `end` for blocks of course. As for 'why' - because nim is what C++ should have been from the start |
19:38:34 | FromDiscord | <haxscramper> Syntax has nothing to do with anything, and for other parts I believe this holds true - mostly procedural, struct-oriented with optional support for some `OOP` and `FP` concepts |
19:39:19 | FromDiscord | <haxscramper> (edit) "Syntax has nothing to do with anything, and for other parts I believe this ... holds" added "[nim being C++ 'done right']" |
19:41:21 | * | nyd quit (Quit: nyd) |
19:41:37 | FromDiscord | <mratsim> syntax has everything to do with C++ 😛 |
19:41:46 | FromDiscord | <mratsim> or avoiding C++ |
19:42:25 | FromDiscord | <haxscramper> I'm not so sure about that. E.g. if you can cut down on verbosity of the language, making it easier to express some concepts |
19:43:11 | FromDiscord | <mratsim> @disruptek, @zevv, believe me, you do not want to do immutable continuations |
19:43:31 | FromDiscord | <mratsim> That is likely one of the design mistakes of Scheme and it had a lot fo discusions ontheir mailing list |
19:43:49 | FromDiscord | <haxscramper> I can't really pinpoint exact part of C++ syntax that I really don't like, it is just a little more bloated that I would like, but that's all. |
19:43:52 | disruptek | this isn't scheme. |
19:44:02 | FromDiscord | <mratsim> if you don't consume the continuation and allow it to be duplicated, you will introduce time travelling in Nim |
19:44:09 | disruptek | sweet. |
19:44:17 | FromDiscord | <mratsim> let's say your continuation ends up by closing a database |
19:44:25 | FromDiscord | <mratsim> if it's immutable, you will close it twice |
19:44:32 | FromDiscord | <mratsim> "enter the room once and leave twice" |
19:44:47 | disruptek | don't use an immutable input, then. |
19:44:49 | FromDiscord | <mratsim> this require an expensive scheme called "unwind" in scheme garbage collector |
19:45:08 | FromDiscord | <mratsim> it's much easier to reason about one-shot continuation |
19:45:22 | disruptek | just because you can't reason about it doesn't mean i can't. |
19:45:43 | FromDiscord | <mratsim> and no one found a use case for multishot continuations (copyable continuations) except as a challenge for the "non-deterministic program" |
19:46:09 | FromDiscord | <mratsim> if we really want that flexible this should be added later. |
19:46:13 | FromDiscord | <mratsim> flexibility |
19:46:29 | disruptek | well, i won't be adding it later. i have it already. |
19:46:37 | FromDiscord | <mratsim> it's unergonomic |
19:46:43 | disruptek | you don't have to use it. |
19:46:44 | FromDiscord | <mratsim> we shouldn't expose the raw Cont |
19:47:04 | disruptek | how do you handle recursing over a view? |
19:47:06 | FromDiscord | <mratsim> not should we ask users to write their own Cont type, this can be autogenerated |
19:47:16 | disruptek | you can do that in your branch. |
19:47:34 | FromDiscord | <mratsim> not sure what you mean. But one-shot delimited continuation can model all control flow. |
19:47:51 | disruptek | you have a view that you don't own. how do you write an iterator against it? |
19:48:01 | FromDiscord | <mratsim> so captureing, suspending and resuming a continuation should be all we need |
19:48:22 | FromDiscord | <mratsim> openarray are value types now |
19:48:35 | FromDiscord | <mratsim> you can store that in the coroutine |
19:49:05 | * | abm joined #nim |
19:49:49 | disruptek | fine, not an openarray. |
19:49:53 | disruptek | some other immutable type. |
19:50:32 | FromDiscord | <mratsim> types are either, not owned, uncopyable or unmovable |
19:50:52 | disruptek | i'm gonna pass on that. |
19:50:56 | FromDiscord | <mratsim> if uncopyable, whell you just need the user not to use it anymore so that it's moved in the coroutine |
19:51:22 | FromDiscord | <mratsim> unmovable, it's likely that you just shouldn't use it beyond what it's intended for |
19:52:08 | FromDiscord | <mratsim> but I really don't see any reason to expose the raw continuation and even less to make it immutable. |
19:52:46 | FromDiscord | <mratsim> I'd rather have a simple, coherent story without gaping caveats for the first iteration that solves 99.9% of the problem domain |
19:53:24 | disruptek | you can do that without sacrificing immutability, but suit yourself. |
19:53:38 | disruptek | i don't really care what you use in weave. |
19:53:49 | FromDiscord | <mratsim> I'm not taking about Weave |
19:54:08 | FromDiscord | <mratsim> I'm talking about streams, sequtils, strutils, asyncstreams, futures. |
19:54:10 | disruptek | i don't really care what you use. |
19:55:00 | Zevv | Does this affect your CSP dreams somehow? |
19:55:24 | disruptek | is immutability somehow important? yes. |
19:55:32 | Zevv | how |
19:55:43 | disruptek | i plan to use cps on values that are immutable. |
19:57:26 | FromDiscord | <mratsim> http://scheme-reports.org/mail/scheme-reports/msg02780.html↵http://www.atdot.net/~ko1/pub/ContinuationFest-ruby.pdf↵↵look for "dynamic-wind" as well. the continuation should be destroyed, not immutable. |
19:57:50 | disruptek | believe it or not, i actually don't care about scheme's impl. |
19:57:54 | FromDiscord | <mratsim> there is no problem to use CPS as is on immutable value, they are copied or moved into the continuation |
19:58:17 | disruptek | yeah, nah. |
19:58:19 | Zevv | yeah, you're not giving up the immutability of your data, right? |
19:58:36 | disruptek | no way. |
19:58:54 | Zevv | no, I mean, you can still use mutant CPS with unmutable data? |
19:59:01 | FromDiscord | <mratsim> yes |
19:59:08 | disruptek | not without modifying memory. |
19:59:11 | FromDiscord | <mratsim> you mutate the continuation not the input |
19:59:48 | FromDiscord | <mratsim> it's better if you show an example. |
20:00:25 | * | habamax quit (Ping timeout: 246 seconds) |
20:00:27 | FromDiscord | <mratsim> when you pass "counter(1, 2)" 1 and 2 are immutable, they don't even have an address |
20:02:21 | disruptek | nimph's tests demonstrate a --gc:arc bug with json parsing. |
20:05:33 | FromDiscord | <mratsim> I have found the ultimate ARC+CPS repo: https://github.com/awwx/arc-cps |
20:10:24 | disruptek | hmm, it's not json, it's something even more fun. |
20:11:11 | disruptek | i'm too old for this shit. |
20:12:26 | * | Arrrrrrrr quit (Remote host closed the connection) |
20:14:49 | FromDiscord | <dk> Is there a variant of `asyncfutures.or` that takes a `varargs` instead of exactly two arguments |
20:15:02 | disruptek | it's easy to write. |
20:16:15 | disruptek | !repo disruptek/rest |
20:16:16 | disbot | https://github.com/disruptek/rest -- 9rest: 11REST comfort 15 0⭐ 0🍴 |
20:16:23 | disruptek | pretty sure i have one in there. |
20:17:31 | disruptek | async is so 2006. |
20:18:46 | Zevv | dude 158 repos |
20:18:49 | saem_ | disruptek: (this is purely for my curiosity) in regards to the immutability conversation above are you're referring to a situation such as, I as a potential author of tock (fn in the readme) want to ensure that any state captured within the continutation (which is really mine) doesn't get mutated/corrupted by a dispatcher or whatever? |
20:19:52 | Zevv | !repo yourang |
20:19:53 | disbot | https://github.com/disruptek/yourang -- 9yourang: 11Thread-safe performant async I/O for Linux 15 5⭐ 0🍴 |
20:19:55 | Zevv | you never told me that |
20:19:59 | disruptek | it's more along the lines of, /someone gave me this immutable thing and i want to look at it with an operation that may have a continuation in it/ |
20:20:10 | disruptek | i didn't finish yourang. |
20:20:27 | FromDiscord | <dk> @disruptek thanks |
20:20:32 | Zevv | I never actually /used/ io_uring, only read about it and looked at the headers |
20:21:31 | Zevv | disruptek: but your continuation will hold a copy of your original memory by default right |
20:21:50 | disruptek | what? |
20:21:58 | FromDiscord | <mratsim> or a move if the mutation completely owns it |
20:22:01 | Zevv | right |
20:22:39 | disruptek | let's put it like this: i want to impl my continuations using strictFuncs. |
20:22:47 | Zevv | hmmm. |
20:23:09 | Zevv | but you will not /implement/ your continuations. CPS will do that for you |
20:23:21 | Zevv | but if you CPS a structFunc function... |
20:23:43 | FromDiscord | <mratsim> in the template generated to access the env, we can do some trickery to prevent compilation if an originally immutable parameter is accessed in a mutable way |
20:23:47 | disruptek | cps will merely rewrite my control-flow. i still want to compose using strictFunc. |
20:24:14 | Zevv | I really need more real life code and examples to think about this stuff |
20:24:24 | FromDiscord | <mratsim> mutant continuations doesn't prevent strict func, I don't see the problem. |
20:24:31 | disruptek | toys are pointless. |
20:25:17 | FromDiscord | <mratsim> the only issue I see is that originally immutable parameters as declared by the user, can be used in a mutable manner in the continuation due to the rewrite. |
20:25:28 | FromDiscord | <mratsim> and the compiler will not catch that |
20:25:49 | FromDiscord | <mratsim> but we can probably modify the template call to catch that. |
20:25:52 | disruptek | i will break your toys, but first i have to try to work around this arc memory corruption. |
20:26:02 | Zevv | fair nuff |
20:26:08 | Zevv | can I assist in that? |
20:26:10 | disruptek | zevv: yourang is not a liburing wrapper. |
20:27:01 | disruptek | ie. it using the syscalls directly. |
20:27:17 | Zevv | yea I know |
20:27:25 | disruptek | if you wanna corrupt your memory, nimph/tests/tpackage.nim ftw |
20:28:21 | Zevv | how does it manifest? |
20:28:46 | disruptek | corrupted package object in the packages group that we parse from json. |
20:29:01 | disruptek | Package is ref object |
20:35:21 | disruptek | i bet it's move(x, x) |
20:35:28 | disruptek | yep. |
20:35:31 | disruptek | gah, so dumb. |
20:36:08 | * | hnOsmium0001 joined #nim |
20:36:33 | Zevv | ow so |
20:36:35 | Zevv | how |
20:36:48 | FromDiscord | <acek7> anyone here a fan of .net c# stuff |
20:36:55 | Zevv | nope |
20:36:59 | disruptek | group[x.toLowerAscii] = group[x] # corruption |
20:37:16 | Zevv | uhm wait what |
20:37:22 | FromDiscord | <mratsim> I like that they introduced Monads and Continuations to the imperative world but otherwise no. |
20:37:32 | FromDiscord | <mratsim> sorry async/await |
20:37:37 | FromDiscord | <mratsim> not continuations |
20:37:46 | FromDiscord | <mratsim> I'm too deep in the pit |
20:40:40 | disruptek | i would rather write c# than java, except that, y'know, i'd rather have access to the jvm than .net. so, there's that. |
20:43:33 | Zevv | so where's shashlick gone |
20:43:38 | Zevv | he just went into thin air |
20:43:53 | disruptek | he's taking a break from his oss hobby. |
20:43:54 | Zevv | argh FUCK dependencies, in the broadest sense |
20:44:36 | Zevv | oh sorry |
20:45:11 | disruptek | nimph no longer supports nim-1.0 for nimterop reasons. 🤷 |
20:49:16 | * | narimiran quit (Ping timeout: 240 seconds) |
20:51:11 | FromDiscord | <mratsim> sent a long message, see http://ix.io/2K8y |
20:51:13 | FromDiscord | <mratsim> I'll write something on the repo |
20:52:51 | Zevv | I think we considered stuff like this once. We considered so many stuffs |
20:54:04 | Zevv | but |
20:54:07 | disruptek | or, you just do what we did. 😉 |
20:54:33 | Zevv | if we inject the 'fake' locals with templates, can't we just make things ro there |
20:54:55 | disruptek | we don't use templates anymore. |
20:54:59 | Zevv | ooh |
20:55:03 | Zevv | we rewrite again? |
20:55:09 | Zevv | the templates were my best idea |
20:55:18 | disruptek | we just rewrite all the syms. |
20:55:22 | Zevv | pfff |
20:55:51 | disruptek | at least, that's my recollection. |
20:57:16 | FromDiscord | <mratsim> in Weave I use the wrapper proc techniques, though everything is immutable in Weave. |
21:03:19 | FromDiscord | <mratsim> @zevv, I think this describes @disruptek immutability issues with mutant and a solution: https://github.com/disruptek/cps/issues/44 |
21:03:24 | disbot | ➥ Preventing immutable parameters from becoming mutable. ; snippet at 12https://play.nim-lang.org/#ix=2K8E |
21:04:34 | Zevv | or you just inject "let a = c.a" |
21:04:37 | Zevv | but whatever |
21:04:55 | FromDiscord | <mratsim> if c.a is array[32, byte] that's expensive. |
21:05:44 | FromDiscord | <mratsim> using with {.byaddr.} I think we can still mutate as well. |
21:05:54 | FromDiscord | <mratsim> not sure, @Clyybber ? ^ |
21:06:44 | * | l1x joined #nim |
21:15:02 | FromDiscord | <mratsim> tested, let byaddr doesn't prevent mutation through the alias. |
21:15:21 | * | saem quit (Quit: Connection closed for inactivity) |
21:15:21 | * | saem_ is now known as saem |
21:17:33 | Zevv | ha |
21:19:35 | FromDiscord | <mratsim> it's like ref, you cannot change the pointer but you can change what is underneath |
21:19:45 | FromDiscord | <mratsim> but the proc indirection would work |
21:20:21 | FromDiscord | <mratsim> it would also cleanly separate CPS stuff in the wrapper from user stuff in the inner proc. |
21:23:11 | FromDiscord | <mratsim> an alternative is to use distinct types, but I think it only works if you know all the proc you need to support:↵↵https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/laser/tensor/datatypes.nim#L19-L20 |
21:23:20 | FromDiscord | <mratsim> https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/laser/tensor/datatypes.nim#L200-L210 |
21:30:10 | * | lritter quit (Quit: Leaving) |
21:45:14 | * | Vladar quit (Quit: Leaving) |
22:05:55 | * | oculux joined #nim |
22:31:34 | FromGitter | <deech> Can't think of why this is in any way helpful but apparently you can have a proc with empty constraints like: `proc p[]() = ...` |
22:46:32 | * | leorize quit (Quit: WeeChat 2.9) |
22:56:26 | planetis[m] | macros. |
23:09:59 | planetis[m] | also `case;else: discard` is possible again because of macros |
23:23:02 | FromDiscord | <bark> I've debugged a segfault down to a single line, where if I comment/uncomment, the segfault doesn't/does occur... it's a setForegroundColor call 🤔 |
23:30:02 | FromDiscord | <bark> I am probably messing up with something gc related 🤔 |
23:31:03 | disruptek | code or it didn't happen. |
23:34:38 | FromDiscord | <bark> I just realized I put ref values behind pointer arithmetic, so something weird was bound to happen sooner or later |
23:35:22 | FromDiscord | <bark> i mean not directly, but a large object where one of its kinds could have been a ref value |
23:36:05 | FromDiscord | <bark> so i'll go with didn't happen |
23:47:38 | * | vicfred joined #nim |
23:54:55 | * | tane quit (Quit: Leaving) |
23:56:17 | saem | And all done with GDB related changes for now. |
23:56:29 | saem | PR: https://github.com/nim-lang/Nim/pull/16479 |
23:56:30 | disbot | ➥ Attempts at improving nim-gdb.py |
23:56:57 | saem | on to nimsuggest findProjectNimFile |