The comment about MultiList's memory having one dimension is true of computer memory in general (ignoring the segmented architecture used in some smaller processors). All multi-dimensional memory is an illusion. Anyway I'm fine with axis if NumPy is using it.
Re: contracts,
Option 1 hides the contract in the implementation of the method where it will not be picked up by a doc tool and not inherited in method overrides, nor identified in any way as part of the API.
Option 3 duplicates code which is the next greatest sin after premature optimization.
Option 2 is the correct form for Cobra.
I have consistently read that Eiffel does allow contracts to be turned off including your choice of preconditions, postconditions and invariants. Since their standard library is loaded with fairly thorough contracts, turning them off can be a necessity for projects that need better performance. This is typically done when shipping the software or releasing to a production environment.
There is then the idea of striking some balance where you leave one of these in place to act as a quality control while turning off the others to improve performance. Which one to leave on? They say
preconditions:
Based on this knowledge, we can say that it is most practical first to turn off runtime checking of postconditions and invariants as we gain confidence in a class. Meaning of course, that we feel confident that any calls that meet preconditions will be properly processed. Then our only worry is that some deranged client will, with total disregard for our carefully crafted preconditions, make calls to our routines from invalid states. So, maybe we will leave precondition checking turned on for a while.
from
http://docs.eiffel.com/book/platform-sp ... assertionsI read somewhere else, but don't have the reference, that this approach was learned through the experience of using Eiffel.
Interestingly, this fits in with your example about turning off preconditions which can lead to undetected misuse of a class.
Cobra does not have a compile-time option to turn these off in a granular fashion, but it does have run-time properties in CobraCore to do so:
class CobraCore
shared
pro willCheckInvariant from var
pro willCheckRequire from var
pro willCheckEnsure from var
pro willCheckAssert from var
pro willCheckNil from var
set willCheckAll as bool
.willCheckInvariant = value
.willCheckRequire = value
.willCheckEnsure = value
.willCheckAssert = value
.willCheckNil = value
Which means you could even set these based on config values or command line args.