错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Detecting Unused Functions in Futhark Programs

  • Raghu Ranganathan,
  • Rajasekar Velswamy,
  • Poonkodi Mariappan

摘要

Unused functions are a common sight in production codebases of functional languages. The presence of unused functions is not inherently bad for the program as it may be used as a module. The imports of an exposed module are however prone to having functions that add unnecessary code to the final generated result. The primary purpose of the unused function finder is to indicate to the programmer about these unused definitions. Language server tools commonly include the detection of unused functions and types as a part of an integrated development environment. Some ML-like languages, like Haskell, provide warnings for unused functions as part of the compiler. Older programming languages like JavaScript and Lisp use tree shaking to eliminate dead code instead of producing warnings. The Futhark programming language uses a unique module system for organizing source files and their constituent functions. In this paper, we will address the problems that are created by its module structure for the detection of dead code. Using the Futhark parser as a library, we will extract the source locations of unused functions from the imports of the given files.