Re: wikipedia draft

new topic     » goto parent     » topic index » view thread      » older message » newer message
katsmeow said...

I am guessing, but i suspect the labels in OE are in quotes, being strings, to avoid the possibility of them being reserved names of anything.

Maybe, I was not planning on replicating Euphoria's label "string" and goto "string" syntax anyway.
(I also have no intention of adding labelled/numbered break, continue or exit statements, or any form of retry. A goto would cover all that nonsense perfectly well enough anyway, and more.)

katsmeow said...

However, and you are in a better position than me to test this, this feature prohibits the ability to goto the value of a variable.

words = {"apple","tree","cow"} 
goto words[1] 
:tree -- code for trees 
:apple -- code for apples 

Oh my, I wasn't planning on anything like that.

Why on earth would anyone in their right mind ever want anything remotely like that, he asks, hopefully rhetorically.

Given that Phix already supports

#ilASM{ jmp :meaningful_label } 
... 
#ilASM{ ::meaningful_label } 

I was merely planning on the following (exact) syntax

goto :meaningful_label 
... 
::meaningful_label 

And simply re-factoring/re-using some of the existing code.

goto should be resolved at compile-time, into a fixed single (possibly short) machine instruction.

If you think I was reluctant to add goto, imagine how reluctant I will be to carry forward a string lookup table and the associated address table into the runtime, along with error handling code and an almost guaranteed branch misprediction.
(Besides, if you really, really, really wanted to, you could do all that in #ilASM{} yourself anyway, today)

katsmeow said...

doesn't mean i'd prohibit back jumps.

I said recommend, not prohibit.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu