00:00:17 | FromDiscord | <ElegantBeef> Something similar with nico/nimscripter would be awesome |
00:00:22 | FromDiscord | <ElegantBeef> Sorta pico-8 like |
00:00:45 | FromDiscord | <ElegantBeef> Or insert your favourite game framework + nimscripter 😛 |
00:01:01 | FromDiscord | <nikki> haha indeed! |
00:01:18 | FromDiscord | <ElegantBeef> Stuff like that is awesome as it reduces the barrier to entry, so people can both checkout nim in a repl like situation and see how others do it |
00:01:39 | FromDiscord | <nikki> yeah totally' also if you can place objects visually and then incrementally add code |
00:02:02 | FromDiscord | <nikki> the main thing is to show people "hey u can make stuff!" once they feel that they just keep going |
00:02:57 | FromDiscord | <ElegantBeef> @rayman22201 i see you just starred my repo and i have to say you're encroaching on Zach's pfp, atleast one bird on a shoulder 😛 |
00:03:29 | rayman22201 | shhhh, I only lurk these days :-P |
00:04:00 | * | stefantalpalaru joined #nim |
00:04:05 | FromDiscord | <ElegantBeef> Hey lurking's not cool |
00:04:25 | FromDiscord | <ElegantBeef> Atleast i've got introuble doing it outside people's windows |
00:05:24 | rayman22201 | lol. As long as you follow the restraining order it's all good. 50 feet / 15 meters ;-) |
00:05:50 | FromDiscord | <ElegantBeef> You seem to be an expert in lurking |
00:05:57 | rayman22201 | I take all my legal advice from disruptek so you know It's foolproof |
00:06:13 | FromDiscord | <ElegantBeef> Well it involves fool, dont remember if it's foolproof though |
00:07:10 | * | stefantalpalaru quit (Changing host) |
00:07:10 | * | stefantalpalaru joined #nim |
00:21:53 | * | Tanger joined #nim |
00:30:33 | * | Mortir joined #nim |
00:51:17 | * | D_ quit (Quit: 💨) |
00:52:05 | * | D_ joined #nim |
00:52:23 | * | Axiomatic quit (Remote host closed the connection) |
01:13:03 | * | Axiomatic joined #nim |
01:24:46 | * | Mortir quit (Quit: leaving) |
01:34:18 | jonjitsu[m] | Are concepts the substitution for interfaces in other languages? I'm trying to figure out how I would pass an object to a proc without specifying a concrete type. I just need it to be able to respond to a certain method. |
01:35:07 | jonjitsu[m] | I guess I could use inheritance with methods... |
01:35:08 | mipri | defining thing-i-can-thismethod-against is a use of concepts yeah |
01:35:48 | jonjitsu[m] | are concepts going to become official soon? |
01:36:06 | mipri | well they're in the language and they're documented and they work by default without a feature flag |
01:37:16 | mipri | do you mean: when are people not going to say that there are some bugs still with them, or when is stdlib going to be written to make extensive use of them? |
01:37:52 | * | Axiomatic quit (Remote host closed the connection) |
01:39:03 | jonjitsu[m] | I saw them on the experimental page and thought they were still a WIP. |
01:40:08 | mipri | ah, since an {.experimental.} isn't required I forgot that |
01:47:05 | * | Axiomatic joined #nim |
01:52:02 | * | kinkinkijkin quit (Ping timeout: 260 seconds) |
01:53:53 | FromDiscord | <zetashift> @Jonjitsu https://github.com/nim-lang/Nim/pull/15251 |
01:53:54 | disbot | ➥ new-style concepts implementation, WIP |
01:54:04 | FromDiscord | <zetashift> (edit) "<@490586708732280842>jitsu" => "jonjitsu" |
01:54:33 | FromDiscord | <ElegantBeef> Concepts work but they currrently have multiple RFCs afaik |
01:58:09 | FromDiscord | <flywind> What happened with Nim CI? |
01:58:09 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/pull/15783 |
01:58:10 | disbot | ➥ fix adding empty sequence to HTTP headers |
01:58:59 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2D3m |
02:01:02 | * | abm quit (Quit: Leaving) |
02:01:24 | FromDiscord | <ElegantBeef> @nikki hey next time you have lunch and want some shoddy nim content you now can watch my nimscripter vidja 😛 https://www.youtube.com/watch?v=GXBxvtHDjbg |
02:01:58 | FromDiscord | <nikki> awesome 😄 |
02:01:59 | FromDiscord | <ElegantBeef> Yes i should've zoomed in |
02:02:15 | * | kinkinkijkin joined #nim |
02:04:02 | jonjitsu[m] | I'm going to use concepts for this exercise project. How would I achieve the same without? Inheritance + methods? |
02:04:28 | FromDiscord | <ElegantBeef> What're you trying to replicate? |
02:05:03 | FromDiscord | <ElegantBeef> Concepts are compile time only, so you cannot use them in runtime types like sequences |
02:09:44 | jonjitsu[m] | I have an emulator and I wan't to swap out the display. The display just needs to respond to certain methods like clear() |
02:14:44 | FromDiscord | <ElegantBeef> You can use a few different methods for that you can use inheritance, or you can use an object with something like `clearImpl: proc(args: T)` so you can use that like an interface where you change what it calls based off the display type |
02:16:05 | FromDiscord | <ElegantBeef> Then you also can use this, although the lack of license is ehh https://github.com/slangmgh/interfaced |
02:19:58 | FromDiscord | <nikki> also if that's a compile time decision, you could just import a different module depending on which impl you want to use, or something like that |
02:20:18 | FromDiscord | <ElegantBeef> Yep left that out |
02:21:06 | FromDiscord | <ElegantBeef> Streams are a great example of that entire `impl` style interface https://github.com/slangmgh/interfaced |
02:21:10 | FromDiscord | <ElegantBeef> damn it |
02:21:17 | FromDiscord | <ElegantBeef> (edit) "https://github.com/slangmgh/interfaced" => "https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/streams.nim#L109" |
02:27:02 | * | apahl quit (Ping timeout: 264 seconds) |
02:28:39 | jonjitsu[m] | Interesting thanks. It's definitely a compile time decision since one display is for sdl and the other for canvas in js... |
02:29:06 | * | apahl joined #nim |
02:29:11 | FromDiscord | <ElegantBeef> Yea you can always checkout how nico does it |
02:30:12 | FromDiscord | <ElegantBeef> https://github.com/ftsf/nico/blob/master/nico.nim#L11 |
02:31:27 | FromDiscord | <ElegantBeef> If i stop giving links to things i do implode |
02:35:15 | FromDiscord | <nikki> yeah i think using modules is good for your case since the display funcs could get called a lot and it's nice to not have the runtime overhead |
02:40:05 | * | ^omn1present^ joined #nim |
02:40:13 | ^omn1present^ | Hello Nim folks |
02:41:56 | ^omn1present^ | Anyone here :sad: |
02:42:14 | FromDiscord | <Rika> hello |
02:42:18 | FromDiscord | <Rika> how are you |
02:42:34 | ^omn1present^ | Good |
02:43:08 | FromDiscord | <ElegantBeef> For someone that's omnipresent you didnt know you were going to get a response |
02:44:32 | FromDiscord | <Rika> lol |
02:44:38 | ^omn1present^ | thats what i want u to think |
02:44:40 | FromDiscord | <Rika> theyre omnipresent not omniscient |
02:44:42 | FromDiscord | <Rika> or omnipotent |
02:44:48 | ^omn1present^ | ye |
02:45:02 | FromDiscord | <ElegantBeef> > (of God) present everywhere at the same time. |
02:45:06 | FromDiscord | <Rika> yeah |
02:45:09 | FromDiscord | <Rika> they dont know everything |
02:45:13 | FromDiscord | <Rika> theyre just everywhere |
02:45:22 | ^omn1present^ | yea |
02:45:28 | FromDiscord | <ElegantBeef> If they were everywhere they could see that we in process of responding 😄 |
02:46:02 | FromDiscord | <Rika> i mean i only started responding 5 seconds before i sent my message |
02:46:13 | FromDiscord | <Rika> which was 2 minutes after they sent their message |
02:46:33 | FromDiscord | <ElegantBeef> Shhh |
02:46:35 | FromDiscord | <Rika> lol |
02:46:35 | ^omn1present^ | hol' up IRC gives everyone my ip |
02:46:36 | FromDiscord | <ElegantBeef> Dont look much into |
02:46:38 | FromDiscord | <ElegantBeef> Just rejoice |
02:46:51 | FromDiscord | <Rika> omnipresent: you get used to it |
02:47:02 | FromDiscord | <Rika> as long as you arent dumb with network security it should be fine? |
02:47:07 | FromDiscord | <ElegantBeef> ^ |
02:47:12 | FromDiscord | <ElegantBeef> Plus only irc users get it |
02:47:17 | FromDiscord | <Rika> at least thats what i think lol |
02:47:30 | FromDiscord | <ElegantBeef> I mean every service you use gives your ip |
02:47:34 | FromGitter | <offbeat-stuff> How to get len of cstring |
02:47:41 | FromDiscord | <ElegantBeef> Cant return a package to an unknown sender |
02:47:43 | FromDiscord | <Rika> theCstring.len |
02:47:44 | FromDiscord | <Rika> lol |
02:47:53 | FromGitter | <offbeat-stuff> var err = getError ⏎ ⏎ ```if len(err.string) > 0: ⏎ echo err``` [https://gitter.im/nim-lang/Nim?at=5fa367d8b4283c208a46c0a3] |
02:47:57 | FromGitter | <offbeat-stuff> this doesn't word |
02:47:58 | FromGitter | <offbeat-stuff> work |
02:48:03 | FromDiscord | <Rika> why? |
02:48:07 | FromGitter | <offbeat-stuff> len(err) also doesn't |
02:48:15 | FromDiscord | <Rika> what does getError return? |
02:48:24 | FromDiscord | <ElegantBeef> well it doesnt matter which you use they're identical internally |
02:48:35 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2D3A |
02:48:35 | FromGitter | <offbeat-stuff> cstring{.cdecl.} |
02:48:37 | FromDiscord | <ElegantBeef> Yea it works |
02:48:58 | * | ^omn1present^ quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
02:49:15 | FromGitter | <offbeat-stuff> I am using cpp and 1.5.1 |
02:49:38 | FromDiscord | <ElegantBeef> Can we see your entire code? |
02:49:42 | FromDiscord | <Rika> that is really odd |
02:49:48 | FromDiscord | <Rika> are you sure its that code thats broken |
02:49:52 | FromDiscord | <Rika> and not elsewhere |
02:50:19 | FromGitter | <offbeat-stuff> Here https://play.nim-lang.org/#ix=2D3E |
02:50:28 | FromGitter | <offbeat-stuff> Yeah |
02:50:44 | FromDiscord | <Rika> whats the full error? |
02:50:56 | FromDiscord | <Rika> i think the issue is that you're not putting parentheses on getError |
02:51:08 | FromGitter | <offbeat-stuff> Sorry i forget the () |
02:51:55 | FromDiscord | <ElegantBeef> interestingly nim playground has sdl2...? |
02:52:11 | FromDiscord | <Rika> yeah playground has first few important packages |
02:52:14 | FromGitter | <offbeat-stuff> Where would someone see the window |
02:52:18 | FromDiscord | <ElegantBeef> Oh i knew that but sdl2 is weird |
02:52:19 | FromDiscord | <ElegantBeef> You dont |
02:52:22 | FromDiscord | <Rika> well nowhere |
02:52:24 | FromDiscord | <Rika> its just there |
02:52:26 | FromGitter | <offbeat-stuff> Can we download the rendered video |
02:52:28 | FromDiscord | <ElegantBeef> It just gives stdout |
02:52:29 | * | ^omn1present^ joined #nim |
02:52:32 | FromDiscord | <Rika> well no |
02:52:33 | FromDiscord | <Rika> lol |
02:52:47 | FromDiscord | <Rika> its just there because its a popular package |
02:52:52 | FromGitter | <offbeat-stuff> It can upload it somewhere |
02:52:58 | FromDiscord | <ElegantBeef> Well it doesnt |
02:53:04 | FromDiscord | <ElegantBeef> It's just a quick place to sorta repl |
02:53:07 | FromGitter | <offbeat-stuff> It can't upload |
02:53:13 | FromGitter | <offbeat-stuff> Using code |
02:53:13 | FromDiscord | <Rika> it can yeah but it doesnt |
02:53:22 | FromGitter | <offbeat-stuff> Oh I see |
02:53:46 | ^omn1present^ | o |
02:53:51 | FromDiscord | <ElegantBeef> It's physically possible but more likely than not it's running on a headless server with 0 interest in renderering graphics 😄 |
02:54:24 | FromDiscord | <ElegantBeef> Never ever make a renderer or else you'll never be able to write just render again |
02:54:39 | FromDiscord | <Rika> stdout rendered as image when |
02:54:59 | * | ^omn1present^ quit (Client Quit) |
02:56:17 | FromGitter | <gogolxdong> How to do file stream with jester? |
03:11:22 | * | muffindrake quit (Ping timeout: 260 seconds) |
03:13:25 | * | muffindrake joined #nim |
04:01:50 | * | blueberrypie quit (Quit: leaving) |
04:05:17 | * | blueberrypie joined #nim |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:37 | * | supakeen joined #nim |
04:12:13 | * | vicfred quit (Quit: Leaving) |
04:20:05 | * | kinkinkijkin quit (Read error: Connection reset by peer) |
04:21:57 | * | kinkinkijkin joined #nim |
04:35:25 | disruptek | packedjson doesn't support serializing tuples or uints. it's slower than std/json for every encoding benchmark i have. |
04:35:28 | disruptek | !repo jason |
04:35:29 | disbot | https://github.com/disruptek/jason -- 9jason: 11JSON done right 🤦 15 30⭐ 1🍴 |
05:11:23 | * | NimBot joined #nim |
05:15:00 | * | hyiltiz quit (Remote host closed the connection) |
05:18:08 | FromDiscord | <Avatarfighter> imo the memory usage of packedjson is worth it when encoding/decoding huge json strings in memory |
05:25:19 | * | nekits0 quit (Read error: Connection reset by peer) |
05:25:52 | * | nekits0 joined #nim |
06:04:24 | * | hyiltiz joined #nim |
06:15:21 | * | mmohammadi9812 quit (Ping timeout: 258 seconds) |
06:16:14 | * | hyiltiz_ joined #nim |
06:17:22 | * | narimiran joined #nim |
06:17:55 | * | hyiltiz quit (Quit: hyiltiz) |
06:29:18 | FromDiscord | <nikki> does `nim doc` support any notion of adding 'category comments' for headings that separate your procs into sections? |
06:33:53 | FromDiscord | <Rika> none that i know of |
06:35:36 | * | Q-Master quit (Read error: Connection reset by peer) |
06:36:00 | * | ^Q-Master^ joined #nim |
06:36:14 | * | habamax joined #nim |
06:36:40 | FromDiscord | <ElegantBeef> I have a joke response of "Yea they're called modules" 😄 |
06:37:15 | * | solitudesf joined #nim |
06:38:24 | * | Q-Master joined #nim |
06:38:24 | * | ^Q-Master^ quit (Read error: Connection reset by peer) |
06:50:18 | FromDiscord | <nikki> haha i think headings within a module would still be useful; but also yeah nbd |
06:50:30 | FromDiscord | <nikki> do i have to freeze a .compileTime. seq for it to show up at runtime somehow 🤔 |
06:50:44 | FromDiscord | <nikki> i'm trying to build a seq of asset filenames and content strings at compiletime that is accessible at runtime |
06:50:52 | FromDiscord | <nikki> at compile time it does have the right contents, but at runtime it's empty |
06:51:00 | FromDiscord | <nikki> https://play.nim-lang.org/#ix=2D4n is what the code looks like |
06:51:08 | FromDiscord | <ElegantBeef> `a = static:` |
06:51:54 | FromDiscord | <nikki> huh interesting and yeah makes sense i'll try that |
06:52:00 | FromDiscord | <nikki> i could also just make it a proc and call that and make it const i guess? |
06:52:08 | FromDiscord | <ElegantBeef> yes |
06:52:10 | FromDiscord | <nikki> like `const theSeq = figureItOut()` |
06:52:11 | FromDiscord | <nikki> cool |
06:52:15 | FromDiscord | <ElegantBeef> compiletime vars dont exist at runtime |
06:52:20 | FromDiscord | <ElegantBeef> or atleast shouldnt |
06:53:00 | FromDiscord | <nikki> yeah the weird thing is -- https://nim-lang.org/docs/manual.html#pragmas-compiletime-pragma what i do seems to be similar to what they're doing here |
06:53:05 | FromDiscord | <nikki> where they describe the pragma in the manual |
06:53:12 | FromDiscord | <nikki> i also tried it in a registration case like the one in the manual and got empty there too |
06:53:27 | FromDiscord | <nikki> in any case i'll do it in the expression way |
06:54:07 | FromDiscord | <nikki> it'd be interesting to just generate a huge case statement that checks each filename and returns the staticread lol |
06:55:45 | FromDiscord | <ElegantBeef> This is how you should do it https://play.nim-lang.org/#ix=2D4o |
06:56:00 | FromDiscord | <ElegantBeef> Possibly with static infront |
06:56:44 | FromDiscord | <nikki> what do you think of the manual example that i linked |
06:56:57 | FromDiscord | <ElegantBeef> I think it has the possibillity to have issues |
06:57:48 | FromDiscord | <ElegantBeef> `static` may need to be used occasionally, so it's just a case of what happens |
06:57:59 | FromDiscord | <ElegantBeef> I'm surprised it doesnt complain about usage of a variable that doesnt exist |
06:58:36 | FromDiscord | <nikki> yeah |
07:11:49 | * | mmohammadi9812 joined #nim |
07:18:18 | * | mmohammadi9812 quit (Read error: Connection reset by peer) |
07:22:57 | * | deepend quit (Remote host closed the connection) |
07:25:22 | * | deepend joined #nim |
07:39:46 | * | habamax quit (Remote host closed the connection) |
07:49:57 | * | MarderIII joined #nim |
07:59:36 | * | kinkinkinkin joined #nim |
07:59:55 | * | kinkinkijkin quit (Ping timeout: 244 seconds) |
08:00:26 | FromDiscord | <Ryuzaku> Hey, is there a way to find the smallest element in a set according to an arbitrary func? ( i mean without converting it to a seq and using idxmin) |
08:00:31 | * | andinus joined #nim |
08:10:08 | FromDiscord | <ElegantBeef> @Ryuzaku no clue if this fits your requirements but this? https://play.nim-lang.org/#ix=2D4A |
08:10:14 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:15 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:16 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:19 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:21 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:26 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:27 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:28 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:28 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:29 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:30 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:31 | FromDiscord | <ElegantBeef> @arnetheduck can you moderate the above please? |
08:10:35 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:36 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:10:36 | FromDiscord | <KevinN> https://discord.gg/xtEu6mMnfT |
08:11:02 | FromDiscord | <ElegantBeef> Thanks? |
08:11:17 | FromDiscord | <Ryuzaku> yeah, I guess it does. I was just curious whether there is something in the stdlib |
08:12:36 | FromDiscord | <ElegantBeef> Doesnt appear so there are 24 procs that have `set[T]` and non seem to get it |
08:14:01 | FromDiscord | <Ryuzaku> hmm. This is probably the wrong place to propose it, but what about fallback implementation for all those functions (like min, max, etc) that work based on iterators, that can always be used as callback in case a more specialized implementation is not available? |
08:14:20 | FromDiscord | <Ryuzaku> even sequtils work on seqs and not on iterators |
08:14:28 | FromDiscord | <ElegantBeef> Well you could implement that with a concept |
08:17:20 | FromDiscord | <ElegantBeef> Although i could be wrong 😄 |
08:21:03 | * | habamax joined #nim |
08:25:04 | FromDiscord | <lqdev> mods are asleep, shit |
08:25:14 | FromDiscord | <ElegantBeef> Arne was green |
08:25:18 | FromDiscord | <ElegantBeef> Still is |
08:25:21 | FromDiscord | <ElegantBeef> They're gone |
08:25:23 | FromDiscord | <lqdev> doesn't mean he saw it |
08:25:29 | FromDiscord | <ElegantBeef> no clue if banned or left |
08:26:06 | FromDiscord | <lqdev> if only i were a mod… i wouldn't have moderated the above anyways because i had a maths exam eh |
08:26:16 | FromDiscord | <lqdev> how are you guys doin' today |
08:26:25 | FromDiscord | <lqdev> working on some cool nim stuff? |
08:28:47 | FromDiscord | <ElegantBeef> At the moment i'm not coding, but tomorrow i plan on recording me wrapping a library be it nico or fidget with nimscripter to show how to do it/easy it is |
08:29:13 | FromDiscord | <lqdev> cool! |
08:29:35 | FromDiscord | <lqdev> if nimscripter becomes usable at some point i may just try to use it for planet overgamma |
08:29:38 | FromDiscord | <lqdev> no promises tho |
08:29:51 | FromDiscord | <ElegantBeef> "if it becomes usable"? |
08:30:09 | FromDiscord | <lqdev> as in, stable |
08:30:11 | FromDiscord | <ElegantBeef> https://streamable.com/aipyfv |
08:30:15 | FromDiscord | <ElegantBeef> Are you not entertained! |
08:30:43 | FromDiscord | <ElegantBeef> I think the API is going to be pretty stable from here on out |
08:30:48 | FromDiscord | <lqdev> source code? |
08:31:05 | FromDiscord | <Varriount> What API? |
08:31:20 | FromDiscord | <ElegantBeef> https://github.com/beef331/nimscripter |
08:31:26 | FromDiscord | <ElegantBeef> I havent got to make any examples yet |
08:31:27 | FromDiscord | <lqdev> than |
08:31:28 | FromDiscord | <lqdev> ks |
08:32:14 | FromDiscord | <ElegantBeef> The one thing i do have to do is figure out how i'm going to manage it for shipping nim files |
08:32:32 | FromDiscord | <ElegantBeef> Right now users need to have nim installed but it's a minor change to remove that requirement |
08:32:49 | FromDiscord | <ElegantBeef> Just need to think about how i'll let the developers load the files they want and ship only those on compilation |
08:33:04 | FromDiscord | <Varriount> Hm, I don't like the way procedures are registered to be available in Nimscript |
08:33:06 | FromDiscord | <ElegantBeef> Probably will do an all but X |
08:33:19 | FromDiscord | <ElegantBeef> What would you prefer a block based method? |
08:33:19 | FromDiscord | <Varriount> Why not a pragma? |
08:33:29 | FromDiscord | <ElegantBeef> I use a pragma? |
08:33:37 | FromDiscord | <lqdev> i'd prefer a block-based method tbh |
08:33:44 | FromDiscord | <Varriount> It uses an import |
08:33:49 | FromDiscord | <ElegantBeef> What? |
08:34:16 | FromDiscord | <Varriount> import nimscripter #Must appear after any wanted nimscript procs |
08:34:24 | FromDiscord | <ElegantBeef> Yes i dont like that either |
08:34:33 | FromDiscord | <ElegantBeef> It's due to nim consts |
08:34:42 | FromDiscord | <lqdev> it's most likely due to how macros work. |
08:34:45 | * | habamax quit (Ping timeout: 240 seconds) |
08:34:53 | FromDiscord | <lqdev> or compile-time variables |
08:34:54 | FromDiscord | <lqdev> or both |
08:34:56 | FromDiscord | <ElegantBeef> Yep |
08:35:00 | FromDiscord | <Varriount> You can't add entries to a const sequence at compile time? |
08:35:13 | FromDiscord | <lqdev> btw beef |
08:35:15 | FromDiscord | <ElegantBeef> Well the issue i've had is that if you do it out of order the const is empty |
08:35:16 | FromDiscord | <lqdev> have you seen this? https://nim-lang.org/docs/macrocache.html |
08:35:26 | FromDiscord | <lqdev> @Varriount it's const for a reason |
08:35:30 | FromDiscord | <ElegantBeef> I have but uncertain how beneficial it is |
08:35:43 | FromDiscord | <Varriount> Why not use a var then |
08:35:54 | FromDiscord | <ElegantBeef> Cause i need to calculate stuff at compile time |
08:36:03 | FromDiscord | <ElegantBeef> And add it to the table for runtime |
08:36:11 | FromDiscord | <Varriount> Consultants are only constant at runtime. Not compile time |
08:36:21 | FromDiscord | <Varriount> constants |
08:36:49 | FromDiscord | <Varriount> Is the constant only used at compile time? |
08:37:00 | FromDiscord | <ElegantBeef> The issue is that because how consts are evaluated adding values to the var it copies after the const is evaluated the data is gone at runtime |
08:37:02 | FromDiscord | <ElegantBeef> No |
08:37:15 | FromDiscord | <ElegantBeef> The constant holds the data to interop with nimscript |
08:37:18 | FromDiscord | <lqdev> @Varriount https://play.nim-lang.org/#ix=2D4C |
08:38:27 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2D4D doesnt work for the data i have |
08:38:34 | FromDiscord | <ElegantBeef> If it did i wouldnt have that requirement |
08:39:22 | FromDiscord | <lqdev> and it's all thanks to https://github.com/nim-lang/Nim/issues/13375 :D |
08:39:23 | disbot | ➥ Accessing compileTime variable at runtime returns zeroed data. ; snippet at 12https://play.nim-lang.org/#ix=2bba |
08:40:42 | FromDiscord | <ElegantBeef> Hmm i can try that global pragma |
08:41:20 | FromDiscord | <lqdev> it doesn't work |
08:41:31 | FromDiscord | <lqdev> https://play.nim-lang.org/#ix=2D4E |
08:42:10 | FromDiscord | <Varriount> What about the workaround mentioned in the issue? |
08:42:19 | FromDiscord | <lqdev> that's what he uses |
08:42:43 | FromDiscord | <lqdev> the big advantage of beef's approach is that you don't have to deal with the pains of overload resolution |
08:42:57 | FromDiscord | <lqdev> compared to a block-based approach, where you do something like |
08:43:10 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2D4F |
08:43:31 | FromDiscord | <ElegantBeef> i can make a block based version of `exportToScript` in theory atleast |
08:43:40 | FromDiscord | <lqdev> good luck with that dude |
08:43:51 | FromDiscord | <lqdev> it's a pain in the ass |
08:44:13 | FromDiscord | <lqdev> i know because i implemented one for euwren |
08:44:19 | FromDiscord | <lqdev> !repo liquid600pgm/euwren |
08:44:20 | disbot | https://github.com/liquid600pgm/euwren -- 9euwren: 11High-level Wren wrapper for Nim 15 30⭐ 0🍴 |
08:44:29 | FromDiscord | <lqdev> and it's buggy as hell |
08:44:41 | FromDiscord | <ElegantBeef> Yea i mean it's not high priority |
08:44:59 | FromDiscord | <lqdev> i think i'm gonna create a {.pubapi.} pragma for planet overgamma anyways |
08:45:01 | FromDiscord | <ElegantBeef> It'd be nicer if i could just use `push` |
08:45:03 | FromDiscord | <lqdev> you can |
08:45:09 | FromDiscord | <ElegantBeef> it doesnt work for my macro |
08:45:55 | FromDiscord | <lqdev> oh yeah |
08:46:01 | FromDiscord | <lqdev> i thought Araq said otherwise…? |
08:46:01 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/773830462249631784/unknown.png |
08:46:21 | FromDiscord | <ElegantBeef> I have 0 clue why it doesnt work |
08:46:24 | FromDiscord | <lqdev> thanks for reminding me to implement a nim linter for lite btw |
08:46:31 | FromDiscord | <ElegantBeef> lite? |
08:46:36 | FromDiscord | <lqdev> !repo rxi/lite |
08:46:37 | disbot | https://github.com/rxi/lite -- 9lite: 11A lightweight text editor written in Lua 15 3905⭐ 176🍴 7& 10 more... |
08:46:42 | FromDiscord | <ElegantBeef> Ew |
08:46:48 | FromDiscord | <lqdev> you're ew |
08:46:52 | FromDiscord | <ElegantBeef> Lua is ew |
08:46:58 | FromDiscord | <lqdev> lua is cool |
08:47:10 | FromDiscord | <ElegantBeef> Dynamically typed = me die |
08:47:34 | FromDiscord | <ElegantBeef> Oh shit this is kinda like what i want to make using Nim instead 😄 |
08:47:37 | FromDiscord | <lqdev> it's not bad if you know what youre doing |
08:47:45 | FromDiscord | <ElegantBeef> I know what i'm doing |
08:47:45 | FromDiscord | <nikki> it's totally possible to understand and appreciate qualities of many technologies at once |
08:47:52 | FromDiscord | <ElegantBeef> Nah |
08:48:04 | FromDiscord | <ElegantBeef> I dislike dynamic typing so cannot appreciate python/js/lua |
08:48:19 | FromDiscord | <ElegantBeef> To do otherwise would be hypocrisy 😛 |
08:48:24 | FromDiscord | <lqdev> dynamic typing isn't as bad as you portray |
08:48:34 | FromDiscord | <lqdev> i've never had many problems with it |
08:48:38 | FromDiscord | <ElegantBeef> Who portrays it badly |
08:49:51 | FromDiscord | <lqdev> dynamic typing has its advantages, primarily in rapid prototyping |
08:49:56 | FromDiscord | <nikki> i think it's just easier to take someone seriously when actually discussing aspects rather than just throwing ews and likes and dislikes around |
08:50:10 | FromDiscord | <nikki> i think lua is p good as a runtime |
08:50:13 | FromDiscord | <nikki> luajit especially |
08:50:17 | FromDiscord | <ElegantBeef> nikki you've been talking to me for how long and dont think i'm overly hyperbolic? |
08:50:34 | FromDiscord | <lqdev> i would never use a dynamically typed language as the core of my game, but as a content language it's fine |
08:51:01 | FromDiscord | <ElegantBeef> I'm rarely 100% serious, but i do dislike dynamic typing as it's just not informational enough for me |
08:51:16 | FromDiscord | <ElegantBeef> You remove a lot of information and put it on words alone |
08:51:42 | FromDiscord | <Varriount> Depends on the game. I've been trying out a tabletop game program written in JavaScript |
08:51:50 | FromDiscord | <nikki> yeah i think static typing is very useful, for sure |
08:52:07 | FromDiscord | <nikki> but i think there's a lot of interesting things to talk about regarding lua |
08:52:11 | FromDiscord | <lqdev> static typing often slows you down imo |
08:52:31 | FromDiscord | <nikki> and purely talking about dislike of dynamic typing is not close to the most interesting one |
08:52:39 | FromDiscord | <ElegantBeef> It's a rigid structure that ensures you cannot run into runtime errors |
08:52:44 | FromDiscord | <lqdev> true |
08:52:55 | FromDiscord | <ElegantBeef> So i mean sure it can slow you down but have fun with your runtime errors |
08:53:19 | FromDiscord | <nikki> the biggest benefit i think also is that sizes of memory layouts can be known, and functions can be ... monomorphized |
08:53:22 | FromDiscord | <Varriount> Or it's a rigid structure that prevents you from quickly developing prototypes |
08:53:57 | FromDiscord | <nikki> but yeah like, in a lot of cases i've used lua and been quite productive in ways that i would've thought otherwise |
08:54:05 | FromDiscord | <nikki> the amt of overhead is low |
08:54:06 | * | Tanger quit (Remote host closed the connection) |
08:54:16 | FromDiscord | <nikki> nim feels good for similar reasons |
08:54:22 | FromDiscord | <Varriount> Monomorphized == single representation? |
08:54:25 | FromDiscord | <nikki> like, why ufcs is good |
08:54:28 | * | mmohammadi9812 joined #nim |
08:54:36 | * | mmohammadi9812 quit (Client Quit) |
08:54:42 | FromDiscord | <nikki> @Varriount compiling / generating variants of a function for a type |
08:54:44 | FromDiscord | <nikki> eg. generics |
08:54:49 | FromDiscord | <Varriount> Ah |
08:54:56 | FromDiscord | <nikki> which allows further optimization per type etc |
08:55:16 | FromDiscord | <nikki> weirdly JITs are a runtime form of this, and Luajit's tracing jit is a cool case there |
08:55:32 | FromDiscord | <Varriount> My biggest hurdle with Nim is that parts of it are (unfortunately) unnecessarily high friction |
08:55:56 | FromDiscord | <nikki> interesting, what are those? |
08:55:58 | FromDiscord | <Varriount> (edit) "are" => "have an" |
08:56:17 | FromDiscord | <Varriount> Well, like the issue @KingDarBoja ran into |
08:56:26 | FromDiscord | <nikki> i spent a lot of time doing mixed lua + c++ engine kinda stuff and am finding nim interesting as a more ergonomic + metaprogrammable angle from c++ |
08:56:29 | FromDiscord | <Varriount> Bah, I mean @ElegantBeef |
08:56:43 | FromDiscord | <nikki> specifically? |
08:56:51 | FromDiscord | <nikki> anyways i actually should go to bed haha sorry |
08:57:04 | FromDiscord | <ElegantBeef> Const not being lately bound so it doesnt calculate what happens after all modules have been imported |
08:57:07 | FromDiscord | <Varriount> Not being able to use a compile-time variable at runtime |
08:57:14 | FromDiscord | <ElegantBeef> Well i never ran into that |
08:57:26 | FromDiscord | <ElegantBeef> Compile-time variables arent supposed to be stored |
08:57:42 | FromDiscord | <nikki> hmm that sounds to me like an impl issue |
08:57:43 | FromDiscord | <Varriount> Well, whatever that issue lqdev posted |
08:57:44 | FromDiscord | <lqdev> @Varriount one of my biggest pain points when developing games is lack of mutual dependencies :( |
08:57:46 | FromDiscord | <nikki> vs. a design issue in the lang |
08:58:08 | FromDiscord | <Varriount> @nikki I never said the problem was with the design |
08:58:25 | FromDiscord | <ElegantBeef> An impl issue making a table from any module in the entire project |
08:58:27 | FromDiscord | <nikki> right, i just mean, that at least gives more hope |
08:58:29 | FromDiscord | <nikki> hehe |
08:58:37 | FromDiscord | <Varriount> True |
08:58:37 | FromDiscord | <nikki> or a different distribution of hope at least |
08:58:38 | ForumUpdaterBot | New thread by Nealie: Changes to 1.4 affecting packaging, see https://forum.nim-lang.org/t/7036 |
08:59:10 | FromDiscord | <nikki> i meant an impl issue in the lang's compiler @ElegantBeef |
08:59:12 | FromDiscord | <nikki> not in user code |
08:59:17 | FromDiscord | <ElegantBeef> Yea i realized that after |
08:59:26 | FromDiscord | <ElegantBeef> I was like "Oh they arent blaming me" |
08:59:45 | FromDiscord | <nikki> xD |
08:59:52 | FromDiscord | <nikki> your lib is doing good things! |
08:59:57 | FromDiscord | <nikki> the things nim promises |
08:59:58 | * | habamax joined #nim |
09:00:10 | FromDiscord | <nikki> compile time magic to register stuff etc. |
09:00:26 | FromDiscord | <ElegantBeef> 99% pixie dust and 1% code? |
09:01:13 | FromDiscord | <ElegantBeef> And varriount sure it's not ideal but it's hardly that big of an issue, there is a usable work around until it gets resolved |
09:01:18 | FromDiscord | <ElegantBeef> No one likes that it has to be done this way |
09:02:30 | FromDiscord | <ElegantBeef> Who knows the macro cache might help but not a clue |
09:02:54 | FromDiscord | <ElegantBeef> Nope it's only strings |
09:03:00 | FromDiscord | <ElegantBeef> I need pointers to procs 😄 |
09:03:01 | FromDiscord | <lqdev> NimNodes |
09:03:24 | FromDiscord | <ElegantBeef> Eh still hard to do |
09:04:20 | FromDiscord | <ElegantBeef> The procs dont need to be exported so the subscription needs to happen next to them |
09:04:44 | FromDiscord | <ElegantBeef> So either i'm too tired to understand the benefit or there is none |
09:05:32 | FromDiscord | <ElegantBeef> I suppose i can always do the subscription at runtime |
09:09:34 | * | clemens3 quit (Ping timeout: 256 seconds) |
09:12:47 | FromDiscord | <Varriount> @nikki if I had to pick a design flaw (or more accurately, pain point) in Nim, I would have to say polymorphism |
09:13:16 | FromDiscord | <Varriount> Specifically, runtime polymorphism |
09:14:19 | FromDiscord | <Varriount> Yes, I know that it can be achieved via libraries, but that's the kind of mechanism that the community around a language needs to settle on |
09:15:31 | FromDiscord | <Varriount> Otherwise you have 2 or 3 different implementations that are incompatible, which makes usage more troublesome. |
09:16:48 | FromDiscord | <ElegantBeef> I agree that's probably the most annoying part |
09:18:23 | FromDiscord | <ElegantBeef> That and the fact i cannot legally force it into the hands of all programmers 😄 |
09:18:33 | * | clemens3 joined #nim |
09:19:34 | * | krux02 joined #nim |
09:24:59 | FromDiscord | <Varriount> I like Go's interface design the most, and think it would work quite well with Nim |
09:25:38 | FromDiscord | <Varriount> Of course, the concept -> vtable would be great |
09:26:01 | FromDiscord | <lqdev> agreed |
09:29:00 | * | MarderIII quit (Quit: Leaving) |
09:29:02 | FromDiscord | <lqdev> i wish we could generate types using macros |
09:29:10 | FromDiscord | <lqdev> so that `type X = myMacro(a, b, c)` would work |
09:29:28 | FromDiscord | <lqdev> then implementing runtime interfaces would be trivial |
09:29:41 | FromDiscord | <lqdev> but alas, both `interface` and `concept` are reserved words >:( |
09:29:48 | FromDiscord | <ElegantBeef> macros returning typsections will be noice |
09:29:57 | FromDiscord | <ElegantBeef> So we can make properties and the like |
09:30:07 | FromDiscord | <ElegantBeef> Without a DSL |
09:30:19 | FromDiscord | <lqdev> we need to open an RFC |
09:31:35 | FromDiscord | <ElegantBeef> For what? |
09:47:24 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:52:10 | * | mmohammadi9812 joined #nim |
09:52:31 | * | PMunch joined #nim |
10:07:37 | * | gangstacat quit (Quit: Ĝis!) |
11:04:18 | * | lritter joined #nim |
11:12:54 | * | kinkinkinkin is now known as kinkinkijkin |
12:05:17 | * | TomDotTom joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:37 | * | supakeen joined #nim |
12:18:52 | * | mmohammadi9812 quit (Ping timeout: 272 seconds) |
12:27:12 | FromDiscord | <Innokentiy Sokolov> does anyone had experience with compiling via `nim in docker` container? |
12:27:44 | FromDiscord | <Innokentiy Sokolov> How to deal with dependencies? |
12:29:07 | * | mmohammadi9812 joined #nim |
12:35:37 | PMunch | I regularly build Nim projects in a Nim container |
12:35:46 | PMunch | Docker container* |
12:43:32 | FromDiscord | <Innokentiy Sokolov> @PMunch how do you install dependencies in that case? like 'nimble install` |
12:43:39 | FromDiscord | <Innokentiy Sokolov> (edit) "'nimble" => "`nimble" |
12:44:35 | * | gangstacat joined #nim |
12:51:01 | PMunch | Yeah, I just got a nimble project set up and then run `nimble build` |
12:52:26 | FromDiscord | <Innokentiy Sokolov> Did I get you right that nimble is installed on your host system? Or you connect to docker image to use nimble? |
12:52:46 | FromDiscord | <Innokentiy Sokolov> I'm just trying to figure out how to use docker only solution |
12:53:29 | FromDiscord | <Innokentiy Sokolov> Docker Hub contains nim image with `single file` example only. Not much info on workflow |
12:53:51 | * | abm joined #nim |
12:54:01 | PMunch | Ah, no the nimble is run inside the container |
12:54:09 | PMunch | Are you familiar with how to use Docker? |
12:55:54 | FromDiscord | <Innokentiy Sokolov> Yeah but I never used docker images `as a console app`. Only used for deploy web services (aka traefik, portainer and etc) |
12:56:50 | FromDiscord | <Innokentiy Sokolov> But I think I get it now |
12:57:03 | * | Q-Master quit (Ping timeout: 260 seconds) |
12:57:50 | PMunch | Well there are two ways of doing it |
12:59:06 | PMunch | One is making a "builder" image that you then run with something like `docker run -v $(pwd):/tmp/src <image> nimble build` to build the Nim project in the current directory. |
12:59:36 | PMunch | The other option is to make a container that builds a specific project and then copies the build result into a run container |
13:00:23 | PMunch | So after the `docker build` command you are left with a container that contains your app already built and runnable, but the container doesn't have Nim installed. |
13:02:03 | FromDiscord | <Innokentiy Sokolov> Thanks for explanation! That sheds light |
13:03:49 | PMunch | No problem! I guess I could do a simple write-up of how to build Nim in Docker |
13:04:38 | FromDiscord | <Innokentiy Sokolov> @PMunch That would be awesome really! |
13:07:47 | * | fredrikhr joined #nim |
13:14:29 | * | agent0x00 joined #nim |
13:20:10 | * | Q-Master joined #nim |
13:20:22 | * | Q-Master quit (Client Quit) |
13:41:00 | * | Q-Master joined #nim |
13:58:50 | * | TomDotTom quit (Quit: Leaving) |
13:59:07 | * | TomDotTom joined #nim |
14:12:14 | FromDiscord | <Innokentiy Sokolov> sent a code paste, see https://play.nim-lang.org/#ix=2D7a |
14:12:50 | * | habamax quit (Read error: Connection reset by peer) |
14:13:05 | * | habamax joined #nim |
14:13:42 | FromDiscord | <Innokentiy Sokolov> init part creates whole nimble structure folder structure with helloworld app. and the second part - install necessary dependencies (mounted locally) and run the task |
14:13:48 | FromDiscord | <flywind> https://www.reddit.com/r/nim/comments/jkk9bd/building_an_prologue_binary_for_alpine_in_docker/ |
14:15:53 | FromDiscord | <Innokentiy Sokolov> Yeah but creating a `Dockerfile` is a bit an overtake versus using already cooked Nim docker image |
14:16:17 | FromDiscord | <Innokentiy Sokolov> I may be wrong tho |
14:21:38 | FromDiscord | <Innokentiy Sokolov> The reason I made a fuzz about all this is that I had a real life scenario recently with old VPS on CentOS - I wasn't able to install Nim there via `choosenim` properly. Don't remember the details but I gave up at that point. The docker image would solve the issue |
14:29:00 | PMunch | Sorry, when you send long messages they get converted to a paste link and I don't get highlighted |
14:29:40 | * | habamax quit (Quit: leaving) |
14:29:49 | PMunch | If you have prologue as a dependency in your nimble file then simply `nimble run` should suffice, it will automatically install it |
14:30:00 | * | habamax joined #nim |
14:30:36 | PMunch | Oh by the way `nimble run` does build and run, so no need for an extra task |
14:30:41 | PMunch | @Inno ^ |
14:32:11 | FromDiscord | <Innokentiy Sokolov> @PMunch I never tried that actually because I add `--define:ssl` to my task. |
14:34:01 | FromDiscord | <Innokentiy Sokolov> @PMunch thanks again for enlightening me |
14:34:01 | PMunch | That's what nim.cfg is for |
14:34:13 | PMunch | Put your defines in there |
14:34:29 | PMunch | Makes nimlsp (and probably other tools) happy as well |
14:34:30 | FromDiscord | <Innokentiy Sokolov> @PMunch that's unknown territory for me yet :))) |
14:34:44 | FromDiscord | <Innokentiy Sokolov> didn't know that |
14:36:44 | PMunch | Here is an example one: https://gist.github.com/mashingan/6cd3af4528ad5c11ed4f27f3aac72cc4 |
14:36:57 | PMunch | Well, that is the one for the Nim compiler it seems |
14:40:28 | * | agent0x00 quit (Quit: WeeChat 1.9.1) |
14:41:45 | FromDiscord | <Innokentiy Sokolov> `nim.cfg`, `.nims` files. my head hurts |
14:42:58 | * | tane joined #nim |
14:43:56 | FromGitter | <christopherzimmerman> Is it possible to have a default named argument after varargs? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5fa40fab7cac87158f8acf2d] |
14:44:19 | PMunch | I don't think so, unfortunately |
14:44:40 | PMunch | Well, not without a macro that is |
14:47:50 | PMunch | And that wouldn't look very good in the documentation |
14:59:03 | * | opal quit (Ping timeout: 240 seconds) |
15:00:59 | PMunch | Hmm, is there a `mgetOrPut` that sets puts the default? |
15:04:26 | * | lol-asd joined #nim |
15:04:49 | * | opal joined #nim |
15:07:41 | * | lol-asd quit (Remote host closed the connection) |
15:08:05 | FromDiscord | <AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=2D7K |
15:09:20 | FromDiscord | <Zachary Carter> look at the generated C code? |
15:12:45 | FromDiscord | <AmjadHD> That's a good idea. |
15:13:21 | FromDiscord | <Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2D7O |
15:13:48 | FromDiscord | <Zachary Carter> you can ignore the `nimfr` lines |
15:14:01 | FromDiscord | <Zachary Carter> and `nimln` as well |
15:27:20 | FromDiscord | <AmjadHD> @Zachary Carter can you do me a favor and paste the c code when you explicitly assign to result instead. |
15:27:31 | FromDiscord | <Zachary Carter> sure |
15:28:09 | FromDiscord | <Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=2D84 |
15:28:41 | FromDiscord | <lqdev> @AmjadHD if the last expression in a procedure is non-void, it acts as a shortcut for assigning to result |
15:33:02 | FromDiscord | <lqdev> it would be nice if params of procs generated from templates wouldn't appear as x`gensym1: int in docs and nimsuggest :( |
15:40:23 | * | mmohammadi9812 quit (Ping timeout: 258 seconds) |
15:41:16 | PMunch | Agreed |
15:50:28 | * | nekits07 joined #nim |
15:51:49 | * | nekits0 quit (Ping timeout: 264 seconds) |
15:52:21 | * | mmohammadi9812 joined #nim |
16:08:42 | PMunch | "Error: cannot export: UnsatisfiableConstraintException", why not? |
16:13:37 | PMunch | Oh.. It's not exported |
16:14:56 | disruptek | nikki: compiletime vars do exist at runtime, but they are immutable. |
16:15:14 | disruptek | yeah, i don't like it, either. |
16:15:18 | * | TomDotTom quit (Ping timeout: 256 seconds) |
16:15:52 | FromDiscord | <nikki> that's fine, but it was just showing up empty for me, there seems to be an issue about it |
16:16:11 | disruptek | got a demo? |
16:16:23 | * | hnOsmium0001 joined #nim |
16:23:00 | FromDiscord | <nikki> will post one soon, gotta do some other stuff irl for a bit |
16:27:36 | * | habamax quit (Ping timeout: 256 seconds) |
16:32:18 | FromDiscord | <nikki> actually disruptek i found the one i posted earlier: https://play.nim-lang.org/#ix=2D4n |
16:36:18 | FromDiscord | <nikki> i was just trying to have a filename + contents list embedded, i got it working by doing `const assetContents = figureItOut()` instead |
16:37:02 | * | xace quit (Ping timeout: 260 seconds) |
16:38:58 | * | xace joined #nim |
16:40:46 | disruptek | that's what i'd have done. also, a table would be faster. |
16:41:02 | disruptek | i don't see a flaw in this code, though. |
16:42:27 | FromDiscord | <nikki> yeah 🤔 |
16:43:07 | FromDiscord | <nikki> i was gonna use a table initially but i had similar code populating a table that was empty earlier so i wondered if it was due to table vs. seq and decided to try a seq |
16:43:17 | FromDiscord | <nikki> (the table turned out empty too) |
16:44:22 | disruptek | i'm probably missing something. i just dunno if i don't do it this way because it doesn't work, or if i don't do it this way because i never learned these semantics. |
16:45:42 | disruptek | i will say that i avoid compiletime vars. i think they are super creepy. i use a let and a compiletime proc instead. |
16:46:19 | disruptek | the fact that code that assigns a value at runtime compiles and runs without mutating the value is fucking nuts. |
16:46:35 | FromDiscord | <Recruit_main707> can you disable array bounds checking? |
16:46:43 | disruptek | yes. |
16:46:52 | mipri | nim --fullhelp|grep check |
16:47:01 | FromDiscord | <nikki> `-d:danger` does, i think you can set/unset granularly too |
16:47:22 | disruptek | it seems that maybe a compiletime var can only observe a value upon initialization. |
16:48:01 | disruptek | hmm, but your static block finds a value. see, it's just madness. |
16:49:27 | * | rockcavera joined #nim |
16:49:49 | FromDiscord | <nikki> yea -- the main usecase i'm eyeing for the future is the 'registration' one where i have a pragma that allows me to do `type Foo {.rememberMe.} = ...` and then later i can look up all of the remember-me'd stuff |
16:50:43 | FromDiscord | <nikki> which is exactly the example in the manual for `compileTime` https://nim-lang.org/docs/manual.html#pragmas-compiletime-pragma |
16:56:08 | FromDiscord | <lqdev> is there any reason for `new` to return nil? |
17:03:05 | disruptek | lol wut |
17:03:59 | disruptek | actually, i kinda remember something about this. |
17:09:08 | FromDiscord | <lqdev> nevermind that question. turns out it was just my idiocy. |
17:09:25 | Zevv | what, again?! |
17:10:03 | disruptek | lqdev: don't insult me. |
17:10:36 | FromDiscord | <lqdev> disruptek: you can't tell me what to do |
17:11:46 | disruptek | fair enough. |
17:11:54 | Zevv | Sure he can tell you |
17:12:20 | disruptek | lqdev is a sharper coder than i am. i have to concede his authority. |
17:16:03 | FromDiscord | <lqdev> my authority lol |
17:16:19 | Zevv | we could use some authority here |
17:16:24 | Zevv | ar4q is seldom around |
17:17:07 | disruptek | he's around, he's just bored by all the whining. |
17:19:51 | Zevv | aren't we all |
17:20:17 | disruptek | Zevv: your irc graph might be a decent measure of language popularity growth. |
17:23:09 | disruptek | or maybe it just measures whining. 🤔 |
17:25:12 | * | TomDotTom joined #nim |
17:36:07 | * | habamax joined #nim |
17:36:26 | * | solitudesf- joined #nim |
17:38:13 | * | solitudesf quit (Ping timeout: 260 seconds) |
17:41:52 | Zevv | it's only the top 100 whiners in the graph |
17:42:24 | disruptek | over which timespan? |
17:42:44 | disruptek | the stack is a stupid invention. |
17:42:51 | disruptek | i hate it so much. |
17:43:33 | Zevv | stacks are so great |
17:43:36 | Zevv | I love stacks |
17:43:47 | Zevv | my house is full of them |
17:43:48 | Zevv | stacks of books |
17:43:50 | Zevv | stacks of plates |
17:44:11 | Zevv | stacks of everything with a aspect ration > 0.5 |
17:44:22 | PMunch | Haha, ditto |
17:44:53 | Zevv | And I naturally forth well. I read 4 books at a time, so rot and swap and pick2 come natural |
17:45:13 | disruptek | yeah, great. |
17:45:26 | FromDiscord | <nikki> leo brodie wrote some good books |
17:45:27 | disruptek | i'm moving you to the top of the list of people i will kill next time i'm overseas. |
17:45:32 | Zevv | I love the pictures |
17:45:50 | Zevv | I bought the brodie boek 3 years ago or so when I made https://github.com/zevv/zForth |
17:45:56 | Zevv | oh is it 5 years already. damn |
17:47:14 | FromDiscord | <nikki> nice! i made a stack based interpreter a while ago that's not embeddable or tiny at all https://github.com/nikki93/nscript lol |
17:47:19 | FromDiscord | <nikki> just interprets the string directly |
17:47:39 | Zevv | see, stacks are just solid stuff |
17:47:45 | FromDiscord | <nikki> ya |
17:47:47 | disruptek | fuck that. |
17:47:47 | FromDiscord | <nikki> stax! |
17:48:01 | FromDiscord | <nikki> disruptek what are you mad about |
17:48:02 | FromDiscord | <nikki> if you are |
17:48:05 | Zevv | stacks |
17:48:08 | FromDiscord | <nikki> you may also not be mad |
17:48:16 | Zevv | perpetual madness |
17:48:31 | FromDiscord | <nikki> if you're always mad to the same extent, are you actually mad? |
17:48:57 | disruptek | yes. |
17:49:02 | disruptek | the doctors tell me i'm quite mad. |
17:49:07 | FromDiscord | <nikki> oh |
17:49:07 | Zevv | Hey this dude made a nim port of zforth \o/ |
17:49:32 | FromDiscord | <nikki> there's no implicit `this`in nim |
17:49:39 | Zevv | there used to be |
17:49:49 | disruptek | this is a bad idea. |
17:50:01 | FromDiscord | <nikki> `import this` |
17:50:28 | * | muffindrake quit (Ping timeout: 244 seconds) |
17:52:04 | * | muffindrake joined #nim |
17:52:55 | disruptek | i'm one of those people who is so fucking depressed that i develop outrage just to feel anything. |
17:53:11 | disruptek | this is a travesty. |
17:53:19 | disruptek | this makes me so angry i cannot see straight. |
17:53:48 | disruptek | either i'm eating Cap'n Crunch cereal right now or someone is typing this into a computer. |
17:54:52 | FromDiscord | <nikki> i think i've seen that |
17:55:44 | FromDiscord | <nikki> have u watched american psycho? p good movie |
17:55:57 | disruptek | of course. i'm old. |
17:56:17 | Zevv | i havent. i save all the good stuff for when I'm old |
17:56:25 | mipri | what do you mean of course? I'm old and I haven't watched it. |
17:56:32 | disruptek | Zevv: i just put a bullet next to your name. |
17:56:46 | mipri | don't let anyone tell you that age forces you to consume Hollywood products. There's lots of new vtubers out there. |
17:57:00 | disruptek | mipri: you may make the list yet. |
17:57:11 | FromDiscord | <nikki> i think hollywood products consume you |
17:57:29 | FromDiscord | <nikki> that's how you get old |
17:57:35 | disruptek | mipri: how old are you? |
17:58:07 | mipri | I'm... not 40 yet. |
17:58:40 | disruptek | then my title is intact. |
18:00:10 | Zevv | we're staltler and waldorf. |
18:00:20 | disruptek | talk about a blast from the past. |
18:00:42 | * | rockcavera quit (Remote host closed the connection) |
18:01:39 | Yardanico | !status |
18:01:41 | FromDiscord | Uptime - 2 weeks, 1 day, 22 hours, and 25 minutes |
18:04:56 | * | habamax quit (Quit: leaving) |
18:05:13 | * | habamax joined #nim |
18:38:40 | * | abm quit (Read error: Connection reset by peer) |
18:45:24 | * | xet7 quit (Quit: Leaving) |
19:20:01 | FromDiscord | <treeform> OMG why is this not in? https://github.com/nim-lang/Nim/pull/7761 |
19:20:02 | disbot | ➥ Implements parseQuery in uri module. |
19:20:19 | FromDiscord | <treeform> What am I supposed todo? |
19:21:42 | disruptek | i'm not sure it's right, anyway; not clear if it handles singleton query params correctly. |
19:24:22 | FromDiscord | <treeform> it puts them in a seq |
19:24:34 | FromDiscord | <treeform> do I have to write my own query string parser? |
19:25:27 | disruptek | ?foo&bar=bif is a valid query string, but i'm sure it can be parsed and re-rendered correctly. are you? |
19:25:39 | disruptek | er, i'm /not/ sure. |
19:25:42 | * | vicfred joined #nim |
19:25:53 | FromDiscord | <treeform> not sure too |
19:26:04 | FromDiscord | <treeform> is there query parser in nim that just works™️? |
19:26:08 | disruptek | so why would you want to use this shitty code? |
19:26:13 | disruptek | it's not like it's hard to write. |
19:26:33 | FromDiscord | <treeform> I don't. I just want to parse query strings and not worry about it. |
19:26:39 | disruptek | i feel you. |
19:26:51 | FromDiscord | <treeform> import uri and get all of that for free |
19:26:59 | FromDiscord | <treeform> and now its like nope... |
19:27:15 | disruptek | there's a Url type that has never served any purpose except to clash names. |
19:27:25 | disruptek | did you really expect more from this stuff? |
19:27:32 | FromDiscord | <treeform> yes |
19:27:39 | disruptek | interesting. |
19:27:57 | disruptek | btw, is there a technical reason your ws lib cannot be synchronous? |
19:28:44 | FromDiscord | <treeform> no I had a synchronous version with threads first. |
19:28:57 | disruptek | in the same repo? |
19:28:57 | FromDiscord | <treeform> but async is just easier due to thread to thread comunication |
19:29:13 | FromDiscord | <treeform> some time long time ago |
19:29:22 | FromDiscord | <treeform> your best best now is just to remove async from everywhere |
19:29:22 | disruptek | i get it, i just don't use async/await anymore. |
19:30:37 | FromDiscord | <treeform> if you just remove all away and {.async.} it will probably just work for you. |
19:30:48 | FromDiscord | <treeform> (edit) "away" => "`await`" | "{.async.}" => "`{.async.}`" |
19:31:04 | disruptek | cool. if i can make it painless, i'll offer a pr. |
19:36:03 | FromDiscord | <Clyybber> @treeform use cgi.decodeData |
19:39:39 | * | astronavt joined #nim |
19:40:30 | * | rockcavera joined #nim |
19:40:42 | FromDiscord | <treeform> @Clyybber thanks! |
19:41:39 | FromDiscord | <treeform> gar! cgi cant work in JS mode... |
19:41:59 | FromDiscord | <treeform> `undeclared identifier: 'stdin'` |
19:45:23 | * | abm joined #nim |
19:48:10 | Prestige | Trying to reason about concepts, and if they can be used for this particular use case. I'm writing a spatial hashing module, which requires an object and a bounding box. I'd like to say, give me an object that has a `getBounds` proc that returns a Rectangle. |
19:48:37 | Prestige | Can this not be done with concepts, because they are compile time helpers? |
19:48:38 | disruptek | you can if the params don't vary. |
19:49:27 | disruptek | getBounds(c) is Rectangle |
19:49:52 | FromDiscord | <haxscramper> I just pushed last fixes for pattern matching, so now I need someone to review it (implementation/documentation/tests etc.) |
19:50:47 | Prestige | disruptek: I'll give that a shot. Thanks |
19:51:28 | disruptek | concepts work best as a concept. |
19:51:38 | disruptek | in practice, things fall apart quite quickly. |
19:51:58 | Prestige | Yeah. I keep wanting something like an interface |
19:52:20 | disruptek | i keep wondering what that word means. |
19:53:40 | Prestige | just a reference to what other languages use - basically an interface is just a "class" that has only abstract functions |
19:53:53 | Prestige | so it's partial multiple inheritance |
19:54:08 | disruptek | concepts are a superset of this. |
19:55:39 | disruptek | also, you cannot use negation in your concepts, which is a little infuriating. |
19:55:45 | FromDiscord | <haxscramper> From my understanding interface is just better way to say that object has field like `implCallback: proc()` |
19:57:51 | FromDiscord | <haxscramper> Which is nice but yeah, concepts are superset of this, and also allow for use of standalone procs as long as they match. Prototype should be different though - e.g. for `implCb: proc()` you need to have `implCb(obj: Type)` |
19:59:01 | Prestige | hm I guess that did work, at least in this small example: https://play.nim-lang.org/#ix=2D9r |
19:59:16 | Prestige | disruptek: negation in what manner? I'm just curious what you mean |
19:59:49 | FromDiscord | <haxscramper> Maybe I can use concepts to make wrappers for OOP-heavy code? Since concepts can inherit from each other (or I think so), and can be misused to describe methods etc. |
20:00:12 | Prestige | I'd be interested in seeing that |
20:00:25 | FromDiscord | <haxscramper> Someone should probably just shoot me before I try to do this for real |
20:00:29 | FromDiscord | <Recruit_main707> i wish there was something like concepts for runtime |
20:00:31 | disruptek | concepts will disappoint you if you attempt anything remotely sophisticated. |
20:00:42 | FromDiscord | <haxscramper> The most cursed idea I've had for the last 20 minutes |
20:00:44 | Prestige | I would still like to see MI but my method for doing it can't be accomplished with macros |
20:00:48 | * | kinkinkijkin quit (Remote host closed the connection) |
20:00:55 | disruptek | you cannot do `concept c ... foo() isnot Bar` for example. |
20:01:05 | disruptek | no negation of boolean logic. |
20:01:06 | Prestige | @Recruit yeah that's basically what an interface would be |
20:01:09 | * | kinkinkijkin joined #nim |
20:01:11 | Prestige | ah |
20:01:26 | FromDiscord | <Recruit_main707> but, like with concept syntax |
20:01:42 | Prestige | Yeah, that would be nice |
20:01:50 | FromDiscord | <haxscramper> @Recruit_main707 Isn't it like just dynamic typing basically, with `assert hasMethod` and `impls; Table[string, proc(args: RuntimeArgs)]` |
20:02:17 | FromDiscord | <haxscramper> Or something like CLOS (not saying I'm familiar with it though) |
20:02:33 | FromDiscord | <Recruit_main707> yes, but then id have to write it myself :P |
20:03:20 | disruptek | nothing wrong with writing nim. |
20:03:34 | mipri | some negation: https://play.nim-lang.org/#ix=2D9u |
20:05:14 | disruptek | hmm, my mistake. maybe it's just certain boolean templates. |
20:06:12 | FromDiscord | <Recruit_main707> those error messages are horrible though |
20:07:16 | * | natrys joined #nim |
20:07:31 | mipri | the error message in that link works; it just needs to suppress some of the spam. that's come up and been fixed in the past for other spammy errors |
20:07:43 | disruptek | this is my canonical demo of concept problem: https://github.com/disruptek/nimph/blob/0de876f3497adf99363a6e1e50a7984d9dac318d/nimph/groups.nim |
20:10:01 | disruptek | also be aware that the order of boolean expressions in the concept declaration /matters/. |
20:10:17 | * | hyiltiz_ quit (Quit: hyiltiz_) |
20:11:53 | * | hyiltiz joined #nim |
20:12:01 | FromDiscord | <AmjadHD> How to pass a char literal to a template ? |
20:12:14 | disruptek | 'x'? |
20:12:40 | mipri | same way you pass char literals to anything. |
20:14:06 | FromDiscord | <Recruit_main707> lemme guess, you used python before? :p |
20:14:30 | FromDiscord | <Recruit_main707> "x" is a string↵'x' is a char |
20:22:22 | FromDiscord | <nikki> is there a way to call the "original" / "default" `=destroy` hook from your own `=destroy` hook for an object? if not i guess you can wrap all the fields inside another object and call `=destroy` on that one and keep your extra work in the `=destroy` for the outer one |
20:23:08 | FromDiscord | <Clyybber> @nikki system.`=destroy` |
20:23:13 | FromDiscord | <nikki> 😮 😮 😮 |
20:23:28 | FromDiscord | <nikki> game changer |
20:26:19 | FromDiscord | <nikki> um wait my program hangs so did it go recursive |
20:26:19 | FromDiscord | <nikki> lmao |
20:26:56 | FromDiscord | <nikki> ya definitely went recursive @Clyybber lol |
20:27:11 | FromDiscord | <Clyybber> oh; sry. I thought that worked |
20:27:26 | FromDiscord | <nikki> https://media.discordapp.net/attachments/371759389889003532/774006983618461736/unknown.png |
20:27:36 | FromDiscord | <nikki> the highlighted part on the left is what corresponds to the C code on the right, C code is recursive |
20:28:26 | mipri | yes, it's recursive |
20:28:46 | FromDiscord | <nikki> woooooops |
20:28:58 | FromDiscord | <nikki> guess i have to stick to manually doing it over the fields / wrap in another layer of object if i want default |
20:29:01 | FromDiscord | <Clyybber> @nikki heh, so did it do the right thing? |
20:29:03 | mipri | https://play.nim-lang.org/#ix=2D9w simpler example |
20:29:06 | FromDiscord | <Clyybber> oh |
20:29:38 | FromDiscord | <nikki> yeah i want to additional work over the system's automatic destroy, but if i hook destroy i lose the system one 😐 |
20:29:53 | FromDiscord | <Clyybber> @nikki you could also try just making your object distinct and giving it a different destructor that calls the undistinct one |
20:30:25 | FromDiscord | <nikki> huh i see. interesting. and then calling the undistinct one would involve casting and calling `=destroy` on it right |
20:30:35 | mipri | as demonstrated: https://play.nim-lang.org/#ix=2D9y |
20:31:29 | FromDiscord | <nikki> hmmmmmmmmmmm if the thing i am distinct from is anonymous, can i cast to it |
20:31:45 | FromDiscord | <nikki> so that i could just do `type Thing = distinct object ...` and then still cast to the anonymous type it's distinct of |
20:32:11 | mipri | if it's anonymous, how did you even define the =destroy for? |
20:32:31 | FromDiscord | <nikki> originally it was `type Thing = object <fields>` |
20:32:54 | FromDiscord | <nikki> i could do `type ThingPayload = object <fields> ... type Thing = distinct ThingPayload` but |
20:33:23 | FromDiscord | <nikki> if i were to do `type Thing = distinct object` but the anonymous type after the `distinct` in that type expression is still available, i avoid needing to name `ThingPayload` |
20:33:38 | FromDiscord | <Clyybber> @nikki theres typetraits.distinctBase |
20:33:48 | FromDiscord | <nikki> yeah nice |
20:33:53 | FromDiscord | <nikki> i'll consider this |
20:34:57 | FromDiscord | <nikki> hmm i guess i could do it the other way too where, there's a subfield, on which i add the destroy hook, that still can access the parent object |
20:35:08 | FromDiscord | <nikki> that might be nicer tbh |
20:35:48 | FromDiscord | <nikki> could allow this to be a reusable construct where the subfield type is generic and it just casts the ptr to itself to the parent type and calls a `userDestroy` hook on it |
20:35:59 | FromDiscord | <nikki> (the cast would work if the subfield is always the first member) |
20:49:52 | * | habamax quit (Quit: leaving) |
20:56:47 | Zevv | disruptek: smart man, think for me. |
20:57:15 | Zevv | I made a little tool in Lua ages ago, but I don't understand anymore how it works. I want to redo it in Nim. It's called "mp" which stands for "mathpipe" |
20:57:38 | disruptek | lemme get my pipe. |
20:57:43 | Zevv | You feed it an arbritrary text file where it looks for numbers in each line. Typically logs, measurements, or whatever kind of data |
20:57:50 | Zevv | The input of the tool is this log on stdin |
20:57:52 | disruptek | you put meth in the top, right? |
20:58:05 | Zevv | and a little expression which references the Nth number in the input lines |
20:58:23 | Zevv | so `avg($1)` would give me a running average of all the inputs from the 1st number in the line |
20:58:52 | Zevv | or `max($1) - min($2)` gives the difference between the min-up-to-now of the 1st and the max-up-to now of the 2nd |
20:59:00 | disruptek | !repo miller |
20:59:01 | disruptek | go on. |
20:59:02 | disbot | https://github.com/johnkerl/miller -- 9miller: 11Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON 15 2578⭐ 86🍴 7& 29 more... |
20:59:25 | Zevv | miller is close, but no cigar I think |
20:59:38 | Zevv | because the magic is in these expressions. I had highpass, lowpass, and whatever not. Any kind of maths |
20:59:46 | disruptek | so you've predefined the functions you can perform? |
21:00:10 | Zevv | yeah, that's a hard coded set. |
21:00:44 | disruptek | npeg runs at compile-time, so it seems like you can impl this in that. |
21:01:22 | Zevv | yeah but I do need a complete expression evaluator, and some kind of representation of the 'running parts' |
21:01:32 | Zevv | Like the avg(). It has history. It keeps a total of all inputs |
21:01:37 | disruptek | what's wrong with nimscript? |
21:01:45 | Zevv | true, true |
21:01:52 | Zevv | no bad |
21:02:12 | Zevv | miller has interesting ideas as well |
21:02:13 | Zevv | didn't know that one |
21:02:45 | Zevv | ho hmmm. let me whip something up |
21:03:25 | disruptek | i haven't used it. who has the energy to devote to yet another tool when you can just code something that will stay perfect for years? |
21:03:42 | Zevv | that's the spirit |
21:04:04 | Zevv | my lua thing has served me well for ages, but it's kind of over-abstracted in a monadian way |
21:04:17 | disruptek | seems like the right approach, honestly. |
21:04:43 | Zevv | it seems, because now that I look at it, it's pretty tiny. Because lua does the interpreting, it creates lua from lua |
21:04:47 | Zevv | lua is not unlike nim :) |
21:04:55 | disruptek | right. |
21:05:03 | FromDiscord | <nikki> totally, man |
21:05:13 | disruptek | i'm debating switching to using lua instead, in my tierra clone. |
21:05:24 | Zevv | do it man |
21:05:27 | FromDiscord | <nikki> lua is gud |
21:05:29 | Zevv | lua makes you a happy man |
21:05:34 | disruptek | i was excited about packedast at first but now i think it's flawed. |
21:05:37 | FromDiscord | <nikki> if you are using it in a place with executable mmap access, luajit will just kill everything |
21:05:42 | FromDiscord | <nikki> speed-wise |
21:05:55 | disruptek | it's really more about future applications. |
21:06:01 | Zevv | I did hefty real time audio stuff in luajit at 48.000hz |
21:06:25 | FromDiscord | <nikki> ya luajit calls c functions faster than c does |
21:06:41 | disruptek | i know, it's a bit of a mindfuck. |
21:06:51 | Zevv | *some* c functions |
21:06:52 | disruptek | !repo lunacy |
21:06:52 | disbot | https://github.com/disruptek/lunacy -- 9lunacy: 11a hack to let me work with some lua data more naturally 15 5⭐ 0🍴 |
21:07:00 | FromDiscord | <nikki> a lil mike pall rewriting your code to be better at runtime |
21:07:05 | disruptek | always be pluggin'. |
21:07:06 | FromDiscord | <nikki> "hey i noticed ur code sux" |
21:07:09 | Zevv | disruptek: was this why you were whining about stacks |
21:07:14 | FromDiscord | <nikki> "so i wrote a program to make it better, here" |
21:07:26 | disruptek | Zevv: yeah, packedast has made me grumpy. |
21:07:32 | disruptek | it's not the impl i had in mind originally. |
21:07:51 | Zevv | bah |
21:08:23 | disruptek | the problem is that i don't want any of this extra structure. |
21:08:37 | disruptek | i just want a single alloc and then i want to query the shit out of it from cache. |
21:09:01 | * | PMunch quit (Quit: leaving) |
21:09:06 | disruptek | and we're duplicating data out-of-phase and across modules and it's just going to shit. |
21:09:37 | Zevv | yeah we all want that |
21:09:46 | disruptek | btw, i meant to ask you... do you still have an npeg json? |
21:09:55 | FromDiscord | <alehander42> hey |
21:09:57 | Zevv | yeah its in the dist |
21:09:58 | FromDiscord | <alehander42> guys |
21:10:00 | Zevv | but hidden away |
21:10:03 | FromDiscord | <nikki> yeah json, do you have an npeg? |
21:10:07 | Zevv | because otherwise people will want to use it for something |
21:10:21 | * | narimiran quit (Quit: leaving) |
21:10:23 | Zevv | https://github.com/zevv/npeg/blob/master/tests/performance.nim#L65 |
21:10:28 | Zevv | It parses but does not collect, nor capture |
21:10:38 | disruptek | well, jason is getting faster, slowly, but i need to think about deserializing now. |
21:10:39 | Zevv | afaik it's complete and correct |
21:10:45 | Zevv | don't use npeg |
21:11:00 | disruptek | can't i just use it for tokenizing? |
21:11:13 | Zevv | well, you could, but not sure if it is worth the hassle |
21:11:18 | Zevv | parsing json is trivial as fuck |
21:11:21 | Zevv | recursive descend |
21:11:32 | disruptek | then why is packedjson so slow? |
21:11:35 | FromDiscord | <nikki> disruptek: i read about jason but i think i'm not totally sure i get it -- is teh idea that you serialize / deserialize to / from json string directly from the type instance, and the logic is comptile time generated from type meta info? |
21:11:36 | Zevv | it's almost like lisp with two kinds of brackets |
21:11:43 | Zevv | npeg is slower |
21:11:57 | FromDiscord | <nikki> there's this thing in c++ that seems to go fast: https://github.com/beached/daw_json_link |
21:12:03 | FromDiscord | <nikki> by doing sth like that |
21:12:10 | disruptek | the idea of jason is that we just skip all the bullshit. |
21:12:25 | disruptek | honestly, we don't need to do like 90% of what we do. |
21:12:43 | disruptek | and even jason is doing too much because concepts are too broken for me to use them. |
21:12:50 | disruptek | and don't get me started on typed macros. |
21:12:54 | FromDiscord | <nikki> yeah, like constructing an in memory spaghetti of references that you then just copy to a typed instance and then throw away? |
21:13:06 | disruptek | jason was poc for frosty. |
21:13:25 | disruptek | look at this: |
21:13:27 | disruptek | !repo flatty |
21:13:28 | disbot | https://github.com/treeform/flatty -- 9flatty: 11Flatty - tools and serializer for plain flat binary files. 15 5⭐ 1🍴 |
21:13:35 | disruptek | this is explicitly /not/ what i want. |
21:13:56 | disruptek | "i don't care." -- araq, 2020 |
21:14:02 | disruptek | i don't give a shit about types. |
21:14:08 | FromDiscord | <nikki> i'm probably gonna start with the std json when i need to do json serialization / deserialization in this game thing, then see how bad it is |
21:14:12 | FromDiscord | <nikki> and then use other things if its bad enough |
21:14:18 | Zevv | it's not bad |
21:14:22 | disruptek | look, i can give you my data, okay? can you just fucking serialize it for me? is that too much to ask of a macro? |
21:14:24 | FromDiscord | <nikki> cool |
21:14:24 | Zevv | it is perfectly ok for 95% of the use caes |
21:14:25 | disruptek | i don't think so. |
21:14:34 | * | disruptek yawns. |
21:14:47 | FromDiscord | <nikki> another thing i use it for is i'm down to keep this jsony dommy structure around just bc. i use it for undo buffer in the editor lol |
21:15:04 | disruptek | i mean, it's whatever. |
21:15:08 | disruptek | who really gives a shit. |
21:15:25 | FromDiscord | <nikki> apparently --- you? |
21:15:25 | disruptek | but i do hate a broken abstraction. |
21:15:27 | FromDiscord | <nikki> can't tell |
21:15:47 | disruptek | and i hate giving away performance when it buys me absolutely nothing. |
21:15:57 | Zevv | true, that |
21:16:02 | disruptek | and i hate not exploiting proper types. |
21:16:32 | disruptek | and i really can't see the point in machinery that i write prior to compile time but have to evaluate every single time i run my code. |
21:17:04 | disruptek | i mean, fuck. it's never the case that i cannot tell you what i expect a json operation to yield. |
21:17:19 | disruptek | why is that something that we need a computer to tell us every damned time? |
21:17:42 | disruptek | there's absolutely zero dynamicism here. |
21:17:49 | FromDiscord | <nikki> i guess it depends on if you're willing to be given random borked data over the network or whatever right? even in that case it's fine. the main thing is if you want some logic for "oh if this isn't present, do this" |
21:17:50 | Zevv | so go fix that shit! |
21:18:00 | disruptek | i did fix it. |
21:18:01 | FromDiscord | <nikki> but in that case i think you deserialize to some intermediate type and read from that |
21:18:31 | disruptek | jason has some room for improvement but it's already miles better than the other options. |
21:20:29 | disruptek | it doesn't deserialize at all. that's what i'm ruminating upon right now. |
21:21:24 | Zevv | What was the source of the "I don't care" |
21:22:59 | disruptek | there's a lot of stuff we don't care about and simply making that assertion let us remove it from the designs for the new ir. |
21:23:42 | Zevv | right |
21:24:04 | disruptek | caching doesn't make any sense when you can quickly evaluate anything at all. |
21:24:08 | disruptek | as an example. |
21:25:41 | disruptek | i just like the phrase because it captures the sense that we are trapped by our expectations for how software is designed and built. |
21:26:42 | Zevv | man that's pretty deep for a thursday night |
21:26:50 | disruptek | i don't care how json should be written. can i write it faster than anyone else with less code to boot? yes? then i don't care. |
21:27:22 | disruptek | jason is 355 lines with docs and examples. |
21:27:35 | Zevv | but man is it stupid |
21:27:47 | disruptek | yeah, it's not exactly brilliant. |
21:27:55 | disruptek | like i said, plenty of room for improvement. |
21:27:59 | Zevv | well, that was a positive thing, actually |
21:28:18 | Zevv | first time I read the source I scratched my head thinking what the hell is this about |
21:28:25 | Zevv | it's so dead obvious |
21:28:29 | disruptek | i dropped arrays from like 500 cycles to 150 last night. |
21:28:39 | disruptek | and there's more meat on the bone, still. |
21:29:06 | Zevv | do seqs |
21:29:18 | disruptek | come closer. |
21:29:22 | * | Zevv steps away |
21:30:07 | disruptek | the code that folds literals together isn't that fast. |
21:30:18 | disruptek | i just to just accumulate the result instead. |
21:30:28 | disruptek | er, i need to just. |
21:31:52 | * | xet7 joined #nim |
21:33:15 | * | xet7 quit (Remote host closed the connection) |
21:35:02 | * | xet7 joined #nim |
21:35:57 | * | solitudesf- is now known as solitudesf |
21:38:54 | * | FromDiscord quit (Remote host closed the connection) |
21:38:55 | Zevv | A lot of time is still spent in escaping I guess |
21:39:10 | * | FromDiscord joined #nim |
21:40:30 | disruptek | there are a couple allocs in there that can be taken out. |
21:43:54 | Zevv | how do you debug that stuff when you write it. expandMacro? |
21:44:08 | disruptek | sure. |
21:44:15 | disruptek | but mostly i read treeRepr. |
21:44:31 | disruptek | you should look at the output of my testes. it's unreal. |
21:47:37 | * | solitudesf quit (Ping timeout: 264 seconds) |
21:50:00 | Zevv | do I see right that compile time constant strings are not compile time escaped? |
21:51:23 | Zevv | and constant numbers are not stringified at compile time? |
21:51:39 | Zevv | or am I a bad seeer |
21:52:36 | disruptek | in jason? |
21:52:50 | Zevv | yea |
21:53:07 | disruptek | numbers, integers, strings.. all done at compile-time if possible. |
21:53:20 | Zevv | I thought so, but then I miss something in my repr output |
21:54:03 | disruptek | if you have something like a mixed-type tuple, it falls back to a slower impl i think. |
21:54:12 | disruptek | not everything is fully optimized out. |
21:54:29 | disruptek | but even the slower impls are 50-100% faster than stdlib. |
21:54:37 | Zevv | but. `12345.jason` |
21:54:55 | Zevv | does not pre-stringify the number. That's done at run time |
21:55:06 | Zevv | no i's not |
21:55:07 | Zevv | wait |
21:55:25 | Zevv | hm I'm stupid. |
21:55:34 | Zevv | I did `let o = 12345; o.json` |
21:55:40 | disruptek | i have commented out the term rewriting macro for literals, but yeah, i think we need to do something like that still. |
21:56:15 | disruptek | term rewriting macros are so powerful that i really think they shouldn't exist. |
21:56:26 | FromDiscord | <nikki> https://play.nim-lang.org/#ix=2D9X getting a "hey i'm copying the `path` string" warning from compiler about this -- logically i want to store the path in the resource but also as the key in the table so ... the copy is necessary right |
21:56:29 | Zevv | yeah but for cases like this |
21:56:37 | FromDiscord | <nikki> like there's no way to reorder this to make it not complain / not copy |
21:56:49 | * | xet7 quit (Remote host closed the connection) |
21:57:29 | disruptek | what do you mean by complain? |
21:57:35 | FromDiscord | <nikki> um this is also definitely happening alongside reading an decoding an image so it's fine |
21:57:46 | FromDiscord | <nikki> just a hint from the compiler: |
21:57:48 | FromDiscord | <nikki> Hint: passing 'tex.path' to a sink parameter introduces an implicit copy; if possible, rearrange your program's control flow to prevent it [Performance] |
21:58:07 | FromDiscord | <nikki> so not a complaint, just a suggestion |
21:58:19 | FromDiscord | <nikki> a helpful nudge, a word of advice |
21:59:19 | disruptek | i can't see how it could be rearranged. |
22:00:16 | FromDiscord | <nikki> yeah. i guess i can turn the hint off within that scope |
22:00:29 | disruptek | maybe if you gfx.texs[tex.path] = tex |
22:00:42 | FromDiscord | <nikki> huh interesting will try |
22:00:51 | * | xet7 joined #nim |
22:01:00 | disruptek | that'll make the last read the ctor. |
22:02:01 | FromDiscord | <nikki> ya nah same(-ish) issue |
22:02:53 | FromDiscord | <nikki> so this case is fine, tbh, i have another case where it's popping up that i was wondering about ... will paste |
22:03:21 | FromDiscord | <nikki> https://play.nim-lang.org/#ix=2D9Z |
22:03:36 | disruptek | i wonder if it makes a copy for the cstring. i wouldn't expect so but i dunno. |
22:03:41 | FromDiscord | <nikki> just collecting removable textures in a pass through the table, then removing them right after |
22:04:16 | FromDiscord | <nikki> the `toDestroy.add(tex.path)` seems to do a copy, and i was wondering if there was some other (maybe even more idiomatic) way to do this |
22:04:26 | FromDiscord | <nikki> interesting disruptek, i'll see if it does a copy, have the gen'd C handy |
22:05:38 | FromDiscord | <nikki> yea nah when passing to `cstring` it just passes a ptr to the string data, no copy |
22:05:51 | disruptek | just add the tex and not tex.path. then del(tex.path). |
22:06:05 | disruptek | seq[ref Texture] instead of [string] |
22:06:08 | FromDiscord | <nikki> nice one |
22:06:10 | FromDiscord | <nikki> yeah makes sense |
22:06:24 | FromDiscord | <nikki> i guess i could make it `seq[ref Texture {.cursor.}]` lolol |
22:07:09 | disruptek | while toDestroy.len > 0: gfx.texs.del(toDestroy.pop.path) |
22:07:40 | FromDiscord | <nikki> cool |
22:07:41 | disruptek | alloc the seq as the same size as the table, too. |
22:07:46 | disruptek | so it won't grow. |
22:07:51 | FromDiscord | <nikki> yeah nice |
22:08:32 | FromDiscord | <nikki> oh actually, on most frames this is not happening at all, so i think it's fine / better to not prealloc |
22:08:41 | FromDiscord | <nikki> since if there are no removals it won't alloc the seq at all |
22:09:04 | FromDiscord | <nikki> and when there are i think it's fine to -- either there's only a few removals and it maybe allocs just once, or there are many and unloading is the bottleneck anyways i think / it's at a game scene boundary |
22:09:36 | disruptek | well, you are the programmer. |
22:09:48 | FromDiscord | <nikki> 👌 |
22:09:56 | FromDiscord | <nikki> ^ do those show up as emoji for you or is it the discord text lol |
22:10:05 | disruptek | nah, it's emoji. |
22:12:10 | disruptek | they show up as green rectangles for zevv. |
22:12:26 | disruptek | whatfer staltler reasons. |
22:15:48 | Prestige | Is there a way to say a declared type conforms to a certain concept? I'm wanting it to apply to a ref object of RootObj |
22:15:59 | Zevv | http://zevv.nl/div/irc.png Protects me against disruptek-induced eye sore |
22:16:28 | FromDiscord | <nikki> irssi? |
22:16:34 | Zevv | sure |
22:16:39 | Zevv | what else |
22:16:48 | Zevv | I have to use slack 8 hours a day |
22:17:02 | Prestige | I'm so tired of slack |
22:17:22 | FromDiscord | <nikki> my cpu is probably more tired of slack than i am |
22:17:44 | Zevv | I had this chunky diarrhea for months, the kind that smells of vomit. I recently found out its because of slack |
22:17:57 | Prestige | slack basically freezes if I have a call open on another workspace |
22:18:00 | Zevv | I out-type slack as if I'm on 300bps |
22:18:08 | Prestige | lmao Zevv |
22:18:57 | disruptek | 1st world problems. |
22:19:19 | FromDiscord | <nikki> lol disruptek i may have thought of a nice way to do the clearing from map thing |
22:19:29 | FromDiscord | <nikki> it's to move the ref into the seq, and then just clear the seq (or not even clear it, is lost at end of scope) |
22:19:35 | FromDiscord | <nikki> that way doesn't inc/dec refcounts i think |
22:19:44 | disruptek | yep, that also works. |
22:20:46 | FromDiscord | <nikki> wait .. i guess i could literally just zero the ref in the table itself. ytf do i need a seq lmao |
22:21:25 | disruptek | because of mutation while traversing? |
22:21:47 | FromDiscord | <nikki> sry i'm dumb, i forgot the remove table entry part |
22:22:03 | FromDiscord | <nikki> i was thinking to zero the ref but not remove the entry .......... but then i need to remove the entry so yeah haha |
22:22:07 | FromDiscord | <nikki> yes the move approach works |
22:22:20 | disruptek | maybe you actually /don't/ need to remove the entry, though. |
22:22:48 | * | kinkinkijkin quit (Remote host closed the connection) |
22:22:58 | FromDiscord | <nikki> yeah that's a fair consideration. for now it feels right to not leave it there, but yeah |
22:23:06 | * | kinkinkijkin joined #nim |
22:24:41 | disruptek | but take my advice with a grain of salt. |
22:24:52 | disruptek | this is how i ended up in with a daughter in baton rouge. |
22:25:11 | FromDiscord | <nikki> what if i am that daughter |
22:25:27 | disruptek | are you in baton rouge? |
22:25:36 | Prestige | hm can't have a HashSet[MyConcept], dang. Is there a way to use concepts in collectios? |
22:25:41 | Prestige | collections* |
22:25:53 | disruptek | what did i just tell you about trying to get sexy with concepts? |
22:26:00 | disruptek | we just fucking went over this. |
22:26:31 | Zevv | seqsy |
22:26:31 | disruptek | what you are talking about is a MyConceptHashSet[T] concept. |
22:26:36 | Prestige | Lol I thought it would be basic functionality. I'm not sure where to draw the line on what concepts can be used with |
22:26:49 | disruptek | if you have to ask, you can't afford it. |
22:27:17 | disruptek | there are basically three corners to the triangle of pain. |
22:27:23 | disruptek | concepts, statics, and generics. |
22:27:52 | disruptek | you mix those together and you are in mratsim territory. woe be the coder who trespasses therein. |
22:28:12 | Zevv | so where does handling types in macros go, in your triangle? |
22:28:30 | disruptek | okay, so it's a tetrahedron of pain, wise guy. |
22:28:33 | Zevv | better make it a pentagram |
22:28:42 | disruptek | it's the 20-sided die of pain. |
22:28:54 | Zevv | 11 dimensions |
22:29:06 | FromDiscord | <nikki> just a sphere |
22:29:08 | FromDiscord | <nikki> pain everywhere |
22:29:11 | Prestige | hm I think this is not possible, then. Dang |
22:29:20 | Zevv | I still long for `macro foo[T]()` |
22:29:22 | disruptek | it's possible, chucklehead. |
22:29:49 | Prestige | I thought you said it isn't |
22:30:01 | FromDiscord | <nikki> how can i iterate a hash table without copying the key if i don't wanna use the key |
22:30:08 | disruptek | i'm just telling you that you're straying close to the black hole. |
22:30:10 | FromDiscord | <nikki> just looked at the gen'd code and it copies the string key lol |
22:30:31 | disruptek | use the values iterator. |
22:30:36 | FromDiscord | <nikki> ohoooooooooo |
22:30:47 | FromDiscord | <nikki> use the thing that was meant for what you wanna do, got it |
22:31:20 | Zevv | also, when just iterating you're not likely to copy the keys, i guess |
22:31:20 | disruptek | same advice applies to prestige. |
22:31:44 | disruptek | unless you're ready to ride that temptress, stay away from the black hole and use the thing that was meant for what you wanna do. |
22:31:57 | FromDiscord | <nikki> zevv i'm looking at the C and there's a string copy in there |
22:32:26 | Prestige | I think concepts are that thing, but are limited because it isn't a concrete type |
22:32:33 | Prestige | unless I'm missing something, here |
22:32:52 | disruptek | you can't define a type in terms of a concept unless that type is a concept. |
22:33:03 | disruptek | but generic concepts are a thing. |
22:33:17 | FromDiscord | <nikki> i'm curious what your usecase is Prestige |
22:33:22 | disruptek | it's just that, y'know, they don't really work well. |
22:33:54 | Prestige | @nikki I'm creating a spatial hash module, which takes objects that have a `getBounds(): Rectangle` proc |
22:34:29 | Prestige | an internal data structure holds this `Boundable` concept I've created, which doesn't compile |
22:34:41 | disruptek | ah, you want a converter that converts the concept type into the key type for your HashSet. |
22:34:49 | * | natrys quit (Ping timeout: 246 seconds) |
22:35:08 | disruptek | basically, an IntSet. don't expect to get the values back out, right? |
22:35:09 | FromDiscord | <nikki> are the values meant to be object values themselves, or refs / ptrs to object values? |
22:35:30 | Prestige | I suppose I could make it take a ref |
22:35:33 | FromDiscord | <nikki> if the latter you could just store a type erased ptr |
22:35:52 | FromDiscord | <nikki> idk if you can have an untyped ref that still preserves gc semantics tho? |
22:35:56 | FromDiscord | <nikki> am nim noob |
22:36:14 | FromDiscord | <nikki> probs not bc. the destructor needs to know the type right |
22:36:26 | * | Prestige shrugs |
22:36:29 | FromDiscord | <nikki> and i'm guessing it nim doesn't hold the destructor as a ptr in the ptr bc that sucks |
22:36:30 | Prestige | I also don't know |
22:37:06 | Prestige | disruptek: Yeah I want to get the object back from this HashSet |
22:37:28 | Prestige | well, the Rectangle... maybe I could just use that |
22:38:15 | Prestige | nope, scratch that, I do need the object back from the set |
22:39:04 | FromDiscord | <nikki> another consideration is to just hold ids to lookup in another table |
22:39:07 | Prestige | Previously I was using a particular object that has a getBounds(): Rectangle proc, but would be nice if I could use concepts to make it more generic |
22:39:34 | Prestige | Yeah, that's possible too |
22:39:37 | FromDiscord | <nikki> personally for a spatialhash api it'd be nice if the api just held ids and i did the resolution myself so i can do the data storage, but, depends |
22:40:32 | disruptek | Araq: can you give me a hook so i can start some integration tests? |
22:41:16 | disruptek | i need just some kinda call with the graph at the point where we're passing it into ic so i have some data to work with. |
22:42:14 | Prestige | Yeah idk, just going to revert back and give up on using concepts |
22:42:31 | disruptek | don't wimp out now. |
22:42:44 | Prestige | If you have ideas I'm all ears |
22:42:44 | FromDiscord | <nikki> yeah maybe not a good time to invest in it for a core construct? |
22:43:21 | disruptek | i told you what i'd do. |
22:43:23 | FromDiscord | <nikki> i think the id approach seems nice. like i'd want a spatial hash to do the hashing. but not necessarily the data layout for the associated data. |
22:43:34 | FromDiscord | <nikki> unless it's actually meant to be a container but .. |
22:44:10 | Prestige | It's just a cell of a spatial grid that holds the objects (or refs to the objects, rather) |
22:44:39 | FromDiscord | <nikki> and the cell can be of various types? why do you need a concept for the cell type itself i guess |
22:45:06 | * | sagax quit (Remote host closed the connection) |
22:45:14 | Prestige | The concept is for the stored object, since the requirement is just for the object to have that getBounds proc |
22:45:29 | * | tane quit (Quit: Leaving) |
22:45:51 | FromDiscord | <nikki> ah i see |
22:46:30 | disruptek | that's not how concepts work. |
22:46:37 | Prestige | This is the current working file: https://play.nim-lang.org/#ix=2Dab |
22:46:39 | disruptek | they are literally user-defined typeclasses. |
22:46:46 | Prestige | Where GameObject has the getBounds proc |
22:46:54 | disruptek | it's a typeclass with very fine control over its definition. |
22:47:58 | FromDiscord | <nikki> yeah i think generally, a concept makes sense in places about type instantiation / parameterization, but maybe not places where types come up for storage layout |
22:48:38 | FromDiscord | <nikki> eg. -- parameters of generic procs, yes. types for fields or for values of concrete containers -- maybe not? |
22:49:03 | FromDiscord | <nikki> but yeah the concept of a container where the elems satisfy a concept makes sense. that's just not a type |
22:49:14 | Prestige | Right |
22:50:05 | disruptek | what you are talking about is a MyConceptHashSet[T] concept. |
22:50:20 | Prestige | How does that work? |
22:50:36 | Zevv | well that is a nice suprise. My nim version works and it's half the size of the lua one" |
22:50:51 | disruptek | ah, but you had to understand the lua one first. |
22:50:56 | disruptek | kinda defeats the purpose, right? |
22:50:57 | Zevv | I did this one pragmatic |
22:51:03 | Zevv | and simpler |
22:51:05 | disruptek | is it slower? |
22:51:09 | Zevv | it's way faster |
22:51:22 | FromDiscord | <nikki> Prestige -- why would the spatial hash structure not be generic over the contained type? |
22:51:37 | FromDiscord | <nikki> if it were you can just have a `HashSet[T]` right |
22:51:37 | Prestige | I want to make it generic |
22:51:49 | disruptek | dude. |
22:51:56 | Prestige | the only prob is I need T to be `Boundable` |
22:51:59 | FromDiscord | <nikki> ok so can you just make it a hash set of T instead of of the concept |
22:52:11 | FromDiscord | <nikki> yes, that's ok. but then you can just have a HashSet[T] no? |
22:52:21 | Prestige | Hmm let me try |
22:52:41 | disruptek | you can't have a hashset of a non-concrete type. |
22:53:00 | Prestige | That's what I thought |
22:53:15 | Prestige | but it seems like you're saying there's some way to do it |
22:53:20 | FromDiscord | <nikki> what i was getting at disruptek was -- if they had `type SpatialHash[T] = object ... theHashSet: HashSet[T]` |
22:53:28 | disruptek | that's why i said, "have a converter that converts Boundable to your HashSet's type" |
22:53:33 | FromDiscord | <nikki> and they also say that `T` has to satisfy a concept somewhere |
22:53:52 | FromDiscord | <nikki> idk what the syntax for that is bc. i'm a noob and talking out of myturn |
22:54:30 | disruptek | nikki: that's generic to each Boundable type, though, right? |
22:54:36 | Prestige | just because I need the bounds of T via a `getBounds` proc, for my use. The other way is to just have them provide T and a Rectangle, but I am trying to see if I can have T just be an object that has `getBounds` |
22:54:49 | Prestige | but afaik it isn't possible with nim atm |
22:55:03 | disruptek | anything is possible. |
22:55:09 | disruptek | you could box the objects, for example. |
22:55:25 | Prestige | I do have gloves |
22:55:32 | disruptek | but i really don't see what this buys you. |
22:55:37 | FromDiscord | <nikki> do you want a single spatial hash to contain multiple elem types? |
22:55:49 | FromDiscord | <nikki> if so then you def need some kind of boxing / type erasure right |
22:56:05 | Prestige | Yeah, if I could just store the pointer or something |
22:56:23 | disruptek | well, you can. |
22:56:27 | FromDiscord | <nikki> and it then has to runtime dispatch to the bounds, unless the bounds call is only done through some call where the concrete type is known (eg. add[T](...) from some other code) |
23:04:53 | FromDiscord | <alehander42> hm |
23:06:43 | disruptek | sasha who did you vote for? |
23:06:54 | disruptek | WHOM? |
23:09:10 | Prestige | Why am I getting an error here? https://i.imgur.com/1pMogOo.png cannot instantiate: 'SpatialCell[T]'; Maybe generic arguments are missing? |
23:09:59 | disruptek | hard to tell without seeing the rest of the code. |
23:10:11 | disruptek | make sure SpatialCell is defined in the same type block. |
23:10:21 | disruptek | the compiler thinks it's generic. |
23:15:46 | * | lritter quit (Ping timeout: 256 seconds) |
23:15:52 | Prestige | this is getting crazy. lol |
23:17:42 | FromDiscord | <nikki> huh you have a T -> Rectangle table for the bounds? |
23:18:31 | FromDiscord | <Avatarfighter> i assume T is going to be the object |
23:18:36 | Prestige | Yeah |
23:18:45 | FromDiscord | <Avatarfighter> but why wouldn't you then store the bounds of the object inside the object itself? |
23:18:56 | Prestige | I'd like to avoid that, which is what I'm trying currently |
23:19:09 | FromDiscord | <Avatarfighter> Why is that Prestige? I'm really curious now |
23:19:42 | FromDiscord | <nikki> hmm needing the object to be hashable so that it can be a key for that table seems 🤔 unlesss they are usually ptrs or refs or sth and the hash is based on the address? |
23:20:22 | FromDiscord | <Avatarfighter> 🤷♀️ |
23:20:22 | Prestige | I do store the bounds inside the object, which is why I'd like to make this take an object with a getBounds proc |
23:20:29 | Prestige | so I can avoid the table |
23:21:02 | FromDiscord | <Avatarfighter> Is this for a game? |
23:21:06 | Prestige | I'm trying with boxing atm and I feel like I'm walking into generics hell |
23:21:10 | Prestige | Yeah |
23:21:19 | FromDiscord | <Avatarfighter> is the game a drawn game? |
23:21:19 | Prestige | Converting my engine from TS to Nim |
23:21:29 | Prestige | drawn? |
23:21:38 | FromDiscord | <Avatarfighter> Sorry I mean does it have textures |
23:21:50 | Prestige | Yeah - it's this game for reference https://astroships.einheit.tech/ |
23:22:04 | FromDiscord | <Avatarfighter> Because you could get away with using the sizing of the texture itself to get the bounds of the object |
23:22:25 | Prestige | the texture and collision bounds don't always match though |
23:22:27 | FromDiscord | <nikki> er, i think it's usually the other way round: have an actual bounds, use that to decide how to scale the texture when rendering |
23:22:46 | FromDiscord | <nikki> texture sizes are in image coordinates which are diff from world size |
23:22:49 | FromDiscord | <Avatarfighter> yeah |
23:23:00 | FromDiscord | <Avatarfighter> hm |
23:23:14 | FromDiscord | <nikki> it seems like you don't need the concept and you could just call `val.getBounds`? |
23:23:21 | FromDiscord | <nikki> and do the concept check elsewhere |
23:23:54 | Prestige | Yeah, that's essentially what I want. I haven't used concepts before, trying to figure this out |
23:24:03 | FromDiscord | <Avatarfighter> I still think that using the texture as the bounds would work best if the actual texture and collision bounds were the same |
23:24:11 | Prestige | They aren't |
23:24:22 | FromDiscord | <Avatarfighter> Yeah that's what I feared lmao |
23:24:34 | FromDiscord | <Avatarfighter> I was trying to save you those valuable bits in memory 😛 |
23:25:09 | FromDiscord | <nikki> you want to be able to redraw textures at a higher res and not have your level objects suddenly be at a different size |
23:25:15 | FromDiscord | <nikki> or same for lower res, or whatever |
23:25:32 | FromDiscord | <Avatarfighter> Yeah I understand |
23:27:26 | Prestige | well I think I'm just confusing myself at this point. |
23:28:58 | FromDiscord | <nikki> separate q: is there something similar to a built-in hashed string type in nim? |
23:29:14 | FromDiscord | <nikki> like something that can hash at compile time, and stores the hash along with the value in the object |
23:29:26 | FromDiscord | <nikki> by built-in i mean in the stdlib, sorry |
23:31:15 | disruptek | you mean like for accelerating a string cache? |
23:32:30 | FromDiscord | <nikki> yeah sth like that. in this case i was gonna use it for this thing where ... i'm loading something that has parameter names that bind at runtime, but then the code sets some common parameters that are compile time known |
23:32:42 | FromDiscord | <nikki> but like, whether those parameters exist / which ones exist for that object are defined at runtime |
23:33:00 | FromDiscord | <nikki> and there's very few of them, so it makes sense to use a seq of eg. (hash, value) pairs bc. the whole thing will fit in a cache line immediately |
23:33:07 | FromDiscord | <nikki> vs. using a table per one of these objects |
23:33:23 | FromDiscord | <nikki> i think i'll just work with it by keeping a hash value |
23:35:25 | Prestige | This is what I came up with for boxing the Boundable concept, which is very wrong and does not compile: https://play.nim-lang.org/#ix=2Dax |
23:35:41 | Prestige | Lost on what could/should be done here. I'm just confused, now |
23:35:59 | FromDiscord | <nikki> mmmmmm it seems like there's too much going on |
23:36:01 | FromDiscord | <nikki> haha |
23:36:29 | FromDiscord | <nikki> have u thought about the store an id approach? |
23:37:35 | * | NimBot joined #nim |
23:37:43 | Prestige | I was thinking of storing a pointer, but I think you can't use that in a collection either |
23:39:15 | FromDiscord | <nikki> pretty sure a pointer in a collection could work |
23:39:45 | FromDiscord | <nikki> the id idea is: the user of this data structure / the outside world is storing the objects, and just passes those ids to this data structure |
23:40:53 | Prestige | I suppose I could do that, yeah. Wish I could just use concepts in a simple way like an interface, though :P |
23:41:26 | FromDiscord | <nikki> i kind of like that the language doesn't add runtime dispatch automatically like that ¯\_(ツ)_/¯ |
23:41:34 | FromDiscord | <nikki> altho to be fair, closures are that kind of thing |
23:48:14 | Prestige | eh, I think the best solution atm is to just use GameObject that has getBounds |
23:59:37 | disruptek | the idea of the box is that it holds different types of object. |