00:00:04 | FromGitter | <singularperturbation> https://irclogs.nim-lang.org/23-04-2019.html#19:30:56 think that what I want to do is currently not possible with system.default |
00:01:32 | * | krux02 quit (Ping timeout: 244 seconds) |
00:01:34 | disruptek | or maybe i'm forgetting something. |
00:02:14 | outtabwz | if i mutate a parameter var within a func it actually mutates global variables of the same name |
00:02:25 | outtabwz | weird |
00:03:27 | FromDiscord | <Varriount> outtabwz: Can you post a link to an example? |
00:03:36 | disruptek | j$: you're right; i use a macro to solve that. |
00:03:54 | outtabwz | Varriount: gimme a couple minutes please |
00:04:00 | disruptek | macro enumValues(e: typed): untyped = newNimNode(nnkCurly).add(e.getType[1][1..^1]) |
00:04:19 | disruptek | see usage in gittyup. |
00:04:21 | disruptek | !repo gittyup |
00:04:22 | disbot | https://github.com/disruptek/gittyup -- 9gittyup: 11higher-level git bindings that build upon nimgit2 15 2⭐ 1🍴 |
00:04:33 | * | SenasOzys quit (Ping timeout: 256 seconds) |
00:14:57 | outtabwz | Varriount: https://paste.call-cc.org/paste?id=ead7702d403e164aedf32f2a2c520834f9e30a25 |
00:15:13 | outtabwz | It's definitely not what I would expect. |
00:17:17 | disruptek | why not? |
00:18:07 | disruptek | you passed it the variable and then you mutated it. |
00:18:48 | FromDiscord | <j$> feels bad, seems like there's a uint16 size limit to tables |
00:19:08 | outtabwz | I don't expect a func parameter var to represent the same memory location as a global var |
00:19:20 | disruptek | then don't pass a global to it. |
00:19:45 | outtabwz | maybe it shouldn't be called a function if it can change global state |
00:19:47 | disruptek | you can have millions of entries in tables. |
00:19:57 | disruptek | outtabwz: there's an rfc about this. |
00:20:09 | outtabwz | sure, i'll read |
00:20:12 | disruptek | actually, i think the change might be in devel already. |
00:21:04 | disruptek | remove the var keyword from the proc param and set result instead. |
00:21:15 | disruptek | ~manual |
00:21:15 | disbot | manual: 11the Nim Manual is https://nim-lang.org/docs/manual.html -- disruptek |
00:21:26 | outtabwz | right |
00:21:28 | outtabwz | ty |
00:21:48 | disruptek | i agree that `func` should break on that code. |
00:29:32 | FromDiscord | <j$> seems like enum values can only range of 0 to 65535? |
00:29:45 | disruptek | yep. |
00:30:01 | FromDiscord | <j$> okay so that's my issues with this macro |
00:30:24 | disruptek | what are you trying to do? besides the obvious. |
00:34:04 | FromDiscord | <j$> Trying to make a list of sdl keycodes. They are stored in an non ordinal enum so I cant loop through it, but the range of possible values exceeds that range, but I think I'll just try something else. I'm stepping into xy problem territory |
00:35:03 | disruptek | you can use intsets if you care about combinations, else... they are just integers, right? |
00:35:17 | FromDiscord | <j$> yeah |
00:35:23 | disruptek | i wouldn't overthink it. |
00:35:30 | disruptek | i mean, i would, but i wish i wouldn't. |
00:35:41 | FromDiscord | <j$> yeah I need to eat, so I'll probably comeback to it |
00:39:48 | FromDiscord | <Zachary Carter> is there any proc for converting the result of `1 shl 2` to hex? |
00:40:04 | FromDiscord | <Elegant Beef> strutils has tohex iirc |
00:40:21 | FromDiscord | <Elegant Beef> Unless you mean as a hex number 😄 |
00:40:30 | FromDiscord | <Zachary Carter> yeah I mean as a hex number not a hex string |
00:40:59 | FromDiscord | <Zachary Carter> at the end of the day it doesn't matter - but I'm generating bindings so if I wanted the values to match the C code |
00:41:12 | FromDiscord | <Zachary Carter> meh screw it - it's not worth the trouble |
00:41:17 | FromDiscord | <Zachary Carter> (1 shl 2) works fine |
00:41:41 | disruptek | been awhile since there was a bug in it. |
00:41:50 | disruptek | but actually, there /was/ a bug in it. |
00:41:55 | disruptek | well, for int128. |
00:55:04 | FromDiscord | <Kiloneie> @Araq Btw for your future laptop purchase, get one with at least 6 cores from AMD.↵Check this link(i can't read german but i figured it out how to filter for you) https://geizhals.at/?cat=nb&bpmin=600&bpmax=1200&v=e&hloc=de&fcols=6751&sort=t&bl1_id=30&xf=10929_FreeDOS%7E1482_AMD |
00:59:35 | FromDiscord | <Kiloneie> Also 4XXX series cpus, get the one with one of those. |
01:02:06 | * | tiorock joined #nim |
01:02:06 | * | rockcavera is now known as Guest58241 |
01:02:06 | * | tiorock is now known as rockcavera |
01:03:55 | Prestige | PMunch has been gone far too long |
01:04:05 | disruptek | !last pmunch |
01:04:06 | disbot | PMunch quit 73 weeks ago and last spoke 3 weeks ago |
01:05:42 | FromDiscord | <Elegant Beef> He's on vacation, but i agree |
01:05:47 | * | Guest58241 quit (Ping timeout: 240 seconds) |
01:14:10 | * | maier joined #nim |
01:14:49 | * | apahl_ quit (Ping timeout: 272 seconds) |
01:16:16 | * | apahl joined #nim |
01:19:08 | * | maier quit (Ping timeout: 256 seconds) |
01:32:12 | FromDiscord | <Zachary Carter> do I really have to write a proc signature here to borrow `or` ? |
01:32:12 | FromDiscord | <Zachary Carter> https://play.nim-lang.org/#ix=2sPs |
01:32:43 | * | lritter joined #nim |
01:33:26 | FromDiscord | <Zachary Carter> or is there a simpler way of doing this? |
01:33:31 | Prestige | or cast to int maybe? |
01:33:53 | Prestige | https://play.nim-lang.org/#ix=2sPt |
01:34:35 | FromDiscord | <Zachary Carter> well yeah but that's even more annoying |
01:35:16 | FromDiscord | <Zachary Carter> I guess I'll just generate a converter for all of these |
01:41:21 | * | krux02_ quit (Remote host closed the connection) |
02:00:26 | disruptek | Zevv: look at this: http://ix.io/2sPz/nim |
02:04:41 | disruptek | i mean, i had no idea it was even possible. |
02:08:26 | ForumUpdaterBot | New thread by Oyster: Hard to load this forum, see https://forum.nim-lang.org/t/6627 |
02:08:43 | disruptek | Zevv: here's a working version that demonstrates the problem nonetheless: http://ix.io/2sPB/nim |
02:09:23 | disruptek | or maybe it's just a rendering "feature"? |
02:16:14 | * | audiofile joined #nim |
02:18:23 | * | vicfred quit (Read error: Connection reset by peer) |
02:42:11 | * | lritter quit (Ping timeout: 240 seconds) |
02:43:03 | * | lritter joined #nim |
02:48:53 | FromDiscord | <Zachary Carter> shashlick: think I found another issue with nimterop |
02:49:01 | FromDiscord | <Zachary Carter> trying to wrap: https://github.com/zeux/volk |
02:50:37 | FromDiscord | <Zachary Carter> https://gist.github.com/zacharycarter/adfb3940a3b8357655671ffe9626bbbb |
02:51:55 | shashlick | what's the error |
02:52:30 | FromDiscord | <Zachary Carter> actually one moment |
02:52:34 | FromDiscord | <Zachary Carter> I might just be missing another define |
02:54:03 | FromDiscord | <Zachary Carter> Error: undeclared identifier: 'PFN_vkAllocateCommandBuffers' |
02:54:06 | FromDiscord | <Zachary Carter> (edit) 'Error:' => '`Error:' | ''PFN_vkAllocateCommandBuffers'' => ''PFN_vkAllocateCommandBuffers'`' |
02:54:12 | FromDiscord | <Zachary Carter> adding the define didn't help |
02:54:58 | shashlick | its not defined anywhere in the code |
02:55:12 | FromDiscord | <Zachary Carter> well it is in the header file |
02:55:26 | FromDiscord | <Zachary Carter> oh I see |
02:55:52 | FromDiscord | <Zachary Carter> I probably need to also include vulkan.h, let me give that a shot |
02:57:35 | shashlick | what version of nimterop do you have - I get that error - ERROR: vulkan/vulkan.h: No such file or directory |
02:57:52 | * | theelous3 quit (Read error: Connection reset by peer) |
02:58:07 | * | audiofile quit (Quit: Default Quit Message) |
03:01:02 | FromDiscord | <Zachary Carter> 0.6.6 |
03:01:10 | FromDiscord | <Zachary Carter> but I think this is because that header relies on symbols defined in vulkan |
03:01:16 | FromDiscord | <Zachary Carter> which you need installed on your machine |
03:01:20 | FromDiscord | <Zachary Carter> like the sdk |
03:02:10 | shashlick | okay |
03:02:25 | FromDiscord | <Zachary Carter> the thing is though - I don't want to have nimterop wrap vulkan too |
03:02:29 | * | muffindrake quit (Ping timeout: 272 seconds) |
03:02:37 | FromDiscord | <Zachary Carter> so maybe I should just build a static library and link it |
03:02:47 | * | Tlanger joined #nim |
03:02:52 | FromDiscord | <Zachary Carter> that's probably the easiest way to go about this |
03:04:12 | * | muffindrake joined #nim |
03:04:55 | * | Tongir quit (Ping timeout: 246 seconds) |
03:05:03 | shashlick | you can exclude stuff now |
03:05:38 | FromDiscord | <Zachary Carter> yeah but do I have to be explicit about what exclude? or can I exclude an entire header file? |
03:05:44 | shashlick | https://nimterop.github.io/nimterop/cimport.html#cExclude.m |
03:05:51 | shashlick | an entire header works |
03:10:57 | FromDiscord | <j$> how would I make a macro have default parameter value, used as a block? |
03:12:50 | FromDiscord | <Varriount> Nim parameters support default values, though I've never seen them used with a macro |
03:15:03 | * | maier joined #nim |
03:18:31 | FromDiscord | <Zachary Carter> hmm shashlick: still a bit confused here - I need to `cImport` the file so that the symbols in the other file which reference them are able to resolve |
03:18:46 | FromDiscord | <Zachary Carter> however then the header gets generated - and I tried `cExclude` but it doesn't seem to help in this scenario |
03:18:58 | FromDiscord | <Zachary Carter> I don't think there's a good answer here |
03:19:15 | shashlick | Are the types defined separately |
03:19:18 | FromDiscord | <Zachary Carter> it's like I need to import a third party Nim module |
03:19:23 | shashlick | Or all together |
03:20:03 | FromDiscord | <Zachary Carter> I guess separately - since `PFN_vkAllocateCommandBuffer` doesn't exist anywhere in that codebase apparently |
03:20:03 | * | maier quit (Ping timeout: 256 seconds) |
03:20:32 | shashlick | You can also do -s in flags |
03:20:45 | shashlick | That way toast will create stubs for all these types |
03:20:55 | FromDiscord | <Zachary Carter> hmm okay I can give that a shot |
03:21:32 | shashlick | What I do is generate a wrapper with stubs then pick and choose the ones I really need in cOverride |
03:21:44 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:22:36 | FromDiscord | <Zachary Carter> oh... |
03:22:42 | FromDiscord | <Zachary Carter> it is actually defined in this library, it's an alias |
03:22:42 | FromDiscord | <Zachary Carter> https://github.com/zeux/volk/blob/79c7627887a9de3775fe80fc316dfb716c226c70/volk.h#L595 |
03:25:40 | FromDiscord | <Zachary Carter> so this indeed seems like a bug |
03:25:51 | shashlick | That's not a type definition |
03:26:13 | shashlick | That's a var |
03:27:00 | FromDiscord | <Zachary Carter> oh shit you're right, my bad |
03:27:01 | FromDiscord | <Zachary Carter> ugh |
03:33:30 | * | def- quit (Quit: -) |
03:39:39 | * | NimBot joined #nim |
03:40:26 | * | casaca quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:41 | * | supakeen joined #nim |
04:14:57 | * | casaca joined #nim |
05:08:33 | * | narimiran joined #nim |
05:15:57 | * | maier joined #nim |
05:21:16 | * | maier quit (Ping timeout: 265 seconds) |
05:34:35 | * | def- joined #nim |
05:35:05 | * | Tlanger quit (Quit: Leaving) |
05:49:28 | FromDiscord | <Zachary Carter> well shashlick: I think I have a better understanding of the problem |
05:49:44 | FromDiscord | <Zachary Carter> the header I'm wrapping expects symbols to be defined in another header file |
05:49:55 | FromDiscord | <Zachary Carter> and in my case they're defined in another wrapped library |
05:50:56 | FromDiscord | <Zachary Carter> using stubs & cOverride doesn't make sense here - because there are a lot of dependent symbols |
05:51:14 | FromDiscord | <Zachary Carter> I'll have to mess with trying to import or include the dependent module in the wrapper and see what happens |
06:18:11 | * | solitudesf joined #nim |
06:44:09 | * | zacts quit (Quit: WeeChat 2.8) |
06:44:48 | * | narimiran quit (Quit: leaving) |
06:58:21 | * | zacts joined #nim |
06:58:35 | zacts | is much of the nim language implemented in nim itself? |
06:58:43 | zacts | (kind of like lisp in this sense maybe) |
06:58:55 | zacts | raku is like this. I'm looking for a language like this. |
06:59:18 | zacts | altho I realize that nim has totally different aims than raku |
07:01:09 | FromDiscord | <Yardanico> Yes, all of the Nim compiler is in Nim |
07:01:13 | zacts | oh nice |
07:01:16 | zacts | thanks |
07:01:28 | FromDiscord | <Yardanico> And all of the stdlib (although some modules are wrappers over other libraries) |
07:01:34 | FromDiscord | <Yardanico> But most of the stdlib is pure Nim |
07:01:36 | zacts | I'll definitely put nim on my list of languages to check out for some future project ideas of mine. |
07:02:12 | zacts | I like how nim seems to be more lightweight than Rust |
07:02:54 | zacts | oh I see this too https://nim-lang.org/docs/nimc.html |
07:03:39 | zacts | nim is kind of what I'm looking for I think |
07:05:04 | * | zacts quit (Quit: WeeChat 2.8) |
07:12:26 | * | SenasOzys joined #nim |
07:17:20 | * | maier joined #nim |
07:19:38 | * | Guest14718 quit (Ping timeout: 260 seconds) |
07:21:58 | * | maier quit (Ping timeout: 260 seconds) |
07:24:25 | voltist | Zevv: Did you see that gist I sent with the broken FITS reader? |
07:24:30 | * | letto quit (Quit: Konversation terminated!) |
07:28:29 | * | letto joined #nim |
07:29:31 | ForumUpdaterBot | New thread by Jasonfi: Which version of OpenSSL to get QuickJWT linking?, see https://forum.nim-lang.org/t/6628 |
07:35:48 | * | endragor joined #nim |
07:48:37 | FromDiscord | <Varriount> Anyone have an idea of how much memory Nim tends to consume when building something like Nimble? |
07:48:49 | FromDiscord | <Varriount> (on linux) |
07:50:43 | FromDiscord | <Rika> i was able to build it on a raspberry pi 4 with 2gb of ram |
08:04:43 | * | endragor quit (Remote host closed the connection) |
08:12:21 | * | endragor joined #nim |
08:42:57 | * | nikita` joined #nim |
09:23:25 | * | solitudesf quit (Ping timeout: 265 seconds) |
09:50:44 | FromDiscord | <Yardanico> no one's here, everyone's sleeping or relaxing? 🤔 |
09:50:49 | Oddmonger | is it possible to call a function when a seq assignation is asked ? |
09:50:53 | supakeen | What is a nice way to include examples in my repository so they can be built easily. |
09:51:02 | FromDiscord | <Yardanico> lol |
09:51:11 | supakeen | Yardanico: You asked for it ;) |
09:51:29 | FromDiscord | <Yardanico> @oddmonger you mean overload a[x] = y ? |
09:51:44 | FromDiscord | <Yardanico> That's the []= operator |
09:51:49 | Oddmonger | like this: var mytype.list == @[ … ] |
09:52:05 | Oddmonger | yes overload, but only for a type |
09:52:08 | FromDiscord | <Yardanico> What would that mean? |
09:52:09 | Oddmonger | that's not clear for me |
09:52:14 | Oddmonger | as you see :) |
09:52:31 | Oddmonger | i try to explain better |
09:53:08 | Oddmonger | i have a «constructor»: let mytype = Mytype( … ) |
09:53:19 | Oddmonger | in this type, there is a seq |
09:53:31 | * | Ven`` joined #nim |
09:53:48 | FromDiscord | <Yardanico> Yeah, so? |
09:53:49 | Oddmonger | which could (in the best way) initilized by the assignation |
09:54:07 | Oddmonger | but i didn't found how to initialize |
09:54:31 | FromDiscord | <Yardanico> You don't have to initialize seqs if you mean that |
09:54:33 | Oddmonger | so i'm trying the next step: overloading the [] actces |
09:54:44 | FromDiscord | <Yardanico> And if you want to assign a seq when constructing it's simple |
09:54:48 | Oddmonger | actces/access |
09:54:52 | * | endragor quit (Remote host closed the connection) |
09:55:01 | FromDiscord | <Yardanico> let f = MyType(myseq: @[1, 2, 3]) |
09:55:05 | * | endragor joined #nim |
09:55:07 | FromDiscord | <Yardanico> Where myseq is a field in MyType |
09:55:29 | Oddmonger | yes but i have to compute the seq |
09:55:52 | FromDiscord | <Yardanico> Based on other fields in a type? Or what? |
09:55:53 | Oddmonger | myseq is derivated from a value given at construction |
09:56:16 | FromDiscord | <Yardanico> Why not just create your custom constructor then? Like initFoo or newFoo |
09:56:18 | Oddmonger | so i have to call a constructor (a real i mean, cannot assign it directly) |
09:56:48 | Oddmonger | i'm doing my homework in fact, i cannot control the flow :) |
09:57:04 | Oddmonger | the test is called like this: |
09:57:22 | Oddmonger | let allergies = Allergies(score: 3) |
09:57:34 | Oddmonger | check allergies.lst == @["eggs", "peanuts"] |
09:58:01 | Oddmonger | so there is a «lst» which i defined as a seq in |
09:58:38 | FromDiscord | <Yardanico> Exercism? |
09:58:40 | Oddmonger | Allergies, but you see, i must either overload @[] access, or populate «lst» when assigning allergies |
09:58:49 | FromDiscord | <Yardanico> Can you show the test code |
09:58:50 | Oddmonger | yes it's exercism |
09:58:53 | Oddmonger | yes |
09:59:38 | Oddmonger | http://ix.io/2sQY |
10:00:08 | * | endragor quit (Remote host closed the connection) |
10:00:43 | FromDiscord | <Yardanico> I can uncover a deep secret for you |
10:00:43 | Oddmonger | and my work: http://ix.io/2sR0 |
10:00:51 | FromDiscord | <Yardanico> lst can be just an ordinary proc |
10:00:56 | Oddmonger | oh |
10:00:56 | FromDiscord | <Yardanico> Remember UFCS |
10:01:00 | FromDiscord | <Yardanico> And command syntax |
10:01:05 | Oddmonger | ohhhhh /o\ |
10:01:18 | Oddmonger | ok thank you :) |
10:01:22 | supakeen | What does `saterm` sound like to you? |
10:01:28 | FromDiscord | <Yardanico> ? |
10:01:34 | Oddmonger | sat ? |
10:01:38 | FromDiscord | <Yardanico> Terminal emulator? |
10:02:15 | Oddmonger | i think he is speaking of grammar |
10:02:35 | * | rockcavera quit (Ping timeout: 240 seconds) |
10:02:39 | Oddmonger | i remember having read this in the lua book «programming in lua» when they define the grammar |
10:03:28 | Oddmonger | but it was «SAT» if i remember well |
10:03:37 | supakeen | Yardanico: That's close enough yes. It's a ploy on saturn but instead it's a terminal. |
10:03:49 | supakeen | Well, not a terminal it's a 'port' of urwid to nim. |
10:04:05 | Oddmonger | (or was it AST :þ) |
10:07:13 | FromDiscord | <Yardanico> Yeah I know what you mean by a SAT |
10:10:25 | Zevv | yeah last thing I saw was he was on a boat |
10:11:06 | * | Vladar joined #nim |
10:11:26 | Zevv | irc/2020/07/10:21:41 #nim: < PMunch> Apparently the internet out here is a bit flaky though.. |
10:11:30 | Zevv | last we ever heard |
10:20:27 | FromGitter | <alehander92> he merged a PR several days ago |
10:20:36 | FromGitter | <alehander92> so he' still out there |
10:24:37 | * | krux02 joined #nim |
11:25:04 | * | waleee-cl joined #nim |
11:31:46 | * | audiofile joined #nim |
11:33:32 | * | maier joined #nim |
11:38:25 | * | maier quit (Ping timeout: 240 seconds) |
11:41:52 | * | noonien joined #nim |
11:44:32 | * | lritter quit (Quit: Leaving) |
11:53:37 | Zevv | so the rumours go |
11:53:56 | Yardanico | ? |
11:58:13 | supakeen | It's handy that you are on all the chat clients so I can at least tab-complete your name Yardanico. |
11:58:19 | Yardanico | hehe |
11:58:42 | Yardanico | Well I use Quassel (so I'm 24/7 online in IRC) and I rarely turn off my PC anyway |
12:02:59 | Oddmonger | so with $ i can convert enum to string, but can i convert a string to enum value ? I read « use strutils », but it doesn't see to do that |
12:03:04 | Yardanico | parseEnum |
12:03:08 | Yardanico | from strutils |
12:03:42 | Oddmonger | Yardanico , you answers are such fast i suspect you to be an AI trained with Nim index |
12:03:47 | Yardanico | shhh |
12:03:48 | Oddmonger | thank you |
12:05:25 | Zevv | Yardanico, built on GPT-3 |
12:05:43 | Yardanico | I just happen to remember most of the (used) stdlib modules |
12:05:47 | Yardanico | Which is quite handy |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:02 | Yardanico | but I still read module docs for more complex procs or for the ones I didn't use myself |
12:06:39 | * | supakeen joined #nim |
12:07:52 | Yardanico | and my answers are fast because when I'm on the PC Quassel is on my second display |
12:08:00 | Yardanico | so I notice new messages with my peripheral vision |
12:08:08 | Yardanico | even when I'm focused on the main display |
12:18:43 | FromDiscord | <Recruit_main707> There are a few rare bugs with dlls —noMain and —threads.↵It’s being hard to find all of them |
12:19:07 | Yardanico | with arc? |
12:19:16 | Yardanico | --threads:on might be hard to properly manage with the default GC |
12:19:20 | Yardanico | with --noMain and stuff |
12:19:23 | Oddmonger | ord(enu.truc) -> ok |
12:19:29 | FromDiscord | <Recruit_main707> It doesn’t seem to be specific to arc |
12:19:31 | Oddmonger | ord (enu.truc) -> cryptic error |
12:19:48 | Oddmonger | (ordinal type expected) |
12:20:12 | Yardanico | well can you show more code? |
12:20:13 | Oddmonger | /o\ 20mn before retyping all without spaces |
12:20:30 | Yardanico | "ord (Tata.truc)" might mean call ord with a tuple in some cases |
12:20:36 | Yardanico | it's better to just not use parens in this case |
12:20:58 | Yardanico | I use UFCS quite a lot, but I rarely add spaces in calls like that :P |
12:21:14 | Oddmonger | # return (ord ( parseEnum[enumAllergies]( name)) and this.score) > 0 |
12:21:30 | Oddmonger | return (ord(parseenum[enumAllergies](name)) and this.score) > 0 |
12:21:47 | Oddmonger | the commented one is refused with «ordinal type expected» |
12:22:22 | Oddmonger | but even with a simple enum access, it's the same error |
12:22:37 | Oddmonger | hum… no |
12:26:03 | FromDiscord | <Shucks> > There are a few rare bugs with dlls —noMain and —threads.↵> It’s being hard to find all of them↵@Recruit_main707 just got issues with arc in that case |
12:26:15 | Yardanico | well report them then :) |
12:26:15 | FromDiscord | <Shucks> thats why I was asking if arc supports threads |
12:26:20 | Yardanico | it does just fine |
12:26:26 | Yardanico | look at how Nim makes a DllMain itself |
12:26:34 | Yardanico | so you can do it in a similar way yourself |
12:27:19 | FromDiscord | <Shucks> Well as you might know we're coding injectable libraries. Hard to tell what exactly happens |
12:27:41 | FromDiscord | <Shucks> Crashes the main process. Debugging doesn't gives usable information |
12:28:40 | Yardanico | try to inject into your own process for a test :) |
12:28:44 | Yardanico | the one you compiled in full debug mode |
12:29:35 | FromDiscord | <Shucks> That might be a solution yea |
12:40:37 | Oddmonger | arrrrrhh disjoints enums |
12:42:43 | Yardanico | don't use enums with holes :(( |
12:42:45 | Yardanico | holes are dangerous |
12:42:49 | Yardanico | you can fall into them |
12:43:23 | Oddmonger | cannot climb with succ ? |
12:47:36 | Oddmonger | nak, works only with no holes too |
13:01:38 | Oddmonger | don't believe i'm proud of this, but it works with very few lines: http://ix.io/2sRA |
13:01:52 | Yardanico | first tip: you can have one type section here :) |
13:02:18 | Oddmonger | ah yes, no need to object |
13:02:41 | Yardanico | also, if you only need one proc from some module, no need to add a comment like that |
13:02:50 | Oddmonger | maybe i could have a cleaner result by generating the table with preprocessor |
13:02:50 | Yardanico | you can just do from strutils import parseEnum |
13:02:59 | Yardanico | and your enum seems to be a bitflag one |
13:03:09 | Yardanico | also I don't like the space placement personally (I like the usual nim style, e.g. what nimpretty would give you) |
13:03:16 | Yardanico | no need for "return result" in lst :) |
13:03:32 | Yardanico | See https://nim-lang.org/docs/manual.html#set-type-bit-fields |
13:03:40 | Yardanico | "Note how the set turns enum values into powers of 2." |
13:06:12 | Oddmonger | ah need to read about set then |
13:07:51 | Oddmonger | i think i understand, it's nice |
13:08:27 | Oddmonger | don't even need parseenum with that |
13:09:41 | FromDiscord | <Shucks> Well I'm not able to reproduce that threads & gc error: https://media.discordapp.net/attachments/371759389889003532/739107587944874014/injecttest.rar |
13:09:56 | FromDiscord | <Shucks> works how expected |
13:12:12 | Yardanico | Oddmonger: I'm also a mentor on exercism for the Nim track btw, but I rarely review solutions :D |
13:13:01 | FromDiscord | <haxscramper> Is it possible to get original source code line from `NimNode` without getting line index using `lineInfoObj` and reading whole file again? |
13:13:42 | Yardanico | I don't really think it is, since otherwise it would take quite a lot of memory |
13:13:57 | Oddmonger | Yardanico: i've written that i've been helped in the source, and included original work |
13:14:06 | Yardanico | no it's fine |
13:14:08 | Oddmonger | even if it doesn't count for the exam :) |
13:14:11 | Yardanico | I didn't mean it this way |
13:14:27 | Oddmonger | yes, no problem :) |
13:14:38 | Oddmonger | i had understood don't worry |
13:28:27 | Araq | plan for the holidays is to remove the VM from Nim :-) |
13:30:36 | Araq | disruptek, https://github.com/disruptek/sigv4 fails for my PR :-( |
13:30:45 | Araq | https://github.com/nim-lang/Nim/pull/15141 |
13:30:47 | disbot | ➥ fixes #15130 |
13:30:48 | Yardanico | Araq: the VM thing sounds.. crazy |
13:30:56 | Yardanico | genius I mean :P |
13:30:58 | Araq | Yardanico, holidays! :P |
13:31:10 | Yardanico | but what will you replace it with? |
13:31:11 | Yardanico | nim itself? |
13:31:29 | Araq | yeah, produce C code and staticExec the code |
13:34:21 | * | maier joined #nim |
13:36:27 | Yardanico | Araq: I will have a short look on sigv4 with your PR to try to see why it fails |
13:36:34 | Araq | thanks |
13:41:41 | FromDiscord | <Chapl> Hi! Somebody mind helping me out with macros and pragmas? I'd like to play with 'em a bit but encountered an issue that I cannot get resolved by myself, be it because of lacking documentation or something else. |
13:44:13 | FromDiscord | <Chapl> See the `{.toggle.}` and `{.with.}` right there, declared with the fields? I'd like them to generate "builder methods" for me, at compile time. Now, I think this would work by implementing a macro that I'd call like this `populateBuilderFunctions(Configuration)`, but I'd like to it without calling some function. https://media.discordapp.net/attachments/371759389889003532/739116275774783528/unknown.png |
13:44:52 | FromDiscord | <Chapl> (edit) 'See the `{.toggle.}` and `{.with.}` right there, declared with the fields? I'd like them to generate "builder methods" for me, at compile time. Now, I think this would work by implementing a macro that I'd call like this `populateBuilderFunctions(Configuration)`, but I'd like to ... it' => 'See the `{.toggle.}` and `{.with.}` right there, declared with the fields? I'd like them to generate "builder methods" for me, at compile time. |
13:46:01 | FromDiscord | <Chapl> So, `whitelistEnabled* {.toggle.}: bool` would technically result in a func looking like this `func toggleWhitelistEnabled(c: var Configuration, b: bool): var Configuration` |
13:50:59 | * | outtabwz left #nim (#nim) |
13:55:01 | * | NimBot joined #nim |
13:57:30 | Araq | don't return things you already know just because you like chaining. use 'with' for chaining |
13:57:35 | Araq | sugar.with |
13:59:07 | FromDiscord | <Chapl> Cool hint but that's not the problem I described. |
13:59:08 | Yardanico | Araq: so far it's https://gist.github.com/Yardanico/6457d94ed01c5af17a5bc3810c21e5ea |
14:06:41 | Yardanico | oh I'm near |
14:08:34 | Yardanico | Araq: only json left https://gist.github.com/Yardanico/7d46844e887ae0f166a61a6cd585866d |
14:08:50 | Yardanico | it's probably because stuff in tt |
14:09:31 | FromDiscord | <Recruit_main707> Yardanico: I already import the dll as normal and inject it into dummy processes for testing |
14:09:51 | Yardanico | ohh I know what I should try |
14:10:22 | Yardanico | yeah easy |
14:11:26 | Yardanico | Araq: final one :) https://gist.github.com/Yardanico/accf95a2dc3162fe0b3a7188ab9d7932 |
14:11:43 | Yardanico | it just doesn't crash with strings because literal strings with arc are static |
14:11:51 | Yardanico | so it doesn't destroy them and there's no crash (so I used seqs which are on heap) |
14:14:28 | Araq | well optimizing string literals was the initial motivation for cursor inference :-) |
14:15:08 | * | vicfred joined #nim |
14:15:13 | Araq | Chap1: sure, now what's your problem again? |
14:15:20 | Yardanico | @Chapl ^ |
14:17:09 | disruptek | Araq: i guess your pr is incomplete. 😉 |
14:18:07 | disruptek | i hope to fixup mangling before you get back. |
14:18:51 | * | theelous3 joined #nim |
14:19:34 | FromDiscord | <Chapl> sent a long message, see http://ix.io/2sRY |
14:20:08 | shashlick | Araq: why remove the vm? What's the motivation |
14:20:11 | FromDiscord | <Chapl> It is just a practice for me to get used to macros and templates. I'm not really trying to get func/proc chaining to work. |
14:20:25 | Yardanico | shashlick: no need to maintain yet another implementation of nim? idk |
14:22:17 | disruptek | without a vm, all operations at runtime are available at compile-time. |
14:22:24 | shashlick | That's the obvious answer but still curious cause it could have been done with static exec initially as well but wasn't for some reason |
14:23:18 | Araq | shashlick, it wasn't because back then I had fun writing a bytecode VM |
14:24:11 | Araq | now it's just another legacy subsystem. Also, I'm not sure I was aware of the idea, macros came earlier than staticExec and making it work with staticExec is a complex task too |
14:25:36 | shashlick | Got it |
14:29:09 | FromGitter | <alehander92> whatr about |
14:29:11 | FromGitter | <alehander92> nlvm |
14:29:17 | FromGitter | <alehander92> and other possible nim impl-s |
14:29:35 | FromGitter | <alehander92> would the spec require stuff like C evaluation on CT |
14:29:52 | Araq | same story, nlvm can use its own backend for evaluation |
14:32:23 | FromGitter | <alehander92> but we need CT to be independent off backend |
14:32:24 | * | vicfred quit (Quit: Leaving) |
14:32:33 | Yardanico | it would be |
14:32:43 | Yardanico | even for JS backend the CT will probably use the C backend |
14:33:09 | FromGitter | <alehander92> but e.g. if my code executes c calls to some lib |
14:33:13 | FromGitter | <alehander92> or emits C |
14:33:20 | FromGitter | <alehander92> is this supposed to be idiomatic / supported |
14:33:24 | Yardanico | so what's the problem? |
14:33:56 | Yardanico | wonder what will happen with "nim secret" though :P |
14:34:00 | Yardanico | I guess it'll be gone away for good? |
14:34:07 | FromGitter | <alehander92> well, the problem is should my custom nim support that on CT |
14:34:23 | FromGitter | <alehander92> because that's an additional requirement compared to runtime availability |
14:34:41 | FromGitter | <alehander92> usually if i see macros i think "this works everywhere" |
14:34:50 | Yardanico | yes, that won't change as far as I can see it |
14:34:54 | Yardanico | macros don't emit C code or call C libraries |
14:35:04 | FromGitter | <alehander92> ok |
14:35:05 | Yardanico | since FFI in the VM was never a stable feature |
14:35:12 | FromGitter | <alehander92> i mean : it's useful |
14:35:14 | FromGitter | <alehander92> to be able to do ffi |
14:35:19 | Yardanico | yes |
14:35:20 | FromGitter | <alehander92> i am not saying it's not a good thing |
14:35:27 | FromGitter | <alehander92> just wondering how standard it is |
14:37:59 | shashlick | So the js backend will also need a C compiler installed |
14:38:53 | shashlick | Our will the new compile time run on js |
14:49:32 | Araq | that's a good question. 'static: os.copyFile(...)' means the JS backend needs the C backend for 'static' blocks :P |
14:51:51 | FromDiscord | <Chapl> Why is everything in the Nim world just 50% solution instead of a 90% or a 100% solution. So excited about Nim and every single time I work with either Nim or the Nim community I get busted in the balls. |
14:51:59 | Yardanico | ? |
14:52:08 | FromDiscord | <Clyybber> @Chapl you could put the generating call in your module |
14:52:16 | FromDiscord | <Clyybber> and make it generate exported procs |
14:52:26 | Yardanico | you can always ask on the forums, real time chat is not good for big questions which would require big explanations :) |
14:52:46 | Araq | chap1: the 'norm' package does comparable things, please check it out |
14:53:14 | Yardanico | Araq: it's l btw, not 1 :D |
14:53:39 | Araq | as for your question, features start in the state "not implemented" and then slowly reach 50%, 80%, 99% |
14:56:37 | * | Ven`` quit (Quit: Textual IRC Client: www.textualapp.com) |
14:56:50 | Yardanico | and 100% is not realistically possible for anything really :) |
14:58:14 | Yardanico | s/really// |
15:22:08 | FromDiscord | <Clyybber> Araq: Btw addressed the review comment and undrafted https://github.com/nim-lang/Nim/pull/15123 |
15:22:08 | disbot | ➥ Better semiStmtList parsing |
15:22:41 | * | rockcavera joined #nim |
15:24:55 | disruptek | chapl: it's because you have big balls. i have the same problem. |
15:25:30 | disruptek | Araq: feel free to pr sigv4. |
15:25:37 | Yardanico | disruptek: it's not a sigv4 problem :) |
15:25:41 | Yardanico | and he already fixed it |
15:25:43 | disruptek | !last zevv |
15:25:44 | disbot | Zevv spoke in 12#nim 3 hours ago 12https://irclogs.nim-lang.org/01-08-2020.html#12:05:25 |
15:25:51 | Zevv | wut |
15:26:23 | Zevv | I mean, good morning disruptek. |
15:26:34 | disruptek | can we just nail down the spec and then i can produce working code? |
15:26:39 | disruptek | i mean, howdy, zevv |
15:26:49 | Yardanico | disruptek: relax :) |
15:27:17 | Zevv | disruptek: sure |
15:27:21 | disruptek | germans make the best pants. |
15:27:30 | Zevv | lederhosen? |
15:27:36 | disruptek | nein |
15:28:27 | disruptek | more like federhosen. |
15:28:33 | disruptek | this company, alberto. |
15:28:43 | disruptek | use an italian fabric. |
15:29:17 | disruptek | i've beat the shit out of these pants and they are incredible. |
15:29:29 | Zevv | is that german? |
15:30:11 | disruptek | which part? |
15:30:25 | Zevv | anyway, the spec |
15:30:34 | Zevv | tell me, what problems were in your V1 which you want to solve in V2 |
15:31:07 | Zevv | I know the implementation was shitty and needs a rewrite, but what needs to change? |
15:31:12 | disruptek | the call convention is a major one. |
15:31:25 | Zevv | right. So, all I ask is to make that end-user centric |
15:31:51 | disruptek | i want c.next, c.next(), and c.next(43) |
15:32:02 | Zevv | so you will pass c to cps procs? |
15:32:37 | disruptek | what else? |
15:32:51 | Zevv | hide that |
15:33:07 | disruptek | what? |
15:33:08 | Zevv | c |
15:33:14 | Zevv | you hid it in v1 |
15:33:21 | disruptek | that was a dumb idea. |
15:33:31 | Zevv | true, just checking |
15:33:40 | disruptek | lol |
15:33:47 | Zevv | was *my* idea, never forget |
15:34:05 | Zevv | so, what is the problem, you can just get c.foo, c.foo() and c.foo(arg, arg), right? |
15:34:15 | Zevv | I don't care for the first really, but I think it comes naturally |
15:34:49 | disruptek | what is the first? |
15:34:54 | Zevv | c.foo |
15:34:56 | Zevv | without the () |
15:35:00 | disruptek | yes, but what does it mean? |
15:35:05 | Zevv | same as c.foo() |
15:35:13 | disruptek | well, this is a problem. |
15:35:21 | * | dadada joined #nim |
15:35:45 | * | dadada is now known as Guest37688 |
15:35:56 | Zevv | because of the callOperator |
15:35:57 | disruptek | maybe () is compositional but command syntax yields the result? |
15:36:40 | Zevv | so, just leave it out then |
15:36:52 | Zevv | why do *you* want those three |
15:37:28 | disruptek | because if people have access to the continuation, we need to understand how they use it. |
15:37:53 | Zevv | I'd say, make it opaque. |
15:37:55 | Zevv | it's just a handle |
15:38:03 | disruptek | i want those because i want to get the result, i want to chain continuations, and i want to pass args to them. |
15:38:48 | Zevv | ok, but you're talking about continuations as if the user needs to know what that are |
15:39:03 | disruptek | i don't care what you build. that's your problem. |
15:39:05 | Zevv | the initial idea of this whole thing is to hide all that |
15:39:15 | disruptek | but it would be helpful if you built some stuff that we can test against. |
15:39:23 | Zevv | sure, ready when you are |
15:39:31 | disruptek | maybe that's done already; i just realized that stash is a directory. 🤣 |
15:40:02 | Zevv | there's a little iterator. a little http server. a little goto and a little trycatch |
15:40:13 | Zevv | all without using any external event queues |
15:40:57 | Zevv | and performance.nim telling me nim closure iterators are 6.111 times faster |
15:41:07 | disruptek | performance.nim? |
15:41:34 | Zevv | https://github.com/disruptek/cps/blob/master/stash/performance.nim |
15:41:47 | disruptek | oh, i'm not up-to-date i guess. |
15:41:53 | Zevv | is that news |
15:42:16 | disruptek | ah, this is neat. |
15:43:21 | Zevv | so basically, I'm reasonably happy with the V1 api, altough I need one more thing |
15:43:33 | Zevv | which is your 'data' in the new continuation type |
15:43:52 | disruptek | i don't get it. |
15:44:37 | Zevv | look at https://github.com/disruptek/cps/blob/master/stash/trycatch.nim |
15:44:54 | Zevv | there's this global vars because I can't put that anywhere else. "err" "msg" and "where" |
15:45:29 | Zevv | the example is kind of silly, but it's a kind of exceptions |
15:45:50 | disruptek | okay, but i think continuations should be so conceptual that they don't define fields. |
15:46:21 | disruptek | that means that you can compose them from anything you want. |
15:46:47 | Zevv | right. I dont need that or see why I would, but it doesn't hurt to do it like that |
15:47:01 | Zevv | it will probably bring great power one day |
15:47:43 | disruptek | what is `setLen(x: seq[T], 10): seq[T]` but a call to a continuation around `seq[T]` with a constant, adjacent value `10`? |
15:48:13 | * | Vladar quit (Ping timeout: 264 seconds) |
15:48:56 | Zevv | sure. I see that, but it's just that I don't *need* that now |
15:49:03 | Zevv | I have a few clear pracical goals |
15:49:15 | disruptek | what are they? |
15:50:07 | Zevv | lua-style coroutines, if possible getting a return value from a cps magic call, and async like in the http server |
15:50:29 | disruptek | i don't really know lua, i just hack it. |
15:50:38 | Zevv | I do, so i have your back |
15:50:55 | disruptek | but what does it mean? x.next; x.next; x.next? |
15:50:56 | FromDiscord | <Recruit_main707> @dom96 where does the choosenim intaller install everything? |
15:51:07 | disruptek | recruit: `which nim` |
15:51:30 | disruptek | Zevv: like python generators? |
15:51:37 | FromDiscord | <dom96> @Recruit_main707 ~/.choosenim |
15:51:40 | Zevv | disruptek: you mean the lua coros? |
15:51:44 | disruptek | yeah. |
15:52:26 | FromDiscord | <Recruit_main707> its just that i deleted everything i could find in my pc, but choosenim still apears when i try to run `nim` on cmd |
15:53:40 | Zevv | disruptek: you create a coroutine and resume() it to start it. |
15:53:52 | Zevv | You can pass data into resume(), which is the avaialble in the coro proc. |
15:54:13 | Zevv | The coro runs until it yields. It can pass data into yield(), which becomes the result of the resume() proc that resumed the coro |
15:54:39 | Zevv | what the proc yields() is return value of resume(), and what you pass to resume() becomse the return value of the next yield() |
15:54:52 | Zevv | it's amazingly simple and powerful |
15:55:22 | Zevv | The good thing is that it doesn't have colored functions. That's something we can not really do for now tho |
15:55:31 | disruptek | what you pass... is the same type as what you receive back. |
15:55:47 | Zevv | lua is typeless, so it doesn't really map. |
15:56:13 | Zevv | But I guess I can make it so that you provide T1 for the one way, and T2 for the other way |
15:56:23 | disruptek | var x = newCoro(); assert x.resume(43) == 44; assert x.resume("43") == "44"; right? |
15:56:37 | * | maier quit (Ping timeout: 264 seconds) |
15:57:05 | Zevv | close enough |
15:57:16 | Zevv | anyway, these are the kind of things I want to try to build |
15:57:34 | Zevv | and also just the simple async stuff |
15:57:40 | Zevv | which I want to go use on tiny embedded things |
15:58:16 | disruptek | like parasites? i have a lot of those. |
15:58:54 | Zevv | symbiotic evolution for millions of years, you'll be just fine |
15:59:26 | disruptek | its only been 18 months and these worms on my back are driving me crazy. |
16:00:43 | Zevv | anyway, practically speaking, V1 was pretty close |
16:01:03 | Zevv | but like I said, I need a way to pass data among my cpsMagic procs, which I could not yet do |
16:01:39 | disruptek | well, let x = mycont.foo(43) is just a return statement where the continuation resumes with a new x value in scope. no big deal. |
16:01:51 | Zevv | no big deal |
16:01:59 | Zevv | so indeed, look at stash/ |
16:02:03 | disruptek | mycont.foo(43) is more interesting to me, because it lets the user put values adjacent. |
16:03:02 | disruptek | the question is, does the user tell us to merge those values into the continuation? or do we always do so? or never? or do we infer this? |
16:03:16 | Zevv | how is that differetn from what we already had? You could do `cps sleep(3)` |
16:03:59 | disruptek | our code was storing the 3 twice. |
16:04:37 | Zevv | right. But the semantics are the same. |
16:04:40 | Zevv | and you really need that |
16:04:44 | Zevv | to be able to do that |
16:06:28 | disruptek | hmm. |
16:07:00 | * | ForumUpdaterBot quit (Remote host closed the connection) |
16:07:08 | * | ForumUpdaterBot joined #nim |
16:08:20 | disruptek | what is cpsMagic to you and why do you need it? |
16:08:49 | Zevv | I don't need the macro, but the concept. Its a thing that gets called to do the "magic" stuff |
16:08:55 | Zevv | the internals. Like the magic CPC functions in the paper |
16:09:06 | Zevv | the things that store continuations in event queue bookkeeping |
16:09:13 | Zevv | they have full access and knowledge of the C type |
16:09:36 | Zevv | they implement 'sleep' and |
16:09:39 | Zevv | 'iowait |
16:10:43 | disruptek | well, it turns out that all primitives are the same. and if primitives are also the same as user code, it helps everyone. |
16:11:07 | Zevv | right, if so, all the better |
16:11:19 | disruptek | okay. |
16:11:47 | disruptek | so what the rewrite does is to make control flow more natural. |
16:12:00 | disruptek | that's the only purpose. |
16:12:10 | Zevv | but I thnink I want to be able to do some level of isolation. middleware can do everything, but users of the middlewere should not be bothered by any of this |
16:12:22 | Zevv | that is the only purpose |
16:12:26 | disruptek | middleware abstraction is your problem. |
16:12:26 | Zevv | i want to write 'normal' nim |
16:12:29 | Zevv | right |
16:13:10 | Zevv | i was just speaking in v1 terms |
16:13:43 | Zevv | I want to be able to do https://github.com/disruptek/cps/blob/master/stash/goto.nim without the global 'labels |
16:13:51 | Zevv | that should live somewhere in the chain of continuations |
16:13:56 | Zevv | all very practical stuff |
16:15:16 | disruptek | cont.foo probably has to be the result. |
16:15:28 | Zevv | probably |
16:15:48 | disruptek | annoying. |
16:17:12 | disruptek | () is next, so (43) is next(43). |
16:18:31 | disruptek | why don't you have labels on the continuation object? |
16:18:32 | Zevv | pretty |
16:20:02 | Zevv | how do you mean? |
16:20:07 | Zevv | labels |
16:20:19 | Zevv | oh in the goto |
16:20:20 | disruptek | in the goto example; why do they have to be global? |
16:20:36 | Zevv | ehm maybe I was just doing stupid stuff, I'll take a good look in an hour or so |
16:20:44 | Zevv | first grillin da portabellos |
16:20:52 | disruptek | heh okay. |
16:27:04 | FromGitter | <alehander92> goto goto |
16:36:09 | disruptek | `[]`() is a macro that lets you cont[n] = 43 # set symbol `n` inside the continuation to value 43. |
16:44:12 | disruptek | might have to start showering again. |
16:44:22 | disruptek | it's annoying to have to floss my comb. |
16:58:36 | * | superbia1 joined #nim |
17:00:03 | Zevv | disruptek: I cant store my labels inside the continuation object because it gets lost and I have not place to initialize. Initialization could be done with some `if nil` snartness, but the passing around breaks it. |
17:00:24 | Zevv | I'll have to go and see which of the `when declaredInScope` branches is taken for each proc |
17:01:25 | * | superbia quit (Ping timeout: 246 seconds) |
17:04:47 | Zevv | also related to yesterdays question: why do we even bother to return a C all the time, if we can just mutate it in plcae |
17:16:20 | disruptek | wut |
17:16:30 | Zevv | wut wut |
17:16:45 | Zevv | ok, forget the last remark |
17:16:52 | Zevv | about gettign my 'goto' labels into C, right |
17:17:08 | Yardanico | wat wut wat? |
17:17:13 | Zevv | so I do http://ix.io/2sSz |
17:17:25 | Zevv | seems ok, if CPS would do the right thing. But V1 doesn't |
17:17:33 | Zevv | So c.labels is not the same c.labels next time |
17:19:26 | Zevv | which is funny, because from the cpsDebug output i'd expect the same continuation to be moved around all of the time |
17:19:33 | disruptek | i don't understand. |
17:19:52 | Zevv | ok, one step back |
17:20:30 | Zevv | goto example, moved labels back to globals. I add one 'int' to my Conte type |
17:20:35 | Zevv | which on every 'goto' I echo and inc |
17:20:37 | Zevv | what should happen? |
17:21:08 | Zevv | the idea is that C is a pointer to the same contuniation all of the time |
17:21:09 | Zevv | but it isn't |
17:21:16 | disruptek | why not? |
17:21:38 | Zevv | beacsue something is broken. I still allocs new C's |
17:21:54 | disruptek | i didn't even know cps was compiling. |
17:22:04 | Zevv | Talking current master |
17:22:10 | Zevv | with my stash/ stuff |
17:22:15 | Zevv | those work |
17:22:20 | disruptek | really? |
17:22:22 | Zevv | dude |
17:22:35 | disruptek | my branch is different, i guess. |
17:22:44 | disruptek | let's look at the rewrite. |
17:22:52 | disruptek | i can't read anything interesting here. |
17:23:01 | disruptek | can you paste it for us? |
17:23:01 | Zevv | the rewrite is doin these two level nasty 'when' things |
17:23:04 | Zevv | so it's hard to follow |
17:23:15 | disruptek | yeah, but i'm the author of that garbage. |
17:23:32 | Zevv | http://ix.io/2sSC |
17:24:08 | Zevv | so start at foo. no 'continuation' in scope so it makes a new one. and puts in 'after_14400250' |
17:24:15 | disruptek | it's clearly creating a new object. |
17:24:27 | Zevv | yeah, the first foo() call, and it should |
17:24:57 | Zevv | but after that it keeps going at after_14400250 only |
17:26:01 | disruptek | we should just call Tc on the env types, i guess. |
17:26:23 | disruptek | it's surprising that we're wrong about Tc(). |
17:26:51 | Zevv | in the 'when' branches, it should take the one where it reuses the current continuation and only updates 'fn', right? |
17:27:00 | disruptek | yes. |
17:27:24 | Zevv | I don't think it does |
17:27:58 | disruptek | `is` is not as smart as you thought. |
17:28:09 | Zevv | I never thought that |
17:28:22 | disruptek | oh, well, uh. |
17:28:24 | Zevv | hehe |
17:28:31 | Zevv | just that 'it worked for me' |
17:28:48 | Zevv | are you sure it's taking the right branch at 'declaredInScope' |
17:29:00 | disruptek | let's start with verifying that Tc() doesn't do a copy. |
17:29:31 | Zevv | well, we shouldn't even return, is my point |
17:29:35 | Zevv | we can just update the passed Tc |
17:29:45 | disruptek | what? |
17:30:09 | disruptek | true, but we return because the rewrite is shit. |
17:30:29 | Zevv | fair enough. But I mean: These proc's do not even have to return a continuation |
17:30:39 | disruptek | how do you figure? |
17:30:41 | Zevv | They can modify the one they got passed, update the fn |
17:30:49 | Zevv | and pass it on |
17:31:05 | Zevv | Why make a new Tc? |
17:31:08 | Zevv | you already have one |
17:31:27 | disruptek | yes, but does that hold for every continuation? |
17:31:33 | Zevv | Sure |
17:31:38 | disruptek | sure? |
17:31:42 | Zevv | As far as I can tell |
17:31:51 | Zevv | it's serial |
17:31:56 | disruptek | it doesn't hold for an immutable object type. |
17:31:58 | Zevv | there is always *one* active, and there is never any backtracking |
17:32:09 | Zevv | no, but it's a ref |
17:32:15 | Zevv | you pass the ref to the continuation |
17:32:18 | disruptek | here it is, but not everywhere. |
17:32:23 | Zevv | then make it so |
17:32:27 | Zevv | it's worth it |
17:32:32 | Zevv | Because Tc() *is* doing a copy |
17:32:33 | disruptek | how? |
17:32:48 | Zevv | Let me rewrite that rewrite |
17:33:03 | disruptek | fine, but we can just use Tc() on the other paths. |
17:33:20 | Zevv | why? |
17:33:23 | disruptek | or, more usefully, cast. |
17:33:23 | Zevv | why would you even want that? |
17:33:34 | disruptek | because then there's no copy in the after(). |
17:33:48 | Zevv | who is copying then? |
17:33:53 | disruptek | you said Tc(). |
17:33:58 | disruptek | try cpsCast. |
17:34:04 | Zevv | Well, or your 'when' is taking the wrong turn |
17:34:17 | disruptek | either way. |
17:34:26 | Zevv | and I'm wrong, Tc() is just a conversion |
17:34:27 | Zevv | it's not a copy |
17:34:32 | Zevv | so it must be the when then? |
17:34:36 | disruptek | Tc() runs on the env. so it's the `is`. |
17:34:48 | disruptek | balls. |
17:34:53 | Zevv | put some echos in there for me |
17:34:57 | Zevv | to see which one of the tree it takes |
17:35:32 | Zevv | immamakeacoffee |
17:35:33 | disruptek | omg i can't rebase. |
17:35:35 | disruptek | kk |
17:35:38 | Zevv | you can't git |
17:35:39 | Zevv | haa haa |
17:35:43 | Zevv | disruptak can't git |
17:36:01 | disruptek | i don't get it; this is my own commit. |
17:36:09 | Zevv | last commit is mine |
17:36:24 | Zevv | do 'git pull --rebase' |
17:36:28 | disruptek | i did. |
17:37:42 | disruptek | there's literally zero difference in the code, too. |
17:38:36 | Zevv | the fun |
17:38:41 | disruptek | bizarre. |
17:39:12 | disruptek | goto runs for me. |
17:39:18 | Zevv | ok cool |
17:39:26 | Zevv | so do the others in stash, afaik |
17:39:29 | disruptek | is it a test? |
17:39:37 | disruptek | ie. does it fail when it's broken? looks like no. |
17:39:52 | disruptek | it just outputs `one`. |
17:40:33 | disruptek | yeah, the rewrite is completely broken. |
17:40:41 | Zevv | no it outputs one two three two three two three |
17:40:43 | Zevv | until ever |
17:40:56 | disruptek | well, not in my branch. 😁 |
17:40:57 | Zevv | that what it does for me at commit e6be78d5e5d0383bd009201fc1ff6a6ff0bde0fe |
17:41:02 | Zevv | so you broke it after that |
17:41:05 | disruptek | yes. |
17:41:08 | disruptek | okay, lemme roll. |
17:41:20 | disruptek | okay, good. |
17:42:23 | disruptek | so `is` is not going to work. |
17:43:02 | Zevv | sure that's it |
17:43:05 | Zevv | that *is* it |
17:43:06 | Zevv | haha |
17:43:20 | disruptek | but that's a huge problem. |
17:43:39 | Zevv | are you sure it's this |
17:43:43 | Zevv | and not the declaredInScope |
17:43:57 | disruptek | i will add your echos and see. |
17:44:37 | Zevv | otoh, why would you still need that? There is only one more kind of env left |
17:44:39 | Zevv | you flattened it out |
17:45:00 | disruptek | only in this case. |
17:45:10 | Zevv | ah ok, I thought you always went flat |
17:45:24 | disruptek | no, it does what it can. |
17:45:28 | Zevv | ok |
17:46:39 | disruptek | no echos. |
17:46:52 | Zevv | well, where did you put'em |
17:47:20 | disruptek | declaredInScope is not true for this code. |
17:47:24 | Zevv | right |
17:47:28 | Zevv | so it's not the is, is it |
17:47:42 | disruptek | well, i will test that, too. |
17:48:01 | disruptek | but also, wtf. |
17:48:10 | Zevv | wtf! |
17:50:33 | disruptek | we can template it as result if it's not declared, but we need to have a way to do that which actually works. |
17:51:04 | disruptek | this is why i wanted to just put the rewrite in its own proc. |
17:51:09 | Zevv | right |
17:51:17 | disruptek | but still, wtf. |
17:51:29 | Zevv | so, do we either hack on this a bit more so it works semantically as we think it should |
17:51:37 | Zevv | or is everything going out and start from scratch already |
17:51:42 | Zevv | because I feel this is pretty close |
17:51:58 | Zevv | I can even forgive you the triple and quadriple returns |
17:52:15 | disruptek | well, that's why i want to nail the spec. |
17:52:28 | Zevv | I always nail specs by writing something that works good enough to run |
17:52:30 | Zevv | and then see if I like it |
17:52:32 | * | maier joined #nim |
17:53:56 | disruptek | one thing i can't decide if i like... cont.foo is result but cont() is typeof(cont). |
17:54:24 | Zevv | is this something that has to be set in stone at this moment? |
17:54:40 | disruptek | what else is there? |
17:54:57 | Zevv | I don't know. But in practice, how would this matter to the end user? They never see what's under the hood |
17:55:02 | Zevv | they just provide their little foo() |
17:55:19 | Oddmonger | i was sure it was possible to comment large portions of code with syntax like #ifdef / #endif |
17:55:34 | disruptek | i want you to be able to write middlware that can be built upon and doesn't need to be rewritten as we improve the impl. |
17:55:34 | Zevv | Oddmonger: you can `when false:` |
17:55:49 | Oddmonger | ahhh |
17:55:55 | Zevv | disruptek: fair enough. But I don't care if that happens for the first few iterations |
17:55:57 | disruptek | #[ is a comment block ]# |
17:56:12 | Zevv | oh yeah that's better, you don't need to indend. use that Oddmonger |
17:56:26 | * | vicfred joined #nim |
17:56:32 | disruptek | so stash is our proof-of-concept? is there anything missing from it that you want? |
17:56:37 | Zevv | disruptek: I really don't care for that now. I'd be happy to rewrite stuff as we go. I only know if I hate or love it when I work with it |
17:56:50 | Zevv | rvalues |
17:56:58 | disruptek | right, but those are easy. |
17:57:23 | Oddmonger | Zevv: of course i know comment on multiline, but `when` keep the syntax colorization |
17:57:23 | Zevv | If there is zero copy of continuations, stash is fine with me |
17:57:25 | * | maier quit (Ping timeout: 240 seconds) |
17:57:29 | disruptek | okay. |
17:57:36 | Zevv | Oddmonger: fair enough |
17:57:47 | Zevv | disruptek: tell me, did you really not know about stash/ and the working things in there? |
17:58:10 | disruptek | i saw some commits and i thought you were commiting the git stash. |
17:58:14 | Zevv | haha |
17:58:17 | Zevv | bad naming :) |
17:58:38 | disruptek | git stash is a weird thing. |
17:58:44 | Zevv | there's no coros in there yet |
18:00:06 | Zevv | but these are pretty much the same as the iterator |
18:01:06 | Zevv | if you decide to go for a rewrite, could we support cps: blocks from the start, next to the cps procs? |
18:01:14 | Zevv | semantics like in the CPC paper |
18:01:25 | Zevv | or is that nasty |
18:01:32 | disruptek | yes, but we support them, now. |
18:01:41 | disruptek | cps Cont: |
18:01:50 | Zevv | yeah but then a proc must go in |
18:01:57 | Zevv | I mean cps'ing only a part of a proc |
18:01:58 | Zevv | or does that work? |
18:02:15 | disruptek | if it doesn't work it's only because of assertions or whatever. |
18:02:21 | Zevv | oh that'd be cool |
18:02:42 | Zevv | gimme a sec, this is where I'd like to go with the async stuff (write write) |
18:02:56 | disruptek | i just don't even want that. i just want `.` and `()` to invert control-flow. |
18:04:40 | Zevv | http://ix.io/2sSS |
18:04:59 | Zevv | something along these lines |
18:05:56 | disruptek | why would you want this? |
18:06:02 | Zevv | it's cool as hell |
18:06:11 | disruptek | callback hell, you mean. |
18:06:47 | Zevv | no callbacks. It's just saying 'start a new "thread" from here' |
18:06:54 | Zevv | this is what the CPC paper does. exactly this |
18:07:59 | disruptek | i am fine with blocks but i want to be rvalues. |
18:08:46 | disruptek | like, i see no point to the second block. |
18:09:09 | Zevv | well, the second block needs a separate "thread" |
18:09:28 | Zevv | the outer 'while' should keep running to acccept new clients, and you want to spawn a new 'thread' for each client |
18:09:32 | Zevv | that's kind of the point |
18:09:49 | disruptek | right, but `spawn` is a primitive you can write. |
18:09:59 | Zevv | sure. |
18:10:08 | Zevv | just saying, I want to be able to make things like this |
18:10:13 | disruptek | yes. |
18:10:18 | Zevv | ok |
18:10:29 | disruptek | the key takeaway for me is that `cps io` is a statement. |
18:10:38 | Zevv | so, as your user #1, these are my requirements |
18:10:42 | Zevv | where do I send the sponsor money? |
18:10:59 | disruptek | let's think about how blocks work. |
18:11:26 | disruptek | can we simply say `cps:` anywhere? |
18:11:57 | disruptek | isn't that what we want? |
18:12:01 | Zevv | sure |
18:12:05 | Zevv | but you need a type |
18:12:15 | Zevv | cps C: |
18:12:23 | disruptek | why do i need a type? |
18:12:43 | Zevv | it's a block handled by the async or the iterator or the coro continuation type |
18:12:58 | Zevv | just like your procs get a cps:C |
18:13:01 | Zevv | it's no different |
18:13:16 | Zevv | Only there's no outer proc, you just get a StmtList right away |
18:13:46 | disruptek | but at line 0, it's as if there is nothing. can i not perform rewrite without a type? |
18:14:37 | Zevv | Hmm and let nim fix that. |
18:14:43 | Zevv | c.whatever(), and you don't care in your rewrite |
18:14:58 | Zevv | there just needs to be a `proc whatever(c: Cont)` somewhere |
18:14:59 | disruptek | can i not say: `let c: MyType = cps:`? my `=` can rewrite it. |
18:15:12 | Zevv | I guess so, but not yet sure |
18:15:45 | Zevv | no you need that, otherwise you don't know what to do when calling a cps primitive |
18:15:54 | Zevv | cpsMgic |
18:15:59 | Zevv | whatsitsname |
18:17:22 | disruptek | not convinced. |
18:17:29 | Zevv | me neither |
18:17:46 | disruptek | you can do a lot of logic without knowing anything about the types. |
18:17:46 | Zevv | why can't we just write this out? |
18:18:02 | Zevv | we just take these stash/ exmpales and write the Nim as it should come out in the end by hand |
18:18:17 | disruptek | maybe that's better. |
18:18:23 | Zevv | still one thing I do not see |
18:18:41 | Zevv | now, in user code, we do `cps sleep()`, right |
18:18:48 | disruptek | yeah. |
18:18:49 | Zevv | how do you want to do this in V2 |
18:19:02 | disruptek | c.sleep() |
18:19:10 | Zevv | But for the user there *is* no c |
18:19:24 | disruptek | why not? |
18:19:36 | disruptek | cps as c: c.sleep() |
18:19:37 | Zevv | look at my https://github.com/disruptek/cps/blob/master/stash/iterator.nim, line 37 |
18:19:49 | Zevv | counter has `lo` and `hi`, but there is no `c` |
18:20:02 | disruptek | yes, but we insert one, even now. |
18:20:16 | Zevv | right. But it's not there. If you go typed, it won't compile |
18:20:21 | Zevv | becasue there is no 'c' |
18:20:29 | disruptek | this is one of the reasons we didn't go typed. 😉 |
18:20:33 | Zevv | so it has to be made explicit |
18:20:38 | disruptek | but it will be made to be there. |
18:21:00 | disruptek | i don't have a problem with that for middleware. |
18:21:09 | disruptek | it's not a big ask, imo. |
18:21:10 | Zevv | not for middlewere. But for end users that can't be |
18:21:27 | disruptek | it's not, for end users. |
18:21:35 | Zevv | it is. This iterator proc is an end user proc |
18:21:50 | disruptek | then you're doing it wrong. |
18:22:07 | Zevv | no, the 'iterator' *implementation* is middleware |
18:22:12 | Zevv | this is how you *use* it |
18:22:19 | disruptek | counter? |
18:22:24 | Zevv | yes |
18:22:32 | disruptek | then you're doing it wrong. |
18:22:33 | Zevv | everythign from line 33 and down is "user" |
18:22:36 | Zevv | above is "middleware" |
18:22:49 | Zevv | ok, tell me how I should do it then |
18:22:57 | disruptek | obviously not, because you have users talking about cps. |
18:23:11 | Zevv | ok, I can introduce one tiny macro called "Iterator" |
18:23:15 | disruptek | you need a level of indirection. |
18:23:18 | Zevv | and make that proc a {.Iterator.} proc instead |
18:23:41 | disruptek | macro? just an object that holds the iterator that users can interact with. |
18:24:16 | Zevv | what's in that object? |
18:24:22 | Zevv | because there is no object. It's cps all the way down |
18:24:24 | disruptek | you have produce() which seems perfectly fine. |
18:24:45 | Zevv | produce is cpsMagic |
18:24:52 | Zevv | its in the Iterator implementation |
18:25:10 | Zevv | middleware |
18:25:14 | disruptek | it doesn't look magical to me. |
18:25:33 | Zevv | ok, then again. I have a piece of *user* code. This user code wants to do 'jield' |
18:25:44 | disruptek | that's not user code, then, is it? |
18:26:03 | Zevv | it is. 'jield' is an iterator thing, not a CPS thing |
18:26:10 | Zevv | ok, other subject. async I/O |
18:26:16 | Zevv | The user wants to do an async recv() |
18:26:19 | disruptek | okay. |
18:26:22 | Zevv | how does she call that? |
18:26:28 | Zevv | what does the call look like? |
18:26:51 | disruptek | probably has a socketish thing and does recv on it. |
18:27:07 | * | audiophile joined #nim |
18:27:19 | Zevv | ok, fair enough, so then the socketish thing is the clue to cps |
18:27:45 | Zevv | another one: the 'gotos' |
18:28:02 | Zevv | I do a 'goto' or a 'label', but there is nothing to do that "on" |
18:28:48 | disruptek | well, make a thing. |
18:28:55 | Zevv | ok, I think I can live with that |
18:29:00 | Zevv | let's go with that |
18:29:15 | Zevv | is that something we want to do in the current codebase still? |
18:29:29 | disruptek | i think there's no alternative. |
18:30:08 | * | audiofile quit (Ping timeout: 256 seconds) |
18:30:10 | disruptek | look, your recv() cannot work without an event loop, right? |
18:30:14 | * | audiophile is now known as audiofile |
18:30:16 | Zevv | sure, for recv that's true |
18:30:21 | disruptek | and you don't want cps to provide it. |
18:30:26 | disruptek | so the middle does. |
18:30:28 | Zevv | and probably for a lot of other things. But like iterators, what is the 'iterator' thingy? |
18:30:34 | disruptek | it's state. |
18:30:40 | disruptek | it is state. its state. |
18:30:47 | Zevv | ok, I'll try to see if I can make this fit in what is now here |
18:31:07 | disruptek | sleep is a better proxy for async.recv |
18:31:21 | disruptek | noop is a better proxy for yield. |
18:31:23 | Zevv | I'm afk for bit, reading time; tonights subject is gravity, this'll be fun |
18:31:31 | disruptek | gravity? |
18:31:35 | Zevv | gravity |
18:31:37 | disruptek | i mean, i've heard of it. |
18:31:58 | disruptek | have you been following this blbbt thing? |
18:32:05 | Zevv | reading something like Brysons "short history of nearly everything" for 10yos |
18:32:06 | disruptek | bhbbt, i mean. |
18:32:24 | Zevv | don't know what that is? |
18:33:39 | disruptek | the theory that there wasn't a single big bang (sbb) but that every black hole translates spacetime into an /analogous/ (not equivalent) universe as its output. |
18:39:44 | * | theelous3 quit (Ping timeout: 265 seconds) |
18:41:44 | Zevv | ah, that's just one of the many multiverse theories. I forgot the name but read a book the other day about all kind of variants on multiverses. Big fun and all, but hard to prove any of those right |
18:42:31 | disruptek | hey man, we're working on it. just need a long quantum string to dangle in a nearby sbh. |
18:47:46 | FromDiscord | <Ricky Spanish> is there an overhead for using oop in nim vs ignoring it completely? |
18:48:33 | disruptek | if you mean methods, yes. |
18:48:59 | Yardanico | but you have to remember that in other languages with methods you accept that overhead by default |
18:49:04 | Yardanico | but in nim it's optional :) |
18:49:24 | Araq | and with --gc:arc the overhead is currently terrible :-) |
18:49:30 | Yardanico | oh yeah, right |
18:49:31 | Araq | but I know how to fix it |
18:49:33 | Yardanico | yay |
18:49:35 | FromDiscord | <Ricky Spanish> yeh i guess thats why im broadly asking, im quite uh confused by nim coming from c++ but also using go im somehwat used to being forced |
18:51:03 | * | narimiran joined #nim |
18:51:04 | disruptek | ricky, are you related to susan spanish? |
18:53:38 | Zevv | ok disruptek, what can I do for you at this time? |
18:54:08 | disruptek | how is your arabic? |
18:55:44 | Araq | guys, time to say goodbye |
18:55:57 | Araq | won't be online tomorrow. don't do things I wouldn't do |
18:56:05 | disruptek | have fun, araq. |
18:56:10 | Yardanico | okay, good luck :) |
18:56:25 | Araq | thanks |
18:56:47 | Araq | and be friendlier to newcomers than I am |
18:56:53 | Araq | bbl |
18:58:11 | disruptek | "lightly pasteurized" milk is bullshit. |
18:58:15 | disruptek | so to speak. |
18:59:04 | Zevv | Araq: have a nice time! |
18:59:13 | * | Senketsu joined #nim |
18:59:27 | Zevv | Luckily we have Disruptek to make a good first impression on the newcomers |
19:00:13 | disruptek | friendlier than araq is a pretty low bar. |
19:00:21 | disruptek | not sure i can meet it. |
19:00:23 | Yardanico | Zevv: exactly /s |
19:00:47 | Zevv | I loved the nice interaction a few days. "Stranger: Hey arak, how are you doing? Arak: I don't know you." |
19:00:56 | Yardanico | hehehe |
19:02:55 | disruptek | Zevv: you know what the problem is? |
19:02:58 | disruptek | it's so obvious. |
19:03:12 | Zevv | tell me about the polka dotted elephant |
19:04:10 | disruptek | Zevv: have you been drinking? |
19:04:15 | Zevv | not today |
19:04:24 | disruptek | s/^/what/ |
19:08:09 | Zevv | what Zevv: have you been drinking |
19:10:44 | Zevv | disruptek: I'm still waiting man |
19:11:44 | disruptek | oh |
19:12:02 | FromDiscord | <haxscramper> Assigning result of macro expansion to `const` hangs compilation. If I just copy-paste generated code to `const val = <my code>` everything works as expected. If I do `let val = macroCall()` there are no problems either. What can possibly cause this? |
19:12:40 | disruptek | a bug, most likely. |
19:13:40 | disruptek | Zevv: i was thinking the `when` didn't work because of out-of-phase eval but that makes no sense. |
19:15:22 | Zevv | no that's just so silly |
19:19:14 | disruptek | `is` clause doesn't work, either. |
19:19:33 | Zevv | all these crappy tools |
19:24:21 | disruptek | compiles() works. |
19:24:28 | disruptek | but without `is`... |
19:25:14 | disruptek | how about this idea: |
19:25:43 | disruptek | we do the conversion in the trampoline. |
19:26:06 | Zevv | I've been playing with that, but I feel it adds a lot of complexity |
19:27:00 | disruptek | we already have the complexity of inheritance in v1. maybe we should use it. |
19:27:24 | Zevv | but not in the trampoline. It's just wrong |
19:27:31 | Zevv | I thought of creating an initial boostrap proc |
19:27:40 | Zevv | that does the conversion of the initial call with args into a continuation |
19:27:46 | Zevv | after that, all split procs only have continuations |
19:27:57 | disruptek | yes, i mentioned that earlier. |
19:28:01 | disruptek | but it doesn't solve this problem. |
19:28:13 | Zevv | it solves the problem of all the funny 'when's |
19:28:26 | disruptek | how? |
19:28:35 | Zevv | there's always a 'continuation' |
19:28:40 | disruptek | that's one when. |
19:28:43 | disruptek | one of two. |
19:29:10 | Zevv | We generate the procs and the envs, right? |
19:29:16 | Zevv | how can you ever call a proc with the wrong env? |
19:29:18 | disruptek | last i checked. |
19:29:29 | Zevv | so why the "is" anyway? |
19:29:35 | Zevv | you *know* it is safe to convert to that type |
19:29:38 | Zevv | there is no other way |
19:30:36 | disruptek | no. |
19:30:48 | Zevv | no, there is no other way |
19:30:51 | disruptek | because i need to be able to create a new continuation in the body and then return a different type. |
19:31:26 | * | superbia1 is now known as superbia |
19:31:44 | FromDiscord | <dom96> Araq: I was just about to review that lol |
19:32:01 | FromDiscord | <dom96> Why are you merging things on holidays anyway? 🙂 |
19:32:15 | disruptek | you're right about one thing, though. |
19:32:26 | disruptek | we /could/ create as many procs as we have subtypes. |
19:32:34 | Zevv | right |
19:32:54 | Zevv | also, asking again: Why do we even return |
19:32:59 | Zevv | throw that out |
19:33:06 | Zevv | you still didn't say why not |
19:33:19 | disruptek | why do we even return? |
19:33:23 | disruptek | as opposed to what? |
19:33:23 | Zevv | no, return a value |
19:33:33 | Zevv | why return a continuation |
19:33:41 | disruptek | because it might be of a different type. |
19:33:54 | Zevv | ok, but we want those to live in the same buffer |
19:33:55 | * | Senketsu quit (Read error: Connection reset by peer) |
19:34:08 | Zevv | converting indeed will not work in this case, but this is where you can do your casting |
19:34:25 | Zevv | remembery my earlier writup about re-inventing stack frames |
19:34:27 | disruptek | what i hear you saying is that you want me to cast. 😁 |
19:34:30 | disruptek | but why? |
19:34:38 | Zevv | ok, bear with me. |
19:34:53 | * | disruptek takes his pants off. |
19:35:14 | Zevv | In the original proc there is a few places where we would split. At these places, when running the original proc, you would have your stack frames |
19:35:30 | Zevv | these stack frames share the same stuff for outer scopes, but might differ for inner scopes. |
19:35:43 | Zevv | stacks grow, shrink back a bit, grow again a bit differently |
19:35:45 | Zevv | with me? |
19:35:50 | disruptek | sure. |
19:36:09 | Zevv | we create an object type for each of these places in the original proc that is basically the same as the stack frame would have been |
19:36:30 | disruptek | church. |
19:36:40 | Zevv | these are not mutualy-convertable |
19:36:49 | Zevv | you can convert from a smaller to a deeper, but not between to deeper |
19:36:59 | Zevv | what you can do is *cast* among them |
19:37:13 | Zevv | if you know you don't need the old "tail" but want to put stuff in for the next scope |
19:37:24 | Zevv | you cast your the continuation you received to the next one |
19:37:28 | Zevv | add the new stuff |
19:37:31 | Zevv | update the fn |
19:37:32 | Zevv | and you're set |
19:37:34 | Zevv | just 'return' |
19:37:38 | disruptek | well, yes, but at the moment we just fold all types together. |
19:37:49 | Zevv | sure, then you don't even need the cast |
19:37:54 | Zevv | you can just update the 'fn' and return |
19:38:08 | Zevv | the trampoline does not do "c = c.fn(c)", it just does "c.fn()" |
19:38:18 | Zevv | no |
19:38:22 | Zevv | damn |
19:38:28 | disruptek | c.fn(c) but no. |
19:38:33 | Zevv | right |
19:38:39 | disruptek | because it needs to return an arbitrary type in response. |
19:38:56 | Zevv | damnit |
19:38:58 | disruptek | i don't think it should be a side-effect of the impl. |
19:39:08 | Zevv | ok, that's fair enough |
19:39:09 | disruptek | you're making too great a concession here. |
19:39:24 | Zevv | but the c we return will always be the exact same c? |
19:39:26 | disruptek | right now, the type is not merely as large as the largest frame. |
19:39:35 | Zevv | it's a new ref to the same thing |
19:39:39 | disruptek | it's as large as anything ever put on the stack in any frame. |
19:40:01 | Zevv | but that will cahnge, right |
19:40:04 | disruptek | the c won't always be the same. |
19:40:23 | Zevv | why not? It's the same alloced block |
19:40:26 | disruptek | it's just a side-effect of the current optimization. |
19:40:37 | Zevv | we *want* it to use the same memory block |
19:41:00 | Zevv | shouldn't we move to a different channel by the way. |
19:41:00 | disruptek | you always want to consume all that memory? for every continuation? |
19:41:14 | Zevv | no, we're talking two differetn things dude |
19:41:14 | disruptek | nah, fuck these nerds. |
19:41:43 | Zevv | 1) we want to do one alloc for the whole continuation chain |
19:41:59 | disruptek | okay, i'm not 100% sure about that. |
19:42:10 | disruptek | first of all, zero'ing it out isn't free. |
19:42:19 | Zevv | you don't have to zero out. |
19:42:25 | Zevv | If you want you can do a low level alloc() instead of a new |
19:43:02 | disruptek | technically true, but that means we have to issue default() sets for variables in the scope. |
19:43:21 | Zevv | ok, anyway, that was assumption #1. As few allocs as possible |
19:43:23 | disruptek | it's not the worst idea, i guess. |
19:43:36 | disruptek | i mean, you've had worse ideas. that's what i'm trying to say. |
19:43:40 | * | disruptek 🤣 |
19:43:45 | Zevv | number #2 is this two ways of making envs. Either you 'unfold' every possible continuation and put it all in one object |
19:43:57 | Zevv | or we make one-per-proc with the specific stack frame at that point |
19:44:09 | Zevv | if you go for the first, stuff is easy, because *all* procs take the same type |
19:44:13 | Zevv | no casts, no conversions |
19:44:15 | Zevv | right? |
19:44:36 | Zevv | that is, all procs ensaftened from the same source proc |
19:44:57 | disruptek | yes, it's true, but it's a big concession. |
19:45:04 | Zevv | ok. It eats more mem then needed |
19:45:13 | Zevv | so: #3: we make one object per split-proc |
19:45:34 | Zevv | you receive one, use and update what you need, and on your way out cast it to the next type |
19:46:01 | Zevv | these casts are 'safe' because of the nature of these things. |
19:46:10 | Zevv | because in the flow of things, it will just look like a stack frame |
19:46:27 | Zevv | when you exit a scope, all the stuff coming after that is no longer relevant |
19:46:52 | disruptek | i see 3 numbers and at least two are the same. but let's do this: |
19:47:14 | disruptek | we'll impl it as a single alloc because that's how the rest of the code optimizes it, today. |
19:47:20 | disruptek | we can reimpl it later. |
19:47:22 | Zevv | sure |
19:48:32 | Zevv | ok, another thing to settle |
19:48:48 | Zevv | what is your feeling about these top-level templates for accessing env contents instead of rewriting the body |
19:49:04 | * | Senketsu joined #nim |
19:49:18 | Zevv | template i = env(c).i_54857395 |
19:49:25 | disruptek | they seem fine but iirc my impl is broken. |
19:49:32 | Zevv | becuase I made something neat for that: I made a template that inserts all those templates |
19:49:41 | Zevv | so you only need to call the 'injectlocals' template at the top of each proc |
19:49:45 | disruptek | i don't like the way the syntax highlight looks; it's creepy. |
19:49:58 | disruptek | but the approach makes some sense. |
19:50:15 | Zevv | ok, then one more |
19:50:18 | Zevv | when introducing a new variable |
19:50:19 | * | solitudesf joined #nim |
19:50:20 | Zevv | ino a scope |
19:50:28 | Zevv | your original code goes "var i = 42" |
19:50:45 | disruptek | yes, that has to change. |
19:50:47 | Zevv | then, in the end before going out, you need to make sure to put this new 'i' into the environment |
19:51:02 | disruptek | it will have to template it at the definition point. |
19:51:07 | Zevv | what if you from the start already instert the 'template i = env(c).i_15125' |
19:51:16 | Zevv | and rewrite 'var i =42' to 'i = 42' |
19:51:35 | disruptek | well, i only want to template it in the scope where it is defined. |
19:51:45 | Zevv | does it hurt to have it before? No one is accessing it? |
19:51:49 | Zevv | it's just a template |
19:51:52 | disruptek | i'd like `declaredInScope` to work. |
19:52:01 | Zevv | no, that's messy |
19:52:07 | Zevv | what is wrong with 'i' existing earlier |
19:52:13 | Zevv | guarenteed there is no one using it |
19:52:14 | disruptek | it could break someone's code. |
19:52:26 | disruptek | who guaranteed it? |
19:52:27 | disruptek | how? |
19:52:40 | Zevv | we know, right? |
19:52:52 | Zevv | oh, wait, there could be two scopes both using an 'i' |
19:53:03 | disruptek | my new scopes only know what they don't know, ironically. |
19:53:13 | disruptek | ie. you cannot query them for local scope. |
19:53:15 | Zevv | ok, so rewrite 'var i = 42' to 'template i = env(c).i_123123; i = 42' |
19:53:22 | * | maier joined #nim |
19:53:24 | disruptek | yes. |
19:53:26 | Zevv | cool |
19:53:52 | FromDiscord | <Varriount> disruptek: Are you re-implementing lambda lifting in a macro? |
19:53:55 | Zevv | are we just stupid or is just still pretty hard all |
19:54:11 | disruptek | i think we're just dumb. |
19:54:17 | disruptek | but, i think this approach is dumb, too. |
19:54:31 | disruptek | we've made it harder than it needs to be. probably by an order of magnitude or more. |
19:54:40 | disruptek | but that's okay. we need experience using it. |
19:54:48 | FromDiscord | <Varriount> What do you mean by "approach"? |
19:54:48 | disruptek | it's hard to use software that hasn't been written. |
19:55:01 | disruptek | this impl sucks a big donkey dick. |
19:55:07 | Zevv | Varriount: well, it's just the current implementation |
19:55:23 | Zevv | disruptek made something that kind of works but is hacky all the way |
19:55:38 | Zevv | so now we're looking to see what was learned from that approach, considering use cases and see how we can make it better |
19:55:56 | Zevv | but over the last 3 days he was too stoned to have proper conversations and went into type and lambda limbo |
19:56:00 | Zevv | luckily he's back now |
19:57:24 | disruptek | lol |
19:57:33 | disruptek | i was watching teevee. |
19:57:38 | Zevv | and playing wow. |
19:57:53 | Zevv | don't watch teevee man. just don't. |
19:57:55 | disruptek | i finally hooked it up so bentley could bark at animals /inside/ the rv. |
19:58:05 | * | maier quit (Ping timeout: 240 seconds) |
19:58:09 | Zevv | I threw mine out 20 years ago. |
19:58:23 | disruptek | i've had periods where i quit for a few years. |
19:58:45 | Zevv | I think it was one of the best decisions in my life. The time saved and spent on other things is amazing |
19:59:02 | disruptek | true, but modern telly isn't the same as it was. |
19:59:10 | FromDiscord | <Varriount> So I did some (likely naive) benchmarking for EC2 instances last night |
19:59:13 | skrylar[m] | hoi |
19:59:20 | Zevv | I'm an old fart, but somehow I'm ahead of most of the new kids on the block, still. I know I'm not much smarter, so it must be because I spent more time doing things that make me *look* smarter |
19:59:35 | skrylar[m] | my teevee hasn't had a coax connection for years :3 |
19:59:47 | FromDiscord | <Varriount> apparently the new A instances have the most processing power per $ |
20:00:53 | disruptek | now goto doesn't crash. also, it doesn't goto. |
20:01:26 | Zevv | progress |
20:03:02 | disruptek | your goto is nuts, btw. |
20:04:17 | Zevv | why |
20:04:47 | disruptek | well, it doesn't make any sense. |
20:05:02 | disruptek | you store a ref and then you return the same object. |
20:05:11 | disruptek | you should be storing the fn. |
20:05:31 | disruptek | right? |
20:05:37 | Zevv | no, the whole continuation. Fn + data |
20:05:44 | Zevv | that's what a continuation is. |
20:06:09 | disruptek | but if the continuation doesn't change, what's the point? |
20:06:16 | Zevv | there is no point |
20:06:29 | disruptek | it's a ref that you're storing. it can never go anywhere. |
20:06:54 | Zevv | ah, throw it out then, it was never ment to go in |
20:07:18 | disruptek | let's just store it by value. |
20:10:44 | disruptek | now i have to figure out git again. |
20:12:10 | disruptek | i guess you want to cherry pick that. |
20:12:29 | disruptek | or see my goats branch. |
20:14:46 | Zevv | right |
20:16:06 | FromDiscord | <Recruit_main707> when i try to compile with `--cpu:i386` i get this:↵`error: size of array 'Nim↵_and_C_compiler_disagree_on_target_architecture' is negative`↵any idea on how to fix it? |
20:16:58 | disruptek | Zevv: performance says Nim closure iterators are 2.051700488716445 times faster |
20:17:08 | disruptek | roughly. |
20:18:11 | disruptek | only about 20% slower on markAndSweep. |
20:19:25 | FromDiscord | <Yardanico> @Recruit_main707 what's your C compiler? |
20:19:38 | FromDiscord | <Yardanico> First try this |
20:19:50 | Zevv | disruptek: \o/ |
20:19:54 | FromDiscord | <Yardanico> --passC:-m32 --passL:-m32 |
20:20:06 | FromDiscord | <Yardanico> Add this after the CPU thing |
20:20:37 | Zevv | that's more like it |
20:20:58 | Zevv | and I guess that is because we split too often, still |
20:21:01 | disruptek | we are still doing extra copies, though, until the tail template goes in. |
20:21:07 | disruptek | yes, that too. |
20:21:16 | disruptek | that stuff might be optimized out, though. |
20:25:49 | disruptek | we could probably add some inline hints to generated procs, too. |
20:27:02 | Zevv | we should do experiments one day with true tail calls |
20:27:08 | Zevv | so how the C compiler handles that |
20:27:20 | Zevv | one day |
20:27:43 | FromDiscord | <Chapl> I'd like to escape the ast of the type and gen a top level statement but I just can't or the compiler just won't let me do it. <https://hastebin.com/areqolexex.cs> <https://hastebin.com/oqukonocex.php> |
20:28:44 | disruptek | you can't go "up". |
20:28:55 | FromDiscord | <Chapl> ffs |
20:29:14 | disruptek | it wouldn't make any sense, compositionally. |
20:29:20 | disruptek | what are you trying to do? |
20:29:31 | FromDiscord | <Chapl> Do I really have to declare a `static:` block in order to populate the according builder functions? |
20:29:35 | disruptek | if, "merely find the edge of the envelope", well, you found it. |
20:29:40 | FromDiscord | <Chapl> (edit) 'Do I really have to declare a `static:` block in order to ... populate' => 'Do I really have to declare a `static:` block in order toscan the type for the pragmas and' |
20:30:11 | disruptek | you can put your type under some other macro, right? |
20:30:17 | disruptek | then simply edit it and return it. boom. |
20:30:19 | FromDiscord | <Chapl> wdym |
20:30:21 | disruptek | you're at top-level. |
20:30:37 | disruptek | buildsomething: type Config = ... |
20:30:51 | FromDiscord | <Chapl> that's what I'd like to avoid because this looks like real crap. |
20:31:20 | disruptek | well, nim is software for solving problems. if you tell us what the problem is, maybe we can help. |
20:31:36 | disruptek | i see a lot of boilerplate. nim isn't great at writing lots of verbosity. |
20:31:43 | disruptek | if you are looking for that, try java or c#. |
20:32:50 | FromDiscord | <lqdev> @Chapl you can always call the macro afterwards as a regular statement `builder(MyType)` and use getTypeImpl on the sym you get |
20:33:00 | FromDiscord | <lqdev> just keep in mind the param to the macro must be `typed` in that case |
20:33:11 | disruptek | well, it would be, already. |
20:33:42 | * | audiophile joined #nim |
20:34:54 | FromDiscord | <Yardanico> @lqdev I think for some reason Chapl doesn't want to call it explicitly at all |
20:35:04 | FromDiscord | <Chapl> 100 points to Yardanico |
20:35:15 | FromDiscord | <Chapl> Sorry, a bigillion points |
20:35:18 | FromDiscord | <Yardanico> But I think it's weird really |
20:35:20 | disruptek | well, he lost me at .toggle. |
20:35:31 | FromDiscord | <Yardanico> And not really possible since you can't go up, you're in a type block |
20:35:41 | disruptek | chapl: don't i remember you from my stream? |
20:35:48 | FromDiscord | <Yardanico> You can't just insert a proc there |
20:36:01 | disruptek | well, technically, you can. |
20:36:08 | disruptek | but never mind. 😉 |
20:36:24 | FromDiscord | <Yardanico> Well you can but it wouldn't committee |
20:36:27 | FromDiscord | <Yardanico> Compile* |
20:36:30 | * | audiofile quit (Ping timeout: 256 seconds) |
20:36:38 | * | audiophile is now known as audiofile |
20:36:40 | FromDiscord | <Chapl> sent a long message, see http://ix.io/2sTL |
20:37:43 | * | narimiran quit (Ping timeout: 246 seconds) |
20:38:14 | disruptek | if you have questions about what you've read in the manual, this is a good place to ask. |
20:38:20 | FromDiscord | <Yardanico> Well as we said, you can do that if you call the macro after the type. You could even just call it without any arguments (and store the fields in a compile time seq) |
20:38:44 | FromDiscord | <Yardanico> For your builder funcs |
20:38:45 | disruptek | or pass the type section as an argument, as i suggested. |
20:38:51 | FromDiscord | <Yardanico> Yeah |
20:39:15 | disruptek | or put a macro on the object definition. |
20:39:25 | disruptek | your macro is on the symbol. |
20:39:30 | FromDiscord | <Yardanico> Also there's really not a lot of ways to *document* macros |
20:39:42 | FromDiscord | <Chapl> Just tell me: I can't avoid `static: <br> composeBuilderFunctions(Configuration)` and call it at top level |
20:39:45 | FromDiscord | <Yardanico> The macro module tells you the AST representation for most types of symbols |
20:39:49 | FromDiscord | <Chapl> (edit) 'and call' => 'orcall' |
20:39:51 | disruptek | of course you can. |
20:40:13 | disruptek | types are always compile-time. |
20:40:29 | FromDiscord | <Yardanico> You don't need static |
20:40:34 | disruptek | type goatse = object {.buildme.} ... |
20:40:38 | FromDiscord | <Yardanico> But you need to somehow call your macro somewhere |
20:40:52 | FromDiscord | <Yardanico> Because you can't insert funcs right in the type definition |
20:40:57 | FromDiscord | <Chapl> https://media.discordapp.net/attachments/371759389889003532/739221149053091860/unknown.png |
20:40:59 | FromDiscord | <Yardanico> If wouldn't make sense |
20:41:47 | FromDiscord | <Chapl> > Because you can't insert funcs right in the type definition↵I do not want to declare funcs or procs in a type's space. I'd like to gen the ast for the funcs/procs in top level. |
20:41:47 | FromDiscord | <Yardanico> So you need some other place to insert the funcs in |
20:42:05 | FromDiscord | <Yardanico> Yes, but you can't "go up" really as Disruptek said |
20:42:23 | FromDiscord | <Yardanico> You can't go to the module AST level from the object field, no AST does that |
20:42:29 | FromDiscord | <Yardanico> AST is not circular |
20:42:36 | * | Guest37688 is now known as dadada |
20:43:10 | FromDiscord | <Chapl> Please please please walk me through how to implement the idea I have because I'm starting to lose it all |
20:43:28 | disruptek | AIIIEEEE! |
20:44:05 | disruptek | did you ever see this movie? |
20:44:20 | FromDiscord | <Chapl> I wouldn't assume that AIIIEEEE is a movie at all. |
20:44:33 | FromDiscord | <Chapl> I wouldn't even assume that AIIIEEEE is a movie * |
20:44:40 | disruptek | WHEN ANIMALS ATTACK! |
20:44:49 | FromDiscord | <Yardanico> Keep all your fields annotated just like now, but either put the type block under the macro call like mymacro: \newline type ...↵or after the block call your macro as mymacro(mytype), again, no need for the static block |
20:44:56 | FromDiscord | <Yardanico> Anyways sorry, I'm going to sleep now |
20:44:57 | FromDiscord | <Chapl> Because this looked like you were smashing your head on the keyboard and swiped it forth and back pressing random keys |
20:46:29 | disruptek | my advice is not to practice. |
20:46:33 | disruptek | do, or do not. |
20:47:39 | disruptek | if you need some examples of what not to do, check my repos. i think i've published something like 130k loc. |
20:48:08 | FromDiscord | <Chapl> sent a long message, see http://ix.io/2sTO |
20:48:37 | disruptek | i have no idea what that means. |
20:48:52 | FromDiscord | <Chapl> You don't. |
20:48:57 | FromDiscord | <Chapl> Have to understand |
20:49:34 | disruptek | i know how to answer this part: "Am I right?" |
20:49:39 | disruptek | the answer is, "Nope." |
20:49:55 | FromDiscord | <Varriount> Chapl: Can you post a link to an example of what you're trying to achieve? |
20:50:21 | FromDiscord | <Chapl> I tried to explain it like three times. I won't. Simple version: Java's Lombok but with Nim Macros. |
20:50:43 | disruptek | ah, see. |
20:50:46 | FromDiscord | <Varriount> Yes, but often it's much easier to understand an example, rather than a description. |
20:50:52 | disruptek | lombok is a boilerplate generator for java. |
20:51:14 | FromDiscord | <Chapl> There's not much to it to explain. Look up Java Lombok and you'll understand in an instant. |
20:52:17 | FromDiscord | <Chapl> I agree with Araq that builders are not necessarily needed because you can do the `with:` thingy or just assign the fields. BUT, I'd like to get to know Nim's "killer feature" |
20:53:04 | FromDiscord | <Chapl> And I figured this would be good way to practice the macro ast gen |
20:53:07 | disruptek | well, you're not exactly impressing us with your open mind. |
20:53:08 | FromDiscord | <Varriount> So, generating procedures from a pragma in a type definition isn't possible, but generating procedures from a pragma in a procedure is |
20:53:24 | FromDiscord | <Chapl> > your open mind.↵please elaborate |
20:53:26 | disruptek | that's not true, either. |
20:53:38 | disruptek | it's certainly possible to generate procs from a pragma in a typedef. |
20:54:08 | disruptek | if you want to be sure that you cannot use the type unless it is processed, then that's certainly as option as well. |
20:54:20 | disruptek | but, there is a reason these things work the way they do. |
20:54:23 | FromDiscord | <Chapl> > well, you're not exactly impressing us with your open mind.↵wdym. I'd like to know |
20:54:29 | FromDiscord | <Varriount> disruptek: You could be a bit less inflammatory. |
20:54:43 | disruptek | you might not understand the rationale behind the reasoning, but that doesn't mean it doesn't exist. |
20:54:58 | disruptek | it's worth making an investment to understand the perspective that brought about these designs. |
20:55:03 | FromDiscord | <Varriount> disruptek: How? A function implementation cannot be present in a type definition |
20:55:13 | disruptek | it would help you to better leverage the technology if you could concede its origin story. |
20:55:29 | disruptek | varriount: it certainly can. |
20:55:32 | disruptek | but also, who cares? |
20:56:01 | disruptek | express the problem, then express the solution in nim. |
20:56:58 | disruptek | there are problems in java which just don't exist in nim, and the converse is true, of course. |
20:57:34 | disruptek | i don't bring problems from other languages to my problem-solving language, i bring solutions. |
20:57:55 | disruptek | i love the way concurrency works in javascript, but i don't want to replicate the js ecosystem in nim. |
20:58:12 | FromDiscord | <Rika> i think what disruptek is essentially saying is that this idea isnt a good practice idea for nim macros |
20:58:12 | disruptek | i love the elegance of python but i don't want to replicate the performance in nim. |
20:58:57 | disruptek | i love the power of c but i don't want to replicate its macros or oop system. |
21:00:25 | FromDiscord | <Varriount> disruptek: How would you generate a function implementation in a type definition? |
21:01:06 | disruptek | untyped ast doesn't need to compile. |
21:02:04 | FromDiscord | <Varriount> But that would require passing the entire type block into a macro. I was talking about using a pragma in a standard type definition block. |
21:02:25 | disruptek | nnkIdentDef? |
21:02:33 | disruptek | it cannot be done. |
21:02:54 | FromDiscord | <Varriount> Which is what I said |
21:02:56 | disruptek | well, except as a lambda, maybe. |
21:03:12 | FromDiscord | <Chapl> > i think what disruptek is essentially saying is that this idea isnt a good practice idea for nim macros↵I'm not trying to bring this builder pattern nor the idea into Nim. I was saying that I figured it being a good way to practice Nim macros. |
21:03:17 | disruptek | but it doesn't need to compile. |
21:03:54 | disruptek | what have you written in nim thus far? |
21:04:25 | * | oriba joined #nim |
21:04:37 | FromDiscord | <Chapl> Who're you talking to? Me? |
21:04:42 | disruptek | yes. |
21:04:51 | disruptek | i don't care what these other bozos have written. |
21:05:06 | disruptek | especially rika. |
21:05:08 | FromDiscord | <Chapl> Nothing production- or library-wise. |
21:05:15 | disruptek | but what? |
21:06:04 | FromDiscord | <Rika> lol |
21:06:09 | FromDiscord | <Chapl> Nothing, I've been playing with Nim here and there. I found myself after some good long time installing Nim in my WSL installation and thought about playing with it. |
21:06:12 | * | maier joined #nim |
21:06:41 | disruptek | my advice is to tackle macros last. |
21:07:01 | FromDiscord | <Varriount> sent a code paste, see https://play.nim-lang.org/#ix=2sTU |
21:07:45 | * | nikita` quit (Quit: leaving) |
21:08:06 | disruptek | i dunno, but is this really the best we can do with discord pastes? |
21:08:09 | disruptek | because it sucks. |
21:08:57 | FromDiscord | <Varriount> Here: https://gist.github.com/Varriount/583a12051d9c0cfe9fdc64d3466a082c |
21:09:02 | FromDiscord | <Yardanico> Tell IRC people to define special types of messages for code psstes :) |
21:09:16 | disruptek | just fucking put it in a command block. |
21:09:32 | disruptek | s/command/comment/ |
21:09:46 | disruptek | varriount: i have no idea how that would work. |
21:09:56 | disruptek | i would use a pragma on the typedef. |
21:10:24 | * | sagax quit (Quit: Konversation terminated!) |
21:10:40 | * | sagax joined #nim |
21:10:40 | * | sagax quit (Read error: Connection reset by peer) |
21:11:24 | disruptek | chapl: find something (else) that annoys you and fix it with nim. the smallest thing you can think of. success will embolden you to achieve greater things. |
21:11:30 | * | maier quit (Ping timeout: 265 seconds) |
21:11:49 | FromDiscord | <Varriount> By "typedef", do you mean inside the definition of "TwoType"? |
21:11:51 | disruptek | also, pay no attention to me. |
21:12:47 | disruptek | yes, on the type itself. |
21:14:02 | FromDiscord | <haxscramper> How can I use `getTypeImpl` for `ref` objects? I.e. I have `A = ref object` and when I use `getTypeImpl` I'm stuck with `nnkSym` node and cannot get the actual definition AST. |
21:14:47 | FromDiscord | <Varriount> disruptek: Like this? https://gist.github.com/Varriount/4d4358d352c2a26bd0f6ba3ae25cbab1 |
21:15:16 | disruptek | sure, but why is it on two lines, weirdo? |
21:16:10 | FromDiscord | <Varriount> How would the macro emit the function definition though? As far as I know, the compiler won't accept a function definition AST in a type definition block AST |
21:16:10 | disruptek | anyway, the point is that you can't process this stuff except from above. and why would you want to? |
21:16:36 | disruptek | of course, but as it is untyped, it can be composed from below if you're a sadist. |
21:18:14 | FromDiscord | <Varriount> Where does 'untyped' come into play? I'm aware that a macro's parameters can be untyped, but it's output has to be a "correct" AST if it's emitting code at the module-level (not inside another macro). |
21:18:43 | disruptek | i just told you. |
21:19:42 | FromDiscord | <haxscramper> Just save AST via `toStrLit()` to separate file, copy all project to separate directory, launch another compiler process via `staticExec`, compile code and then kill original compiler process. Now you can emit anything from any position in AST. |
21:21:10 | FromDiscord | <Varriount> disruptek: You may have told me, but I'm telling you that I don't understand your explanation, so could you please be a bit more descriptive. |
21:21:51 | disruptek | the macro would emit the function definition by teasing it from the type section. |
21:21:51 | Zevv | how do I iterate over object members again? |
21:21:54 | Zevv | fieldnames? |
21:21:57 | disruptek | fieldpairs |
21:22:01 | Zevv | right |
21:22:28 | Zevv | could I also iterate over fields of a Type instead of a value? |
21:22:36 | disruptek | i will permit it. |
21:22:40 | Zevv | thank you |
21:23:26 | disruptek | are you going to do the tail templates? |
21:23:27 | FromDiscord | <Elegant Beef> Where would we be without your permission disruptek |
21:23:31 | Zevv | no the head templates |
21:23:52 | disruptek | we already have those, no? |
21:23:52 | Zevv | I'm making a complete mock manual transferred proc |
21:23:52 | Zevv | to discuss |
21:23:52 | Zevv | I want to automate more |
21:23:53 | Zevv | less clutter |
21:23:55 | disruptek | okay. |
21:24:15 | Zevv | but I want to iterate over *type* fields |
21:24:36 | disruptek | i just want to warn you that the type may not be finalized when you do this. |
21:24:45 | disruptek | just consider that possibility. |
21:25:47 | Zevv | we will go *so* *very* typed on this |
21:26:27 | disruptek | well, you can try. |
21:30:30 | * | NimBot joined #nim |
21:30:31 | Zevv | dude this is cumbersome and tedious |
21:30:34 | * | solitudesf quit (Ping timeout: 246 seconds) |
21:30:36 | Zevv | doing all that transform stuff by hand |
21:30:48 | disruptek | oh yeah? |
21:30:59 | disruptek | in two weeks we get to start over. |
21:31:32 | disruptek | without macros. 😈 |
21:38:34 | Zevv | tell me |
21:38:36 | Zevv | I have a ref object T |
21:38:42 | Zevv | sizeof(T) is now the size of the ref |
21:38:47 | Zevv | how do I get the size of the T |
21:38:52 | Zevv | sizeof(T[]) is not valid |
21:40:13 | disruptek | that would be a cool idea. |
21:40:22 | Zevv | I need that |
21:40:24 | Zevv | and I need it now |
21:40:35 | disruptek | you have to getType and unwrap the ref() around it. |
21:41:20 | Zevv | I'm not in a macro |
21:41:24 | Zevv | anyway, nevermind |
21:41:49 | Zevv | I have now this |
21:41:50 | Zevv | http://ix.io/2sU0/nim |
21:41:51 | disruptek | oh, then you're fucked. |
21:42:08 | Zevv | it creates an Env type for each split proc |
21:42:14 | Zevv | and these use the stack frame philosophy |
21:42:28 | Zevv | so note that in Env_foo_6 and onwards, 'j' changed into a string |
21:42:33 | disruptek | but... |
21:42:37 | Zevv | no buts |
21:42:48 | disruptek | this is what we started with. |
21:42:48 | Zevv | ok, *tiny* buts |
21:43:00 | Zevv | I know I know |
21:43:07 | Zevv | but it's a bit bigger |
21:43:15 | Zevv | and now I want to know what we want to change |
21:43:17 | Zevv | this is the starting point |
21:43:45 | disruptek | well, if you may the env produce unique types, you will find that it outputs them. |
21:44:15 | disruptek | it only outputs one right now because of isWritten(): bool. |
21:44:20 | Zevv | ok |
21:44:29 | Zevv | but looking at that snippet. What do we want to change about this |
21:44:51 | disruptek | i would change two things that will make it more useful to us: |
21:45:00 | Zevv | note that it's not quite what we started with |
21:45:14 | disruptek | make sleep return nil, and make it take a constant argument. |
21:45:32 | disruptek | then impl noop(c: C): C = c |
21:45:52 | disruptek | it's useful to have a way to test the scope. |
21:46:00 | Zevv | ok |
21:46:26 | Zevv | but the transformation |
21:46:27 | disruptek | what's nice about inheritance is that we can make assumptions about the location of values in scope. |
21:46:41 | Zevv | what's nice about this is that we reuse space |
21:46:51 | disruptek | if you want to move forward with your stack accretion concept, that's a nice assumption to be able to make. |
21:48:40 | Zevv | this can be inherited as well I guess, but then it will be a real trie structure |
21:48:45 | Zevv | let me rework this |
21:48:57 | disruptek | well, that cast doesn't work, for example. |
21:49:08 | Zevv | which cast |
21:49:13 | Zevv | all of them? |
21:49:42 | disruptek | yes? |
21:49:48 | Zevv | why |
21:49:58 | Zevv | this works |
21:50:05 | disruptek | you don't know the position of the var unless you add every var to every type, right? |
21:50:20 | Zevv | not if you inherit, it boils down to the same stuff |
21:50:22 | Zevv | ow wait packing |
21:50:29 | disruptek | if you inherit, it's fine. |
21:50:33 | disruptek | not elsewise. |
21:50:37 | Zevv | now it's fine |
21:50:51 | Zevv | vars from outer scopes go in top, and are always at the same place |
21:50:56 | Zevv | oredering matters |
21:51:05 | Zevv | but could also be inherited i guess |
21:51:14 | disruptek | and it is. 😁 |
21:52:02 | Zevv | ok, works as well |
21:52:20 | Zevv | http://ix.io/2sU2/nim |
21:52:32 | Zevv | and it's cleaner to read, you can see what comes in new where |
21:53:56 | Zevv | but it's harder to lift like this |
21:53:58 | Zevv | bro do you even |
21:55:43 | disruptek | now you can stop casting. |
21:56:15 | Zevv | nope |
21:56:15 | disruptek | i really have my doubts that lifting is even a thing. |
21:56:39 | Zevv | still need to cast. Can't convert from 5 to 6 |
21:56:45 | Zevv | 'j' gets a new type |
21:57:20 | disruptek | so how would your cast work? |
21:57:30 | Zevv | the old 'j' from 5 falls out of scope |
21:57:32 | Zevv | that was an int |
21:57:36 | Zevv | then we go to scope 6 |
21:57:41 | Zevv | there happens to be a new variable |
21:57:44 | Zevv | also accidentally called j |
21:57:46 | Zevv | but now it is a string |
21:57:51 | Zevv | 5 contunues to 6 |
21:57:59 | Zevv | int j can go out |
21:58:00 | Zevv | but now string j comes in |
21:58:10 | Zevv | contnuation needs to go from type 5 to type 6 |
21:58:28 | Zevv | you can't convert horizontally over a tree of inherited types, only vertically |
21:58:41 | disruptek | yes, but if it's gensym'd, it doesn't need a cast. |
21:58:49 | disruptek | it already has a unique name and type. |
21:59:08 | Zevv | no, it's about the layout of the underlying C struct. |
21:59:13 | Zevv | It goes from 'int int int' to 'int int string' |
21:59:19 | Zevv | that's not convertible |
22:00:09 | disruptek | the code we have today goes `int int int string`, right? |
22:00:15 | Zevv | right |
22:00:15 | disruptek | so what's the problem? |
22:00:23 | Zevv | of the code we have today? |
22:00:35 | Zevv | the extra storage, that's all |
22:00:44 | Zevv | if that is no problem, stuff is simpler |
22:01:05 | Zevv | and I'm making things more complicated then needed |
22:01:16 | Zevv | I don't know either. This is where we friggin started! |
22:01:22 | disruptek | well, you told me you wanted one alloc. 🤣 |
22:01:31 | Zevv | yes but this ix example is 1 alloc! |
22:01:38 | Zevv | this is as optimal as it can get |
22:01:45 | Zevv | it is 1 alloc, as small as possible |
22:02:10 | disruptek | sure, but... |
22:02:35 | Zevv | this is like as if we put the stack on the heap |
22:02:53 | disruptek | the impression i got is that you wanted all calls to operate on the same type. |
22:02:55 | disruptek | ideally. |
22:03:16 | disruptek | whatfer alloc frag reasons or something. |
22:03:34 | Zevv | well, they do now, basicaly. Excepty for the casting to get stuff out :) |
22:03:43 | Zevv | but this is literally what I just say: The stack is now on the heap |
22:03:54 | Zevv | it grows, it shrinks. We just moved that to the heap. |
22:04:02 | disruptek | the original impl worked like this 2sU2 i'm looking at. |
22:04:12 | Zevv | yeah |
22:04:26 | Zevv | but it alloced a new frame for each call |
22:04:30 | Zevv | that was baaad mkah |
22:04:38 | disruptek | sure. |
22:04:52 | Zevv | this has 1 alloc. It's just a blob of memory. It adds variables as the come into scope, drops them if they move out |
22:04:58 | Zevv | but it's all the same block. It is a *stack* |
22:06:01 | Zevv | the whole point: if you want have multiple threads of something, you need each one to have it's own stack. And after two feeks of fiddling, what I just wrote is just that |
22:06:08 | Zevv | is this good or is this bad or a friggin waste of time?! |
22:06:12 | Zevv | I don't know |
22:06:15 | Zevv | reinventing wheels |
22:06:57 | disruptek | well, it seems self-evident that it's both correct and minimal. |
22:07:09 | Zevv | that's quite a relief :) |
22:07:27 | disruptek | but i personally don't care for the concession to memory usage. |
22:07:44 | Zevv | ok, fair enough |
22:07:51 | Zevv | so for sake of simplicity, all the envs drop into 1 |
22:07:54 | disruptek | ie. just because it's as good as it was doesn't excite me. |
22:08:07 | disruptek | technically, it could be better. |
22:08:10 | Zevv | ok |
22:08:21 | disruptek | ie. we can drop from the stack that which we no longer need. |
22:08:55 | FromDiscord | <Elegant Beef> @treeform in fidget is there a way to get non character inputs from the keyboard? |
22:09:18 | FromDiscord | <Elegant Beef> arrows/return and the like |
22:10:53 | Zevv | disruptek: so we get http://ix.io/2sUa/nim |
22:11:10 | disruptek | Zevv: it's not simplicity that governs our current design now, it's the whens. |
22:11:12 | Zevv | oh wait |
22:11:46 | disruptek | i mean, i'm not bothering to run this stuff. am i supposed to? |
22:11:49 | Zevv | http://ix.io/2sUb/nim |
22:11:59 | disruptek | it's okay if it doesn't work. |
22:12:05 | Zevv | we get this. All envs in one big blob |
22:12:08 | Zevv | no casts, not magic |
22:12:40 | Zevv | so can we make this from what we have now |
22:12:44 | Zevv | drop all the funny when stuff |
22:12:55 | Zevv | clean up, maybe get the octuple returns out |
22:14:46 | disruptek | the when stuff is gone, right? |
22:14:52 | Zevv | right |
22:15:08 | disruptek | so you just don't want double returns? |
22:15:25 | disruptek | and rm var/let sections. |
22:15:39 | Zevv | the double returns is just whining of course |
22:15:50 | Zevv | but what you have is pretty close to this stuff I just dumped |
22:15:51 | disruptek | i don't want them, either. |
22:15:54 | Zevv | so why throw it all out |
22:16:13 | disruptek | they are an artifact. i'm not trying to throw stuff away. |
22:16:39 | disruptek | i do want free goto, though. |
22:16:39 | Zevv | no I mean, why start from scratch, if what you have now is pretty close to what seems to be obviously correct and minimal |
22:16:55 | Zevv | the problem was mostly in the allocs |
22:17:02 | disruptek | it doesn't have to be from scratch. |
22:17:07 | Zevv | right |
22:17:43 | Zevv | I know you want to get rid of the env implementation |
22:18:04 | disruptek | here's a question. |
22:18:26 | disruptek | does adding a name to the current scope create a new scope holding that name, or does it change the existing scope? |
22:19:02 | Zevv | it grows the scope, because all the other stuff that were in the previous scope are also in the new scope |
22:19:29 | Zevv | so it grows the existing scope |
22:20:22 | disruptek | okay. |
22:21:12 | Zevv | but all this practical stuff - it is far from the philosophical musings you had the last few days |
22:21:12 | disruptek | so the reason i want to change the env impl is that i get clash handling "for free" as a side-effect of the semantics of scope-based, uh, scope tracking. |
22:21:41 | disruptek | well, i still want my simpler compositions and syntax. |
22:21:50 | Zevv | sure |
22:21:54 | Zevv | but that doesn't bite |
22:21:58 | disruptek | what? |
22:22:02 | Zevv | (Btw, https://github.com/disruptek/cps/blob/master/talk-talk/manual2.nim is the ix, just checked it in) |
22:22:12 | disruptek | okay. |
22:22:25 | Zevv | you need to make some diner right |
22:22:30 | disruptek | lol |
22:22:39 | Zevv | i need some sleep |
22:22:46 | disruptek | sleep tight, zevv. |
22:22:54 | Zevv | same dude, laters! |
22:41:26 | * | vicfred quit (Quit: Leaving) |
22:51:37 | * | leorize quit (Remote host closed the connection) |
22:52:08 | * | leorize joined #nim |
23:03:09 | FromGitter | <gogolxdong> Any project |
23:05:41 | FromGitter | <gogolxdong> Does anyone know any well-known project written in Nim? |
23:07:05 | * | maier joined #nim |
23:07:42 | FromGitter | <gogolxdong> https://github.com/nim-lang/Nim/wiki/Companies-using-Nim Is this enough? |
23:11:45 | * | maier quit (Ping timeout: 240 seconds) |
23:12:18 | leorize | the Nim compiler is a well-known one :P |
23:12:39 | leorize | there's also nimbus, the etherium 2 implementation |
23:12:59 | leorize | also nitter, a privacy frontend for twitter |
23:17:25 | * | dadada quit (Ping timeout: 240 seconds) |
23:19:30 | * | dadada joined #nim |
23:19:37 | disruptek | shallow people are impressed by vim cubed. |
23:19:46 | disruptek | thousands of 'em. |
23:19:53 | * | dadada is now known as Guest9637 |
23:21:21 | * | vicfred joined #nim |
23:21:25 | * | Senketsu quit (Read error: Connection reset by peer) |
23:24:37 | shashlick | Nim is probably a secret weapon for some companies, who knows |
23:25:23 | federico3 | that list is so sad :( |
23:25:40 | disruptek | there's no accounting for taste. |
23:26:17 | disruptek | it's probably because our community is so toxic to new folks. |
23:27:11 | FromDiscord | <Ricky Spanish> yep that list is way shorter than deserved, community size on discord too to be fair, iv only been using a few days but iv found it atleast as useable and useful as vlang, golang and rust with the exception being the number of learning materials isnt as great as rust....i disagree about the community...i actually liked the people i spoke to here... |
23:27:40 | disruptek | i'm just teasing varriount. |
23:28:11 | FromDiscord | <Ricky Spanish> ah my bad just jumped in at the end 😆 |
23:28:36 | disruptek | i mean, it's a good report and it's nice to hear. |
23:33:55 | disruptek | for some people, a rusty tool doesn't matter. |
23:33:59 | disruptek | for the rest of us, there's nim. |
23:34:49 | * | Guest9637 is now known as dadada |
23:39:51 | FromDiscord | <Ricky Spanish> sent a long message, see http://ix.io/2sUq |
23:40:35 | FromDiscord | <Ricky Spanish> when i re-found nim...it was very clear it was for systems |
23:41:29 | FromDiscord | <Varriount> disruptek: Now that I think about it, is there any technical reason a macro couldn't be able to modify the AST tree *ahead* of its call site? |
23:42:24 | FromDiscord | <Varriount> It can't modify already processed nodes, beecause they're... already processed, but nodes "ahead" of it haven't been processed yet. |
23:42:52 | FromDiscord | <Varriount> *ahead of it and it's parents |
23:51:37 | FromDiscord | <Elegant Beef> @Ricky Spanish Yea i've actually had to point out that nim isnt an intepreted language a few times when i evangalized it 😄 |
23:54:40 | FromDiscord | <Varriount> Also, people seem to think that GC == slow (which is probably why Go calls references "pointers", to throw people off the scent) |
23:55:19 | FromGitter | <binhonglee> Hi all, I have a question about compiling a macos binary from linux |
23:55:49 | FromDiscord | <Elegant Beef> I mean varriount i recently spoke to someone that said "ARC is always slower than GC" |
23:55:55 | FromDiscord | <Elegant Beef> So im super confused why nim's ARCis so fast |
23:56:00 | FromDiscord | <Elegant Beef> (edit) 'ARCis' => 'ARC is' |
23:56:12 | FromDiscord | <Varriount> It depends on what you mean by "fast" |
23:56:40 | FromDiscord | <Elegant Beef> Well the benchmarks that were shown off at nimconf seems to indicate it's vastly faster than the GC options |
23:56:46 | FromDiscord | <Elegant Beef> In those cases |
23:56:53 | FromDiscord | <Ricky Spanish> well im a little guilty on the gc front tbh, but atleast nim has the option to disable it giving me the option for each project so having the option to learn a language and trusting me to decide whats right as i need seems revolutionary to me |
23:56:56 | FromDiscord | <Varriount> The garbage collectors that Java and C# tend to use are "fast" in that they allow allocating memory very quickly |
23:57:08 | FromGitter | <binhonglee> I have a file that only have 1 line : `import httpClient` ⏎ ⏎ and compiling it like this: ⏎ `nim c --os:macosx -d:emscripten -d:ssl --cpu:amd64 -t:-m64 -l:-m64 x.nim` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5f26015403d73b60ee5e7ead] |
23:58:10 | * | krux02_ joined #nim |
23:58:37 | FromDiscord | <Varriount> This might yield some answers. Looks like a missing library or header path? https://stackoverflow.com/questions/58741942/event-h-no-such-file-or-directory-even-when-libevent-dev-is-installed |
23:59:33 | FromDiscord | <Varriount> @binhonglee What OS are you using? |
23:59:36 | * | oriba quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |