itsjohncs / phial

A Python microframework for building static sites. Will not be completed.
BSD 2-Clause "Simplified" License
4 stars 0 forks source link

Research use of inert decorators, activated by scanning for them. #62

Open itsjohncs opened 9 years ago

itsjohncs commented 9 years ago

This is a very understandable concept that I've never thought about or encountered before. The Pyramid web framework does this (using a library called venusian). I think it's a clever idea and seems to go a long way towards solving the "one-off" nature of the decorator's behavior that Phial has.

I can imagine doing a scan of decorated functions and adding them into the queue only after that's done. This could allow repopulating the queue after a build is finished, mutating things based on selectors, or just adding a subset of the application to the queue (though this might be better done once everything is in the queue so all the dependency resolving nonsense is ready).

itsjohncs commented 9 years ago

venusian seems overly complicated. I can just build a set of things that have been registered and make that seperate from the action queue. The effect should be the equivalent, I'll avoid all that crazy introspection nonsense, and it's super understandable.

itsjohncs commented 9 years ago

Though I guess if I'm storing a bunch of references to functions, if those functions go away because of some fancy hotloading, they won't be collected and I'll still think they exist.... keys would solve that though? Is hotloading Python even a thing though?