Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Elixir core? #5

Open
arnodirlam opened this issue Aug 21, 2018 · 5 comments
Open

Port to Elixir core? #5

arnodirlam opened this issue Aug 21, 2018 · 5 comments
Labels
T:Question Type: Question

Comments

@arnodirlam
Copy link

Hi there,
we've been working with TypedStruct a lot recently, and it's really nice.
I think that it makes Elixir type system much more approachable, and is also in line with the increased priority on Dialyzer in the Elixir core team. If there's interest, there would probably also be more options syntax-wise, so maybe (!) it could be made even better..

Did you already suggest porting its functionality to Elixir core? If no, would you be fine if I do it, or prefer to do it yourself? Either way, I think it'd be a great contribution :)

@ejpcmac
Copy link
Owner

ejpcmac commented Aug 21, 2018

Hi @arnodirlam,

Thank you very much for your feedback :) I don’t have made any proposals to Elixir core yet, so feel free to do it. I’ll be glad to help if needed.

@ejpcmac ejpcmac added the T:Question Type: Question label Oct 30, 2018
@toraritte
Copy link

toraritte commented Jan 3, 2019

Merging typed_struct with Ecto.Schema would be awesome as the latter does not generate a type when setting up a schema. As Michał Muskała points it out on Elixir Forum, "While it would be rather easy to generate a spec for a schema with built-in types, it’s not as easy to generate one when you start using custom types".

Although custom types should use the Ecto.Type behaviour, so maybe it would be possible to bake this into them?

@ejpcmac
Copy link
Owner

ejpcmac commented Jan 4, 2019

Hi @toraritte! As I’ve stated in #9, I don’t want to make typed_struct a monolith. I plan to provide a plugin API in v0.2 for third-party developers to be able to provide their own libraries integrations. I have been quite busy these past weeks and need some more time to get back on track for new dev projects, but I will definitely tackle this subject on one week-end in the months to come.

@toraritte
Copy link

I guess I missed #9 , will look into it. There is no rush on my part, and I know that you probably only have time maintaining this repo in your free time. Thanks @ejpcmac for the reply and thank you especially for this fine tool!

@foucist
Copy link

foucist commented Dec 8, 2022

What would the DSL look like if it was made for elixir core? Would it be less ecto-style?

  @typedoc "A person"
  deftypestruct name: [String.t(), enforce: true],
                age: non_neg_integer(),
                happy?: [boolean(), default: true],
                phone: String.t()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:Question Type: Question
Projects
Status: Backlog
Development

No branches or pull requests

4 participants