lua-users home
lua-l archive

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


It was thus said that the Great Jay Glascoe once stated:
> 
> @Steve that's a good idea.  A good chapter/section title would be
> "Debugging Lua: What To Do When the Print Statements Fail"  I think this
> would be most effective if I can settle on a single IDE with debugger
> support.  (And tbh, the freer the better so I need to look at ZBS).  And
> then just cover step into/out of/over/run/inspect vars with screenshots.
>  Any further ideas on that?

  Don't sell print statements short---it's often the only thing available
for troubleshooting [1][2][3].  Even after programming for nearly 30 years,
I still regularly use print statements (especially helpful for debugging
LPeg code).

  If the print statement fails, it's because you either picked the wrong
place for the statment, or you're printing too much  to go through
effectively.  The real trick with debugging is having a theory as to what
went wrong and knowing how to test your hypothesis.  

> @Everyone, regarding the "OO Overused" thread.  You know, I love the
> functional languages.  If you give me first class functions, lexical
> scoping, closures and tail call elimination, I'm yours!  But OO is what
> puts asses in the seats.  Beginning and experienced programmers flock to
> the OO books and blogs because it is the currently accepted paradigm.  It's
> what gets you a paying job because it's what the bosses and the managers
> want.

	The venerable master Qc Na was walking with his student, Anton.
	Hoping to prompt the master into a discussion, Anton said "Master, I
	have heard that objects are a very good thing - is this true?" Qc Na
	looked pityingly at his student and replied, "Foolish pupil -
	objects are merely a poor man's closures."

	Chastised, Anton took his leave from his master and returned to his
	cell, intent on studying closures. He carefully read the entire
	"Lambda: The Ultimate..." series of papers and its cousins, and
	implemented a small Scheme interpreter with a closure-based object
	system. He learned much, and looked forward to informing his master
	of his progress.

	On his next walk with Qc Na, Anton attempted to impress his master
	by saying "Master, I have diligently studied the matter, and now
	understand that objects are truly a poor man's closures." Qc Na
	responded by hitting Anton with his stick, saying "When will you
	learn? Closures are a poor man's object." At that moment, Anton
	became enlightened.

(from http://c2.com/cgi/wiki?ClosuresAndObjectsAreEquivalent)

  -spc (Ah, so that's the sound of one hand clapping ... )

[1]	You see trouble, you shoot it. [4]

[2]	And sometimes, not even *that* is availble, but so far, I've been
	lucky enough to avoid having to use one of these:

	http://www.computerhope.com/jargon/p/port80.htm

	which, oddly enough, is a type of hardware instantiation of a print
	statement.

[3]	The worst type of bug though, are those that crash the program, but
	only after running for hours, possibly days, on end.  And even the
	best debugger won't really help much for that type of bug.

[4]	The Computer is your friend, citizen.