struct-self-reference

command module
v0.0.0-...-a4b7a9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Struct TYPE as a Reference Id

Q: can the Type of a Golang object used as a unique identifier.

Reason: If the type of an object can be used as a unique key then objects, like a context object, that hold objects of uniquely different types can use the type itself as the index to retrieve the object.

Conclusion:

  • the nil value of a type "StructType{}" acts as an ID.
  • aliased types === original type with respect to the type's "value".
  • extended types are unique versus the type extended from.

Using the syntax "StructType{}" in multiple locations in a program appears to yield the same value and can be used as a unique key in a map.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL