From 230d1abfe39152712039f188d2d374f6374f1f9f Mon Sep 17 00:00:00 2001 From: copygirl Date: Thu, 29 Dec 2022 11:21:03 +0100 Subject: [PATCH] Rename Identifier to Id --- src/gaemstone.ECS/Entity.cs | 2 +- src/gaemstone.ECS/EntityBase.cs | 30 ++++++------ src/gaemstone.ECS/EntityBuilder.cs | 28 +++++------ src/gaemstone.ECS/EntityPath.cs | 2 +- src/gaemstone.ECS/EntityRef.cs | 26 +++++----- src/gaemstone.ECS/EntityType.cs | 6 +-- src/gaemstone.ECS/{Identifier.cs => Id.cs} | 30 ++++++------ src/gaemstone.ECS/IdRef.cs | 55 ++++++++++++++++++++++ src/gaemstone.ECS/IdentifierRef.cs | 55 ---------------------- src/gaemstone.ECS/Iterator.cs | 4 +- src/gaemstone.ECS/Term.cs | 10 ++-- 11 files changed, 124 insertions(+), 124 deletions(-) rename src/gaemstone.ECS/{Identifier.cs => Id.cs} (53%) create mode 100644 src/gaemstone.ECS/IdRef.cs delete mode 100644 src/gaemstone.ECS/IdentifierRef.cs diff --git a/src/gaemstone.ECS/Entity.cs b/src/gaemstone.ECS/Entity.cs index 5eef0d9..3a1728d 100644 --- a/src/gaemstone.ECS/Entity.cs +++ b/src/gaemstone.ECS/Entity.cs @@ -27,6 +27,6 @@ public readonly struct Entity public static bool operator !=(Entity left, Entity right) => !left.Equals(right); public static implicit operator ecs_entity_t(Entity e) => e.Value; - public static implicit operator Identifier(Entity e) => new(e.Value.Data); + public static implicit operator Id(Entity e) => new(e.Value.Data); public static implicit operator ecs_id_t(Entity e) => e.Value.Data; } diff --git a/src/gaemstone.ECS/EntityBase.cs b/src/gaemstone.ECS/EntityBase.cs index def9ce6..a710c6a 100644 --- a/src/gaemstone.ECS/EntityBase.cs +++ b/src/gaemstone.ECS/EntityBase.cs @@ -5,36 +5,36 @@ public abstract class EntityBase public abstract World World { get; } - public abstract TReturn Add(Identifier id); - public abstract TReturn Remove(Identifier id); - public abstract bool Has(Identifier id); + public abstract TReturn Add(Id id); + public abstract TReturn Remove(Id id); + public abstract bool Has(Id id); public TReturn Add(string symbol) => Add(World.LookupBySymbolOrThrow(symbol)); public TReturn Add() => Add(World.LookupByTypeOrThrow(typeof(T))); - public TReturn Add(Entity relation, Entity target) => Add(Identifier.Pair(relation, target)); + public TReturn Add(Entity relation, Entity target) => Add(Id.Pair(relation, target)); public TReturn Add(Entity target) => Add(World.LookupByTypeOrThrow(), target); public TReturn Add() => Add(World.LookupByTypeOrThrow(), World.LookupByTypeOrThrow()); public TReturn Remove(string symbol) => Remove(World.LookupBySymbolOrThrow(symbol)); public TReturn Remove() => Remove(World.LookupByTypeOrThrow(typeof(T))); - public TReturn Remove(Entity relation, Entity target) => Remove(Identifier.Pair(relation, target)); + public TReturn Remove(Entity relation, Entity target) => Remove(Id.Pair(relation, target)); public TReturn Remove(Entity target) => Remove(World.LookupByTypeOrThrow(), target); public TReturn Remove() => Remove(World.LookupByTypeOrThrow(), World.LookupByTypeOrThrow()); public bool Has(string symbol) => Has(World.LookupBySymbolOrThrow(symbol)); public bool Has() => Has(World.LookupByTypeOrThrow(typeof(T))); - public bool Has(Entity relation, Entity target) => Has(Identifier.Pair(relation, target)); + public bool Has(Entity relation, Entity target) => Has(Id.Pair(relation, target)); public bool Has(Entity target) => Has(World.LookupByTypeOrThrow(), target); public bool Has() => Has(World.LookupByTypeOrThrow(), World.LookupByTypeOrThrow()); - public abstract T? GetOrNull(Identifier id) where T : unmanaged; - public abstract T? GetOrNull(Identifier id, T _ = null!) where T : class; - public abstract T GetOrThrow(Identifier id); - public abstract ref T GetMut(Identifier id) where T : unmanaged; - public abstract ref T GetRefOrNull(Identifier id) where T : unmanaged; - public abstract ref T GetRefOrThrow(Identifier id) where T : unmanaged; - public abstract void Modified(Identifier id); + public abstract T? GetOrNull(Id id) where T : unmanaged; + public abstract T? GetOrNull(Id id, T _ = null!) where T : class; + public abstract T GetOrThrow(Id id); + public abstract ref T GetMut(Id id) where T : unmanaged; + public abstract ref T GetRefOrNull(Id id) where T : unmanaged; + public abstract ref T GetRefOrThrow(Id id) where T : unmanaged; + public abstract void Modified(Id id); public T? GetOrNull() where T : unmanaged => GetOrNull(World.LookupByTypeOrThrow()); public T? GetOrNull(T _ = null!) where T : class => GetOrNull(World.LookupByTypeOrThrow()); @@ -45,8 +45,8 @@ public abstract class EntityBase public void Modified() => Modified(World.LookupByTypeOrThrow()); - public abstract TReturn Set(Identifier id, in T value) where T : unmanaged; - public abstract TReturn Set(Identifier id, T obj) where T : class; + public abstract TReturn Set(Id id, in T value) where T : unmanaged; + public abstract TReturn Set(Id id, T obj) where T : class; public TReturn Set(in T value) where T : unmanaged => Set(World.LookupByTypeOrThrow(), value); public TReturn Set(T obj) where T : class => Set(World.LookupByTypeOrThrow(), obj); diff --git a/src/gaemstone.ECS/EntityBuilder.cs b/src/gaemstone.ECS/EntityBuilder.cs index e00ef17..5890379 100644 --- a/src/gaemstone.ECS/EntityBuilder.cs +++ b/src/gaemstone.ECS/EntityBuilder.cs @@ -37,7 +37,7 @@ public class EntityBuilder public bool UseLowId { get; set; } /// Ids to add to the new or existing entity. - private readonly HashSet _toAdd = new(); + private readonly HashSet _toAdd = new(); private Entity _parent = Entity.None; /// String expression with components to add. @@ -49,7 +49,7 @@ public class EntityBuilder public EntityBuilder(World world, EntityPath? path = null) { World = world; Path = path; } - public override EntityBuilder Add(Identifier id) + public override EntityBuilder Add(Id id) { // If adding a ChildOf relation, store the parent separately. if (id.AsPair(World) is (EntityRef relation, EntityRef target) && @@ -61,25 +61,25 @@ public class EntityBuilder return this; } - public override EntityBuilder Remove(Identifier id) + public override EntityBuilder Remove(Id id) => throw new NotSupportedException(); - public override bool Has(Identifier id) + public override bool Has(Id id) => !id.IsWildcard ? _toAdd.Contains(id) : throw new NotSupportedException(); // TODO: Support wildcard. - public override T? GetOrNull(Identifier id) => throw new NotSupportedException(); - public override T? GetOrNull(Identifier id, T _ = null!) where T : class => throw new NotSupportedException(); - public override T GetOrThrow(Identifier id) => throw new NotSupportedException(); - public override ref T GetMut(Identifier id) => throw new NotSupportedException(); - public override ref T GetRefOrNull(Identifier id) => throw new NotSupportedException(); - public override ref T GetRefOrThrow(Identifier id) => throw new NotSupportedException(); - public override void Modified(Identifier id) => throw new NotImplementedException(); + public override T? GetOrNull(Id id) => throw new NotSupportedException(); + public override T? GetOrNull(Id id, T _ = null!) where T : class => throw new NotSupportedException(); + public override T GetOrThrow(Id id) => throw new NotSupportedException(); + public override ref T GetMut(Id id) => throw new NotSupportedException(); + public override ref T GetRefOrNull(Id id) => throw new NotSupportedException(); + public override ref T GetRefOrThrow(Id id) => throw new NotSupportedException(); + public override void Modified(Id id) => throw new NotImplementedException(); - public override EntityBuilder Set(Identifier id, in T value) + public override EntityBuilder Set(Id id, in T value) // "in" can't be used with lambdas, so we make a local copy. { var copy = value; _toSet.Add(e => e.Set(id, copy)); return this; } - public override EntityBuilder Set(Identifier id, T obj) + public override EntityBuilder Set(Id id, T obj) { _toSet.Add(e => e.Set(id, obj)); return this; } public unsafe EntityRef Build() @@ -104,7 +104,7 @@ public class EntityBuilder }; var add = desc.add; var index = 0; - if (parent.IsSome) add[index++] = Identifier.Pair(World.ChildOf, parent); + if (parent.IsSome) add[index++] = ECS.Id.Pair(World.ChildOf, parent); foreach (var id in _toAdd) add[index++] = id; var entityId = ecs_entity_init(World, &desc); diff --git a/src/gaemstone.ECS/EntityPath.cs b/src/gaemstone.ECS/EntityPath.cs index 345157b..bcbd57d 100644 --- a/src/gaemstone.ECS/EntityPath.cs +++ b/src/gaemstone.ECS/EntityPath.cs @@ -170,7 +170,7 @@ public class EntityPath fixed (byte* ptr = part.AsSpan()) if (skipLookup || (parent = new(ecs_lookup_child(world, parent, ptr))).IsNone) { var desc = new ecs_entity_desc_t { name = ptr, sep = CStringExtensions.ETX }; - if (parent.IsSome) desc.add[0] = Identifier.Pair(world.ChildOf, parent); + if (parent.IsSome) desc.add[0] = Id.Pair(world.ChildOf, parent); parent = new(ecs_entity_init(world, &desc)); skipLookup = true; } diff --git a/src/gaemstone.ECS/EntityRef.cs b/src/gaemstone.ECS/EntityRef.cs index 67a4e60..2e3c2b9 100644 --- a/src/gaemstone.ECS/EntityRef.cs +++ b/src/gaemstone.ECS/EntityRef.cs @@ -74,24 +74,24 @@ public unsafe class EntityRef } - public override EntityRef Add(Identifier id) { ecs_add_id(World, this, id); return this; } - public override EntityRef Remove(Identifier id) { ecs_remove_id(World, this, id); return this; } - public override bool Has(Identifier id) => ecs_has_id(World, this, id); + public override EntityRef Add(Id id) { ecs_add_id(World, this, id); return this; } + public override EntityRef Remove(Id id) { ecs_remove_id(World, this, id); return this; } + public override bool Has(Id id) => ecs_has_id(World, this, id); - public override T? GetOrNull(Identifier id) + public override T? GetOrNull(Id id) { var ptr = ecs_get_id(World, this, id); return (ptr != null) ? Unsafe.Read(ptr) : null; } - public override T? GetOrNull(Identifier id, T _ = null!) + public override T? GetOrNull(Id id, T _ = null!) where T : class { var ptr = ecs_get_id(World, this, id); return (ptr != null) ? (T)((GCHandle)Unsafe.Read(ptr)).Target! : null; } - public override T GetOrThrow(Identifier id) + public override T GetOrThrow(Id id) { var ptr = ecs_get_id(World, this, id); if (ptr == null) throw new Exception($"Component {typeof(T)} not found on {this}"); @@ -99,14 +99,14 @@ public unsafe class EntityRef : (T)((GCHandle)Unsafe.Read(ptr)).Target!; } - public override ref T GetRefOrNull(Identifier id) + public override ref T GetRefOrNull(Id id) { var @ref = ecs_ref_init_id(World, this, id); var ptr = ecs_ref_get_id(World, &@ref, id); return ref (ptr != null) ? ref Unsafe.AsRef(ptr) : ref Unsafe.NullRef(); } - public override ref T GetRefOrThrow(Identifier id) + public override ref T GetRefOrThrow(Id id) { ref var ptr = ref GetRefOrNull(id); if (Unsafe.IsNullRef(ref ptr)) throw new Exception( @@ -114,17 +114,17 @@ public unsafe class EntityRef return ref ptr; } - public override ref T GetMut(Identifier id) + public override ref T GetMut(Id id) { var ptr = ecs_get_mut_id(World, this, id); // NOTE: Value is added if it doesn't exist on the entity. return ref Unsafe.AsRef(ptr); } - public override void Modified(Identifier id) + public override void Modified(Id id) => ecs_modified_id(World, this, id); - public override EntityRef Set(Identifier id, in T value) + public override EntityRef Set(Id id, in T value) { var size = (ulong)Unsafe.SizeOf(); fixed (T* ptr = &value) @@ -133,7 +133,7 @@ public unsafe class EntityRef return this; } - public override EntityRef Set(Identifier id, T obj) where T : class + public override EntityRef Set(Id id, T obj) where T : class { var handle = (nint)GCHandle.Alloc(obj); // FIXME: Previous handle needs to be freed. @@ -163,6 +163,6 @@ public unsafe class EntityRef public static implicit operator Entity(EntityRef? e) => e?.Entity ?? default; public static implicit operator ecs_entity_t(EntityRef? e) => e?.Entity.Value ?? default; - public static implicit operator Identifier(EntityRef? e) => new(e?.Entity.Value.Data ?? default); + public static implicit operator Id(EntityRef? e) => new(e?.Entity.Value.Data ?? default); public static implicit operator ecs_id_t(EntityRef? e) => e?.Entity.Value.Data ?? default; } diff --git a/src/gaemstone.ECS/EntityType.cs b/src/gaemstone.ECS/EntityType.cs index 06e9417..fb34df3 100644 --- a/src/gaemstone.ECS/EntityType.cs +++ b/src/gaemstone.ECS/EntityType.cs @@ -6,7 +6,7 @@ using static flecs_hub.flecs; namespace gaemstone.ECS; public unsafe readonly struct EntityType - : IReadOnlyList + : IReadOnlyList { public World World { get; } public ecs_type_t* Handle { get; } @@ -19,7 +19,7 @@ public unsafe readonly struct EntityType // IReadOnlyList implementation public int Count => Handle->count; - public IdentifierRef this[int index] => new(World, new(Handle->array[index])); - public IEnumerator GetEnumerator() { for (var i = 0; i < Count; i++) yield return this[i]; } + public IdRef this[int index] => new(World, new(Handle->array[index])); + public IEnumerator GetEnumerator() { for (var i = 0; i < Count; i++) yield return this[i]; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/src/gaemstone.ECS/Identifier.cs b/src/gaemstone.ECS/Id.cs similarity index 53% rename from src/gaemstone.ECS/Identifier.cs rename to src/gaemstone.ECS/Id.cs index 516bd68..ac57d12 100644 --- a/src/gaemstone.ECS/Identifier.cs +++ b/src/gaemstone.ECS/Id.cs @@ -3,49 +3,49 @@ using static flecs_hub.flecs; namespace gaemstone.ECS; -public readonly struct Identifier - : IEquatable +public readonly struct Id + : IEquatable { public readonly ecs_id_t Value; public bool IsPair => ecs_id_is_pair(this); public bool IsWildcard => ecs_id_is_wildcard(this); - public IdentifierFlags Flags => (IdentifierFlags)(Value & ECS_ID_FLAGS_MASK); + public IdFlags Flags => (IdFlags)(Value & ECS_ID_FLAGS_MASK); public Entity RelationUnsafe => new(new() { Data = (Value & ECS_COMPONENT_MASK) >> 32 }); public Entity TargetUnsafe => new(new() { Data = Value & ECS_ENTITY_MASK }); - public Identifier(ecs_id_t value) => Value = value; + public Id(ecs_id_t value) => Value = value; - public static Identifier Combine(IdentifierFlags flags, Identifier id) + public static Id Combine(IdFlags flags, Id id) => new((ulong)flags | id.Value); - public static Identifier Pair(Entity relation, Entity target) - => Combine(IdentifierFlags.Pair, new( + public static Id Pair(Entity relation, Entity target) + => Combine(IdFlags.Pair, new( ((relation.Value.Data << 32) & ECS_COMPONENT_MASK) | ( target.Value.Data & ECS_ENTITY_MASK ))); public EntityRef? AsEntity(World world) - => new IdentifierRef(world, this).AsEntity(); + => new IdRef(world, this).AsEntity(); public (EntityRef Relation, EntityRef Target)? AsPair(World world) - => new IdentifierRef(world, this).AsPair(); + => new IdRef(world, this).AsPair(); - public bool Equals(Identifier other) => Value.Data == other.Value.Data; - public override bool Equals(object? obj) => (obj is Identifier other) && Equals(other); + public bool Equals(Id other) => Value.Data == other.Value.Data; + public override bool Equals(object? obj) => (obj is Id other) && Equals(other); public override int GetHashCode() => Value.Data.GetHashCode(); public override string? ToString() => (Flags != default) ? $"Identifier(0x{Value.Data:X}, Flags={Flags})" : $"Identifier(0x{Value.Data:X})"; - public static bool operator ==(Identifier left, Identifier right) => left.Equals(right); - public static bool operator !=(Identifier left, Identifier right) => !left.Equals(right); + public static bool operator ==(Id left, Id right) => left.Equals(right); + public static bool operator !=(Id left, Id right) => !left.Equals(right); - public static implicit operator ecs_id_t(Identifier i) => i.Value; + public static implicit operator ecs_id_t(Id i) => i.Value; } [Flags] -public enum IdentifierFlags : ulong +public enum IdFlags : ulong { Pair = 1ul << 63, Override = 1ul << 62, diff --git a/src/gaemstone.ECS/IdRef.cs b/src/gaemstone.ECS/IdRef.cs new file mode 100644 index 0000000..2115a70 --- /dev/null +++ b/src/gaemstone.ECS/IdRef.cs @@ -0,0 +1,55 @@ +using System; +using gaemstone.Utility; +using static flecs_hub.flecs; + +namespace gaemstone.ECS; + +public unsafe class IdRef + : IEquatable +{ + public World World { get; } + public Id Id { get; } + + public IdFlags Flags => Id.Flags; + public bool IsPair => Id.IsPair; + public bool IsWildcard => Id.IsWildcard; + public bool IsValid => ecs_id_is_valid(World, this); + + public bool IsInUse => ecs_id_in_use(World, this); + public int Count => ecs_count_id(World, this); + + public IdRef(World world, Id id) + { World = world; Id = id; } + + public static IdRef Combine(IdFlags flags, IdRef id) + => new(id.World, Id.Combine(flags, id)); + + public static IdRef Pair(World world, Entity relation, Entity target) + => new(world, Id.Pair(relation, target)); + public static IdRef Pair(EntityRef relation, EntityRef target) + => Pair(relation.World, relation, target); + public static IdRef Pair(EntityRef relation, Entity target) + => Pair(relation.World, relation, target); + public static IdRef Pair(Entity relation, EntityRef target) + => Pair(target.World, relation, target); + public static IdRef Pair(EntityRef target) + => Pair(target.World.LookupByTypeOrThrow(), target); + + public EntityRef? AsEntity() + => (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null; + public (EntityRef Relation, EntityRef Target)? AsPair() + => IsPair && (World.LookupAlive(Id.RelationUnsafe) is EntityRef relation) && + (World.LookupAlive(Id.TargetUnsafe ) is EntityRef target ) + ? (relation, target) : null; + + public bool Equals(IdRef? other) => (other is not null) && (World == other.World) && (Id == other.Id); + public override bool Equals(object? obj) => Equals(obj as IdRef); + public override int GetHashCode() => HashCode.Combine(World, Id); + public override string? ToString() => ecs_id_str(World, this).FlecsToStringAndFree()!; + + public static bool operator ==(IdRef? left, IdRef? right) => ReferenceEquals(left, right) || (left?.Equals(right) ?? false); + public static bool operator !=(IdRef? left, IdRef? right) => !(left == right); + + public static implicit operator Id(IdRef i) => i.Id; + public static implicit operator ecs_id_t(IdRef i) => i.Id.Value; +} diff --git a/src/gaemstone.ECS/IdentifierRef.cs b/src/gaemstone.ECS/IdentifierRef.cs deleted file mode 100644 index 667ac22..0000000 --- a/src/gaemstone.ECS/IdentifierRef.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using gaemstone.Utility; -using static flecs_hub.flecs; - -namespace gaemstone.ECS; - -public unsafe class IdentifierRef - : IEquatable -{ - public World World { get; } - public Identifier Id { get; } - - public IdentifierFlags Flags => Id.Flags; - public bool IsPair => Id.IsPair; - public bool IsWildcard => Id.IsWildcard; - public bool IsValid => ecs_id_is_valid(World, this); - - public bool IsInUse => ecs_id_in_use(World, this); - public int Count => ecs_count_id(World, this); - - public IdentifierRef(World world, Identifier id) - { World = world; Id = id; } - - public static IdentifierRef Combine(IdentifierFlags flags, IdentifierRef id) - => new(id.World, Identifier.Combine(flags, id)); - - public static IdentifierRef Pair(World world, Entity relation, Entity target) - => new(world, Identifier.Pair(relation, target)); - public static IdentifierRef Pair(EntityRef relation, EntityRef target) - => Pair(relation.World, relation, target); - public static IdentifierRef Pair(EntityRef relation, Entity target) - => Pair(relation.World, relation, target); - public static IdentifierRef Pair(Entity relation, EntityRef target) - => Pair(target.World, relation, target); - public static IdentifierRef Pair(EntityRef target) - => Pair(target.World.LookupByTypeOrThrow(), target); - - public EntityRef? AsEntity() - => (Flags == default) ? World.LookupAlive(new Entity(new() { Data = Id })) : null; - public (EntityRef Relation, EntityRef Target)? AsPair() - => IsPair && (World.LookupAlive(Id.RelationUnsafe) is EntityRef relation) && - (World.LookupAlive(Id.TargetUnsafe ) is EntityRef target ) - ? (relation, target) : null; - - public bool Equals(IdentifierRef? other) => (other is not null) && (World == other.World) && (Id == other.Id); - public override bool Equals(object? obj) => Equals(obj as IdentifierRef); - public override int GetHashCode() => HashCode.Combine(World, Id); - public override string? ToString() => ecs_id_str(World, this).FlecsToStringAndFree()!; - - public static bool operator ==(IdentifierRef? left, IdentifierRef? right) => ReferenceEquals(left, right) || (left?.Equals(right) ?? false); - public static bool operator !=(IdentifierRef? left, IdentifierRef? right) => !(left == right); - - public static implicit operator Identifier(IdentifierRef i) => i.Id; - public static implicit operator ecs_id_t(IdentifierRef i) => i.Id.Value; -} diff --git a/src/gaemstone.ECS/Iterator.cs b/src/gaemstone.ECS/Iterator.cs index 5ae146f..cafed4e 100644 --- a/src/gaemstone.ECS/Iterator.cs +++ b/src/gaemstone.ECS/Iterator.cs @@ -71,7 +71,7 @@ public unsafe class Iterator public EntityRef Entity(int index) => new(World, new(Value.entities[index])); - public IdentifierRef FieldId(int index) + public IdRef FieldId(int index) { fixed (ecs_iter_t* ptr = &Value) return new(World, new(ecs_field_id(ptr, index))); @@ -104,7 +104,7 @@ public unsafe class Iterator // The id might be "(Identifier, Name)", but its data type "Identifier". public bool FieldIs(int index) => FieldIs(index, World.LookupByType()); - public bool FieldIs(int index, Identifier id) + public bool FieldIs(int index, Id id) { fixed (ecs_iter_t* ptr = &Value) return ecs_field_id(ptr, index) == id.Value; diff --git a/src/gaemstone.ECS/Term.cs b/src/gaemstone.ECS/Term.cs index feec33a..bf79298 100644 --- a/src/gaemstone.ECS/Term.cs +++ b/src/gaemstone.ECS/Term.cs @@ -6,23 +6,23 @@ namespace gaemstone.ECS; public class Term { - public Identifier Id { get; set; } + public Id Id { get; set; } public TermId? Source { get; set; } public TermId? Relation { get; set; } public TermId? Target { get; set; } public TermInOutKind InOut { get; set; } public TermOperKind Oper { get; set; } - public IdentifierFlags Flags { get; set; } + public IdFlags Flags { get; set; } public Term() { } - public Term(Identifier id) => Id = id; + public Term(Id id) => Id = id; public Term(TermId relation, TermId target) { Relation = relation; Target = target; } public static implicit operator Term(EntityRef entity) => new(entity); public static implicit operator Term(Entity entity) => new(entity); - public static implicit operator Term(IdentifierRef id) => new(id); - public static implicit operator Term(Identifier id) => new(id); + public static implicit operator Term(IdRef id) => new(id); + public static implicit operator Term(Id id) => new(id); public Term None { get { InOut = TermInOutKind.None; return this; } } public Term In { get { InOut = TermInOutKind.In; return this; } }