alanfo <alan.f...@gmail.com>:
> I suspect that you could achieve 90% coverage with just 4 built-in 
> contracts: 
> 
> 
> 1. integer (any integer type) 
> 
> 2. real (any integer or floating point type)
> 
> 3. ordered (any integer, floating point or string type)
> 
> 4. comparable (any type which supports == and !=)

Experience with Python suggests two others:

5. indexable (indexable by integers)

6. maplike (supports indexing by any valid map key).

You would also want to make "ordered" applicable to any type that
can support a < relation, for sorting purposes.

I'm saying this from a lot of experience with Python's facility for
binding operators to class methods.  A lot of that facility turns out
to be decorative fluff. These parts are not.

I would be happy with this set of contracts.  It would certainly
fulfil Ian's goal of being able to write min() and max() as generics.

Yes, I would prefer this 90% to the elaborate, fragile schemes for
user-defined contracts that are under discussion.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to