lua-users home
lua-l archive

Re: Definition of Semantic: was What Lua can do that other programming languages can't do?

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


2013年3月26日 Tim Hill <drtimhill@gmail.com>:
> I would say a "semantic" bug is any deviation from expected behavior
> of a program that is grammatically correct (i.e. has correct syntax
> according to the formal grammar of the language).
I would classify bugs into five groups.
 Typographical: the program would have been correct if the symbol
 the programmer intended had been typed, but actually there is
 a different symbol in there.
 Syntactic: the compiler catches the bug.
 Semantic: the bug is caused by something in the language having
 a different meaning to what the programmer reasonably expects.
 E.g. when does an expression test "false" in a `if` statement?
 (There are four different conventions for C, Python, Lua and
 LuaJIT.) What is the precedence of operators in a expression?
 Etc.
 Logical: the bug can be found by using 'assert'. The programmer has
 (perhaps unwittingly) assumed that a certain state must exist,
 but failed take into account that it could be otherwise.
 Rot: The program used to work, but changes to the language, OS etc
 have made it invalid.

AltStyle によって変換されたページ (->オリジナル) /