<< 20-01-2016 >>

00:00:46Araq_I actually simplified this example without running it through the compiler
00:00:51Araq_that's what I get.
00:00:55Araq_2 typos already.
00:02:10*vendethiel joined #nim
00:03:20*jaco60 quit (Ping timeout: 250 seconds)
00:06:53*jsudlow joined #nim
00:12:38*nchambers joined #nim
00:23:42*vendethiel quit (Ping timeout: 250 seconds)
00:38:31bozaloshtshso jester's based off sinatra (as it seems) and I can get a sinatra app to run from a class (so I can have multiple in one file.) Can this be done with jester while still using the nice syntax?
00:39:14bozaloshtshmeaning can I start multiple webservers from procs
00:40:09*M-max joined #nim
00:41:26*bjz_ quit (Quit: Textual IRC Client: www.textualapp.com)
00:41:43*bjz joined #nim
00:54:04dom96bozaloshtsh: I don't think that's supported at the minute I'm afraid
00:54:15dom96bozaloshtsh: please create an issue on github and i'll see what I can do :)
00:54:24dom96good night
00:57:42Araq_why would you want that?
01:07:36bozaloshtshmy program's central feature isn't a webserver, but it runs one on the side... I want to make a mini library for it
01:08:09*pregressive joined #nim
01:09:52Araq_makes sense I guess, but I would likely run the server as a separate program anyway
01:11:01*M-Quora joined #nim
01:13:29*desophos quit (Ping timeout: 276 seconds)
01:16:25*user__ joined #nim
01:17:30*user__ quit (Client Quit)
01:24:54ldleworkIs there a way to do ... partial object variants?
01:25:05ldleworkLike... what if I want to add a variant to some library variant or something
01:25:34ldleworkAraq_: I was thinking this might be another way to do components
01:25:53ldleworkSince now you can treat all these variant types as the same type with regards to book-keeping
01:25:59ldleworkand then later discriminate meaningfully in gameplay code
01:26:23Araq_yeah you guys always want to distribute types over compilation units
01:26:27ldleworkBut if you have to deifne all the component variants in the single block...
01:26:36ldleworkAraq_: hehe
01:27:42Araq_and eventually we will indeed get something like that, as I said.
01:28:25ldleworkAraq_: I suppose for now I could write a macro to pool variant partials ... :D
01:28:33ldleworkand then emit the unified partial
01:28:46Araq_yeah, well it's not like the compiler can do much more than that
01:28:52ldleworkSure
01:29:24ldleworkYeah not sure how it would distinguish between a redefinition in error, or a variant addendum
01:30:01Araq_do you know about C#'s partial classes?
01:30:17ldleworkyep
01:30:19Araq_would that be good enough?
01:30:43ldleworkif you adapated that to object variant definitions I suppose
01:30:49ldleworkI dunno
01:31:03ldleworkI'm such a child in this type safe world I don't know what's possible!
01:32:03Araq_wait ... why do you use object variants?
01:34:53ldleworkWell I don't yet. I was talking with someone and the idea of defining all the data-component types as variants of the same type ocurred to me.
01:35:27ldleworkLike if you wanted to initialize an entity, you could a number of these variants in a single sequence or varargs or whatever. It'd be a natural interface.
01:35:35*satbyy_ quit (Ping timeout: 264 seconds)
01:35:47ldleworkIf an entity maintained a list of components it had, you'd be able to check what components an entity has by iterating over them and checking the discriminator.
01:36:04ldleworkAll without having to care at all that each component is basically a totally disjoint type
01:36:31ldleworkuntil you do care, in the gameplay code where you say "give me all the entities with X, Y and Z components" and procede to access fields on those types
01:36:52ldleworkSo instead of building a huge unified type
01:36:58ldleworkYou are really doing composition again..
01:37:10ldleworkargh I'm so far down this unified approach but this makes some sense..
01:38:29ldleworkfuck I've basically reinvented partial classes
01:39:34ldleworkActually really cool flexible version of partial classes but still
01:39:53Araq_dunno - sounds wrong to me. why would position and e.g. velocity share a common type?
01:40:31ldleworkBecause of their role in being dynamically composed together at run time?
01:40:43ldleworkIf they were different types you couldn't treat components homogenously
01:41:24ldleworkyou couldn't map those variants to strings
01:41:33Araq_yeah. I don't want homogenously.
01:41:34ldleworkand then compose a novel type at runtime with json data
01:41:49ldleworkby just saying, "make a thing that has a position and velocity"
01:41:57ldleworkor "make a different thing that has position and a sprite"
01:41:59ldleworkand so on
01:42:15ldleworkAraq_: I mean isn't that basically what algebraic types are?
01:42:30ldleworkBeing able to treat some different types as the same type
01:42:39Araq_no, you want to compose your type at runtime. which is stupid.
01:42:59ldleworkwhy?
01:43:06Araq_because then it's strictly speaking not even a type anymore.
01:43:20ldleworkWell sure, I don't really want a type
01:43:32ldleworkI want a model of some agent that has arbitrary behaviors
01:43:37Araq_you might as well use JSON everywhere then.
01:43:53ldleworkWhy? My tilemaps and renderer and UI and so on, are all implemented traditionally
01:44:52Araq_so you only need a mapping from JSON to T and from T to JSON. that's easy enough to do.
01:45:45ldleworkNo it isn't serialization/marshalling
01:46:25ldleworkI mean I know you know why people want to compose entity types with data, and why that has to be done at runtime hehe we shouldn't have this 'fake argument' :P
01:47:13ldlework(though maybe you imagine other ways to accomplish the same goals other people have not thought of I wouldn't put that past you)
01:49:40Araq_no, it's not obvious that all that needs to be done at runtime
01:50:17ldleworkAraq_: what if I wanna write the metaverse
01:50:30ldleworkand so novel entities should be able to be designed and instantly usable at runtime ? :D
01:50:58ldleworkmany game engines support doing this. And its by way of generating every possible type for every possible behavior component.
01:51:17ldleworkits not*
01:52:06Araq_yes but many game engines are scriptable with Lua, for example.
01:52:13ldleworkAraq_: are you alluding to just making a class that can do potentially everything that your system supports?
01:52:35Araq_where it's dead easy to have objects/tables that consist of predefined components
01:52:40ldleworkSure but you end up just doing the same thing but in lua
01:53:15Araq_no, since Lua is dynamically typed the modelling problem you're having doesn't even exist. I think.
02:01:24*Jesin quit (Ping timeout: 245 seconds)
02:05:20*derka quit (Quit: derka)
02:07:27*derka joined #nim
02:13:44*kniteli joined #nim
02:24:44*vendethiel joined #nim
02:29:05*derka quit (Ping timeout: 255 seconds)
02:29:54*derka joined #nim
02:31:31*desophos joined #nim
02:47:35*vendethiel quit (Ping timeout: 240 seconds)
02:50:21*nchambers is now known as homiechambers
03:40:02*brson quit (Quit: leaving)
03:42:41*pregressive quit (Remote host closed the connection)
03:43:17*pregressive joined #nim
03:46:04*zama quit (Ping timeout: 250 seconds)
03:47:59*pregressive quit (Ping timeout: 260 seconds)
03:48:03*pregress_ joined #nim
03:52:44*pregress_ quit (Ping timeout: 276 seconds)
03:58:35*zama joined #nim
04:38:20*vangroan joined #nim
04:41:34Xehow do I add -d:threads, etc to a nimble definition?
05:12:16*vendethiel joined #nim
05:27:00*vendethiel- joined #nim
05:28:06*vendethiel quit (Ping timeout: 240 seconds)
05:29:42*homiechambers is now known as nchambers
05:34:38*s4 joined #nim
05:37:00*vendethiel- quit (Ping timeout: 272 seconds)
05:46:07*s4 quit (Quit: Konversation terminated!)
05:47:52*s4 joined #nim
06:00:08*silven quit (Ping timeout: 276 seconds)
06:00:24*silven joined #nim
06:14:54*nchambers quit (Read error: Connection reset by peer)
06:18:27*darkf joined #nim
06:50:03*Demon_Fox quit (Quit: Leaving)
06:52:08*vqrs quit (Ping timeout: 276 seconds)
06:52:37*vqrs joined #nim
07:04:14*vendethiel joined #nim
07:08:55*desophos quit (Read error: Connection reset by peer)
07:30:29*jsudlow quit (Ping timeout: 276 seconds)
07:47:18*ephja joined #nim
07:48:27*yglukhov joined #nim
07:56:58*vendethiel quit (Ping timeout: 272 seconds)
07:57:47*gokr joined #nim
07:57:56*bjz_ joined #nim
07:58:59*bjz quit (Ping timeout: 264 seconds)
08:00:48*jsudlow joined #nim
08:08:47*Ven joined #nim
08:10:15*vendethiel joined #nim
08:27:22*Trustable joined #nim
08:30:11*jaco60 joined #nim
08:30:13*polde joined #nim
08:33:04*vendethiel quit (Ping timeout: 272 seconds)
08:36:45*vendethiel joined #nim
08:37:57*polde quit (Quit: q)
08:38:52*polde joined #nim
08:55:59*vendethiel- joined #nim
08:56:35*jaco60 quit (Ping timeout: 260 seconds)
08:57:08*vendethiel quit (Ping timeout: 272 seconds)
09:14:41*Arrrr joined #nim
09:21:40*vendethiel- quit (Ping timeout: 260 seconds)
09:25:32*kniteli quit (Ping timeout: 265 seconds)
09:47:14mountaingoatany tips on how to use `dynlib` to import a global variable (specifically, a function pointer) from a library?
09:51:50*awsteele joined #nim
09:53:55*coffeepot joined #nim
10:08:17*awsteele quit (Quit: My Mac has gone to sleep. ZZZzzz…)
10:10:57*awsteele joined #nim
10:16:24*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:22:17Araq_take a look at the Python wrapper
10:22:25Araq_I forgot how it needs to be done.
10:22:44Araq_better yet: use a library that is not insane.
10:23:14mountaingoatwill do, thanks
10:23:18coffeepoti'm just looking at https://github.com/jboy/nim-pymod
10:23:23mountaingoatunfortunately it's not my library
10:33:04*vendethiel joined #nim
10:53:50*vendethiel quit (Ping timeout: 260 seconds)
10:54:50*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
11:03:49*Ven joined #nim
11:09:19*derka_ joined #nim
11:09:22*yglukhov quit ()
11:10:50*gokr1 joined #nim
11:10:58*gokr quit (Read error: Connection reset by peer)
11:11:32*derka quit (Ping timeout: 250 seconds)
11:11:33*derka_ is now known as derka
11:13:30*BitPuffin joined #nim
11:13:48*awsteele quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:15:01*yglukhov joined #nim
11:23:27*matkuki joined #nim
11:28:59*vendethiel joined #nim
11:29:13*bjz joined #nim
11:31:23*bjz_ quit (Ping timeout: 264 seconds)
11:49:35matkukiHi guys.
11:49:35*vendethiel quit (Ping timeout: 240 seconds)
11:49:36matkukiIs there a large overhead in using MainObject vs Myobject? https://bpaste.net/show/1fde6072dc02
11:51:20*vendethiel joined #nim
11:52:21reactormonkmatkuki, depends on the C compiler. I'd go for version 2 and simply with SubObject, less DRY.
11:55:01matkukireactormonk: Thanks. What do you mean with 'simply with SubObject'?
11:55:30reactormonkmatkuki, they don't seem to have any different attributes for now
11:57:07matkukireactormonk: oh, thanks
11:57:44reactormonkmatkuki, you could go MainObject: attx: SubObject etc.
11:58:29reactormonkmatkuki, but honestly, compiler optimization is tricky business. I'd try both versions and see what happens.
12:01:30matkukiI'm using mingw64. Will try it, thanks.
12:01:51*vangroan_ joined #nim
12:05:26*vangroan quit (Ping timeout: 272 seconds)
12:06:41Araq_matkuki: MainObject has no overhead.
12:08:20matkukiAraq_: Great! Thanks. I've a game object with a ton of physics attributes, so it's a little more managable that way.
12:11:11ArrrrHow many
12:11:56*vendethiel quit (Ping timeout: 276 seconds)
12:17:21matkukiArrrr: about 40
12:19:55*vendethiel joined #nim
12:24:46*joelmo joined #nim
12:26:56*vangroan__ joined #nim
12:30:17ArrrrI don't think that's too many
12:30:17*vangroan_ quit (Ping timeout: 255 seconds)
12:30:51ArrrrBut also i don't know what things are you gonna do with them
12:41:40*vendethiel quit (Ping timeout: 250 seconds)
12:45:52*cnu- joined #nim
12:46:48cnu-i am using asyncnet. is it possible to cancel "await server.accept()" and close the socket?
12:59:26*vangroan__ quit (Ping timeout: 240 seconds)
13:17:52dom96cnu-: there is no way to cancel it yet, you might need to use a workaround for now, what are you trying to do?
13:22:04*gokr1 quit (Ping timeout: 272 seconds)
13:27:09*pregressive joined #nim
13:27:33*vendethiel joined #nim
13:35:47cnu-dom96, i wanted to make "reload configuration" where the new configuration could have different listeners
13:36:49dom96cnu-: sorry, i'm not sure I understand the reason for cancelling 'await server.accept' in that use case, could you elaborate?
13:37:53cnu-dom96, are you familiar with nginx?
13:38:05dom96sure
13:39:38cnu-you can send nginx a signal while it's running, to make it reload the configuration file. if you replace say "listen 1234" with "listen 4321" it will close the old socket and open a new one
13:47:23*Pisuke joined #nim
13:50:37*LeNsTR|away joined #nim
13:51:06*pleiosau1 joined #nim
13:51:12*liori_ joined #nim
13:51:41*s4 quit (Quit: Konversation terminated!)
13:51:43cnu-i guess i have a similar problem with recv()/send(). it seems very easy to write code that "speaks the protocol", but it gets difficult if i want to add timeouts, the possibility of cancelling the connection from somewhere else etc
13:51:44*wuehlmau1 joined #nim
13:54:23*matkuki quit (Quit: ChatZilla 0.9.92 [Firefox 43.0.4/20160105164030])
13:55:00*eldamar_ joined #nim
13:55:15*Amrykid2 joined #nim
13:55:15*dom96_ joined #nim
13:55:33*vqrs_ joined #nim
13:56:00*vqrs quit (*.net *.split)
13:56:01*wuehlmaus quit (*.net *.split)
13:56:01*satbyy quit (*.net *.split)
13:56:01*onionhammer quit (*.net *.split)
13:56:01*mtj_ quit (*.net *.split)
13:56:02*federico3 quit (*.net *.split)
13:56:02*lenstr quit (*.net *.split)
13:56:03*Amrykid quit (*.net *.split)
13:56:03*so quit (*.net *.split)
13:56:03*liori quit (*.net *.split)
13:56:03*sarlalian quit (*.net *.split)
13:56:03*SianaGearz quit (*.net *.split)
13:56:03*joebo quit (*.net *.split)
13:56:03*delian66 quit (*.net *.split)
13:56:04*saml quit (*.net *.split)
13:56:05*MyMind quit (*.net *.split)
13:56:05*pleiosaur quit (*.net *.split)
13:56:06*Amun_Ra quit (*.net *.split)
13:56:06*dom96 quit (*.net *.split)
13:56:06*eldamar quit (*.net *.split)
13:56:07*fold3 quit (*.net *.split)
13:56:07*rinukkusu quit (*.net *.split)
13:56:07*low-profile quit (*.net *.split)
13:56:07*cncl quit (*.net *.split)
13:56:08*dom96_ is now known as dom96
13:57:10*delian66 joined #nim
13:57:48*SianaGearz joined #nim
13:59:04*rinukkusu joined #nim
14:02:44*cncl joined #nim
14:02:56*satbyy joined #nim
14:03:02*joebo joined #nim
14:03:11*federico3 joined #nim
14:03:16*mtj_ joined #nim
14:03:17*saml joined #nim
14:03:31*Amun_Ra joined #nim
14:03:31*onionhammer joined #nim
14:04:36*sarlalian joined #nim
14:04:43*low-profile joined #nim
14:05:19*fold3 joined #nim
14:09:55*vendethiel quit (Ping timeout: 240 seconds)
14:15:51*pregressive quit (Remote host closed the connection)
14:19:23*arnetheduck quit (Ping timeout: 264 seconds)
14:24:05*wuehlmau1 is now known as wuehlmaus
14:26:01*vendethiel joined #nim
14:30:57*Guest34835 is now known as Heartmender
14:31:06*Heartmender quit (Changing host)
14:31:06*Heartmender joined #nim
14:41:00*LeNsTR|away quit (Changing host)
14:41:00*LeNsTR|away joined #nim
14:41:03*LeNsTR|away is now known as lenstr
14:48:26*vendethiel quit (Ping timeout: 255 seconds)
14:48:57*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:05:32*bozaloshtsh quit (Ping timeout: 250 seconds)
15:05:56*Ven joined #nim
15:09:50*so joined #nim
15:23:17*Arrrr quit (Quit: WeeChat 1.2)
15:30:54*pregressive joined #nim
15:33:53*bozaloshtsh joined #nim
15:42:55*minmax joined #nim
15:56:50*Ven quit (Ping timeout: 276 seconds)
16:11:12*liori_ is now known as liori
16:17:50*bozaloshtsh quit (Ping timeout: 250 seconds)
16:34:51*satbyy_ joined #nim
16:38:12*bozaloshtsh joined #nim
16:44:32*yglukhov quit (Ping timeout: 255 seconds)
16:44:44*ryan2 joined #nim
16:47:55*desophos joined #nim
16:51:19*algun joined #nim
16:52:11algunwat is dis?
16:53:41*minmax quit (Quit: Page closed)
16:54:00ephjaalgun: roughly what it says in the topic :-)
16:54:34algunJavaScript is a PL too
16:55:42algunephja so like js?
16:56:17*vendethiel joined #nim
16:58:01ephjaalgun: it's statically typed and has both high and low level features
16:58:26algunso like c++?
16:59:18ephjayes, it's more similar to C++
16:59:46ephjaspeaking of JS, it's possible to generate JS code
17:00:17algunmate ive gotta tell you youre not selling this thing
17:01:34algunperhaps i should explain that i know that nim aims to be a syslang w an emphasis on metaprogramming and what id like to know is why i should learn it
17:12:36*bozaloshtsh quit (Ping timeout: 272 seconds)
17:16:17*kniteli joined #nim
17:16:24*askatasuna joined #nim
17:16:34ephjaalgun: perhaps if you're interested in those aspects but aren't happy with C++ for example, because it does a lot of things better
17:18:29algunephja: i don't use cpp. i use the nicer c for sysprog and then higher level langs for rhings that benefit from more absrraction
17:18:50algunso perhaps try selling me nims meraprogramming?
17:22:00*ggVGc joined #nim
17:23:13*brson joined #nim
17:29:08algunsetting aside browser apis not sure if anything but promises deserve mention. legacy is so constraining thay we are forced to be excited to have document.querySelectorAll AND it doesnt return an array so you must hack Array.prototype functions
17:29:23algunoops wrong ch
17:44:20*satbyy_ quit (Ping timeout: 265 seconds)
17:45:52*yglukhov joined #nim
17:50:14*yglukhov quit (Ping timeout: 256 seconds)
17:52:59*askatasuna quit (Quit: WeeChat 1.3)
17:53:40*jaco60 joined #nim
17:55:49*yglukhov joined #nim
17:56:52*askatasuna joined #nim
18:08:01*jsudlow quit (Read error: Connection reset by peer)
18:08:25*algun quit (Quit: peace)
18:08:38Araq_algun: well not everybody believes in the C+high-level-language combination.
18:08:43Araq_ah too late.
18:08:44*algun joined #nim
18:08:44*algun quit (Client Quit)
18:08:49*jsudlow joined #nim
18:09:28*BitPuffin quit (Ping timeout: 265 seconds)
18:12:47*ryan3 joined #nim
18:17:19*Matias joined #nim
18:18:34*bjz_ joined #nim
18:20:28*mal``` joined #nim
18:20:41*huonw_ joined #nim
18:22:00*ryan2 quit (*.net *.split)
18:22:01*bjz quit (*.net *.split)
18:22:02*Senketsu quit (*.net *.split)
18:22:03*thotypous quit (*.net *.split)
18:22:03*huonw quit (*.net *.split)
18:22:03*Roin quit (*.net *.split)
18:22:04*mal`` quit (*.net *.split)
18:22:04*gsingh93 quit (*.net *.split)
18:22:05*_stowa quit (*.net *.split)
18:22:35*_stowa_ joined #nim
18:22:50*gsingh93 joined #nim
18:23:30*jsudlow quit (Read error: Connection reset by peer)
18:24:56*jsudlow joined #nim
18:28:33*Senketsu joined #nim
18:28:52*Roin joined #nim
18:35:42*jsudlow quit (*.net *.split)
18:35:57*Matias is now known as thotypous
18:37:49*jsudlow joined #nim
18:42:49*_stowa_ is now known as _stowa
18:48:18*jsudlow quit (*.net *.split)
18:48:39*jsudlow joined #nim
18:54:34*Heartmender quit (Changing host)
18:54:35*Heartmender joined #nim
18:59:06*jsudlow quit (*.net *.split)
19:07:24*darkf quit (Quit: Leaving)
19:10:48*Matthias247 joined #nim
19:26:22*Amrykid2 is now known as Amrykid
19:26:36*Amrykid quit (Changing host)
19:26:36*Amrykid joined #nim
19:36:59ephjaAraq_: I have this c2nim directive: "#def EAPI", but it fails when encountering "#undef EAPI". What should I do? Preprocess the header?
19:41:47*Jesin joined #nim
19:45:26ephjaprobably, and then report it
19:50:36*xtagon joined #nim
19:54:29Araq_not sure.
19:54:48Araq_I don't think #undef EAPI is supported but it should just be ignored by c2nim
20:02:28*satbyy_ joined #nim
20:04:15*yglukhov quit (Remote host closed the connection)
20:12:25*Demon_Fox joined #nim
20:13:29*strcmp1 quit (Quit: peace)
20:14:47*zepolen joined #nim
20:18:02*jsudlow joined #nim
20:23:37*brson quit (Quit: leaving)
20:23:44*zepolen quit (Remote host closed the connection)
20:24:32*zepolen joined #nim
20:26:16*yglukhov joined #nim
20:28:39*jsudlow quit (*.net *.split)
20:42:43*meh joined #nim
20:42:51*jsudlow joined #nim
20:48:17ldleworkIs it possible to define `in` for Table?
20:50:15*meh quit (Quit: Page closed)
20:52:14ldleworkguess so
20:52:16ldleworkneat
20:52:53ldleworkshould add this to the tables module:
20:52:55ldleworkproc `in`[K, V](t: Table[K, V], kind: K): bool = t.hasKey(kind)
20:52:59flyxldlework: usually, you'll use on of `in table.keys()`, `in table.values()` or `in table.pairs()`
20:53:14ldleworkah well
20:53:24*jsudlow quit (*.net *.split)
20:53:36ldleworkflyx: does that construct a new sequence?
20:53:49flyxnewSeq[T]()
20:53:50ldleworkI wonder if calling hasKey is more efficient than in .keys()
20:54:09flyxah, misread
20:56:08*derka quit (Quit: derka)
20:56:13flyxI actually don't know how it works, it was more of a guess
20:57:02ldleworksure
21:03:18Araq_no, 'in' is **always** an alias for 'contains'
21:03:26Araq_you need to give table a 'contains'
21:03:29ldleworkoh okay
21:03:31ldleworkthanks Araq_
21:03:36Araq_but it should already have one?
21:03:48Araq_this thing has like 4 trillion procs
21:04:13ldleworkyeah I guess it does
21:04:17ldleworkI was looking for `in`
21:04:19ldleworkthanks
21:04:55*bozaloshtsh joined #nim
21:05:39ldleworkAraq_: how do you express 'not in'
21:05:52Araq_without the space
21:05:53ldleworkis it `if not (a in b):` or `if a not in b`
21:05:55Araq_foo notin bar
21:05:56ldleworkoh
21:05:59ldleworkhuh
21:06:00ldleworkok
21:06:09Araq_parser restriction :P
21:07:18ldleworkhehe
21:11:42ldleworkWhy isn't this working? https://gist.github.com/dustinlacewell/4e59cf4cfe2fdd403190
21:20:30ldleworkAraq_: is there any sensible way to echo an object variant?
21:24:30Araq_sure but the default $ for object cases doesn't work.
21:30:16ldleworkAraq_: which means you need to build a single `$` for your base variant type that covers all cases
21:30:36Araq_getType ftw
21:30:50ldleworkI dunno what you're insinuating
21:32:31ldleworkAraq_: can I use fieldpairs on variants?
21:36:07ldleworkAlso any idea why the linked gist doesn't work?
21:37:08def-ldlework: components parameter needs to be var
21:37:48ldleworkwhy?
21:37:55ldleworkshouldn't it be pure?
21:38:13ldleworkI mean entity gets mutated...
21:38:53ldleworkdef-: that didn't fix it
21:39:01ldleworksame error
21:41:18def-ldlework: your proc also needs "(c: var Component)"
21:41:36def-but i'm just guessing from the error, would help if your code was self-contained
21:42:42def-now that I look at it, I'm not sure why you're even use map, why not a for loop?
21:43:02ldleworkdef-: because I wanted to be fancy
21:43:06ldleworkwhy the hell does it have to be var?
21:44:05def-because "map" is for mutating the elements of a datastructure or creating a new one based on the elements of another one
21:44:18ldleworkRight creating a new one
21:44:25ldleworkmeans you don't need to mutate it
21:44:41def-so what is entity.addComponent(c) returning?
21:44:49ldleworknothing
21:44:52ldleworkmaybe that's why
21:45:19ldleworkWell it seems that you cannot use fieldpairs on an object variant
21:45:41def-for c in components: entity.addComponent(c)
21:46:28def-And yes, if addComponent returns nothing, then it doesn't fit the op parameter of the second map
21:46:56ldleworkdef-: yeah you were right
21:46:59ldleworkI switch to forloop anyway
21:47:01def-and even if it returned something, you'd have to discard the end result
21:47:05ldleworkright
21:47:11def-and you'd be building up some data structure that you don't need
21:47:15def-so yes, for loop is better :)
21:47:27ldleworkdef-: check this out, https://gist.github.com/dustinlacewell/f485c053e4f297bdb12a
21:48:03*jsudlow joined #nim
21:49:19def-ldlework: fieldPairs(x[])
21:49:26ldleworkinteresting
21:50:33def-btw, you might want to use result.add(")") instead of result = result & ")"
21:50:49ldleworkhmm yeah
21:51:18ldleworkI wonder why components are not getting added
21:51:23ldleworkeverything says false at the end
21:52:03ldleworkdef-: https://gist.github.com/dustinlacewell/f485c053e4f297bdb12a
21:52:19ldleworkoops
21:52:21ldleworkdon't look!
21:52:23*ldlework blushes
21:53:45*brson joined #nim
21:54:06ldleworkyay
21:54:20ldleworkthe world's simpilest type-safe ECS !
21:54:23ldleworkhahaha
21:54:34ldleworkso awesome
21:54:39ldleworkno macros either!
21:55:14*bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:56:10ldleworkbut now I need some macros so I can distribute the variant definitions, and generate some helper methods for initializing components so you don't have to pass in a kind enum
21:56:49ldleworkdef-: thanks for your help
21:59:13def-ldlework: you're welcome, great that it works
22:03:48*strcmp1 joined #nim
22:04:30ldleworkdef-: when you create a type alias, say a type name for a specific Table type, is there an easy way to get all of the procs defined on Table, for your type?
22:06:06*gokr joined #nim
22:06:40def-ldlework: just don't use distinct?
22:06:50ldleworkhmm I wasn't
22:07:14def-then they should be available, shouldn't they?
22:07:28ephjayes
22:07:59*awsteele joined #nim
22:08:38*derka joined #nim
22:09:13ldleworkthat worked yeah
22:09:15ldleworkthanks
22:10:44*bjz joined #nim
22:13:23*derka quit (Ping timeout: 264 seconds)
22:13:31ldleworkdef-: why the indentation error? https://gist.github.com/dustinlacewell/afcbceb24d56c5b08687
22:14:08ldleworkoh alias is a keyword
22:14:40ldleworknope that wasn't it...
22:14:41Araq_no
22:14:43Araq_ case kind:
22:14:49Araq_<-- type missing
22:15:30ldleworkoh thanks
22:16:31ldleworkAraq_: partial variants would be a really cool first class feature
22:16:52ldleworkno idea how you'd express it though
22:16:55Araq_create a spec for them
22:17:09ldleworkhmm interesting
22:17:31Araq_like I said, we need some prepass over types so that people can continue to write their misdesigns (hi yuri!)
22:17:59Araq_and a prepass is a prepass. it can collect "partial variants" too, whatever that means.
22:17:59ldleworkhehe, what are they doing
22:18:03ldleworkright
22:18:26*bjz quit (Ping timeout: 240 seconds)
22:18:47*ryan3 quit (Quit: WeeChat 1.3)
22:18:50*derka joined #nim
22:25:00*awsteele quit (Quit: Textual IRC Client: www.textualapp.com)
22:27:22*brson quit (Ping timeout: 272 seconds)
22:30:17ldleworkAraq_: hmm, I could just object inheritance huh
22:30:52ldleworkComponent = object of RootObj
22:30:54ldleworkCVisible = object of Component
22:30:59ldleworkgame over?
22:31:42ldleworkah nope
22:31:48ldleworkif I define something to take a Component
22:31:55ldleworkand I pass it a CVisible it complains I didn't pass it a Component
22:32:34ldleworkoh well variants are cool
22:33:41def-t
22:34:42ldlework?
22:36:27def-ldlework: works for me: https://gist.github.com/def-/aa8f2d2793d800920df6
22:37:09ldleworkdef-: but you could never access .name right
22:37:58def-inside of test? not directly, no
22:38:09ldleworkwith object variants you can
22:38:19ldleworkyou have to discriminate, but that's okay
22:39:42def-you can discriminate with inheritance as well, updated the example
22:39:48*strcmp1 quit (Quit: peace)
22:40:00ldleworkoh neat
22:40:10ldleworkis there a case version of that?
22:40:18ldleworkso all subclasses have to be covered maybe?
22:40:25ldleworkdon't need that just curious
22:40:42ldleworkits kinda too bad that you have to rebind
22:41:16ldleworkI wonder if the compiler could be made to consider x a Dog in the scope of the discrimination
22:41:28def-well, you could write a macro to do that
22:42:49ldleworkeh
22:43:51ldleworkAraq_: what do you think about that
22:44:25def-a case version might not even be possible here because you could introduce new subtypes in other files
22:45:25Araq_what def- said
22:45:45Araq_oh def- how did you generate the makefile for csources?
22:45:54Araq_got some bug report about that
22:46:12ldleworkOkay I think I'll stick with variant-partials then
22:47:54def-Araq_: tools/niminst/makefile.tmpl, which I manually translated from the buildsh template
22:48:29Araq_ok, so it should actually update it automatically
22:51:18def-ldlework: now with a simple template
22:53:18ldleworkdef-: hmm, interesting. How would you write a proc that allowed you to say "From this list of Animals, give me all the Dogs"
22:53:55def-Araq_: not sure how the csources repo is updated, but makefile was indeed not updated
22:54:32*vendethiel quit (Ping timeout: 256 seconds)
22:54:42ldleworkthat is, without writing a specific proc for each subclass
22:55:00def-ldlework: hm, my template hack is probably ugly
22:57:04def-ldlework: updated with that proc
22:57:12*gokr quit (Quit: Leaving.)
22:57:33ldleworkdef-: right, without having a proc for each subclass :P
22:58:03ldleworkWhat's nice about the variants is that they already require some kind of enumeration to couple to the variant
22:58:15ldleworkso you can pass a list of enums as a natural interface for gathering specific variants
22:58:58ldleworkBut I suppose you will now write a template
22:59:00def-ldlework: updated
22:59:00ldlework:D
22:59:02ldleworkhaha
22:59:11def-no, generics are good enough
22:59:12ldleworkthat's awesome
22:59:51ldleworkdef-: "with x as T" syntax would be badass
23:00:03def-don't understand
23:00:21ldleworkfor using x as a T
23:00:32ldleworklike when you discriminate in test
23:00:55ldleworkdef-: also, is there a way to take multiple sub types?
23:01:18ldleworkto get a list of animals consisting of Dogs and Cats but not Elephants or Birds?
23:01:38ldleworkI doubt there is an openarray for generic parameters
23:02:29ldleworkI guess that's not super important...
23:04:11*M-max quit (Ping timeout: 260 seconds)
23:04:28*M-max joined #nim
23:06:19*brson joined #nim
23:10:41*NimBot joined #nim
23:10:42def-ldlework: don't see a simple way, you can do it at runtime or with more advanced templates/macros
23:13:44ldleworkIt seems like when using the `%` macro to do string interpolation, that it should run each item in the array through $
23:14:03ldleworkecho "$1, $2" % [$(e[EPosition].x), $(e[EPosition].y)]
23:14:21def-ldlework: use format
23:14:30def-it applies $ automatically
23:14:56ldleworkdoh, lol why doesn't % do that?
23:19:10ldleworkdef-: do you know if Nim supports weakrefs?
23:20:10def-google finds this: http://forum.nim-lang.org/t/45
23:21:15ldleworkyeah reading that now
23:23:23ldleworkI guess I'm just worried
23:23:35ldleworkIf an entity has a component that holds a reference to some other entity
23:23:44ldleworkor some other component maybe
23:23:53ldleworkand then that target is destroyed
23:24:07ldleworkand then this reference holding entity tries to do something with the entity
23:24:23ldleworkI guess I should just not destroy things explicity
23:24:34ldleworkAnd I should have a gameplay-related field of whether the entity is still active
23:24:40ldleworkand use that for determining what to do
23:24:53ldleworkand release the reference inside of components and stuff when they realize entities are dead
23:25:03ldleworkand then just let the GC do everything
23:31:05*pregressive quit ()
23:33:20*jsudlow quit (Quit: HydraIRC -> http://www.hydrairc.com <- Now with extra fish!)
23:35:38Araq_ldlework: sounds smart ;-)
23:41:38*Matthias247 quit (Read error: Connection reset by peer)
23:42:56ldleworkwait
23:43:02ldleworktwo variants can't have the same fields?
23:43:03ldleworkwhy?
23:43:45Araq_there is an issue about it
23:43:48ldleworkoh okay
23:43:50Araq_an RFC, have a look
23:45:34ldleworkouch you said no to different types :3
23:48:53*Trustable quit (Remote host closed the connection)
23:49:43ldleworkah
23:49:45ldleworkdang
23:51:38ldleworkomg I like the solution to suggested!
23:51:48ldleworkoh wait no I don't
23:51:58ldleworkI'd like to keep all the block separate
23:52:21ldleworkIt isn't important to users of the variant types that some specific field is also the field of some other variant type
23:52:56Araq_you should do it like so anyway I think:
23:53:14Araq_ type Physics = object ...
23:53:27Araq_ type Sprites = object ...
23:53:41Araq_type Component = object
23:53:49Araq_ case kind: Whatever
23:54:07Araq_ of Whatever.Sprites: sprites: Sprites
23:54:08ldlework(it'd be cool if you could use type names like global enums...)
23:54:38Araq_in other words, you already have unique field names and some protection against duplicate field names
23:54:54Araq_so I don't see the problem for your case
23:55:01ldleworkbut there's no reason to have unique field names at all
23:55:08ldleworktwo components should be able to have .x and .y
23:55:29ldleworkthey're different discriminated types afterall
23:55:36ldleworkI can never have a value that is two different variants
23:55:40Araq_it's a.sprites.x vs a.physics.x
23:55:49Araq_what's the problem?
23:56:26ldleworkthe problem is that since they are separate types the interface for treating them exactly the same and distingusihing them when it matter (when you want to access their fields) doesn't work quite the same without object variants
23:56:49ldleworkin my case its e[DiscrminatingEnum] and I get back that variant from the entity if it exists.
23:56:58ldleworkand that variant type should have whatever fields
23:57:14ldleworkbut I see your suggestion solves the problem of overlapping fields because they are distinct types
23:57:46ldleworkthey can even be different types in that case
23:58:39ldleworkI can't believe I'm about to say this
23:59:10ldleworkBut it would be kind of cool if there was a way like in go *cringe* where I could make a list of those phyiscs and sprite types, and then discriminate them later based on their type/interface
23:59:32ldleworkI guess that's what the inheritance is like, but I can't pass around type names like they are enums
23:59:52ldleworkIE I can't be like, hey, give me the entities that contain this sequence of Types