DEV Community

CrabPascal
CrabPascal

Posted on

From Delphi Developer to CrabPascal | Do desenvolvedor Delphi ao CrabPascal

Bilingual post · Post bilíngue

Jump to: English · Português


English {#english}

From Delphi Developer to CrabPascal

Series — Part 2: Previous: The v2.8 Hotfix Story (057-v28-hotfix-story). Philosophy: essentials/project-philosophy. Compatibility: roadmap/review-360. Quick start: usage/guia-rapido.

You know Delphi. You have .pas files, .dpr projects, maybe Horse APIs or legacy VCL units. CrabPascal is not a replacement IDE — it is a modern Pascal toolchain written in Rust with honest parity boundaries. This migration guide respects your experience and tells you exactly what changes — and what does not.

Mindset shift: three truths

From essentials/project-philosophy:

  1. No gambiarra — CrabPascal prefers failing loudly over fake support
  2. Dual pathsrun (interpreter) vs build-exe (native C) are not identical yet
  3. Sprint-evolving RTLSystem.* shims grow release by release

If your unit uses exceptions, method properties, or generics iteration, start with run until sprint reviews confirm native parity.

Day-one setup (Delphi developer edition)

Install CLI

git clone https://bitbucket.org/alphatecnologia/crabpascal.git
cd crabpascal
cargo build --release
Enter fullscreen mode Exit fullscreen mode

Windows shortcut: VS Code extension crabpascal.crabpascal with optional auto-install of crab-pascal.exe.

See usage/guia-rapido for PATH configuration and platform notes.

First commands (map from Delphi IDE)

Delphi habit CrabPascal equivalent
Compile (syntax) crab-pascal check Project.dpr
Run without full IDE crab-pascal run Project.dpr
Build native exe crab-pascal build-exe Project.dpr (subset of language)
Preprocessor view crab-pascal preproc Unit.pas
crab-pascal check examples/crud/crud.dpr
crab-pascal run examples/crud/crud.dpr
Enter fullscreen mode Exit fullscreen mode

CRUD demo is the modern Horse REST reference — closer to today's Delphi backend work than VCL hello world.

Namespace and uses clause

Delphi XE+ style:

uses
  System.SysUtils,
  System.Classes,
  System.Generics.Collections;
Enter fullscreen mode Exit fullscreen mode

CrabPascal resolves these via rtl/sys/ shims (Sprint 2+). If a unit is missing, check reports it — add shim or refactor uses temporarily.

Dotted unit names (unit System.IOUtils) landed in v2.22.0 — verify your version in essentials/project-status.

What migrates easily

  • Procedures, functions, records
  • Classes with inheritance (runtime path)
  • try/except/finally in run
  • Properties with backing fields
  • Generics TList<T>, TDictionary<K,V> basic operations
  • Horse-style HTTP handlers in examples

What needs attention

Check roadmap/review-360 Priority 0/1 before bulk porting:

  • String semantics — UTF-8 internal vs Delphi UTF-16; watch indexing and PChar
  • RTL gaps — IO, encoding, satellite units
  • Codegen parity — exceptions and some OOP constructs refuse native build honestly
  • VCL/FMX — not supported; keep UI in Delphi, port logic units

Incremental migration strategy

Phase A — Static analysis

crab-pascal check EachUnit.pas
Enter fullscreen mode Exit fullscreen mode

Collect errors; group by parser vs RTL vs semantic.

Phase B — Runtime validation

crab-pascal run EachUnit.pas
Enter fullscreen mode Exit fullscreen mode

Or compile a thin .dpr driver importing your units.

Phase C — Native build (optional)

Only after run passes and you confirm no blocked constructs (exceptions in hot paths, etc.).

Phase D — Contribute back

Minimal fixture for your blocker → sprint PR. Your pain becomes everyone's test.

Configuration

crabpascal.toml (see blog post 007) sets search paths, defines, and build preferences — analogous to Delphi project options stripped to essentials.

Community and support

  • Blog series Part 1 (001–031) — fundamentals
  • Part 2 (032–061) — Mintlify docs tour and audits
  • Bitbucket issues with smallest repro win fastest fixes

Takeaway

Delphi skills transfer directly — syntax is home. What changes is tooling honesty and RTL coverage cadence. Start with check + run, read the 360° review for your dependencies, and ship one unit before betting a whole codebase.

Next: Teaching Pascal in 2026 with CrabPascal (059-teaching-pascal-with-crabpascal).


Português {#portugus}

Do desenvolvedor Delphi ao CrabPascal

Série — Parte 2: Anterior: História dos hotfixes v2.8 (057-v28-hotfix-story). Filosofia: essentials/project-philosophy. Compatibilidade: roadmap/review-360. Quick start: usage/guia-rapido.

Você conhece Delphi. Tem arquivos .pas, projetos .dpr, talvez APIs Horse ou units VCL legadas. CrabPascal não é IDE substituta — é toolchain Pascal moderna escrita em Rust com limites de paridade honestos. Este guia de migração respeita sua experiência e diz exatamente o que muda — e o que não muda.

Mudança de mindset: três verdades

De essentials/project-philosophy:

  1. Sem gambiarra — CrabPascal prefere falhar alto a suporte falso
  2. Dual pathsrun (interpretador) vs build-exe (C nativo) ainda não são idênticos
  3. RTL evoluindo por sprint — shims System.* crescem release a release

Se sua unit usa exceptions, properties por método ou iteração generics, comece com run até reviews de sprint confirmarem paridade nativa.

Setup dia um (edição desenvolvedor Delphi)

Instalar CLI

git clone https://bitbucket.org/alphatecnologia/crabpascal.git
cd crabpascal
cargo build --release
Enter fullscreen mode Exit fullscreen mode

Atalho Windows: extensão VS Code crabpascal.crabpascal com auto-instalação opcional de crab-pascal.exe.

Veja usage/guia-rapido para PATH e notas de plataforma.

Primeiros comandos (mapa da IDE Delphi)

Hábito Delphi Equivalente CrabPascal
Compilar (sintaxe) crab-pascal check Project.dpr
Rodar sem IDE completa crab-pascal run Project.dpr
Build exe nativo crab-pascal build-exe Project.dpr (subconjunto da linguagem)
Visão preprocessor crab-pascal preproc Unit.pas
crab-pascal check examples/crud/crud.dpr
crab-pascal run examples/crud/crud.dpr
Enter fullscreen mode Exit fullscreen mode

Demo CRUD é referência Horse REST moderna — mais próxima de backend Delphi atual que hello world VCL.

Namespace e uses

Estilo Delphi XE+:

uses
  System.SysUtils,
  System.Classes,
  System.Generics.Collections;
Enter fullscreen mode Exit fullscreen mode

CrabPascal resolve via shims rtl/sys/ (Sprint 2+). Se unit falta, check reporta — adicione shim ou refatore uses temporariamente.

Unit names com ponto (unit System.IOUtils) chegou em v2.22.0 — verifique versão em essentials/project-status.

O que migra fácil

  • Procedures, functions, records
  • Classes com herança (caminho runtime)
  • try/except/finally em run
  • Properties com backing fields
  • Generics TList<T>, TDictionary<K,V> operações básicas
  • Handlers HTTP estilo Horse nos exemplos

O que precisa atenção

Consulte roadmap/review-360 Prioridade 0/1 antes de port em massa:

  • Semântica de strings — UTF-8 interno vs UTF-16 Delphi; cuidado com indexação e PChar
  • Gaps RTL — IO, encoding, units satélite
  • Paridade codegen — exceptions e alguns construtos OOP recusam build nativo honestamente
  • VCL/FMX — não suportado; mantenha UI no Delphi, porte units de lógica

Estratégia de migração incremental

Fase A — Análise estática

crab-pascal check CadaUnit.pas
Enter fullscreen mode Exit fullscreen mode

Colete erros; agrupe por parser vs RTL vs semântica.

Fase B — Validação runtime

crab-pascal run CadaUnit.pas
Enter fullscreen mode Exit fullscreen mode

Ou compile driver .dpr fino importando suas units.

Fase C — Build nativo (opcional)

Só após run passar e confirmar ausência de construtos bloqueados (exceptions em hot paths, etc.).

Fase D — Contribua de volta

Fixture mínimo do seu blocker → PR de sprint. Sua dor vira teste de todos.

Configuração

crabpascal.toml (veja blog post 007) define search paths, defines e preferências de build — análogo a opções de projeto Delphi reduzidas ao essencial.

Comunidade e suporte

  • Série blog Parte 1 (001–031) — fundamentos
  • Parte 2 (032–061) — tour docs Mintlify e auditorias
  • Issues Bitbucket com menor repro ganham fixes mais rápidos

Conclusão

Skills Delphi transferem direto — sintaxe é casa. O que muda é honestidade do tooling e cadência de cobertura RTL. Comece com check + run, leia review 360° para suas dependências, e ship uma unit antes de apostar codebase inteiro.

Próximo: Ensinando Pascal em 2026 (059-teaching-pascal-with-crabpascal).


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

Top comments (0)