bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Add native blocks

Open woollybah opened this issue 6 years ago • 6 comments

We currently only support single line native statements.

Print "Loop..."

'! int a = 10;
'! while (a > 0) {
'! a--;
'! }

Print "Finished"

This is obviously rather cumbersome, and not really suitable for anything other than very simple statements.

It would be useful if we could define a block in the code that would be interpreted purely as native code.

We could add to the '! syntax by providing a "start" and "end" block character, which would define the space between them as native... something along the lines of '!\ and '!/. So our example would become :

Print "Loop..."
'!\
int a = 10;
while (a > 0) {
a--;
}
'!/
Print "Finished"

The advantage of a native block over the current single line statements is obvious, and would make implementing native code sections quite seamless.

MaxIDE would need to be tweaked to ignore the sections, but I don't believe that would be a huge task.

woollybah avatar Dec 11 '18 08:12 woollybah