You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
implement: does not accept a qualified name: make Fake, implement: FS.File #179
make X, implement: Trait accepts only a bare UpperIdent, so a trait or capability that lives inside a module cannot be implemented at all.
module FS2 do
capability File do
foul read(path: String) -> String do return "REAL:" + path end
end
end
record FakeFiles do
canned : String
end
make FakeFiles, implement: FS2.File do
foul read(path: String) -> String = @canned + path
end
error: Expected 'do' after make target, got .
parseMakeImplements (src/parser/parser.cxx:689) reads one UpperIdent per entry and never consumes a dotted path.
Why it matters now
It blocks the capability work in #143. A capability's boundary is the innermost module that owns effectful methods — FS.File and FS.Directory, never FS, since FS.Path is pure string manipulation with nothing to substitute. So every realistic capability in the stdlib is nested, and none of them can be implemented until this parses. That in turn blocks converting the stdlib to capability blocks, which blocks deleting Mock.*.
The names already line up on the semantic side: a nested ModuleDef is registered under its qualified name (FS.File), which is exactly what a dotted implement: would need to match.
Fixed. parseMakeImplements now consumes a dotted path per entry, so a trait or capability declared inside a module can be implemented:
module FS2 do
capability File do
foul read(path: String) -> String do return "REAL:" + path end
end
end
make FakeFiles, implement: FS2.File do
foul read(path: String) -> String = @canned + path
end
foul load(p: String) -> String = FS2.File.read(p)
with FS2.File = FakeFiles { canned: "FAKE:" } do
IO.printLine(load("a.txt")) # FAKE:a.txt
end
The names already lined up on the semantic side — a nested ModuleDef is registered under its qualified name — so nothing beyond the parser needed to change.
The reserved-single-letter check now applies to the whole name rather than each segment: a qualified path is never a type parameter, so A.B is fine while a bare A is still rejected.
Covered by spec/capabilities.kex, which now exercises a nested capability end to end (declare, implement by qualified name, substitute, restore). This unblocks converting the stdlib to capability blocks, since every realistic capability there is nested — FS.File and FS.Directory are capabilities while FS is not, FS.Path being pure string work with nothing to substitute.
Activity
akoskovacs commentedon Aug 22, 2026
Fixed.
parseMakeImplementsnow consumes a dotted path per entry, so a trait or capability declared inside a module can be implemented:The names already lined up on the semantic side — a nested
ModuleDefis registered under its qualified name — so nothing beyond the parser needed to change.The reserved-single-letter check now applies to the whole name rather than each segment: a qualified path is never a type parameter, so
A.Bis fine while a bareAis still rejected.Covered by
spec/capabilities.kex, which now exercises a nested capability end to end (declare, implement by qualified name, substitute, restore). This unblocks converting the stdlib tocapabilityblocks, since every realistic capability there is nested —FS.FileandFS.Directoryare capabilities whileFSis not,FS.Pathbeing pure string work with nothing to substitute.Work with capabilities as traits, closes #179