Comprehension

Category: Comprehension Result: Calor wins (1.46x) What it measures: Structural clarity and semantic extractability


Overview

The Comprehension metric measures how easily an AI agent can understand code structure and extract semantic information without deep analysis.


Why It Matters

When an AI agent reads code, it needs to answer:

  • What are the function boundaries?
  • What are the inputs and outputs?
  • What side effects are possible?
  • What constraints must hold?

Traditional languages require parsing and inference. Calor makes these explicit.


How It's Measured

Calor Clarity Factors

FactorPointsCheck
Module declaration0.15Contains §M{
Function declaration0.15Contains §F{
Input parameters0.10Contains §I{
Output type0.10Contains §O{
Return statement0.10Contains §R
Effect declaration0.15Contains §E{
Requires contract0.15Contains §Q
Ensures contract0.10Contains §S
Function closing tag0.05Contains §/F{
Module closing tag0.05Contains §/M{

C# Clarity Factors

FactorPointsCheck
Namespace0.15Contains namespace
Class0.10Contains class
Public modifier0.05Contains public
Private modifier0.05Contains private
Return statement0.10Contains return
XML documentation0.20Contains ///
Comments0.05Contains //
Type annotations0.10Contains int , string , etc.
Code Contracts0.15Contains Contract. or Debug.Assert

Example Comparison

Calor (High Clarity)

Plain Text
§M{m001:Calculator}
§F{f001:Divide:pub}
  §I{i32:a}
  §I{i32:b}
  §O{i32}
  §Q (!= b 0)
  §S (>= result 0)
  §R (/ a b)
§/F{f001}
§/M{m001}

Score calculation:

  • §M{: +0.15
  • §F{: +0.15
  • §I{: +0.10
  • §O{: +0.10
  • §R: +0.10
  • §Q: +0.15
  • §S: +0.10
  • §/F{: +0.05
  • §/M{: +0.05

Total: 0.95

C# (Lower Clarity)

C#
namespace Calculator
{
    public static class Program
    {
        public static int Divide(int a, int b)
        {
            if (b == 0) throw new ArgumentException();
            var result = a / b;
            Debug.Assert(result >= 0);
            return result;
        }
    }
}

Score calculation:

  • namespace: +0.15
  • class: +0.10
  • public: +0.05
  • return: +0.10
  • int : +0.10
  • Debug.Assert: +0.15

Total: 0.65

Ratio: 0.95 / 0.65 = 1.46x (Calor wins)


What Agents Can Extract

From Calor (Direct Extraction)

InformationExtraction Method
Function nameParse §F{id:name:vis}
Function IDParse §F{id:name:vis}
InputsFind all §I{type:name}
Output typeParse §O{type}
Side effectsParse §E{codes}
PreconditionsFind all §Q condition
PostconditionsFind all §S condition
Scope boundariesMatch §F{id} with §/F{id}

From C# (Requires Inference)

InformationExtraction Method
Function nameParse method declaration
InputsParse parameter list
Output typeParse return type
Side effectsAnalyze all statements for I/O
PreconditionsFind throw statements, Debug.Assert
PostconditionsFind assertions near return
Scope boundariesCount and match braces

Real-World Impact

Agent Task: "What are the constraints on the Divide function?"

From Calor:

Plain Text
Preconditions: b != 0
Postconditions: result >= 0

Direct extraction from §Q and §S.

From C#:

Plain Text
Must analyze:
1. Exception throws (if (b == 0) throw...)
2. Debug.Assert calls
3. Comments (if any)
4. Infer from implementation

Interpretation

The 1.46x advantage indicates that Calor's explicit structure provides ~46% more structural clarity signals than equivalent C# code.

This doesn't mean C# is hard to understand—it means Calor makes structure more explicit, which benefits automated analysis.


Next