<< 15-10-2024 >>

00:07:05*Guest73 joined #nim
00:16:41*Guest73 quit (Quit: Client closed)
00:46:45*xet7 joined #nim
01:31:14*rockcavera joined #nim
02:11:40*rockcavera quit (Remote host closed the connection)
03:28:41*mahlon_ is now known as mahlon
05:31:52*coldfeet joined #nim
05:39:44*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
06:24:51*SchweinDeBurg joined #nim
07:25:00FromDiscord<emanresu3> is there a way to get field names from a type? I can get them from objects with fieldPairs()
07:36:25FromDiscord<demotomohiro> https://nim-lang.org/docs/macros.html#getType%2Ctypedesc
07:36:59*redj quit (Read error: Connection reset by peer)
07:38:20*redj joined #nim
08:25:42FromDiscord<kiloneie> Why does nim-lang.org extension mark the following code from my Object Variants Part 1 Tutorial as errors ? It doesn't actually error, i thought it would... https://media.discordapp.net/attachments/371759389889003532/1295663883897540660/image.png?ex=670f7886&is=670e2706&hm=f9cd8ba0528bfa5725129cdffb19aaabfd833783afdc7fbccf0aaae74c04a2b9&
08:25:56FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#pasty=jHXyadVM
08:30:48FromDiscord<k0ts> https://wandbox.org/permlink/yaUOwVzse4zJfYPi
08:56:19FromDiscord<emanresu3> `getImpl`, thank you!
09:11:42*ryuukk quit (Remote host closed the connection)
09:18:24FromDiscord<kiloneie> https://github.com/nim-lang/RFCs/issues/126↵↵Is there a reason this is still open ? I should follow the changelog more, i didn't know about type defaults till now...
09:25:40PMunchHuh? Looks closed to me
09:26:38PMunchHas anyone created a less copy-intensive strutils?
09:28:06PMunchI'm handling scenarios like a message starting with one or more instances of "\r\n" and then the message. I want to check if the message starts with something. In the strutils module this is `message.strip.startsWith`, but strip returns a new copy of the string..
09:36:50*beholders_eye joined #nim
09:45:57FromDiscord<nnsee> In reply to @kiloneie "https://github.com/nim-lang/RFCs/issues/126 Is the": ?
09:45:59FromDiscord<nnsee> https://media.discordapp.net/attachments/371759389889003532/1295684085670215680/image.png?ex=670f8b56&is=670e39d6&hm=61b828548aa5cfb2c99a85340cd193335501cce0003cb6e990e3f8cf55cc97c8&
10:16:11*PMunch quit (Remote host closed the connection)
10:16:25*PMunch joined #nim
10:16:54FromDiscord<kiloneie> Oh..., i did see that, but somehow my brains thought that since i can comment, it's still somehow open... my bad D:
10:42:31FromDiscord<kiloneie> Not possible right ? https://media.discordapp.net/attachments/371759389889003532/1295698314368520313/image.png?ex=670f9897&is=670e4717&hm=579e9f77a5a2985861f11a27e2e73fa56bb8340dac07295669ea92de68e7b712&
10:43:14*ryuukk joined #nim
10:53:18*coldfeet quit (Remote host closed the connection)
11:26:41FromDiscord<ieltan> In reply to @kiloneie "Not possible right ?": Nim doesn't support anonymous enums no
11:27:38FromDiscord<ieltan> that `enum` is not concrete so you cannot use it as a object field, you gotta use a Generic and constraint it to an enum
11:29:24FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=FvtueKqx
11:48:20FromDiscord<fabric.input_output> or make an `ObjKind` enum
11:48:27FromDiscord<fabric.input_output> (edit) "or make an `ObjKind` enum ... " added "type"
12:02:22FromDiscord<kiloneie> that was just me thinking if the above was possible https://media.discordapp.net/attachments/371759389889003532/1295718408259637338/image.png?ex=670fab4d&is=670e59cd&hm=b740d65b53aeb1dbb61f60dcc92811bc4f6247188731d3ad2aaaba9c6f0568fe&
12:03:53FromDiscord<kiloneie> i still wanna have like a NodeType that maps to Object, EmptyNode, etc... i can't remember if that's doable either
12:06:23FromDiscord<kiloneie> probably not as a type, but as a HashSet variable...
12:28:31*ntat joined #nim
12:37:21FromDiscord<kiloneie> sent a code paste, see https://play.nim-lang.org/#pasty=JcbwstQJ
12:50:05FromDiscord<kiloneie> Idk what im doing... https://media.discordapp.net/attachments/371759389889003532/1295730417134997575/image.png?ex=670fb67c&is=670e64fc&hm=92556740fd14eb915ba5d6d99fcc988d6c6b889ca68806933d6ee38905377235&
13:00:46FromDiscord<odexine> what are you trying to do
13:01:42FromDiscord<odexine> i think mixing generics and inheritance is not that well defined
13:02:27FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=safTTcgJ
13:03:23FromDiscord<odexine> any childobjects you want to be "compatible" with each other must have the same T and K
13:08:59FromDiscord<kiloneie> Well i was just trying to see if something like that is even possible and how it would work. https://media.discordapp.net/attachments/371759389889003532/1295735170829258783/image.png?ex=670fbaea&is=670e696a&hm=c8165ec1cf96591044b560de4882bd4f89bfe33df2562c669064b7487a7f07b8&
13:10:23FromDiscord<kiloneie> Atm i got 2x versions for my system of objects for my game, a "monolithic" one where i use 2x enums in an object with variants, and then a "modular" one where the first enum gets cut in favor of using inheritance instead of it, and then the second enum gets used in the children
13:10:41FromDiscord<kiloneie> so im trying to explore more options
13:11:16FromDiscord<odexine> its still a ref type
13:11:20FromDiscord<odexine> you still have to initialise it
13:11:25FromDiscord<ieltan> ref defaults to nil
13:11:30FromDiscord<kiloneie> oh
13:11:35FromDiscord<odexine> var co = ChildObject[ObjectKind, ImageKind]()
13:11:49FromDiscord<ieltan> So you gotta do `var obj = MyObj()`
13:11:53FromDiscord<ieltan> Beat me to it lol
13:12:02FromDiscord<odexine> butterfingers
13:12:18FromDiscord<ieltan> Idk what that means
13:12:32FromDiscord<odexine> nothing in particular in this case, i just wanted to say it'
13:12:46FromDiscord<ieltan> Oh lol
13:12:48FromDiscord<odexine> technically its to denote someone is a klutz but thats not really my intent
13:12:56FromDiscord<odexine> ~~not like i aint a klutz tho~~
13:15:02FromDiscord<ieltan> In reply to @kiloneie "Atm i got 2x": You mean instead of having a huge enum and matching those in a single object you want distinct objects that have similar base but different features depending on what kind it is?
13:17:34FromDiscord<kiloneie> Monolithic https://media.discordapp.net/attachments/371759389889003532/1295737334586802176/image.png?ex=670fbcee&is=670e6b6e&hm=569b33631212f483d73ba99ad983dd2a2f42e458ddab1bbfc251fce946085622&
13:18:19FromDiscord<kiloneie> Modular https://media.discordapp.net/attachments/371759389889003532/1295737521631793162/image.png?ex=670fbd1a&is=670e6b9a&hm=5a890dc86ad7b53a3849160e9abbf135346fb8adeed3e89a8e219bdaca3723be&
13:19:33FromDiscord<kiloneie> "Modular" allows for well whatever modularity offers and methods/dynamic dispatch if i will use it...↵↵I wanna have a NodeType like in "Monolithic" that maps to the "ObjectKind, ImageKind, AudioKind..."
13:19:43FromDiscord<kiloneie> one way would be via hashSets
13:20:01FromDiscord<kiloneie> at first i was trying to do some nonsense of enum with enum, but that doesn't seem like it's EVER possible
13:20:12FromDiscord<kiloneie> compiler cannot differentiate
13:20:20FromDiscord<kiloneie> between enum and enumerations
13:20:32FromDiscord<ieltan> You already using inheritance you might as well drop the enums and go "full" OOP with `method`
13:21:03FromDiscord<kiloneie> Oh that's an option..
13:21:54FromDiscord<kiloneie> Wait i could just have Node that does nothing, then NodeType that does the same to get the mapping i want... i think...
13:27:40FromDiscord<ieltan> If possible use a "event-oriented" approach, it will allow you to "fire" an event with a particular type (can be your player receiving damage, an enemy dying, etc..). Your event system take care of determining which event was fired and call the appropriate events handler
13:29:17FromDiscord<kiloneie> Got a good source of info on that ?
13:30:10FromDiscord<kiloneie> i am planning to have a level editor and or Game Maker sorts of editor one day in it, and i kind of want to overengineer it now
13:31:00FromDiscord<ieltan> I just know it's a known approach to adopt in game programming, any nim specific thing is a Google away
13:31:13FromDiscord<ieltan> You can ask here too I think chronos made one such system herself
13:39:25*beholders_eye quit (Read error: Connection reset by peer)
13:40:26FromDiscord<kiloneie> Okay, will look into it
13:45:12*beholders_eye joined #nim
14:01:02FromDiscord<kiloneie> In reply to @ieltan "You already using inheritance": enums demand covering of all cases, therefore you cannot forget to cover the case if you add it, and vice versa
14:33:02*ntat quit (Quit: Leaving)
14:44:20*ntat joined #nim
14:49:40*coldfeet joined #nim
14:51:19*PMunch quit (Quit: Leaving)
14:59:42*coldfeet quit (Remote host closed the connection)
15:01:58*ntat quit (Quit: Leaving)
15:10:13*nisstyre joined #nim
15:31:38*beholders_eye quit (Ping timeout: 255 seconds)
15:41:48*ntat joined #nim
15:54:03*beholders_eye joined #nim
16:16:22FromDiscord<double_spiral> Are there docs on the nimble file somewhere
16:43:39FromDiscord<spotlightkid> https://nim-lang.github.io/nimble/create-packages.html↵https://nim-lang.org/docs/nims.html↵https://nim-lang.org/docs/nimscript.html
16:45:40FromDiscord<kiloneie> In reply to @double_spiral "Are there docs on": my WIP that only requires the video part from half a year ago: https://kiloneie.github.io/Work%20in%20Progress/WIP%202/nimblePackageManagementAndGithub.html
16:46:01FromDiscord<kiloneie> Feel free to give feedback b4 it's made in a week or so.
17:19:45*cnx quit (Remote host closed the connection)
17:21:24*cnx joined #nim
18:48:20*coldfeet joined #nim
19:14:22*ntat quit (Quit: Leaving)
19:20:21*ntat joined #nim
19:42:58FromDiscord<double_spiral> How does one go about converting a seq of strings to a cstringArray
19:44:33FromDiscord<double_spiral> `let c_strings = cast[cstringArray](strings.addr)` seems to segfault when i try to access it
19:45:27FromDiscord<jviega> Take the address of the first element not the top level data structure
19:46:13FromDiscord<double_spiral> Ah
19:46:36FromDiscord<double_spiral> Nope still seqfaults
19:46:38FromDiscord<jviega> Not awesome if there are 0 elements, be careful of that
19:46:40FromDiscord<double_spiral> (edit) "seqfaults" => "segfaults"
19:46:52Amun-RacstringArray is an equivalent of (char *)[]
19:46:55FromDiscord<jviega> No it’ll work if it’s really an array of c strings
19:47:05FromDiscord<double_spiral> is a seq of strings
19:47:09FromDiscord<double_spiral> (edit) "is" => "its"
19:47:20Amun-Ra$cast[cstring](someseq[0].addr)
19:47:27Amun-Raseq must be nil-terminated
19:49:18FromDiscord<Elegantbeef> If it's a `seq[string]` you have to use `allocCstringArray`
19:49:46FromDiscord<jviega> Yeah nim strings aren’t c strings
19:50:08FromDiscord<Elegantbeef> Unless you're passing a single entry of course
19:50:43FromDiscord<heysokam> @double_spiral https://github.com/heysokam/nstd/blob/903b0b6bc837248b859175ea814be00442f75cba/src/nstd/strings.nim#L88-L104
19:50:55FromDiscord<heysokam> thats the idea
19:51:50FromDiscord<heysokam> you dont need the distinct types, as long as your C compiler is not set to be giga-strict
19:55:15FromDiscord<demotomohiro> Nim's string is pointer + size. seq[string] is different from the memory layout of array of pointers to char.
19:58:26FromDiscord<double_spiral> I dont think this is how you spell world https://media.discordapp.net/attachments/371759389889003532/1295838214933839872/image.png?ex=67101ae1&is=670ec961&hm=642660480039d7e064cb51468255ab5ca7568528ef137c4d5f604af0a560e90d&
19:59:11FromDiscord<double_spiral> In reply to @Elegantbeef "If it's a `seq[string]`": This worked btw
19:59:13FromDiscord<jviega> Right because you have nim string objects in that array not c strings, as people have been saying over and over
19:59:52FromDiscord<double_spiral> Take a chill pill
20:04:27FromDiscord<jviega> I’m chill, just recommending you read more closely 🙂
20:05:21FromDiscord<double_spiral> I can recommend the same to you, no when ever mentioned cstrings, i very explicitly said "a seq of strings" 😄
20:05:32FromDiscord<double_spiral> (edit) "when" => "one"
20:06:47*coldfeet quit (Remote host closed the connection)
20:08:24FromDiscord<kiloneie> eat a cookie
20:17:26*ntat quit (Quit: Leaving)
20:24:58FromDiscord<jviega> That’s ambiguous in a way that `seq[string]` is not, which is why the answer qualified it to cstrings, poorly implying you should say if you needed something else 🙂
20:26:24FromDiscord<double_spiral> uhuh its not your fault
20:26:27FromDiscord<double_spiral> god i hate the internet
20:28:49FromDiscord<jviega> Communication is hard pretty much everyone could be doing better 🙂
20:39:38FromDiscord<odexine> In reply to @kiloneie "eat a cookie": cook an eatie
20:44:36*beholders_eye quit (Quit: WeeChat 4.1.2)
20:45:45FromDiscord<double_spiral> In reply to @jviega "Communication is hard pretty": This one actually won me over ngl, good job
20:46:23FromDiscord<Elegantbeef> Nah I've pretty much peaked, no one could ever understand me any more
20:46:35FromDiscord<Elegantbeef> Remember to dealloc your cstring array when you're done with it
21:38:46*rockcavera joined #nim
23:46:23*xet7 quit (Read error: Connection reset by peer)
23:53:32*xet7 joined #nim