<< 09-11-2022 >>

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