lasp-lang / types

Prototype implementation of Conflict-free Replicated Data Types (CRDTs) in Erlang.
https://lasp-lang.org
Apache License 2.0
139 stars 13 forks source link

make type representation a tagged tupple #89

Closed ghost closed 6 years ago

ghost commented 6 years ago

for example - dot_set.erl :

Rather than :

-spec new() -> dot_set().
new() ->
   ordsets:new().

Instead do :

-spec new() -> {module(), dot_set()}.
new() ->
   {dot_set, ordsets:new()}.

This would make it easier to expose them at the web layer, rather than having to add type specific code paths, in particular I'm thinking of meta programming such as Elixir macros/protocols.

I know a change like this is crazy at this stage, but putting it out there for discussion.

For the use cases I have in mind, an alternative would be to wrap each type but that's a lot of bloat.

cmeiklejohn commented 6 years ago

All of the data types are already tagged tuples. You're looking at one of the support structures, that's not meant to be used directly.