00:08:28 | FromDiscord | <drsensor👹> sent a code paste, see https://play.nim-lang.org/#ix=2uc0 |
00:08:44 | Yardanico | toSeq |
00:08:49 | Yardanico | from sequtils |
00:08:49 | FromDiscord | <drsensor👹> (edit) 'https://play.nim-lang.org/#ix=2uc0' => 'https://play.nim-lang.org/#ix=2uc1' |
00:09:02 | Yardanico | also are you sure you want that? |
00:09:05 | Yardanico | not key, but the value? |
00:09:12 | disruptek | do you speak Mandarin? |
00:09:47 | FromDiscord | <drsensor👹> @Yardanico yups |
00:09:59 | Yardanico | then toSeq from sequtils |
00:10:15 | Yardanico | but it might be quite not efficient if you do it often and your table is big |
00:10:43 | FromDiscord | <drsensor👹> sent a code paste, see https://play.nim-lang.org/#ix=2uc2 |
00:10:58 | Yardanico | echo myval in toSeq(tables.values) |
00:11:01 | Yardanico | that's how you should use it |
00:11:06 | Yardanico | sorry |
00:11:12 | Yardanico | echo myval in toSeq(mytable.values) |
00:12:08 | FromDiscord | <drsensor👹> ah |
00:16:34 | disruptek | are there rules here against snakes? |
00:16:54 | Yardanico | tunnel snakes rule |
00:16:57 | disruptek | how many of you own stringed instruments? |
00:16:58 | Yardanico | we are tunnel snakes |
00:17:09 | Yardanico | https://www.youtube.com/watch?v=S0ximxe4XtU |
00:18:35 | disruptek | where do you stand on the corn argument? is corn a vegetable? |
00:18:49 | Yardanico | I don't know honestly |
00:18:51 | Yardanico | and don't care |
00:18:55 | Yardanico | all I know is that I can eat it or cook it |
00:19:05 | disruptek | think about it. |
00:23:23 | disruptek | i feel bad about your neck. |
00:24:59 | * | krux02__ quit (Remote host closed the connection) |
00:27:58 | FromDiscord | <Rika> corn |
00:37:09 | * | NimBot joined #nim |
00:37:29 | disruptek | rika: when did you learn how to think? |
00:37:38 | leorize[m] | Yardanico: do you still have your version of nimforum running? |
00:37:50 | Yardanico | yeah, seems like it's still running |
00:38:01 | Yardanico | https://forum.my-toolbox.xyz/ |
00:38:06 | leorize[m] | where can I find it? |
00:40:35 | Yardanico | I didn't update it for a few months though |
00:40:44 | disruptek | good thinking. |
00:40:50 | Yardanico | I mean it has my hackish opengraph addition though |
00:40:55 | disruptek | nice! |
00:40:59 | Yardanico | but nimforum didn't get any real changes anyway |
00:41:08 | Yardanico | ah seems like it did |
00:41:09 | leorize[m] | at least you're running on up-to-date jester |
00:41:12 | Yardanico | haha |
00:41:54 | Yardanico | also it's much snappier for me than the official instance, maybe because it has much less threads, idk :) |
00:42:14 | leorize[m] | like dom96 fix a zero-day in jester then proceed to not update the forum :P (not that it affects the forum, cloudflare protects against this stuff) |
00:45:17 | FromDiscord | <Rika> disruptek: i did? |
00:49:09 | * | vicfred quit (Quit: Leaving) |
00:53:39 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
00:53:56 | disruptek | my mistake. |
01:02:57 | FromGitter | <iffy> What's the best way to assert that an object implements a certain interface? Concepts? |
01:03:03 | disruptek | indeed. |
01:03:20 | FromGitter | <iffy> thanks! |
01:03:27 | Yardanico | but don't forget that concepts are compile-time only |
01:03:30 | Yardanico | you can't store them in seqs, etc |
01:03:36 | FromGitter | <iffy> right; I like that part |
01:03:39 | Yardanico | that said, they work just fine for proc arguments and stuff |
01:04:59 | FromGitter | <iffy> hmm... anyway to assert that a module defines a newMyObject proc? I have when defined(ios): ... elif defined(android):... stuff and want to make sure both branches have a newMyObject proc. Anything better than a unittest for that? |
01:05:37 | disruptek | use a concept and see if the proc is defined for the type. |
01:06:10 | FromGitter | <iffy> okay, I'll play with that |
01:32:25 | * | abm quit (Quit: Leaving) |
01:35:25 | * | awe004 quit (Ping timeout: 240 seconds) |
01:51:23 | FromDiscord | <Varriount> Anyone know what the state of the `channels` module is? |
01:51:29 | Yardanico | wdym? |
01:51:30 | Yardanico | it works |
01:51:31 | * | apahl_ joined #nim |
01:52:42 | * | ForumUpdaterBot quit (Remote host closed the connection) |
01:52:51 | * | ForumUpdaterBot joined #nim |
01:54:11 | FromDiscord | <Varriount> Yardanico: What is the performance like? |
01:54:22 | Yardanico | I don't know, but it should be enough? |
01:54:26 | Yardanico | I didn't see any benchmarks for it |
01:54:27 | FromDiscord | <Varriount> I ask, because I recall something about channels needing to be optimized |
01:54:34 | * | apahl quit (Ping timeout: 256 seconds) |
02:02:57 | * | audiofile joined #nim |
02:27:57 | * | bunbunbunbunny joined #nim |
02:36:47 | * | muffindrake quit (Ping timeout: 272 seconds) |
02:38:24 | * | muffindrake joined #nim |
02:38:48 | * | vicfred joined #nim |
02:40:06 | FromGitter | <iffy> Is there a way to get more information about why a concept doesn't match a thing? |
02:40:30 | FromGitter | <iffy> from `assert MyThing is MyConcept` |
02:45:54 | * | bunbunbunbunny quit (Quit: Lost terminal) |
02:48:11 | * | leorize joined #nim |
02:53:43 | * | leorize quit (Ping timeout: 240 seconds) |
02:58:03 | * | endragor joined #nim |
03:02:05 | * | endragor quit (Ping timeout: 240 seconds) |
03:08:06 | FromDiscord | <Admin> sent a code paste, see https://play.nim-lang.org/#ix=2ucy |
03:08:18 | * | surma quit (Ping timeout: 256 seconds) |
03:09:33 | Yardanico | install xorg-devel |
03:09:41 | Yardanico | xorg-dev rather |
03:10:41 | FromGitter | <iffy> Hey, that works great, disruptek: https://play.nim-lang.org/#ix=2ucz If I could find a way to eliminate the `nop` proc, that's be ideal, but it works, so I'll use it as-is |
03:11:11 | FromDiscord | <Admin> @Yardanico works ty buddy |
03:11:29 | * | r4vi quit (Read error: Connection reset by peer) |
03:12:24 | * | bunbunbunbunny joined #nim |
03:12:58 | * | r4vi joined #nim |
03:12:58 | * | surma joined #nim |
03:17:31 | * | r4vi quit (Read error: Connection reset by peer) |
03:22:24 | * | surma quit (Ping timeout: 256 seconds) |
03:24:41 | * | endragor joined #nim |
03:25:39 | * | surma joined #nim |
03:29:38 | * | endragor quit (Remote host closed the connection) |
03:30:06 | * | r4vi joined #nim |
03:30:27 | * | endragor joined #nim |
03:30:54 | * | bunbunbunbunny quit (Quit: leaving) |
03:35:38 | * | endragor quit (Ping timeout: 260 seconds) |
03:39:36 | FromDiscord | <Varriount> Hrm. I have no idea what I should work on. |
03:39:56 | FromDiscord | <Varriount> Anyone need help with something Nim-related? |
03:41:50 | * | endragor joined #nim |
03:49:00 | FromDiscord | <InventorMatt> Making an xml-rpc in nim? |
03:52:48 | * | bunbunbunbunny joined #nim |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:32 | * | supakeen joined #nim |
04:09:03 | FromDiscord | <Varriount> @InventorMatt I would prefer not to be eaten alive by XML |
04:09:49 | FromDiscord | <Varriount> Anyway, I consider anything networking-related off the table until there's some sort of consensus on what Async will be. |
04:11:23 | FromDiscord | <InventorMatt> Understandable. |
04:11:33 | FromDiscord | <Varriount> I guess I could come up with my own Async framework prototype. |
04:17:26 | * | audiofile quit (Ping timeout: 256 seconds) |
04:35:22 | * | endragor quit (Remote host closed the connection) |
04:35:49 | * | endragor joined #nim |
04:39:56 | * | pulux quit (Quit: WeeChat 2.8) |
04:40:11 | * | bunbunbunbunny quit (Ping timeout: 240 seconds) |
04:41:11 | * | endragor quit (Ping timeout: 246 seconds) |
04:52:00 | * | bunbunbunbunny joined #nim |
04:57:06 | * | bunbunbunbunny quit (Ping timeout: 256 seconds) |
05:06:04 | * | bunbunbunbunny joined #nim |
05:06:24 | * | bunbunbunbunny quit (Client Quit) |
05:17:29 | * | justsomeguy joined #nim |
05:49:12 | * | arecacea1 quit (Read error: Connection reset by peer) |
05:51:04 | * | arecacea1 joined #nim |
06:01:49 | * | endragor joined #nim |
06:05:43 | * | solitudesf joined #nim |
06:08:30 | * | endragor quit (Ping timeout: 256 seconds) |
06:17:34 | * | JustASlacker quit (Ping timeout: 256 seconds) |
06:36:08 | * | justsomeguy left #nim (#nim) |
06:58:19 | FromDiscord | <vieru> hi does anybody know how you can limit your app to only one instance ? |
06:58:36 | Yardanico | wdym? |
06:58:47 | Yardanico | What does "app" and "instance" mean in your message? |
06:58:51 | Yardanico | is it related to some nim library? |
06:58:56 | FromDiscord | <vieru> no |
06:59:03 | FromDiscord | <vieru> the program i mean |
06:59:11 | FromDiscord | <vieru> executable |
06:59:50 | FromDiscord | <vieru> i just want to click 10000 times on the app icon and there should be only one app in the task manager |
06:59:56 | FromDiscord | <vieru> sry for my english lol |
06:59:57 | FromDiscord | <Elegant Beef> The dumbest method is to make a temporary file that if it exists exit out |
07:00:39 | FromDiscord | <vieru> yeah that could work but if the program studently stops it wont start again lol |
07:01:12 | Yardanico | for windows you can check if there's a running process with the name of your app |
07:01:13 | FromDiscord | <vieru> there's a winapi method but i want to know if nim has something of its own |
07:01:16 | Yardanico | and if so - exit |
07:01:36 | Yardanico | https://rosettacode.org/wiki/Determine_if_only_one_instance_is_running |
07:01:49 | Yardanico | there are a few nim examples, although I guess they're somewhat outdated |
07:01:56 | Yardanico | and they're both posix-specific |
07:03:31 | FromDiscord | <vieru> yeah i know about this but i want it to be my last resort method↵like i want to know if there's a method for it already implemented |
07:03:37 | FromDiscord | <vieru> if not ill just write my own |
07:03:42 | Yardanico | no, I don't think there is |
07:03:47 | Yardanico | it's a quite specific problem :P |
07:05:01 | FromDiscord | <vieru> ik electronjs has something like this |
07:05:32 | * | rokups joined #nim |
07:06:19 | FromDiscord | <vieru> https://github.com/electron/electron/blob/master/docs/api/app.md#apprequestsingleinstancelock |
07:07:00 | FromDiscord | <vieru> and i dont think it searches for the name of the process or smth |
07:08:06 | FromDiscord | <vieru> this too |
07:08:08 | FromDiscord | <vieru> https://github.com/electron/electron/blob/v0.36.10/docs/api/app.md#appmakesingleinstancecallback |
07:28:39 | * | JustASlacker joined #nim |
07:28:50 | * | JustASlacker quit (Remote host closed the connection) |
07:47:45 | * | vqrs quit (Ping timeout: 272 seconds) |
08:12:33 | FromDiscord | <wiremoons> Hi - when running `nimble init` to setup a new Nim project - is there any nimble hook that allows the init process to also run some additonal setup commands? Like a local nimble system wide / per user config file perhaps, that would run an addtional Nimscript to perform extra init steps straight away? Basically a `nimble init` extention hook? |
08:17:06 | * | leorize joined #nim |
08:23:30 | * | awe004 joined #nim |
08:24:43 | * | leorize quit (Ping timeout: 240 seconds) |
08:25:23 | * | Prestige quit (Quit: Prestige) |
08:25:45 | * | Prestige joined #nim |
08:51:08 | FromDiscord | <Recruit_main707> I don’t think so |
08:59:32 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:00:21 | * | j4nvkvc quit (Quit: Idle for 30+ days) |
09:01:15 | FromGitter | <aachh> Hey, I’ve got a question: what do seqs compile to more or less? |
09:01:33 | FromGitter | <aachh> Are they something like dynamic arrays or more like linked lists? |
09:01:40 | Yardanico | just heap-allocated dynamic arrays |
09:01:44 | * | Zambyte[m] quit (Quit: Idle for 30+ days) |
09:01:46 | Yardanico | there are linked lists in the stdlib |
09:01:54 | Yardanico | if you want to really know the internal memory structure of a seq, it's this: |
09:01:54 | FromGitter | <aachh> Great, thank you very much! |
09:02:05 | Yardanico | for old runtime it's |
09:02:16 | Yardanico | len, cap: int, data: pointer to dynamic array |
09:02:18 | Yardanico | for new runtime: |
09:02:29 | Yardanico | len: int, obj: pointer to object with cap: int and data: array |
09:02:40 | Yardanico | https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim#L17 |
09:02:53 | FromGitter | <aachh> Oh, great great! Thanks for the link! |
09:02:54 | Yardanico | that's the internal memory layout of seqs for the new runtime (arc/orc) |
09:03:11 | FromGitter | <aachh> Thanks! |
09:03:20 | Yardanico | also strings have the exact same memory layout as seqs |
09:03:28 | Yardanico | although this is more or less an implementation detail :P |
09:04:13 | Yardanico | if you're interested in singly/doubly linked lists/rings - there's https://nim-lang.org/docs/lists.html |
09:05:44 | FromGitter | <aachh> No, I actually was looking for something more reminiscent of what you’ve shown me seqs are |
09:05:49 | FromGitter | <aachh> So that’s solved! |
09:11:07 | FromDiscord | <lqdev> i wonder why the seq layout was changed |
09:15:18 | * | rokups quit (Quit: Connection closed for inactivity) |
09:22:38 | * | krux02 joined #nim |
09:29:33 | * | endragor joined #nim |
09:34:02 | * | endragor quit (Ping timeout: 260 seconds) |
09:36:15 | FromDiscord | <Rika> i wonder too |
09:36:42 | Yardanico | maybe @clyybber knows :P |
09:47:55 | FromDiscord | <Clyybber> why it was changed to pointer len pair? |
09:48:15 | * | Trustable joined #nim |
09:48:43 | FromDiscord | <Clyybber> because its one indirection less for getting the length |
09:49:09 | FromDiscord | <Clyybber> and it fits well with nil seq is empty seq |
10:01:02 | * | Kaivo quit (Quit: WeeChat 2.9) |
10:15:23 | * | Vladar joined #nim |
10:15:28 | FromDiscord | <lqdev> oh cool |
10:20:42 | * | leorize joined #nim |
10:23:40 | * | abm joined #nim |
10:28:03 | * | leorize quit (Ping timeout: 240 seconds) |
10:31:26 | * | leorize joined #nim |
10:31:44 | * | endragor joined #nim |
10:39:43 | * | leorize quit (Ping timeout: 240 seconds) |
10:41:05 | * | endragor quit (Ping timeout: 240 seconds) |
10:45:40 | FromDiscord | <LiteLotus> hey guys. i decided to dive back into nim but im struggling to import cpp libraries |
10:46:06 | FromDiscord | <LiteLotus> i dont understand how to use c2nim properly |
10:46:13 | FromDiscord | <LiteLotus> the documentation is alittle obtuse |
10:47:57 | * | arecacea1 quit (Remote host closed the connection) |
10:48:21 | * | arecacea1 joined #nim |
10:49:09 | FromDiscord | <Clyybber> c2nim doesn't really support cpp |
10:49:16 | FromDiscord | <LiteLotus> does it not? |
10:49:29 | FromDiscord | <Clyybber> nope, it requires manual work most of the time |
10:49:37 | FromDiscord | <LiteLotus> rip |
10:49:43 | FromDiscord | <LiteLotus> are there any alternatives? |
10:51:00 | FromDiscord | <Clyybber> theres nimterop but afaik it doesn't support cpp either (maybe to a certain degree); what do you want to wrap? |
10:52:12 | FromDiscord | <LiteLotus> https://github.com/drewnoakes/joystick |
10:52:13 | FromDiscord | <LiteLotus> this |
10:53:05 | Yardanico | can't you just use SDL instead? |
10:53:14 | FromDiscord | <Clyybber> seems relatively small to me, could be done manually I think |
10:53:21 | FromDiscord | <Recruit_main707> c2nim has given me good results with cpp |
10:53:22 | FromDiscord | <Clyybber> @Zachary Carter and shashlick are the guys to ask |
10:53:35 | FromDiscord | <Recruit_main707> not with big libraries, but with small things it works pretty well |
10:53:38 | Yardanico | yeah the API seems to be simple |
10:53:42 | Yardanico | could be even wrapped manually |
10:53:50 | FromDiscord | <Clyybber> yeah, maybe c2nim will work for this case |
10:54:27 | FromDiscord | <LiteLotus> ok, so how would i go about wrapping it |
10:54:35 | FromDiscord | <LiteLotus> ive never done somethign like this before |
10:54:54 | FromDiscord | <LiteLotus> is there any guides / documentation? |
10:55:12 | FromDiscord | <LiteLotus> the C2Nim documentation is just hard to get my head around |
10:55:49 | FromDiscord | <flywind> See https://nim-lang.github.io/Nim/manual.html#importcpp-pragma-importcpp-for-objects |
10:55:54 | FromDiscord | <Clyybber> tbh this library seems so simple it might be worth it just rewriting it in nim directly |
10:55:59 | FromDiscord | <flywind> and https://github.com/kaushalmodi/std_vector/blob/master/src/std_vector.nim |
10:56:18 | FromDiscord | <Clyybber> because the object oriented aspect of that library really seems unneccessary to me |
10:57:36 | FromDiscord | <Clyybber> but if you still want to wrap it I think flywinds links are a good resource |
10:57:54 | FromDiscord | <Clyybber> or just try to run c2nim, it should have a good help message |
10:58:09 | FromDiscord | <LiteLotus> i mean i agree i may aswell rewrite it |
10:58:25 | FromDiscord | <LiteLotus> i just thought linux event streams were more complex than they actually are |
10:58:32 | * | filcuc joined #nim |
11:07:14 | FromDiscord | <LiteLotus> when i finish rewriting this how would i submit it to become a nimble addon? |
11:07:28 | FromDiscord | <Clyybber> nimble publish I think |
11:07:35 | * | leorize joined #nim |
11:12:35 | Yardanico | @LiteLotus well, first of all you need to make sure it has a correct nimble package structure :) |
11:12:40 | Yardanico | but yeah, then it's just "nimble publish" |
11:12:46 | FromDiscord | <LiteLotus> cool |
11:12:48 | FromDiscord | <LiteLotus> thanks |
11:13:12 | FromDiscord | <LiteLotus> everyone is nicer than when i started using nim and was asking semi obvious wuestions |
11:13:17 | FromDiscord | <LiteLotus> (edit) 'wuestions' => 'questions' |
11:30:01 | * | endragor joined #nim |
11:32:04 | * | sagax quit (Ping timeout: 246 seconds) |
11:39:29 | * | s4mu3lbk joined #nim |
11:42:48 | * | fowl_ joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:34 | * | supakeen joined #nim |
12:06:57 | * | filcuc_ joined #nim |
12:07:04 | * | filcuc quit (Ping timeout: 246 seconds) |
12:11:19 | * | filcuc_ quit (Ping timeout: 256 seconds) |
12:11:27 | * | filcuc joined #nim |
12:21:25 | * | xet7 quit (Remote host closed the connection) |
12:22:56 | * | D_ quit (Remote host closed the connection) |
12:23:51 | * | D_ joined #nim |
12:37:22 | FromDiscord | <Recruit_main707> can you export a custom pragma? |
12:38:01 | FromDiscord | <Clyybber> nope, not yet |
12:38:25 | FromDiscord | <Recruit_main707> is there a pr to allow it? |
12:38:55 | FromDiscord | <Clyybber> nope |
12:40:07 | FromDiscord | <Recruit_main707> so its only planned |
12:40:25 | FromDiscord | <Recruit_main707> i guess include will do until then |
12:49:27 | leorize | technically you can just write a macro that adds pragmas into things |
12:49:31 | leorize | then export that |
12:55:38 | * | s4mu3lbk quit (Quit: Leaving) |
13:02:39 | FromDiscord | <Zachary Carter> You can also check out Nim line |
13:03:50 | FromDiscord | <Zachary Carter> https://github.com/sinkingsugar/nimline |
13:05:23 | * | leorize quit (Ping timeout: 240 seconds) |
13:05:44 | FromDiscord | <Zachary Carter> Some things should stay in C++ world though... If you're dealing with multiple inheritance, have a need to override virtual functions or play with vtables, good luck! |
13:06:49 | FromDiscord | <Zachary Carter> Maybe eventually Nim will develop abilities to gracefully handle these situations |
13:07:44 | FromDiscord | <Zachary Carter> Doubtful though... The emit pragma is much better IMO than Python's solution(s) |
13:08:15 | * | leorize joined #nim |
13:09:33 | FromDiscord | <Zachary Carter> Another piece of advice - don't try to do OOP with Nim... |
13:13:02 | FromDiscord | <Zachary Carter> You'll be much better off with Nim programming using a procedural programming mindset. Pretend you're using a better C with a robust standard library and a garbage collector. YMMV. |
13:13:18 | FromDiscord | <Zachary Carter> (edit) removed 'programming' |
13:14:52 | FromDiscord | <Zachary Carter> Finally, I'd just use sokol, sdl2 or glfw depending on your needs. |
13:16:33 | FromDiscord | <Zachary Carter> @LiteLotus ^ |
13:18:01 | FromDiscord | <Zachary Carter> @Recruit_main707 just put your custom pragma inside of a template |
13:20:07 | FromDiscord | <Zachary Carter> And export the template / call it in the module you want to use it in. |
13:22:16 | FromDiscord | <Zachary Carter> template pluginApis*() = |
13:22:35 | FromDiscord | <Zachary Carter> https://github.com/zacharycarter/junkers/blob/5e41d431b9faa27a56ff46b68f05dc0b9684bfa5/src/api.nim#L67 |
13:23:54 | * | FromDiscord quit (Remote host closed the connection) |
13:24:11 | * | FromDiscord joined #nim |
13:26:15 | FromDiscord | <Zachary Carter> https://github.com/zacharycarter/junkers/blob/5e41d431b9faa27a56ff46b68f05dc0b9684bfa5/src/junkers.nim#L3 |
13:27:31 | FromDiscord | <Zachary Carter> No need to include |
13:27:34 | * | sagax joined #nim |
13:34:23 | * | leorize quit (Ping timeout: 240 seconds) |
13:42:37 | FromDiscord | <Recruit_main707> ok, i will check this, thx |
13:47:05 | * | awe004 quit (Ping timeout: 256 seconds) |
13:50:27 | * | arecacea1 quit (Remote host closed the connection) |
13:50:32 | FromDiscord | <Zachary Carter> No problem. |
13:50:51 | * | arecacea1 joined #nim |
13:55:43 | * | awe004 joined #nim |
14:13:41 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2ueX |
14:14:18 | disruptek | Yardanico: will you please fix that? |
14:15:28 | FromDiscord | <niv> hey. whats the canonical/official/recommended way to represent a bunch of non-printably/binary payload? string? seq[byte]? something else? |
14:16:07 | disruptek | probably seq[byte] but i cannot fathom why string isn't fine. i always use string. |
14:16:12 | FromDiscord | <lqdev> i use `seq[uint8]` |
14:16:33 | FromDiscord | <niv> i use string as well because most c bindings can cast to/from easily, not so sure about seq[] |
14:16:50 | FromDiscord | <niv> how about distinct string, to indicate to the api user its not a printable? |
14:18:11 | FromDiscord | <niv> relatedly, is there a good way to cast a string to a seq[uint8] or back without a memcpy? |
14:24:12 | * | leorize joined #nim |
14:29:23 | * | leorize quit (Ping timeout: 240 seconds) |
14:30:52 | FromDiscord | <Zachary Carter> when interoping with C I use `seq[uint8]` |
14:31:24 | FromDiscord | <Zachary Carter> no I don't think you can cast to a seq without a memcopy |
14:32:21 | FromDiscord | <niv> alright, cheers |
14:33:15 | FromDiscord | <Zachary Carter> (edit) 'memcopy' => 'memcpy' |
14:33:25 | * | leorize joined #nim |
14:40:01 | FromDiscord | <lqdev> actually, you can |
14:40:10 | FromDiscord | <lqdev> it's a bit hacky but the mem layout is the same anyways |
14:41:14 | FromDiscord | <Zachary Carter> How? |
14:48:43 | * | leorize quit (Ping timeout: 240 seconds) |
14:48:45 | FromDiscord | <LiteLotus> whats the equivalent of a double in nim? |
14:48:53 | FromDiscord | <LiteLotus> i need an unsigned double & int |
14:49:21 | * | leorize joined #nim |
14:50:52 | FromDiscord | <Zachary Carter> float64 |
14:50:59 | FromDiscord | <LiteLotus> ty |
14:51:20 | FromDiscord | <Zachary Carter> Np |
14:52:30 | FromDiscord | <LiteLotus> what about shorts? |
14:53:10 | FromDiscord | <LiteLotus> im guessing int16? |
14:54:23 | FromDiscord | <lqdev> yes |
14:54:46 | FromDiscord | <LiteLotus> 👌 |
14:59:02 | FromDiscord | <Zachary Carter> @lqdev still interested in seeing the string to seq cast |
15:00:27 | FromDiscord | <lqdev> !eval echo cast[seq[uint8]]("123") |
15:00:29 | NimBot | @[49, 50, 51] |
15:00:36 | FromDiscord | <lqdev> @Zachary Carter |
15:00:50 | Zevv | the memory layout is the same *for now* |
15:00:57 | Zevv | no guarentees for the futur |
15:00:59 | Zevv | e |
15:01:59 | Zevv | i implemented sso in the compiler once, something like tht |
15:02:05 | Zevv | breaks the compatibiliy |
15:02:23 | Zevv | ar4q didnt like it at all so i nevercontinued with that thouhg |
15:02:46 | * | MyMind joined #nim |
15:02:51 | Zevv | \ |
15:02:53 | Zevv | \ |
15:03:10 | Zevv | typing is hard |
15:03:58 | * | Sembei quit (Ping timeout: 260 seconds) |
15:08:22 | disruptek | sometimes the fox is nice. |
15:12:23 | disruptek | a proper chair is life-changing. |
15:13:03 | * | leorize quit (Ping timeout: 240 seconds) |
15:17:52 | * | sschwarzer joined #nim |
15:19:51 | * | sschwarzer quit (Client Quit) |
15:23:50 | * | waleee-cl joined #nim |
15:25:03 | disruptek | i just want one day without bugs. |
15:25:17 | disruptek | time to play video-games, i guess. |
15:26:30 | FromDiscord | <LiteLotus> im struggling to set up this data read from an input stream |
15:26:37 | FromDiscord | <LiteLotus> i feel linke im missing something |
15:26:57 | disruptek | ~pate |
15:26:57 | disbot | no footnotes for `pate`. 🙁 |
15:26:59 | disruptek | ~paste |
15:27:00 | disbot | paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek |
15:27:18 | disruptek | ~pate is a really bad idea made worse by its implementation. |
15:27:19 | disbot | pate: 11a really bad idea made worse by its implementation. |
15:27:34 | FromDiscord | <LiteLotus> im trying to read 24bytes of data from a stream |
15:28:04 | disruptek | oh yeah? |
15:28:40 | FromDiscord | <LiteLotus> a c timeval (a posix timeval if im corect), 2 unsigned shorts and a unsigned int |
15:29:07 | FromDiscord | <LiteLotus> however i dont know how this fits into the stream.readData() proc |
15:29:18 | FromDiscord | <LiteLotus> ive created the object |
15:29:23 | FromDiscord | <LiteLotus> but cant read it |
15:29:36 | FromDiscord | <LiteLotus> use it to read it i mean |
15:29:55 | FromDiscord | <LiteLotus> i created the Type |
15:30:04 | FromDiscord | <LiteLotus> technically shouldnt be using objects |
15:30:27 | FromDiscord | <LiteLotus> according to zach |
15:31:14 | disruptek | if you share some code, we can probably identify the error. |
15:32:11 | FromDiscord | <LiteLotus> https://pastebin.com/6QrhicPj |
15:33:06 | disruptek | var myobj: input_event; strm.read(myobj) |
15:33:40 | disruptek | ie. alloc the object and then read into it from the stream. |
15:33:55 | Zevv | Ha I got a cool ix short link |
15:33:58 | Zevv | "2ufo" |
15:34:34 | FromDiscord | <LiteLotus> @disruptek so do that every loop? |
15:34:57 | FromDiscord | <LiteLotus> how do i then get the data from that? |
15:35:36 | disruptek | what data? |
15:35:47 | FromDiscord | <LiteLotus> from the buffer |
15:35:52 | FromDiscord | <LiteLotus> that im reading from teh stream |
15:36:07 | disruptek | i'm not sure you're picking up what i'm laying down. |
15:36:17 | FromDiscord | <LiteLotus> probably not |
15:36:28 | disruptek | the "data" isn't in the buffer. |
15:36:53 | disruptek | myobj holds whatever types you've defined and their values as read from the stream. |
15:37:09 | FromDiscord | <LiteLotus> ah ok |
15:37:12 | FromDiscord | <LiteLotus> so its a buffer definition |
15:37:19 | FromDiscord | <LiteLotus> not the data itself? |
15:37:27 | disruptek | what the fuck? |
15:37:38 | FromDiscord | <LiteLotus> bro im confused |
15:37:38 | disruptek | you define the structure of the data. |
15:37:49 | disruptek | you read the values into that structure from the stream. |
15:37:55 | FromDiscord | <LiteLotus> yeah |
15:37:56 | disruptek | var myobj: input_event; strm.read(myobj) |
15:37:59 | FromDiscord | <LiteLotus> thats what i was saying |
15:38:03 | FromDiscord | <LiteLotus> just not as elegantly |
15:38:11 | disruptek | okay. |
15:38:17 | disruptek | give it a shot and then follow up with zevv. |
15:38:24 | disruptek | i have to go ice my head. |
15:38:28 | FromDiscord | <LiteLotus> xD |
15:38:28 | FromDiscord | <LiteLotus> ok |
15:39:26 | * | awe004 quit (Ping timeout: 260 seconds) |
15:42:40 | Zevv | LiteLotus: You got it to work then? |
15:42:52 | FromDiscord | <LiteLotus> no |
15:43:14 | FromDiscord | <LiteLotus> i still dont understand how i then use "myobj" from there |
15:43:29 | FromDiscord | <LiteLotus> this is my first time using stream |
15:43:31 | FromDiscord | <LiteLotus> (edit) 'stream' => 'streams' |
15:43:38 | Zevv | ok, lemme check your snippet |
15:44:13 | Zevv | I'm slow today, I got a strnage computer that lacks all my shortcuts and hotkeys |
15:44:28 | * | awe004 joined #nim |
15:44:43 | FromDiscord | <LiteLotus> rip |
15:44:58 | FromDiscord | <LiteLotus> didnt put them in a dotfile git repo? |
15:45:20 | Zevv | Yeah sure, but I've been carrying around stuff since 1992 I guess |
15:45:30 | Zevv | so there's always something amiss |
15:45:37 | FromDiscord | <LiteLotus> ah |
15:45:45 | Zevv | my scripts use some custom made font that doesn't install on new ubuntu because it lacks bitmap fonts |
15:45:48 | Zevv | or whatever |
15:45:51 | Zevv | i'm fine :) |
15:49:40 | FromDiscord | <LiteLotus> so how am i supposed to use getData? |
15:52:22 | Zevv | http://ix.io/2ugG |
15:52:26 | Zevv | so this reads your object |
15:52:45 | Zevv | there's no need to create your buffer on the heap (to 'new' it), you can just create a var of the type |
15:52:53 | * | Guest94576 joined #nim |
15:53:16 | Zevv | if you 'new' it, 'buffer' is not and input_event but a pointer to an input_event |
15:53:27 | Zevv | so `addr buffer` gives you the address of the pointer instead |
15:53:31 | FromDiscord | <LiteLotus> fuck |
15:53:36 | FromDiscord | <LiteLotus> yeah how did i not spot that |
15:53:48 | Zevv | no worries |
15:53:55 | FromDiscord | <LiteLotus> too much typescript |
15:54:09 | Zevv | rule of thumb is: don't ref or new unless you have to |
15:54:24 | FromDiscord | <LiteLotus> honestly ive been hopping through languages like im playing hopscotch lately |
15:54:28 | Zevv | so if you need multiple references to something, or have a dynamic pool of things, then you ref |
15:54:37 | Zevv | keep doing that |
15:54:38 | FromDiscord | <LiteLotus> ok |
15:54:52 | FromDiscord | <LiteLotus> why? |
15:54:55 | FromDiscord | <LiteLotus> is it good? |
15:54:58 | Zevv | it's the best way to learn new stuff, new concepts |
15:55:00 | Zevv | its the best |
15:55:06 | FromDiscord | <LiteLotus> huh |
15:55:09 | FromDiscord | <LiteLotus> didnt know |
15:55:12 | Zevv | sticking to one thing and doing only that for the rest of your career is stupid |
15:55:13 | FromDiscord | <LiteLotus> makse sense tho |
15:55:39 | Zevv | and if you dare, go completely out of your league every now and then. Do Haskell. Do Clojur. Do Elixir. Do Rust. |
15:55:50 | Zevv | they all are great in their own ways |
15:56:34 | Zevv | If I were smart enough I would use one of those |
15:56:40 | Zevv | but here I am, stuck with Nim |
15:58:35 | FromDiscord | <lqdev> >:( |
16:01:06 | FromDiscord | <LiteLotus> i tried rust |
16:01:21 | FromDiscord | <LiteLotus> but didnt have any projects that really meshed well with it |
16:01:48 | Zevv | that's my problem with most languages |
16:02:16 | FromDiscord | <LiteLotus> ive been told so many times to try haskell |
16:02:22 | Zevv | really, do |
16:02:26 | Zevv | you will probably never *use* it |
16:02:29 | FromDiscord | <LiteLotus> i might give it a go some time soon |
16:02:32 | Zevv | but it bends your brain in great ways |
16:02:42 | Zevv | you pick great concepts from every new language |
16:02:50 | Zevv | going real functional is enlightening |
16:03:06 | FromDiscord | <LiteLotus> interesting |
16:03:21 | FromDiscord | <LiteLotus> also this data seems to be the wrong size. |
16:03:32 | FromDiscord | <LiteLotus> 16 bytes. not 24 |
16:04:33 | FromDiscord | <LiteLotus> i think timeval is the culprit? |
16:07:57 | Zevv | or packing |
16:08:29 | FromDiscord | <LiteLotus> packing? |
16:19:45 | FromDiscord | <LiteLotus> its definatelyTimeval |
16:19:54 | FromDiscord | <LiteLotus> its half the size that im expecting |
16:20:06 | FromDiscord | <LiteLotus> its 8 bytes, im expecting 16 |
16:20:17 | FromDiscord | <LiteLotus> also explains why the data is so incorrect |
16:22:16 | * | Guest94576 quit (Quit: Guest94576) |
16:25:46 | FromDiscord | <Zachary Carter> what is the content of `js0`? |
16:26:04 | FromDiscord | <LiteLotus> linux device event stream |
16:26:11 | FromDiscord | <Zachary Carter> can you gist it? |
16:26:21 | FromDiscord | <LiteLotus> its raw byte data |
16:26:25 | FromDiscord | <Zachary Carter> ah |
16:26:39 | FromDiscord | <Zachary Carter> well if you know the layout of data - just don't use the stdlib types |
16:26:57 | FromDiscord | <Zachary Carter> and this is the more idiomatic way to write this code |
16:27:16 | FromDiscord | <Zachary Carter> https://play.nim-lang.org/#ix=2ugP |
16:27:17 | FromDiscord | <LiteLotus> it should line up as a 16 byte timeval, 2 int16, and a unsigned int |
16:27:44 | FromDiscord | <Zachary Carter> so just inline the `timeval` into the `InputEvent` object |
16:27:47 | FromDiscord | <LiteLotus> but nims posix timeval is 8 bytes |
16:27:52 | FromDiscord | <Zachary Carter> I need to go to the beach - but I"ll be back later |
16:27:54 | * | lritter joined #nim |
16:28:05 | FromDiscord | <Zachary Carter> well - you can file a bug / PR it if it's incorrect |
16:28:33 | FromDiscord | <Zachary Carter> but please provide a link to the header it's defined in showing the correct type definition |
16:28:38 | FromDiscord | <Zachary Carter> anywho, bbl |
16:28:47 | FromDiscord | <LiteLotus> cya ❤️ |
16:31:05 | Zevv | just use libev |
16:45:54 | * | vegai left #nim (#nim) |
16:50:01 | FromDiscord | <LiteLotus> what do you mean? |
16:50:12 | FromDiscord | <LiteLotus> is that a nimble package? @zevv |
16:50:50 | FromDiscord | <Clyybber> its libevent |
16:51:01 | FromDiscord | <Clyybber> a c library |
16:51:35 | FromDiscord | <Clyybber> Zevv, disruptek: I think my fix is getting ready |
16:51:43 | FromDiscord | <Clyybber> the fix for the typed redefinition issue |
16:57:33 | * | superbia1 joined #nim |
17:00:49 | * | superbia quit (Ping timeout: 264 seconds) |
17:04:07 | FromDiscord | <LiteLotus> then i would be stuck importing something again |
17:04:26 | FromDiscord | <LiteLotus> (edit) 'then i would be stuck importing something again ... ' => 'then i would be stuck importing something again/ wrapping' |
17:04:45 | FromDiscord | <LiteLotus> (edit) 'then i would be stuck importing something again / wrapping ... ' => 'then i would be stuck importing something again / wrapping@Clyybber' |
17:04:53 | * | endragor quit (Remote host closed the connection) |
17:06:33 | Zevv | clyybber: yay, so we can finally start to drop the _clyybber! |
17:07:27 | Zevv | litelotus: libevdev maybe? its in nimble |
17:08:01 | FromDiscord | <Recruit_main707> hmm, in the macros module, addPragma doesnt work with objects, shouldnt it do? |
17:09:11 | * | endragor joined #nim |
17:09:42 | FromDiscord | <Clyybber> clyybber: oh no :D( |
17:13:25 | * | endragor quit (Ping timeout: 240 seconds) |
17:19:06 | * | leorize joined #nim |
17:21:39 | Zevv | until we find the next bug we want you to fix |
17:21:42 | FromDiscord | <Clyybber> Zevv, disruptek: its green \o/ https://github.com/nim-lang/Nim/pull/15158 |
17:21:42 | disbot | ➥ Fix #5691 |
17:21:48 | Zevv | we'll call that one clyybber |
17:21:52 | Zevv | ad infinitum |
17:22:06 | FromDiscord | <Clyybber> i'm fine with that |
17:22:46 | * | bung quit (Ping timeout: 246 seconds) |
17:27:05 | Zevv | green! |
17:27:08 | Zevv | merge that stuff! |
17:28:31 | FromDiscord | <Clyybber> heh, its not quite finished yet |
17:29:23 | * | leorize quit (Ping timeout: 240 seconds) |
17:30:02 | * | leorize joined #nim |
17:31:13 | Zevv | can't test it anyway. cps is always broken, you know. |
17:32:36 | FromDiscord | <Clyybber> heh |
17:32:45 | FromDiscord | <LiteLotus> i figured out why its 8 bytes instead of 16 |
17:32:53 | FromDiscord | <LiteLotus> its x86 |
17:33:14 | Zevv | thus I said: use libevent :) |
17:33:14 | FromDiscord | <LiteLotus> aparently its only 8 bytes on a 32bit system |
17:33:24 | FromDiscord | <LiteLotus> i was so close |
17:33:33 | FromDiscord | <LiteLotus> i didnt want to give up on my solution 😢 |
17:33:40 | Zevv | or import the definitions from your local input.h, at least |
17:33:58 | FromDiscord | <LiteLotus> i can do that? |
17:38:25 | Zevv | there's tooling for that, c2nim or nimterop |
17:38:33 | Zevv | but fair enough, for one simple struct you're probably fine like thi |
17:38:34 | Zevv | s |
17:39:49 | Zevv | oh yeah I had this error that disruptek didn't have, altough we have the same version of everything |
17:40:03 | Zevv | well, if all this cps does not fly in the end, at least we'll have improved nim by finding a lot of bugs |
17:40:44 | FromDiscord | <Clyybber> it will fly |
17:40:49 | FromDiscord | <Clyybber> and yeah, that ones a great benefit |
17:41:28 | Zevv | disruptek: you here? |
17:50:33 | Zevv | clyybber: is it done enough for me to give it a try? |
17:50:49 | Zevv | and why don't you move to irc so I can tab expand you nick properly |
17:53:19 | * | clyybber joined #nim |
17:53:28 | clyybber | Zevv: yeah its ready enough for that |
17:54:08 | * | hnOsmium0001 joined #nim |
17:54:13 | * | bung joined #nim |
17:54:28 | Zevv | cool |
17:55:03 | * | leorize quit (Ping timeout: 240 seconds) |
17:55:16 | Zevv | who puts hashes in branch names |
17:56:01 | Zevv | oh bah I just realized why the booty has a tramp |
17:56:15 | Zevv | we can't change the signature of the original definition :( |
17:56:31 | clyybber | why? |
17:56:52 | clyybber | couldn't think of a better branch name this time |
17:56:55 | Zevv | unless I undestand it wrong, but: with typed you can't mutate the original nodes, right? |
17:57:02 | clyybber | you can copy it |
17:57:05 | Zevv | so the original defined proc will always be there, you can only create new stuff |
17:57:07 | clyybber | and then modify it afaik |
17:57:15 | clyybber | Zevv: No with my PR not |
17:57:17 | Zevv | there is already a proc without return value, but we want to give it a return value |
17:57:24 | Zevv | oh, even that is fixed \o/ |
17:57:29 | clyybber | that *is* the bug |
17:57:35 | clyybber | its all the same thing :P |
17:57:46 | Zevv | Well, I thought the bug was that you can create new stuff, as long as it doesn't have the same *name* |
17:58:17 | Zevv | seems to do the job! |
17:58:27 | Zevv | I now get the normal disruptek induced errors |
17:58:31 | Zevv | woot! |
17:58:35 | clyybber | \o// |
17:59:02 | * | bung quit (Ping timeout: 256 seconds) |
18:04:17 | * | NimBot joined #nim |
18:07:15 | Zevv | oh boy is arac not going to agree with your fix |
18:07:39 | Zevv | or do you probably undo the side effects during overload resolution already |
18:07:43 | Zevv | s/properly/ |
18:09:43 | FromDiscord | <Clyybber> yeah, thats the remaining part |
18:09:56 | FromDiscord | <Clyybber> so that arg2 can't access symbols from arg1 |
18:11:27 | Zevv | right |
18:11:30 | Zevv | well, I don't care! |
18:11:33 | Zevv | we'll just fork nim |
18:29:48 | disruptek | what do i have to do to make things work? |
18:30:16 | Zevv | start with: run clybbers branch and pull cps, run with -d:cpsTrampBooty=false |
18:30:49 | Zevv | and drop _clybber on all the calls |
18:31:20 | Zevv | git remote add clyybber https://github.com/Clyybber/Nim/ |
18:31:29 | Zevv | git co 'clyybber/fix#5691' |
18:32:01 | Zevv | now I'm looking into "Error: internal error: environment misses: lo |
18:32:44 | disruptek | it's due to one of the issues i created. |
18:32:50 | Zevv | isn't it all |
18:33:10 | Zevv | you create so many issues |
18:34:03 | Zevv | but clyybbers fix now allows mutation of the orignal proc |
18:34:11 | Zevv | so the booty now returns the cont as it should |
18:34:51 | Zevv | oh #32, right |
18:35:09 | Zevv | hm that's a bit more then a "bummer" imho |
18:35:22 | disruptek | yeah, well... |
18:35:39 | Zevv | isn't it a friggin show stopper? |
18:36:48 | * | Vladar quit (Quit: Leaving) |
18:36:50 | FromDiscord | <Clyybber> hmm |
18:36:57 | FromDiscord | <Clyybber> I'm not sure they are intended to be syms |
18:37:49 | Zevv | hm is this even #32 |
18:37:53 | Zevv | I'm looking at |
18:38:17 | * | bung joined #nim |
18:38:20 | Zevv | because this is not a .cps. proc param |
18:38:23 | * | endragor joined #nim |
18:38:25 | Zevv | it's a lifted local |
18:40:32 | Zevv | well, apart from not finding `lo` and `hi` in the env, my iterator iterates again! |
18:41:14 | disruptek | do you have a repro that refutes 32? |
18:41:43 | Zevv | well, my iterator can now accept a value in its jield() |
18:41:51 | Zevv | isnt taht the same? It's an arg to a .cps. proc |
18:42:05 | Zevv | pull and run my iterator |
18:42:06 | disruptek | so i should use head? |
18:42:16 | Zevv | I hardcoded 0 and 3 for lo and hi |
18:42:22 | Zevv | yes, pull head typed |
18:42:49 | * | bung quit (Ping timeout: 264 seconds) |
18:42:51 | Zevv | and run with -d:cpsTrampBooty=false |
18:43:04 | Zevv | that define should go out and that code path should be the default |
18:43:14 | Zevv | but make sure to run clyybbers nim branch |
18:43:21 | Zevv | as per instructions above |
18:43:37 | disruptek | okay, it runs. |
18:43:43 | Zevv | cool bro |
18:43:47 | disruptek | but, i'm still seeing idents for lo/hi. |
18:44:29 | Zevv | in the booty, you mean, or in the .cps' |
18:45:02 | disruptek | everywhere. |
18:45:27 | FromDiscord | <Clyybber> is the proc generic? |
18:45:30 | disruptek | nah. |
18:46:25 | * | endragor quit (Ping timeout: 246 seconds) |
18:46:48 | Zevv | disruptek: where do you mean then |
18:47:15 | disruptek | they are arguments to the counter() and they don't get typed into syms. |
18:48:27 | Zevv | oh it's the booty generating the error |
18:48:42 | Zevv | it's hard to tell with the line numbers from the original source |
18:49:07 | Zevv | ok sure its #32 then |
18:49:41 | disruptek | look at --define:cpsTree |
18:49:53 | * | bung joined #nim |
18:50:29 | Zevv | ah you have a define for that, I was just adding the treeRepr |
18:51:02 | Zevv | hmmm |
18:51:04 | Zevv | dang |
18:52:35 | * | dddddd quit (Ping timeout: 240 seconds) |
18:54:30 | * | bung quit (Ping timeout: 260 seconds) |
18:56:09 | Zevv | soooo |
18:56:30 | Zevv | "I'm not sure they are intended to be syms" |
18:56:38 | * | bung joined #nim |
19:00:50 | FromDiscord | <Clyybber> I mean, is it some weird special edge case where they aren't? |
19:00:53 | FromDiscord | <Clyybber> or are they never? |
19:01:05 | * | bung quit (Ping timeout: 240 seconds) |
19:01:31 | FromDiscord | <Clyybber> probably a bug tho, but if you could extract something minimal, that'd help a lot |
19:01:44 | Zevv | lemmesee |
19:02:22 | disruptek | i'm burnt out. |
19:04:50 | FromDiscord | <Clyybber> you need water |
19:04:54 | Zevv | clyybber: http://ix.io/2uhs |
19:05:00 | Zevv | disruptek: mentally or physically? |
19:05:14 | FromDiscord | <Clyybber> Zevv: Thanks! |
19:05:17 | * | bung joined #nim |
19:05:31 | Zevv | I wanted to update the #32 issue but I don't have my github credentials here |
19:05:44 | disruptek | why are you cloning the proc, though? |
19:06:06 | Zevv | can't mutate because typed |
19:06:13 | Zevv | that still stands, right |
19:06:15 | disruptek | is `a` a symbol in `n`? |
19:06:23 | disruptek | i don't care if it's mutated or not. |
19:06:33 | disruptek | we're trying to establish that we're getting bad input. |
19:06:58 | Zevv | well, this is the minimilazation of the same issue as #32 afaik |
19:07:46 | disruptek | nah. |
19:08:33 | disruptek | http://ix.io/2uht/nim |
19:09:06 | * | dddddd joined #nim |
19:09:47 | * | bung quit (Ping timeout: 240 seconds) |
19:13:20 | disruptek | i am going to start csp i guess. |
19:13:35 | FromDiscord | <Clyybber> start? |
19:14:24 | disruptek | i did some experiments but i think i have a better sense for how this should work now. |
19:16:43 | * | bung joined #nim |
19:17:10 | FromDiscord | <--HA--> Is there a merge or similar for Table (not CountTable)? |
19:19:46 | disruptek | nah. |
19:21:04 | * | bung quit (Ping timeout: 246 seconds) |
19:23:23 | * | bung joined #nim |
19:25:52 | Zevv | make up your mind dude |
19:25:55 | Zevv | jah or nah |
19:26:20 | FromDiscord | <Clyybber> jein |
19:29:58 | FromDiscord | <Elegant Beef> Nyeno |
19:30:10 | Zevv | ah that is more minimal indeed |
19:30:19 | disruptek | the csp approach will be continuations at compile-time, basically. we form the algebra from code+data but we treat them as a single unit. |
19:30:37 | Zevv | oh there we go again |
19:30:39 | disruptek | then at runtime, the code portion is simply omitted. |
19:30:59 | disruptek | the data is, y'know, whatever you data is. |
19:31:14 | disruptek | we just give you the algebra to operate on it at compile-time. |
19:31:38 | disruptek | no overhead of the environment. |
19:31:46 | disruptek | no special types. |
19:31:55 | Zevv | you clearly have it all in your head |
19:31:56 | disruptek | no boxing or anything like that. |
19:32:11 | * | bung quit (Ping timeout: 240 seconds) |
19:32:14 | FromDiscord | <Elegant Beef> What about wrestling? |
19:32:20 | Zevv | and I feel I should make an effort of understanding it |
19:32:39 | Zevv | WWF style |
19:32:45 | disruptek | there's really no reason to keep the fn around. |
19:33:28 | Zevv | disruptek: do you have a clear enough picture to make this concrete with some examples? |
19:33:36 | Zevv | take my iterator, for example |
19:33:46 | Zevv | what does it end up like, and hwo do you get there |
19:34:03 | * | bung joined #nim |
19:34:18 | disruptek | i don't really know how to exploit csp yet. |
19:34:42 | Zevv | "exploit" as in "use" it ? |
19:34:58 | disruptek | yeah, like i dunno what it's good for. |
19:35:14 | Zevv | well, we know a few right |
19:35:29 | FromDiscord | <Clyybber> async? |
19:35:30 | Zevv | these are good enouhg for me for now |
19:35:32 | disruptek | do we? |
19:35:35 | FromDiscord | <Clyybber> yes |
19:35:38 | disruptek | what? |
19:35:38 | Zevv | yes |
19:36:04 | Zevv | low overhead async, iterators, coroutines, funny control flow |
19:36:18 | disruptek | that's cps. |
19:36:26 | FromDiscord | <Clyybber> what do you want? |
19:36:33 | Zevv | oh wait |
19:36:35 | disruptek | csp 😁 |
19:36:37 | Zevv | hes pulling our finger |
19:36:40 | Zevv | soooo |
19:36:43 | FromDiscord | <Clyybber> classic disruptek |
19:37:15 | disruptek | csp is communication via sequential processing or something. |
19:37:35 | Zevv | ok I have a great iedea |
19:37:42 | Zevv | we first frigging *finish* this |
19:37:51 | Zevv | and *then* you start your next adventure |
19:38:13 | disruptek | look, cps is just the crude logic. |
19:38:21 | Zevv | right. finish it then |
19:38:25 | * | bung quit (Ping timeout: 240 seconds) |
19:38:27 | Zevv | make it work |
19:38:27 | disruptek | this is the actual application which, if it's correct, is universally applicable. |
19:38:43 | Zevv | sure |
19:38:43 | disruptek | this is goroutines and core.async and whatever. |
19:39:01 | disruptek | cps is just, "oh look, explicit inverted control-flow." |
19:39:16 | disruptek | big deal. it's how you compose cps that matters. |
19:39:17 | Zevv | you have the same thing as I did right |
19:39:25 | Zevv | this lack of euphory |
19:39:47 | FromDiscord | <Clyybber> yeah, cps is just inverted control flow |
19:39:50 | FromDiscord | <Clyybber> but thats pretty cool |
19:40:00 | Zevv | your mid-code-crisis. it's nothing to be ashamed of, its pretty normal |
19:40:16 | disruptek | well, fix more bugs and i will write more cps. |
19:40:29 | disruptek | we are pretty well limited by nim at the moment, afaik. |
19:40:32 | Zevv | fair enough |
19:40:36 | FromDiscord | <Clyybber> whats the new idea you had tho disruptek |
19:40:47 | disruptek | with regard to what? |
19:40:52 | FromDiscord | <Clyybber> something with algebra and compile time |
19:40:54 | FromDiscord | <Clyybber> and data and code |
19:40:58 | FromDiscord | <Clyybber> undecipherable :p |
19:41:05 | Zevv | look at his little example project |
19:41:24 | disruptek | basically, our continuations are an environment with some code that runs on that environment. |
19:41:31 | disruptek | we get that, right? |
19:41:48 | Zevv | https://github.com/disruptek/cps/blob/master/experiments/chain.nim |
19:42:11 | Zevv | right |
19:42:19 | disruptek | even if it's created at run-time, this relationship between the data and logic has some weight to it. |
19:42:28 | disruptek | it's an object, it holds the fn ptr and the data. |
19:42:42 | Zevv | right again |
19:42:50 | disruptek | but if we were able to unwrap the data out of this object and store the fn "for free", then we have something more interesting. |
19:43:07 | disruptek | we have arbitrary data that is "native"; a table is a table and also a continuation. |
19:43:13 | disruptek | a string is a string and also a continuation. |
19:43:25 | disruptek | the association between the data and the fn ptr need only exist at compile-time. |
19:43:32 | * | bung joined #nim |
19:43:51 | disruptek | if so, it means you can compose both continuations and processes (in csp parlance) with all our existing "data" machinery. |
19:44:05 | disruptek | all our existing procs that operate on data will operate on continuations. |
19:44:21 | disruptek | all our future procs that operate on data will also be composable as csp processes. |
19:44:31 | disruptek | it's a big fucking deal. |
19:45:02 | FromDiscord | <Clyybber> what does it mean in practice? |
19:45:20 | Zevv | this is your chain.nim, right? |
19:45:25 | FromDiscord | <Clyybber> how do you operate on continuations? |
19:46:01 | disruptek | in practice it means that we can rely on 40 year-old math to prove control-flow, not just of async code but any code. |
19:46:35 | disruptek | it gives us a level of indirection for processing that we don't currently enjoy, but which we have every ability to achieve. |
19:46:54 | disruptek | chain.nim is a demo of composition, yes. |
19:47:26 | disruptek | it demonstrates composing a continuation using two non-continuation things; a string and a proc that operates on strings. |
19:47:41 | disruptek | and yet, the result is a continuation that you can work with as you might any other. |
19:47:46 | FromDiscord | <Clyybber> ah, so basically a string is treated like a proc returning a string? |
19:48:05 | disruptek | "hello" + toUpperAscii == continuation |
19:48:20 | disruptek | continuation() == "HELLO" |
19:49:00 | FromDiscord | <Clyybber> ok, so lazy application? |
19:49:07 | Zevv | as well |
19:49:42 | disruptek | when you add csp algebra on top of this, you start to get some really interesting emergent properties. |
19:50:06 | * | bung quit (Ping timeout: 256 seconds) |
19:50:33 | disruptek | we learned that cps primitives aren't really a thing, but csp primitives are. |
19:50:41 | FromDiscord | <Clyybber> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
19:50:43 | FromDiscord | <Clyybber> wtf |
19:50:52 | FromDiscord | <Clyybber> is the difference between cps and csp in your mind |
19:51:10 | disruptek | cps is what we have now. |
19:51:13 | Zevv | and it all started with just a typo in my repo name :) |
19:51:19 | FromDiscord | <Clyybber> yeah, crazy |
19:51:24 | disruptek | csp is composition we can apply to cps. |
19:51:37 | FromDiscord | <Clyybber> words is words |
19:51:40 | FromDiscord | <Clyybber> but what do they mean |
19:51:54 | disruptek | holdon |
19:52:00 | disruptek | https://en.wikipedia.org/wiki/Communicating_sequential_processes |
19:52:42 | FromDiscord | <Clyybber> aha |
19:52:46 | FromDiscord | <Clyybber> thanks |
19:53:15 | disruptek | what they call event, i just call data. |
19:53:27 | disruptek | in our cps, we call it env. |
19:53:51 | * | bung joined #nim |
19:58:19 | disruptek | in chain.nim, it's data. chain.nim is cps in which the continuations and their functions are generic. |
19:58:22 | Zevv | dude this is just npeg for continuations |
19:58:36 | * | bung quit (Ping timeout: 256 seconds) |
19:58:43 | disruptek | good. |
20:00:24 | Zevv | so finally it starts to sink in here |
20:01:13 | disruptek | yeah, and we're really not that far from being able to do this stuff. |
20:02:03 | disruptek | cps lives in the dark corners. if we're able to impl csp just in the compile-time syntax you see here, all the |[]|{}()->, then we really have something amazing. |
20:02:06 | * | bung joined #nim |
20:03:25 | disruptek | provably race-free async, let's say. |
20:04:20 | FromDiscord | <Clyybber> the transformation stays the same though, this is about scheduling with additional information and about the environment/continuation relation |
20:04:24 | FromDiscord | <Clyybber> right? |
20:04:42 | disruptek | scheduling? |
20:05:15 | disruptek | it's a semi-tight coupling between the data/code, which together is the continuation. |
20:05:21 | FromDiscord | <Clyybber> I mean when to execute stuff so that it doesn't interfere with each other |
20:05:54 | disruptek | yeah, it's about composition that is correct by construction. |
20:06:02 | disruptek | composition of continuations. |
20:06:15 | * | WilhelmVonWeiner quit (Read error: Connection reset by peer) |
20:06:25 | * | bung quit (Ping timeout: 240 seconds) |
20:07:16 | * | bung joined #nim |
20:09:41 | Zevv | ok |
20:09:51 | Zevv | i do see finally where you're going |
20:09:53 | Zevv | *but* |
20:10:29 | Zevv | this is yet another bulk of theory an background that will take some good time to all sink in and get acquiented with |
20:10:49 | disruptek | i know. like i said, i don't know how to use it yet. |
20:10:51 | Zevv | if theres nothing we can continue on with cps its cool, but if not i prefer we fnish that first |
20:10:59 | disruptek | but it was the same with cps. |
20:11:11 | Zevv | for cps it was clear from the start what to use it for |
20:11:13 | Zevv | to me at least |
20:11:23 | * | bung quit (Ping timeout: 240 seconds) |
20:11:41 | Zevv | for csp it *really* is like a grammar for code flow |
20:11:52 | disruptek | i understand the iterators and stuff, but i didn't know how we would actually write cps software. |
20:11:58 | disruptek | now that's clearer. |
20:12:21 | FromDiscord | <--HA--> for checking emtpy string is one of these better `str != ""` or `str.len > 0`? |
20:12:35 | disruptek | length check is superior. |
20:12:43 | FromDiscord | <--HA--> thank you |
20:12:57 | disruptek | by an insignificant amount. 😉 |
20:12:57 | Zevv | ill think a bit about csp, or what I think it roughly is, and I think I can whip up a few things already |
20:13:31 | disruptek | yeah, the hard part is going to be figuring out if we can squirrel away things like semaphores somehow. |
20:13:45 | Zevv | HA: dont trust anyone, just measure if you want to make sure. run a million of iterations of both and you will know |
20:14:06 | Zevv | disruptek: same goes for cps when doing magic threadpool stuff |
20:14:10 | FromGitter | <wltsmrz> If I have exported alloc0 from overrides.nim (and included it), will this override all alloc0 throughout system? |
20:14:21 | Zevv | and i stil think we do need serialization and copying for channel like stuff |
20:14:29 | disruptek | why? |
20:14:35 | FromDiscord | <--HA--> I have no code that is that time sensitive just noticed that I was typing checks for empty strings a few times and wondered which I should use as my default |
20:14:37 | * | bung joined #nim |
20:14:45 | disruptek | just use channels if you want to copy. that's exactly what it does. |
20:15:07 | Zevv | channels implementation have sucky parts, like, they must be global |
20:15:43 | Zevv | you cant just create thousand things with their own channels stuck on |
20:16:20 | disruptek | huh? |
20:16:36 | Zevv | my little love affair the other day with whats-that-language-again taught me a new way of parallel programming I didnt know yet, but liked a lot |
20:16:47 | Zevv | use channels for everything as if they cost naught |
20:16:55 | disruptek | that's csp. 😉 |
20:17:00 | Zevv | tens, hundreds, thousands |
20:17:09 | disruptek | yes, it's pretty great. |
20:17:35 | Zevv | that can also be done with cps |
20:17:39 | disruptek | i've used go but i found it too limiting even for my inelegant shit. |
20:17:47 | Zevv | oh its very limiting |
20:17:49 | FromDiscord | <Clyybber> chill out |
20:17:54 | Zevv | but *that* part is very cool |
20:17:57 | disruptek | yes. |
20:18:05 | disruptek | it's the story we need. |
20:18:14 | FromDiscord | <Clyybber> cps is not invalidated by csp |
20:18:29 | FromDiscord | <Clyybber> cps is still essential |
20:18:29 | Zevv | no cps is invalidated by nim bugs :) |
20:18:34 | FromDiscord | <Clyybber> yeah |
20:18:37 | disruptek | of course. |
20:18:42 | Zevv | it is, and Im eagerly waiting for it to be usable again |
20:18:56 | Zevv | because I just go started making real things when it broke very much |
20:18:59 | FromDiscord | <Clyybber> don't wait |
20:19:06 | disruptek | well, use 0.0.13? |
20:19:11 | * | bung quit (Ping timeout: 246 seconds) |
20:19:13 | Zevv | boooring |
20:19:40 | FromDiscord | <Clyybber> so which bug is blocking you know |
20:19:42 | FromDiscord | <Clyybber> now |
20:19:48 | FromDiscord | <Clyybber> the indent one or a different one? |
20:19:53 | FromDiscord | <Clyybber> I have to ix.ios here |
20:20:03 | Zevv | i think the idents yes |
20:20:28 | FromDiscord | <Clyybber> I'm still on 5691, so it will have to wait a bit |
20:20:54 | Zevv | time I have, I have still half my life ahead of me |
20:21:10 | Zevv | oh wait I was planning to get to 120 at least |
20:21:21 | disruptek | it's kinda funny that we started off with a working leak-free arc impl and now it doesn't even compile under arc, nor does it work anywhere else. |
20:21:35 | FromDiscord | <Clyybber> dig into the compiler people |
20:21:41 | FromDiscord | <Clyybber> I know you can |
20:22:04 | disruptek | every time i go there i'm mired for days. |
20:22:08 | FromDiscord | <Clyybber> haha |
20:22:09 | disruptek | it really takes a lot out of me. |
20:22:11 | Zevv | yeah |
20:22:33 | FromDiscord | <Clyybber> used to be the same here, but then something snapped |
20:22:36 | disruptek | turns out that mangling only passes all but one stdlib test. |
20:22:37 | FromDiscord | <Clyybber> my sanity probably |
20:22:47 | Zevv | haha |
20:22:49 | FromDiscord | <Clyybber> disruptek: why is it failign the last one? |
20:22:58 | disruptek | who cares. |
20:23:05 | disruptek | it fails all over on the tests outside of stdlib. |
20:23:09 | FromDiscord | <Clyybber> I, otherwise I wouldn't have asked |
20:23:10 | FromDiscord | <Clyybber> oh |
20:23:39 | disruptek | it's jsonutils, probably due to something timmy invented to ruin my life. |
20:23:51 | FromDiscord | <Clyybber> lol |
20:24:14 | Zevv | and really, doing compiler stuff feels too much like my work |
20:24:27 | Zevv | its mrs and feedback and reviews and unit tests and discussions |
20:24:50 | Zevv | i know its important stuff to do, i really do, but i have to cope with all that stuff al week |
20:24:56 | FromDiscord | <Clyybber> nah, look at my prs; they don't get much reviews nor discussions :P |
20:25:26 | * | bung joined #nim |
20:25:28 | FromDiscord | <--HA--> Can I define a type for a specifc form of table? like this Table[int, tuple[name: string, full: string]] |
20:25:34 | disruptek | yes. |
20:25:36 | Zevv | and every time i pr something trivial i get bikeshedded into oblivion |
20:25:40 | FromDiscord | <Clyybber> and only digging in to find out what or where it fails is good enough |
20:25:52 | FromDiscord | <Clyybber> Zevv: The trick is to PR stuff that nobody understands |
20:25:56 | Zevv | HA sure you can |
20:26:19 | FromDiscord | <Clyybber> Zevv: if your stuff is trivial its gonna get bikeshed over pretty hard |
20:26:38 | Zevv | clybber: i know, i did some pretty deep stuf fwith the memory allocs stuff that touch 100% of everbodys codeand no one cared |
20:27:11 | Zevv | and the vm stuff |
20:27:38 | FromDiscord | <--HA--> Zevv, how would that look like? I only know the type definition where you have to use keys |
20:27:44 | Zevv | but then i want ot add a tiny 1 line macro to the stdlib that would make life easier, but forget it |
20:27:55 | FromDiscord | <Clyybber> which one? |
20:28:26 | Zevv | i dont know, the new ref constructor or something like that |
20:28:36 | FromDiscord | <Clyybber> you didn't pr that |
20:28:38 | FromDiscord | <Clyybber> I like it tho |
20:28:40 | Zevv | i dont think i even PRed that, it died from a thousand papercuts on irc |
20:28:47 | FromDiscord | <Clyybber> doesn't even have to be a macro |
20:28:49 | FromDiscord | <Clyybber> just a template |
20:28:52 | FromDiscord | <Clyybber> Zevv: Did it? |
20:29:16 | Zevv | anyway, jsut ranting and whining |
20:29:32 | Zevv | AH: sorry, im currently typing on mobile, its hard to throw out code at thsi moment |
20:30:41 | Zevv | for clarity i would split it up, define a separate type for your value-part |
20:31:10 | Zevv | and then just do `type Thing = Table[int, Otherthing]` |
20:32:00 | Zevv | disruptek: wait was all this stuff just magically fixed because you switchedto typed? |
20:32:02 | FromDiscord | <--HA--> Oh I wasn't aware of that. I thought it had to be type thing = tuple/object |
20:32:09 | Zevv | or did you do actual work fro that |
20:32:26 | Zevv | HA: no, you can type your heart out |
20:33:13 | * | bung quit (Ping timeout: 264 seconds) |
20:33:37 | disruptek | clyybber: so i can't simply replace a sym with a dotexpr. :-( |
20:33:46 | FromDiscord | <--HA--> Works perfectly, thanks Zevv. I missed that in the tutorial |
20:37:50 | disruptek | Zevv: no, i have more than a couple commits to the typed branch to make it work. 😉 |
20:38:12 | disruptek | actually, i haven't impl tuples but i will do so soon. i have the code commented out iirc. |
20:39:08 | Zevv | cool |
20:39:36 | * | bung joined #nim |
20:39:42 | disruptek | 34 could be another thorny one. |
20:40:56 | FromDiscord | <Clyybber> disruptek: When? |
20:41:14 | * | clyybber quit (Quit: WeeChat 2.9) |
20:41:43 | FromDiscord | <Clyybber> when can't you do that |
20:43:46 | FromDiscord | <Clyybber> oh, I see the issue now |
20:44:09 | FromDiscord | <Clyybber> I'll dig into it tomorrow, getting some sleep |
20:44:10 | * | bung quit (Ping timeout: 260 seconds) |
20:44:11 | FromDiscord | <Clyybber> gn8 fellas |
20:44:14 | disruptek | aight, gn |
20:44:20 | disruptek | thanks for hacking. |
20:46:44 | disruptek | this tramp booty thing doesn't work. |
20:46:56 | Zevv | thanks again clyybber |
20:47:02 | Zevv | oh works for me? |
20:47:16 | Zevv | my iterator iterates like it should? |
20:48:16 | * | arecacea1 quit (Remote host closed the connection) |
20:48:28 | * | bung joined #nim |
20:49:14 | * | arecacea1 joined #nim |
20:51:40 | disruptek | it's an ambiguous call for me. |
20:52:45 | * | bung quit (Ping timeout: 240 seconds) |
20:53:16 | disruptek | oh, i'm on the wrong nim. 🤣 |
20:53:58 | * | bung joined #nim |
20:54:09 | Zevv | nim_temp :) |
20:54:21 | Zevv | or, as I called mine, nim_clyybber |
20:58:05 | * | bung quit (Ping timeout: 240 seconds) |
20:58:25 | disruptek | well, it still doesn't work. |
20:58:34 | disruptek | cps/cps.nim(510, 23) Error: expression 'result = continuation' has no type (or is ambiguous) |
20:58:47 | disruptek | we should probably be using result in any event. |
21:01:05 | * | Trustable quit (Remote host closed the connection) |
21:03:49 | * | bung joined #nim |
21:08:37 | * | bung quit (Ping timeout: 264 seconds) |
21:15:29 | * | bung joined #nim |
21:16:55 | FromDiscord | <Kiloneie> Aren't object variants just objects with a field of enums as a variable to make them variants? |
21:18:13 | FromDiscord | <Elegant Beef> Well they also have the whole cant get a field from the wrong variant |
21:18:35 | FromDiscord | <Elegant Beef> But yes they're just an object with an enum field to limit the abillity to access fields |
21:20:01 | FromDiscord | <Kiloneie> Thanks |
21:20:01 | * | bung quit (Ping timeout: 264 seconds) |
21:20:17 | FromDiscord | <Elegant Beef> Making an object variant tutorial? |
21:21:55 | * | bung joined #nim |
21:26:31 | * | bung quit (Ping timeout: 256 seconds) |
21:27:09 | * | bung joined #nim |
21:27:19 | * | opi joined #nim |
21:27:43 | * | opal quit (Ping timeout: 240 seconds) |
21:32:15 | * | opal joined #nim |
21:33:47 | * | bung quit (Ping timeout: 240 seconds) |
21:34:11 | * | bung joined #nim |
21:38:38 | * | bung quit (Ping timeout: 246 seconds) |
21:39:46 | FromDiscord | <Kiloneie> uhmm yes, after reference objects one(which was supposed to be today but i had to go pick potatoes for a friend...) |
21:40:05 | FromDiscord | <Kiloneie> so 2 videos tomorrow(hopefully) |
21:40:09 | * | solitudesf quit (Remote host closed the connection) |
21:40:42 | * | bung joined #nim |
21:41:07 | FromDiscord | <Zachary Carter> you might want to let folks know that object variants are similar to tagged or discriminated unions |
21:41:16 | FromDiscord | <Zachary Carter> maybe not semantically but functionally |
21:44:44 | * | solitudesf joined #nim |
21:45:05 | * | bung quit (Ping timeout: 240 seconds) |
21:46:46 | FromDiscord | <Kiloneie> Okay, just after i google what that means. xD... |
21:48:53 | * | bung joined #nim |
21:53:38 | * | bung quit (Ping timeout: 256 seconds) |
21:56:55 | * | bung joined #nim |
22:00:00 | * | opi quit (Quit: Leaving) |
22:01:38 | * | bung quit (Ping timeout: 260 seconds) |
22:04:17 | * | bung joined #nim |
22:08:55 | * | FromDiscord quit (Remote host closed the connection) |
22:09:12 | * | FromDiscord joined #nim |
22:11:02 | * | awe00 joined #nim |
22:12:56 | * | awe004 quit (Ping timeout: 246 seconds) |
22:17:30 | * | bung quit (Ping timeout: 256 seconds) |
22:20:11 | * | bung joined #nim |
22:28:26 | * | lritter quit (Ping timeout: 256 seconds) |
22:33:49 | * | solitudesf quit (Ping timeout: 264 seconds) |
22:38:29 | * | bung quit (Ping timeout: 246 seconds) |
22:40:39 | * | bung joined #nim |
22:43:12 | * | vicfred quit (Quit: Leaving) |
22:46:46 | * | awe001 joined #nim |
22:48:02 | * | awe00 quit (Ping timeout: 256 seconds) |
23:23:25 | * | endragor joined #nim |
23:28:02 | * | krux02 quit (Remote host closed the connection) |
23:31:59 | * | endragor quit (Ping timeout: 265 seconds) |
23:34:53 | * | vicfred joined #nim |
23:51:34 | * | bung quit (Ping timeout: 256 seconds) |
23:57:18 | * | bung joined #nim |
23:59:36 | * | vicfred_ joined #nim |