[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Has Lua reached perfection?
- From: Paige DePol <lual@...>
- Date: Sun, 28 Jan 2018 14:17:42 -0600
Soni They/Them L. <fakedme@gmail.com> wrote:
> I've checked the asm output of rustc over and over. It doesn't have jump
> tables. I couldn't get it to produce jump tables no matter what I tried.
>
> Jump tables are unnecessary. The syntax sugar is nice when comparing the
> same variable to many many values, as it avoids typos (e.g. `hello == 1`
> in the first "if", `helo == 2` in the second "if").
I like my patch which uses jump tables to allow both computed goto syntax
along with faster code branching over a large number of possible choices,
as well as the ability to fallthrough case blocks, which can not currently
be done with just an if/else construct in vanilla Lua.
You are, of course, more than welcome to develop your own patch for creating
a switch/case patch which is just syntactic sugar for an if/else construct.
I may add non-constant case values at some point, if I do maybe I'll revert
the entire switch/case to if/else, or maybe just give const values priority
over non-constant values... but honestly, at this point adding support for
non-constant values is not a priority as there is always if/else for them!
I do agree that switch/case syntax does help remove potential typos in the
names of variables... then again, so would a 'strict' mode! ;)
~Paige
- References:
- Has Lua reached perfection?, Dibyendu Majumdar
- Re: Has Lua reached perfection?, Sean Conner
- Re: Has Lua reached perfection?, KHMan
- Re: Has Lua reached perfection?, Dirk Laurie
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.
- Re: Has Lua reached perfection?, Paige DePol
- Re: Has Lua reached perfection?, Soni "They/Them" L.