Idea for Language Extensions for Interface-Protocols, was Re: Automatic Resource Management and Simple Resource Clean-up
Thorsten van Ellen
thorsten at vanellen.de
Wed Mar 4 12:09:35 PST 2009
By the way:
* allocate - deallocate
* open - close
* begin - commit/rollback
* lock - unlock
* push - push - pop - pop
and so on, all have somthing in common and that is:
a protocol on top of the signature.
Expressing protocols for interfaces might be a great language feature and
solving many more bugs caused by misused interfaces than only misused resources.
But surely it is a complex feature. Protocols itself could be expressed with
their own languages, e.g., simple regular expressions or even more complex
expressions.
Languages that can be evaluated at compile time, e.g., for simple cases like
"open - close" and languages that have to trace a state to be evaluated at
runtime, e.g., "push - push - pop - pop". Compile time mechanisms can not easily
be developed by individuals. Runtime mechanisms could be developed individually
without language extensions but need effort for every single case. Language
extensions like regular expressions could solve the problem generally with one
runtime mechanism.
Some of them could also be expressed by design by contract which is also a
complex feature probably even more complex, but that only works at runtime and
does not find errors at compile time.
It is only one idea, no proposal, probably too complex for this project and
therefore offtopic.
Best regards
Thorsten van Ellen
More information about the coin-dev
mailing list