pjode
Why do components only allow primitive values
I’m interested in a technical reason why a component in ECSx only allows for primitive values like float, atoms, etc and not something like structs or tuples. For example, rather than a PositionX and PositionY as separate components, instead have a Position component that stores both x and y coords. I feel like there’s a technical reason like something to do with how ETS works or something but I couldn’t find anything in the code, docs, or blog post that gave a clue and it’s piquing my curiosity.
Most Liked Responses
christhekeele
My guess, based on the original stated goals of the project:
- Type-checking for all component data
Supporting compound product data types like structs would mean ECSx has to build or bring a much more involved Ecto-schema style solution for component structure definition, coercion, and validation.
Nothing I know about ECSx’s implementation or how ETS works suggests to me that this is impossible: but I’d imagine it’s not a priority for the framework devs.
pjode
Thanks! I must’ve missed that issue in my searching. I wasn’t suggesting that as a feature, more for my own learning so I appreciate the answer
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #podcasts
- #code-sync
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








