Repository navigation
gateway: declare TStringArray locally in RelayQueue for dcc64 (PR #318 follow-up) - #320
Merged
Merged
Conversation
…follow-up) Delphi build broke on PR #318's PasClaw.Gateway.RelayQueue.pas: [dcc64 Error] (172): E2003 Undeclared identifier: 'TStringArray' [dcc64 Error] (178): E2005 'TStringArray' is not a type identifier [dcc64 Error] (183): E2005 'TStringArray' is not a type identifier [dcc64 Error] (220): E2005 'TStringArray' is not a type identifier [dcc64 Error] (345): E2005 'TStringArray' is not a type identifier [dcc64 Error] (351): E2008 Incompatible types [dcc64 Error] (351): E2008 Incompatible types [dcc64 Error] (353): E2250 There is no overloaded version of 'Trim' [dcc64 Error] (397): E2008 Incompatible types [dcc64 Error] (536): E2005 'TStringArray' is not a type identifier [dcc64 Error] (563): E2008 Incompatible types Root cause: FPC's `SysUtils` declares `TStringArray = array of string` but Delphi's RTL doesn't. The errors at 351/353/397/563 (E2008 "Incompatible types", E2250 "no overloaded Trim") are cascade failures -- once dcc64 can't resolve the field/parameter type at 172/178/183, every subsequent `SetLength(Caps, ...)`, `Caps[i] := LowerCase(Trim(...))`, and assignment chains through unknown-type which then mismatch in arithmetic/Trim call sites. Fix: declare `TStringArray` locally inside the type block, guarded by `{$IFNDEF FPC}`. Matches the established codebase pattern: - src/pkg/tools/PasClaw.Tools.Registry.pas (the canonical place, has the long-form comment explaining the FPC/Delphi split) - src/pkg/tools/PasClaw.Tools.Shell.Filters.pas - src/cmd/PasClaw.Cmd.Profile.pas PasClaw doesn't have a single shared compatibility unit for these RTL gaps -- the convention is the local guarded declaration in each consuming unit. PR #318 missed the pattern. Tests ===== make clean && make passes (FPC build; the Delphi-only declaration is guarded by IFNDEF FPC so FPC is unaffected). make test-relay-queue passes all 14 cases. Should i open a follow-up ========================= A "PasClaw.RTL.Compat" unit that re-exports TStringArray (and any other FPC/Delphi gaps) under a single import would let units just `uses PasClaw.RTL.Compat` instead of duplicating the IFNDEF block -- worth considering once we hit this for the 5th time. With 4 instances the duplicate-IFNDEF pattern is still defensible. Flagging as a follow-up candidate, not landing here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Delphi build broke on PR #318's
PasClaw.Gateway.RelayQueue.paswith 11 dcc64 errors all rooted inTStringArraynot being a known type. Fix matches the established pattern used elsewhere in the codebase.Root cause
FPC's
SysUtilsdeclaresTStringArray = array of string. Delphi's RTL does not. The 11 errors broke down as:TStringArraySetLengthagainst unknown type fail downstreamTrim(Caps[i])whereCapsis unresolved typeFix
Local
{$IFNDEF FPC} TStringArray = array of string; {$ENDIF}block inside thetypesection, right at the top beforeTRelayRequestId. Guarded so FPC builds are unaffected."Do we have one we use for all?"
The user's question — and the honest answer is no, we don't have a central shared compat unit. The convention so far is local guarded declarations in each consuming unit. Three other places do it:
src/pkg/tools/PasClaw.Tools.Registry.pas(the canonical place with the long-form explanation comment)src/pkg/tools/PasClaw.Tools.Shell.Filters.passrc/cmd/PasClaw.Cmd.Profile.pasPR #318 missed this established pattern.
Should we centralize?
A
PasClaw.RTL.Compatunit re-exportingTStringArray(and any other FPC/Delphi RTL gaps we hit) would let units justuses PasClaw.RTL.Compatinstead of repeating the IFNDEF block. Worth considering once we hit this for the 5th time. With 4 instances the duplicate-IFNDEF pattern is still defensible — and the local guard documents the cross-compiler issue right where it's needed. Flagging as a follow-up candidate, not landing here.Test plan
make clean && makepasses (FPC build — the Delphi-only declaration is guarded byIFNDEF FPCso FPC is unaffected)make test-relay-queuepasses all 14 casesFiles
src/pkg/gateway/PasClaw.Gateway.RelayQueue.pas— 9 lines added (the IFNDEF block + comment).Generated by Claude Code