PLIP proposal: Disallow implicit Acquisiton of properties

Note: This is a Plone Improvement Proposal Proposal to discuss possibilities to realize this PLIP.

Acquisition is a powerful but very confusing concept. It can be very handy, especially when dealing with object permissions. But acquiring each and every property on attribute access is not only expensive but highly confusing and not expected by generic Python developers at all.

This PLIP proposes to change implicit acquisition to explicit acquisition wherever it is really needed.

This is a draft and I didn't dig into possibility of realization.
This also touches core Zope 4, so it might even better proposed there.
It will probably also break a lot of code.

Comments are very welcome.

Related projects (only handle acquisition when publishing objects, not attribute acquisition):

1 Like

is implicit acquisition a serious impediment for young programmers ? I looked a bit into Javascript features and it seems to me that implicit acquisition is part of the language. I'd be interested if experienced Zope programmers could explain to me if and how Zope implicit acquisition is really different from and more complex than Javascript acquisition.

I have no idea what you mean by this. Do you have an example of (implicit) acquisition in javascript?

I suspect he's getting confused between acquisition and scope.
Personally I think it being confusing to learn is less of an issue. It's more that it can create some really strange bugs. Like if add /plone to any plone site it doesn't get a 404 but exposes an object id. if you created content called "plone" then deleted it this could be a problem. And the performance improvements we will get if we remove it make it worth it.

One of the things about getting rid of acquisition is finding the small use cases where it was handy and then finding new solutions to them. It could often be handy for TTW things. For example using python scripts to create custom indexing behaviour using just the ZMI. One we could help with this is to allow hooking up themefragments or python scripts as plone adaptors so you could register a python script as a custom indexer using plone.indexer.

We also did some work on acquisition, the code is running with good results on production:

1 Like