On Thu, Sep 6, 2018 at 1:21 PM, Caleb Spare <cesp...@gmail.com> wrote: > On Thu, Sep 6, 2018 at 9:54 AM Ian Lance Taylor <i...@golang.org> wrote: >> >> Personally I think an important feature of the current design draft is >> that it adds relatively few new concepts to the language. While >> concepts are of course a new feature, a contract looks like a >> function. If you can read a function, you can read a contract. You >> don't need to understand a new set of ideas to know what a contract >> is. With your proposal, everybody has to learn a new set of >> predeclared identifiers. You list 14 new ones, including $struct. I >> count 39 existing predeclared identifiers, so this is a significant >> increase. Also, of course, the new identifiers don't look like any >> existing ones, with the $, but perhaps that could be changed. I would >> very much prefer to not add so many new names. > > In practice, reading a contract is not really like reading a function at all. > > Like the compiler, the reader is interested in understanding the set > of operations a contract allows. When reading a function, the reader > pieces together a sequence of computations in order to understand the > function's behavior.
Fair enough, but I still feel that it is an advantage to not have to learn additional names or syntax beyond what you already know. > I think we'll find that we need to think and talk about contracts as > sets of allowed operations and giving names to those operations makes > that easier. Writing contracts as code to avoid naming the operations > doesn't mean we can avoid thinking about them, it just hides them a > little. We already have names for those operations: the less than operator, the equality operator. We don't have to use explicit names in the code to understand what we are reading. Ian -- 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.