refactoring - 有助于重构的编程语言属性?

标签 refactoring language-features language-design automated-refactoring

促进(简化)广泛自动化源代码分析和重新设计(转换)工具的编程语言的共同特征/属性是什么?
我主要考虑编程语言特性,使开发静态分析和重构工具更容易(即比较 Java 与 C++,前者对重构有更好的支持)。
换句话说,一种从一开始就明确设计为支持自动静态分析和重构的编程语言,它最好具有哪些特征?
例如,对于 Ada ,有ASIS :

The Ada Semantic Interface Specification (ASIS) is a layered, open architecture providing vendor-independent access to the Ada Library Environment. It allows for the static analysis of Ada programs and libraries. ASIS, the Ada Semantic Interface Specification, is a library that gives applications access to the complete syntactic and semantic structure of an Ada compilation unit. This library is typically used by tools that need to perform some sort of static analysis on an Ada program.

ASIS information: ASIS provides a standard way for tools to extract data that are best collected by an Ada compiler or other source code analyzer. Tools which use ASIS are themselves written in Ada, and can be very easily ported between Ada compilers which support ASIS. Using ASIS, developers can produce powerful code analysis tools with a high degree of portability. They can also save the considerable expense of implementing the algorithms that extract semantic information from the source program. For example, ASIS tools already exist that generate source-code metrics, check a program's conformance to coding styles or restrictions, make cross-references, and globally analyze programs for validation and verification.


另请参阅,ASIS FAQ
你能想到其他编程语言提供类似全面和完整的接口(interface)来处理源代码,专门用于分析/转换目的吗?
我正在考虑提供低级 Hook 的特定实现技术,例如提供一种在运行时检查 AST 或 ASG 的方法的核心库函数。

最佳答案

最大的必须是静态类型。这使工具可以更深入地了解代码在做什么。没有它,重构变得困难很多倍。

关于refactoring - 有助于重构的编程语言属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/977474/

相关文章:

language-agnostic - 如何将静态调用排除在类之外

c# - 在 visual studio 中快速轻松重构

java - Java 接口(interface)中的默认方法返回值

computer-science - 评估语言 "Turing Completeness"的实用指南是什么?

c# - 为什么 List<T> 不密封?

c# - 将实体保存到数据库——我的 Save 方法应该返回保存的实体吗?

asp.net-mvc - 复用 MVC 架构;有两层 UI : ASP. NET MVC 和 .NET Winforms

c++ - 如何在 C++ 中将模板与枚举相结合?

python - “self”的 Ruby 和 Python 版本有什么区别?

c# - 为什么私有(private)字段是类型私有(private)的,而不是实例私有(private)的?