[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [PATCH] Jump Tables for Switch/Case and Computed Goto
- From: Karel Tuma <kat@...>
- Date: Tue, 06 May 2014 07:58:15 +0200
Excerpts from Paige DePol's message of 2014-05-06 07:21:47 +0200:
> What? I have no idea what you mean by that? It is not something I said.
> Essentially I did make addressable identifiers, that can be any constant value.
In 1.5k LOC patch. All I am saying it might be worth it to think about
in terms of doing more in less.
> You can jump when there is a sub-scope. You can jump over it, just not into it.
> Why would we need to do that, we know at compile time if all jumpto statements can reach all jump points without violating local scope.
I suppose code will explain better:
-- no jumping to outside scope
do
local x = 1
do
jumpto x -- should jump to 1 ...
:|2|: -- to satisfy static scoping check
end
:|1|:
os.exit()
jumpto x -- to satisfy static scoping check
end
-- lua equivalent:
-- jumping to outside scope
do
do
goto out
end
::out::
end
-- no jumping into scope of local variable
do
local x = 1
jumpto x
:|1|:
local b = 2
:|2|:
jumpto b
end
-- no lua equivalent because lua uses static check
-- too (but for static gotos)
Doing dynamic gotos with static scoping is rather um ... unorthodox.
Common usage is to err ... jump to outside scope I guess?
> Thank you for your feedback, though I have to be honest, I did not understand half of it! :(
No worries, thats what they call code talks, bullshit walks.