<< 02-02-2022 >>

00:01:16FromDiscord<abenedic (Alex Benedict)> Thank you, would I try returning an `nnkOfBranch`?
00:01:39FromDiscord<Elegantbeef> No you need to return an entire case statement at once with the of branches filled
00:02:13FromDiscord<abenedic (Alex Benedict)> Ah, so I can't return a partial case statement.
00:02:26FromDiscord<Elegantbeef> Indeed
00:02:35FromDiscord<abenedic (Alex Benedict)> Awesome, thank you very much
00:35:59FromDiscord<Patitotective> What is a https://nim-lang.org/docs/typetraits.html#HoleyEnum ? 😕
00:36:44FromDiscord<konsumlamm> an enum where the values of the vstiants are not continuous
00:37:15FromDiscord<konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3Omm
00:37:18FromDiscord<Patitotective> oooh, Ok
00:37:18FromDiscord<Patitotective> thanks
00:38:27FromDiscord<Elegantbeef> A alias for easily figuring out if an enum has assigned values that are not contiguous
00:43:47FromDiscord<demotomohiro> When do you need to define HoleyEnum? I guess when you need to use C library that contain holy enum.
00:44:01FromDiscord<Elegantbeef> When you want to hurt people
00:44:18FromDiscord<Patitotective> How do I reverse a set?
00:44:59FromDiscord<demotomohiro> There is no order in set
00:45:14FromDiscord<Elegantbeef> I think they want the complement
00:45:30FromDiscord<Elegantbeef> `import std/setutils; echo complement({'a'..'b'}`
00:46:06FromDiscord<Patitotective> In reply to @demotomohiro "There is no order": Then why does `for i in {1, 2}` print `1 2`
00:46:30FromDiscord<Elegantbeef> Cause the order is defined in the bit signature
00:47:04FromDiscord<Elegantbeef> Each bit represents a single value from the `range.low` to `range.high`
00:47:21FromDiscord<Elegantbeef> So you'd iterate that range backward checking if it's in the set
00:47:26FromDiscord<Patitotective> so `for i in {2, 1}` would print `1 2` as well?
00:47:31FromDiscord<Elegantbeef> Yes
00:47:41FromDiscord<Patitotective> perfect thanks 👍
00:49:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Omn
00:50:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Omo
00:55:25*krux02 quit (Remote host closed the connection)
01:13:31termerDoes asyncnet use async streams or are the procs for interacting with async socks just specific to them?
01:19:24FromDiscord<Patitotective> sent a code paste, see https://paste.rs/2h7
01:19:31FromDiscord<Elegantbeef> Sure but there is no other way
01:19:55FromDiscord<Elegantbeef> You have a collection of bits you need to iterate over them all to yield the collection in reverse
01:20:04FromDiscord<Elegantbeef> How do you think the iteration works anyway
01:20:51FromDiscord<demotomohiro> Even if you just iterate forward, you need to check every bits, isn't it?
01:20:59FromDiscord<Elegantbeef> Indeed
01:21:11FromDiscord<Elegantbeef> You only have bits
01:23:20FromDiscord<demotomohiro> So, if you have a large range set contains few elements, iterating seq that have same value might faster.
01:28:34FromDiscord<Patitotective> Are there reverse slices?
01:29:19FromDiscord<Rika> You can’t slice sets
01:29:25FromDiscord<Rika> It doesn’t really make sense
01:29:47FromDiscord<Patitotective> not sets
01:30:11FromDiscord<Patitotective> a seq
01:30:14FromDiscord<Patitotective> (edit) "seq" => "sequence"
01:30:25FromDiscord<Rika> Don’t think so
01:30:55FromDiscord<Patitotective> 😕
01:31:45FromDiscord<Patitotective> Then how do I reverse a seq?
01:32:07FromDiscord<Elegantbeef> You can make iterators you know?
01:33:12FromDiscord<demotomohiro> Why do you want to reverse seq or set?
01:33:13FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L37-L45
01:33:59FromDiscord<Patitotective> In reply to @demotomohiro "Why do you want": https://github.com/nim-lang/Nim/pull/19480#discussion_r796866159
01:39:38FromDiscord<demotomohiro> There is reverse proc in algorithm module https://nim-lang.org/docs/algorithm.html#reverse%2CopenArray%5BT%5D
01:43:41FromDiscord<Patitotective> :o
01:46:12*noeontheend joined #nim
01:47:29*tiorock joined #nim
01:47:30*rockcavera quit (Killed (calcium.libera.chat (Nickname regained by services)))
01:47:30*tiorock is now known as rockcavera
01:59:32*noeontheend quit (Ping timeout: 250 seconds)
02:07:44*rockcavera quit (Remote host closed the connection)
02:15:29*noeontheend joined #nim
02:16:26*neurocyte0917090 quit (Ping timeout: 250 seconds)
02:35:34*rockcavera joined #nim
02:35:34*rockcavera quit (Changing host)
02:35:34*rockcavera joined #nim
02:58:02*noeontheend quit (Ping timeout: 250 seconds)
03:11:24*arkurious quit (Quit: Leaving)
04:21:14*rockcavera quit (Remote host closed the connection)
05:36:09*Gustavo6046 joined #nim
05:38:12*blackbeard420 quit (*.net *.split)
05:38:12*kayabaNerve quit (*.net *.split)
05:38:12*FromDiscord quit (*.net *.split)
05:38:12*fowl quit (*.net *.split)
05:38:12*mahlon quit (*.net *.split)
05:38:12*syl quit (*.net *.split)
05:38:12*drewr quit (*.net *.split)
05:38:12*[R] quit (*.net *.split)
05:38:12*def- quit (*.net *.split)
05:38:12*tinystoat quit (*.net *.split)
05:38:12*flynn quit (*.net *.split)
05:38:12*GreaseMonkey quit (*.net *.split)
05:38:12*oprypin quit (*.net *.split)
05:38:12*notchris quit (*.net *.split)
05:38:12*NimEventer quit (*.net *.split)
05:38:12*joast quit (*.net *.split)
05:38:12*lain quit (*.net *.split)
05:38:12*cornfeedhobo quit (*.net *.split)
05:38:12*toothlessgear quit (*.net *.split)
05:38:12*ormiret quit (*.net *.split)
05:38:12*lucerne quit (*.net *.split)
05:38:13*rb quit (*.net *.split)
05:38:13*Mister_Magister quit (*.net *.split)
05:38:13*dv^_^ quit (*.net *.split)
05:38:13*Onionhammer quit (*.net *.split)
05:38:13*nrds quit (*.net *.split)
05:38:13*haakon quit (*.net *.split)
05:38:13*mal`` quit (*.net *.split)
05:38:13*oz quit (*.net *.split)
05:42:27*stkrdknmibalz quit (Ping timeout: 250 seconds)
05:51:14*Mister_Magister joined #nim
05:51:14*dv^_^ joined #nim
05:51:14*Onionhammer joined #nim
05:51:14*nrds joined #nim
05:51:14*haakon joined #nim
05:51:14*mal`` joined #nim
05:52:44*GreaseMonkey joined #nim
05:52:44*oprypin joined #nim
05:52:44*notchris joined #nim
05:52:44*NimEventer joined #nim
05:52:44*joast joined #nim
05:52:44*lain joined #nim
05:52:44*cornfeedhobo joined #nim
05:52:44*toothlessgear joined #nim
05:52:44*ormiret joined #nim
05:52:44*lucerne joined #nim
05:52:44*rb joined #nim
05:53:35*blackbeard420 joined #nim
05:53:35*kayabaNerve joined #nim
05:53:35*FromDiscord joined #nim
05:53:35*fowl joined #nim
05:53:35*mahlon joined #nim
05:53:35*syl joined #nim
05:53:35*drewr joined #nim
05:53:35*[R] joined #nim
05:53:35*def- joined #nim
05:53:35*tinystoat joined #nim
05:53:35*flynn joined #nim
05:54:13*Gustavo6046 quit (Remote host closed the connection)
05:54:28*Gustavo6046 joined #nim
05:54:51*oz joined #nim
06:04:19*Gustavo6046 quit (Quit: Leaving)
06:12:30*Gustavo6046 joined #nim
06:13:48*Gustavo6046 quit (Remote host closed the connection)
06:14:09*Gustavo6046 joined #nim
06:58:11*jjido joined #nim
07:32:11*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:35:03*jjido joined #nim
07:41:47NimEventerNew Nimble package! mt - A simple TLDR pages client, see https://codeberg.org/eqf0/mt/
07:46:36*PMunch joined #nim
07:51:19*neurocyte0917090 joined #nim
08:17:23PMunchHmm, once again I meet the lack of support for jsondocs..
08:18:44PMunchI guess I should make an RFC for getting the compiler to only output JSON and then have a program called to turn that JSON into HTML and LaTeX..
08:19:36*neurocyte0917090 quit (Ping timeout: 256 seconds)
08:21:49*neurocyte0917090 joined #nim
08:33:10FromDiscord<Hamid_Bluri> In reply to @demotomohiro "Why do you want": beef you're genius
08:33:25FromDiscord<Elegantbeef> I'm?
08:35:07FromDiscord<Hamid_Bluri> yes you are
08:36:41PMunchhttps://github.com/nim-lang/RFCs/issues/447
08:37:07*enyc joined #nim
08:39:25FromDiscord<Hamid_Bluri> In reply to @hamidb80 "beef you're genius": i replied wrong msg
08:39:44FromDiscord<Hamid_Bluri> In reply to @Elegantbeef "https://github.com/beef331/slicerator/blob/master/s": i wanted to reply this
08:39:54FromDiscord<Hamid_Bluri> (edit) "In reply to @Elegantbeef "https://github.com/beef331/slicerator/blob/master/s": i wanted to reply ... this" added "to"
08:41:08FromDiscord<Elegantbeef> Ah
08:54:45FromDiscord<demotomohiro> @PMunch Nim have parsed RST data as `PRstNode`. So I think you can get the json data by serializig the `PRstNode` with marshal module. Then your program can get the `PRstNode` by deserializing it.
08:55:56PMunchHaha, I was actually just sitting here reading the RST module right now
08:56:11PMunchBut yeah, something like that should be possible
08:57:04PMunchI mean this shouldn't be hard, but it might be a bit time-consuming because every part of the existing system is built around outputting HTML
08:58:02FromDiscord<Phil> Say I have a package with dependencies. To make that installable, do I have to enter all my package dependencies with their version to the nimble file by hand? Is there a command for that? Is the nimble file even the correct place for it?↵I thought nimble lock was the thing to do, but I just discovered that according to `nimble --help` that no longer exists
08:58:41FromDiscord<Phil> (edit) "installable," => "installable with `nimble install`,"
08:58:42FromDiscord<Elegantbeef> You just use requires for now
08:59:15FromDiscord<Elegantbeef> Lock files are coming but the nimble update that introduced them caused issues for people so they were pulled back and will be readded soon tm
08:59:50FromDiscord<Phil> Check, so I have to write them by hand?
08:59:59FromDiscord<Phil> (for now)
09:00:08FromDiscord<Elegantbeef> Yes you need to write your requires by hand presently
09:00:54FromDiscord<Phil> That might explain why my nimstoryfont project didn't compile for Waldecir, I had forgotten writing 3 of the dependencies in there
09:01:14FromDiscord<Phil> Thanks!
09:02:28*vicecea quit (Remote host closed the connection)
09:02:58*vicecea joined #nim
09:20:01*jmdaemon quit (Ping timeout: 256 seconds)
09:26:28*fowl quit (Ping timeout: 256 seconds)
09:29:16*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:30:36*rp1 joined #nim
09:31:31FromDiscord<Phil> In reply to @Elegantbeef "Yes you need to": Just so I'm on the safe side in terms of understanding constructor:↵The second parameter of the `implDefaults` macro is optional, correct?
09:31:48FromDiscord<Elegantbeef> It's not optional
09:31:55FromDiscord<Elegantbeef> Atleast with the new version
09:32:05FromDiscord<Phil> That
09:32:20FromDiscord<Phil> explains why my project didn't compile for Waldecir
09:32:40FromDiscord<Phil> What does genFlags do? what's it for?
09:33:12FromDiscord<Elegantbeef> https://github.com/beef331/constructor/blob/master/src/constructor/defaults.nim#L5-L7
09:37:46FromDiscord<Phil> so defExported allows the proc to be exported (just adds a ) and defTypeConstr...I don't think I get what the result of defTypeConstr is
09:38:16FromDiscord<Elegantbeef> https://github.com/beef331/constructor/blob/master/tests/tdefaults.nim#L25-L29
09:39:15FromDiscord<Phil> So instead of a `newMyModel()` it generates a `new(t: typedesc[MyModel])`
09:39:26FromDiscord<Elegantbeef> Yes
09:39:35FromDiscord<Phil> Mind if I add that to the readme in a PR?
09:39:47FromDiscord<Elegantbeef> Feel free
09:40:18FromDiscord<Elegantbeef> the runnable examples also need fixed iirc
09:40:56FromDiscord<Elegantbeef> I might have a fix to make it an optional parameter
09:42:21FromDiscord<Phil> Is that even possible in macros? I mean, it would be neat for the API if I don't want to have to think about this
09:42:42FromDiscord<Elegantbeef> Yea i think so
09:43:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OoF
09:43:54FromDiscord<Elegantbeef> There most recent version 😛
09:45:26FromDiscord<Phil> In reply to @Elegantbeef "There most recent version": yay!
09:57:25*jjido joined #nim
10:33:25FromDiscord<Phil> ... I do not comprehend github
10:33:27FromDiscord<Phil> Or git
10:33:30FromDiscord<Phil> One of these two
10:33:43FromDiscord<Elegantbeef> What;s the problem?
10:33:48FromDiscord<Phil> Beef, I can see your flag-code on github, it's nice, it's there, it exists
10:33:58FromDiscord<Phil> Yet it's not in my fork
10:34:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
10:34:07FromDiscord<Phil> and I can't sync, it claims everything is up to date
10:34:42FromDiscord<Phil> And if I locally pull from your git-repo into my local repo, I still don't see iiiiiiiiit wait am I on the right branch locally
10:35:09FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/gDs
10:35:27FromDiscord<Elegantbeef> Then you just add to the docs push and PR
10:35:47FromDiscord<Phil> Ahhh there it is, git pull beef upstream (I named the remote to your repo "beef") gave me what I was looking for
10:36:45FromDiscord<Phil> (edit) "upstream" => "master"
10:37:03FromDiscord<Elegantbeef> Well sleepy sleepy for me i'll look at your PR tomorrow
10:37:17FromDiscord<xx_ns> In reply to @Isofruit "And if I locally": recommend getting an indicator for that in your shell
10:37:25FromDiscord<xx_ns> i use something like this https://media.discordapp.net/attachments/371759389889003532/938382592158335016/unknown.png
10:37:42FromDiscord<xx_ns> it fetches the status async so it doesn't reduce prompt load times
10:38:03FromDiscord<Phil> One day I might! ... but not now because lazy
10:38:13FromDiscord<Phil> I use vscode so the shell would be bash
10:38:22FromDiscord<Phil> And I've never tinkered with bash so far outside of setting some env variables
10:38:30FromDiscord<xx_ns> i personally use zsh
10:38:35FromDiscord<xx_ns> here's my status script
10:38:36FromDiscord<xx_ns> https://github.com/nnsee/.shincludes/blob/master/zsh/git-status.sh
10:39:27FromDiscord<Phil> In reply to @Elegantbeef "Well sleepy sleepy for": Sleep well!
10:55:05FromDiscord<haxscramper> In reply to @PMunch "But yeah, something like": current documentation generator does not have any intermediate representation implemented for any part of the code
10:55:44PMunchOh trust me, I know..
10:55:46FromDiscord<haxscramper> everything is written out as the documentor pass traverses the code, and things are substituted directly into string interpolation
10:56:07PMunchIt does invoke the RST parser for comments though
10:56:31PMunchWhich is what we where talking about there
10:56:52PMunchBasically to make this work you'd also need to write a RST -> JSON part
10:57:23PMunchWhich also does highlighting of Nim code and references as JSON
10:57:55FromDiscord<haxscramper> Ideally this thing should just collect list of documentable entries that can be written later on
10:58:07PMunchBut I've looked at the source code for these parts (I've modified some of them as well), and while it is a bit of work it shouldn't be all that hard
10:58:14FromDiscord<haxscramper> json is just a representation, there is no need to even discuss it for the inner part of the docgen
10:58:49FromDiscord<haxscramper> but that's probably a more extreme opinion on the implementation, extending json and removing html/latex might seem easier at the start
10:59:07PMunchAh you want to have types internally and build some internal documentation representation and then just convert that to JSON for the final output?
10:59:36FromDiscord<haxscramper> yes, that's what I find reasonable style of implementing stuff like this
10:59:40FromDiscord<haxscramper> collect the data
10:59:44FromDiscord<haxscramper> render the data
11:00:11PMunchThe problem is that parts of the code like the highlighter and RST parser are separate modules, the RST parer in particular just spits out a string (with HTML)
11:00:38PMunchSo these packages (which are available to import into your project without importing the whole compiler), would also know how to deal with this internal format
11:01:02PMunchOr it would need to have some kind of callback functionality so that you can hook it onto your own format when you call it
11:02:57FromDiscord<haxscramper> idk, maybe wrap rst ast into json as well?
11:03:21PMunchIe. look at `genComment` (compiler/docgen.nim:222) which calls `renderRstToOut` (lib/packages/docutils/rstgen.nim:995)
11:03:23FromDiscord<haxscramper> parse rst, resolve all links, generate data and render it later
11:04:00PMunchI guess `renderRstToOut` could be moved into `compiler/docgen` though
11:04:21PMunchI agree that it's a much better way of doing it though
11:04:38PMunchBut it would be trickier to actually do because of how the current system is built..
11:05:15FromDiscord<haxscramper> the documentation generator either continues to be a half-assed solution, or it needs a nontrivial rework
11:05:52FromDiscord<haxscramper> the fact you can't even see fields in `when` properly, or any types in `when`
11:06:28FromDiscord<haxscramper> with proper IR you can just make a pre-sem visitation that collects a possible list of the documentable entries, and then clarify it in post-sem
11:06:36FromDiscord<haxscramper> without proper IR you are just dead
11:13:38FromDiscord<haxscramper> For example, I still can't find where the enum generation happens
11:14:13FromDiscord<haxscramper> or rather, I tried to uncover the mess that field generation for enums is
11:16:11FromDiscord<haxscramper> In reply to @haxscramper "with proper IR you": https://github.com/nim-works/nimskull/pull/214
11:16:29FromDiscord<haxscramper> changes in depends.nim
11:18:18FromDiscord<haxscramper> this is a proof-of-concept, but the differenence in "before" and "after" graphs should illustrate just how many important things are missing when the documentation is generated
11:18:46*m5zs7k quit (Ping timeout: 260 seconds)
11:18:54FromDiscord<haxscramper> and with proper IR you can even go into more sophisticated analysis, like compiling with different GCs or defines, and merging mutliple documentable entry databases
11:19:44*m5zs7k joined #nim
11:44:37PMunchYeah it is a bit unfortunate that `when` statements have to be resolved, but on the other hand you could easily create a scenario in which it would be impossible to solve for all when statements
11:45:11PMunchOf course `when defined` might be easier to evaluate
11:45:37*jjido joined #nim
12:04:10FromDiscord<Shiba> how can i stop the process of checking of changes in modulses and specify the modules where i made changes
12:04:17FromDiscord<Shiba> (edit) "modulses" => "modules"
12:04:22FromDiscord<Shiba> (edit) "changes" => "changes?"
12:04:44*l1x joined #nim
12:05:26FromDiscord<haxscramper> In reply to @PMunch "Yeah it is a": you don't need to resolve all `when` statements, you just need to know that some procs might be available only on js backend, or only on C backend
12:05:31FromDiscord<haxscramper> same for fields
12:06:14FromDiscord<haxscramper> this dives deeper into general program analysis, gut current `genDepend` is very misleading for example, for system it shows only fraction of the complexity
12:06:30FromDiscord<haxscramper> docgen and genDepend are pretty similar after all, they allow you to understand code better
12:06:45PMunchNot really, `when defined(windows): import "C:\\somefile.nim"`
12:06:57FromDiscord<haxscramper> what "not really"?
12:07:19PMunchI mean that simple example won't be possible to evaluate on Linux
12:07:24PMunchBecause that path doesn't exist
12:07:42PMunchTrivial and silly example, but it's not hard to come up with a more realistic one
12:07:52FromDiscord<haxscramper> ok, yes, and you also can't document imports generated from macros
12:08:25FromDiscord<haxscramper> but you know, the point is providing as good of a solution as possible, instead of giving up on the whole endeavor just because someone might write this weird nonsense
12:08:44PMunchI mean that's why Nim goes the route of "lets just compile the project with all your flags and such, and generate the documentation for this particular build as we come across it"-route
12:09:21FromDiscord<haxscramper> yes, that documents a single combination of flags, gc, and backend
12:09:29PMunchIt's not that weird, I think maybe even Futhark would break what you're proposing
12:09:38FromDiscord<haxscramper> it doesn't document the project as a whole, just a project as seen by t
12:09:45PMunchCorrect
12:09:49FromDiscord<haxscramper> by the compiler
12:10:28FromDiscord<haxscramper> In reply to @PMunch "It's not *that* weird,": you think I don't understand that pre-sem analysis can be broken by macros?
12:10:49FromDiscord<haxscramper> I"m proposing to do a multistage information gathering, on both pre and pos-sem code versions
12:11:07FromDiscord<haxscramper> I'm not trying to propose documentation generator that operates purely on pre-sem data
12:11:46FromDiscord<haxscramper> I'm saying that post-sem data can be further enhanced if we don't discard the knowledge about the code that we found before semantic analysis
12:13:22PMunchOh yeah, I*m just pointing out that it's hard
12:13:28PMunchI'm not saying we shouldn't do it
12:13:35FromDiscord<haxscramper> well, quality tooling is hard, right
12:13:44FromDiscord<haxscramper> not to be honest it is not that hard to do
12:13:53FromDiscord<haxscramper> given correct data model of course
12:14:13PMunchAlthough I guess you could potentially get a better picture if you generate the documentation for different combination of flags/platforms and then ingest them into the same system and combine them after the fact
12:14:34FromDiscord<haxscramper> `TLineInfo` is a good enough disambiguator for that sort of interactions IMO, maybe there are some additional heuristics that can be dispatched on top
12:14:59FromDiscord<haxscramper> In reply to @PMunch "Although I guess you": yes that would be an ideal solution, although a more expensive one to implement
12:15:13PMunchI mean with my jsondoc changes you could easily take both a Linux build and a Windows build and ingest them into a system which would then give you a dropdown to select platform or show the different implementations of similar procedures etc.
12:15:18FromDiscord<haxscramper> just merge two documentation database
12:15:34PMunchI mean this is the kind of stuff I want to do with my jsondoc RFC
12:16:00PMunchBasically build a database of the documentation, and then we can create a more dynamic representation of the documentation
12:16:10PMunchIt could even support user comments/examples
12:16:45PMunchAnd you could have docs for different versions, showing the differences and such
12:17:14FromDiscord<haxscramper> crazy how much things you can do if the tools you work with can actually output data, right
12:17:20FromDiscord<haxscramper> instead of pretty-printed nonsense
12:20:18PMunchData is pretty neat
12:23:32FromDiscord<haxscramper> put the advertisement for the possibilities on the RFC
12:26:43FromDiscord<haxscramper> also pre-sem visitation is just about the only way to list defines that project can react to
12:26:57FromDiscord<haxscramper> aside from hooking into sem layer of course
12:33:51*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:42:37*jjido joined #nim
12:43:30*jjido quit (Client Quit)
12:44:50FromDiscord<Waldecir Santos> I'd like to implement a table that works transparent for the user, for exemple if the table receives a string it convets to the proper ContextValue, but seems like I'm calling the parent function that dosen't accept my type, how can I archive that ? here it is my example
12:44:57FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/938414686662172692/unknown.png
12:49:39*rockcavera joined #nim
12:49:39*rockcavera quit (Changing host)
12:49:39*rockcavera joined #nim
12:58:43*fvs joined #nim
13:02:54PMunchYou need to make your Context either a wrapper object or a distinct object and then convert it back
13:03:22PMunchThe problem here is that at line 17 it triggers the procedure at line 15 again, but now V is a ContextValue
13:04:51PMunchWell, maybe you don't need a distinct value, but you need to use something like `tables.\`[]=\`(this, key, ContextValue(<...>)` in order to call the correct []= proc from the tables module and not the one you just created
13:05:13PMunchIt would be much easier to show this to you if you had shared you code via the playground instead of as a screenshot: play.nim-lang.org
13:05:51FromDiscord<Waldecir Santos> Oh I see what you mean but let me share it
13:06:29FromDiscord<Waldecir Santos> https://play.nim-lang.org/#ix=3Oqm
13:09:54PMunchThis works: https://play.nim-lang.org/#ix=3Oqn
13:10:14PMunchNote that I also had to make `Context` into a `var`
13:10:45PMunchSince we're mutating it
13:16:31*Gustavo6046 quit (Quit: Leaving)
13:18:01FromDiscord<enthus1ast> @Waldecir Santos\: and before you try to long to use multiple "value" attributes with the same name in a case object, they this is not allowed
13:18:22FromDiscord<enthus1ast> @Waldecir Santos\: and before you try too long to use multiple "value" attributes with the same name in a case object, this is not allowed
13:26:37*jjido joined #nim
13:36:17FromDiscord<Waldecir Santos> Oh I see that is sad, but fine, thanks for pointing this up
13:38:44*sagax joined #nim
13:43:50*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:01:17*noeontheend joined #nim
14:08:30*fowl joined #nim
14:34:31*noeontheend quit (Ping timeout: 256 seconds)
14:36:26FromDiscord<ache of head> In reply to @Waldecir Santos "": hey, i'm actually kinda curious now, what font is that?
14:36:54FromDiscord<ache of head> i feel like i know it but i can't recall the name or where i've seen it before
14:37:36FromDiscord<Waldecir Santos> https://www.monolisa.dev
14:38:46FromDiscord<ache of head> oh right!
14:38:52FromDiscord<ache of head> thanks
14:40:11*rockcavera quit (Remote host closed the connection)
14:42:24*arkurious joined #nim
14:43:31FromDiscord<--HA--> Hello. I'm doing C interop. I'm passing a string allocated like this `var s = newString(MAX_LEN)` to a C function via `s.cstring`. The C function writes a string but I do not know it's length other than it being <= MAX_LEN. How can I best set the length of `s` to the length till the first zero byte? Or how should I do this differently?
14:44:32FromDiscord<--HA--> I do get a string back fine but it is filled with `\x0` till the cap
14:48:35FromDiscord<demotomohiro> Are there any C function that return the length of that string?
14:49:19PMunchAre you sure the C function doesn't return the length of the string? It's fairly common in C
14:49:37PMunchBut otherwise you could probably do `s.setLen(s.cstring.len)`
14:50:44FromDiscord<tandy> is there a way to check if a type/object is null?
14:50:56FromDiscord<tandy> for objects you can do `isNil`, but that doesnt work for strings or ints
14:51:05FromDiscord<demotomohiro> Your C library just says the C function doesn't write more than MAX_LEN?
14:51:20*rockcavera joined #nim
14:51:20*rockcavera quit (Changing host)
14:51:20*rockcavera joined #nim
14:51:31FromDiscord<demotomohiro> string or int is not a pointer. They never nil.
14:51:47FromDiscord<Rika> Strings and ints cannot be null
14:51:55FromDiscord<demotomohiro> ref object can be nil but object never nil.
14:52:08FromDiscord<Rika> Pointers can too
14:52:21FromDiscord<Rika> But only those, pretty much
14:52:27FromDiscord<tandy> is there a way to check if they havent been initialised then?↵(@Rika)
14:52:36FromDiscord<demotomohiro> If I remember collectly, string or seq can be nil before version 1.0
14:52:41FromDiscord<Rika> Check if they’re == default(Type)?
14:52:53FromDiscord<Rika> In reply to @demotomohiro "If I remember collectly,": Before 0.20
14:52:54FromDiscord<tandy> hmm
14:52:57FromDiscord<tandy> maybe
14:53:11FromDiscord<enthus1ast> and its a godsent↵(@demotomohiro)
14:53:14FromDiscord<tandy> maybe i just need to use options
14:53:15FromDiscord<Rika> Of course that means you reject empty string or 0 even if it was explicitly initialised
14:53:18*tiorock joined #nim
14:53:18*tiorock quit (Changing host)
14:53:18*tiorock joined #nim
14:53:19*rockcavera is now known as Guest5423
14:53:19*tiorock is now known as rockcavera
14:53:27FromDiscord<tandy> yeah..↵(@Rika)
14:53:46FromDiscord<Rika> If you control the type use {.requiresInit.} on the type definition
14:53:53FromDiscord<Rika> I believe that would require initialisation
14:54:09FromDiscord<--HA--> In reply to @PMunch "But otherwise you could": `s.cstring.len` works perfectly, thank you
14:54:53FromDiscord<--HA--> The C function returns an error code but not the length. I guess that is why they have that MAX_LEN constant.
14:55:34FromDiscord<Rika> Tandy, I don’t know what your use case is. It might help saying what it is
14:56:30*Guest5423 quit (Ping timeout: 250 seconds)
14:59:08FromDiscord<tandy> thanks rika, i just made things simpler lol
15:00:05PMunchMaking things simpler is often a good idea
15:05:09PMunchHmm, is it possible to set things like `cpu` and `os` build flags from within Nim?
15:05:12FromDiscord<Waldecir Santos> I'm trying to overload the table retrieve operator but I:m receiving a strange error (I still newbie 😄 ) can someone give me an idea on what is the problem, ps nim-play is broken :omg:
15:05:15FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/938449992899788800/unknown.png
15:05:22PMunchOr must those be placed in the cfg file?
15:05:59PMunch@Waldecir_Santos, https://play.nim-lang.org/#ix=3Or1
15:06:15FromDiscord<Waldecir Santos> it was lol
15:06:16FromDiscord<Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/938450250987864175/unknown.png
15:06:38PMunchThat just tells you that `V` can't be guessed from the call
15:06:40FromDiscord<Waldecir Santos> ok here it is: https://play.nim-lang.org/#ix=3Or2
15:06:56FromDiscord<demotomohiro> In reply to @PMunch "Making things simpler is": I never saw any pragma that allows setting os or cpu in nim file. I think you need to set them in cfg or .nims or compiler parameter.
15:06:56PMunchIf you change `V` to ContextValue as the return type it should work
15:07:37FromDiscord<Waldecir Santos> I tried that same error
15:07:50PMunchWorks fine for me: https://play.nim-lang.org/#ix=3Or3
15:08:06PMunchI'm guessing you left the `V` in the generic parameters?
15:08:11FromDiscord<Waldecir Santos> OH my god the proc was wrong
15:08:26FromDiscord<Waldecir Santos> I had [K,V] and it should be [K]
15:08:30PMunchMhm
15:09:00FromDiscord<Waldecir Santos> I got this example from tables.nim 🤔
15:09:03PMunch@demotomohiro, that's what I was afraid of
15:09:16FromDiscord<Waldecir Santos> https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/tables.nim#L339
15:09:47PMunch@Waldecir_Santos, yes because B there is used in the Table definition
15:09:53PMunchSo it is able to find it
15:10:00FromDiscord<Waldecir Santos> I wonder why there works with "`[]`[A, B]"
15:10:08FromDiscord<Waldecir Santos> Got it
15:11:34FromDiscord<demotomohiro> In reply to @PMunch "<@288750616510201856>, that's what I": There is `passC`, `localPassc` or `passL` pragma, but I cannot find pragma to set os or cpu
15:25:47*jjido joined #nim
15:26:55*jjido quit (Client Quit)
15:31:17*ssiyad joined #nim
15:39:14*ssiyad quit (Quit: WeeChat 3.4)
16:41:33*noeontheend joined #nim
17:16:12*cyraxjoe joined #nim
17:16:22*MightyJoe quit (Ping timeout: 268 seconds)
17:24:11*neurocyte0917090 quit (Ping timeout: 256 seconds)
17:25:05*noeontheend quit (Ping timeout: 256 seconds)
18:23:32*cyraxjoe quit (Ping timeout: 252 seconds)
18:30:41FromDiscord<tandy> when is the next nim devel release?
18:31:38FromDiscord<tandy> i want to know when i can use my pull request https://github.com/nim-lang/Nim/pull/19473
18:38:15FromDiscord<mratsim> In reply to @tandy "when is the next": nightlies are every night
18:38:43FromDiscord<mratsim> requires Nim 1.7 in Nimble
18:53:01*rightbrace joined #nim
18:53:28*cyraxjoe joined #nim
18:57:34*rightbrace quit (Quit: Lost terminal)
19:05:11FromDiscord<Josef> I have a pretty basic question, I would be very appreciative if anyone could help. I'm using a wrapper for a C library, and I notice that I cannot `deepCopy` wrapped structs (the object just gets a zero value). I couldn't find anything relevant in the manual or elsewhere online. What is the reason / what am I doing wrong?
19:06:31*cyraxjoe quit (Ping timeout: 256 seconds)
19:06:40*MightyJoe joined #nim
19:14:45*fowl quit (Read error: Connection reset by peer)
19:15:22*fowl joined #nim
19:19:01*MightyJoe quit (Ping timeout: 240 seconds)
19:21:48*cyraxjoe joined #nim
19:26:23*vicfred joined #nim
19:28:18*cyraxjoe quit (Ping timeout: 260 seconds)
19:45:32NimEventerNew thread by Tcheran: Zlib.h: No such file or directory error on Windows, see https://forum.nim-lang.org/t/8861
19:59:39*cyraxjoe joined #nim
20:06:14*tiorock joined #nim
20:06:14*tiorock quit (Changing host)
20:06:14*tiorock joined #nim
20:06:14*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
20:06:14*tiorock is now known as rockcavera
20:08:51*cyraxjoe quit (Ping timeout: 256 seconds)
20:16:51*fvs left #nim (WeeChat 3.4)
20:18:19*ssiyad joined #nim
20:24:01FromDiscord<pmunch> @Josef\: that sounds very strange. Do you have any code you can share?
20:30:22*krux02 joined #nim
20:33:38*jmdaemon joined #nim
20:34:54FromDiscord<oldteen> Hello, what tool do you use to edit your code and is there a recommended server language?
20:35:17FromDiscord<kaddkaka> In reply to @oldteen "Hello, what tool do": I use Neovim with pylsp language server
20:35:36FromDiscord<kaddkaka> In reply to @oldteen "Hello, what tool do": Or what do you mean by "server language"?
20:39:41*jmdaemon quit (Ping timeout: 250 seconds)
20:40:53*cyraxjoe joined #nim
20:42:52*jmdaemon joined #nim
20:46:32FromDiscord<tandy> i see, thank you↵(@mratsim)
20:46:32PMunchMaybe they meant library?
20:46:56PMunchAnyways, I use Vim to edit Nim, but I think most people use VSCode
20:47:22FromDiscord<Josef> sent a code paste, see https://paste.rs/U6S
20:48:36PMunchAh, try changing those variables around
20:48:48PMunchdeepCopy is (to, from)
20:49:25FromDiscord<Josef> Is `v2.deepCopy v1` not "copy v1 into v2"?
20:49:36PMunchOh wait, yeah you're right
20:49:51PMunchHmm, that's strange
20:57:37PMunchVery strange indeed
21:00:41PMunchThat's definitely a bug, but why are you trying to use deepCopy anyways?
21:00:49PMunchYou can just `var v2 = v1`
21:11:45*oz quit (*.net *.split)
21:11:45*blackbeard420 quit (*.net *.split)
21:11:45*kayabaNerve quit (*.net *.split)
21:11:45*FromDiscord quit (*.net *.split)
21:11:45*mahlon quit (*.net *.split)
21:11:45*syl quit (*.net *.split)
21:11:45*drewr quit (*.net *.split)
21:11:45*[R] quit (*.net *.split)
21:11:45*def- quit (*.net *.split)
21:11:45*tinystoat quit (*.net *.split)
21:11:45*flynn quit (*.net *.split)
21:11:45*rp1 quit (*.net *.split)
21:11:46*GreaseMonkey quit (*.net *.split)
21:11:46*oprypin quit (*.net *.split)
21:11:46*notchris quit (*.net *.split)
21:11:46*NimEventer quit (*.net *.split)
21:11:46*joast quit (*.net *.split)
21:11:46*lain quit (*.net *.split)
21:11:46*cornfeedhobo quit (*.net *.split)
21:11:46*toothlessgear quit (*.net *.split)
21:11:46*ormiret quit (*.net *.split)
21:11:46*lucerne quit (*.net *.split)
21:11:46*rb quit (*.net *.split)
21:11:46*ssiyad quit (*.net *.split)
21:11:46*Mister_Magister quit (*.net *.split)
21:11:46*dv^_^ quit (*.net *.split)
21:11:46*Onionhammer quit (*.net *.split)
21:11:46*nrds quit (*.net *.split)
21:11:46*haakon quit (*.net *.split)
21:11:46*mal`` quit (*.net *.split)
21:11:46*jmdaemon quit (*.net *.split)
21:11:46*cyraxjoe quit (*.net *.split)
21:11:46*krux02 quit (*.net *.split)
21:11:47*fowl quit (*.net *.split)
21:11:47*arkurious quit (*.net *.split)
21:11:47*vicecea quit (*.net *.split)
21:11:47*xiamx quit (*.net *.split)
21:11:47*crem1 quit (*.net *.split)
21:11:47*GnuYawk quit (*.net *.split)
21:11:47*l1x quit (*.net *.split)
21:11:47*Yardanico_ quit (*.net *.split)
21:11:47*robertmeta quit (*.net *.split)
21:11:47*rockcavera quit (*.net *.split)
21:11:47*vicfred quit (*.net *.split)
21:11:47*m5zs7k quit (*.net *.split)
21:11:47*Ekho quit (*.net *.split)
21:11:47*arkanoid quit (*.net *.split)
21:11:47*jkl quit (*.net *.split)
21:11:48*PMunch quit (*.net *.split)
21:11:48*happycorsair[m] quit (*.net *.split)
21:11:48*Jjp137 quit (*.net *.split)
21:11:48*ehmry quit (*.net *.split)
21:11:48*mjsir911 quit (*.net *.split)
21:11:48*averell quit (*.net *.split)
21:11:48*meowray quit (*.net *.split)
21:11:48*nixfreaknim[m] quit (*.net *.split)
21:11:48*k0mpjut0r quit (*.net *.split)
21:11:48*koltrast quit (*.net *.split)
21:11:48*LyndsySimon quit (*.net *.split)
21:11:48*greyrat_ quit (*.net *.split)
21:11:48*Schnouki quit (*.net *.split)
21:11:48*dv2 quit (*.net *.split)
21:11:48*redj quit (*.net *.split)
21:11:48*dom96 quit (*.net *.split)
21:11:48*adium quit (*.net *.split)
21:11:49*cheer[m] quit (*.net *.split)
21:11:49*ecs quit (*.net *.split)
21:11:49*xet7 quit (*.net *.split)
21:11:49*tk quit (*.net *.split)
21:11:49*szahid quit (*.net *.split)
21:11:49*nisstyre quit (*.net *.split)
21:11:49*sagax quit (*.net *.split)
21:11:49*Amun-Ra quit (*.net *.split)
21:11:49*Zevv quit (*.net *.split)
21:11:49*gshumway quit (*.net *.split)
21:11:49*madprops quit (*.net *.split)
21:11:49*djanatyn quit (*.net *.split)
21:11:50*ldlework quit (*.net *.split)
21:11:50*termer quit (*.net *.split)
21:11:50*euantorano quit (*.net *.split)
21:11:50*oisota quit (*.net *.split)
21:11:50*anddam quit (*.net *.split)
21:11:50*Nuc1eoN quit (*.net *.split)
21:11:50*enyc quit (*.net *.split)
21:11:50*om3ga quit (*.net *.split)
21:12:23*jkl joined #nim
21:12:23*arkanoid joined #nim
21:12:23*Ekho joined #nim
21:12:23*m5zs7k joined #nim
21:12:23*vicfred joined #nim
21:12:23*rockcavera joined #nim
21:12:23*jmdaemon joined #nim
21:12:23*cyraxjoe joined #nim
21:12:23*krux02 joined #nim
21:12:25*sagax joined #nim
21:12:25*Amun-Ra joined #nim
21:12:25*Zevv joined #nim
21:12:25*gshumway joined #nim
21:12:25*madprops joined #nim
21:12:25*djanatyn joined #nim
21:12:52*ssiyad joined #nim
21:12:52*Mister_Magister joined #nim
21:12:52*dv^_^ joined #nim
21:12:52*Onionhammer joined #nim
21:12:52*nrds joined #nim
21:12:52*haakon joined #nim
21:12:52*mal`` joined #nim
21:13:07*PMunch joined #nim
21:13:07*happycorsair[m] joined #nim
21:13:07*Jjp137 joined #nim
21:13:07*ehmry joined #nim
21:13:07*mjsir911 joined #nim
21:13:07*averell joined #nim
21:13:07*meowray joined #nim
21:13:26*enyc joined #nim
21:13:26*Nuc1eoN joined #nim
21:13:26*ldlework joined #nim
21:13:26*termer joined #nim
21:13:26*euantorano joined #nim
21:13:26*oisota joined #nim
21:13:26*anddam joined #nim
21:13:26*om3ga joined #nim
21:13:30*fowl joined #nim
21:13:30*arkurious joined #nim
21:13:30*vicecea joined #nim
21:13:30*xiamx joined #nim
21:13:30*crem1 joined #nim
21:13:30*GnuYawk joined #nim
21:13:52*blackbeard420 joined #nim
21:13:52*kayabaNerve joined #nim
21:13:52*FromDiscord joined #nim
21:13:52*mahlon joined #nim
21:13:52*syl joined #nim
21:13:52*drewr joined #nim
21:13:52*[R] joined #nim
21:13:52*def- joined #nim
21:13:52*tinystoat joined #nim
21:13:52*flynn joined #nim
21:13:54PMunch@Josef, created an issue for you: https://github.com/nim-lang/Nim/issues/19482
21:14:06*nixfreaknim[m] joined #nim
21:14:06*k0mpjut0r joined #nim
21:14:06*koltrast joined #nim
21:14:06*LyndsySimon joined #nim
21:14:06*greyrat_ joined #nim
21:14:06*Schnouki joined #nim
21:14:06*dv2 joined #nim
21:14:06*redj joined #nim
21:14:32*rp1 joined #nim
21:14:32*GreaseMonkey joined #nim
21:14:32*oprypin joined #nim
21:14:32*notchris joined #nim
21:14:32*NimEventer joined #nim
21:14:32*joast joined #nim
21:14:32*lain joined #nim
21:14:32*cornfeedhobo joined #nim
21:14:32*toothlessgear joined #nim
21:14:32*ormiret joined #nim
21:14:32*lucerne joined #nim
21:14:32*rb joined #nim
21:14:49*l1x joined #nim
21:14:49*Yardanico_ joined #nim
21:14:49*robertmeta joined #nim
21:15:01*dom96 joined #nim
21:15:01*adium joined #nim
21:15:02*oz joined #nim
21:15:02*nixfreaknim[m] quit (Ping timeout: 240 seconds)
21:15:08*happycorsair[m] quit (Ping timeout: 252 seconds)
21:15:17*cheer[m] joined #nim
21:15:17*ecs joined #nim
21:15:17*xet7 joined #nim
21:15:17*tk joined #nim
21:15:17*szahid joined #nim
21:15:17*nisstyre joined #nim
21:15:18*cheer[m] quit (Ping timeout: 245 seconds)
21:15:29FromDiscord<Josef> In reply to @PMunch "<@385801366779723786>, created an issue": Ah, thank you - I didn't realize you meant a language error I thought maybe there was something wrong with the wrapper
21:15:57PMunchNah, that should work. I mean you don't have to deepCopy, but it seems like an issue that it doesn't work
21:16:18PMunchFor your case you can just assign it to a new variable and that makes a copy
21:18:54*xiamx quit (Ping timeout: 260 seconds)
21:18:59FromDiscord<Josef> My vectors are a few object ref's away from where I need to do the copy though (ie I have a Object, which has a Renderable field, which has a path field, which is a sequence of vectors). Is the solution for me to write a copy method for every object that has vectors or other imported structs in it somewhere?
21:22:32*noeontheend joined #nim
21:23:56PMunchHmm, that makes it a bit trickier
21:24:22PMunchDo you absolutely need to deepCopy it?
21:27:40FromDiscord<Josef> Yeah, or do if by copying all the fields over individually
21:32:55*nixfreaknim[m] joined #nim
21:33:25*noeontheend quit (Ping timeout: 250 seconds)
21:33:37*jmdaemon quit (Ping timeout: 256 seconds)
21:39:36*xiamx joined #nim
21:48:44FromDiscord<Elegantbeef> Does nigui have any API for dragging, looked into it and seems no, but might've missed it?
21:49:02FromDiscord<michaelb> sent a code paste, see https://play.nim-lang.org/#ix=3Otq
21:49:53FromDiscord<Elegantbeef> `bars: ptr UncheckedArray[Bar]`
21:50:31FromDiscord<Elegantbeef> `Foo(bars: bars.addr`
21:50:39FromDiscord<Elegantbeef> Also what's with the lowercase type names 😀
21:50:55FromDiscord<michaelb> thanks
21:52:09*jmdaemon joined #nim
21:53:23FromDiscord<michaelb> In reply to @Elegantbeef "Also what's with the": in the module directly wrapping the C stuff, I tend to use names that are an exact match for what's being wrapped↵↵in the module/s providing a nicer (or "higher level", or however you want to describe it) I follow the usual conventions and Status Nim style guid
21:53:28FromDiscord<michaelb> (edit) "guid" => "guide"
21:53:51FromDiscord<michaelb> (edit) "In reply to @Elegantbeef "Also what's with the": in the module directly wrapping the C stuff, I tend to use names that are an exact match for what's being wrapped↵↵in the module/s providing a nicer (or "higher level", or however you want to describe it) ... I" added "Nim API"
21:54:01FromDiscord<michaelb> (edit) "API" => "API,"
22:01:00*jjido joined #nim
22:11:55FromDiscord<michaelb> sent a code paste, see https://play.nim-lang.org/#ix=3Otx
22:11:58*PMunch quit (Quit: leaving)
22:12:33FromDiscord<Elegantbeef> Make a proc or template
22:24:17FromDiscord<Phil> Beef, question, if you wanted to store procs with completely different signatures in a seq, would it be possible to store their pointers as a `seq[pointer]` ?
22:24:37FromDiscord<Phil> And then somehow dereference those pointers to get the actual proc back?
22:25:11FromDiscord<Phil> I'm asking to see whether I'm understanding the idea behind an implementation of an event system
22:25:25*jmdaemon quit (Ping timeout: 256 seconds)
22:26:22FromDiscord<Elegantbeef> You could but it makes more sense to use an object variant so there is no guessing
22:27:02FromDiscord<Phil> an object variant?
22:27:16FromDiscord<Phil> Employing google fu
22:27:20FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-object-variants
22:28:10FromDiscord<Phil> That would be in case I know all variations of procs ahead of time
22:28:15FromDiscord<Phil> Which strictly speaking I do
22:28:43FromDiscord<Elegantbeef> Well you cannot call a procedure you dont know 😛
22:28:48FromDiscord<Phil> But it would also be a massive PITA
22:29:18FromDiscord<Elegantbeef> You could also do `proc(data: string)` which calls the internal procedure
22:29:20*jmdaemon joined #nim
22:29:22FromDiscord<Elegantbeef> It's what I do for an RPC
22:30:00FromDiscord<Phil> With converting data back to the type you'd actually want and going from there? Hmmm
22:30:12*cheer[m] joined #nim
22:30:47FromDiscord<Elegantbeef> Yes using a macro to emit the inbetween
22:31:06FromDiscord<Elegantbeef> Nim being static meaning arbitrary stuff isnt fun
22:31:29FromDiscord<Phil> Wouldn't JsonNode be the somewhat perfect type for this given that converting to and from it is literally built into stdlib?
22:31:45FromDiscord<Phil> Or am I overlooking a caveat somewhere?
22:31:51FromDiscord<Elegantbeef> It's slow and not binary
22:32:00FromDiscord<Phil> The worst caveat
22:32:16FromDiscord<Waldecir Santos> How can a singleton be implemented in nim in a thread safe mannar ?
22:32:20FromDiscord<Waldecir Santos> (edit) "mannar" => "maner"
22:32:34FromDiscord<Elegantbeef> global variables with properties that use locks
22:34:13FromDiscord<Waldecir Santos> Like sharedtables ?
22:34:35FromDiscord<Elegantbeef> I dont think anyone suggests those they're pretty deprecated iirc
22:34:54FromDiscord<Phil> sent a code paste, see https://paste.rs/N5B
22:35:04FromDiscord<Elegantbeef> Indeed
22:35:12FromDiscord<Elegantbeef> I mean you can do `typeOf(globalMyType)()`
22:35:20FromDiscord<Elegantbeef> But yea generally speaking you cannot
22:36:56FromDiscord<Elegantbeef> Pmunch you still about?
22:37:50FromDiscord<Elegantbeef> Just wanted to show him my level editor since he thought i was crazy at first!
22:42:29*happycorsair[m] joined #nim
22:46:48FromDiscord<Phil> sent a long message, see http://ix.io/3OtG
22:46:50FromDiscord<Phil> But also the most amount of code maintenance
22:47:01FromDiscord<Phil> Hmmmm
22:47:17FromDiscord<Phil> Any other pros/cons you see between those two?
22:47:40FromDiscord<Elegantbeef> You can always use macros to do everything automated so not really
22:50:34FromDiscord<Phil> I wish I could just have a macro that automatically scanned my entire project and gave me an enum that always have an enumType for all types that inherit from `Model`
22:51:03FromDiscord<Waldecir Santos> AST magic
22:51:05FromDiscord<Phil> (edit) "always have" => "has" | "all types" => "every type" | "inherit" => "inherits"
22:51:17FromDiscord<Phil> That's AST magic so deep I think it might be unmaintainable
22:51:23FromDiscord<Elegantbeef> Wait until you learn you can do it somewhat↵(@Phil)
22:51:24FromDiscord<Elegantbeef> 😛
22:51:30FromDiscord<Phil> If it's even possible without
22:51:34FromDiscord<Phil> squints
22:51:45FromDiscord<Phil> Is this some sort of usecase for nimscript or sth?
22:51:50FromDiscord<Elegantbeef> You'd need manually subscribe it but yea it'd be possible to do stuff with
22:52:01FromDiscord<Elegantbeef> Nope
22:52:20FromDiscord<Elegantbeef> I only condone using nimscript for when you want a scriptable environment
22:52:43FromDiscord<Phil> I'm not even sure what exactly nimscript is, I'll be honest
22:52:50FromDiscord<Phil> It was a scripting language to manipulate code I think?
22:53:00FromDiscord<Elegantbeef> It's a subset of Nim
22:53:07FromDiscord<Elegantbeef> An interpreted scripting language
22:53:23FromDiscord<Elegantbeef> Mainly used for static evaluation and macros
22:55:24FromDiscord<Phil> I think I'll, for the sake of maintainability unless there's a package for it, do my "ModelEnum" by hand and maintain it by hand. Not that I think it'll actually change
22:59:11FromDiscord<keks> Is there a way in NIM to iterate over an array at compile time - something like a static for loop in D? This should be possible because the length of an array is known at compile time.
22:59:44FromDiscord<Elegantbeef> Do you mean loop unrolling or running a static expression?
23:00:47FromDiscord<Elegantbeef> Also it's "Nim" 😛
23:04:16FromDiscord<keks> In reply to @Elegantbeef "Do you mean loop": Yes, loop unrolling at compile time. I'm still trying to do this automatic conversion of various array expressions at compile time
23:04:57FromDiscord<keks> sent a code paste, see https://play.nim-lang.org/#ix=3OtR
23:05:48FromDiscord<keks> I'm trying to convert float64 arrays to float32 arrays. I could do it for array literals, but this won't generalise to general variables of type array[N, float64].
23:06:12FromDiscord<keks> And I'm too lazy to implement the entire for loop as a macro.
23:06:59FromDiscord<Elegantbeef> you can use `static` if you want to run code at compile time, other wise you'll need a macro to unroll the loop
23:07:55*jmdaemon quit (Ping timeout: 256 seconds)
23:09:29FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3OtS
23:09:57*anddam quit (Quit: WeeChat 3.4)
23:10:47FromDiscord<Elegantbeef> If you want it unrolled for runtime it can also be done with a macro of course
23:13:45FromDiscord<keks> that works, but this is with the use of const. I want a generic solution that can work both on array literals of type float64 as well as any variable of type array[N, float64]
23:13:53*anddam joined #nim
23:14:17FromDiscord<Elegantbeef> I'm writing as fast as i can!
23:18:34FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3OtX
23:18:43FromDiscord<Elegantbeef> There you go loop unrolled float64 -\> float32
23:18:55FromDiscord<Phil> ... a casual 29 models, all of which need to go into the enum, all of which I need to consider for the object variant
23:19:00FromDiscord<Phil> God, life is pain and a typi mess
23:19:21FromDiscord<Elegantbeef> What are these procedures like?
23:19:31FromDiscord<Elegantbeef> Are they all the same but different first parameter?
23:19:38FromDiscord<Elegantbeef> If so, use dynamic dispatch you drongo
23:20:01FromDiscord<Phil> Essentially it's all proc[T: Model](connection: DbConn, modelInstance: T)
23:20:19FromDiscord<Phil> If I could store generics anyway
23:20:36FromDiscord<Elegantbeef> So basically you're saying `method doThing(myInstance: Model, conn: DbConn)`
23:20:41FromDiscord<Phil> There are some bits and bobs that differ for some of the 29
23:20:45FromDiscord<Phil> But the general proc signature is the above
23:21:04FromDiscord<Elegantbeef> Use dynamic dispatch and solve your problem simpler
23:21:22FromDiscord<keks> In reply to @Elegantbeef "I'm writing as fast": woow, I need time to process this.. Thanks a lot!
23:21:51FromDiscord<Phil> I think I've been through so many different solution iterations I actually need to get my head out of the entire event system thinky and try to think on how I could apply dynamic dispatch to it
23:22:16FromDiscord<Phil> Which... okay no idea, I've really not used and thus not thought in dynamically dispatched functions in nim yet
23:22:27FromDiscord<Phil> I've seen them used in norm though
23:22:34FromDiscord<Elegantbeef> They work like normal OOP functions
23:22:42FromDiscord<Elegantbeef> You define a base then override it for all your inheriting children
23:23:26FromDiscord<Phil> Is that also possible when I don't own the code that defines the Model type?
23:24:11FromDiscord<Phil> What am I talking about, I can just define that... I think `func` was the keyword? Where I need it
23:24:35FromDiscord<Elegantbeef> I think so
23:24:56FromDiscord<Elegantbeef> As long as the type is in the scope and you define a base method that the other methods can see and the call site can see
23:25:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3OtZ
23:25:28FromDiscord<Elegantbeef> `method` is the keyword
23:25:28FromDiscord<Elegantbeef> `func` is a pure function like in FP
23:25:34FromDiscord<Phil> Ah, check
23:30:10FromDiscord<Phil> Then I can just do a `type TableModel = <List of 29 models separated with '|'>` and use that as parameter in my `sendSignal(signal: SignalType, modelInstance: TableModel)` proc.
23:30:48FromDiscord<Elegantbeef> Why would you need to make a typedesc
23:31:00FromDiscord<Elegantbeef> `[T: Model]` is composite typeclass that is all inheriting children
23:31:49FromDiscord<Phil> Still too mentally trapped in previous approaches I think and its late
23:33:04FromDiscord<Phil> I'll go to sleep I think and look at this with fresh eyes
23:33:19FromDiscord<Phil> And see whether that way I can implement an event system and at the same time get rid of a circular dependency I'm running into
23:33:47FromDiscord<Phil> Well, less event system
23:33:55FromDiscord<Phil> More something that works akin to Django's Signal system
23:34:10*jmdaemon joined #nim
23:34:44FromDiscord<Phil> Oh wait, no I don't think that approach works, I have to store seq[proc]!
23:34:58FromDiscord<Phil> Because one event can have trigger multiple follow up actions
23:35:31FromDiscord<Phil> Like deleting an image can trigger as a follow up action that its contents from the search table are removed as well as deleting the actual image file
23:36:19FromDiscord<Phil> Boah screw my brain, tomorrow is also time
23:36:54FromDiscord<Phil> (edit) removed "have"