00:00:46 | Araq_ | I actually simplified this example without running it through the compiler |
00:00:51 | Araq_ | that's what I get. |
00:00:55 | Araq_ | 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:31 | bozaloshtsh | so 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:14 | bozaloshtsh | meaning 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:04 | dom96 | bozaloshtsh: I don't think that's supported at the minute I'm afraid |
00:54:15 | dom96 | bozaloshtsh: please create an issue on github and i'll see what I can do :) |
00:54:24 | dom96 | good night |
00:57:42 | Araq_ | why would you want that? |
01:07:36 | bozaloshtsh | my 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:52 | Araq_ | 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:54 | ldlework | Is there a way to do ... partial object variants? |
01:25:05 | ldlework | Like... what if I want to add a variant to some library variant or something |
01:25:34 | ldlework | Araq_: I was thinking this might be another way to do components |
01:25:53 | ldlework | Since now you can treat all these variant types as the same type with regards to book-keeping |
01:25:59 | ldlework | and then later discriminate meaningfully in gameplay code |
01:26:23 | Araq_ | yeah you guys always want to distribute types over compilation units |
01:26:27 | ldlework | But if you have to deifne all the component variants in the single block... |
01:26:36 | ldlework | Araq_: hehe |
01:27:42 | Araq_ | and eventually we will indeed get something like that, as I said. |
01:28:25 | ldlework | Araq_: I suppose for now I could write a macro to pool variant partials ... :D |
01:28:33 | ldlework | and then emit the unified partial |
01:28:46 | Araq_ | yeah, well it's not like the compiler can do much more than that |
01:28:52 | ldlework | Sure |
01:29:24 | ldlework | Yeah not sure how it would distinguish between a redefinition in error, or a variant addendum |
01:30:01 | Araq_ | do you know about C#'s partial classes? |
01:30:17 | ldlework | yep |
01:30:19 | Araq_ | would that be good enough? |
01:30:43 | ldlework | if you adapated that to object variant definitions I suppose |
01:30:49 | ldlework | I dunno |
01:31:03 | ldlework | I'm such a child in this type safe world I don't know what's possible! |
01:32:03 | Araq_ | wait ... why do you use object variants? |
01:34:53 | ldlework | Well 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:27 | ldlework | Like 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:47 | ldlework | If 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:04 | ldlework | All without having to care at all that each component is basically a totally disjoint type |
01:36:31 | ldlework | until 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:52 | ldlework | So instead of building a huge unified type |
01:36:58 | ldlework | You are really doing composition again.. |
01:37:10 | ldlework | argh I'm so far down this unified approach but this makes some sense.. |
01:38:29 | ldlework | fuck I've basically reinvented partial classes |
01:39:34 | ldlework | Actually really cool flexible version of partial classes but still |
01:39:53 | Araq_ | dunno - sounds wrong to me. why would position and e.g. velocity share a common type? |
01:40:31 | ldlework | Because of their role in being dynamically composed together at run time? |
01:40:43 | ldlework | If they were different types you couldn't treat components homogenously |
01:41:24 | ldlework | you couldn't map those variants to strings |
01:41:33 | Araq_ | yeah. I don't want homogenously. |
01:41:34 | ldlework | and then compose a novel type at runtime with json data |
01:41:49 | ldlework | by just saying, "make a thing that has a position and velocity" |
01:41:57 | ldlework | or "make a different thing that has position and a sprite" |
01:41:59 | ldlework | and so on |
01:42:15 | ldlework | Araq_: I mean isn't that basically what algebraic types are? |
01:42:30 | ldlework | Being able to treat some different types as the same type |
01:42:39 | Araq_ | no, you want to compose your type at runtime. which is stupid. |
01:42:59 | ldlework | why? |
01:43:06 | Araq_ | because then it's strictly speaking not even a type anymore. |
01:43:20 | ldlework | Well sure, I don't really want a type |
01:43:32 | ldlework | I want a model of some agent that has arbitrary behaviors |
01:43:37 | Araq_ | you might as well use JSON everywhere then. |
01:43:53 | ldlework | Why? My tilemaps and renderer and UI and so on, are all implemented traditionally |
01:44:52 | Araq_ | so you only need a mapping from JSON to T and from T to JSON. that's easy enough to do. |
01:45:45 | ldlework | No it isn't serialization/marshalling |
01:46:25 | ldlework | I 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:13 | ldlework | (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:40 | Araq_ | no, it's not obvious that all that needs to be done at runtime |
01:50:17 | ldlework | Araq_: what if I wanna write the metaverse |
01:50:30 | ldlework | and so novel entities should be able to be designed and instantly usable at runtime ? :D |
01:50:58 | ldlework | many game engines support doing this. And its by way of generating every possible type for every possible behavior component. |
01:51:17 | ldlework | its not* |
01:52:06 | Araq_ | yes but many game engines are scriptable with Lua, for example. |
01:52:13 | ldlework | Araq_: are you alluding to just making a class that can do potentially everything that your system supports? |
01:52:35 | Araq_ | where it's dead easy to have objects/tables that consist of predefined components |
01:52:40 | ldlework | Sure but you end up just doing the same thing but in lua |
01:53:15 | Araq_ | 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:34 | Xe | how 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:14 | mountaingoat | any 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:17 | Araq_ | take a look at the Python wrapper |
10:22:25 | Araq_ | I forgot how it needs to be done. |
10:22:44 | Araq_ | better yet: use a library that is not insane. |
10:23:14 | mountaingoat | will do, thanks |
10:23:18 | coffeepot | i'm just looking at https://github.com/jboy/nim-pymod |
10:23:23 | mountaingoat | unfortunately 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:35 | matkuki | Hi guys. |
11:49:35 | * | vendethiel quit (Ping timeout: 240 seconds) |
11:49:36 | matkuki | Is there a large overhead in using MainObject vs Myobject? https://bpaste.net/show/1fde6072dc02 |
11:51:20 | * | vendethiel joined #nim |
11:52:21 | reactormonk | matkuki, depends on the C compiler. I'd go for version 2 and simply with SubObject, less DRY. |
11:55:01 | matkuki | reactormonk: Thanks. What do you mean with 'simply with SubObject'? |
11:55:30 | reactormonk | matkuki, they don't seem to have any different attributes for now |
11:57:07 | matkuki | reactormonk: oh, thanks |
11:57:44 | reactormonk | matkuki, you could go MainObject: attx: SubObject etc. |
11:58:29 | reactormonk | matkuki, but honestly, compiler optimization is tricky business. I'd try both versions and see what happens. |
12:01:30 | matkuki | I'm using mingw64. Will try it, thanks. |
12:01:51 | * | vangroan_ joined #nim |
12:05:26 | * | vangroan quit (Ping timeout: 272 seconds) |
12:06:41 | Araq_ | matkuki: MainObject has no overhead. |
12:08:20 | matkuki | Araq_: Great! Thanks. I've a game object with a ton of physics attributes, so it's a little more managable that way. |
12:11:11 | Arrrr | How many |
12:11:56 | * | vendethiel quit (Ping timeout: 276 seconds) |
12:17:21 | matkuki | Arrrr: about 40 |
12:19:55 | * | vendethiel joined #nim |
12:24:46 | * | joelmo joined #nim |
12:26:56 | * | vangroan__ joined #nim |
12:30:17 | Arrrr | I don't think that's too many |
12:30:17 | * | vangroan_ quit (Ping timeout: 255 seconds) |
12:30:51 | Arrrr | But 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:48 | cnu- | 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:52 | dom96 | cnu-: 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:47 | cnu- | dom96, i wanted to make "reload configuration" where the new configuration could have different listeners |
13:36:49 | dom96 | cnu-: sorry, i'm not sure I understand the reason for cancelling 'await server.accept' in that use case, could you elaborate? |
13:37:53 | cnu- | dom96, are you familiar with nginx? |
13:38:05 | dom96 | sure |
13:39:38 | cnu- | 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:43 | cnu- | 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:11 | algun | wat is dis? |
16:53:41 | * | minmax quit (Quit: Page closed) |
16:54:00 | ephja | algun: roughly what it says in the topic :-) |
16:54:34 | algun | JavaScript is a PL too |
16:55:42 | algun | ephja so like js? |
16:56:17 | * | vendethiel joined #nim |
16:58:01 | ephja | algun: it's statically typed and has both high and low level features |
16:58:26 | algun | so like c++? |
16:59:18 | ephja | yes, it's more similar to C++ |
16:59:46 | ephja | speaking of JS, it's possible to generate JS code |
17:00:17 | algun | mate ive gotta tell you youre not selling this thing |
17:01:34 | algun | perhaps 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:34 | ephja | algun: 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:29 | algun | ephja: 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:50 | algun | so perhaps try selling me nims meraprogramming? |
17:22:00 | * | ggVGc joined #nim |
17:23:13 | * | brson joined #nim |
17:29:08 | algun | setting 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:23 | algun | oops 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:38 | Araq_ | algun: well not everybody believes in the C+high-level-language combination. |
18:08:43 | Araq_ | 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:59 | ephja | Araq_: 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:26 | ephja | probably, and then report it |
19:50:36 | * | xtagon joined #nim |
19:54:29 | Araq_ | not sure. |
19:54:48 | Araq_ | 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:17 | ldlework | Is it possible to define `in` for Table? |
20:50:15 | * | meh quit (Quit: Page closed) |
20:52:14 | ldlework | guess so |
20:52:16 | ldlework | neat |
20:52:53 | ldlework | should add this to the tables module: |
20:52:55 | ldlework | proc `in`[K, V](t: Table[K, V], kind: K): bool = t.hasKey(kind) |
20:52:59 | flyx | ldlework: usually, you'll use on of `in table.keys()`, `in table.values()` or `in table.pairs()` |
20:53:14 | ldlework | ah well |
20:53:24 | * | jsudlow quit (*.net *.split) |
20:53:36 | ldlework | flyx: does that construct a new sequence? |
20:53:49 | flyx | newSeq[T]() |
20:53:50 | ldlework | I wonder if calling hasKey is more efficient than in .keys() |
20:54:09 | flyx | ah, misread |
20:56:08 | * | derka quit (Quit: derka) |
20:56:13 | flyx | I actually don't know how it works, it was more of a guess |
20:57:02 | ldlework | sure |
21:03:18 | Araq_ | no, 'in' is **always** an alias for 'contains' |
21:03:26 | Araq_ | you need to give table a 'contains' |
21:03:29 | ldlework | oh okay |
21:03:31 | ldlework | thanks Araq_ |
21:03:36 | Araq_ | but it should already have one? |
21:03:48 | Araq_ | this thing has like 4 trillion procs |
21:04:13 | ldlework | yeah I guess it does |
21:04:17 | ldlework | I was looking for `in` |
21:04:19 | ldlework | thanks |
21:04:55 | * | bozaloshtsh joined #nim |
21:05:39 | ldlework | Araq_: how do you express 'not in' |
21:05:52 | Araq_ | without the space |
21:05:53 | ldlework | is it `if not (a in b):` or `if a not in b` |
21:05:55 | Araq_ | foo notin bar |
21:05:56 | ldlework | oh |
21:05:59 | ldlework | huh |
21:06:00 | ldlework | ok |
21:06:09 | Araq_ | parser restriction :P |
21:07:18 | ldlework | hehe |
21:11:42 | ldlework | Why isn't this working? https://gist.github.com/dustinlacewell/4e59cf4cfe2fdd403190 |
21:20:30 | ldlework | Araq_: is there any sensible way to echo an object variant? |
21:24:30 | Araq_ | sure but the default $ for object cases doesn't work. |
21:30:16 | ldlework | Araq_: which means you need to build a single `$` for your base variant type that covers all cases |
21:30:36 | Araq_ | getType ftw |
21:30:50 | ldlework | I dunno what you're insinuating |
21:32:31 | ldlework | Araq_: can I use fieldpairs on variants? |
21:36:07 | ldlework | Also any idea why the linked gist doesn't work? |
21:37:08 | def- | ldlework: components parameter needs to be var |
21:37:48 | ldlework | why? |
21:37:55 | ldlework | shouldn't it be pure? |
21:38:13 | ldlework | I mean entity gets mutated... |
21:38:53 | ldlework | def-: that didn't fix it |
21:39:01 | ldlework | same error |
21:41:18 | def- | ldlework: your proc also needs "(c: var Component)" |
21:41:36 | def- | but i'm just guessing from the error, would help if your code was self-contained |
21:42:42 | def- | now that I look at it, I'm not sure why you're even use map, why not a for loop? |
21:43:02 | ldlework | def-: because I wanted to be fancy |
21:43:06 | ldlework | why the hell does it have to be var? |
21:44:05 | def- | because "map" is for mutating the elements of a datastructure or creating a new one based on the elements of another one |
21:44:18 | ldlework | Right creating a new one |
21:44:25 | ldlework | means you don't need to mutate it |
21:44:41 | def- | so what is entity.addComponent(c) returning? |
21:44:49 | ldlework | nothing |
21:44:52 | ldlework | maybe that's why |
21:45:19 | ldlework | Well it seems that you cannot use fieldpairs on an object variant |
21:45:41 | def- | for c in components: entity.addComponent(c) |
21:46:28 | def- | And yes, if addComponent returns nothing, then it doesn't fit the op parameter of the second map |
21:46:56 | ldlework | def-: yeah you were right |
21:46:59 | ldlework | I switch to forloop anyway |
21:47:01 | def- | and even if it returned something, you'd have to discard the end result |
21:47:05 | ldlework | right |
21:47:11 | def- | and you'd be building up some data structure that you don't need |
21:47:15 | def- | so yes, for loop is better :) |
21:47:27 | ldlework | def-: check this out, https://gist.github.com/dustinlacewell/f485c053e4f297bdb12a |
21:48:03 | * | jsudlow joined #nim |
21:49:19 | def- | ldlework: fieldPairs(x[]) |
21:49:26 | ldlework | interesting |
21:50:33 | def- | btw, you might want to use result.add(")") instead of result = result & ")" |
21:50:49 | ldlework | hmm yeah |
21:51:18 | ldlework | I wonder why components are not getting added |
21:51:23 | ldlework | everything says false at the end |
21:52:03 | ldlework | def-: https://gist.github.com/dustinlacewell/f485c053e4f297bdb12a |
21:52:19 | ldlework | oops |
21:52:21 | ldlework | don't look! |
21:52:23 | * | ldlework blushes |
21:53:45 | * | brson joined #nim |
21:54:06 | ldlework | yay |
21:54:20 | ldlework | the world's simpilest type-safe ECS ! |
21:54:23 | ldlework | hahaha |
21:54:34 | ldlework | so awesome |
21:54:39 | ldlework | no macros either! |
21:55:14 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:56:10 | ldlework | but 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:49 | ldlework | def-: thanks for your help |
21:59:13 | def- | ldlework: you're welcome, great that it works |
22:03:48 | * | strcmp1 joined #nim |
22:04:30 | ldlework | def-: 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:40 | def- | ldlework: just don't use distinct? |
22:06:50 | ldlework | hmm I wasn't |
22:07:14 | def- | then they should be available, shouldn't they? |
22:07:28 | ephja | yes |
22:07:59 | * | awsteele joined #nim |
22:08:38 | * | derka joined #nim |
22:09:13 | ldlework | that worked yeah |
22:09:15 | ldlework | thanks |
22:10:44 | * | bjz joined #nim |
22:13:23 | * | derka quit (Ping timeout: 264 seconds) |
22:13:31 | ldlework | def-: why the indentation error? https://gist.github.com/dustinlacewell/afcbceb24d56c5b08687 |
22:14:08 | ldlework | oh alias is a keyword |
22:14:40 | ldlework | nope that wasn't it... |
22:14:41 | Araq_ | no |
22:14:43 | Araq_ | case kind: |
22:14:49 | Araq_ | <-- type missing |
22:15:30 | ldlework | oh thanks |
22:16:31 | ldlework | Araq_: partial variants would be a really cool first class feature |
22:16:52 | ldlework | no idea how you'd express it though |
22:16:55 | Araq_ | create a spec for them |
22:17:09 | ldlework | hmm interesting |
22:17:31 | Araq_ | like I said, we need some prepass over types so that people can continue to write their misdesigns (hi yuri!) |
22:17:59 | Araq_ | and a prepass is a prepass. it can collect "partial variants" too, whatever that means. |
22:17:59 | ldlework | hehe, what are they doing |
22:18:03 | ldlework | right |
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:17 | ldlework | Araq_: hmm, I could just object inheritance huh |
22:30:52 | ldlework | Component = object of RootObj |
22:30:54 | ldlework | CVisible = object of Component |
22:30:59 | ldlework | game over? |
22:31:42 | ldlework | ah nope |
22:31:48 | ldlework | if I define something to take a Component |
22:31:55 | ldlework | and I pass it a CVisible it complains I didn't pass it a Component |
22:32:34 | ldlework | oh well variants are cool |
22:33:41 | def- | t |
22:34:42 | ldlework | ? |
22:36:27 | def- | ldlework: works for me: https://gist.github.com/def-/aa8f2d2793d800920df6 |
22:37:09 | ldlework | def-: but you could never access .name right |
22:37:58 | def- | inside of test? not directly, no |
22:38:09 | ldlework | with object variants you can |
22:38:19 | ldlework | you have to discriminate, but that's okay |
22:39:42 | def- | you can discriminate with inheritance as well, updated the example |
22:39:48 | * | strcmp1 quit (Quit: peace) |
22:40:00 | ldlework | oh neat |
22:40:10 | ldlework | is there a case version of that? |
22:40:18 | ldlework | so all subclasses have to be covered maybe? |
22:40:25 | ldlework | don't need that just curious |
22:40:42 | ldlework | its kinda too bad that you have to rebind |
22:41:16 | ldlework | I wonder if the compiler could be made to consider x a Dog in the scope of the discrimination |
22:41:28 | def- | well, you could write a macro to do that |
22:42:49 | ldlework | eh |
22:43:51 | ldlework | Araq_: what do you think about that |
22:44:25 | def- | a case version might not even be possible here because you could introduce new subtypes in other files |
22:45:25 | Araq_ | what def- said |
22:45:45 | Araq_ | oh def- how did you generate the makefile for csources? |
22:45:54 | Araq_ | got some bug report about that |
22:46:12 | ldlework | Okay I think I'll stick with variant-partials then |
22:47:54 | def- | Araq_: tools/niminst/makefile.tmpl, which I manually translated from the buildsh template |
22:48:29 | Araq_ | ok, so it should actually update it automatically |
22:51:18 | def- | ldlework: now with a simple template |
22:53:18 | ldlework | def-: 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:55 | def- | 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:42 | ldlework | that is, without writing a specific proc for each subclass |
22:55:00 | def- | ldlework: hm, my template hack is probably ugly |
22:57:04 | def- | ldlework: updated with that proc |
22:57:12 | * | gokr quit (Quit: Leaving.) |
22:57:33 | ldlework | def-: right, without having a proc for each subclass :P |
22:58:03 | ldlework | What's nice about the variants is that they already require some kind of enumeration to couple to the variant |
22:58:15 | ldlework | so you can pass a list of enums as a natural interface for gathering specific variants |
22:58:58 | ldlework | But I suppose you will now write a template |
22:59:00 | def- | ldlework: updated |
22:59:00 | ldlework | :D |
22:59:02 | ldlework | haha |
22:59:11 | def- | no, generics are good enough |
22:59:12 | ldlework | that's awesome |
22:59:51 | ldlework | def-: "with x as T" syntax would be badass |
23:00:03 | def- | don't understand |
23:00:21 | ldlework | for using x as a T |
23:00:32 | ldlework | like when you discriminate in test |
23:00:55 | ldlework | def-: also, is there a way to take multiple sub types? |
23:01:18 | ldlework | to get a list of animals consisting of Dogs and Cats but not Elephants or Birds? |
23:01:38 | ldlework | I doubt there is an openarray for generic parameters |
23:02:29 | ldlework | I 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:42 | def- | ldlework: don't see a simple way, you can do it at runtime or with more advanced templates/macros |
23:13:44 | ldlework | It seems like when using the `%` macro to do string interpolation, that it should run each item in the array through $ |
23:14:03 | ldlework | echo "$1, $2" % [$(e[EPosition].x), $(e[EPosition].y)] |
23:14:21 | def- | ldlework: use format |
23:14:30 | def- | it applies $ automatically |
23:14:56 | ldlework | doh, lol why doesn't % do that? |
23:19:10 | ldlework | def-: do you know if Nim supports weakrefs? |
23:20:10 | def- | google finds this: http://forum.nim-lang.org/t/45 |
23:21:15 | ldlework | yeah reading that now |
23:23:23 | ldlework | I guess I'm just worried |
23:23:35 | ldlework | If an entity has a component that holds a reference to some other entity |
23:23:44 | ldlework | or some other component maybe |
23:23:53 | ldlework | and then that target is destroyed |
23:24:07 | ldlework | and then this reference holding entity tries to do something with the entity |
23:24:23 | ldlework | I guess I should just not destroy things explicity |
23:24:34 | ldlework | And I should have a gameplay-related field of whether the entity is still active |
23:24:40 | ldlework | and use that for determining what to do |
23:24:53 | ldlework | and release the reference inside of components and stuff when they realize entities are dead |
23:25:03 | ldlework | and 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:38 | Araq_ | ldlework: sounds smart ;-) |
23:41:38 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:42:56 | ldlework | wait |
23:43:02 | ldlework | two variants can't have the same fields? |
23:43:03 | ldlework | why? |
23:43:45 | Araq_ | there is an issue about it |
23:43:48 | ldlework | oh okay |
23:43:50 | Araq_ | an RFC, have a look |
23:45:34 | ldlework | ouch you said no to different types :3 |
23:48:53 | * | Trustable quit (Remote host closed the connection) |
23:49:43 | ldlework | ah |
23:49:45 | ldlework | dang |
23:51:38 | ldlework | omg I like the solution to suggested! |
23:51:48 | ldlework | oh wait no I don't |
23:51:58 | ldlework | I'd like to keep all the block separate |
23:52:21 | ldlework | It isn't important to users of the variant types that some specific field is also the field of some other variant type |
23:52:56 | Araq_ | you should do it like so anyway I think: |
23:53:14 | Araq_ | type Physics = object ... |
23:53:27 | Araq_ | type Sprites = object ... |
23:53:41 | Araq_ | type Component = object |
23:53:49 | Araq_ | case kind: Whatever |
23:54:07 | Araq_ | of Whatever.Sprites: sprites: Sprites |
23:54:08 | ldlework | (it'd be cool if you could use type names like global enums...) |
23:54:38 | Araq_ | in other words, you already have unique field names and some protection against duplicate field names |
23:54:54 | Araq_ | so I don't see the problem for your case |
23:55:01 | ldlework | but there's no reason to have unique field names at all |
23:55:08 | ldlework | two components should be able to have .x and .y |
23:55:29 | ldlework | they're different discriminated types afterall |
23:55:36 | ldlework | I can never have a value that is two different variants |
23:55:40 | Araq_ | it's a.sprites.x vs a.physics.x |
23:55:49 | Araq_ | what's the problem? |
23:56:26 | ldlework | the 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:49 | ldlework | in my case its e[DiscrminatingEnum] and I get back that variant from the entity if it exists. |
23:56:58 | ldlework | and that variant type should have whatever fields |
23:57:14 | ldlework | but I see your suggestion solves the problem of overlapping fields because they are distinct types |
23:57:46 | ldlework | they can even be different types in that case |
23:58:39 | ldlework | I can't believe I'm about to say this |
23:59:10 | ldlework | But 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:32 | ldlework | I guess that's what the inheritance is like, but I can't pass around type names like they are enums |
23:59:52 | ldlework | IE I can't be like, hey, give me the entities that contain this sequence of Types |