lua-users home
lua-l archive

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]


On Fri, 8 Mar 2013 11:48:05 -0500
Steve Litt <slitt@troubleshooters.com> wrote:
> On 2013年3月08日 10:56:06 -0200
> Jorge <xxopxe@gmail.com> wrote:
> 
> > On 03/07/2013 07:36 PM, Steve Litt wrote:
> > > Speaking of tarpits, what the heck does "semantic" mean?
> > 
> > If I was a computer, mi mind would have had a stack overflow right
> > there.
> 
> LOL.
> 
> Also, if you were a computer, you'd reject all the silly uses of the
> word that seem to pop up every time someone talks code and tries to
> sound smart.
> 
> Perhaps this is the solution to the stack overflow:
> 
> 
> function semantic_usage_correct(usage)
> 	if makes_sense(usage) == "definitely"
> 		return(0)
> 	elseif makes_sense(usage) == "no way"
> 		return(1)
> 	elseif you_are_tired_of_this_krap(usage)
> 		return(-1)
> 	else
> 		usage = get_more_info(usage)
> 		return(semantic_usage_correct(usage))
> 	end
> end
> 
> The thing that keeps you from stack overflowing is the test for
> you_are_tired_of_this_krap(usage) :-)
> 
> Now, could somebody please code the makes_sense() function?
Hi all,
Watching this presentation:
https://www.usenix.org/conference/fast13/study-linux-file-system-evolution
Time marks 9:10 to 9:58, it looks to me like he's defining "semantic
bugs" as incorrect coding of algorithms or data structures, or, at a
higher thought level, failure to match the code to the problem
domain.
Of course, that's in the tool's source code, which isn't the typical
way I hear the words "semantic" and "semantics" used by developers.
Perhaps developers are using the word "semantics" to mean "behavior".
For instance, the *syntax* of Lua tables is:
my_table={} -- Create empty table
my_table.fname = "Steve" -- Give value to "fname" key
my_table["lname"] = "Litt" -- Same behavior as above, different
syntax table.insert(my_table,"one") -- Set key 1 
 -- (first numeric key)
 -- to "one" 
table.insert(my_table,"two") -- Set next numeric key to "two"
The *behavior* (semantics?) of Lua tables are:
* Tables are key/value pair lists
* Keys can be almost anything
* Values can be anything
* Tables passed and referenced by reference, not value
* Tables whose only keys are 1 through a larger number can be iterated
 a special way and treated like arrays in other languages
Have I made this distinction correctly? Is "semantics of" a synonym for
"behavior of"?
Thanks,
SteveT
Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance

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