# dsl

Dirk Hoffmann

03/14/2023, 3:15 PM
I am trying to give the "parent" block ability to implement the same closure(s) as their "child" block, but restricting to certain interfaces. I of course can give the parent an implementation which implements all interface "flavours", and still restrict the children to more specific interfaces ... everything works out, but then, DESPITE having @DslMarkers on ALL my classes, child-blocks STILL see clauses of the parent WITHOUT explicitly qualifying them (
) and I don't understand WHY. I constructed a single executable File to showcase my "problem" (at the end of the file/code)
the "problem" is even more visible, when you (uncomment) to let
itself delegate BOTH interfaces:
Copy code
IDelegationIfcSpecialAndCommon by dslClassDelegateImpl
common { name..Special {
is visible without
special { name...Common {
is also visible without
Why is this?
official docs say:
To make the compiler start controlling scopes you only have to annotate the types of all receivers used in the DSL with the same marker annotation.
which I think I did, so that:
..., the Kotlin compiler knows which implicit receivers are part of the same DSL and allows to call members of the nearest receivers only
(so why does it allow the implicit receiver of the parent
in my example code I gave?