Re: quick print type debugging



Eric Mahurin wrote:

What would be nice is if you could somehow convert the block
back to text (and put it in the debug message).  Anybody know
how to do that?  I know I could make the block be a string of
the code instead to solve the problem (d{"..."}), but that
would be uglier and less efficient when we have debugging off
(because we have to eval).

See attachment. It's not very general, though.

I think I'd go with the string solution, use Binding.of_caller to put it into the right context and alias it to a method that does nothing when $DEBUG isn't set.

Attachment: binding_of_caller.rb
Description: application/ruby

Attachment: proc_source.rb
Description: application/ruby



Relevant Pages

  • Re: Serial driver
    ... step by step debugging using Multi Ice It prints the debug message from ... only but not from EdbgOutputDebugString(). ... is my code for printing the string. ... doesnot display any message. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Serial driver
    ... your OEMWriteDebugString() it is adopted to ... EdbgOutputDebugString() doesn't print any debug messages. ... step by step debugging using Multi Ice It prints the debug message from ... is my code for printing the string. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: SQL
    ... Just a naked string. ... also that in this case it is not the context which determines the types, ... I.e. it is dynamic typing, ... interesting than math libraries IMO. ...
    (comp.object)
  • Re: SQL
    ... Just a naked string. ... Note that different libraries may accept different inputs. ... In context typing, "typing is in the mind and only in the ...
    (comp.object)
  • Re: Test first as specification
    ... >>> the only valid input string is an infinite string of a's? ... Without some additional knowledge about the language we ... The context you mention below. ... correctness may be a matter of degree. ...
    (comp.object)