lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 26/03/2013, Doug Currie <doug.currie@gmail.com> wrote:
> On Mar 25, 2013, at 8:56 PM, Tim Hill <drtimhill@gmail.com> wrote:
>
>> from a computers standpoint, semantic bugs cannot exist
>
> There are programming languages that take great pains, e.g., using static
> analysis, to detect semantic bugs at compile time.
>
> This Lua function will pass through the compiler just fine:
>
> function f1 (x) return x + math.sqrt("elephant") end
>
> but in a language with static analysis (or just strong static type checking)
> the compiler can declare it "meaningless," and thereby detect a "semantic
> bug."
>
> e
>
Well, with evil coertion rules, "elephant" == 0 or maybe 4294967295 :-)

<opinion>In a way, weak static type checking is the worst of both
worlds.</opinion>