Skip to content

Support for type declarations and Intersection types #1330

@markwpearce

Description

@markwpearce

It would be nice be able to support "mixins" to interfaces...

Basically, some way of being able to say this interface is composed of these other interfaces:

Eg. source/mixins/alpha.bs:

interface AlphaM
   alpha as boolean
end interface

sub initAlpha()
   m.alpha = true
end sub

components/MyComponent.xml

<component name="MyComponent" extends="Group">
    <script type="text/brightscript" uri="pkg:/source/mixins/alpha.bs" />
    <interface>
       <field id="text" type="string" />
    </interface>
</component>

components/MyComponent.bs

typecast m as MyComponentM

interface MyComponentM
   top as roSGNodeMyComponent
   include AlphaM ' not married to this syntax, but this is the magic
end interface

sub init()
   initAlpha()
  print m.alpha ' this is known to be a boolean
end sub

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions