Eiffel has a cool feature I think we should adopt:
the once keyword.
You can declare a function as "Once" and it will only be executed once. If it returns a value, the value will be saved, and subsequent calls will return the value from the first time it was called without running all the code.
Once Function InitDatabaseStuff()
...
End Function
I can see all kinds of value in this sort of thing. It saves on lots of unneeded testing for whether or not something has been done already.
----
Eiffel says it will run once per thread.
I think we probably need a way to say once per thread, or once per application or something - because I can see how it might be valuable either way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Eiffel has a cool feature I think we should adopt:
the once keyword.
You can declare a function as "Once" and it will only be executed once. If it returns a value, the value will be saved, and subsequent calls will return the value from the first time it was called without running all the code.
Once Function InitDatabaseStuff()
...
End Function
I can see all kinds of value in this sort of thing. It saves on lots of unneeded testing for whether or not something has been done already.
----
Eiffel says it will run once per thread.
I think we probably need a way to say once per thread, or once per application or something - because I can see how it might be valuable either way.