Skip to content

Exposed type object - needs clarification? #362

Open

Description

The first bullet point under If the type object is exposed seems somehow unclear to me. The exposure of the typed object allows code that otherwise could not get their hands on type objects, to access them. It does not magically restrict all acess to the type object. Im fact, it must not, because you need a reference to a type object to instantiate a typed object, regardless of whether you are using the constructor function on the type object or the one where you pass in the type object.

  • Outside code can interact with type objects without having an instance of the typed class So can it, if the type object is not exposed, it just needs to get the reference to the type object from somewhere. What changes is where it can get that reference (not from the typed object, which weirdly, is what you say here is not necessary when exposed - do you mean it can interact with it without going THROUGH the typed object?)
  • This prevents us, for example, from using our constructor pattern, where new monsters are created by calling a method on the breed. If it does prevent us from using that, it also prevents us from using the other instantiation method, where we need to pass in a breed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions