pjode

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

christhekeele

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

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

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement