Visualizing Type Error Messages: Enhancing Usability and Understanding in Programming
This presentation examines the visualization of type error messages in programming languages, focusing on the ViSeR tool. It highlights the challenges posed by type errors, such as mismatched types in expressions, and explores a foundational approach using Processing. The discussion includes pros and cons of using these tools, with emphasis on usability improvements and providing context for error suggestions. Examples illustrate how ViSeR can help reduce user confusion and improve understanding of type errors, while also acknowledging its limitations and areas for future work.
Visualizing Type Error Messages: Enhancing Usability and Understanding in Programming
E N D
Presentation Transcript
Visualizing Type Error Messages Allison Thompson CSCI 5535 Spring 2010
Motivation This expression has type int but is here used with type float This expression has type my_type but is here used with type my_type
Outline • Motivation • Tools: Processing and Seminal • ViSeR • Conclusion
Outline • Motivation • Tools: Processing and Seminal • ViSeR • Conclusion
Pros and Cons of Processing • Easy • Didn’t require learning new language • Free • Based on Java 1.4.2 (limited) • Does not always run very fast • Visualization can take 4-5 sec to load; then 4-5 for each refresh
Seminal: Searching for Error Messages INAdvanced Languages • Enumerate local changes to abstract syntax tree that may remove type errors • Search for places to try changes • Use type checker to evaluate changes • Rank changes and present to user
Seminal Results: 1 + 2.5;; ------------------------------------------------------------------ File "test1.ml", line 1, characters 4-7: This expression has type float but is here used with type int Relevant code: 2.5 ------------------------------------------------------------------ File "test1.ml", line 1, characters 4-7: Try replacing 2.5 with 2.5; [[...]] of type int within context 1 + (2.5; [[...]]);; ============================== File "test1.ml", line 1, characters 2-3: Try replacing + with +; [[...]] of type int -> float -> 'a within context (1 +; [[...]] 2.5);; ============================== File "test1.ml", line 1, characters 4-7: Try replacing 2.5 with 2.5; [[...]] of type int within context 1 + (2.5; [[...]]);; wildcard replacement with type int
Outline • Motivation • Tools: Processing and Seminal • ViSeR • Conclusion
ViSeR: Visualization for Seminal Results • Goals: • Put Seminal suggestions in context with some form of helpful visualization • Minimize need for user to learn new symbols/etc – improve usability and understandability • Avoid re-introducing confusion: This expression has type int but is here used with type float
ViSeR: Examples and Screenshots 1 + 2.5;; File "test1.ml", line 1, characters 4-7: Try replacing 2.5 with 2.5; [[...]] of type int within context 1 + (2.5; [[...]]);; wildcard replacement with type int This expression has type int but is here used with type float
ViSeR: Examples and Screenshots actual error error location according to OCaml This expression has type int but is here used with type float
Outline • Motivation • Tools: Seminal and Processing • ViSeR • Conclusion
Conclusion • Success? • Put Seminal results in context • Provide improvement in usability • Remaining Issues/Future Work • ViSeR as a tool is limited/slow • Several situations doesn’t cover; doesn’t gracefully handle proper compilation • 4-5 seconds for some visualizations is too slow ✓ ✗