-
Notifications
You must be signed in to change notification settings - Fork 56
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 Component Statement #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