-
Notifications
You must be signed in to change notification settings - Fork 139
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
[proposal] Want dry-struct compiler #1210
Comments
Thanks for writing the compiler for We only include DSL compilers for a few core gems that we use at Shopify inside Tapioca at this time. Our plan is to extract them, when appropriate, to the gems that they are modelling at some point in the future. For that reason, we are not accepting DSL compiler contributions, since we won't be able to support them. However, Tapioca is smart enough to load any Ruby file under the Finally, you are correct, we should make this more clear in our contribution guidelines. |
@YukiJikumaru I like the idea of adding the compiler to |
Thanks for working on this @YukiJikumaru. I would say having |
YES! I want |
Sorry, what I meant is that it feels like tapioca compilers extend tapioca's functionality, so in case of dry-struct, you'd have something like WDYT? |
That is very fair @solnic and as an OSS maintainer myself I can see your angle. I'd probably need to do something similar for Faraday as well as we do use quite a lot of metaprogramming 😅. Bundling tapioca compilers inside gems will avoid the situation where I do see the issue of the maintenance burden though, and I don't really have a good solution for that in mind. Finally, a super-wild thought: an alternative solution would be to have separate gems with some sort of convention (e.g. |
@solnic I understand your approach and respect it. However, I think I can make an argument as to why, to me, at least, it seems appropriate that Tapioca compilers should be a part of the respective gem they model. It is indeed the case that Tapioca DSL compilers extend the functionality of Tapioca. However, they do that to represent the DSL added methods in an application by the DSL patterns from the gem in question. So, in that sense, they model the behaviour of the gem more than the behaviour of Tapioca or anything else. The DSL compiler code is just a glorified way to encode that behaviour in a manner that Tapioca can understand and generate the correct artefacts for. This is not that different from a gem exporting a Rails or a Hanami generator to make their functionality available to application authors. The generator code would indeed be extending Rails/Hanami, but the functionality would belong to the gem. I view this as being very similar. Another analogous case is gems exporting Rake tasks, which are also extending Rake functionality, but are happily used by many gem authors. Finally, (as @iMacTia is also saying above), we've seen instances where an upstream gem changed how they model the DSL generation, and thus break some of the compilers bundled with Tapioca. If the compiler was a part of the gem, and tested along with it, it would not have broken as such and that is the best developer experience possible. Before I sign off, I would like to just add my talk from RubyKaigi 2021 where I was talking about how what Tapioca is doing leads to better analysis and understanding of our applications, that I think is relevant: https://www.youtube.com/watch?v=Ms7_PrryvMM If you have 30 mins to watch, I think my points above could make more sense. In summary, I respect your opinion as a gem author that you might not want to get that (development, btw, never runtime) dependency on Tapioca for your gems. It is perfectly reasonable to package them as |
Thank you! After reconsidering, I thought As recommendations for naming gems by https://guides.rubygems.org/name-your-gem/ .
|
There is still a lot of discussion and there may be major changes, I have released the alpha version. |
Yeah I can see that now. Thanks for sharing your thoughts and insights. I'll talk to the rest of the team about this after we're done with Hanami 2.0 release. Supporting Sorbet OOTB would be really nice. I just want to be sure that if we decide to do it as part of the gem codebases, then it will actually be maintained 😅 |
I'm using dry-rb which defining typed struct classes, authored by @solnic.
Nowadays we can use T::Struct to define typed struct classes, but my project have massive dry-rb structs and T::Struct is not fully compatible with dry-rb.
Therefore I need rbi files for dry-structs, and I wrote a dsl compiler
lib/tapioca/dsl/compilers/dry_struct.rb
.YukiJikumaru/tapioca
I wan to know 2 points.
A new dsl compiler is wellcome to tapioca? And you have any contribution guidelines?
The text was updated successfully, but these errors were encountered: