Coding 2020-02-15

By Max Woerner Chase

Another slow day in terms of the blog stuff. I might see about stretching this over the weekend.

I did do some design/planning for my punq changes/fork. Mostly focused around realizing that I'm going to have to be very careful implementing all of this. I'll just dump the notes I was taking in here.

Type References are used at definition time, at registration time, and at resolution time.

Type References at definition time are resolved contextually. Other type references are resolved globally.

One-part names, resolved contextually, must fall back to resolving against the builtins module. Resolved globally, they must be resolved against the builtins module.

Resolution involves locating a module, getting the name from it, and extracting the qualname. The canonical name of a Type reference is the right-most segment in its name, followed by the canonical names of its __args__ values, if any. Next, the __qualname__ of the actual class object. Finally, the canonical names of the arguments to the type.

Miscellaneous notes: List[Any] -> list. In other words, if a generic type is subscripted entirely with Any, it should be replaced with its __origin__. It looks a little tricky to determine this.


int -> int:int list -> list:list List -> list:list List[int] -> typing.List:typing.List:[int] List[T] -> not implemented

given Writer = Tuple[T, str], Writer[int] -> mod.Writer[mod.T, str]:typing.Tuple:[int]

Good night.