<< 04-08-2021 >>

00:31:49*[R] joined #nim
00:56:53*thunder quit (Remote host closed the connection)
01:03:15*thunder joined #nim
01:20:14*thunder quit (Remote host closed the connection)
01:20:40*thunder joined #nim
01:33:00nrds<Prestige99> that's interesting
01:33:26nrds<Prestige99> oh you can still use $ with decimals, cool
01:37:45*arkurious quit (Quit: Leaving)
01:40:26FromDiscord<Elegantbeef> Prestige impressed with the oddest thing
01:41:29FromDiscord<theangryepicbanana> In reply to @@bracketmaster-5a708063d73408ce4 "I know `$` is": isn't `$` already `toString` thought?
01:41:31FromDiscord<theangryepicbanana> (edit) "thought?" => "though?"
01:42:23FromDiscord<Elegantbeef> Hey i found it odd, but i just showed them how \:D
01:42:43FromDiscord<theangryepicbanana> fair enough
01:43:43FromDiscord<Elegantbeef> Sometimes i should say the "but why" instead of just giving a solution
01:43:43FromDiscord<Elegantbeef> Sometimes i should say the
01:46:43*rockcavera joined #nim
01:46:43*rockcavera quit (Changing host)
01:46:43*rockcavera joined #nim
01:57:14*auxym quit (Ping timeout: 258 seconds)
02:02:21nrds<Prestige99> :)
03:05:17*krux02 quit (Remote host closed the connection)
03:09:58*thunder quit (Remote host closed the connection)
03:16:06*thunder joined #nim
03:31:46*rockcavera quit (Remote host closed the connection)
03:32:44FromDiscord<Rika> The
03:35:02FromDiscord<Elegantbeef> quick
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:34*supakeen joined #nim
06:19:02FromDiscord<ynfle (ynfle)> Is this a bug https://play.nim-lang.org/#ix=3uX7? Why can't a NimNode's kind be determined at compile time. Its' only ever available then
06:21:58FromDiscord<Elegantbeef> Except when that procedure is instantiated there is no way to reason what x.kind is
06:23:38FromDiscord<ynfle (ynfle)> I'm not sure what that means?
06:24:04FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3uX8 this might work for you
06:25:29FromDiscord<Elegantbeef> Well let's look what you're asking, you call a procedure providing an argument, so that means everytime you invoke this procedure `x.kind` would need to be changed since `{.error.}` only takes consts
06:26:10FromDiscord<ynfle (ynfle)> But at compile time, all of the instantiations are known
06:26:27FromDiscord<Elegantbeef> There is only one instantiation of this procedure
06:26:34FromDiscord<ynfle (ynfle)> It is a minified example
06:26:49FromDiscord<Elegantbeef> It doesnt matter what you do to it
06:26:49FromDiscord<ynfle (ynfle)> Oh
06:27:01FromDiscord<ynfle (ynfle)> So the error message isn't acurate
06:27:12FromDiscord<Elegantbeef> Well it is
06:27:20FromDiscord<Elegantbeef> Or sorta is
06:27:21FromDiscord<ynfle (ynfle)> Why?
06:27:42FromDiscord<Elegantbeef> Cause it cannot reason what x in a constant frame
06:28:24FromDiscord<Elegantbeef> It knows it'll be a Nimnode but has 0 clue what it could contain
06:29:21FromDiscord<Elegantbeef> I suppose if NimNodes were treated as a `static` it'd enable that, but the implications would be weird
06:29:38FromDiscord<Elegantbeef> Plus i might be spewing some amount of inconsistencies šŸ˜€
06:30:33*thunder quit (Quit: Leaving)
06:34:22FromDiscord<ynfle (ynfle)> https://play.nim-lang.org/#ix=3uX9
06:35:58FromDiscord<Elegantbeef> I said "if they were treated"
06:37:19FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/zj5
06:37:34FromDiscord<Elegantbeef> I still just say use expect kinds where you need to or assertions
06:42:49FromDiscord<ynfle (ynfle)> I have a proc that uses a case statement and I want to produce a useful error message
06:44:57FromDiscord<ynfle (ynfle)> For when a node was passed in that isn't part of the case statement
06:45:58FromDiscord<ynfle (ynfle)> If I use expectkind, I'd have to manually collect all of the NimNode possibilities
06:51:06*neceve joined #nim
06:53:42FromDiscord<Elegantbeef> To steal some logic from CPS https://play.nim-lang.org/#ix=3uXe
06:54:48FromDiscord<Elegantbeef> Plus error doesnt really do what you want https://play.nim-lang.org/#ix=3uXf
06:58:10FromDiscord<ynfle (ynfle)> Is there a reason that the example in https://nim-lang.github.io/Nim/manual_experimental.html#case-statement-macros doesn't compile?
06:58:28FromDiscord<ynfle (ynfle)> @elegantbeef\:matrix.org it's not exactly what I need
06:59:04FromDiscord<Elegantbeef> those are devel logs, replace `case` with `match`
06:59:24*max22- joined #nim
07:00:05FromDiscord<Elegantbeef> Notice it doesnt use `{.error.}` it uses `error(msg)`
07:01:01FromDiscord<Elegantbeef> As such you dont have that compile time issue since it's not in a pragma https://play.nim-lang.org/#ix=3uXh
07:03:20FromDiscord<ynfle (ynfle)> Ohhh
07:03:49FromDiscord<ynfle (ynfle)> \:facepalm
07:27:40FromDiscord<ynfle (ynfle)> Thanks for the help @elegantbeef\:matrix.org
07:34:26FromDiscord<zygon.sisyphus> hi
07:36:23FromDiscord<zygon.sisyphus> how possible is to use zig / zig cc as compiler for nim ? also, is possible to generate zig instead of c as intermediate lang ?
07:36:35FromDiscord<zygon.sisyphus> or combine c + zig
07:37:01FromDiscord<Elegantbeef> People have used the zig compiler as the C compiler and no Nim doesnt have a zig backend
07:37:04FromDiscord<zygon.sisyphus> how dificult will be to implement this ?
07:37:12FromDiscord<ynfle (ynfle)> Zig compiler, yes. generate zig, yes, but it'd require tons of work
07:37:50FromDiscord<Elegantbeef> What'd even be the benefit to using nim -\> zig
07:38:01FromDiscord<Elegantbeef> We already have nlvm so seems more sensiible to work on that
07:38:18FromDiscord<zygon.sisyphus> is cleaner than c and integrates better with libs
07:38:36FromDiscord<zygon.sisyphus> as cross platform target
07:38:42FromDiscord<Elegantbeef> Again what's the benefit over nlvm
07:39:39FromDiscord<zygon.sisyphus> nlvm ?
07:39:53FromDiscord<Elegantbeef> https://github.com/arnetheduck/nlvm
07:39:56nrds<R2D299> itHub: 7"LLVM-based compiler for the Nim language"
07:41:07FromDiscord<zygon.sisyphus> thx, i didn't know about nlvm
07:44:20FromDiscord<ynfle (ynfle)> 1) the nim c instead supposed to be read. 2) using the zig compiler with nim c, it becomes cross platform
07:47:27FromDiscord<Elegantbeef> Well also Zig's compiler for C is mostly just clang isnt it?
07:47:30FromDiscord<zygon.sisyphus> the "advantages" are on front page https://ziglang.org
07:47:50FromDiscord<zygon.sisyphus> sent a long message, see http://ix.io/3uXw
07:47:55FromDiscord<Elegantbeef> but how is that a benefit over using C as an IR
07:48:05FromDiscord<Elegantbeef> C has a compiler for almost every cpu
07:48:31FromDiscord<Elegantbeef> So if you have a CPU you can most likely run Nim
07:48:45FromDiscord<zygon.sisyphus> today the development is more than just the compiler
07:48:53FromDiscord<ynfle (ynfle)> That's only an issue for writing programs not generating
07:49:59FromDiscord<zygon.sisyphus> is about libs, package mangement, dependecy management, crossplatform, static analysis
07:50:18FromDiscord<Elegantbeef> But Nim already does most of that
07:50:29FromDiscord<zygon.sisyphus> at hi level
07:51:06FromDiscord<zygon.sisyphus> it was just an idea
07:51:08FromDiscord<ynfle (ynfle)> Right
07:51:18FromDiscord<Elegantbeef> I'm just trying to see the benefits
07:51:20FromDiscord<ynfle (ynfle)> Why do we need low level if we have high level?
07:52:00FromDiscord<zygon.sisyphus> it was based on my experience on testing some c projects
07:52:15FromDiscord<Elegantbeef> No one is writing the generated C code, so almost all of those aforementioned benefits are not actually needed
07:52:20FromDiscord<zygon.sisyphus> is as bad as was 20 year ago
07:52:29FromDiscord<Elegantbeef> But nim isnt C
07:53:32FromDiscord<zygon.sisyphus> but most of the time is necessary to have low level integration and most OS Api today are desined based on libc
07:54:03FromDiscord<zygon.sisyphus> so an middle level that can solve some issues is an idea
07:54:16FromDiscord<ynfle (ynfle)> Which issues?
07:54:34FromDiscord<ShalokShalom> How does have Nim implemented the effects tracking, to say if func is pure or not?
07:54:34FromDiscord<zygon.sisyphus> package/libs management
07:54:42FromDiscord<Elegantbeef> How does zig solve that
07:54:44FromDiscord<zygon.sisyphus> header management
07:54:50FromDiscord<zygon.sisyphus> references
07:55:34FromDiscord<haxscramper> In reply to @ShalokShalom "How does have Nim": Each procedure is either manually annotated with effects, or they are computed based on its body.
07:56:22FromDiscord<haxscramper> Some "root" procedures like echo has manual side effect annotation, which then propagates through the callers
07:57:30FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/devel/compiler/sempass2.nim#L1338
07:57:32*xet7 quit (Remote host closed the connection)
07:58:21FromDiscord<haxscramper> This has nothing to do with low-level backend, features.
07:58:33FromDiscord<zygon.sisyphus> I think the same apply to rust
07:58:35*xet7 joined #nim
07:58:45FromDiscord<zygon.sisyphus> but rust is to llvm dependent
07:59:44FromDiscord<ynfle (ynfle)> What applies to rust?
08:01:17FromDiscord<haxscramper> I think we have a misunderstanding, because I'm also having hard time figuring out how zig backend would affect anything you listed earlier
08:01:18FromDiscord<zygon.sisyphus> use rust/zig instead of plain c
08:01:56FromDiscord<Elegantbeef> Feel free to make a `ziggen.nim` file in the compiler to get the rewards
08:01:58FromDiscord<haxscramper> Why this would be better? Compiling to rust is probably useless idea in the first place
08:02:09FromDiscord<haxscramper> Like, really useless
08:02:19FromDiscord<zygon.sisyphus> the idea is to combine an hi level lang with GC with low level no GC
08:02:19FromDiscord<Elegantbeef> Yea you still havent said why it's beneficial clearly
08:02:24FromDiscord<Elegantbeef> But that's not what nim is
08:02:24*max22- quit (Ping timeout: 276 seconds)
08:02:28FromDiscord<haxscramper> C/js?
08:03:16FromDiscord<haxscramper> I mean C does have a package management solutions (usually they are a distro PM but anyway)
08:03:41FromDiscord<haxscramper> And C is almost universal language for interop
08:03:43FromDiscord<zygon.sisyphus> for big projects c is dificult to read and allow to many errors
08:03:51FromDiscord<haxscramper> Yes, but nim is not C
08:03:52FromDiscord<Elegantbeef> Which is why we say write Nim
08:03:58FromDiscord<haxscramper> Nim generates C
08:04:08FromDiscord<zygon.sisyphus> this is ok
08:04:11FromDiscord<Elegantbeef> You arent using C + Nim, you're using Nim
08:04:29FromDiscord<zygon.sisyphus> until you need to interact with other libs, usualy c/c++
08:04:38FromDiscord<Elegantbeef> And you still arent using C/C++
08:04:46FromDiscord<zygon.sisyphus> because OS needs c/libc
08:04:56FromDiscord<Elegantbeef> You write bindings and then use Nim
08:05:00FromDiscord<Elegantbeef> Have you actually used Nim?
08:05:10FromDiscord<zygon.sisyphus> not yet
08:05:18FromDiscord<zygon.sisyphus> just try some demo
08:05:28FromDiscord<zygon.sisyphus> just try some samples
08:05:44FromDiscord<ynfle (ynfle)> Of nim?
08:05:50FromDiscord<zygon.sisyphus> need an good IDE with debug support
08:05:54FromDiscord<haxscramper> Nim can interface with c and c++ without having to actually write C/c++ code
08:06:25FromDiscord<Elegantbeef> You do need to write/generate bindings, but that can be slightly automated using `c2nim` and `nimterop`
08:06:36FromDiscord<Elegantbeef> But many popular libraries already have bindings
08:06:57FromDiscord<zygon.sisyphus> compared to crates.io ?
08:07:02FromDiscord<zygon.sisyphus> how many ?
08:07:10FromDiscord<zygon.sisyphus> how stable ?
08:07:35FromDiscord<Elegantbeef> Am i supposed to grab a stick and count?
08:07:53FromDiscord<Elegantbeef> They're rather stable since most C libraries are rather concreted as APIs
08:07:59emeryi heard that most crates were garbage
08:08:03FromDiscord<zygon.sisyphus> no, I was just curios what popular is
08:08:30FromDiscord<zygon.sisyphus> crates is better than npmjs
08:08:42FromDiscord<Elegantbeef> Sdl, Opengl, Glfw, Imgui, X, WinApi, Gtk, Qt is a small selection
08:08:48FromDiscord<haxscramper> > qt
08:08:52FromDiscord<haxscramper> Qt qml
08:08:55FromDiscord<haxscramper> Lest be honest here
08:09:01FromDiscord<zygon.sisyphus> ssl, cypto, libuv ?
08:09:10FromDiscord<Elegantbeef> openssl, bearssl
08:09:29FromDiscord<zygon.sisyphus> how about serialization ? cbor, xml, json ?
08:09:38FromDiscord<Elegantbeef> xml and json are stdlib
08:10:13FromDiscord<zygon.sisyphus> pessagepack ?
08:10:14FromDiscord<Elegantbeef> https://nimble.directory/ probably more beneficial
08:10:15FromDiscord<zygon.sisyphus> messagepack ?
08:10:57FromDiscord<zygon.sisyphus> ok, thx ( https://nimble.directory/ )
08:10:57FromDiscord<zygon.sisyphus> probabli I don't know all about nim
08:10:58FromDiscord<zygon.sisyphus> need more info
08:11:03emerycbor is outside stdlib
08:11:09FromDiscord<Elegantbeef> Well you're talking about non problems \:D
08:11:22FromDiscord<zygon.sisyphus> I didn't say is a problam
08:11:26FromDiscord<zygon.sisyphus> I didn't say is a problaem
08:11:38FromDiscord<zygon.sisyphus> I didn't say is a problem
08:11:48FromDiscord<Elegantbeef> Well you suggested using zig to solve problems which is what i was referencing
08:11:57FromDiscord<zygon.sisyphus> It was just an idea
08:12:25FromDiscord<Elegantbeef> Hey i'm not going to hold it against you, i just jest
08:12:26FromDiscord<zygon.sisyphus> I just like zig more than c/c++
08:14:40FromDiscord<zygon.sisyphus> that is why I switch to c#
08:14:40FromDiscord<haxscramper> Compiling to smart languages is harder
08:14:40FromDiscord<zygon.sisyphus> now I'm investigating alternatives like nim, vala ,...
08:14:40FromDiscord<haxscramper> Compiling to C is easy because it is dumb as brick
08:14:40FromDiscord<Elegantbeef> Nim isnt an alternative to C# per se
08:14:40FromDiscord<zygon.sisyphus> is not
08:14:40FromDiscord<Elegantbeef> It's a systems language so it's capable of what C/Zig/C++ can do
08:14:40FromDiscord<zygon.sisyphus> I agree
08:15:41FromDiscord<zygon.sisyphus> c is not easy to replace
08:17:24FromDiscord<zygon.sisyphus> nim is opensouce, so if somebody want to implemnt zig backed is possible
08:17:40FromDiscord<Elegantbeef> Yes
08:21:20FromDiscord<Elegantbeef> You also have the jsgen and cgen modules as reference
08:21:21FromDiscord<zygon.sisyphus> ok
08:21:21FromDiscord<zygon.sisyphus> this is the info I need
08:21:22FromDiscord<zygon.sisyphus> just need to add an new one
08:21:22FromDiscord<zygon.sisyphus> cgen is for c++ also\\
08:21:23FromDiscord<zygon.sisyphus> cgen is for c++ also?
08:21:23FromDiscord<zygon.sisyphus> the backend is modular and independent
08:21:24FromDiscord<Elegantbeef> I dont know
08:55:54*max22- joined #nim
09:05:33FromDiscord<ShalokShalom> @haxscramper In regards to func:↵↵How do you that with higher order functions?
09:05:48FromDiscord<ShalokShalom> To ensure no side effects
09:06:02FromDiscord<Rika> the type of a func is `proc (...): ... {.noSideEffects.}`
09:07:27FromDiscord<ShalokShalom> Because the approach of having a single keyword means you cannot express "this function is pure if it's arguments are pure"
09:07:38FromDiscord<ShalokShalom> @Rika I know
09:07:50FromDiscord<ShalokShalom> The question is, how higher order functions work on that
09:07:52arkanoidany news on the "code coverage" topic?
09:07:58FromDiscord<haxscramper> no
09:08:13FromDiscord<haxscramper> In reply to @ShalokShalom "Because the approach of": https://github.com/nim-lang/RFCs/issues/404 https://github.com/nim-lang/RFCs/issues/403
09:08:38FromDiscord<haxscramper> Right now effects are inferred based on callback effectrs
09:09:00FromDiscord<haxscramper> but ultimately you can put anything in the callback, and it is not possible to fully track
09:09:25FromDiscord<haxscramper> So `cb: proc()` means `{.raises: [Any], effects: [AllEffects].}` roughly speking
09:09:51FromDiscord<haxscramper> In reply to @arkanoid "any news on the": at least nothing changed since the last time
09:10:06FromDiscord<ShalokShalom> So there is no guarantee?
09:11:07FromDiscord<Rika> cant you enforce raises: [] and effects: [] in a type?
09:11:36FromDiscord<haxscramper> yes, you can
09:11:40arkanoidsad, nim really deserves a native code coverage tool
09:11:58arkanoidI enforce no exceptions and no effects all the time
09:12:16FromDiscord<haxscramper> In reply to @arkanoid "sad, nim really deserves": https://github.com/binhonglee/coco/issues/19
09:12:27arkanoid"func can raise side effects" is my favorite error
09:14:56FromDiscord<haxscramper> execution traces PR looks really promising
09:16:11FromDiscord<ShalokShalom> "Side effects are allowed in nosideeffect functions if the effect is passed as a parameter"↵↵ So you just dont care?
09:16:38arkanoidhaxscramper, I'm already getting nim coverage but is quite convoluted
09:16:39FromDiscord<ShalokShalom> sent a code paste, see https://play.nim-lang.org/#ix=3uXT
09:17:20FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3uXU
09:17:27FromDiscord<haxscramper> So yeah, you need to be explicit in that case
09:18:09FromDiscord<haxscramper> In reply to @arkanoid "<@608382355454951435>, I'm already getting": Are you using gcc coverage options? I do that as well, but they don't have perfect results
09:18:13FromDiscord<ShalokShalom> Aha, ok.
09:18:17FromDiscord<haxscramper> As they are based on `#line` in generated code
09:18:28FromDiscord<ShalokShalom> So why not preventing by default?
09:18:35FromDiscord<ShalokShalom> And letting the people choose a proc
09:18:45FromDiscord<ShalokShalom> I mean, that is the whole point of func
09:18:46FromDiscord<Rika> because when you say `proc()` it means proc and not func
09:19:00FromDiscord<haxscramper> yes, if you need no side effect you say so
09:19:02FromDiscord<Rika> same thing why you can do `x: var int` i guess
09:19:10FromDiscord<Rika> but it's "backwards"
09:19:10arkanoidhaxscramper, exactly
09:19:24FromDiscord<haxscramper> It would be really weird if `proc(cb: proc())` and `func(cb: proc())` would mean different things
09:19:33FromDiscord<Rika> since you're being less "funcy" by specifying less instead of more "funcy" for specifying less
09:19:51FromDiscord<ShalokShalom> In reply to @haxscramper "yes, if you need": isnt this, by using func?
09:19:55FromDiscord<Rika> no
09:20:02FromDiscord<Rika> think of it this way
09:20:10FromDiscord<ShalokShalom> šŸ˜„
09:20:14FromDiscord<Rika> the `func` is no side effects because you said so
09:20:25FromDiscord<haxscramper> Though I still don't understand why
09:20:25FromDiscord<Rika> but if you ask for a `proc()` you didnt say you wanted no side effects
09:20:26FromDiscord<haxscramper> `Error: func keyword is not allowed in type descriptions, use proc with {.noSideEffect.} pragma instead`
09:20:31FromDiscord<ShalokShalom> yeah, I understand that
09:20:37FromDiscord<Rika> In reply to @haxscramper "`Error: func keyword is": i was gonna say that'
09:20:40FromDiscord<haxscramper> FFS what was the reasoning for explicitly disallowing
09:20:46FromDiscord<Rika> func keyword for type would be super nice
09:20:58FromDiscord<haxscramper> yes, `{.noSideEffect.}` is just super verbose
09:21:02FromDiscord<Elegantbeef> There is a PR somewhere the enables it iirc
09:21:09FromDiscord<ShalokShalom> yeah, so passing in as parameters only happens at type definitions?
09:21:26FromDiscord<Rika> ?
09:21:40FromDiscord<Rika> wdym'
09:21:54FromDiscord<Rika> parameters, when not specified as no side effects, can have side effects
09:22:26FromDiscord<Rika> no matter if the thing the parameter is part of is a func or a proc
09:51:27arkanoidI keep having issues with vscode + nim, autocompletion just works for first 5 minutes, then I have to restart
10:13:29FromDiscord<konsumlamm> which plugin do you use?
10:50:10arkanoidnimsaem one
10:50:46arkanoidwhoa, HashSet dosn't work with type aliases
10:52:07arkanoidhttps://play.nim-lang.org/#ix=3uYb
10:52:10FromDiscord<Rika> type alias -> distinct or
10:52:36arkanoidno, not distinct, just plain alias
10:52:38FromDiscord<Rika> you're `=`
10:52:42FromDiscord<Rika> `:`
10:53:09FromDiscord<Rika> and add is wrong i believe
10:53:43FromDiscord<Rika> its not add, its `incl`
10:54:01FromDiscord<Rika> https://play.nim-lang.org/#ix=3uYc
10:59:33arkanoidoh! thanks
11:25:28*krux02 joined #nim
11:29:16*max22- quit (Ping timeout: 250 seconds)
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:35*supakeen joined #nim
12:12:31*max22- joined #nim
12:16:11arkanoidhow do I set a default for a var argument?
12:16:57arkanoidif I do myproc(foo: var HashSet[string] = HashSet[string]()) it complains that wants a var thing
12:18:31FromDiscord<exelotl> I don't think you can, as a var argument needs to be something that exists outside the called proc and is mutable
12:22:08FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3uYt
12:26:46FromDiscord<haxscramper> `proc q(a: var int = (var tmp = 12; tmp)) = discard`
12:28:34arkanoidthanks
12:28:50arkanoidit's for a recursive function that returns a collection
12:29:18arkanoidso first call wants an empty collection, default arg seems a correct choice here
12:30:24FromDiscord<haxscramper> I'd rather do↵↵func main() ... func aux(it\: var int)\`
12:30:31FromDiscord<Rika> why would you need a var param then?
12:30:36FromDiscord<haxscramper> And this `var tmp = 12; tmp` is a horrible hack
12:30:54FromDiscord<haxscramper> Like, yes it is possible, but don't do this, there are better ways
12:45:59*max22- quit (Ping timeout: 250 seconds)
12:57:22*arkurious joined #nim
13:01:36FromDiscord<haxscramper> I have a large project that uses jsony to write `JsonNode` to a file (along with multiple other fields). If json node is `nil` it silently crashes, without any stacktrace. When launched it under gdb I found out the crash happens after `switch ((v).kind) {` which is pretty unsurprising. I tried to reproduce the same issue at a smaller scale, but failed to do this - `import jsony, std/json; echo toJson(cast[JsonNode](nil))` generated
13:02:20FromDiscord<haxscramper> I did all the testing in the same directory, so if there is a configuration file that disabled stracktraces it should've affected both (not to mention all other exceptions are fine)
13:02:55FromDiscord<haxscramper> sent a code paste, see https://paste.rs/r4U
13:03:16FromDiscord<haxscramper> In both cases - for a large project, and for a smaller one
13:04:12FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3uYG
13:04:32FromDiscord<haxscramper> Failure happens in the same function, the only difference is how it is called - directly by `toJson`, or from other `.dumpHook()`
13:17:28arkanoidhaxscramper thanks for the suggestion, I've refactored the code
13:17:56FromDiscord<StefanSalewski (StefanSalewski)> For the var parameter default value we can also use the cast[ptr t](http://nil)[] hack as suggested by https://github.com/StefanSalewski/gintro/issues/102#issuecomment-726454448
13:18:05FromDiscord<StefanSalewski (StefanSalewski)> We use that for gintro.
13:20:08arkanoidthanks StefanSalewski, but I think that I can skip hacks here, as it's pure nim code. It's just up to find out how. I'd prefer to avoid var and mutability and get back to pure func
13:20:28arkanoidprobably with some copying I can do this
13:22:08FromDiscord<StefanSalewski (StefanSalewski)> logout
13:24:15arkanoiddo you know why there's a merge function for Countable but not for Table?
13:25:20FromDiscord<Rika> which value should be chosen when you encounter two duplicates of a key
13:37:38arkanoidwell, first or second table
13:37:49arkanoidlike others do
13:38:26arkanoidor if fancier: mergeLeft mergeRight
13:38:42FromDiscord<Rika> then i guess it is a matter of prs welcome
13:58:20*max22- joined #nim
14:59:42*max22- quit (Ping timeout: 276 seconds)
15:04:56*max22- joined #nim
15:14:57*neceve quit (Ping timeout: 258 seconds)
15:15:31*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
15:46:06*max22- quit (Ping timeout: 272 seconds)
15:47:11*max22- joined #nim
16:06:39*max22- quit (Ping timeout: 276 seconds)
16:13:56*max22- joined #nim
16:19:10*max22- quit (Ping timeout: 250 seconds)
16:21:46*max22- joined #nim
17:24:57*neceve joined #nim
18:31:08arkanoidis there an xml serialization/deserialization lib in nim?
18:33:42FromDiscord<haxscramper> If you want to test your luck - https://github.com/haxscramper/nimtraits/blob/master/src/nimtraits/trait_xml.nim , and https://github.com/haxscramper/haxdoc/blob/master/src/haxdoc/docentry_io.nim
18:34:29FromDiscord<haxscramper> It is no longer necessary to explicitly instantiate serialization procedures, the example has somewhat outdated API
18:34:53FromDiscord<haxscramper> Otherwise there is nothing for working with XML in automated manner
18:37:59arkanoidI've dived into xml xsd world in the last 48 hours and I've found madness
18:38:14arkanoidit is exactly how I imaged hell in my mind
18:40:02FromDiscord<haxscramper> So you want to store a date? Here is 10+ built-in date types
18:41:45arkanoidwhy declare types just in one place, when you can include,import,ref,declare inline,make them anonymous
18:42:17arkanoidand when you think that you can map into a type system, you have to deal with sequence vs attribute
18:42:29arkanoidand there you have the impossible type
18:44:16arkanoidso here I have a wsdl from an international well-known thing that I'm struggling to work with nim as just declaring types is much harder than expected
18:44:20*max22- quit (Ping timeout: 250 seconds)
18:45:04arkanoidI'll probably give up working with metaprogramming and type-system and just hack SOAP messages with strings
18:45:12arkanoidit's probably much quicker
18:46:16FromDiscord<haxscramper> It is quicker, though I did some automatic xsd2nim converters as well. But I did it because I need to parse tons of XML from doxygen
18:46:47FromDiscord<haxscramper> Otherwise it is easier to use string
18:48:33arkanoidyea but this was kinda like my testbed on nim metaprogramming. I kinda succeeded with it (even with compiler/ast thanks to you!) but now I feel down as I feel that the effort has been useless
18:51:15arkanoidhow did you deal with complexTypes that have both sequence and attributes?
18:52:34FromDiscord<haxscramper> I have `{.Attr.}` annotation
18:53:13FromDiscord<haxscramper> And then I just write attributes first, then fields
18:53:23FromDiscord<haxscramper> s/fields/sequence
18:55:13FromDiscord<haxscramper> For reading I either manually write code like this https://github.com/haxscramper/hmisc/blob/master/src/hmisc/hasts/xml_ast.nim#L959 , or generate checks
18:55:19arkanoidwise! know nothing abount annotations, are them in nim manual?
18:56:03FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-custom-annotations
18:56:23FromDiscord<haxscramper> For parsing I generate loops like this, based on the earlier structure https://github.com/haxscramper/hcparse/blob/master/src/hcparse/dox_compound.nim#L2269
18:56:58arkanoidI like your use of vertical space while writing code. I should give some more space too
18:57:25FromDiscord<haxscramper> Note that actually checking whether field is annotated with `{.Attr.}` requires very convoluted setup, you can see how it is implemented in https://github.com/nim-lang/Nim/blob/version-1-4/lib/core/macros.nim#L1484
18:58:12FromDiscord<haxscramper> You can use `hasCustomPragma`, but it is not available in the macros, so you need to adapt implementation
18:58:12FromDiscord<haxscramper> At least that's what I did for hnimast
19:00:12FromDiscord<haxscramper> Or you can just use `getObjectStructure()` to get all object parsed and checked for attributes
19:00:29arkanoidwhy are you saying that hasCustomPragma is not available in the macros?
19:00:53arkanoidis this broken? https://github.com/nim-lang/Nim/blob/44e653a9314e1b8503f0fa4a8a34c3380b26fff3/lib/core/macros.nim#L1557
19:01:21FromDiscord<haxscramper> because you can do `macro test(field: typed) = if hasCustomPragma(field, "Attr")`
19:01:26FromDiscord<haxscramper> What you linked is a `macro`
19:01:36FromDiscord<haxscramper> You can't call macro during macro execution
19:02:10arkanoidoh! ok, you're doing it at runtime. Is this necessary?
19:03:02arkanoidI mean, once you've parsed the types (with annotations), then you create the required encoding/decoding functions still at macro/ast time
19:03:04FromDiscord<haxscramper> yes? well, you take `typedesc` of an object you want to write/load to/from xml, so you have a macro runtime, which has to execute all kind of checks
19:03:25FromDiscord<haxscramper> And `hasCustomPragma` cannot be used for these checks
19:04:14FromDiscord<haxscramper> All macros like this must be implemented in form of procs IMO
19:04:17FromDiscord<haxscramper> So you would have `macro hasCustomPragma(a: typed): untyped = newLit(hasCustomPragmaImpl(a))`
19:04:29FromDiscord<haxscramper> Where `proc hasCustomPragmaImpl(a: NimNode): bool` implements logic
19:04:45FromDiscord<haxscramper> But sadly there is almost no macros in stdlib that follow this pattern
19:05:54FromDiscord<haxscramper> And why `proc customPragmaNode(n: NimNode): NimNode =` is not exposed to the user API? I mean, we have `import {.all.}` hack now, but this should not be the reason to hide parts of an API
19:05:58arkanoidwhen you say "macro runtime" you mean just "runtime"?
19:06:44FromDiscord<haxscramper> when macro is executed
19:07:06FromDiscord<haxscramper> It is hard to pinpoint what exactly "runtime" and "compile-time" means when you talk about macros
19:08:08arkanoidwell, if you're talking to post-expansion and nim compiler process is not running, it's just runtime
19:09:10arkanoidwhatever, I'm surely the one who's not getting it completely here, probably. I see a huge knowledge gap between your code and what I can do
19:12:41FromDiscord<Elegantbeef> Yea that's the best pattern hax, enables the most code reuse
19:12:45arkanoidhow did you takle the xml/xsd/namespace/types madness, in general? I mean, which order/strategy did you used?
19:14:31FromDiscord<haxscramper> Namespaces - they weren't needed so I ignored that part. But if I had to use them, I would just concatenate type name and namespace.
19:14:53FromDiscord<haxscramper> Xsd type is mapped to nim type almost 1:1, or at least I try to do it as close as possible
19:15:15nrds<Prestige99> Hey beef
19:15:25FromDiscord<Elegantbeef> Hello
19:15:28*max22- joined #nim
19:15:43FromDiscord<haxscramper> When converting xsd to nim types I don't differentiate between attributes and sequence, this is done at parser level
19:15:54nrds<Prestige99> What was your question from earlier?
19:16:21FromDiscord<Elegantbeef> Drawing window frames, how is that done? I did see a function that seems like it might do that but i'm uncertain
19:16:43nrds<Prestige99> like, creating a new window? Or a border?
19:16:51arkanoidso you just annotate which is sequence and which is attribute with pragmas, and then on reader/writer do what's needed
19:16:53FromDiscord<Elegantbeef> Border
19:17:09nrds<Prestige99> XSetWindowBorderWidth(display, this.window, this.borderWidth.cuint)
19:17:28FromDiscord<Elegantbeef> Ah wasnt certain that was actually what it was for šŸ˜€
19:17:30FromDiscord<Elegantbeef> Well that makes live easy
19:17:33nrds<Prestige99> and XSetWindowBorder
19:20:30FromDiscord<haxscramper> In reply to @arkanoid "so you just annotate": Correct.
19:20:58arkanoidnow I'm really curious how you read pragmas back at runtime!
19:21:24FromDiscord<haxscramper> I don't. What do you mean by "read pragmas" anyway?
19:33:16*rockcavera joined #nim
19:33:16*rockcavera quit (Changing host)
19:33:17*rockcavera joined #nim
20:19:18FromDiscord<undersquire> Hi
20:22:59FromDiscord<Elegantbeef> Hello
20:23:23FromDiscord<@bracketmaster-5a708063d73408ce4> hi
20:23:32FromDiscord<undersquire> why does it say BOT next to everyones name
20:23:35FromDiscord<Elegantbeef> I know that name it's the person from reddit with the memory allocation post!
20:23:41FromDiscord<undersquire> In reply to @Elegantbeef "I know that name": yep
20:23:42FromDiscord<undersquire> lol
20:23:42FromDiscord<Elegantbeef> Cause i'm on matrix
20:23:45FromDiscord<undersquire> Ah
20:23:48FromDiscord<undersquire> ok that makes more sense lol
20:24:03FromDiscord<Elegantbeef> Or i'm a sophisticated bot
20:24:03FromDiscord<@bracketmaster-5a708063d73408ce4> also, apparently, you can't form a string that start with a doublequote using rawstring in nim
20:24:05FromDiscord<Elegantbeef> Though i'm not that sophisticated
20:24:25FromDiscord<@bracketmaster-5a708063d73408ce4> I'm pretty sure I'm the only human on here
20:24:26FromDiscord<undersquire> you are self aware robot and you live in a virtual reality
20:24:36FromDiscord<Elegantbeef> !eval echo """""yes you can"""
20:24:38NimBot""yes you can
20:24:40FromDiscord<@bracketmaster-5a708063d73408ce4> As you can clearly see, I have a profile picture
20:24:51FromDiscord<undersquire> In reply to @@bracketmaster-5a708063d73408ce4 "As you can clearly": Lol yes only humans have profile pictures
20:25:01FromDiscord<@bracketmaster-5a708063d73408ce4> !eval echo """I feel dumb"""
20:25:05NimBotI feel dumb
20:27:29FromDiscord<undersquire> wait isnt Matrix a protocol?
20:27:47FromDiscord<undersquire> or is it a client
20:31:37nrds<Prestige99> protocol
20:31:57nrds<Prestige99> Element is the official client
20:34:14FromDiscord<undersquire> ok maybe ill give it a try
20:34:26FromDiscord<undersquire> https://element.io this one?
20:34:51nrds<Prestige99> yep that's it
21:24:35arkanoidhaxscramper, I'm spending some time reading your code on github. It's advanced code for me but I feel the flow, but I also know that I'm lacking knowledge about parsing where you seem very solid. I'd like to ask you if you have any reference that you'd suggest reading to understand your approach, expecially for xml_ast.nim and xsd_ast.nim
21:26:50*neceve quit (Ping timeout: 272 seconds)
21:45:37FromDiscord<lamersc.com 🐧> Is it possible to use nim script as a secure interface for say an extension system for a game server?
21:45:54FromDiscord<lamersc.com 🐧> Such as only allowing specific calls and such, disabling network and file access
21:46:47FromDiscord<Elegantbeef> Yea you can pretty well sandbox the nimVm + modules
21:47:21FromDiscord<Elegantbeef> I do have nimscripter which enables scripted programs but i presently have a rewrite that needs to be done before i'm overly happy with it šŸ˜€
21:50:01FromDiscord<lamersc.com 🐧> In reply to @Elegantbeef "I do have nimscripter": That seems like an interesting project šŸ‘€ nim seems to be very capable for scripted programs
22:03:34*max22- quit (Quit: Leaving)
23:24:53*auxym joined #nim
23:41:00FromDiscord<dom96> wow https://forum.nim-lang.org/t/8297