rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
152 stars 47 forks source link

Node or AA based Class Support #6

Open chrisdp opened 5 years ago

chrisdp commented 5 years ago

Is there anyway we could do classes ether as AA out put or as Node output. I say this because internally we avoid AA's as much as possible.

this is a good suggestion - so something like NodeClass? whereby

  • automatcially creates a className.xml,
  • imports the declaring brs file into className.xml
  • the public methods become <function> interface entries in className.xml
  • public fields become <field> entries on className.xml

There's a lot in this idea - I think you should raise it as a separate issue - as it's a hugely useful; but also huge feature; but (imho) way beyond the scope of pobo (i.e. aa) classes

The above was a response from @georgejecook

Originally posted by @chrisdp in https://github.com/TwitchBronBron/brighterscript/issues/1#issuecomment-499995224

chrisdp commented 5 years ago

@georgejecook yes, exactly. There might be more to this but it would be really nice. One thing to think about on this topic would be how to handle classes with children as UI.

Would we want some sort of JSX style support or just a dedicated declaration for UI children that become the UI you would have in XML. This might even need to be another issue entirely again.

georgejecook commented 5 years ago

shudders

each to their own mate; but yes, I'd suggest jsx style support should be another issue. It's not my project though; but there's a reasonable argument for a node based utility class that can cross thread boundaries (as per this issue), and adding jsx style support to it, isn't a requirement for that use case, and again - considerably more work..

chrisdp commented 5 years ago

@georgejecook not saying we have to go that route as I'm not a fan ether. Was just the first parallel I could think of on the spot. It's really about creating a node class that would have stuff in its children node of the XML.

chrisdp commented 5 years ago

Perhaps we could have the XML separate as we already do and just match the class name to the component name in the XML as its UI layer for that class?

georgejecook commented 4 years ago

I'm actively thinking about this feature now, as I've wanted to use it several times.

My question is, do we use the generated code as straightforward codebehind, or do we still create an aa class, and have the generated node source proxy public methods to it?