[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Switch/Case with Fallthrough
- From: Tom N Harris <telliamed@...>
- Date: Thu, 21 Nov 2013 15:52:46 -0500
On Thursday, November 21, 2013 06:59:45 AM Paige DePol wrote:
> Yes, my misunderstanding. My latest thoughts on the switch statement is that
> I will probably turn the whole switch block into a closure.
> This way I can patch the constant list generated for the closure so all the
> case constants are in order in the constant pool with no gaps, thus making
> the jump table as efficient as possible. This would also then allow nested
> cases should someone wish to do so.
Now, if Lua had a computed goto, that would make this more interesting.
What would be the roadblocks to implementing that? Each function would need a
table of names to instruction pointers. And maybe that's all?
goto [value] -- cast value to string and jump
What happens with an invalid label? A runtime error, I suppose.