00:00:46 | * | krux02 quit (Remote host closed the connection) |
00:05:46 | FromDiscord | <abby.> is nim a good language for a small interpreter? i originally wrote it in C but it's kind of a pain so i want to move it |
00:06:30 | FromDiscord | <ShalokShalom> Well, the good thing is, you can succeed your existing code |
00:06:36 | FromDiscord | <ShalokShalom> Since Nim compiles to C |
00:06:51 | FromDiscord | <abby.> there's barely any code in C and it's badly written |
00:07:04 | FromDiscord | <Elegantbeef> Many people have written intepreters in Nim |
00:07:17 | FromDiscord | <ShalokShalom> And Nim itself, and the Nim VM that is used for macros and Nimscript, is also written in Nim. |
00:07:51 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Many people have written": Interpreters and compilers are both asking for similar semantics, right? |
00:08:17 | FromDiscord | <ShalokShalom> So what is good for an interpreter, is good for writing a compiler, and the other way around? |
00:08:39 | FromDiscord | <ShalokShalom> Basically, in functional languages you would use pattern matching as your main tool. |
00:08:52 | FromDiscord | <ShalokShalom> Idk what you would do in Nim. |
00:09:43 | FromDiscord | <Elegantbeef> case statements |
00:10:17 | FromDiscord | <ShalokShalom> Yeah |
00:10:48 | FromDiscord | <Elegantbeef> The answer to you question is kinda |
00:12:10 | FromDiscord | <abby.> may do it |
00:12:22 | FromDiscord | <abby.> i was also considering c# |
00:12:28 | FromDiscord | <abby.> doing it in C is kinda annoying |
00:14:32 | FromDiscord | <ShalokShalom> An example might help |
00:14:36 | FromDiscord | <ShalokShalom> https://github.com/anbclausen/lambda-calculus-nim |
00:15:01 | FromDiscord | <abby.> i originally write the first version of the prototype language in python but i want to rewrite it in a faster language |
00:15:03 | FromDiscord | <abby.> https://github.com/megabytesofrem/tsuki-lang |
00:16:34 | FromDiscord | <huantian> I’d say C# and Nim are both great languages |
00:16:43 | FromDiscord | <huantian> Though I’m heavily biased for both lmao |
00:17:10 | FromDiscord | <abby.> is there a thing similar to lark for nim? |
00:17:15 | FromDiscord | <abby.> parser generator |
00:18:40 | FromDiscord | <Elegantbeef> Npeg? |
00:19:33 | FromDiscord | <abby.> also how do i install it on arch again |
00:19:38 | FromDiscord | <abby.> i forgor |
00:19:47 | FromDiscord | <abby.> haven't used nim in a while |
00:19:49 | FromDiscord | <Elegantbeef> Most use choosenim to install Nim |
00:21:14 | FromDiscord | <abby.> how's the speed of nim btw |
00:21:28 | FromDiscord | <Elegantbeef> as fast as C |
00:22:30 | FromDiscord | <abby.> very pog |
00:22:30 | FromDiscord | <auxym> In reply to @huantian "I’d say C# and": if I had to pick an enterprisey language for some big company project or whatever, then yeah, C# would probably be my first pick. I hear modern java is getting closer though. |
00:22:36 | FromDiscord | <huantian> really? |
00:22:40 | FromDiscord | <huantian> I gotta try java again then |
00:22:40 | FromDiscord | <abby.> this is just a toy project |
00:22:48 | FromDiscord | <ShalokShalom> F# would be much more suitable |
00:22:54 | FromDiscord | <abby.> i just want to rewrite this small language but not in python |
00:22:58 | FromDiscord | <abby.> because that's slow af |
00:23:00 | FromDiscord | <ShalokShalom> FParsec is a perfect library |
00:23:11 | FromDiscord | <abby.> me + functional programmer = runs away |
00:23:19 | FromDiscord | <abby.> i once tried to learn haskell and it was a nightmare |
00:23:27 | FromDiscord | <abby.> (edit) "programmer" => "programming" |
00:23:28 | FromDiscord | <ShalokShalom> Well, Haskell... |
00:23:33 | FromDiscord | <huantian> one day I'll try F# |
00:23:43 | FromDiscord | <ShalokShalom> Thats like saying you wont like Python, since C is a horror |
00:23:47 | FromDiscord | <abby.> ocaml doesn't look too bad but it's uh |
00:23:51 | FromDiscord | <abby.> very weird |
00:23:57 | FromDiscord | <ShalokShalom> And there are actually good tutorials for writing parsers |
00:24:06 | FromDiscord | <auxym> In reply to @ShalokShalom "F# would be much": f# is cool, but has a tiny user base for hiring, and doesn't have the tooling support and business backing of c#, which was my point (enterprisey-language for a large company etc). anyways this is veering OT |
00:24:30 | FromDiscord | <ShalokShalom> In reply to @auxym "f# is cool, but": I meant for a parser/interpreter |
00:24:50 | FromDiscord | <ShalokShalom> Such a thing is basically a pure function |
00:25:00 | FromDiscord | <ShalokShalom> Compiler, parser, interpreter |
00:25:12 | FromDiscord | <ShalokShalom> You always want the same output for the same input |
00:25:31 | FromDiscord | <ShalokShalom> And pattern matching goes a long way doing that |
00:26:28 | FromDiscord | <auxym> Sure. I don't know much about writing compilers anyways. But I did enjoy F# a lot when I tried it out. H-M types feels magical. |
00:27:45 | FromDiscord | <abby.> i may try this in nim |
00:27:58 | FromDiscord | <abby.> does nim have switch case |
00:28:36 | FromDiscord | <auxym> yes, with exhaustivity check |
00:28:51 | FromDiscord | <auxym> and no fallthrough, which is stupid |
00:29:01 | FromDiscord | <abby.> yeah |
00:29:08 | FromDiscord | <auxym> so it has the good type of case statement |
00:29:11 | FromDiscord | <abby.> what parser libraries are there? |
00:29:20 | FromDiscord | <abby.> i'm curious if there's anything similar to lark |
00:30:04 | FromDiscord | <auxym> not many. npeg as beef said. and there are a few unmaintained ones on gh |
00:30:06 | FromDiscord | <Elegantbeef> `Npeg` and `std/parseutils` |
00:31:24 | FromDiscord | <abby.> i guess i could do my own but it would be nice to have something |
00:31:49 | FromDiscord | <abby.> lark is a very very nice framework |
00:32:19 | FromDiscord | <huantian> right but I don't think any of us has ever used it |
00:32:50 | FromDiscord | <abby.> i did |
00:34:52 | FromDiscord | <ShalokShalom> In reply to @auxym "Sure. I don't know": Yeah, absolutely |
00:35:03 | FromDiscord | <ShalokShalom> Its my favorite language next to Nim/Cyo |
00:35:32 | FromDiscord | <ShalokShalom> But its dependency on dotnet, aside of compiling to the Fable languages... |
00:35:40 | FromDiscord | <ShalokShalom> Dotnet is a pain. |
00:35:53 | FromDiscord | <abby.> dotnet is not good |
00:35:56 | FromDiscord | <abby.> c# is good |
00:35:56 | FromDiscord | <ShalokShalom> https://github.com/haxscramper/hparse |
00:36:04 | FromDiscord | <huantian> is dotnet really that bad lol |
00:36:20 | FromDiscord | <ShalokShalom> Hax is one of the core contributors, he usually knows what he does |
00:36:27 | FromDiscord | <ShalokShalom> And he discontinued his lib |
00:36:35 | FromDiscord | <abby.> oh why |
00:36:39 | FromDiscord | <ShalokShalom> Because handrolling turned out to be more effective |
00:36:44 | FromDiscord | <ShalokShalom> See the readme. |
00:36:48 | FromDiscord | <abby.> oh ok |
00:36:54 | FromDiscord | <ShalokShalom> In reply to @huantian "is dotnet really that": No. Its worse |
00:37:00 | FromDiscord | <abby.> is it hard to hand write a small parser for a toy language? |
00:37:05 | FromDiscord | <ShalokShalom> Just setting up a project and get started |
00:37:17 | FromDiscord | <ShalokShalom> And then, dont get me started on msbuild and nuget |
00:37:33 | FromDiscord | <ShalokShalom> At least you have Fake and Paket as alternative |
00:37:36 | FromDiscord | <huantian> yeah for met dotnet msbuild and nuget are things that I dont' understand at all |
00:37:44 | FromDiscord | <huantian> and I just type things and push buttons and they kind work |
00:37:46 | FromDiscord | <ShalokShalom> In reply to @abby. "is it hard to": Better try out 😉 |
00:38:16 | NimEventer | New thread by GavinRay: Howto: reinterpret a contiguous region/chunk of memory as a sequence of a certain type?, see https://forum.nim-lang.org/t/9590 |
00:38:30 | FromDiscord | <abby.> let me get out of bed then |
00:38:32 | FromDiscord | <auxym> In reply to @abby. "is it hard to": A small RD parser isn't too bad. Have a look at the first few chapters of https://craftinginterpreters.com/contents.html |
00:38:34 | FromDiscord | <huantian> but like pushing the buttons adn typing the random commands wasn't that hard |
00:38:37 | FromDiscord | <ShalokShalom> In reply to @auxym "and no fallthrough, which": Fallthrough, as in? |
00:38:55 | FromDiscord | <huantian> and randomly editing xml files until they do what I want |
00:39:26 | FromDiscord | <huantian> I'd rather touch that than npm |
00:39:34 | FromDiscord | <ShalokShalom> You might find this beneficial |
00:39:36 | FromDiscord | <ShalokShalom> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html |
00:39:48 | FromDiscord | <auxym> In reply to @ShalokShalom "Fallthrough, as in?": in java and C++, you have to explicitly break from each case, otherwise even if one case is triggered, you can go on and match other cases (eg the default) |
00:40:12 | FromDiscord | <ShalokShalom> Lol |
00:40:31 | FromDiscord | <ShalokShalom> And Nim doesnt have that? |
00:40:38 | FromDiscord | <ShalokShalom> Sounds like an improvement to me |
00:42:43 | FromDiscord | <Elegantbeef> Nim requires a macro for fallthrough |
00:43:12 | FromDiscord | <ShalokShalom> Ah. Yeah, that sounds sane? |
00:43:57 | FromDiscord | <huantian> I don't remember the last time I used fallthrough in switch |
00:44:17 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4fmZ |
00:44:32 | * | derpydoo joined #nim |
00:45:58 | FromDiscord | <ShalokShalom> Didnt PMunch also have a pattern matching library? ↵↵Or am I remembering this wrong |
00:47:28 | FromDiscord | <ShalokShalom> In reply to @auxym "A small RD parser": Thanks. That looks awesome at first sight |
00:48:01 | FromDiscord | <aquova> Quick question, if I have a URL, is there any way to determine where it redirects to? |
00:48:05 | FromDiscord | <Elegantbeef> Pattern matching schmattern matching |
00:48:29 | FromDiscord | <auxym> I hate fallthrough, the entire point of a case statement is to execute a single case. IMO. If you want potentially multiple satisfied cases, just use `if` |
00:48:37 | FromDiscord | <ShalokShalom> Yeah? |
00:48:56 | FromDiscord | <Elegantbeef> I agree auxym fallthough is only wanted in like .1% of cases |
00:48:58 | FromDiscord | <ShalokShalom> But didnt you complain about Nim not having fallthrough? |
00:48:59 | FromDiscord | <auxym> In reply to @aquova "Quick question, if I": not without asking the server (making a request) |
00:49:52 | FromDiscord | <ShalokShalom> Ah, you meant fall through is stupid. |
00:50:00 | FromDiscord | <ShalokShalom> Read this differently. |
00:50:16 | FromDiscord | <auxym> yeah 😛 |
00:50:17 | FromDiscord | <ShalokShalom> Yeah, I agree. |
00:50:38 | FromDiscord | <ShalokShalom> I love that case statements in Nim have exhaustive checks |
00:51:05 | FromDiscord | <ShalokShalom> Its one of those things, where Nim has brought functional mindsets to an imperative language |
00:51:15 | FromDiscord | <ShalokShalom> I find that quite convenient |
00:51:23 | FromDiscord | <ShalokShalom> How they are combined. |
00:51:48 | FromDiscord | <auxym> yeah, exhaustivity check is great. IIRC there was a JVM language that had it too. groovy or kotlin I think? |
00:52:06 | FromDiscord | <ShalokShalom> Every functional language has that |
00:52:10 | FromDiscord | <ShalokShalom> Scala for sure |
00:52:20 | FromDiscord | <ShalokShalom> Kotlin potentially |
00:52:24 | FromDiscord | <auxym> yeah might be scala I had in mind |
00:52:32 | FromDiscord | <aquova> In reply to @auxym "not without asking the": I'm fine with making a request, but even then I'm not sure where to get it. HttpClient's `request` returns a `Response`, but afaik where we actually ended up isn't part of the headers or anywhere else |
00:52:49 | FromDiscord | <ShalokShalom> No exhaustive check on pattern matching would be a complete failure |
00:52:57 | FromDiscord | <ShalokShalom> People would joke about it. |
00:53:17 | FromDiscord | <ShalokShalom> They do, about imperative languages, who dont do that |
00:53:21 | FromDiscord | <ShalokShalom> 😅 |
00:54:26 | FromDiscord | <Elegantbeef> You say that but then people shit over it by doing `else: x` |
00:54:27 | FromDiscord | <auxym> In reply to @aquova "I'm fine with making": I haven't done much http in nim. but for a 301 response, the redirection URl should be in the response body (not the headers) https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301 |
00:54:45 | FromDiscord | <aquova> ahhh maybe that is it. Ty |
00:55:04 | FromDiscord | <aquova> although i thought this was reporting 200 |
00:55:04 | FromDiscord | <auxym> In reply to @Elegantbeef "You say that but": else in a case definitely needs to be used sparingly and carefully |
00:56:26 | FromDiscord | <auxym> In reply to @aquova "although i thought this": some http client libs I've used in the past "automatically" handle the redirect for you. aka they hide it, make a new request to the redirect and return you that response. there's usually a flag for turning that off. No idea if that's the case for nim's httpclient though |
00:56:59 | FromDiscord | <huantian> you can maybe set max redirects = 0? |
00:57:14 | FromDiscord | <auxym> that ^ |
00:58:35 | FromDiscord | <scarf> how did the language got its initial name, nim(rod)? for example c is because it's after b, python is because developer liked monty python, etc. |
00:58:46 | FromDiscord | <Elegantbeef> Nimrod was the first king of the bible |
00:59:23 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "You say that but": True |
00:59:33 | FromDiscord | <ShalokShalom> But they are doing it at least explicitly 😅 |
00:59:46 | FromDiscord | <scarf> In reply to @Elegantbeef "Nimrod was the first": i mean, why the particular king? because he was first? |
01:00:31 | FromDiscord | <scarf> (edit) removed "because he was first?" |
01:01:49 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4fn6 |
01:02:07 | FromDiscord | <ShalokShalom> In often cases, you have no other choice as to simply wildcard. |
01:02:35 | FromDiscord | <ShalokShalom> People doing it blindly on the other hand, is obviously an issue. |
01:02:52 | FromDiscord | <auxym> sure. sometimes you need it. you just have to remember that you're basically turning off exhaustivity check for that case statement when you add else |
01:04:35 | FromDiscord | <auxym> eg if you add a new enum member in the future, if your case statements were explicitly exhaustive, you'll get compile errors everywhere that tell you where you need to handle the new enum member. if you have an else case, it might lead to a bug where your forget to handle your new enum member somewhere and it accidentally gets handled by else |
01:04:38 | FromDiscord | <ShalokShalom> Is it common to use the option type for the else branch? |
01:05:31 | FromDiscord | <ShalokShalom> In reply to @auxym "eg if you add": Sure, but in this case, the wildcard was superfluous in the first place, right? |
01:06:00 | FromDiscord | <huantian> right for enums you should probably not use wildcards |
01:06:34 | FromDiscord | <ShalokShalom> https://github.com/arnetheduck/nim-result |
01:06:35 | * | xet7 joined #nim |
01:06:36 | FromDiscord | <huantian> tho hmmm it still may make sens in some cases? |
01:06:45 | FromDiscord | <ShalokShalom> Is this used a lot? |
01:06:59 | FromDiscord | <ShalokShalom> Or, why is this not in the stdlib? :p |
01:07:10 | FromDiscord | <ShalokShalom> Is this type of error handling not normal, in Nim? |
01:07:13 | FromDiscord | <Elegantbeef> Cause it has `std/options` |
01:07:16 | FromDiscord | <Elegantbeef> And Nim uses exceptions |
01:07:34 | FromDiscord | <ShalokShalom> Has std/options also a result type? |
01:07:41 | FromDiscord | <ShalokShalom> For like, a description on the error |
01:08:09 | FromDiscord | <Elegantbeef> No Nim uses exceptions |
01:09:19 | FromDiscord | <huantian> though i do know that status does prefer it over exceptions iirc |
01:09:36 | FromDiscord | <Elegantbeef> Yea but they're wacky |
01:09:41 | FromDiscord | <Elegantbeef> Exceptions \> Results fite me |
01:09:54 | FromDiscord | <ShalokShalom> Usually, you use Exceptions for other things as option and result types |
01:10:21 | FromDiscord | <huantian> I mean there are occasionally times I prefer result over exception |
01:10:41 | FromDiscord | <Elegantbeef> I rarely ever want results |
01:10:51 | FromDiscord | <Elegantbeef> It's just so invasive |
01:11:05 | FromDiscord | <huantian> but like when I write rust I end up just putting ? everywhere and using them like exceptions on the stack |
01:11:19 | FromDiscord | <huantian> I say this as a person who barely writes rust |
01:11:21 | FromDiscord | <auxym> so, is there anyway I can pass a `typedesc` to a macro and, eg, call `low`/`high` on it? It seems to get passed as a NimNode in the macro |
01:11:41 | FromDiscord | <Elegantbeef> Call it in the generated code, or make a template to call the macro |
01:12:39 | FromDiscord | <auxym> I wanted to inspect the typedesc in the macro, but I guess macro can't do that? Because the types aren't resolved yet or something like that? |
01:12:44 | * | ltriant quit (Ping timeout: 260 seconds) |
01:14:10 | FromDiscord | <Elegantbeef> Macros are not generic so typedescs have no meaning other than NimNodes afaik |
01:16:31 | FromDiscord | <ShalokShalom> How does Nim deal with Null, when using Exceptions? |
01:17:44 | * | xet7 quit (Ping timeout: 246 seconds) |
01:17:47 | FromDiscord | <auxym> defect or segfault IIRC, nil accesses aren't catchable |
01:18:00 | FromDiscord | <huantian> unless you import a funny module |
01:20:15 | FromDiscord | <huantian> but ideally you'd use option on your nillable types |
01:20:21 | FromDiscord | <huantian> or use nil checking thingy whatervber |
01:20:46 | FromDiscord | <ShalokShalom> In reply to @huantian "but ideally you'd use": Yeah, what I would assume. |
01:21:01 | FromDiscord | <ShalokShalom> Its so funny, how the culture between languages differ |
01:21:23 | FromDiscord | <ShalokShalom> What is completely common in one community, is foreign in another |
01:21:36 | FromDiscord | <ShalokShalom> Despite being the same context, semantics, etc |
01:22:39 | FromDiscord | <Elegantbeef> Just dont write bad code, problem solved 😛 |
01:24:07 | FromDiscord | <ShalokShalom> Like, Result being not even in the stdlib, or how one does handle errors by default. |
01:24:19 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Just dont write bad": Sounds sane |
01:24:25 | FromDiscord | <ShalokShalom> I will do that! |
01:24:49 | FromDiscord | <Elegantbeef> With exceptions |
01:24:49 | FromDiscord | <Elegantbeef> Exceptions are more sane than results imo |
01:24:49 | FromDiscord | <Elegantbeef> YMMV |
01:25:18 | FromDiscord | <huantian> try catch expressions do definitely help wtih making exceptions a lot nicer |
01:25:29 | FromDiscord | <Elegantbeef> Also the effect system |
01:25:31 | FromDiscord | <huantian> as well as exctpion tracking |
01:25:45 | FromDiscord | <Elegantbeef> being able to say `{.raises:[].}` is nicer than "Oh I unpacked all the exceptions manually" |
01:28:47 | FromDiscord | <Rika> I don’t know what’s so strange about communities having different opinions |
01:30:51 | * | xet7 joined #nim |
02:05:18 | FromDiscord | <ShalokShalom> Its more about how the defaults and the overall existing culture shapes the view of the people |
02:05:33 | FromDiscord | <ShalokShalom> And how easily they accept that |
02:06:23 | FromDiscord | <ShalokShalom> Like, how less scientific thinking and generally just objective truths are counting |
02:06:57 | FromDiscord | <ShalokShalom> As said, Nim is a positive counter example overall, by adopting many different concepts of very different languages 🙂 |
02:10:36 | FromDiscord | <Rika> I see |
02:19:25 | FromDiscord | <dedraiaken> In reply to @Elegantbeef "It's just so invasive": Just a compile-time reminder that this routine may fail, no? Versus returning some convention based value and crashing your program at runtime. |
02:20:44 | FromDiscord | <Rika> In reply to @dedraiaken "Just a compile-time reminder": You can also have the reminder with exceptions |
02:20:52 | FromDiscord | <Rika> Raises pragma |
02:21:14 | FromDiscord | <Rika> The difference is that you have to deal with results everywhere, even when you don’t want to care |
02:21:23 | FromDiscord | <Rika> You can opt in to caring with exceptions |
02:21:48 | FromDiscord | <Rika> If you want, you can even gain back the whole benefit of results with that raises pragma plastered everywhere |
02:24:39 | FromDiscord | <dedraiaken> I haven't used `raises` yet, so it forces you to handle a specific exception? |
02:26:03 | FromDiscord | <Elegantbeef> Yes |
02:27:36 | FromDiscord | <scarf> do i necropost or create a new thread with same topic in nim forum? |
02:30:52 | FromDiscord | <Elegantbeef> Necro is likely better imo but no clue |
02:30:59 | FromDiscord | <Rika> In reply to @dedraiaken "I haven't used `raises`": It forces you to handle all exceptions you do not list as raises |
02:31:12 | FromDiscord | <Rika> Like throws in Java I guess |
02:32:14 | FromDiscord | <scarf> iirc result works well with chaining |
02:32:25 | FromDiscord | <scarf> such as `>>=` in haskell |
02:33:00 | FromDiscord | <dedraiaken> In reply to @Rika "If you want, you": Is there a notable performance difference between raises and result types? |
02:34:06 | FromDiscord | <Elegantbeef> You mean exceptions and results |
02:34:39 | FromDiscord | <Elegantbeef> Exceptions in Nim atleast are heap allocated so can be slower |
02:35:19 | FromDiscord | <dedraiaken> In reply to @Elegantbeef "You mean exceptions and": Is that only if it's actually thrown? |
02:35:46 | FromDiscord | <Elegantbeef> I believe so yes |
02:35:52 | FromDiscord | <Elegantbeef> Stack unwinding and all that jazz |
02:41:39 | * | ltriant joined #nim |
02:42:35 | NimEventer | New thread by scarf: Nim name origin?, see https://forum.nim-lang.org/t/9591 |
03:09:29 | FromDiscord | <chmod> sorta wondering, how impactful to growth was fireship's recent video on nim? |
03:09:43 | FromDiscord | <Elegantbeef> https://plausible.io/nim-lang.org |
03:36:24 | FromDiscord | <Bung> interesting october 2022 18.9k visitors |
03:37:11 | FromDiscord | <Bung> oh, maybe just because nimconf |
03:37:43 | FromDiscord | <Elegantbeef> It was the first month with statistics so it's not really a good metric of what a month is like(In combination with nimconf) 😄 |
03:38:48 | FromDiscord | <Bung> okay, I see |
04:05:57 | * | ltriant_ joined #nim |
04:06:25 | * | derpydoo quit (Quit: derpydoo) |
04:06:34 | * | ltriant quit (Ping timeout: 260 seconds) |
04:16:03 | FromDiscord | <JSONBash> when I `open` a file, does arc/orc free it when i am done, or do I still need to close it myself |
04:16:32 | FromDiscord | <Elegantbeef> IO hasnt been rewritten with destructors yet sadly |
04:17:57 | FromDiscord | <JSONBash> 😢 |
04:18:33 | FromDiscord | <Elegantbeef> A `defer: file.close` is luckily not too bad |
04:19:03 | FromDiscord | <JSONBash> yeah not the worst |
04:19:07 | FromDiscord | <JSONBash> thnx |
04:33:20 | FromDiscord | <chmod> looking for pixie docs, https://nimdocs.com/treeform/pixie is down? |
04:34:40 | FromDiscord | <Elegantbeef> It might be |
04:35:08 | FromDiscord | <chmod> nimdocs down for like a week then. hm. |
04:35:19 | FromDiscord | <Elegantbeef> You should be able to just clone the repo and do `nim doc --project --docCmd:skip path/pixie.nim` |
04:35:30 | FromDiscord | <Elegantbeef> Name aside it's ran by treeform |
04:36:51 | * | Jjp137 quit (Quit: Leaving) |
04:43:05 | FromDiscord | <chmod> In reply to @Elegantbeef "You should be able": that worked, thanks! |
04:45:37 | FromDiscord | <Elegantbeef> No problem |
04:49:07 | FromDiscord | <chmod> anyone using nim with an nvim lua conf? |
06:23:46 | * | tiorock joined #nim |
06:23:46 | * | tiorock quit (Changing host) |
06:23:46 | * | tiorock joined #nim |
06:23:46 | * | rockcavera is now known as Guest4210 |
06:23:46 | * | tiorock is now known as rockcavera |
06:26:51 | * | Guest4210 quit (Ping timeout: 248 seconds) |
06:51:04 | FromDiscord | <JeysonFlores> What does the "var" keyword mean when it's used in a proc argument? |
06:52:16 | FromDiscord | <Bung> mutable |
06:53:12 | FromDiscord | <Elegantbeef> It's a mutable reference to be percise |
06:53:51 | FromDiscord | <Elegantbeef> If you know C++ it's a lot like `&T` |
06:55:37 | FromDiscord | <JeysonFlores> Ohhh ok, I think I get it |
06:55:56 | FromDiscord | <JeysonFlores> so when you don't put it, the var referece is just for reading |
06:56:31 | FromDiscord | <Elegantbeef> Parameter you mean, yes |
06:56:43 | * | ltriant_ quit (Ping timeout: 252 seconds) |
06:57:01 | FromDiscord | <Elegantbeef> Unless it's a reference type then the fields are mutable |
06:57:02 | FromDiscord | <JeysonFlores> yeah, thanks! |
07:09:07 | FromDiscord | <ShalokShalom> In reply to @Rika "Raises pragma": That sounds interesting. So there is no difference? Between Result and raises pragma? |
07:09:25 | FromDiscord | <Rika> Well no, there probably is |
07:09:44 | FromDiscord | <Rika> But the “explicitly need to manage” part can be done with exceptions too |
07:09:52 | FromDiscord | <ShalokShalom> Does an exception count as a value? |
07:10:09 | FromDiscord | <ShalokShalom> Results usually do |
07:10:46 | FromDiscord | <Rika> What do you mean? |
07:11:15 | * | m5zs7k quit (Ping timeout: 272 seconds) |
07:11:17 | FromDiscord | <ShalokShalom> Result is usually a union type |
07:11:25 | FromDiscord | <ShalokShalom> Idk, how are exceptions implemented? |
07:11:45 | FromDiscord | <Elegantbeef> Exceptions are heap allocated types that use inheritance |
07:12:02 | FromDiscord | <Elegantbeef> They do the same thing just differently |
07:12:04 | FromDiscord | <ShalokShalom> Ah, I see |
07:12:18 | FromDiscord | <ShalokShalom> I imagine some differences occur from that |
07:12:21 | FromDiscord | <Elegantbeef> They both indicate a failure, one is explicit and tedious, the other is much more enjoyable |
07:12:32 | FromDiscord | <ShalokShalom> Would railway oriented programming work with exceptions? |
07:12:50 | FromDiscord | <Rika> You can use exceptions as the error type on a result |
07:12:51 | FromDiscord | <Elegantbeef> I dont know what that even means |
07:12:55 | FromDiscord | <Rika> Just doesn’t make sense to |
07:13:08 | FromDiscord | <Rika> Think there’s a library in Nim that converts exceptions to results |
07:13:27 | FromDiscord | <Elegantbeef> Exceptions bubble up an error, results have you manage that error |
07:13:39 | FromDiscord | <Rika> Railway oriented programming is really a result based thing |
07:13:46 | FromDiscord | <Rika> Doesn’t really apply if you don’t use results |
07:13:53 | * | m5zs7k joined #nim |
07:14:02 | FromDiscord | <ShalokShalom> Ok, thanks 🙂 |
07:14:10 | FromDiscord | <Rika> Hey, at least Nim allows you to choose lol |
07:14:18 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Exceptions bubble up an": Thats a good comparison |
07:14:30 | FromDiscord | <ShalokShalom> Like that sentence. |
07:14:43 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "I dont know what": https://blog.logrocket.com/what-is-railway-oriented-programming/ |
07:14:46 | FromDiscord | <Rika> Only annoying thing really about exceptions are the heap part, can be annoying for embedded people |
07:14:55 | FromDiscord | <Elegantbeef> I personally vastly prefer the semantics of exceptions, I find results awful semantically |
07:15:21 | FromDiscord | <Rika> Railway paradigm helps a bit with the results use issue |
07:15:55 | FromDiscord | <Rika> Oh well, for me pattern matching go brr |
07:19:12 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "I personally vastly prefer": Like, why? |
07:19:39 | FromDiscord | <ShalokShalom> In reply to @Rika "Railway paradigm helps a": Ah, do you know railway oriented from the Elixir community? |
07:19:42 | FromDiscord | <Elegantbeef> Cause results are unintuitive and enforce an importance of an error |
07:19:42 | FromDiscord | <Rika> No |
07:19:50 | FromDiscord | <Rika> I knew about it before I went into elixir |
07:19:54 | FromDiscord | <ShalokShalom> I see |
07:19:59 | FromDiscord | <Rika> Know it from F# I think |
07:20:07 | FromDiscord | <ShalokShalom> Since its very much a F# thing, yes |
07:20:27 | FromDiscord | <ShalokShalom> The author of it has a lot of great talks and a very nice book, imho |
07:20:37 | FromDiscord | <Rika> Yeah I read a lot about other languages that don’t make me cry blood |
07:20:44 | FromDiscord | <ShalokShalom> 'Domain modeling made functional' |
07:20:54 | FromDiscord | <Elegantbeef> Do i always care that `parseInt` can raise an error? No. Should I have to explicitly state "I dont care if this raises an error" I think one shouldnt |
07:21:09 | FromDiscord | <ShalokShalom> Then you dont use Result or Option |
07:21:15 | FromDiscord | <Rika> In reply to @Elegantbeef "Do i always care": I think it’s a taste thing |
07:21:18 | FromDiscord | <Elegantbeef> I use them when they make sense |
07:21:21 | FromDiscord | <Rika> In reply to @ShalokShalom "Then you dont use": You can’t usually control that |
07:21:28 | FromDiscord | <Rika> What if a library uses it! |
07:21:29 | FromDiscord | <Rika> ? |
07:21:59 | FromDiscord | <Rika> Kinda sucks really that one has to manually convert from one or the other |
07:22:09 | FromDiscord | <Rika> Wonder what kinda solutions there would be to resolve it |
07:22:55 | FromDiscord | <Elegantbeef> You'd need compiler support likely to convert inbetween |
07:23:01 | FromDiscord | <Elegantbeef> Without explicitly doing it |
07:23:45 | FromDiscord | <Elegantbeef> And i mean a good result needs to have atleast a string, and atmost it's a tuple of msg and extra data to use |
07:24:26 | FromDiscord | <Elegantbeef> Really the only thing i like about results is their overhead |
07:35:30 | FromDiscord | <Horizon [She/Her]> In reply to @Rika "Only annoying thing really": What about goto exceptions? |
07:36:10 | FromDiscord | <Horizon [She/Her]> Aren't they supposed to be friendlier with 'weirder' platforms? (Like WASM) |
07:37:59 | * | Jjp137 joined #nim |
07:48:20 | * | PMunch joined #nim |
07:52:33 | FromDiscord | <ShalokShalom> In reply to @Rika "You can’t usually control": Arnt you supposed to use one, when you can recover, and one, when you dont? ↵↵But yeah, I agree. A more streamlined option would be good here |
07:52:41 | FromDiscord | <ShalokShalom> Looks too ambiguous |
08:03:15 | * | kenran joined #nim |
08:17:21 | FromDiscord | <jmgomez> In reply to @ShalokShalom "Since its very much": Scott just put a friendly name on it, it’s monad pattern.. if anything is a Haskell thing. Isn’t it? |
08:17:53 | FromDiscord | <ChocolettePalette> xmonad \:/ |
08:24:28 | NimEventer | New Nimble package! nimldap - LDAP client bindings, see https://github.com/inv2004/nimldap |
08:37:11 | * | ltriant joined #nim |
08:44:12 | FromDiscord | <ShalokShalom> In reply to @jmgomez "Scott just put a": Yes. |
08:44:35 | FromDiscord | <ShalokShalom> Haskell has, although, a trillion different ways to handle errors |
08:44:43 | FromDiscord | <ShalokShalom> F# is streamlined |
08:44:56 | PMunch | F# is a dumpsterfire |
08:45:37 | PMunch | Such a poor excuse for a functional language |
08:46:04 | PMunch | Granted, I didn't use it that much. But the little I tried was absolutely horrid |
08:50:20 | FromDiscord | <ShalokShalom> What exactly? |
08:50:56 | FromDiscord | <ShalokShalom> Not using something and them judging it is risky, in terms of logical arguing |
08:52:28 | PMunch | Well the whole structure of it. I've used it to program a couple of programs, so it's not just from looking at a cheatsheet or anything |
08:52:43 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4fox |
08:53:01 | PMunch | It somehow managed to get all the downsides of functional programming, but with very few of the benefits |
08:53:02 | FromDiscord | <ShalokShalom> In reply to @PMunch "Well the whole structure": Whole structure means the language features? 🙂 |
08:53:11 | FromDiscord | <ShalokShalom> I see it quite the opposite |
08:53:40 | FromDiscord | <ShalokShalom> The pipe operator? |
08:53:42 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4foz |
08:53:45 | PMunch | To each their own I guess. But I'd rather use Clojure than F# |
08:53:56 | FromDiscord | <ShalokShalom> Well, Clojure is nice |
08:54:13 | FromDiscord | <ShalokShalom> I still see a lot of issues, when used in a cooperation |
08:54:36 | FromDiscord | <ShalokShalom> The language is so loose, huge codebases become their own language |
08:54:49 | FromDiscord | <ShalokShalom> Its a bit too flexible |
08:55:10 | PMunch | I mean I'm using Nim so I don't think I can complain about things being too flexible :P |
08:57:18 | FromDiscord | <ShalokShalom> Nim at least makes types mandatory |
08:57:36 | PMunch | I have tried my best to forget F# as it was so horrible. But I seem to remember that I had to convert between different versions of a collection type for no reason. Having to implement my own map or filter for the built in array type or something like that. And even resort to interop with dotnet for really the simplest of things. |
08:57:42 | FromDiscord | <ShalokShalom> It creates a structure right there |
08:57:52 | PMunch | Yeah, that's one of the things I don't like with Clojure, no types |
08:58:06 | FromDiscord | <ShalokShalom> In reply to @PMunch "I have tried my": You sounds something in the whole process went of the rails |
08:58:13 | FromDiscord | <ShalokShalom> It sounds unusual |
08:58:23 | FromDiscord | <ShalokShalom> (edit) "sounds" => "sound like" |
08:58:36 | FromDiscord | <ShalokShalom> In reply to @PMunch "Yeah, that's one of": Well, you have specs |
08:58:55 | FromDiscord | <ShalokShalom> And according to some Clojure dev, they are also quite popular |
08:59:37 | FromDiscord | <ShalokShalom> But still, many people say Clojure is good for personal projects, and when you have a big project and a big turnaround rate, it becomes quite challenging |
08:59:46 | FromDiscord | <ShalokShalom> F# just released 7.0 |
09:00:00 | FromDiscord | <ShalokShalom> Maybe a good time to rediscover it 😉 |
09:00:14 | PMunch | I'd rather pull out my own toenails |
09:00:41 | PMunch | And yeah, the process went off the rails, the second I started using F# |
09:00:55 | FromDiscord | <ShalokShalom> Haha |
09:01:28 | PMunch | Then again, really don't like dotnet/C# either, so that probably doesn't help my perception of F# |
09:01:40 | FromDiscord | <ShalokShalom> Dotnet is the horrible part |
09:01:46 | FromDiscord | <ShalokShalom> Its the reason I am here |
09:01:54 | FromDiscord | <ShalokShalom> And not at F# currently. |
09:02:18 | FromDiscord | <ShalokShalom> Fable helps, it can compile to Rust, Python and Javascript fine now. |
09:02:27 | FromDiscord | <ShalokShalom> But still, its a dotnet language. |
09:03:05 | FromDiscord | <ShalokShalom> And it really relies a lot on C# libraries sometimes. |
09:03:22 | FromDiscord | <ShalokShalom> Mostly, when there is no reason to write a F# equivalent |
09:03:28 | FromDiscord | <jmgomez> IMO best parts of F# are being ML based, the use of Hindley-Milner and the access to the net ecosystem. TypeProviders are kinda cool too (if you dont know Nim haha). The type system lacks constructors like typeclasses/concepts for a lang that claims to be typed functional, its parametric polymorphism is a bit weak |
09:04:00 | FromDiscord | <ShalokShalom> Its both intentionally and because the dotnet runtime would need to change |
09:04:05 | FromDiscord | <ShalokShalom> And that happens only for C# |
09:04:42 | FromDiscord | <ShalokShalom> Don is generally in the perception, that functors are not needed, since you can express everything without them |
09:04:48 | FromDiscord | <ShalokShalom> And they complicate things. |
09:05:10 | FromDiscord | <ShalokShalom> Intersection types could prove to be cool |
09:05:33 | FromDiscord | <ShalokShalom> They are approved in principle and lack an implementation |
09:05:49 | FromDiscord | <jmgomez> I know it's quite opinated and he may be right |
09:05:50 | FromDiscord | <ShalokShalom> And computatiom expressions are bare none. |
09:06:02 | FromDiscord | <ShalokShalom> They are the big highlight |
09:06:26 | FromDiscord | <ShalokShalom> In reply to @jmgomez "I know it's quite": He worked with the Haskell main dev for a good decade on the same floor |
09:06:38 | FromDiscord | <ShalokShalom> He learned from their experience |
09:07:06 | FromDiscord | <ShalokShalom> I love the simple workflow. F# is so easy to read and follow |
09:07:10 | FromDiscord | <jmgomez> That doesnt invalidate anything, it's just his way of seeing things which may be correct or not |
09:07:25 | FromDiscord | <ShalokShalom> I could understand what a lot of the code does, before I even wrote my first line |
09:07:40 | FromDiscord | <ShalokShalom> In reply to @jmgomez "That doesnt invalidate anything,": Yeah, of course. |
09:08:07 | FromDiscord | <ShalokShalom> I also think, its a design decision. One of the issues with type classes is, that they complicate both type inference and error reporting. |
09:08:37 | FromDiscord | <ShalokShalom> And so far as tooling and compiler messages go, is F# leaps ahead of most functional languages |
09:08:43 | FromDiscord | <ShalokShalom> And Nim, obviously |
09:08:52 | FromDiscord | <ShalokShalom> Which is quite easy to do. |
09:11:26 | FromDiscord | <jmgomez> Yeah.. but what I would take from F# and put into Nim would be the tooling (debugger + IDE support) |
09:12:01 | FromDiscord | <ShalokShalom> Yep, absolutely |
09:12:10 | FromDiscord | <jmgomez> I also care about inference and error messages, but I think the above is more important for adoption |
09:12:17 | FromDiscord | <ShalokShalom> I thought about a Fable to Nim implementation |
09:12:28 | FromDiscord | <ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/1039829815630499910/image0-1.png |
09:12:48 | FromDiscord | <ShalokShalom> In reply to @jmgomez "I also care about": That way, you could get both |
09:13:02 | FromDiscord | <ShalokShalom> Nims runtime/compiler and FSharps tooling, etc |
09:13:23 | FromDiscord | <jmgomez> I would prefer the other way around though, Nim to .NET |
09:13:40 | FromDiscord | <jmgomez> or being able to use .NET packages in Nim would be even better |
09:14:10 | FromDiscord | <jmgomez> because the best of Nim is to code on Nim |
09:14:46 | FromDiscord | <ShalokShalom> I like both |
09:15:02 | FromDiscord | <ShalokShalom> Nim is very straightforward on an imperative level |
09:15:08 | FromDiscord | <ShalokShalom> F# on a functional |
09:15:38 | FromDiscord | <ShalokShalom> And both can do both just fine 😄 |
09:15:56 | FromDiscord | <ShalokShalom> Immutable datastructures are really missing in Nim |
09:16:33 | FromDiscord | <ShalokShalom> Nim on dotnet > Nim runs on Graal. |
09:16:50 | FromDiscord | <ShalokShalom> Thats not the same, but I guess would solve lot of the use cases |
09:21:08 | FromDiscord | <Generic> In reply to @ShalokShalom "": yesss |
09:21:17 | FromDiscord | <Generic> this so much |
09:22:16 | FromDiscord | <ShalokShalom> Absolutely |
09:35:45 | FromDiscord | <radekm> On the other hand Nim with ARC/ORC has more deterministic memory management and resource management than F# (no need for use keyword) and it’s easier to use C libs from Nim than from .NET |
09:36:24 | FromDiscord | <ShalokShalom> Yeah, C interop and generally the compiler output of Nim is superb |
09:36:39 | FromDiscord | <ShalokShalom> And one of the key reasons, why I am here. 🙂 |
09:37:00 | FromDiscord | <ShalokShalom> I like both memory management systems, personally. |
09:38:20 | FromDiscord | <ShalokShalom> I love Nim, because its so straightforward. Compiler runs on source code, executable. ↵↵In F#, you have to slaughter a goat and dance naked at full moon to get a project compiling and shipped |
09:42:36 | FromDiscord | <Horizon [She/Her]> In reply to @jmgomez "I would prefer the": I think Java is more ideal tbh, since the JVM languages that currently exist are... Less than ideal tbh, from my experience |
09:42:58 | FromDiscord | <Horizon [She/Her]> Waiting for burnout to not be horrible, before i pick up the project again |
10:52:00 | FromDiscord | <haxscramper> the sanest way of all |
10:52:01 | FromDiscord | <haxscramper> write your parsers manually |
10:52:03 | FromDiscord | <haxscramper> dead end implementation, the code is crap↵(@abby.) |
10:52:24 | FromDiscord | <haxscramper> right\ |
10:52:24 | FromDiscord | <haxscramper> yeah rghti↵(@ShalokShalom) |
11:06:51 | PMunch | Do we have a simple recipe somewhere to configure a web server to use Nim? |
11:07:27 | PMunch | I've done it before with slotting a Nim server into my Apache install, but now I'm doing it on a fresh machine and I was wondering if there was a step by step guide out there |
11:08:34 | FromDiscord | <jmgomez> prologue has this https://planety.github.io/prologue/deployment/↵Not sure if it works for you |
11:14:12 | FromDiscord | <Phil> The above is a general deployment documentation using docker. If you just need an nginx config file you can just rip the one in there |
11:32:27 | FromDiscord | <ShalokShalom> In reply to @haxscramper "write your parsers manually": Do you also despise parser combinator libraries in other languages? |
11:35:03 | FromDiscord | <ShalokShalom> And is there a difference between parser generators and parser combinators? |
11:56:14 | FromDiscord | <Tonda Horkel> sent a code paste, see https://play.nim-lang.org/#ix=4fp4 |
12:03:55 | * | jmdaemon quit (Ping timeout: 248 seconds) |
12:07:15 | FromDiscord | <Bung> update to latest |
12:23:44 | * | kenran quit (Remote host closed the connection) |
12:53:59 | FromDiscord | <Tonda Horkel> i did |
12:54:14 | FromDiscord | <Tonda Horkel> directly from github |
12:54:40 | FromDiscord | <Tonda Horkel> it worked when i updated yesterday |
13:04:57 | FromDiscord | <Tonda Horkel> It works on commit ca3b6cb (https://github.com/nim-lang/Nim/commit/ca3b6cba5dca1b0f73d8dec7476d440af9780567) from yesterday but on newer it doesn't. |
13:14:01 | FromDiscord | <ringabout> In reply to @Tonda Horkel "It works on commit": As per https://github.com/nim-lang/Nim/pull/20792#issue-1441285546 said, please clear up the nimcache of the compiler and the binary built before. |
13:24:42 | FromDiscord | <Tonda Horkel> sent a code paste, see https://play.nim-lang.org/#ix=4fpl |
13:25:27 | FromDiscord | <ringabout> Where is the nimcache you cleared? |
13:28:20 | FromDiscord | <ringabout> See also https://github.com/nim-lang/Nim/pull/20781#issuecomment-1307336072 |
13:41:23 | * | kenran joined #nim |
14:02:27 | * | derpydoo joined #nim |
14:06:35 | PMunch | Hmm, tried Prologue but I'm unable to get it to serve static files with the staticFileMiddleware |
14:07:03 | FromDiscord | <Phil> Oh? I got that to work pretty quickly locally, what's the issue? |
14:08:08 | FromDiscord | <voidwalker> uhm, how to add a string to a seq[byte] ? |
14:10:11 | PMunch | Not sure tbh. I have this http://ix.io/4fpu/ |
14:10:40 | PMunch | As you can see I have /tmp/server/index.html but a request to index.html returns 404 |
14:11:28 | PMunch | @voidwalker, concat I assume |
14:13:16 | FromDiscord | <Phil> In reply to @PMunch "As you can see": Currently at work, I'll take a look at it later |
14:14:35 | FromDiscord | <Phil> In reply to @PMunch "Not sure tbh. I": Ahhhh you assumed that the path you throw in there is an absolute one |
14:14:46 | FromDiscord | <Phil> Incorrect assumption, the path is relative to the path of your binary IIRC |
14:15:03 | FromDiscord | <ringabout> https://github.com/planety/prologue/blob/devel/src/prologue/middlewares/staticfilevirtualpath.nim should probably be used |
14:15:13 | FromDiscord | <ringabout> (edit) "https://github.com/planety/prologue/blob/devel/src/prologue/middlewares/staticfilevirtualpath.nim should probably be used ... " added "in this case." |
14:18:30 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4fpw |
14:18:51 | FromDiscord | <voidwalker> cast[seq[byte]](s) ? |
14:19:34 | FromDiscord | <auxym> maybe, sort of unsafe, depends on internal string implementation in nim being compatible with seq. |
14:19:43 | PMunch | @Phil, well I tried with just `.` as well but got the same error |
14:20:45 | FromDiscord | <ringabout> How about a request to `/tmp/server/index.html` |
14:21:27 | PMunch | Same thing |
14:21:42 | FromDiscord | <Phil> I more mean I'm not sure you can serve out of tmp when your binary isn't in tmp or at the root level |
14:21:48 | PMunch | Also tried to put it in a subfolder and set the staticFileMiddleware to that, same issue |
14:21:49 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4fpy |
14:22:01 | FromDiscord | <auxym> or something like that, might have off-by-one error. @voidwalker |
14:22:12 | PMunch | But my binary is in tmp |
14:22:51 | FromDiscord | <voidwalker> Yeah speed will be a concern, I am trying to write a minimal torrent client : D |
14:23:14 | FromDiscord | <voidwalker> handshake message, which is constant size, would be a byte array, not a byte seq, in the final version |
14:24:28 | FromDiscord | <auxym> In reply to @voidwalker "Yeah speed will be": note: if speed is a concern, always profile your stuff. Start by writing the idiomatic version, try the "low level" version and see if there's an actual improvement. it's quite possible that gcc will optimize the nice for loop to a memcopy. |
14:24:56 | * | arkurious joined #nim |
14:25:12 | FromDiscord | <auxym> blind "optimization" will lead nowhere |
14:25:32 | FromDiscord | <ringabout> In reply to @PMunch "But my binary is": Does the hello world example work for you? https://planety.github.io/prologue/staticfiles/ |
14:25:55 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4fpA |
14:27:07 | FromDiscord | <ringabout> https://media.discordapp.net/attachments/371759389889003532/1039909000780730429/image.png |
14:27:32 | FromDiscord | <ringabout> (edit) "https://play.nim-lang.org/#ix=4fpA" => "https://play.nim-lang.org/#ix=4fpB" |
14:29:04 | PMunch | No I'm unable to serve any static files |
14:29:15 | PMunch | I am able to do a normal serve though |
14:32:46 | FromDiscord | <ringabout> The static file directory is relative to the bin file and the request should start with the directory. |
14:33:01 | FromDiscord | <ringabout> In reply to @PMunch "Also tried to put": What's the code for this? |
14:33:29 | FromDiscord | <ringabout> (edit) "bin file" => "binary" | "directory." => "directory name." |
14:34:02 | PMunch | Now I have this: http://ix.io/4fpD/ |
14:34:21 | PMunch | Ah wait |
14:34:36 | PMunch | Now it works if I use /website/index.html |
14:34:44 | FromDiscord | <ringabout> Yeah |
14:35:05 | PMunch | Hmm, I really would like to have everything that isn't resolved as another route be served from that directory |
14:35:19 | PMunch | So e.g. index.html is rewritten to website/index.html |
14:35:55 | FromDiscord | <ringabout> In reply to @PMunch "Hmm, I really would": Yeah, there is another middleware for this purpose => https://github.com/planety/prologue/blob/devel/src/prologue/middlewares/staticfilevirtualpath.nim |
14:36:42 | FromDiscord | <Tonda Horkel> Ok, ignore this, I acidentally switched to a wrong commit. But it works now, after clearing the nimcache. Thanks for the help. |
14:38:06 | PMunch | @ringabout, ooh that looks promising |
14:38:12 | PMunch | But I tried and it still doesn't work.. |
14:38:33 | PMunch | Tried this: http://ix.io/4fpE/ |
14:38:53 | PMunch | And then just /index.html, but it didn't work.. |
14:41:11 | PMunch | Hmm, it did work with "/website", "/test" |
14:41:19 | PMunch | But I can't seem to make it work directly on the root |
14:42:50 | FromDiscord | <ringabout> You can also use the `redirectTo` function. |
14:43:05 | PMunch | Sure |
14:43:34 | PMunch | But then none of the relative links in the HTML work any longer |
14:48:49 | FromDiscord | <jmgomez> In reply to @PMunch "<@658563905425244160>, ooh that looks": You may have the issue somewhere else, just so you know staticFileMiddleware works fine for me. The path at least in my case is relative to where I run the Nim compile command, rather than to the exec |
14:50:09 | PMunch | I have 5 lines of code, kinda hard to have an error elsewhere.. |
14:50:58 | FromDiscord | <jmgomez> can you return regular text based responses? |
14:54:00 | PMunch | Aha, because in normalizes the virtualPath (ie. removes the /) it sees it as length 0 and the check here fails: https://github.com/planety/prologue/blob/devel/src/prologue/middlewares/staticfilevirtualpath.nim#L24 |
14:57:14 | PMunch | By changing it to "website", "." it works fine |
14:57:50 | PMunch | This does what I wanted http://ix.io/4fpO/ |
14:58:33 | FromDiscord | <jmgomez> nice! |
15:24:56 | * | PMunch quit (Quit: Leaving) |
15:25:32 | FromDiscord | <EliasG2> I am trying to use nico (on windows), i installed it from nimble, but 'nicoboot' is not recognized as a command |
15:28:30 | FromDiscord | <voidwalker> no operator to concatenate same type arrays ? |
15:32:28 | FromDiscord | <Rika> seems not |
15:32:56 | FromDiscord | <dlesnoff> In reply to @voidwalker "no operator to concatenate": see https://forum.nim-lang.org/t/3872 |
15:41:13 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fqb |
15:41:48 | FromDiscord | <dlesnoff> Oops sorry |
15:42:39 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fqd |
15:43:07 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/9ZA |
15:43:10 | FromDiscord | <dlesnoff> (edit) "https://play.nim-lang.org/#ix=4fqg" => "https://play.nim-lang.org/#ix=4fqe" |
15:43:17 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4fqh" => "https://paste.rs/UxZ" |
15:44:36 | FromDiscord | <pyryrin> is `let` in nim more like `const` in c++ or is `const` in nim more like `const` c++ |
15:45:43 | FromDiscord | <Clonkk> `const` in Nim is compile time constant value. `let` is immutable value (so more like C++ `const`)↵(@pyryrin) |
15:46:16 | FromDiscord | <Clonkk> The important difference is that `const` variable in Nim can be used compile-time |
15:46:22 | FromDiscord | <pyryrin> what would be the c++ equivalent of `const` in nim |
15:46:24 | FromDiscord | <Generic> const is like C++ constexpr |
15:46:28 | FromDiscord | <pyryrin> oh |
15:46:44 | FromDiscord | <pyryrin> is there constexpr in c |
15:46:55 | FromDiscord | <Generic> I don't think so |
15:47:05 | FromDiscord | <Generic> though I'm not exactly sure |
15:47:11 | FromDiscord | <EliasG2> nico |
15:47:22 | FromDiscord | <Clonkk> In C you would use `#define ` macro |
15:47:46 | FromDiscord | <Clonkk> for compile time constant |
15:48:23 | FromDiscord | <dlesnoff> In reply to @Generic "const is like C++": https://en.cppreference.com/w/cpp/language/constexpr |
15:48:37 | FromDiscord | <dlesnoff> Of course there is |
15:48:56 | * | derpydoo quit (Remote host closed the connection) |
15:49:22 | FromDiscord | <Clonkk> constexpr is C++11 not C↵(@dlesnoff) |
15:49:41 | FromDiscord | <voidwalker> @dlesnoff that's the only/best way to do it ? no shortcuts ? |
15:51:31 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fqj |
15:51:59 | FromDiscord | <voidwalker> welp, the whole reason I used array is to not use seq.. because faster |
15:56:02 | FromDiscord | <voidwalker> https://rosettacode.org/wiki/Array_concatenation#Nim |
15:59:34 | FromDiscord | <vindaar> or define a different helper https://play.nim-lang.org/#ix=4fqm |
16:00:32 | * | derpydoo joined #nim |
16:01:47 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4fqr |
16:07:08 | arkanoid | how can I get a streams/Stream out of a TCP AsyncSocket -> newAsyncSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP) ? |
16:19:42 | FromDiscord | <Horizon [She/Her]> Hm wonder if Nim bindings to MicroPython would be wanted |
16:19:44 | FromDiscord | <dlesnoff> In reply to @Jiezron "see https://forum.nim-lang.org/t/3872": @voidwalker I asked the same question on the Nim forum post but apparently you did not read it. Even though it converts to intermediate results, if you instantiate a const array to it, it will coerce back into an array. |
16:19:50 | FromDiscord | <Horizon [She/Her]> Could be used as an alternative to Lua |
16:20:37 | arkanoid | or maybe you know a safe proc to read from stream until custom delimiter? Like recvLine, but with "#" instead of "\r\L" |
16:20:58 | FromDiscord | <dlesnoff> In reply to @voidwalker "https://rosettacode.org/wiki/Array_concatenation#Ni": The rosetta codes are for the most part outdated |
16:24:41 | FromDiscord | <rakgew> micropython inside nim sounds neat. (-\: |
16:25:43 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/4jh |
16:27:00 | * | ehmry quit (Ping timeout: 248 seconds) |
16:28:37 | * | ehmry joined #nim |
16:30:05 | FromDiscord | <Horizon [She/Her]> In reply to @rakgew "micropython inside nim sounds": Yeah it can already be embedded into C programs, a minimal Nim binding would prolly be neat :) |
16:35:16 | * | kenran quit (Remote host closed the connection) |
16:42:57 | FromDiscord | <Require Support> how to add two seqs together 🤔 |
16:45:42 | FromDiscord | <federico3> I'd rather have a \Python to Nim translator \:) |
16:47:15 | FromDiscord | <rakgew> @Horizon [She/Her] for sure. \:-D |
16:53:19 | FromDiscord | <Horizon [She/Her]> In reply to @federico3 "I'd rather have a": My idea was to use MicroPython as a lightweight scripting language aha, and making a Python to Nim translator sounds like a challenge, probably possible to make a Python program using the ast module in python to build a Nim source program though? |
17:00:03 | FromDiscord | <rakgew> so with mpy embedded into nim, one could expose nim procs to mpy, right? |
17:00:45 | FromDiscord | <guttural666> how do I disambiguate a function call? I want to call the std/strbasics version of strip here? https://media.discordapp.net/attachments/371759389889003532/1039947666941034506/image.png |
17:00:48 | FromDiscord | <rakgew> so from mpy perspective those would look like c functions? |
17:04:59 | FromDiscord | <Rika> In reply to @guttural666 "how do I disambiguate": What is it being confused with |
17:09:56 | FromDiscord | <guttural666> apparently std/unicode and std/strutils are conflicting |
17:12:05 | FromDiscord | <pointystick> sent a code paste, see https://play.nim-lang.org/#ix=4fqN |
17:12:38 | FromDiscord | <pointystick> UFCS means "myVar.strip()" is the same as "strip(myVar)", and you can add the file at the start that way |
17:12:46 | FromDiscord | <guttural666> does the scoping conflict with UFC? |
17:14:39 | FromDiscord | <pointystick> I'm not sure what you mean. In general, if you include lots of files with similarly-named functions then you either need to disambiguate them or import in a different way (using 'except foo') |
17:14:41 | FromDiscord | <guttural666> yeah, okay that works |
17:14:56 | FromDiscord | <guttural666> it conflicts with the universal function call syntax |
17:15:16 | FromDiscord | <guttural666> you can't just string.strutils.strip() |
17:15:38 | FromDiscord | <guttural666> compiler wants to interpret strutils as a variable |
17:16:07 | FromDiscord | <guttural666> so that version of calling a function does not work anymore, if you have to scope the func |
17:16:23 | FromDiscord | <guttural666> sad face 😄 but it's okay |
17:23:38 | FromDiscord | <Horizon [She/Her]> In reply to @rakgew "so with mpy embedded": Mhm, that'd be the idea at least |
17:23:44 | FromDiscord | <Horizon [She/Her]> In reply to @rakgew "so from mpy perspective": Yeah |
17:53:55 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4fr1 |
17:54:06 | FromDiscord | <Horizon [She/Her]> I get a pointer but i don't exactly know how to use it aha |
18:00:12 | FromDiscord | <ShalokShalom> In reply to @Event Horizon "Hm wonder if Nim": Another burnout project? 😄 |
18:05:17 | FromDiscord | <jmgomez> In reply to @Event Horizon "How would i write": https://github.com/WebAssembly/wasi-libc/blob/b99173e17765fdbbfa3f75e2389fc2e994a04ef2/libc-bottom-half/headers/public/wasi/api.h#L51 |
18:05:48 | FromDiscord | <jmgomez> you mean to do a struct like that or you mean a binding? |
18:06:16 | FromDiscord | <jmgomez> for the later, importc doesnt work? |
18:12:19 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
18:22:43 | FromDiscord | <Horizon [She/Her]> In reply to @ShalokShalom "Another burnout project? 😄": Nah I'm just brainstorming |
18:22:51 | FromDiscord | <Horizon [She/Her]> In reply to @jmgomez "you mean to do": As a struct yeah |
18:27:55 | * | derpydoo quit (Ping timeout: 248 seconds) |
18:29:38 | FromDiscord | <jmgomez> In reply to @Event Horizon "As a struct yeah": then you should be able to declare a regular object as long as the wasi_size_t size matches but I think it would be better to do importc if you can |
18:30:18 | FromDiscord | <jmgomez> In NimForUE we do the former for unknown structs (we add padding in the middle because UE provides the offsets) |
18:30:53 | FromDiscord | <jmgomez> as long as the memory layout matches, you should be fine. But we did it so we dont have to compile every single plugin outthere |
18:31:22 | FromDiscord | <jmgomez> maybe in your case there is a better opt |
18:37:43 | FromDiscord | <Horizon [She/Her]> Hm alright, i could probably yoink the struct declaration from wasm3, if it's not already defined in the low-level C bindings |
18:47:42 | FromDiscord | <Yandall> Hi everybody, I'm new here. Just found about nim thanks to fireship video and I really liked it. I'm looking forward to learn it. I would appreciate any suggestion |
18:54:44 | FromDiscord | <JSONBash> Hello and Welcome! Any particular suggestions you are looking for? |
18:55:45 | FromDiscord | <Yandall> I started reading the tutorials in the official page, but there is a good website to learn? |
18:57:10 | FromDiscord | <Yandall> I installed the nim extension in vscode but there is not good highlight for errors, there is a better IDE for nim? |
18:57:40 | FromDiscord | <pyryrin> i personally like windows notepad |
18:59:13 | FromDiscord | <Horizon [She/Her]> How do i cast a pointer to a type? |
19:00:31 | FromDiscord | <Yandall> I'm working on a mac 😅 |
19:02:19 | FromDiscord | <JSONBash> I use the Nim extension made by nimsaem with VSCode |
19:04:46 | FromDiscord | <JSONBash> sent a long message, see http://ix.io/4frx |
19:05:01 | FromDiscord | <JSONBash> there are probably a couple more but those are the ones I remember |
19:05:02 | FromDiscord | <auxym> In reply to @Event Horizon "How do i cast": `cast[ptr myType](myPtr)` ? |
19:06:10 | FromDiscord | <auxym> @Yandall official tutorials are good as is miran's nim by example. There are 2 nim books, also I think exercism.io supports nim |
19:08:17 | FromDiscord | <Andreas> could smbd pls. help we write a destructor for this case-object -> https://play.nim-lang.org/#ix=4frz |
19:09:09 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=4frz" => "https://play.nim-lang.org/#ix=4frz↵there was smth. special about destructors for variant - but i forgot what it was" |
19:09:23 | FromDiscord | <Horizon [She/Her]> Nvm i didn't understand what i wanted to do |
19:09:27 | FromDiscord | <Horizon [She/Her]> And i still don't :p |
19:09:43 | FromDiscord | <Andreas> (edit) "variant" => "variants" |
19:10:14 | FromDiscord | <auxym> lol |
19:18:24 | FromDiscord | <ShalokShalom> In reply to @Yandall "I installed the nim": Which extension did you get? |
19:18:41 | FromDiscord | <ShalokShalom> The popular one is outdated. See that you get that one from saem. |
19:19:15 | FromDiscord | <ShalokShalom> There is also a Jetbrains implementation. |
19:23:13 | FromDiscord | <jmgomez> In reply to @ShalokShalom "There is also a": which is also outdated 😦 |
19:23:34 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4frE↵(@Andreas) |
19:24:48 | FromDiscord | <guttural666> In reply to @Yandall "I installed the nim": the eternal answer shall always be Vim, can I hear an Aaamen |
19:24:58 | FromDiscord | <Elegantbeef> no |
19:25:41 | Amun-Ra | what's preferred: config.nims or nim.cfg? |
19:25:51 | FromDiscord | <Yandall> Thanks @JSONBash @auxym I appreciate it |
19:25:53 | FromDiscord | <guttural666> 🤪 |
19:25:55 | FromDiscord | <Elegantbeef> `config.nims` |
19:26:07 | FromDiscord | <Elegantbeef> nim.cfg generally is for user config overrides imo |
19:26:13 | * | derpydoo joined #nim |
19:26:35 | Amun-Ra | hmm |
19:27:21 | Amun-Ra | then config.nims it is :> |
19:27:39 | FromDiscord | <pyryrin> does float default to float32 |
19:28:02 | FromDiscord | <Elegantbeef> Nope it's float64 |
19:28:15 | Amun-Ra | even on 32-bit platforms? |
19:28:25 | FromDiscord | <Elegantbeef> Yes |
19:28:27 | Amun-Ra | k |
19:28:29 | FromDiscord | <Elegantbeef> It's an alias to float64 |
19:28:41 | Amun-Ra | it's consistent |
19:29:52 | FromDiscord | <pyryrin> what about int? |
19:29:58 | FromDiscord | <Elegantbeef> Platform specific |
19:39:24 | * | Guest20 joined #nim |
19:39:47 | * | Guest20 quit (Client Quit) |
19:45:04 | FromDiscord | <ShalokShalom> In reply to @jmgomez "which is also outdated": Sure? I think they just fucked up the version number |
19:45:12 | FromDiscord | <ShalokShalom> It used to be in sync |
19:45:58 | FromDiscord | <ShalokShalom> Todays current version is 1.4.something and its compatible witj 1.6 according to the release notes. |
19:50:26 | FromDiscord | <jmgomez> In reply to @ShalokShalom "Sure? I think they": are we talking about this one ?https://plugins.jetbrains.com/plugin/15128-nim |
20:11:20 | FromDiscord | <ShalokShalom> Yep |
20:11:31 | FromDiscord | <ShalokShalom> It seems it broke with the newest IDEs |
20:13:50 | FromDiscord | <jmgomez> yes 😦 |
20:17:47 | * | derpydoo quit (Remote host closed the connection) |
20:18:48 | * | derpydoo joined #nim |
20:23:07 | FromDiscord | <ShalokShalom> Love it, when they say "the code is not in a state, where we can open source it" |
20:23:39 | FromDiscord | <ShalokShalom> Like, how does this even look? ↵↵What technical requirements need to be fulfilled, so a code can be open sourced? |
20:23:54 | FromDiscord | <guttural666> In reply to @ShalokShalom "Love it, when they": everybody: acknowledged, let's use it as a foundation for our project |
20:24:20 | FromDiscord | <ShalokShalom> Yeah, that too |
20:25:03 | FromDiscord | <ShalokShalom> But I think its a cheap excuse when people just dont wanna say 'we like to let it stay closed, since that's better for our revenue' |
20:25:34 | FromDiscord | <ShalokShalom> Just say that, and not come up with its illusory explanations. |
20:25:57 | FromDiscord | <ShalokShalom> https://youtrack.jetbrains.com/issue/NIM-43/Is-this-Plugin-going-to-be-updatedimproved-any-time-soon#focus=Comments-27-5384152.0-0 |
20:31:33 | FromDiscord | <guttural666> how do you make a dynamic console output in Nim? Meaning replacing the current console output with something different depending on user input |
20:32:50 | FromDiscord | <ShalokShalom> You mean a REPL? |
20:35:22 | FromDiscord | <guttural666> just echo "bla" then wait for user input and replace "bla" with "you have chosen xy" |
20:35:43 | FromDiscord | <guttural666> yeah REPL sounds right |
20:35:49 | FromDiscord | <demotomohiro> Something like this?↵https://nim-lang.org/docs/terminal.html#eraseLine,File |
20:35:56 | FromDiscord | <guttural666> sorry, didn't know the term |
20:36:44 | FromDiscord | <demotomohiro> its ok |
20:36:58 | FromDiscord | <Phil> If you're a company I personally can understand it |
20:37:25 | FromDiscord | <Phil> Bad code published means loads of issues that you in doubt will want to tackle to actually get any benefit out of open source |
20:37:45 | FromDiscord | <Phil> So you at least want to not have any noise among the issues |
20:37:55 | FromDiscord | <Phil> Such as "I opened this issue because I missunderstood the docs" |
20:38:19 | FromDiscord | <guttural666> In reply to @demotomohiro "Something like this? https://nim-lang.org/docs/term": that sounds about right, gonna look into that, thanks for the directions |
20:38:43 | FromDiscord | <Phil> Because if you just opened yourself up to having a competitor jump into life that doesn't have to shoulder the initial dev costs you'll want to squeeze what little benefit you can get for as much as possible |
20:39:11 | FromDiscord | <Phil> And you most definitely do not want to have to pay for folks sifting through incorrect or dumb issues, that's all wasted money |
20:39:14 | FromDiscord | <ShalokShalom> In reply to @Isofruit "Bad code published means": This doesnt mean you need to maintain it |
20:40:44 | FromDiscord | <Phil> In reply to @ShalokShalom "This doesnt mean you": Then you're opening yourself up to bad PR |
20:41:50 | FromDiscord | <Phil> "They're not even willing to apply this little fix, it's so frustrating that the paid devs of jetbrains are so lazy" |
20:42:07 | FromDiscord | <ShalokShalom> They are not paid by the community |
20:42:14 | FromDiscord | <ShalokShalom> But I get the point |
20:42:35 | FromDiscord | <ShalokShalom> Another question is, why a repo by a company like Jetbrains is in such a condition |
20:42:51 | FromDiscord | <ShalokShalom> Like, do they lack proper tooling? 🤪 |
20:42:52 | FromDiscord | <Phil> Wait... if it's created by the community how the hell is it not OS |
20:42:53 | FromDiscord | <Phil> (edit) "OS" => "OSS" |
20:43:07 | FromDiscord | <ShalokShalom> Its not created by the community |
20:43:15 | FromDiscord | <ShalokShalom> Its closed source and not paid for |
20:43:19 | FromDiscord | <ShalokShalom> 🤷🏻♂️ |
20:43:26 | FromDiscord | <huantian> In reply to @Isofruit ""They're not even willing": smh they won't even apply my random pr that I made at some point they need to get fired smh my head↵<https://github.com/JetBrains/JetBrainsRuntime/pull/172> |
20:43:30 | FromDiscord | <Phil> Ohhhh wait, I misinterpreted your sentence |
20:43:43 | FromDiscord | <Phil> Well they are getting paid by the community indirectly |
20:43:49 | FromDiscord | <ShalokShalom> Yep |
20:43:59 | FromDiscord | <Phil> This is all to promote Jetbrains and their license in professional usage |
20:44:03 | FromDiscord | <ShalokShalom> But you can apply it to IDEA Community |
20:44:10 | FromDiscord | <ShalokShalom> In reply to @Isofruit "This is all to": Yes, probably |
20:44:29 | FromDiscord | <ShalokShalom> But this still doesn't explain, why its in such a bad shape |
20:44:38 | FromDiscord | <Phil> And given that it's basically a kind of ad and you're competing cost-wise with m'fin vscode |
20:44:42 | FromDiscord | <Elegantbeef> Cause it's not a first class supported language |
20:44:45 | FromDiscord | <ShalokShalom> Either care for if, or not |
20:44:58 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Cause it's not a": Is that official? |
20:45:01 | FromDiscord | <Phil> works better for me than anything on vscode |
20:45:10 | FromDiscord | <ShalokShalom> Like, their official standpoint. |
20:45:26 | FromDiscord | <Elegantbeef> Is it in an editor named `Nim....`? |
20:45:29 | FromDiscord | <ShalokShalom> In reply to @Isofruit "works better for me": Yeah, idk if thats a compliment. |
20:46:11 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Is it in an": You are using Nimedit? |
20:46:23 | FromDiscord | <Elegantbeef> Read what i said |
20:46:27 | FromDiscord | <Elegantbeef> I believe in you |
20:46:31 | FromDiscord | <Phil> In reply to @ShalokShalom "Yeah, idk if thats": Given that autocomplete took 5+ seconds for suggestions and CTRL+Click / F12 on a symbol didn't work 90% of the time at all (with the extension that failure rate is way less) |
20:46:32 | FromDiscord | <ShalokShalom> Yeah, I know |
20:46:38 | FromDiscord | <Phil> It's a "meh" statement |
20:46:51 | FromDiscord | <ShalokShalom> But this suggested, that you know the experience in Nimedit |
20:46:53 | FromDiscord | <Phil> (edit) "In reply to @ShalokShalom "Yeah, idk if thats": Given that autocomplete ... took" added "on Vscode" |
20:47:12 | FromDiscord | <Elegantbeef> I'm saying it's a plugin for Nim support it's not a first class editor like pycharm, clion or any others |
20:47:25 | FromDiscord | <Elegantbeef> It's not made specifically for Nim, so it's clearly not first class |
20:47:33 | FromDiscord | <Phil> In reply to @huantian "smh they won't even": Okay now that's just sad |
20:47:42 | FromDiscord | <Elegantbeef> It's one developer that got permission to make the plugin |
20:47:50 | FromDiscord | <ShalokShalom> I see. |
20:48:11 | FromDiscord | <huantian> In reply to @Isofruit "Okay now that's just": I'm pretty sure they just don't look at prs for this repo tbh |
20:48:14 | FromDiscord | <ShalokShalom> In reply to @Isofruit "Given that autocomplete *on": With Saems plugin? |
20:48:26 | FromDiscord | <ShalokShalom> @Elegantbeef#0000 what do you use? |
20:48:27 | FromDiscord | <banan|crab> how do i send a message with discord webhooks. what does the post request have to be |
20:48:29 | FromDiscord | <huantian> but like it's such an obvious bug |
20:48:39 | FromDiscord | <Elegantbeef> I use Kate with nimlsp |
20:48:53 | FromDiscord | <ShalokShalom> Ah, yeah |
20:48:56 | FromDiscord | <huantian> you literally have a duplicate file with different casing↵that's going to cause a bug on any non-case sensitive file system |
20:48:59 | FromDiscord | <Phil> I mean, I gave up on it so I#d need to check.... yeah only nimsaem extension installed |
20:49:02 | FromDiscord | <ShalokShalom> And works that fine?/ |
20:49:06 | FromDiscord | <ShalokShalom> I love Kate |
20:49:15 | FromDiscord | <ShalokShalom> Just wish they had a centered mode. |
20:49:24 | FromDiscord | <Elegantbeef> Nimlangserver likely will work better |
20:49:25 | FromDiscord | <huantian> kate her? but I barely even know her! |
20:49:40 | FromDiscord | <Elegantbeef> Nimlsp likes to crash a lot ime |
20:49:45 | FromDiscord | <ShalokShalom> I see |
20:49:56 | FromDiscord | <ShalokShalom> But Kate's LSP implementation in general? |
20:50:02 | FromDiscord | <Elegantbeef> What about it |
20:50:08 | FromDiscord | <ShalokShalom> I remind them implementing the first pieces.. |
20:50:12 | FromDiscord | <Elegantbeef> It suggests symbols and i can go to definition |
20:50:14 | FromDiscord | <Elegantbeef> What more do i need |
20:50:16 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "What about it": Well, is it mature? |
20:50:16 | FromDiscord | <Phil> I don't think I ever set up any lang-server-communication with vscode |
20:50:20 | FromDiscord | <ShalokShalom> I see. |
20:50:57 | FromDiscord | <guttural666> In reply to @Elegantbeef "Nimlsp likes to crash": yeah it does |
20:52:48 | FromDiscord | <guttural666> shitting itself rn, showing errors that are none 😄 after a Vim restart it gets it so it's fiiine 😄 https://media.discordapp.net/attachments/371759389889003532/1040006060162945135/image.png |
20:53:13 | FromDiscord | <Elegantbeef> Though one might be able to build it using devel and switch back |
20:54:07 | FromDiscord | <Prestige> How should nim be installed on arm platforms? |
20:55:12 | FromDiscord | <Phil> Don't you pretty much just need a c to arm binary compiler and then pass the binary as program to the compile-command for usage (that and a linker) ? |
20:55:21 | FromDiscord | <Elegantbeef> Build from source or package repo i think↵(@Prestige) |
20:55:43 | FromDiscord | <Phil> Ohh right for the nim --> C step you still need the nim compiler compiled |
20:55:54 | FromDiscord | <Elegantbeef> Choosenim ships x86 on mac still iirc |
20:56:03 | FromDiscord | <Elegantbeef> Could use gitnim likely |
20:56:13 | FromDiscord | <Prestige> Hmm okay |
20:58:56 | * | pro joined #nim |
21:02:40 | FromDiscord | <Horizon [She/Her]> I hate WASM, and i hate trying to implement WASI |
21:02:52 | FromDiscord | <Elegantbeef> Then just dont 😛 |
21:03:36 | FromDiscord | <Horizon [She/Her]> Maybe I'll develop PRs welcome-itis https://cdn.discordapp.com/emojis/1007839063920881737.png?quality=lossless&size=48 |
21:03:46 | FromDiscord | <Horizon [She/Her]> Oof no embeds |
21:04:08 | FromDiscord | <Elegantbeef> I dont really see why you need to wrap all of WASI for your project |
21:04:09 | FromDiscord | <guttural666> check if str is in pls: seq[string]? |
21:04:18 | FromDiscord | <Elegantbeef> `str in pls` |
21:04:46 | FromDiscord | <guttural666> Elegantbeef, what a chad |
21:05:08 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "I dont really see": I don't, i just want to wrap `fd_write` |
21:05:36 | FromDiscord | <Horizon [She/Her]> So you can use native APIs for file IO, but I'll just make a custom function and say "implement it yourself (please)" |
21:05:41 | FromDiscord | <amadan> In reply to @Avahe "How should nim be": asdf is another option and install a nightly so you don't need to build |
21:05:46 | FromDiscord | <Horizon [She/Her]> I'm sure the mod would attract some attention anyway, either way |
21:06:08 | FromDiscord | <Elegantbeef> I mean `writeFile(cstring, int)` isnt fucking rocket science↵(@Horizon [She/Her]) |
21:06:25 | FromDiscord | <Elegantbeef> If you cannot wrap that function you've got bigger problems 😄 |
21:07:14 | FromDiscord | <Elegantbeef> Like yes you cannot use the WASI api, but I mean you only want to load/write files is it really a big deal? |
21:08:41 | FromDiscord | <Elegantbeef> Where were you stuck on the fd\_write anyway? |
21:08:46 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Like yes you cannot": Not really, it's just annoying to me, like an itch you can't scratch |
21:08:54 | FromDiscord | <ShalokShalom> In reply to @Avahe "How should nim be": Guess you could also compile it with Zig CC |
21:09:04 | FromDiscord | <ShalokShalom> Cross compile |
21:09:06 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Where were you stuck": Just trying to wrap our heads on how it works, it's fine anyway now |
21:09:34 | FromDiscord | <Elegantbeef> That's not exactly a place 😄 |
21:09:42 | FromDiscord | <guttural666> ZIGs compile tools are pretty wicked so I have heard |
21:09:44 | FromDiscord | <Elegantbeef> Something obviously confused you about their API |
21:09:54 | FromDiscord | <Elegantbeef> What do they wick? |
21:10:24 | FromDiscord | <Elegantbeef> Will guttural ever write Zig, find out next time on Dragon Ball Z |
21:10:38 | FromDiscord | <Elegantbeef> Do you write NIM guttural? |
21:10:45 | FromDiscord | <Elegantbeef> If so i'm blocking you |
21:11:13 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "That's not exactly a": Fair aha, i was particularly struggling with trying to get `iovs` into an `Iovec`, but I'll probably continue actually banging my head on this another day now because energy is so low after screaming mentally |
21:11:38 | FromDiscord | <guttural666> hahaha |
21:11:53 | FromDiscord | <guttural666> I am rn haha |
21:12:03 | FromDiscord | <Elegantbeef> https://github.com/wasm3/wasm3/blob/main/source/m3_api_wasi.c#L191-L201↵(@Horizon [She/Her]) |
21:12:19 | FromDiscord | <Elegantbeef> They use a lot of C macros |
21:12:34 | FromDiscord | <Elegantbeef> Wait that's the wrong proc |
21:13:04 | FromDiscord | <Elegantbeef> hmm is it? |
21:14:00 | FromDiscord | <Elegantbeef> Do you know how wasm3's host proc calls store their parameters? |
21:14:10 | * | arkanoid quit (Ping timeout: 252 seconds) |
21:14:12 | FromDiscord | <Elegantbeef> That might make this make more sense |
21:14:13 | FromDiscord | <guttural666> Nim compiler complaining about the wrong indentation for comments, gawd damn 😄 |
21:14:27 | FromDiscord | <guttural666> simply refused to compile, that's so funn a.D |
21:14:34 | FromDiscord | <guttural666> funny 😄 |
21:14:52 | * | arkanoid joined #nim |
21:15:01 | FromDiscord | <Horizon [She/Her]> I'll note the link down for later, but where do you get `m3ApiCheckMem` from in the wasm3 bindings? Was looking but couldn't find it unless we're more blind than we thought, in which case we should probably get our eyes tested again |
21:15:31 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Do you know how": Not really, magic hurts small playdough brain |
21:15:40 | FromDiscord | <Elegantbeef> https://github.com/wasm3/wasm3/blob/aba42b533e8ff03407e0eafac52edb943114b79f/source/wasm3.h#L340 |
21:15:47 | FromDiscord | <Elegantbeef> It's not even magic |
21:16:11 | FromDiscord | <Elegantbeef> It provides a stack pointer `sp` you offset that pointer for each parameter |
21:16:56 | FromDiscord | <Elegantbeef> So if you have `i(ii)` the stack pointer is pointing at result, you then increment it by 8bytes for the first parameter, then increment it again for the next |
21:17:27 | FromDiscord | <Elegantbeef> Of course if it's a complex type you get a wasm side pointer to the data you need to get the memory from |
21:18:24 | FromDiscord | <Elegantbeef> `i(ii)` is a `proc(a, b: int32): int32` in Nim if unclear |
21:19:55 | termer | Looking at the release build flags, I came across -d:danger |
21:20:01 | termer | what does that do exactly |
21:20:07 | FromDiscord | <Elegantbeef> Which is why they do `returnType` `getARg` `getArgMem` ... |
21:20:12 | FromDiscord | <Elegantbeef> It disables most runtime checks |
21:20:18 | termer | Oh I see |
21:20:57 | FromDiscord | <Elegantbeef> the `checkMem` just ensures that the data is within wasm runtime memory |
21:20:59 | FromDiscord | <banan|crab> why is my post request not working |
21:21:09 | FromDiscord | <banan|crab> ill post the error in a bit |
21:21:21 | FromDiscord | <Elegantbeef> Wasm3 uses very little magic, quite a bit of C-isms but it's not overly hard to understand |
21:21:36 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "It provides a stack": Wdym by offset the pointer? Do you mean from the pointer in the wasm context (which i assume isn't a pointer in the sense of how C and other langs use it), add/subtract that by the length of the data for the value you're getting (as you said, 8 bytes for int32s for example)? I know I'm repeating what you're saying but, trying to digest the information clearly |
21:21:48 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "`i(ii)` is a `proc(a,": Yeah we understood the message signature parts |
21:23:09 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4fsa |
21:24:43 | FromDiscord | <Horizon [She/Her]> How would you get the wasm side pointer? Would it be similar to how we get the values from C, but instead just, obviously on the WASM side? So to get `buf_len` after reading `buf`, shift by 8 bytes? |
21:25:14 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Wasm3 uses very little": Yeah that's fair, our brain is just literally wired stupidly |
21:25:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsc |
21:26:14 | FromDiscord | <Elegantbeef> Yes structs are complex types Wasm does not define structs in the standard |
21:26:31 | FromDiscord | <Elegantbeef> A struct(without the experimental multiple return types feature) is actually a pointer in wasm |
21:27:42 | FromDiscord | <Elegantbeef> In the case of complex types you need to do stuff like this https://github.com/beef331/wasm3/blob/master/src/wasm3.nim#L180-L200 |
21:28:08 | FromDiscord | <Elegantbeef> `m3GetMemory` returns a pointer to the start of the wasm3 memory |
21:28:29 | FromDiscord | <Elegantbeef> pos is got from exposing `alloc` to the host and calling it from there |
21:29:26 | FromDiscord | <Elegantbeef> An example of a host managed growable array is here https://github.com/beef331/aiarena/blob/master/src/core/wasmenvs.nim#L48-L60 |
21:30:06 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Nimlangserver likely will work": I have not found such a repo |
21:30:11 | FromDiscord | <ShalokShalom> Is it part of another one? |
21:30:34 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/langserver |
21:30:36 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Nimlsp likes to crash": Maybe PMunch should have written in it F# 😋 |
21:30:48 | FromDiscord | <Elegantbeef> That doesnt solve any problem |
21:30:53 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "https://github.com/nim-lang/langserver": Thanks a lot 🥳 |
21:31:03 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "That doesnt solve any": Obviously, I am joking. |
21:31:05 | FromDiscord | <Elegantbeef> Nimlsp is code ontop of nimsuggest |
21:31:19 | FromDiscord | <guttural666> that PMunch guy, was that a prof of Andi or something like that? |
21:31:42 | FromDiscord | <Elegantbeef> What the hell are you talking about guttural |
21:31:44 | FromDiscord | <guttural666> lot of stuff by him on Github, like nimlsp |
21:31:59 | FromDiscord | <Elegantbeef> He's a domesticated viking or something like that |
21:32:05 | FromDiscord | <ShalokShalom> I doubt it, considering they appear to be of similar age |
21:32:30 | FromDiscord | <guttural666> okay, thought I read something like that, don't be mean Beef |
21:32:38 | FromDiscord | <Elegantbeef> Yea yea yea, but you guys think that i'm anicent |
21:32:45 | FromDiscord | <Elegantbeef> I'll be what i want to be |
21:33:07 | FromDiscord | <guttural666> are you PMunch on Github? |
21:33:12 | FromDiscord | <ShalokShalom> Wait |
21:33:14 | FromDiscord | <abby.> is there a better way to structure this? |
21:33:15 | FromDiscord | <ShalokShalom> https://github.com/saem/vscode-nim#nim-lanugage-server-integration-experimental |
21:33:23 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsd |
21:33:40 | FromDiscord | <abby.> (edit) "https://play.nim-lang.org/#ix=4fsd" => "https://play.nim-lang.org/#ix=4fse" |
21:33:54 | FromDiscord | <ShalokShalom> The VSCode extension from saem uses optionally Nim Language Server, which in turn again uses nimsuggest? |
21:34:00 | FromDiscord | <ShalokShalom> So we add another layer? |
21:34:06 | FromDiscord | <Elegantbeef> Abby here writing code that is the last nim possible! 😄 |
21:34:09 | FromDiscord | <Elegantbeef> least\ |
21:34:19 | FromDiscord | <abby.> wdym |
21:34:22 | FromDiscord | <abby.> haha |
21:34:32 | FromDiscord | <ShalokShalom> In reply to @guttural666 "are you PMunch on": No, PMunch has an account here |
21:34:39 | FromDiscord | <guttural666> 😄 Beef is very mean today 😄 |
21:34:44 | FromDiscord | <Elegantbeef> Nimlangserver uses LSP and also monitors nimsuggest better and also uses a newer version of nimsuggest |
21:34:51 | FromDiscord | <abby.> this is only my second project in this language lol |
21:35:02 | FromDiscord | <ShalokShalom> 🤪 |
21:35:02 | FromDiscord | <guttural666> In reply to @ShalokShalom "No, PMunch has an": ah okay, Beef is talking confusing stuff ^^^^ |
21:35:11 | FromDiscord | <ShalokShalom> How many layers are that |
21:35:12 | FromDiscord | <Elegantbeef> you can do `func initLexer....` you dont need `return '\0'` |
21:35:26 | FromDiscord | <abby.> wdym? |
21:35:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsf |
21:35:42 | FromDiscord | <abby.> wow |
21:35:48 | FromDiscord | <abby.> whats result? |
21:35:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsg |
21:35:54 | FromDiscord | <ShalokShalom> That sounds more convoluted than Ionide, which does a similar 2 layer abstraction |
21:36:12 | FromDiscord | <ShalokShalom> Dont so many layers introduced a lot of performance penalties |
21:36:20 | FromDiscord | <ShalokShalom> And make the code more compley |
21:36:25 | FromDiscord | <ShalokShalom> (edit) "compley" => "complex" |
21:36:30 | FromDiscord | <Elegantbeef> Also `prevPos` and `currPos` are 0 by default so not really needed |
21:36:30 | FromDiscord | <Elegantbeef> result is an implicitly created variable |
21:37:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsh |
21:37:08 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Ok so to go": Ah good to know! |
21:37:09 | FromDiscord | <Elegantbeef> This is mostly IO bound code↵(@ShalokShalom) |
21:37:15 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsi |
21:37:18 | FromDiscord | <Elegantbeef> correct |
21:37:32 | FromDiscord | <Elegantbeef> All nim variables are intialized to `0` so in `char`s case that is a `\0` |
21:37:38 | FromDiscord | <abby.> damn thats cool |
21:37:49 | FromDiscord | <abby.> i need to work w this language more lol |
21:37:51 | FromDiscord | <Horizon [She/Her]> Thanks beef! I think we understand it a lot better than before |
21:38:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsj |
21:39:22 | FromDiscord | <Elegantbeef> also `var int` is invalid for a parameter |
21:39:30 | FromDiscord | <Elegantbeef> not parameter |
21:39:30 | FromDiscord | <Elegantbeef> Field |
21:39:31 | FromDiscord | <Elegantbeef> it's just `int` |
21:42:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsl |
21:43:10 | FromDiscord | <Elegantbeef> Actually it might even be `func init(_: typedesc[Lexer], str: string): Lexer` so you can do `Lexer.init("hello")` |
21:44:31 | FromDiscord | <Elegantbeef> Abby has left the building 😛 |
21:44:55 | FromDiscord | <Elegantbeef> Whoops `peek` should be `result = lexer.src....` |
21:45:36 | FromDiscord | <abby.> sorry i was afk xd |
21:45:44 | FromDiscord | <abby.> why func vs proc? |
21:45:57 | FromDiscord | <Elegantbeef> you wrote `proc {.noSideEffect.}` |
21:46:00 | FromDiscord | <Elegantbeef> That's what `func` is |
21:46:01 | FromDiscord | <abby.> In reply to @Elegantbeef "also `var int` is": if i didnt add, it complained about immutability |
21:46:15 | FromDiscord | <Elegantbeef> `: var Lexer` |
21:46:28 | FromDiscord | <Elegantbeef> You want to mutate an object you pass it as a `var` |
21:46:34 | FromDiscord | <abby.> ohhh |
21:46:35 | FromDiscord | <abby.> mb |
21:46:52 | FromDiscord | <abby.> i havent used this language for a hot minute :p |
21:47:18 | FromDiscord | <guttural666> welcome to the pleb club abby |
21:49:48 | FromDiscord | <Elegantbeef> More people to mock |
21:50:54 | FromDiscord | <abby.> how do i use the word end as a variable |
21:51:06 | FromDiscord | <Elegantbeef> you strop it, but it's best you dont |
21:51:07 | FromDiscord | <abby.> or do i just not |
21:51:13 | FromDiscord | <abby.> i guess i can call it finish |
21:51:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsr |
21:52:57 | * | pro quit (Quit: pro) |
21:53:55 | FromDiscord | <abby.> gotcha |
21:55:04 | FromDiscord | <abby.> In reply to @Elegantbeef "If you care about": so it has UFCS like D? |
21:55:16 | FromDiscord | <Elegantbeef> Yes |
21:55:20 | FromDiscord | <abby.> since you can do `object.func` or `func(object)` |
21:55:22 | FromDiscord | <abby.> very nice |
22:02:36 | FromDiscord | <guttural666> UFCS broke for me today tho, when having to disambiguate functions in different imports, like: data.ambig_func() had to be package_name.ambig_func(data), compiler refused to parse data.package_name.func() correctly |
22:07:51 | * | rockcavera quit (Remote host closed the connection) |
22:09:15 | FromDiscord | <Elegantbeef> Yea cause that's a dotexpr you have to either disambiguate on import or use C style calls of `moduleName.func(arg)` |
22:09:17 | * | jmdaemon joined #nim |
22:09:58 | FromDiscord | <guttural666> disam on import, how would that work? |
22:11:01 | FromDiscord | <Elegantbeef> `import package except ambigFunc` |
22:11:14 | FromDiscord | <Elegantbeef> `from package import onlyFuncINeed` |
22:11:24 | FromDiscord | <guttural666> ahhhhh |
22:11:42 | FromDiscord | <guttural666> again what learned |
22:11:43 | FromDiscord | <Elegantbeef> Personally i prefer doing `myModule.func(args)` unless it's literally the only proc i need |
22:12:13 | FromDiscord | <guttural666> nice, thanks |
22:12:58 | * | rockcavera joined #nim |
22:12:58 | * | rockcavera quit (Changing host) |
22:12:58 | * | rockcavera joined #nim |
22:16:24 | FromDiscord | <demotomohiro> Multiple modules sometimes have same name procedures but their parameters are usually different and doesn't need to disambiguate thanks to overloading. |
22:18:09 | FromDiscord | <guttural666> usually yes, so it's a reasonable default |
22:31:15 | FromDiscord | <abby.> is nim inspired by pascal? |
22:31:21 | FromDiscord | <abby.> some parts of it feel very pascal like |
22:32:23 | FromDiscord | <Elegantbeef> WEll oberon and modula |
22:32:26 | FromDiscord | <Elegantbeef> So yes |
22:34:05 | FromDiscord | <abby.> is there a better way of doing this btw or |
22:34:14 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsB |
22:34:32 | FromDiscord | <Elegantbeef> That's how i'd likely do it |
22:34:41 | FromDiscord | <Elegantbeef> You dont need the commas for enums though |
22:42:21 | FromDiscord | <abby.> fr? |
22:48:36 | FromDiscord | <abby.> beef how do i do a dictionary in nim? |
22:48:46 | FromDiscord | <Elegantbeef> `import std/tables` |
23:08:36 | FromDiscord | <ShalokShalom> The tk is to avoid conflicts within the same namespace? |
23:09:24 | FromDiscord | <abby.> ig |
23:09:30 | FromDiscord | <abby.> can i get help w/ why this is happening |
23:09:34 | FromDiscord | <Elegantbeef> It's a convention that predates `overloadableEnums` |
23:09:42 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsG |
23:09:53 | FromDiscord | <Elegantbeef> Well you removed the important part |
23:09:54 | FromDiscord | <abby.> https://pastebin.com/RXek9HKh |
23:09:58 | FromDiscord | <abby.> i sent the code |
23:10:06 | FromDiscord | <abby.> and this is what im giving it |
23:10:18 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsH |
23:10:27 | FromDiscord | <Elegantbeef> your peek uses `atEnd` |
23:10:31 | FromDiscord | <abby.> (edit) "https://play.nim-lang.org/#ix=4fsH" => "https://play.nim-lang.org/#ix=4fsI" |
23:10:39 | FromDiscord | <abby.> yeah |
23:10:55 | FromDiscord | <abby.> bc i wanna check if its at the end |
23:11:00 | FromDiscord | <Elegantbeef> `func atEnd(lexer: Lexer, offset = 0): bool = lexer.currPos + offset >= lexer.src.len`↵`if not lexer.atEnd(1): ...` |
23:11:18 | FromDiscord | <Elegantbeef> You can only peak if you're 1+ character from end |
23:11:21 | FromDiscord | <abby.> ohh |
23:11:32 | FromDiscord | <Elegantbeef> You're attempting to peek at the end of the data |
23:12:09 | FromDiscord | <abby.> it still didnt fix it |
23:12:23 | FromDiscord | <abby.> now i just get unexpected character '' |
23:14:04 | FromDiscord | <abby.> i replaced w this |
23:14:07 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsK |
23:14:54 | FromDiscord | <abby.> i just get this |
23:15:00 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsL |
23:15:32 | FromDiscord | <Elegantbeef> I'll look in a minute writing a PR right now |
23:15:35 | FromDiscord | <abby.> alright |
23:16:01 | FromDiscord | <abby.> https://pastebin.com/GEDg7w6e↵updated code but it still doesnt work |
23:20:06 | FromDiscord | <Elegantbeef> Are you not checking for `\0`? |
23:20:32 | FromDiscord | <abby.> wdym |
23:20:37 | FromDiscord | <Elegantbeef> You advance but dont check if it's `\0` |
23:20:48 | FromDiscord | <abby.> also im not sure why it literally either gives me a index error or prints this spam |
23:20:59 | FromDiscord | <abby.> sent a long message, see http://ix.io/4fsM |
23:21:21 | FromDiscord | <Elegantbeef> `of '\0': if lexer.atEnd: break` |
23:22:46 | FromDiscord | <Elegantbeef> You do make life difficult, giving one code they cannot run |
23:23:44 | FromDiscord | <abby.> its still broken |
23:23:46 | FromDiscord | <abby.> > Error: unhandled exception: index 1 not in 0 .. 0 [IndexDefect] |
23:23:58 | FromDiscord | <abby.> lemme post the code again |
23:24:13 | FromDiscord | <abby.> https://pastebin.com/GemeF5jV |
23:25:57 | FromDiscord | <abby.> im not sure where its getting index 1 from??? |
23:26:18 | FromDiscord | <abby.> sent a code paste, see https://play.nim-lang.org/#ix=4fsP |
23:26:19 | FromDiscord | <abby.> (edit) "1" => "3" |
23:26:39 | FromDiscord | <Elegantbeef> Either throw the code on a repo or put it on https://wandbox.org/ |
23:28:03 | FromDiscord | <abby.> ill put it on github |
23:28:28 | FromDiscord | <Elegantbeef> Again it's the same issue no? |
23:29:04 | FromDiscord | <Elegantbeef> `if not lexer.atEnd(1)` will cause you not to index the out of bounds character |
23:29:05 | FromDiscord | <Elegantbeef> Advance and peek need 1 character to consume |
23:29:32 | FromDiscord | <abby.> https://github.com/megabytesofrem/tsuki |
23:30:07 | FromDiscord | <abby.> > if not lexer.atEnd(1) will cause you not to index the out of bounds character↵if i do this its get stuck in a infintie loop... |
23:30:19 | FromDiscord | <abby.> i posted it on github |
23:31:37 | FromDiscord | <abby.> could u take a look if thats ok? |
23:35:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsQ |
23:35:19 | FromDiscord | <Elegantbeef> Advance will always move the head forward |
23:35:36 | FromDiscord | <Elegantbeef> If it's at the last character it'll move it forward and return `\0` |
23:35:48 | FromDiscord | <abby.> what else did u change? |
23:37:21 | FromDiscord | <abby.> because my integer scanning code is broken rn |
23:37:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsR |
23:39:16 | FromDiscord | <abby.> its broken when trying to scan `abc` |
23:39:26 | FromDiscord | <abby.> does it work for u? |
23:40:27 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsT |
23:40:35 | FromDiscord | <abby.> yeah see |
23:40:37 | FromDiscord | <abby.> its broken |
23:40:41 | FromDiscord | <abby.> i have no idea why |
23:41:31 | FromDiscord | <Elegantbeef> Well `currPos` should be `-1` to start |
23:43:22 | FromDiscord | <Elegantbeef> Or you should stop doing `data[1 + currPos]` and just use `currPos` |
23:45:56 | arkanoid | please help me remember the name of that package capable of building cmdline options from function signature & also parsing same options from file if available |
23:46:06 | FromDiscord | <Elegantbeef> cligen? |
23:46:17 | arkanoid | yeah! |
23:46:19 | arkanoid | thanks |
23:46:32 | FromDiscord | <Elegantbeef> There are a lot of CLI gen libraries |
23:47:13 | FromDiscord | <abby.> @ElegantBeef is there a equivalent to x++ |
23:47:19 | FromDiscord | <Elegantbeef> `inc x` |
23:47:29 | FromDiscord | <abby.> isn't that the same as += |
23:47:31 | FromDiscord | <Elegantbeef> Nim doesnt have postfix operators |
23:47:36 | FromDiscord | <Elegantbeef> you can do `inc x` |
23:47:42 | FromDiscord | <Elegantbeef> It increments x 1 |
23:47:49 | FromDiscord | <albassort> Hey how do you feel about constructors |
23:48:13 | FromDiscord | <Elegantbeef> I find them tedious everywhere you go |
23:48:18 | FromDiscord | <albassort> I feel as if currently the situation where you have to define the procedure separately to do complex instantiation is a bit weird |
23:48:41 | FromDiscord | <albassort> In reply to @Elegantbeef "I find them tedious": I think they're kind of okay in C++, but they're implemented weird |
23:48:52 | FromDiscord | <Elegantbeef> Nim2.0 will add default values but it's still not great |
23:49:05 | FromDiscord | <albassort> If you can add procedures in there then it's fine I guess |
23:49:20 | FromDiscord | <Elegantbeef> https://github.com/beef331/constructor is how much i hate them |
23:49:21 | FromDiscord | <albassort> Or just statements |
23:49:27 | arkanoid | procedures in objects? |
23:49:30 | FromDiscord | <Elegantbeef> I still dont like those macros |
23:49:50 | FromDiscord | <Elegantbeef> I think the requirement is that the default value must be statically known presently |
23:51:15 | FromDiscord | <abby.> @ElegantBeef right but ++ gets the current value then increments how would i do this in nim |
23:51:16 | FromDiscord | <albassort> In reply to @arkanoid "procedures in objects?": type bLa = ref object↵ int example = procedure(input) |
23:51:19 | FromDiscord | <albassort> Or something |
23:51:35 | FromDiscord | <albassort> On mobile and hungry so I can't think |
23:51:37 | FromDiscord | <Elegantbeef> `inc` is the same as `++` |
23:51:41 | FromDiscord | <Elegantbeef> It just doesnt return the value |
23:51:49 | FromDiscord | <abby.> then what's += |
23:51:51 | FromDiscord | <abby.> for |
23:52:02 | FromDiscord | <Elegantbeef> They're identical semantics `inc` just defaults to adding 1 |
23:52:08 | FromDiscord | <abby.> ohh |
23:52:11 | FromDiscord | <Elegantbeef> `inc x, 2` is the same as `x += 2` |
23:52:19 | FromDiscord | <Elegantbeef> `inc x` does `x += 1` |
23:52:28 | FromDiscord | <albassort> In reply to @Elegantbeef "https://github.com/beef331/constructor is how much": This is the second most useful thing you've ever worked on |
23:52:33 | FromDiscord | <albassort> I kind of like it |
23:52:45 | FromDiscord | <Elegantbeef> What's the first? |
23:52:52 | FromDiscord | <albassort> Did you work on the terminal graph thing |
23:53:01 | FromDiscord | <albassort> With Yard |
23:53:06 | FromDiscord | <Elegantbeef> No |
23:53:13 | FromDiscord | <albassort> This is the first most useful thing |
23:53:24 | FromDiscord | <Elegantbeef> Literally a compiler contributor |
23:53:41 | FromDiscord | <albassort> Okay I haven't seen your compiler PRs |
23:53:58 | FromDiscord | <albassort> WHAT HAVE YOU DONE FOR ME LATELY |
23:54:26 | FromDiscord | <albassort> apart from being a valuable chat member and useful member of my life |
23:57:29 | FromDiscord | <Elegantbeef> `++` actually saves two bytes |
23:57:32 | FromDiscord | <Elegantbeef> `inc` requires a space |
23:58:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fsV |
23:59:17 | FromDiscord | <ChocolettePalette> Wow, considering C++ operator overloading, this one seems very logical ngl |
23:59:19 | FromDiscord | <abby.> how do u implement i++ |
23:59:31 | FromDiscord | <Elegantbeef> Nim doesnt have postfix operators |
23:59:51 | FromDiscord | <Elegantbeef> That's partially a lie it has the export marker and `[]` |