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

feat: add type parameters #34

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fahchen
Copy link

@fahchen fahchen commented Sep 19, 2022

related pr #28

@flupke flupke mentioned this pull request Sep 23, 2022
Copy link

@flupke flupke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with just a few naming nits. Thanks for showing me how it's done :)

(note: I'm not a maintainer, just commenting)

Comment on lines 180 to 181
# A arg named :int
arg :int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# A arg named :int
arg :int
# A type parameter named int
arg :int

README.md Outdated
use TypedStruct

typedstruct do
arg :state
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I would call it parameter:

  • to match the style of field and plugin, which are not abbreviated
  • to match the documentation, which talks about "parameterized types"

end

def __arg__(name, _env) do
raise ArgumentError, "a arg name must be an atom, got #{inspect(name)}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ArgumentError, "a arg name must be an atom, got #{inspect(name)}"
raise ArgumentError, "a parameter name must be an atom, got #{inspect(name)}"

@@ -155,6 +172,22 @@ defmodule TypedStruct do
end
end

@doc """
Defines a argument for a typed struct.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Defines a argument for a typed struct.
Defines a type parameter for a typed struct.

@ejpcmac
Copy link
Owner

ejpcmac commented Sep 23, 2022

Hello, thank you for your PR! @flupke, I’ve also read your comments on the other PR, sorry that both of you have worked on the same subject.

I’m still quite loaded on non-OSS personal duties this week, and not available this week-end, but I will review it next week, along with other pending PRs.

As stated in the CONTRIBUTING.md, work should be based and merged back to develop. Could you then just rebase your PR on top of develop and re-target it to develop? It will run the CI as well, as it is enabled only for PRs to develop.

Note that I have disabled Elixir 1.14 from the CI as of now, as there is a bug in Elixir 1.14.0 breaking typed_struct, which will be fixed in the next Elixir release.

@fahchen fahchen force-pushed the feat/fahchen/parameterized-types branch from 2a33f4f to b31b509 Compare September 24, 2022 05:50
@fahchen fahchen changed the base branch from main to develop September 24, 2022 05:50
@fahchen
Copy link
Author

fahchen commented Sep 24, 2022

@flupke Thanks for your suggestions that makes sense.

@ejpcmac Thanks for your reply, and I’ve updated the PR according to the CONTRIBUTING.

@ejpcmac ejpcmac added this to the 0.3.1 milestone Oct 5, 2022
@sethcalebweeks
Copy link

This is an awesome package that saves me a ton of boilerplate. Thanks @ejpcmac! Unfortunately, I really need parameterized types. Is this still being considered, or am I better off forking/creating a plugin? Thanks!

@ejpcmac ejpcmac added the T:Feature Type: Feature label Dec 29, 2023
@fahchen
Copy link
Author

fahchen commented Jul 5, 2024

I am extremely grateful to @ejpcmac for providing this package, which has performed excellently in my projects. However, it lacked some features I needed, and it appeared that the repo was not being maintained actively. I rewrite this package with some new functionalities, including those introduced in this PR. For those interested in these enhancements, you are welcome to visit https://github.com/elixir-typed-structor/typed_structor or https://hexdocs.pm/typed_structor/readme.html. Once again, many thanks to @ejpcmac .

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

Successfully merging this pull request may close these issues.

4 participants