Repository navigation
1.6.0
Four gaps a consumer reported, and two bugs found while closing them.
List<T>.[a, b],xs[i],len,pushandfor … inare language forms rather than a module, so there is nostd/collections— that entry was listed inSTD_MODULESand in the language reference for as long as neither existed, and it is gone rather than filled in. The list is invariant: aList<Wolf>is not aList<Dog>, because with covariance aDogcould be pushed through a reference whose real list holdsWolf, and record subtyping is sound here partly because that cannot happen. An index past the end throws, for the reason integer overflow does.pushneeds amutbinding, because growing a list writes to the container.breakandcontinue. No labels; a jump always means the loop it is written in. Abreakout of a query loop finishes walking the cursor first — the protocol generated code speaks has no release call, so a cursor is returned to the pool whenecs.nextreports exhaustion and by no other route, and leaving early would keep one per frame.- Module constants. A
letat the top of a file, exported, and importable the way a function is. Its value is arithmetic over literals and other constants; a call cannot run before a module's host is bound. Declaration order carries no meaning, so they are emitted in dependency order and a cycle is refused naming every constant in it.varat this level is refused. - A component reached through a handle now compiles to a read.
who.Placement.xoutside a query loop emittedwho.Placement.x— a property of a number. It type-checked, it linked, and it threw the moment it ran; a helper taking anEntityand writing a component is a documented pattern that produced broken code, and nothing had executed one. It lowers toecs.readandecs.writeinstead, which is what a consumer was writing by hand with the component and field as strings — the same calls, with both names checked. - A function can take a row of a component.
fn advance(m: mut Placement, dx: f64), called asadvance(e.Placement, 1)— the signature says which component the helper touches,mutsays whether it writes, and the caller's system is checked to have declared it. A row lowers to a world and a handle, so the body'sm.xis the sameecs.reada handle access is. - A component row is not a value, and now it is refused as one.
entities.tshad asserted that in a comment since the entity model shipped and nothing enforced it, solet m = e.Placementcompiled to a property read of a number. Holding one or returning one is an error naming the two things a row can do. - A capability may return
Entity. The registry path resolved the name to a primitive where a written annotation resolved it to the handle kind, so a host that returned a handle got a type on which.Componentwas refused with "Entityhas no fields". The two resolvers disagreed about one word and only one of them had ever been exercised. - A system's declared access is added to its metadata, not only checked against inference. A capability naming a component with a string is invisible to inference, so the component never reached the metadata and a host enforcing declared access refused the call at runtime — with no way for the author to grant it, because writing
reads Positionwas checked and then dropped.
Two things a consumer has to change. A helper that reaches a component through a handle now takes a World parameter, because that is what the read runs against; the form it replaces could not run. And a .drs file that imported std/collections was already failing per name and now fails at the module.