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
2.0.38 added Event.Text to Base; a program with its own Text constructor is refused with "duplicate declaration: Text", and the notes do not say so #1913
On 2.0.37 the program builds and prints text:hi <p>. On 2.0.38, 2.0.39 and main (bf35ec3, 2026-10-28, run with bun bend2/main.ts) the same file is refused before any of its code is checked:
Error:
- expected : a fresh constructor name (duplicate declaration: Text)
- observed : 'Text'
Location:
4 | type Node is Data:
5>| Text{s: String}
| ^^^^
6 | Elem{tag: String}
The other declaration is Base's: 2.0.38 gave type Event a Text{text: String} constructor ("Native windows emit Text events", #1019, PR #1441). A constructor name is one namespace with Base, so a Base addition can refuse an existing program that never imports windows. Three things made this cost more than the rename itself:
The 2.0.38 notes mark +RTS, the JS tags and TCP.send as Breaking and say nothing about Text. A new bare constructor name in Base is a breaking change for every program that already uses the name (bend-lint hit the same one: PR fix(lint)!: prefix option constructors to avoid Base collisions #1565).
The error points only at the user's line. It does not say that the other Text is Base's Event.Text, so the first reading is "I declared Text twice", and the search starts in the wrong place.
The guide does not list the bare constructor names Base reserves. Today there are 23 (Chr Close EQ F32 False GT Key LT Look Mouse Move Pix Qua SCon SNil Scroll Succ Text True U32 Unit WNil Zero in 2.0.39's base.bend); Text, Key, Move, Close, Look are ordinary words a DOM, a game or an editor would pick.
What would have avoided the afternoon: a Breaking line in the notes when Base gains a bare constructor name; the error naming the other declaration (Base: Event.Text); and a line in the guide saying Base's constructor names are reserved, with the list or the grep that produces it. Whether a user constructor should be able to shadow Base's, or Base's event constructors should carry a prefix as #1565 did for bend-lint, is your call; the report is about the silence.
The same pattern in 2.0.36: Chan.send answering Result instead of Bool, TCP.recv answering Maybe, and io_eff losing its third argument shipped without a Breaking line (PR #1259). Programs that compiled on 2.0.35 stopped, and for the C effect only clang said so.
The file
importBase# A program with its own `Text` constructor: 2.0.37 builds it, 2.0.38+ refuses it.
type NodeisData:
Text{s: String}
Elem{tag: String}
defshow(n: Node) ->String:
matchn:
caseText{s}:
"text:"++scaseElem{tag}:
"<"++tag++">"defmain() ->IO(Unit):
IO.print(show(Text{"hi"}) ++" "++show(Elem{"p"}))
bend version
bend 2.0.39 (also 2.0.38, and main at bf35ec3 run with bun bend2/main.ts); builds on 2.0.37
Activity
Lorenzobattistela commentedon Oct 29, 2026
Being handled on #1585