Comments (9)
Okay. Let’s think about an example.
StairAscender
StairDescender
Compose into StairTraverser. That’s an additive composition.
For And and Or compositions I can’t think of an example off the top of my head. Both I think would require the two composited facets to take the same command though. An And/Or that takes different facets doesn’t make sense to me.
from amethyst.
from amethyst.
would the API be facet.compose(otherFacet)
Or would it be better to have a CompositeFacet class that is a facet and has a constructor that takes two facets?
from amethyst.
I'd do this similar to how Behavior
s are composed now. The reason for this is that we can take advantage of operator overloading and we can also define boolean operations like facet0 + facet1
facet0 or facet1
, things like that.
from amethyst.
Okay. So basically. If I’m going to implement this look at how behavior composition works.
from amethyst.
That's a good idea, yes. But first let's think about the kinds of compositions we might want to implement. +
can be used to compose but what about and
and or
? Do you think that would make sense here?
from amethyst.
So StairAscender
takes GoUp
and StairDescender
takes GoDown
so StairTraverser
takes both GoUp
and GoDown
so it is an additive composition. Job well done, we can go home, right? 😄
from amethyst.
Yeah. I mean sure. My question was, is there a case where we’d want and/or style composition . What would that be useful for if anything?
from amethyst.
or
/and
I think is not really meaningful here. We have it with Behavior
s and it is useful because they return a Boolean
value so we can determine whether it performed an action or not. or
short-circuits so if the first Behavior
returns true
the second is not run at all.
With Facet
s this is a bit more fuzzy because each Facet
responds to a single Command
so the composite Facet
we get with +
is just doing dynamic dispatch. As a corollary the or
/and
overloads seem useless here because if we have a Command
we already know which Facet
responds to that so there is no point in short-circuiting.
from amethyst.
Related Issues (5)
- Have some method of creating global systems that can work on collections of entities with attributes HOT 1
- Actions aren't really attributes in Caves of Zircon, they're a code smell which means something may be missing HOT 3
- ProcessorsExample.kt types leak into final artifact HOT 2
- Support for IR compiler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amethyst.