sigmundch / DEP-member-interceptors

little experiment of using barriers to implement observability
4 stars 4 forks source link

Class objects instead of null for static interceptors? #5

Open munificent opened 9 years ago

munificent commented 9 years ago

If the metaclass proposal goes through, it may make sense to pass in the class object as the target for static interceptors. Or we could stick with null for now and leave that open for refinement later.

sigmundch commented 9 years ago

Interesting, I wasn't aware of the metaclass proposal until now.

That's a good question. I'd say yes. In fact, I think even now, it might be a good idea to do something other than null for static members and top-level members. One idea would be to use:

Another option is to do something like we do in the initialize package, where we pass in a const object containing the context. For libraries, that includes the name and URL.

munificent commented 9 years ago

I think for now, the simplest thing to do is to pass in null or perhaps an undefined object. That would let us later change it to something more full-featured later without breaking compatibility.