Noeud « Next »: , Noeud « Previous »: T4 Code to Write, Noeud « Up »: T4



4.6.5 T4 Options

These are features that you might want to implement in addition to the core features.

type::Error
One problem is that type error recovery can generate false errors. For instance our compiler usually considers that the type for incorrect constructs is Int, which can create cascades of errors:
          "666" = if 000 then 333 else "666"
          File 56: is_devil.tig
     
          $ tc is_devil.tig --types-check
          error-->is_devil.tig:1.8-33: type mismatch
          error-->  then clause type: int
          error-->  else clause type: string
          error-->is_devil.tig:1.0-33: type mismatch
          error-->  left operand type: string
          error-->  right operand type: int
          =>4
          Example 57: tc is_devil.tig --types-check
     

One means to avoid this issue consists in introducing a new type, type::Error, that the type checker would never complain about. This can be a nice complement to ast::Error.