00:11:01 | FromDiscord | <sOkam! π«> yeah i resorted to seq just because the array vers was failing |
00:18:28 | FromDiscord | <wick3dr0se> Is there a way to pass a url of a png without downloading it to disk? I want to pass the png image, not the url itself |
00:20:12 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "Is there a way": what do you mean by "pass"? pass to where from where? |
00:24:04 | FromDiscord | <Elegantbeef> Leroize you just made me play with converters + concepts and made me crash the compiler! |
00:25:04 | FromDiscord | <Elegantbeef> leorize even π |
00:25:05 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4Ilv |
00:25:05 | FromDiscord | <Elegantbeef> I wanted to not need to call `toUint8` here but `converter`s explode the compiler |
00:25:06 | FromDiscord | <Elegantbeef> Well the converter + concepts seem to |
00:25:34 | FromDiscord | <leorize> I guess it couldn't figure out how to handle recursive conversion induced by concepts matching |
00:25:50 | FromDiscord | <Elegantbeef> There shouldnt be any recursive conversions |
00:26:13 | FromDiscord | <wick3dr0se> In reply to @heysokam "what do you mean": From DALL-E image create endpoint to DALL-E image create edit endpoint |
00:26:32 | FromDiscord | <wick3dr0se> My imageGen proc outputs a url which contains the png image |
00:26:51 | FromDiscord | <leorize> on playground it doesn't seem to crash without the call |
00:27:02 | FromDiscord | <leorize> it doesn't compile either but that's something else \:P |
00:27:02 | FromDiscord | <Elegantbeef> uhh |
00:27:13 | FromDiscord | <Elegantbeef> It locks the compiler |
00:27:21 | FromDiscord | <Elegantbeef> When using `converter` |
00:27:47 | FromDiscord | <leorize> ah only now I noticed that you're not using converter |
00:28:34 | FromDiscord | <leorize> https://play.nim-lang.org/#ix=4Ilw \<- nothing is happening with this |
00:29:03 | FromDiscord | <Elegantbeef> Well yea you need to tell it to use the converter |
00:29:11 | FromDiscord | <Elegantbeef> and once you do that you crash the compiler quickly |
00:29:41 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "From DALL-E image create": that doesn't really tell me much, since i don't know how your app communicates with dalle |
00:29:57 | FromDiscord | <wick3dr0se> https://github.com/wick3dr0se/openai-nim |
00:30:04 | FromDiscord | <wick3dr0se> I commented where I am struggling |
00:30:38 | FromDiscord | <leorize> got the repro, I guess time for a bug report |
00:30:41 | FromDiscord | <sOkam! π«> im not gonna read that lib just to answer the question, my man π¦β΅you can explain the problem better and im sure everyone here will be able to help (including me) |
00:31:04 | FromDiscord | <wick3dr0se> Its 3 procs. I think it would be much easier if you did |
00:31:08 | FromDiscord | <Elegantbeef> I was going to fix it, but the compiler is just trying to print a mismatch so fixing it seems hellish |
00:31:42 | FromDiscord | <wick3dr0se> Like 80 SLOC |
00:32:26 | FromDiscord | <wick3dr0se> Its hard to explain what I want exactly because thats the issue. Idk exactly what I need to do |
00:32:50 | FromDiscord | <sOkam! π«> i still don't understand the problem, because you really didn't explain what you want to do |
00:32:56 | FromDiscord | <wick3dr0se> I checked Python and JS implementations of the API but they don't directly translate to Nim |
00:33:02 | FromDiscord | <sOkam! π«> its not about reading it or not, its about explaining the issue so that people can help |
00:33:24 | FromDiscord | <sOkam! π«> code is not self-explanatory |
00:33:24 | FromDiscord | <wick3dr0se> I want to pass a png to the API request. Currently it's a url of a png |
00:33:34 | FromDiscord | <sOkam! π«> whats the format of that png? |
00:34:05 | FromDiscord | <sOkam! π«> oh you said so, its a png. and what does your interface require as input? |
00:34:10 | FromDiscord | <sOkam! π«> (edit) "oh you said so, its a png. and what does your ... interface" added "target" |
00:34:16 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4Ilx |
00:34:18 | FromDiscord | <sOkam! π«> (edit) "png." => "url." |
00:34:33 | FromDiscord | <wick3dr0se> The body expects a png image. I am passing the url to that proc |
00:35:02 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "The body expects a": but you just said that your png is just an url |
00:35:18 | FromDiscord | <sOkam! π«> and your body expects the actual bytes of the image? is that so? |
00:35:22 | FromDiscord | <wick3dr0se> It is a url of a png image generated by DALL-E |
00:35:33 | FromDiscord | <wick3dr0se> Well it says in the API it only accepts a png image |
00:35:44 | FromDiscord | <wick3dr0se> But I dont want to download it to disk |
00:35:48 | FromDiscord | <wick3dr0se> Just to pass it back to edit |
00:35:58 | FromDiscord | <sOkam! π«> how are you going to read it if you don't download it? |
00:36:17 | FromDiscord | <wick3dr0se> I'm not knowledgable enough to know lol |
00:36:30 | FromDiscord | <sOkam! π«> well, then your question has nothing to do with dalle or pngs |
00:36:56 | FromDiscord | <wick3dr0se> My buddy who is, said that the url is raw bytes and that it could be passed somehow directly but Idk wtf hes talking about |
00:36:56 | FromDiscord | <sOkam! π«> the questions in reality is:β΅`How to readFile from an url instead of from the disk?` |
00:37:04 | FromDiscord | <sOkam! π«> (edit) "questions" => "question" |
00:37:15 | FromDiscord | <wick3dr0se> Yea but half the battle of finding answers is not knowing what to look for |
00:37:51 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "My buddy who is,": i mean, an url is technically bytes, because its a string |
00:38:14 | FromDiscord | <sOkam! π«> if he meant the stream of data from said url thats very different |
00:38:30 | FromDiscord | <wick3dr0se> Ok heres a scenario.. Like I want to use it in my Discord bot. I dont want to download the image to the server everytime someome makes an edit request |
00:38:31 | FromDiscord | <sOkam! π«> (edit) "the question in reality is:β΅`How to readFile from an url ... instead" added "into memory" |
00:39:27 | FromDiscord | <sOkam! π«> yeah, well, the image needs to go into your app, and then up into the api again... if the target api itself does not have the ability to download that url itself |
00:39:50 | FromDiscord | <wick3dr0se> sent a long message, see http://ix.io/4Ily |
00:40:20 | FromDiscord | <sOkam! π«> that is still downloading it, really |
00:40:41 | FromDiscord | <wick3dr0se> So is the way I'm doing it valid? |
00:40:49 | FromDiscord | <sOkam! π«> idk if the http module has that feature, the docs for it should tellβ΅but in any case, that would still be downloading the data |
00:41:15 | FromDiscord | <wick3dr0se> My concern was that it wouldnt work with Discord downloading it.. The API cost money and I dont want to endlessly test it |
00:41:22 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "So is the way": im not saying its valid or invalid. I'm just mentioning that you said you don't want to download it... but you also need the bytes inside your app |
00:41:45 | FromDiscord | <sOkam! π«> if that's not whats going on, then i don't understand your problem, because the explanation is a bit lacking in info. so would be expected |
00:43:30 | FromDiscord | <wick3dr0se> Well from what your saying downloading is the only choice I have. So since learning that now then I suppose its what I have to do. I believe my approach does that but I may have to switch to downloadFile.. |
00:44:25 | FromDiscord | <wick3dr0se> At this point anything that works is what matters. If it makes a png get passed back to that request, I am happy |
00:47:24 | FromDiscord | <sOkam! π«> @wick3dr0se i think your confusion and/or not knowing what to do in this situation is coming from a lack of understanding and mental models for how to deal with inputs/outputs in programming in general |
00:47:49 | FromDiscord | <sOkam! π«> at least it feels that way, because of the way you explained the problem initially |
00:48:07 | FromDiscord | <wick3dr0se> Yea thats about right |
00:48:31 | FromDiscord | <wick3dr0se> I would just Google it if I knew how |
00:49:09 | FromDiscord | <wick3dr0se> These are learning projects |
00:51:42 | FromDiscord | <sOkam! π«> sent a long message, see http://ix.io/4IlC |
00:52:22 | FromDiscord | <sOkam! π«> (edit) "http://ix.io/4IlC" => "https://paste.rs/t8J5P" |
00:53:14 | FromDiscord | <sOkam! π«> inputs/outputs are always data of some type, that is true for all programming in general, and that data needs to be compatible if you are going to connect it into another input (a function, or an api, etc) |
00:54:36 | FromDiscord | <sOkam! π«> sent a long message, see http://ix.io/4IlD |
00:55:12 | FromDiscord | <wick3dr0se> I'm far from technical but that makes sense. I was hoping I could just send it from one endpoint to the next but my initial thought was downlosding it and sending it as an actual png with something like open(). I have tampered with files verrrry few times and few as in like 2. And that was in C. Nim is the first programming language I'm trying to write shit I'll actually use in |
00:55:39 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "I'm far from technical": nim has `readFile` that does the reading automatically |
00:56:07 | FromDiscord | <wick3dr0se> Thats what I used. I guess it should work. Not sure what my errors are then but I'll check it out soon |
00:56:18 | FromDiscord | <sOkam! π«> just to compare it to that `open()` you mention, because nim has an actual stdlib (unlike C) π |
00:56:32 | FromDiscord | <sOkam! π«> C's stdlib is as raw barebones as it gets, lol |
00:57:25 | FromDiscord | <wick3dr0se> My output is a url (string), yes. And I need to accept a url into that proc and do the conversion to png within, if that makes more sense |
00:57:31 | FromDiscord | <sOkam! π«> what does your target api expect? |
00:58:14 | FromDiscord | <wick3dr0se> I can code you any bash script but dont ask me why it works or wtf anything means. I just slap stuff together |
00:58:23 | FromDiscord | <wick3dr0se> png |
00:58:27 | FromDiscord | <sOkam! π«> but how |
00:58:53 | FromDiscord | <sOkam! π«> png how, as a url that the api will download?β΅as a stream of bytes?β΅how exactly |
00:59:08 | FromDiscord | <sOkam! π«> outputs are not just ambiguous data types, they need to have an exact format |
00:59:50 | FromDiscord | <wick3dr0se> sent a long message, see http://ix.io/4IlF |
00:59:56 | FromDiscord | <wick3dr0se> Thats the image field required by the API |
01:00:14 | FromDiscord | <sOkam! π«> does it ask you for width/height properties? |
01:00:14 | FromDiscord | <wick3dr0se> Ima just download it and pass it, its fine |
01:00:33 | FromDiscord | <wick3dr0se> Not for input, only for output |
01:00:52 | FromDiscord | <wick3dr0se> sent a long message, see http://ix.io/4IlI |
01:00:55 | FromDiscord | <sOkam! π«> so that string is actually a `bytebuffer`, am i understanding? |
01:01:12 | FromDiscord | <wick3dr0se> Has to be.. Thats how Python does it |
01:01:24 | FromDiscord | <wick3dr0se> But idk much about that to try and explain anything |
01:01:35 | FromDiscord | <sOkam! π«> kk. and i understand your target has no way to download images by itself, right? |
01:02:00 | FromDiscord | <sOkam! π«> if you give it a url, does it download it? or does it require the bytebuffer instead |
01:02:19 | FromDiscord | <sOkam! π«> there might be a different api function for it (maybe) |
01:03:04 | FromDiscord | <wick3dr0se> Not without handling it internally. I cant pass a url directly to it or it errors out. It should require the bytebuffer as you mentioned which I think is what my buddy is getting at |
01:04:10 | FromDiscord | <sOkam! π«> right, yeah. and your buddy is probably very used to low-level coding, and its telling you about downstreamed bytebuffers as if they were nothing difficult to reason about or learn π€·ββοΈ |
01:06:49 | FromDiscord | <sOkam! π«> @wick3dr0se do you -need- the data to not go into the disk of where your app is running?β΅because if you don't, the process will be a crap-ton easier |
01:07:24 | FromDiscord | <wick3dr0se> Yea he works at Microsoft and speaks gibberish |
01:07:53 | FromDiscord | <wick3dr0se> I probably dont require that. My only reasoning was the Discord bot. I was worried it wouldnt download to a server if I decide to host it or something |
01:08:02 | FromDiscord | <wick3dr0se> My experience is little with stuff like this |
01:08:28 | FromDiscord | <sOkam! π«> sent a code paste, see https://play.nim-lang.org/#ix=4IlJ |
01:08:34 | FromDiscord | <sOkam! π«> pseudocode, ofc |
01:09:22 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "I probably dont require": downloading to file is the same as downloading to memory. only difference is in disk usage, not in data streamedβ΅so that sounds like you probably don't need to worry about it at all |
01:09:25 | FromDiscord | <wick3dr0se> Thanks a lot.. Sorry for the confusion |
01:09:46 | FromDiscord | <wick3dr0se> As usual I'm overcomplicating things |
01:09:49 | FromDiscord | <sOkam! π«> no worries, programming can be difficult to reason about. and nobody teaches reasoning, only coding β°οΈ |
01:10:06 | FromDiscord | <sOkam! π«> programming is reasoning, not punching code. but that is explained very little |
01:10:49 | FromDiscord | <sOkam! π«> @wick3dr0se https://www.youtube.com/watch?v=azcrPFhaY9k BIG recommend. this helped me massively when I started |
01:11:07 | FromDiscord | <wick3dr0se> Lol no kidding. I've learned a shit load especially last few weeks. Decides to write a Discord bot and then needed AI in it and Nim (that I could find) has no decent OpenAI module |
01:11:29 | FromDiscord | <sOkam! π«> In reply to @wick3dr0se "Lol no kidding. I've": waelcome to codinggs π |
01:11:46 | FromDiscord | <sOkam! π«> every damn project turns out overcomplex like that, like 99% of the time |
01:12:05 | FromDiscord | <wick3dr0se> Thats why I was also hoping someone might see it, have the knowledge and wanna contribute it. Most people like to keep things to themselves tho |
01:12:08 | FromDiscord | <sOkam! π«> we humans suck at understanding the actual complexity of what we have in front of us |
01:13:03 | FromDiscord | <wick3dr0se> Lmao its a serious struggle. I have some addiction to the pain of learnjng things the hard way too. Like in bash I write TUI's in pure bash instead of using ncurses.. Idk why I do these things to myself |
01:17:23 | FromDiscord | <sOkam! π«> this is turning into #offtopic, but don't know if you knew that if you say "Bash syntax" three times at night in front of a mirror you summon a demon π |
01:19:28 | termer | wick3rdr0se You can create your own OpenAI client pretty easily |
01:19:32 | termer | It's just HTTP |
01:19:39 | termer | at least the parts of the API that you need |
01:19:45 | termer | I assume you only need GPT |
01:25:14 | FromDiscord | <wick3dr0se> In reply to @termer "wick3rdr0se You can create": Yea they appear to all be POST request. I havent had an issue implementing anything other than this image edit shit. But I plan to keep it public so anyone can use it. No point in everyone writing their own |
01:29:02 | FromDiscord | <wick3dr0se> You have to put a card on file tho to use an API key. It does charge so I doubt many want to write it themselves. If anyone feels like contributing and wants to further the module or help me learn new stuff, feel free to contribute. All I do is write open source shit, so it'll stay there and be maintained. My team will eventually pick it up with me |
01:56:30 | termer | They used to give out free credits without CC, not sure if they still do |
02:47:40 | * | rockcavera quit (Read error: Connection reset by peer) |
02:48:00 | * | rockcavera joined #nim |
02:48:00 | * | rockcavera quit (Changing host) |
02:48:00 | * | rockcavera joined #nim |
03:02:05 | * | azimut_ joined #nim |
03:02:39 | * | azimut quit (Ping timeout: 252 seconds) |
04:21:18 | * | nyeaa4928423010 quit (Read error: Connection reset by peer) |
04:21:46 | * | nyeaa4928423010 joined #nim |
04:27:21 | * | tiorock joined #nim |
04:27:21 | * | tiorock quit (Changing host) |
04:27:21 | * | tiorock joined #nim |
04:27:21 | * | rockcavera is now known as Guest406 |
04:27:21 | * | tiorock is now known as rockcavera |
04:29:34 | * | Guest406 quit (Ping timeout: 272 seconds) |
05:16:15 | * | derpydoo joined #nim |
06:58:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4ImN |
06:59:40 | FromDiscord | <Phil> I'm currently in the experimental phase for my code so I just look for what goes, not if it's basically the necronomicon |
06:59:49 | FromDiscord | <Phil> (edit) "goes," => "goes to achieve the structure I want," |
07:00:03 | FromDiscord | <odexine> In reply to @isofruit "Question, why does this": wdym "why does this work"? |
07:00:06 | FromDiscord | <odexine> what's the mysterious part |
07:00:16 | FromDiscord | <odexine> it's also pretty cursed |
07:00:43 | FromDiscord | <odexine> also no you cannot ref-ify a value without a copy |
07:01:06 | FromDiscord | <Phil> But I wanna though.... |
07:01:19 | FromDiscord | <Elegantbeef> Too bad heap allocate and move it |
07:01:28 | FromDiscord | <Elegantbeef> `ref` is a gc'd data type, a `ptr` is not |
07:02:07 | FromDiscord | <Elegantbeef> In the above you have not provided a reason not to use `var int` |
07:02:12 | FromDiscord | <Phil> In reply to @odexine "what's the mysterious part": The mysterious part is that by the time it reaches echo, a is A(num: 5).β΅Even though I'd assume 5 is a value type and thus my entire addr bit was my first assumption to not work at all, that was me throwing dumb code around |
07:02:33 | FromDiscord | <Phil> In reply to @Elegantbeef "In the above you": Imagine to5 is in fact a proc that generates an owlkettle widget which wishes to capture x in a callback |
07:02:51 | FromDiscord | <Phil> Try that with var int and you get:β΅`'fieldValue' is of type <var float> which cannot be captured as it would violate memory safety, declared here: /home/philipp/dev/owlkettle/owlkettle/autoform.nim(35, 33); using '-d:nimNoLentIterators' helps in some cases. Consider using a <ref var float> which can be captured.` |
07:03:14 | FromDiscord | <odexine> when you do `for field, value in a[].fieldPairs` value is expanded into `a[].<field name>` |
07:03:41 | FromDiscord | <odexine> fieldpairs is a compile time loop expansion |
07:06:08 | FromDiscord | <Elegantbeef> Right you cannot capture `var T` as that can exist on the stack |
07:06:08 | FromDiscord | <Elegantbeef> If you know it's not on the stack and is a safe pointer you can just capture the address |
07:06:35 | FromDiscord | <Elegantbeef> Or if you know the value stays alive for long enough |
07:10:24 | FromDiscord | <Phil> In reply to @Elegantbeef "If you know it's": I can't know that ahead of time.β΅I can't know the fields on `A` basically and must assume that some of them will be value types |
07:10:37 | FromDiscord | <Elegantbeef> You should just force using `ref T` |
07:10:43 | FromDiscord | <Elegantbeef> `ref T` fields can be captured |
07:14:52 | FromDiscord | <Phil> sent a long message, see http://ix.io/4ImR |
07:15:25 | FromDiscord | <Phil> (edit) "http://ix.io/4ImR" => "http://ix.io/4ImT" |
07:16:11 | FromDiscord | <Elegantbeef> All your procs have to 'thunk' the field access so you have to pass appstate everywhere |
07:17:57 | FromDiscord | <Phil> Yeah I feared that =/β΅So I can't get rid of AppState and generating expressions from there... I wonder if I can assign a callback to a widget instead of declaring the callback on the widget |
07:18:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ImU |
07:19:13 | FromDiscord | <Elegantbeef> Otherwise you can force all fields on the object to be references |
07:21:28 | FromDiscord | <Elegantbeef> For instance |
07:21:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ImV |
07:24:30 | FromDiscord | <Phil> I don't think I want to limit owlkettle users like that for fields on their general `<Widget>State` just for this feature.β΅However, I think I found a different approach:β΅I just realized I can pass the changed proc as a parameter and that should work just fine! |
07:24:58 | * | nyeaa4928423010 quit (Read error: Connection reset by peer) |
07:25:13 | * | nyeaa4928423010 joined #nim |
07:26:33 | FromDiscord | <Elegantbeef> I don't even know what feature you're talking about |
07:26:53 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4In0 |
07:26:56 | FromDiscord | <Elegantbeef> "Generate a form" meaning you want to automate making inspectors? |
07:27:12 | FromDiscord | <Phil> In reply to @Elegantbeef ""Generate a form" meaning": Somewhat, for the most part it's for playing around with the examples in an easier fashion |
07:27:27 | FromDiscord | <Phil> Allows you to manipulate the widget fields at runtime to see what they can do |
07:27:28 | FromDiscord | <Elegantbeef> You could use a template to achieve this |
07:28:34 | FromDiscord | <Phil> I've had trouble with templates for the gui section of owlkettle before so I didn't try that, hmmm |
07:30:09 | FromDiscord | <Phil> Basically here a small example on what the goal is for owlkettle examples https://media.discordapp.net/attachments/371759389889003532/1160116842728271923/Screencast_from_2023-10-07_09-27-43.webm?ex=65337e01&is=65210901&hm=008fdf47189aad2c774e1692a01907f3b329572426363dd89868bb9897675ba6& |
07:30:33 | FromDiscord | <Phil> Generating a form came out of "Wow, I am writing a lot of forms currently, that is very annoying" |
07:30:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4In1 |
07:32:30 | FromDiscord | <Elegantbeef> Using templates gives you over-loadable dispatch, so you can make each UI element per type and there should not be any issues |
07:34:01 | FromDiscord | <Elegantbeef> It should not be much different to writing a serialisation library in Nim |
07:34:22 | FromDiscord | <Elegantbeef> define a template for all your primitives and then one for `tuple or object` and then you have like 99% of your objects working |
07:34:31 | FromDiscord | <Phil> I have done neither before and I'm trying to translate your example into how I would implement that for generating forms for owlkettle ^^' |
07:34:37 | FromDiscord | <Elegantbeef> still need `distinct` and friends |
07:34:51 | FromDiscord | <Elegantbeef> Replace my code with a `gui: ...` block |
07:35:23 | FromDiscord | <Elegantbeef> Same with the `makeInspector[T: ref]` proc |
07:35:28 | FromDiscord | <Elegantbeef> Each template handles generating it's own tree that goes under your form |
07:35:50 | FromDiscord | <Elegantbeef> Arguably the entry proc should be a template aswell |
07:36:38 | FromDiscord | <Elegantbeef> If unclear why templates over procs it's so the `fields` iterator does not do `paramter.field` it'll always be `a.b.c.d.e.f` |
07:37:35 | FromDiscord | <Elegantbeef> As such you do not have any issue with the capturing as it's directly on the root ref object |
07:37:38 | FromDiscord | <mihara_ichirou> sent a code paste, see https://play.nim-lang.org/#ix=4In2 |
07:38:02 | FromDiscord | <mihara_ichirou> (edit) |
07:38:31 | FromDiscord | <Elegantbeef> You can just do `{.cast(gcSafe).} : echo "token ", token` |
07:39:19 | FromDiscord | <Elegantbeef> If this is not multi-threaded you can do `--threads:off` |
07:39:47 | FromDiscord | <Phil> In reply to @Elegantbeef "As such you do": I'll eat first and hack away at a reimplementation based on templates in the hopes of it working.β΅If it does, that would be pretty fire |
07:40:03 | FromDiscord | <Elegantbeef> Well I know a guy if you get stuck |
07:40:13 | * | blop_ quit (Ping timeout: 252 seconds) |
07:40:23 | FromDiscord | <Elegantbeef> But it's nearing his bed time |
07:40:53 | FromDiscord | <mihara_ichirou> In reply to @Elegantbeef "You can just do": Yes, but a) this time it's actually multithreaded, b) wait, can I do this just for the one statement that uses the variable and leave the rest of the proc untouched? |
07:41:00 | FromDiscord | <Elegantbeef> Yes |
07:41:19 | FromDiscord | <Elegantbeef> Anything under that ugly as sin cast pragma is no longer considered for gcsafety |
07:41:37 | FromDiscord | <Phil> In reply to @Elegantbeef "Well I know a": It's fine, it's more likely that I'll have all the kinks worked out be this evening anyway |
07:42:10 | FromDiscord | <Elegantbeef> Well make sure it's reusable |
07:42:28 | FromDiscord | <Elegantbeef> I can see an automatic inspector very useful for things like brushes in an art program |
07:42:39 | FromDiscord | <mihara_ichirou> In reply to @Elegantbeef "Anything under that ugly": Yay, that worked. Still, this seems extremely crude, and there should be a legit way to do it. |
07:43:08 | FromDiscord | <Phil> Ah you mean reuseable as in useable for owlkettle users |
07:43:37 | FromDiscord | <Elegantbeef> Could even implement user defined pragmas for things like slider ranges π |
07:43:38 | FromDiscord | <Phil> That's the long haul for this feature. Step 1 is make the examples decent.β΅Step 2 make a "playground" feature |
07:44:03 | FromDiscord | <odexine> In reply to @mihara_ichirou "Yay, that worked. Still,": it would probably be better not to use globals |
07:44:06 | FromDiscord | <Phil> Where users can just get inspectors for their own stuff |
07:45:25 | FromDiscord | <mihara_ichirou> In reply to @odexine "it would probably be": Sure, and what should I use if I can't pass a parameter into the proc (because whatever library actually calls it does not let me) ? |
07:46:20 | FromDiscord | <Elegantbeef> I was nearing towards implementing that auto inspector, but then remembered I often use object variants so it's hell on earth π |
07:47:03 | FromDiscord | <Elegantbeef> For my own GUI stuff not for owlkettle |
07:47:08 | FromDiscord | <Phil> I mean, conceptually I think it's doable (?) |
07:47:39 | FromDiscord | <Elegantbeef> Well object variants arent the worse it's also my complex requirements |
07:47:44 | FromDiscord | <Phil> Generate a list of fields each possible variant has at compiletime, when you encounter the variant check its kind and generate a form based on that? |
07:47:47 | FromDiscord | <Elegantbeef> Like only always walkable tiles should show a text entry field |
07:48:10 | FromDiscord | <Phil> (edit) "kind" => "kind, select the right list of fields (well fieldNames more like)" |
07:48:16 | FromDiscord | <Elegantbeef> Only tiles that are always walkable should also have a drop down for placables |
07:49:37 | FromDiscord | <Elegantbeef> I mean `field`s iterators work on variants so it's not that bad, but I also do want selective logic for things |
07:57:22 | FromDiscord | <Phil> In reply to @Elegantbeef "I mean `field`s iterators": Question about your template approach again |
07:57:36 | FromDiscord | <Phil> So the template returns a proc that generates the widget? Is that the approach? |
07:58:16 | FromDiscord | <Elegantbeef> No |
07:58:22 | FromDiscord | <Elegantbeef> The template returns the `gui:` block |
07:58:43 | FromDiscord | <Elegantbeef> I set result to be a proc to demonstrate it was infact a closure |
08:02:01 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4In4 |
08:02:29 | FromDiscord | <Elegantbeef> Yes that |
08:02:36 | FromDiscord | <Elegantbeef> Right owlkettle is untyped |
08:02:51 | FromDiscord | <Elegantbeef> Untyped macros suuuuuck π |
08:03:13 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4In5 |
08:03:33 | FromDiscord | <Elegantbeef> Well then try returning a proc |
08:04:01 | FromDiscord | <Phil> As in `template toFormField(fieldValue: typed, fieldName: static string): proc(): Widget =`? |
08:04:14 | FromDiscord | <Elegantbeef> Right |
08:05:33 | FromDiscord | <Elegantbeef> I don't recall if that's valid |
08:06:05 | FromDiscord | <Phil> Nope, triggers the same error, it just refuses to have a `gui` block inside a `template` |
08:06:16 | FromDiscord | <Elegantbeef> It's not the gui block inside the template |
08:06:22 | FromDiscord | <Elegantbeef> It's the fact that gui is an untyped macro |
08:07:08 | FromDiscord | <Elegantbeef> A proc call inside gui should be a widget name |
08:09:39 | FromDiscord | <Elegantbeef> This is the issue with `untyped` and why araq what's to remove it |
08:10:08 | FromDiscord | <Elegantbeef> wants\ |
08:11:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4In8 |
08:11:25 | FromDiscord | <Phil> Though I guess I should push fieldName as a template parameter |
08:12:36 | FromDiscord | <Elegantbeef> That works but it'll fall apart for anything like `((x, y: int),)` |
08:12:51 | FromDiscord | <Elegantbeef> Atleast from what i can tell |
08:12:56 | FromDiscord | <Elegantbeef> also your template has no return type |
08:13:13 | FromDiscord | <Elegantbeef> also why such an ugly `return` |
08:13:17 | FromDiscord | <Elegantbeef> `= state.numberFIeld(fieldName)` π |
08:15:08 | FromDiscord | <Phil> Becuase I want numberField to work for both the expressions `state.getField(fieldName) ` as well as `state.getField(fieldName)[index]` |
08:15:25 | FromDiscord | <Phil> I just want to throw in the expressiont hat generates the direct field access on state and insert that into the code-block that generates the widget |
08:15:31 | FromDiscord | <Phil> (edit) "expressiont hat" => "expression that" |
08:18:02 | FromDiscord | <Elegantbeef> Ugh it's a shame about the gui macro, no real pluggable way to do this |
08:35:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Ine |
08:37:25 | * | azimut_ quit (Ping timeout: 252 seconds) |
08:44:23 | FromDiscord | <Elegantbeef> Right like i said |
08:44:43 | FromDiscord | <Elegantbeef> It does not compose |
08:44:43 | FromDiscord | <Elegantbeef> You need to generate this using a macro |
08:45:35 | FromDiscord | <Phil> Yeah I give up there, that's starting into macro on macro action where one of those macros is the entire gui-dsl of owlkettle and that seems too large for me to wrap my head around |
08:47:17 | FromDiscord | <Elegantbeef> Just cross your fingers and hope for removal of `untyped` π |
08:47:38 | FromDiscord | <Phil> My macro skills are firmly in the "Can write his own macro and understand semi-simple macros" category, not "Can understand an entire DSL that was written in a style unlike his own" category |
08:53:56 | FromDiscord | <vindaar> How are untyped identifiers supposed to work if `untyped` macros were removed, anyway? Would we grow a `nnkUntypedIdent` kind of node that a macro argument of `untyped` would use? |
08:54:16 | FromDiscord | <Elegantbeef> `nnkIdent` would appear if there was no symbol |
08:54:29 | FromDiscord | <Elegantbeef> `nnkSymChoice` would appear if there was a symbol |
08:55:33 | FromDiscord | <vindaar> I guess that could work |
09:03:53 | FromDiscord | <Phil> I wonder how my nim knowledge stacks up at this point, given the points of comparisons I've got "decisively average" seems fitting |
09:04:11 | FromDiscord | <Elegantbeef> But that's my knowledge level |
09:04:54 | FromDiscord | <Phil> Bah, you are decisively above average.β΅At the lowest I give you "average of above average" |
09:09:26 | FromDiscord | <mratsim> In reply to @ezquerra "Blame <@570268431522201601> π": blame Fortran |
09:12:30 | * | junaid_ joined #nim |
09:17:58 | * | Zevv joined #nim |
09:23:47 | FromDiscord | <mratsim> https://lemire.me/blog/2023/10/07/web-server-hello-world-benchmark-go-vs-node-js-vs-nim-vs-bun/ |
09:42:51 | FromDiscord | <leetnewb> is it reasonable to compare a standard library http server to httpbeast? |
09:53:18 | FromDiscord | <Phil> Given that I have trouble seeing "fairness" in benchmark, eh. |
09:53:25 | FromDiscord | <Phil> (edit) "benchmark," => "benchmarks, my response is" |
09:58:02 | FromDiscord | <0ffh> In reply to @mratsim "https://lemire.me/blog/2023/10/07/web-server-hello-": Lol, yeah just saw it on HN. |
09:58:02 | FromDiscord | <0ffh> https://news.ycombinator.com/item?id=37799331 |
09:58:21 | FromDiscord | <0ffh> Came here to post, but.... |
09:58:27 | FromDiscord | <0ffh> second! π |
10:01:42 | FromDiscord | <0ffh> In reply to @isofruit "Given that I have": Totally with you, but in a way I think it might be nice advertisement.β΅The conclusion is more or less "If you want an easy time coding, this is what you get. I wanted to try C++, but it was so painful that I couldn't be bothered." |
10:03:16 | FromDiscord | <0ffh> Sound like an endorsement in a way. |
10:03:25 | FromDiscord | <0ffh> Sounds like an endorsement in a way. |
10:07:05 | FromDiscord | <Phil> In reply to @0ffh "Totally with you, but": I mean I agree, but I actually get annoyed by it |
10:07:17 | FromDiscord | <Phil> Because every benchmark immediately becomes a reputation battle |
10:07:48 | FromDiscord | <Phil> And given that you can optimize the crap out of everything given the right tools, it becomes a battle of who is willing to burn the most amount of time to optimize memory moves and copies etc. |
10:08:32 | FromDiscord | <Phil> Which means ultimately it comes down to who has the largest community (assuming you have the baseline tools to control memory etc.). |
10:09:03 | FromDiscord | <Phil> (edit) "etc.)." => "etc.).β΅Because benchmark code is rarely ever about "this is the naive implementation", it is "Who gets the most roided out implementation just shy of writing highly optimized assembly"" |
10:09:23 | FromDiscord | <0ffh> In reply to @isofruit "Which means ultimately it": You're quite right there, that's part of the charm of this one. It's just "Let's solve this in the most easy way and see what comes off it." |
10:09:23 | FromDiscord | <Phil> (edit) "Which means ultimately it comes down to who has the largest community (assuming you have the baseline tools to control memory etc.).β΅Because benchmark code is rarely ever about "this is the naive implementation", it is "Who gets the most roided out implementation ... just" added "making use of every highly advanced language feature" |
10:10:38 | FromDiscord | <0ffh> So in a way, it takes productivity into account. |
10:11:10 | FromDiscord | <0ffh> Even emphasizes it. |
10:11:45 | FromDiscord | <ezquerra> Is `proc loadLibPattern(pattern: string; globalSymbols = false)` supposed to work on Windows? |
10:12:00 | FromDiscord | <ezquerra> That is, is it possible to pass a pattern to the dynlib pragma on windows? |
10:12:45 | FromDiscord | <ezquerra> For example, you have a dll that might or might not start with "lib", can you use a dynlib pattern to find the dll in both cases? |
10:14:51 | FromDiscord | <0ffh> In reply to @isofruit "Which means ultimately it": Oh, maybe I didn't quite get your point there! π
β΅Of course your point stands insofar as all the optimization effort doesn't really go away, but is just shifted to the library implementation. |
10:17:23 | FromDiscord | <0ffh> (But even though, I find it hard to imagine Go code that's faster than Nim. Gross algorithmic misconduct excluded.) |
11:10:06 | * | gshumway quit (Quit: .) |
11:12:09 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4InH |
11:15:20 | * | gshumway joined #nim |
11:17:54 | FromDiscord | <demotomohiro> In reply to @user2m "I'm using the autome": https://nim-lang.org/docs/exitprocs.htmlβ΅Or you can use defer |
11:23:57 | * | gshumway quit (Quit: .) |
11:24:15 | * | gshumway joined #nim |
11:26:39 | * | gshumway quit (Client Quit) |
11:27:27 | * | junaid_ quit (Remote host closed the connection) |
11:28:56 | FromDiscord | <saint._._.> In reply to @isofruit "Which means ultimately it": Benchmarks have to be about looking at the code too. I feel itβs useful if people can make the case of how easy it is to write whatever case the benchmark test is. |
11:29:25 | FromDiscord | <saint._._.> (edit) "Benchmarks have" => "A somewhat useful benchmark has" |
11:31:48 | * | gshumway joined #nim |
11:47:14 | * | junaid_ joined #nim |
13:29:19 | NimEventer | New thread by sls1005: Details about procedures and their pointers, see https://forum.nim-lang.org/t/10533 |
13:48:30 | FromDiscord | <nnsee> In reply to @leetnewb "is it reasonable to": it doesn't matter either way, microbenchmarks like this are all meaningless |
13:48:51 | FromDiscord | <nnsee> but I see that's already been discussed here |
13:53:54 | * | junaid_ quit (Remote host closed the connection) |
13:56:56 | * | junaid_ joined #nim |
14:17:10 | * | antranigv quit (Read error: Connection reset by peer) |
14:17:26 | * | antranigv_ joined #nim |
15:10:48 | * | antranigv_ is now known as antranigv |
15:12:17 | FromDiscord | <mratsim> In reply to @nnsee "it doesn't matter either": A full http server is not really a microbenchmark though |
15:36:53 | Zevv | last time I checked https://github.com/disruptek/httpleast was about 5x faster than httpbeast and mummy. but it is indeed just a microbenchmark |
15:37:56 | Zevv | because it's far from a "Full HTTP server" |
16:25:30 | NimEventer | New thread by lou15b: Effects of calls to Garbage Collector when using ARC/ORC?, see https://forum.nim-lang.org/t/10534 |
17:03:42 | * | derpydoo quit (Read error: Connection reset by peer) |
17:23:37 | * | azimut joined #nim |
17:32:44 | * | azimut quit (Remote host closed the connection) |
17:33:03 | * | azimut joined #nim |
17:52:00 | * | tiorock joined #nim |
17:52:00 | * | tiorock quit (Changing host) |
17:52:00 | * | tiorock joined #nim |
17:52:00 | * | rockcavera quit (Killed (copper.libera.chat (Nickname regained by services))) |
17:52:00 | * | tiorock is now known as rockcavera |
17:52:30 | * | derpydoo joined #nim |
18:49:14 | * | junaid_ quit (Remote host closed the connection) |
19:09:19 | FromDiscord | <luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IpN |
19:12:22 | FromDiscord | <guttural666> I did this with a variant type before |
19:12:34 | FromDiscord | <nang4403> Hi |
19:13:06 | FromDiscord | <fakecrafter> @luxurymode yeah I'm also using it right now and it seems legit |
19:13:50 | FromDiscord | <guttural666> In reply to @luxurymode "I'm pretty new to": you can take a look at this, keep in mind that I'm a Nim noob and this is not finished: https://gitlab.com/hansdampfinger666/abap_modern/-/blob/main/src/lexer_types.nim?ref_type=heads |
19:14:31 | FromDiscord | <luxurymode> In reply to @guttural666 "you can take a": oh awesome, thanks a lot |
19:14:51 | FromDiscord | <luxurymode> In reply to @fakecrafter "<@389604138943643649> yeah I'm also": "it" being the book or Nim? π |
19:14:52 | FromDiscord | <guttural666> In reply to @luxurymode "oh awesome, thanks a": TokenData is the variable data part, I think that's what you mean |
19:15:18 | FromDiscord | <fakecrafter> i meant the enum object variants |
19:15:25 | FromDiscord | <luxurymode> ah gotcha |
19:15:51 | FromDiscord | <fakecrafter> I think they're really cool and useful. at least i can imagine so |
19:16:13 | FromDiscord | <luxurymode> In reply to @guttural666 "TokenData is the variable": Thanks. I think that's right. Assuming my current understanding of what the author intended in the book I'm going through is correct in the first place... |
19:17:39 | FromDiscord | <guttural666> In reply to @luxurymode "Thanks. I think that's": I'm rewriting this rn and I dumbed everything down to just Token(kind: enum, str: string) and I just use the string, if there is original content (meaning user defined identifiers or numbers etc.), probably depends on your needs |
19:18:30 | FromDiscord | <luxurymode> In reply to @guttural666 "I'm rewriting this rn": right |
19:18:39 | FromDiscord | <guttural666> but I just want to tokenize and parse and correct code etc. for interpretation etc. you'd probably need properly typed fields |
19:21:39 | * | azimut quit (Ping timeout: 252 seconds) |
19:22:04 | FromDiscord | <luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IpQ |
19:22:58 | FromDiscord | <luxurymode> identifier refers to, for example, if you have `var a = ...` `a = b` then `b` is an identifier? |
19:24:13 | FromDiscord | <guttural666> a and b would be yeah |
19:24:14 | FromDiscord | <luxurymode> or am I way off π |
19:24:25 | * | azimut joined #nim |
19:24:30 | FromDiscord | <guttural666> string probably means a string literal like 'hello' |
19:24:37 | FromDiscord | <fakecrafter> sent a code paste, see https://play.nim-lang.org/#ix=4IpT |
19:24:40 | FromDiscord | <guttural666> number likewise a 1212 |
19:24:40 | FromDiscord | <luxurymode> In reply to @guttural666 "string probably means a": right |
19:25:39 | FromDiscord | <luxurymode> I think what I'm unclear on is if I use a discrimated union here, then I really have to have a `case` for each and every one of my `TokenType`s right? |
19:25:46 | * | xet7 quit (Remote host closed the connection) |
19:26:13 | FromDiscord | <luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IpU |
19:26:48 | FromDiscord | <guttural666> In reply to @fakecrafter "does anyone have a": unsure if it's possible to do that from "outside", I am currently just counting the line breaks I encounter while reading the file (see strutils.NewLines) |
19:26:51 | FromDiscord | <luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IpV |
19:28:00 | FromDiscord | <guttural666> (edit) "strutils.NewLines)" => "strutils.NewLines)β΅which can either be done by reading the file into memory beforehand with readFile and then looping over the chars or you could read the file line by line and count the lines" |
19:29:09 | * | xet7 joined #nim |
19:29:33 | FromDiscord | <fakecrafter> yeah kinda thought of that |
19:29:51 | FromDiscord | <fakecrafter> but thx |
19:31:33 | FromDiscord | <guttural666> In reply to @luxurymode "I think I was": normally the left hand side (mystring) is considered an identifier and the right hand side a string literal in this example code (analogous for numbers):β΅var mystring = "This is my string"β΅var myint = 1 |
19:32:42 | FromDiscord | <luxurymode> In reply to @guttural666 "normally the left hand": right |
19:33:06 | FromDiscord | <guttural666> (edit) "In reply to @luxurymode "I think I was": normally the left hand side (mystring) is considered an identifier and the right hand side ... a" added "(This is my string)" |
19:36:56 | * | nyeaa4928423010 quit (Ping timeout: 255 seconds) |
19:38:09 | * | mal`` quit (Quit: Leaving) |
19:39:12 | FromDiscord | <guttural666> In reply to @fakecrafter "yeah kinda thought of": anybody know how to restart the Lsp in Vim? nimlsp just exits as soon as I open a Nim file it seems https://media.discordapp.net/attachments/371759389889003532/1160300311911604325/image.png?ex=653428df&is=6521b3df&hm=2a60f86ba10ca46f017614c232d8e507fb986a03a94741a1ff6a8c34c5f79e39& |
19:39:46 | FromDiscord | <fakecrafter> I use emacs lol |
19:42:20 | FromDiscord | <nnsee> In reply to @guttural666 "anybody know how to": depends entirely on your lsp plugin |
19:43:08 | FromDiscord | <nnsee> but maybe try `:e` |
19:44:45 | * | azimut quit (Ping timeout: 252 seconds) |
19:44:49 | FromDiscord | <luxurymode> In reply to @guttural666 "anybody know how to": depends on the lsp client you're using, like with coc.nvim it's `:CocRestart`. Other than that `:q` and reopen Vim is the best I got lol |
19:44:57 | * | Zevv left #nim (#nim) |
19:45:15 | FromDiscord | <guttural666> In reply to @nnsee "depends entirely on your": nimlsp by Peter |
19:45:42 | FromDiscord | <guttural666> In reply to @luxurymode "depends on the lsp": PC restart now π |
19:45:58 | FromDiscord | <luxurymode> In reply to @guttural666 "PC restart now π": lmao. Just get a new computer altogether |
19:45:58 | * | azimut joined #nim |
19:46:39 | * | xet7 quit (Remote host closed the connection) |
19:47:06 | FromDiscord | <luxurymode> In reply to @guttural666 "nimlsp by Peter": I think they meant like are you using vim-lsp, for example |
19:47:20 | FromDiscord | <luxurymode> not which lang server itself |
19:48:57 | * | nyeaa4928423010 joined #nim |
19:50:01 | * | xet7 joined #nim |
19:50:07 | FromDiscord | <guttural666> I'm relatively clueless in this matter, I just installed nimlsp through nimble, I do have CoC installed, but I didn't have to configure the LSP through CocConfig, it just kinda worked with the guide on the nimlsp github page |
19:52:32 | FromDiscord | <luxurymode> In reply to @guttural666 "I'm relatively clueless in": you and me both |
19:53:51 | FromDiscord | <guttural666> dunno what happened, nimlsp did work in Vim lately, just updated my plugins, nothing, still just nimlsp: exited |
19:54:04 | FromDiscord | <guttural666> god, I don't want to go back to MS Code |
19:54:08 | FromDiscord | <guttural666> (again) |
20:04:12 | * | mal`` joined #nim |
20:12:36 | FromDiscord | <guttural666> In reply to @luxurymode "you and me both": just shot you a pn, dunno if that arrived |
20:19:02 | FromDiscord | <Chronos [She/Her]> Is code contained within `runnableExamples` blocks ran during doc generation to ensure it's correct? |
20:19:27 | FromDiscord | <Chronos [She/Her]> In reply to @guttural666 "just shot you a": Unrelated but Anarchist? |
20:24:28 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "Is code contained within": this seems like it would be very easy to test :p |
20:24:52 | FromDiscord | <Chronos [She/Her]> True but I am also multitasking rn by writing good docs for my code- |
21:19:33 | * | xet7 quit (Remote host closed the connection) |
21:42:27 | FromDiscord | <Chronos [She/Her]> Procrastination on writing code by writing docs now that I can release them automatically on new tag release |
21:42:56 | FromDiscord | <Chronos [She/Her]> I'm gonna mass-update my stuff on Nimble to link to the doc pages :p |
21:43:27 | * | xet7 joined #nim |
21:55:19 | FromDiscord | <guttural666> any easy way to create a set from the array above at compile time without writing it by hand? https://media.discordapp.net/attachments/371759389889003532/1160334564594561054/image.png?ex=653448c6&is=6521d3c6&hm=deee0697e9a07fe49eeaa003d1e42f77dcc3e840b649940817796e1eb8b41be0& |
22:00:07 | FromDiscord | <Chronos [She/Her]> In reply to @guttural666 "any easy way to": https://nim-lang.org/docs/sets.html this may help ya o7 |
22:02:13 | FromDiscord | <Chronos [She/Her]> Rn I'm wondering if I should make my ULID impl fallback to using the `random` module instead of `sysrand` in the very unlikely chance it isn't available, since the spec does say 'secure source of randomness if available' |
22:04:43 | FromDiscord | <guttural666> In reply to @chronos.vitaqua "https://nim-lang.org/docs/sets.html this may help": don't think a hash set is warranted with <100 elements |
22:06:20 | FromDiscord | <Chronos [She/Her]> Doesn't seem like any other option rip |
22:09:03 | FromDiscord | <sOkam! π«> In reply to @guttural666 "don't think a hash": if you need an ordinal set, then take the TokenKinds and turn them into a set at compiletime either with a `compiletime` proc or with a `static: ...` block |
22:09:32 | FromDiscord | <sOkam! π«> aka by looping through your array and `result.incl kind` |
22:10:53 | FromDiscord | <sOkam! π«> also, you should probably do `array[TokenKind, char]`.... instead of tuples like its not nim what you are writing π |
22:11:30 | FromDiscord | <sOkam! π«> enum arrays are a thing, and a really useful one |
22:12:14 | FromDiscord | <guttural666> what type would those bad boys be in the [] in array[TokenKind, char]? |
22:12:24 | FromDiscord | <guttural666> anonymous tuple? |
22:12:29 | FromDiscord | <sOkam! π«> no, just chars |
22:12:36 | FromDiscord | <sOkam! π«> chars in an array indexed by your tuple |
22:13:03 | FromDiscord | <sOkam! π«> enums are an ordinal type, and they can be used to index arrays like any other number |
22:13:51 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Rn I'm wondering if": Locking it behind a compiletime define |
22:14:09 | FromDiscord | <Chronos [She/Her]> Also would make my library work on js ig |
22:15:33 | FromDiscord | <guttural666> In reply to @heysokam "enums are an ordinal": is this what this kind of initialization is? I was very confused when I saw something like this in my old code (lol) and sifting through Mastering Nim didn't make it clearer: https://media.discordapp.net/attachments/371759389889003532/1160339660913004554/image.png?ex=65344d85&is=6521d885&hm=d8c6d34b5a8142dac211c9864503a180c7687c521487d1b78d51a2dcb9f73d8b& |
22:16:31 | FromDiscord | <Elegantbeef> Yes that is |
22:16:45 | FromDiscord | <Elegantbeef> you also can just do `const pls: array[YourEnum, char] = [Bleh: 'a', Meh: 'b']` |
22:18:48 | FromDiscord | <guttural666> very cool, I think I understand, is there a technical name for this so I can reference it in docs? |
22:19:34 | FromDiscord | <guttural666> In reply to @Elegantbeef "you also can just": don't quite understand that, doesn't Bleh have to be an int ord(YourEnum) |
22:19:54 | FromDiscord | <Elegantbeef> Nope |
22:19:55 | FromDiscord | <Elegantbeef> Nim has enum indexed arrays |
22:19:55 | FromDiscord | <Elegantbeef> It internally does all that inanity for you |
22:20:05 | FromDiscord | <Elegantbeef> Not that there is any inanity to do |
22:20:25 | FromDiscord | <Elegantbeef> Enums are just named integers |
22:20:32 | FromDiscord | <guttural666> In reply to @Elegantbeef "Enums are just named": indeed |
22:23:41 | FromDiscord | <guttural666> okay this is really good, I just wrote all this mapping shit down to have the string representation of my tokens (some have string representations some are single chars that I want to compare to my Lexer.current_char etc.) π https://media.discordapp.net/attachments/371759389889003532/1160341704277233664/image.png?ex=65344f6c&is=6521da6c&hm=e37d80b2f714f697d2ec29ac7b25e110d362b166a0e76df9b25c15f6f5d1a66d& |
22:24:01 | FromDiscord | <Elegantbeef> You don't need the kind |
22:24:20 | FromDiscord | <Elegantbeef> You've just made an array with a tuple |
22:24:57 | FromDiscord | <guttural666> exactly and accessing those vals is crap |
22:25:02 | FromDiscord | <Chronos [She/Her]> Making a type for that seems better tbh |
22:25:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Iqr |
22:25:33 | FromDiscord | <Chronos [She/Her]> It most likely won't ever be an issue, but |
22:25:34 | FromDiscord | <Elegantbeef> Then you can use `parseEnum` or you own macro to parse the enums |
22:26:54 | FromDiscord | <guttural666> In reply to @Elegantbeef "Also you can just": that is what I had previously but I always had to deal with converting substrings str[from..to] to chars etc. |
22:27:26 | FromDiscord | <Elegantbeef> use an proc that has `openArray[char]` |
22:27:52 | FromDiscord | <Elegantbeef> I don't get the issue of slicing |
22:28:24 | FromDiscord | <guttural666> we talked about this before π I'll have to do some reading on that |
22:28:31 | FromDiscord | <guttural666> thanks! |
22:47:13 | FromDiscord | <guttural666> how do I get the idx out again when looping? https://media.discordapp.net/attachments/371759389889003532/1160347629633404929/image.png?ex=653454f1&is=6521dff1&hm=758866496ec00b3545db2647943994e292c7d142fd49c4f3f51304d14a3604d3& |
22:47:31 | FromDiscord | <Elegantbeef> `for x, y in z.pairs` |
22:47:35 | FromDiscord | <guttural666> right |
22:50:25 | FromDiscord | <guttural666> and accessing the enum by index again? https://media.discordapp.net/attachments/371759389889003532/1160348431768883270/image.png?ex=653455b0&is=6521e0b0&hm=216a3107d49be374534eed744c1ee2d6399ddbe3e2046b60fe5eebe61368ff57& |
22:51:02 | FromDiscord | <sOkam! π«> In reply to @guttural666 "and accessing the enum": `TokenKind(idx)` |
22:51:08 | FromDiscord | <sOkam! π«> remember, enums are just integers |
22:51:18 | FromDiscord | <guttural666> yesss, nice |
22:51:21 | FromDiscord | <guttural666> thanks |
22:51:49 | FromDiscord | <guttural666> yeah, just expected the index access as with arrays and sequences |
22:52:07 | FromDiscord | <Elegantbeef> idx is already a TokenKind |
22:52:13 | FromDiscord | <Elegantbeef> There is no need to convert |
22:52:44 | FromDiscord | <sOkam! π«> explicit is clearer to read, though |
22:53:08 | FromDiscord | <guttural666> yeah, just realized, so idx is a bad name |
22:53:28 | FromDiscord | <Elegantbeef> It's already declared as an enum indexed array they only way to get more explicit is to add swearing |
22:53:45 | FromDiscord | <sOkam! π«> you should probably do `for kind, token in keywords`... and just `result = kind` |
22:53:54 | FromDiscord | <guttural666> now we're cooking https://media.discordapp.net/attachments/371759389889003532/1160349310827905084/image.png?ex=65345681&is=6521e181&hm=b81f056c51cdbfc5c685252886938fb3f02009eb4a2fd6b817e137fb8e756829& |
22:54:06 | FromDiscord | <sOkam! π«> yeah exactly |
22:54:08 | FromDiscord | <Elegantbeef> `return kind` |
22:54:15 | FromDiscord | <Elegantbeef> No reason for using result if you're just going to return |
22:54:34 | FromDiscord | <guttural666> I know, all WIP |
22:55:25 | FromDiscord | <guttural666> Nim is awesome |
23:17:16 | FromDiscord | <sOkam! π«> 100% |
23:17:43 | FromDiscord | <sOkam! π«> the readability tools of this lang are top of the game, by a big margin |
23:25:28 | FromDiscord | <user2m> does std/paths still exist? https://nim-lang.org/docs/paths.html#%2F%2CPath%2CPath |
23:25:52 | FromDiscord | <user2m> `import std/paths` yields an error on nim 1.16.12 |
23:26:33 | FromDiscord | <user2m> ahh ok I se it's v 2.0 only |
23:28:46 | FromDiscord | <sOkam! π«> In reply to @user2m "`import std/paths` yields an": it was introduced in 2.0β΅you -could- use it in 1.16.... but you have to pull about 5k-6k lines of dependency code (i did it, and it worked while i was waiting for 2.0)β΅if you must use that old version, its doable. but its tedious, not worth the effort unless you really plan on sticking to that old vers for a while |
23:34:26 | FromDiscord | <user2m> In reply to @heysokam "it was introduced in": nahh this works fine for me https://github.com/achesak/nim-pythonpathlib |
23:34:45 | FromDiscord | <user2m> In reply to @heysokam "it was introduced in": I don't know why but i've only ever had trouble with 2.0 so I try ntot o use it |
23:35:11 | FromDiscord | <user2m> In reply to @heysokam "it was introduced in": no issues with 1.16.12 tho . ill have to migrate evntually tho |
23:37:41 | FromDiscord | <sOkam! π«> In reply to @user2m "I don't know why": you must be using outdated libs, i guess? π€ |
23:37:46 | FromDiscord | <luxurymode> Why is nimpretty the only tool without a link here? https://nim-lang.org/docs/tools.html π’ Is it because it's defunct? |
23:39:05 | FromDiscord | <user2m> In reply to @heysokam "you must be using": some of the js backend stuff breaks in 2.0 |
23:39:21 | FromDiscord | <luxurymode> In reply to @luxurymode "Why is nimpretty the": hrm, nevermind. Looks like I have automatically, I guess standard with choosenim |
23:40:01 | FromDiscord | <sOkam! π«> In reply to @luxurymode "hrm, nevermind. Looks like": yep, it comes with nim, just like nimble and nimsuggest |
23:40:11 | NimEventer | New thread by giaco: Nim vs cppfront as C++ frontend, see https://forum.nim-lang.org/t/10535 |
23:58:12 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in) |
23:59:40 | * | xutaxkamay joined #nim |