rokucommunity / rokucommunity/brighterscript
Support for declaring all roku types in typedefs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 68
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 39
Description
We should have a way to declare all (or almost all) built-in roku types in typedefs. This would provide several benefits:
- more flexibility for contributors wanting to improve the documentation on the native types
- more options for separating certain features into different libraries (like brightscript, brightsign, maybe future versions of brightscript with new features)
- enables developers to use that same syntax to declare objects in their own code that might not be public knowledge (i.e. internal roku projects, select partners, etc).
I envision we move all of the built-in types and objects and components and interfaces into a single folder (maybe libs/brightscript.d.bs, and here is the syntax I'm currently envisioning.
-
the native interfaces can probably just use the existing
interface keywordinterface ifDateTime sub ToLocalTime() as Void ...etc end interface -
"brightscript components" use the
objectkeyword". We need a way to "spread" all of the functions of an interface onto the object. Maybe that's how "implements" works forobject, or maybe we have some extra syntax to say "I'm not going to write them again, just copy them onto this thing".object roDateTime implements ifDateTime, ifToStr 'objects can also have concrete methods declare on them, if you want to make an interface for them function someNonInteraceFunc() as integer end object -
components would use the
componentkeyword (like the component statement syntax mentioned in #575)component "Rectangle" extends "Group" 'callfuncs public getBoundingRect() as roAssociativeArray 'fields public someField as roAssociativeArray end component -
Declaring these items with the
declarekeyword in a d.bs file might allow them to be exposed globally to the program. Like this:declare function abs(num) as number
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed declarations in a possible libs/brightscript.d.bs file and the component statement syntax referenced in #575. Determine how interfaces, objects, components, and declare would fit together, then define a testable scope for built-in type declarations and global exposure; the issue does not identify existing implementation files or tests.
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
- Needs clarification
- Newbie friendliness
- 25/100