question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Mixins(?)

See original GitHub issue

Hey @juanchosaravia, I’d like to apply @AutoDsl on classes contained within a separate Gradle/Maven module or dependency, i.e. not in the current source.

Is something this in the roadmap? Should i try patching up a PR?

For the latter please note i’ll probably have to:

  • Add an @AutoDslMixin annotation
  • Add a dependency to my kotlin-utils’ kapt module

The implementation would allow something like:

@AutoDslMixin(
      dslName = "whatever", // Default: "person"
      dslSource = Person::class)
class PersonMixin

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
manosbatsiscommented, Oct 8, 2020

Had a couple of issues with that approach:

  • Creating a class that has the target external classes as members to generate their DSL produces a wrapper layer that is hard to get rid of.
  • Creating a super class of the target to apply @AutoDsl there only works if the target class is open, while it doesn’t produce the target type anyway. Also a bit problematic in case of data classes.
  • In either case of the above there is no way for fine grained config, e.g. DSL name or collection tweaks like AutoDslCollection)
0reactions
juanchosaraviacommented, Oct 7, 2020

I’m concern of the need to create new classes to generate builders for other classes. Seems to be a lot of code just to provide support to external class that should not really be exposed in a DSL. You could easily create a class to encapsulate the internal classes that you use or any class from any library. In that case you will not need to expose that class with your DSL and then no need to apply AutoDsl to that internal class.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mixin and @include - Sass
Mixins allow you to define styles that can be re-used throughout your stylesheet. They make it easy to avoid using non-semantic classes like...
Read more >
Documentation - Mixins - TypeScript
TypeScript's best mixin support is done via the class expression pattern. You can read more about how this pattern works in JavaScript here....
Read more >
Mixins - The Modern JavaScript Tutorial
JavaScript does not support multiple inheritance, but mixins can be implemented by copying methods into prototype. We can use mixins as a way...
Read more >
Sass @mixin and @include - W3Schools
The @mixin directive lets you create CSS code that is to be reused throughout the website. The @include directive is created to let...
Read more >
Mixin - Wikipedia
In object-oriented programming languages, a mixin (or mix-in) is a class that contains ... or to work around lack of support for multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found