Repository: mlange-42/arche
Pull request #219 (2023-04-14 09:00:57)

Rename GetUnsafe/HasUnsafe methods to GetUnchecked/HasUnchecked


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f0d4345..9232b33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,9 +5,9 @@
 ### Features
 
 * Adds method `World.ComponentType(ID)` to get the `reflect.Type` for component IDs (#215)
-* Adds methods `World.GetUnsafe` and `World.HasUnsafe` as optimized variants for known static entities (#217)
-* Adds method `MapX.GetUnsafe` to all generic mappers, as equivalent to previous point (#217)
-* Adds methods `Map.GetUnsafe` and `Map.HasUnsafe` to generic `Map`, as equivalent to previous points (#217)
+* Adds methods `World.GetUnchecked` and `World.HasUnchecked` as optimized variants for known static entities (#217, #218)
+* Adds method `MapX.GetUnchecked` to all generic mappers, as equivalent to previous point (#217, #218)
+* Adds methods `Map.GetUnchecked` and `Map.HasUnchecked` to generic `Map`, as equivalent to previous points (#217, #218)
 
 ### Bugfixes
 
diff --git a/ecs/world.go b/ecs/world.go
index ec53ac3..47de43b 100644
--- a/ecs/world.go
+++ b/ecs/world.go
@@ -325,7 +325,7 @@ func (w *World) Alive(entity Entity) bool {
 //
 // Panics when called for a removed (and potentially recycled) entity.
 //
-// See [World.GetUnsafe] for an optimized version for static entities.
+// See [World.GetUnchecked] for an optimized version for static entities.
 // See also [github.com/mlange-42/arche/generic.Map.Get] for a generic variant.
 func (w *World) Get(entity Entity, comp ID) unsafe.Pointer {
 	if !w.entityPool.Alive(entity) {
@@ -335,17 +335,17 @@ func (w *World) Get(entity Entity, comp ID) unsafe.Pointer {
 	return index.arch.Get(index.index, comp)
 }
 
-// GetUnsafe returns a pointer to the given component of an [Entity].
+// GetUnchecked returns a pointer to the given component of an [Entity].
 // Returns nil if the entity has no such component.
 //
-// GetUnsafe is an optimized version of [World.Get],
+// GetUnchecked is an optimized version of [World.Get],
 // for cases where entities are static or checked with [World.Alive] in user code.
 // It can also be used after getting another component of the same entity with [World.Get].
 //
 // Panics when called for a removed entity, but not for a recycled entity.
 //
 // See also [github.com/mlange-42/arche/generic.Map.Get] for a generic variant.
-func (w *World) GetUnsafe(entity Entity, comp ID) unsafe.Pointer {
+func (w *World) GetUnchecked(entity Entity, comp ID) unsafe.Pointer {
 	index := &w.entities[entity.id]
 	return index.arch.Get(index.index, comp)
 }
@@ -354,7 +354,7 @@ func (w *World) GetUnsafe(entity Entity, comp ID) unsafe.Pointer {
 //
 // Panics when called for a removed (and potentially recycled) entity.
 //
-// See [World.HasUnsafe] for an optimized version for static entities.
+// See [World.HasUnchecked] for an optimized version for static entities.
 // See also [github.com/mlange-42/arche/generic.Map.Has] for a generic variant.
 func (w *World) Has(entity Entity, comp ID) bool {
 	if !w.entityPool.Alive(entity) {
@@ -363,15 +363,15 @@ func (w *World) Has(entity Entity, comp ID) bool {
 	return w.entities[entity.id].arch.HasComponent(comp)
 }
 
-// HasUnsafe returns whether an [Entity] has a given component.
+// HasUnchecked returns whether an [Entity] has a given component.
 //
-// HasUnsafe is an optimized version of [World.Has],
+// HasUnchecked is an optimized version of [World.Has],
 // for cases where entities are static or checked with [World.Alive] in user code.
 //
 // Panics when called for a removed entity, but not for a recycled entity.
 //
 // See also [github.com/mlange-42/arche/generic.Map.Has] for a generic variant.
-func (w *World) HasUnsafe(entity Entity, comp ID) bool {
+func (w *World) HasUnchecked(entity Entity, comp ID) bool {
 	return w.entities[entity.id].arch.HasComponent(comp)
 }
 
diff --git a/generic/generate/main.go b/generic/generate/main.go
index e5f46e3..ef3b043 100644
--- a/generic/generate/main.go
+++ b/generic/generate/main.go
@@ -81,11 +81,11 @@ func generateMaps() {
 		}
 
 		for j := 0; j < i; j++ {
-			returnAll += fmt.Sprintf("(*%s)(m.world.GetUnsafe(entity, m.id%d))", typeLetters[j], j)
+			returnAll += fmt.Sprintf("(*%s)(m.world.GetUnchecked(entity, m.id%d))", typeLetters[j], j)
 			if j == 0 {
 				returnAllSafe += fmt.Sprintf("(*%s)(m.world.Get(entity, m.id%d))", typeLetters[j], j)
 			} else {
-				returnAllSafe += fmt.Sprintf("(*%s)(m.world.GetUnsafe(entity, m.id%d))", typeLetters[j], j)
+				returnAllSafe += fmt.Sprintf("(*%s)(m.world.GetUnchecked(entity, m.id%d))", typeLetters[j], j)
 			}
 			arguments += fmt.Sprintf("%s *%s", strings.ToLower(typeLetters[j]), typeLetters[j])
 			idAssign += fmt.Sprintf("	id%d: ecs.ComponentID[%s](w),\n", j, typeLetters[j])
diff --git a/generic/generate/map.go.txt b/generic/generate/map.go.txt
index f1b7f2d..ecac563 100644
--- a/generic/generate/map.go.txt
+++ b/generic/generate/map.go.txt
@@ -31,19 +31,19 @@ func NewMap{{ .Index }}{{ .TypesFull }}(w *ecs.World) Map{{ .Index }}{{ .Types }
 
 // Get all the Map{{ .Index }}'s components for the given entity.
 //
-// See [Map{{ .Index }}.GetUnsafe] for an optimized version for static entities.
+// See [Map{{ .Index }}.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map{{ .Index }}{{ .Types }}) Get(entity ecs.Entity) ({{ .TypesReturn }}) {
 	return {{ .ReturnAllSafe }}
 }
 
-// GetUnsafe all the Map{{ .Index }}'s components for the given entity.
+// GetUnchecked all the Map{{ .Index }}'s components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map{{ .Index }}.Get],
+// GetUnchecked is an optimized version of [Map{{ .Index }}.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map{{ .Index }}{{ .Types }}) GetUnsafe(entity ecs.Entity) ({{ .TypesReturn }}) {
+// See also [ecs.World.GetUnchecked].
+func (m *Map{{ .Index }}{{ .Types }}) GetUnchecked(entity ecs.Entity) ({{ .TypesReturn }}) {
 	return {{ .ReturnAll }}
 }
 
diff --git a/generic/map.go b/generic/map.go
index 3edc7b5..bdf601b 100644
--- a/generic/map.go
+++ b/generic/map.go
@@ -29,38 +29,38 @@ func (g *Map[T]) ID() ecs.ID {
 
 // Get gets the component for the given entity.
 //
-// See [Map.GetUnsafe] for an optimized version for static entities.
+// See [Map.HasUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (g *Map[T]) Get(entity ecs.Entity) *T {
 	return (*T)(g.world.Get(entity, g.id))
 }
 
-// GetUnsafe gets the component for the given entity.
+// GetUnchecked gets the component for the given entity.
 //
-// GetUnsafe is an optimized version of [Map.Get],
+// GetUnchecked is an optimized version of [Map.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (g *Map[T]) GetUnsafe(entity ecs.Entity) *T {
-	return (*T)(g.world.GetUnsafe(entity, g.id))
+// See also [ecs.World.GetUnchecked].
+func (g *Map[T]) GetUnchecked(entity ecs.Entity) *T {
+	return (*T)(g.world.GetUnchecked(entity, g.id))
 }
 
 // Has returns whether the entity has the component.
 //
-// See [Map.HasUnsafe] for an optimized version for static entities.
+// See [Map.HasUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Has].
 func (g *Map[T]) Has(entity ecs.Entity) bool {
 	return g.world.Has(entity, g.id)
 }
 
-// HasUnsafe returns whether the entity has the component.
+// HasUnchecked returns whether the entity has the component.
 //
-// HasUnsafe is an optimized version of [Map.Has],
+// HasUnchecked is an optimized version of [Map.Has],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.HasUnsafe].
-func (g *Map[T]) HasUnsafe(entity ecs.Entity) bool {
-	return g.world.HasUnsafe(entity, g.id)
+// See also [ecs.World.HasUnchecked].
+func (g *Map[T]) HasUnchecked(entity ecs.Entity) bool {
+	return g.world.HasUnchecked(entity, g.id)
 }
 
 // Set overwrites the component for the given entity.
diff --git a/generic/map_generated.go b/generic/map_generated.go
index c55b822..e4c9a21 100644
--- a/generic/map_generated.go
+++ b/generic/map_generated.go
@@ -38,20 +38,20 @@ func NewMap1[A any](w *ecs.World) Map1[A] {
 
 // Get all the Map1's components for the given entity.
 //
-// See [Map1.GetUnsafe] for an optimized version for static entities.
+// See [Map1.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map1[A]) Get(entity ecs.Entity) *A {
 	return (*A)(m.world.Get(entity, m.id0))
 }
 
-// GetUnsafe all the Map1's components for the given entity.
+// GetUnchecked all the Map1's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map1.Get],
+// GetUnchecked is an optimized version of [Map1.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map1[A]) GetUnsafe(entity ecs.Entity) *A {
-	return (*A)(m.world.GetUnsafe(entity, m.id0))
+// See also [ecs.World.GetUnchecked].
+func (m *Map1[A]) GetUnchecked(entity ecs.Entity) *A {
+	return (*A)(m.world.GetUnchecked(entity, m.id0))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map1's components.
@@ -187,22 +187,22 @@ func NewMap2[A any, B any](w *ecs.World) Map2[A, B] {
 
 // Get all the Map2's components for the given entity.
 //
-// See [Map2.GetUnsafe] for an optimized version for static entities.
+// See [Map2.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map2[A, B]) Get(entity ecs.Entity) (*A, *B) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1))
+		(*B)(m.world.GetUnchecked(entity, m.id1))
 }
 
-// GetUnsafe all the Map2's components for the given entity.
+// GetUnchecked all the Map2's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map2.Get],
+// GetUnchecked is an optimized version of [Map2.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map2[A, B]) GetUnsafe(entity ecs.Entity) (*A, *B) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1))
+// See also [ecs.World.GetUnchecked].
+func (m *Map2[A, B]) GetUnchecked(entity ecs.Entity) (*A, *B) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map2's components.
@@ -348,24 +348,24 @@ func NewMap3[A any, B any, C any](w *ecs.World) Map3[A, B, C] {
 
 // Get all the Map3's components for the given entity.
 //
-// See [Map3.GetUnsafe] for an optimized version for static entities.
+// See [Map3.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map3[A, B, C]) Get(entity ecs.Entity) (*A, *B, *C) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2))
 }
 
-// GetUnsafe all the Map3's components for the given entity.
+// GetUnchecked all the Map3's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map3.Get],
+// GetUnchecked is an optimized version of [Map3.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map3[A, B, C]) GetUnsafe(entity ecs.Entity) (*A, *B, *C) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2))
+// See also [ecs.World.GetUnchecked].
+func (m *Map3[A, B, C]) GetUnchecked(entity ecs.Entity) (*A, *B, *C) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map3's components.
@@ -519,26 +519,26 @@ func NewMap4[A any, B any, C any, D any](w *ecs.World) Map4[A, B, C, D] {
 
 // Get all the Map4's components for the given entity.
 //
-// See [Map4.GetUnsafe] for an optimized version for static entities.
+// See [Map4.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map4[A, B, C, D]) Get(entity ecs.Entity) (*A, *B, *C, *D) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3))
 }
 
-// GetUnsafe all the Map4's components for the given entity.
+// GetUnchecked all the Map4's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map4.Get],
+// GetUnchecked is an optimized version of [Map4.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map4[A, B, C, D]) GetUnsafe(entity ecs.Entity) (*A, *B, *C, *D) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3))
+// See also [ecs.World.GetUnchecked].
+func (m *Map4[A, B, C, D]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map4's components.
@@ -700,28 +700,28 @@ func NewMap5[A any, B any, C any, D any, E any](w *ecs.World) Map5[A, B, C, D, E
 
 // Get all the Map5's components for the given entity.
 //
-// See [Map5.GetUnsafe] for an optimized version for static entities.
+// See [Map5.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map5[A, B, C, D, E]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4))
 }
 
-// GetUnsafe all the Map5's components for the given entity.
+// GetUnchecked all the Map5's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map5.Get],
+// GetUnchecked is an optimized version of [Map5.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map5[A, B, C, D, E]) GetUnsafe(entity ecs.Entity) (*A, *B, *C, *D, *E) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4))
+// See also [ecs.World.GetUnchecked].
+func (m *Map5[A, B, C, D, E]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map5's components.
@@ -891,30 +891,30 @@ func NewMap6[A any, B any, C any, D any, E any, F any](w *ecs.World) Map6[A, B,
 
 // Get all the Map6's components for the given entity.
 //
-// See [Map6.GetUnsafe] for an optimized version for static entities.
+// See [Map6.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map6[A, B, C, D, E, F]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5))
 }
 
-// GetUnsafe all the Map6's components for the given entity.
+// GetUnchecked all the Map6's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map6.Get],
+// GetUnchecked is an optimized version of [Map6.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map6[A, B, C, D, E, F]) GetUnsafe(entity ecs.Entity) (*A, *B, *C, *D, *E, *F) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5))
+// See also [ecs.World.GetUnchecked].
+func (m *Map6[A, B, C, D, E, F]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map6's components.
@@ -1092,32 +1092,32 @@ func NewMap7[A any, B any, C any, D any, E any, F any, G any](w *ecs.World) Map7
 
 // Get all the Map7's components for the given entity.
 //
-// See [Map7.GetUnsafe] for an optimized version for static entities.
+// See [Map7.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map7[A, B, C, D, E, F, G]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5)),
-		(*G)(m.world.GetUnsafe(entity, m.id6))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5)),
+		(*G)(m.world.GetUnchecked(entity, m.id6))
 }
 
-// GetUnsafe all the Map7's components for the given entity.
+// GetUnchecked all the Map7's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map7.Get],
+// GetUnchecked is an optimized version of [Map7.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map7[A, B, C, D, E, F, G]) GetUnsafe(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5)),
-		(*G)(m.world.GetUnsafe(entity, m.id6))
+// See also [ecs.World.GetUnchecked].
+func (m *Map7[A, B, C, D, E, F, G]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5)),
+		(*G)(m.world.GetUnchecked(entity, m.id6))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map7's components.
@@ -1303,34 +1303,34 @@ func NewMap8[A any, B any, C any, D any, E any, F any, G any, H any](w *ecs.Worl
 
 // Get all the Map8's components for the given entity.
 //
-// See [Map8.GetUnsafe] for an optimized version for static entities.
+// See [Map8.GetUnchecked] for an optimized version for static entities.
 // See also [ecs.World.Get].
 func (m *Map8[A, B, C, D, E, F, G, H]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H) {
 	return (*A)(m.world.Get(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5)),
-		(*G)(m.world.GetUnsafe(entity, m.id6)),
-		(*H)(m.world.GetUnsafe(entity, m.id7))
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5)),
+		(*G)(m.world.GetUnchecked(entity, m.id6)),
+		(*H)(m.world.GetUnchecked(entity, m.id7))
 }
 
-// GetUnsafe all the Map8's components for the given entity.
+// GetUnchecked all the Map8's components for the given entity.
 //
-// GetUnsafe is an optimized version of [Map8.Get],
+// GetUnchecked is an optimized version of [Map8.Get],
 // for cases where entities are static or checked with [ecs.World.Alive] in user code.
 //
-// See also [ecs.World.GetUnsafe].
-func (m *Map8[A, B, C, D, E, F, G, H]) GetUnsafe(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H) {
-	return (*A)(m.world.GetUnsafe(entity, m.id0)),
-		(*B)(m.world.GetUnsafe(entity, m.id1)),
-		(*C)(m.world.GetUnsafe(entity, m.id2)),
-		(*D)(m.world.GetUnsafe(entity, m.id3)),
-		(*E)(m.world.GetUnsafe(entity, m.id4)),
-		(*F)(m.world.GetUnsafe(entity, m.id5)),
-		(*G)(m.world.GetUnsafe(entity, m.id6)),
-		(*H)(m.world.GetUnsafe(entity, m.id7))
+// See also [ecs.World.GetUnchecked].
+func (m *Map8[A, B, C, D, E, F, G, H]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H) {
+	return (*A)(m.world.GetUnchecked(entity, m.id0)),
+		(*B)(m.world.GetUnchecked(entity, m.id1)),
+		(*C)(m.world.GetUnchecked(entity, m.id2)),
+		(*D)(m.world.GetUnchecked(entity, m.id3)),
+		(*E)(m.world.GetUnchecked(entity, m.id4)),
+		(*F)(m.world.GetUnchecked(entity, m.id5)),
+		(*G)(m.world.GetUnchecked(entity, m.id6)),
+		(*H)(m.world.GetUnchecked(entity, m.id7))
 }
 
 // NewEntity creates a new [ecs.Entity] with the Map8's components.


Test patch:
diff --git a/benchmark/arche/iterate_world/arche_test.go b/benchmark/arche/iterate_world/arche_test.go
index cc10bca..b42d3b6 100644
--- a/benchmark/arche/iterate_world/arche_test.go
+++ b/benchmark/arche/iterate_world/arche_test.go
@@ -52,7 +52,7 @@ func runArcheWorldGetGeneric(b *testing.B, count int) {
 	}
 }
 
-func runArcheWorldGetUnsafe(b *testing.B, count int) {
+func runArcheWorldGetUnchecked(b *testing.B, count int) {
 	b.StopTimer()
 	world := ecs.NewWorld()
 
@@ -67,13 +67,13 @@ func runArcheWorldGetUnsafe(b *testing.B, count int) {
 
 	for i := 0; i < b.N; i++ {
 		for _, e := range entities {
-			pos := (*c.Position)(world.GetUnsafe(e, posID))
+			pos := (*c.Position)(world.GetUnchecked(e, posID))
 			pos.X = 1
 		}
 	}
 }
 
-func runArcheWorldGetGenericUnsafe(b *testing.B, count int) {
+func runArcheWorldGetGenericUnchecked(b *testing.B, count int) {
 	b.StopTimer()
 	world := ecs.NewWorld()
 
@@ -90,7 +90,7 @@ func runArcheWorldGetGenericUnsafe(b *testing.B, count int) {
 
 	for i := 0; i < b.N; i++ {
 		for _, e := range entities {
-			pos := get.GetUnsafe(e)
+			pos := get.GetUnchecked(e)
 			pos.X = 1
 		}
 	}
@@ -120,26 +120,26 @@ func BenchmarkArcheIterWorldGeneric_100_000(b *testing.B) {
 	runArcheWorldGetGeneric(b, 100000)
 }
 
-func BenchmarkArcheIterWorldIDUnsafe_1_000(b *testing.B) {
-	runArcheWorldGetUnsafe(b, 1000)
+func BenchmarkArcheIterWorldIDUnchecked_1_000(b *testing.B) {
+	runArcheWorldGetUnchecked(b, 1000)
 }
 
-func BenchmarkArcheIterWorldIDUnsafe_10_000(b *testing.B) {
-	runArcheWorldGetUnsafe(b, 10000)
+func BenchmarkArcheIterWorldIDUnchecked_10_000(b *testing.B) {
+	runArcheWorldGetUnchecked(b, 10000)
 }
 
-func BenchmarkArcheIterWorldIDUnsafe_100_000(b *testing.B) {
-	runArcheWorldGetUnsafe(b, 100000)
+func BenchmarkArcheIterWorldIDUnchecked_100_000(b *testing.B) {
+	runArcheWorldGetUnchecked(b, 100000)
 }
 
-func BenchmarkArcheIterWorldGenericUnsafe_1_000(b *testing.B) {
-	runArcheWorldGetGenericUnsafe(b, 1000)
+func BenchmarkArcheIterWorldGenericUnchecked_1_000(b *testing.B) {
+	runArcheWorldGetGenericUnchecked(b, 1000)
 }
 
-func BenchmarkArcheIterWorldGenericUnsafe_10_000(b *testing.B) {
-	runArcheWorldGetGenericUnsafe(b, 10000)
+func BenchmarkArcheIterWorldGenericUnchecked_10_000(b *testing.B) {
+	runArcheWorldGetGenericUnchecked(b, 10000)
 }
 
-func BenchmarkArcheIterWorldGenericUnsafe_100_000(b *testing.B) {
-	runArcheWorldGetGenericUnsafe(b, 100000)
+func BenchmarkArcheIterWorldGenericUnchecked_100_000(b *testing.B) {
+	runArcheWorldGetGenericUnchecked(b, 100000)
 }
diff --git a/ecs/world_test.go b/ecs/world_test.go
index 130e66b..f9f5117 100644
--- a/ecs/world_test.go
+++ b/ecs/world_test.go
@@ -312,8 +312,8 @@ func TestWorldGetComponents(t *testing.T) {
 
 	assert.False(t, w.Has(e2, posID))
 	assert.True(t, w.Has(e2, rotID))
-	assert.False(t, w.HasUnsafe(e2, posID))
-	assert.True(t, w.HasUnsafe(e2, rotID))
+	assert.False(t, w.HasUnchecked(e2, posID))
+	assert.True(t, w.HasUnchecked(e2, rotID))
 
 	pos1 := (*Position)(w.Get(e1, posID))
 	assert.Equal(t, &Position{}, pos1)
@@ -326,8 +326,8 @@ func TestWorldGetComponents(t *testing.T) {
 	assert.Equal(t, &Position{}, pos0)
 	assert.Equal(t, &Position{100, 101}, pos1)
 
-	pos0 = (*Position)(w.GetUnsafe(e0, posID))
-	pos1 = (*Position)(w.GetUnsafe(e1, posID))
+	pos0 = (*Position)(w.GetUnchecked(e0, posID))
+	pos1 = (*Position)(w.GetUnchecked(e1, posID))
 	assert.Equal(t, &Position{}, pos0)
 	assert.Equal(t, &Position{100, 101}, pos1)
 
diff --git a/generic/map_generated_test.go b/generic/map_generated_test.go
index bc89c51..e308dab 100644
--- a/generic/map_generated_test.go
+++ b/generic/map_generated_test.go
@@ -43,7 +43,7 @@ func TestMap1Generated(t *testing.T) {
 	q = mut.NewEntitiesWithQuery(2, &testStruct0{})
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	cnt := mut.RemoveEntities(true)
 	assert.Equal(t, 11, cnt)
@@ -98,7 +98,7 @@ func TestMap2Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -157,7 +157,7 @@ func TestMap3Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -216,7 +216,7 @@ func TestMap4Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -282,7 +282,7 @@ func TestMap5Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -348,7 +348,7 @@ func TestMap6Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -414,7 +414,7 @@ func TestMap7Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
@@ -480,7 +480,7 @@ func TestMap8Generated(t *testing.T) {
 	)
 	q.Close()
 
-	mut.GetUnsafe(e)
+	mut.GetUnchecked(e)
 
 	mut.RemoveEntities(true)
 	mut.RemoveEntities(false)
diff --git a/generic/map_test.go b/generic/map_test.go
index bdc9e21..296f005 100644
--- a/generic/map_test.go
+++ b/generic/map_test.go
@@ -21,8 +21,8 @@ func TestGenericMap(t *testing.T) {
 	_ = get.Get(e0)
 	assert.True(t, has)
 
-	has = get.HasUnsafe(e0)
-	_ = get.GetUnsafe(e0)
+	has = get.HasUnchecked(e0)
+	_ = get.GetUnchecked(e0)
 	assert.True(t, has)
 
 	_ = get.Set(e0, &testStruct0{100})
@@ -57,7 +57,7 @@ func ExampleMap() {
 	pos.X, pos.Y = 10, 5
 
 	// Get the map's component, optimized for cases when the entity is guaranteed to be still alive.
-	pos = mapper.GetUnsafe(entity)
+	pos = mapper.GetUnchecked(entity)
 	pos.X, pos.Y = 10, 5
 	// Output:
 }