Retrogamecoding(.org) > BrowserBasic
requests
SteveOW:
@Guilect
I wonder is there any chance of getting two extra functions in the next release of BB:- strokeEllipse, fillEllipse?
= = = = =
Also do you think it would be possible to have a "goto" command (and associated label statement)?
I assumed that javascript doesnt have such capability but after reading the following link the picture isnt clear.
http://stackoverflow.com/questions/9751207/how-can-i-use-goto-in-javascript.
cheers, SteveOW.
EDIT:
Just realized a simple way to implement goto:
Basic: Goto LabelOne JS: If (1==2) { //...Goto LabelOne
Basic: LabelOne: JS: } //...LabelOne:
leave it to the programmer to avoid jumping across control structures.
Guilect:
Not a big fan of 'goto'.
But if it can be easily implemented I could do it and users could choose to use it or not.
I do not get your JS example.
--- Quote ---If (1==2) { //...Goto LabelOne
} //...LabelOne:
--- End quote ---
I can make a keyword 'Goto' in BB what what is its JS equivelant that BB outputs?
The ellipse request seems doable.
{EDIT}:
I have implemented the stroke and fill ellipses.
When used each on their own they work fine.
But, like the POLY draw function, when used together the stroked one gets a extra outline.
I will continue to look into that.
SteveOW:
@Guilect
Re: GOTO...Sorry my illustration was a bit confusing. :-[
--- Code: ---Basic: Goto abc123
Basic: a line of code that I want to skip for now in order to see if that solves a particular bug
Basic: a line of code that I want to skip for now in order to see if that solves a particular bug
Basic: a line of code that I want to skip for now in order to see if that solves a particular bug
Basic: abc123:
Here is the minimal JS required to implement the goto effect
JS: If (1==2) {
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: }
JS code with additional endline comments which explain to another programmer how a goto is being implemented
JS: If (1==2) { // this line acts as a goto abc123
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: a line of code that I want to skip for now in order to see if that solves a particular bug
JS: } // this line acts like a basic "label abc123"
--- End code ---
I would not expect the compiler to auto-generate the end-line comments.
I dont expect the compiler to check the validity/safeness of the use to which goto is put.
Compiler must recognize that a basic statement "goto abc123" can be replaced simply by "if(1==2)" It can ignore the specifics of the label.
Compiler must recognize that a statement like "abc123:" is a label (as in VB6) and simply replace it by a "}"
My main reason for having goto's is I find it helps in bug hunting to quickly and clearly jump over blocks of code that may harbour the bug.
In JS one can use the block comment start & end structure: /* .... ... ... */
But in VB6 (AFAIK) there is no such start & end block comment facility.
Same seems to apply for BB. (I think I might include the facility in Browzic).
Second reason for using goto = it helps explain to Level 1 novices how computers really work, using near-natural language terms.
Then Level 2 novices can be allowed to confuse themselves with goto spaghetti.
Then Level 3 novices will appreciate the benefits of structured programming. :)
cheers, SteveOW.
PS I would be very glad to have fillEllipse, I can live with the outlining "feature".
Cybermonkey:
The only thing I can say is that I never ever needed GOTO the last 15 years. I only needed it on the Commodore64 but that BASIC had'nt advanced control structures.
SteveOW:
@Guilect
Please could you provide an Open Hyperlink function in next release of BB?
Here is some JS which opens a hyperlink in a new browser tab when supplied with a url as a string:-
var page_URL //as string
page_URL = "sow_FRED.html"
window.open(page_URL,'_newtab');
Cheers, SteveOW.
Navigation
[0] Message Index
[#] Next page
Go to full version