contract unsigned(v T) {
    // Require T to be an integer type.
    v % 1
    // This is satisfied by any unsigned integer type, but not by a
signed integer type.
    v = 1<<(unsafe.Sizeof(v) * 8 - 1)
}

That requires an import, not to mention unsafe, which raises the issue of
whether a contract must be written in pure Go without imports. I'm not
sure, but I do think it might be good that it does.

Even then, saying v%1 is the way to ask for an integer is infelicitous at
best.

To my mind this general area is the least clear part of the contracts
design: what _is_ a contract?

-rob

-- 
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