tracers.js icon indicating copy to clipboard operation
tracers.js copied to clipboard

Incorrect type for LogTracer functions?

Open MarkKoz opened this issue 6 years ago • 1 comments
trafficstars

LogTracer.set()'s parameter has a type of string but the print functions use any. All functions seem to have the same general purpose: to log the argument given Well, which type is it then? Is set() really meant to have a different type than the rest?

MarkKoz avatar Jul 28 '19 01:07 MarkKoz

I designed that way so that LogTracer.set() directly sets the string value that will be displayed whereas the print functions convert the value to string and then append it to the displayed value. However, I agree that LogTracer.set() should also convert any value to string first before setting it in order to not confuse users. You can make LogTracer.set() in tracers.py have any parameter. I'll fix it in tracers.js and algorithm-visualizer.

64json avatar Jul 28 '19 06:07 64json