DEV Community

CrabPascal
CrabPascal

Posted on

Sprint 13 Review: Honest build-exe | Review Sprint 13: build-exe honesto

Bilingual post · Post bilíngue

Jump to: English · Português


English {#english}

Sprint 13 Review: Honest build-exe

Mintlify docs tour — after Sprint 10 string parity, Sprint 13 chooses trust over checkbox features.

For several releases, CrabPascal's C backend simulated exception handling — emitting stub blocks that compiled but did not behave like Delphi or like run. Sprint 13 (v2.21.0) ended that. The codegen module now refuses to generate C for try/except/finally and raise.

The single deliverable — and why it matters

The Sprint 13 Review is concise because the decision is sharp:

Codegen C now fails with a clear message when it encounters try/except/finally or raise.

This prevents false positives: developers no longer think native build works until production crashes differently than run.

Consider typical Delphi code:

try
  ProcessOrder(OrderId);
except
  on E: Exception do
    LogError(E.Message);
end;
Enter fullscreen mode Exit fullscreen mode

In run, this unwinds correctly. The old C path generated placeholder comments — enough to pass compile, not enough to run. v2.21.0 replaces silence with explicit failure:

crab-pascal build-exe MyApp.dpr
# error: exception handling not supported in native codegen yet; use `crab-pascal run`
Enter fullscreen mode Exit fullscreen mode

CI pipelines fail for the right reason. That aligns with a core CrabPascal principle documented in project philosophy: honest tooling.

When to use each path

Command Best for
run Development, Horse APIs, OOP with exceptions
check IDE feedback, static analysis in CI
build-exe Performance-sensitive code without exception constructs

The CRUD example's hot paths — JSON serialization, route handlers without nested try — may compile natively where parity is proven. Anything with structured exception handling stays on run until real lowering ships.

Regression lock

Sprint 13 added tests ensuring codegen returns Err on try/raise — not fake C:

// Intent: codegen must Err on try/raise, not emit simulated blocks
assert!(codegen_result.is_err());
assert!(message.contains("use `run`"));
Enter fullscreen mode Exit fullscreen mode

Future work on setjmp/longjmp, table-based handlers, or LLVM exception tables will flip specific tests green — not reintroduce silent stubs.

Context in the sprint arc

Sprints 10–12 progressively closed parity gaps: strings in C, parser hardening, method-based properties in runtime. Sprint 13 drew the line on the hardest remaining backend debt (TD-CODEGEN-003). Full OO codegen (real method bodies, VMT parent links) remains planned; exceptions were the highest-risk fake feature.

Roadmap for real native exceptions

Honest failure is step one. Step two requires Delphi-compatible exception tables coordinated with RTL types in System.SysUtils and runtime object layout. Until then, this article, release notes, and check hints document the split clearly.

Tag v2.21.0 approved. Docs: Mintlify Roadmap → Sprint 13 Review. Next: Sprint 17 kickoff — CRUD, JSON, and what comes after v2.22.0.


Português {#portugus}

Review Sprint 13: build-exe honesto

Tour Mintlify — depois da paridade de strings do Sprint 10, o Sprint 13 escolhe confiança em vez de features de checkbox.

Por várias releases, o backend C do CrabPascal simulava exception handling — emitindo blocos stub que compilavam mas não se comportavam como Delphi ou como run. O Sprint 13 (v2.21.0) acabou com isso. O módulo codegen agora recusa gerar C para try/except/finally e raise.

A entrega única — e por que importa

O Sprint 13 Review é conciso porque a decisão é nítida:

Codegen C agora falha com mensagem clara ao encontrar try/except/finally ou raise.

Isso evita falsos positivos: desenvolvedores não acham mais que build nativo funciona até produção quebrar diferente do run.

Considere código Delphi típico:

try
  ProcessOrder(OrderId);
except
  on E: Exception do
    LogError(E.Message);
end;
Enter fullscreen mode Exit fullscreen mode

No run, isso desenrola corretamente. O caminho C antigo gerava comentários placeholder — bastava para compilar, não para executar. v2.21.0 troca silêncio por falha explícita:

crab-pascal build-exe MyApp.dpr
# error: exception handling not supported in native codegen yet; use `crab-pascal run`
Enter fullscreen mode Exit fullscreen mode

Pipelines CI falham pelo motivo certo. Alinha com princípio central documentado na filosofia do projeto: ferramentas honestas.

Quando usar cada caminho

Comando Melhor para
run Desenvolvimento, APIs Horse, OOP com exceções
check Feedback IDE, análise estática no CI
build-exe Código sensível a performance sem construtos de exceção

Hot paths do exemplo CRUD — serialização JSON, handlers sem try aninhado — podem compilar nativamente onde paridade está provada. Qualquer coisa com exception handling estruturado fica no run até lowering real.

Trava de regressão

O Sprint 13 adicionou testes garantindo que codegen retorna Err em try/raise — não C falso:

// Intenção: codegen deve Err em try/raise, não emitir blocos simulados
assert!(codegen_result.is_err());
assert!(message.contains("use `run`"));
Enter fullscreen mode Exit fullscreen mode

Trabalho futuro com setjmp/longjmp, handlers tabulares ou tabelas LLVM trocará testes específicos para verde — sem reintroduzir stubs silenciosos.

Contexto no arco de sprints

Sprints 10–12 fecharam gaps de paridade progressivamente: strings no C, parser hardening, properties por método no runtime. O Sprint 13 traçou a linha no débito de backend mais arriscado (TD-CODEGEN-003). Codegen OO completo (corpos reais de métodos, VMT parent link) permanece planejado; exceções eram a feature falsa de maior risco.

Roadmap para exceções nativas reais

Falha honesta é passo um. Passo dois exige tabelas de exceção compatíveis com Delphi coordenadas com tipos RTL em System.SysUtils e layout de objetos no runtime. Até lá, este artigo, release notes e hints do check documentam a divisão claramente.

Tag v2.21.0 aprovada. Docs: Mintlify Roadmap → Sprint 13 Review. Próximo: kickoff Sprint 17 — CRUD, JSON e o que vem depois do v2.22.0.


Published on dev.to/@crabpascal · Código em CrabPascal

Top comments (0)