rokucommunity / rokucommunity/brighterscript

Combine component inheritance into transpiled output

Open
#468 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

There is a performance hit whenever you use component inheritance on-device.

Add a compile-time flag that will merge child components and parent components into a single file. This reduces the performance hit for all of those components when instantiated at runtime. We could also flag certain components as "abstract", so they won't get emitted at all. (for example, the "Parent" component below could be excluded from output because it'll never be directly instantiated).

For example:

<component name="Parent">
    <script uri="common.brs" />
    <script uri="parent.brs" />
    <script>
        sub init()
            m.name = "Parent"
        end sub
    </script>
    <interface>
        <function name="CommonOperation" />
    </interface>
</component>
<component name="Child" extends="Parent">
    <script uri="common.brs" />
    <script uri="child.brs" />
    <script>
        sub init()
            m.name = "Child"
        end sub
    </script>
    <interface>
        <function name="ParentOperation" />
        <function name="CommonOperation" />
    </interface>
</component>

would transpile to:

<component name="Child">
    <script uri="common.brs" />
    <script uri="parent.brs"
    <script uri="child.brs" />
    <script>
        sub init()
            m.name = "Parent"
            m.name = "Child"
        end sub
    </script>
    <interface>
        <function name="ParentOperation" />
        <function name="CommonOperation" />
        <function name="ChildOperation" />
    </interface>
</component>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the component inheritance transpilation entry point and the handling for the Parent and Child XML examples. Define how a compile-time flag merges scripts, initialization, and interface declarations, and how abstract components are excluded. Done means inherited components emit as one runtime component with the expected ordering and abstract components are not emitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.