Gradual 'tree' typing and C++
Concerns raised about the syntax and verbosity of gradual typing proposals for GCC's internal tree representation.
Jakub Jelinek expresses strong reservations about a proposal for gradual typing in GCC’s internal tree representation. He argues that the proposed syntax is ugly, more verbose than necessary, and restricts the flexibility developers currently have when working with TREE_CODEs and similar macros.
- proposer
Criticizes the proposed gradual typing syntax, deeming it ugly, verbose, and restrictive compared to current methods like TREE_CODE.
“All of it? Ugly syntax, having to type more than before (and thus having to deal with line wrapping more as well), having to introduce new vars for the dyn_cast way and being tied to if statements.”
In Details
This discussion concerns the C++ representation of GCC's internal Abstract Syntax Tree (AST) data structures, known as 'tree'. The proposal introduces gradual typing, allowing some parts of the tree to have statically known types while others remain dynamically typed. The debate centers on the C++ syntax and ergonomics for developers manipulating these trees, contrasting explicit type checks (like dyn_cast) with existing macros (like TREE_CODE).
- tree
- GCC's internal representation of the Abstract Syntax Tree (AST) and other intermediate forms.
- TREE_CODE
- A macro used to determine the type or kind of a GCC tree node.
- dyn_cast
- A C++ RTTI (Run-Time Type Information) mechanism used for safe downcasting, often employed in frameworks like LLVM and proposed here for GCC's tree manipulation.
- GIMPLE
- GCC's middle-end intermediate representation, a simplified form of the tree AST.
- RTL
- Register Transfer Language, an intermediate representation used in GCC's backend.