Contracts Draft: unsatisfiable contracts

118 views
Skip to first unread message

Qais Patankar

unread,
Jul 30, 2019, 8:45:43 AM7/30/19
to golang-nuts
For unsatisfiable contracts like the one mentioned just above this, copied below: 
 
Another, pedantic, example:
 
contract unsatisfiable(T) {
 T
int
 T
uint
}
 
This contract permits any type that is both int and uint. Since there is no such type, the contract does not permit any type. This is valid but useless.


Since T cannot be two primitives at the same time, can we make this a vet warning or compile time error?

-- Qais

alan...@gmail.com

unread,
Jul 30, 2019, 10:04:47 AM7/30/19
to golang-nuts
I suspect they won't want to make this a compiler error because of other possible conflicts that may arise when one contract is embedded within another.

A vet warning should be feasible though.

Alan

Ian Lance Taylor

unread,
Jul 30, 2019, 10:31:05 AM7/30/19
to alanfo, golang-nuts
On Tue, Jul 30, 2019 at 7:04 AM <alan...@gmail.com> wrote:
>
> I suspect they won't want to make this a compiler error because of other possible conflicts that may arise when one contract is embedded within another.
>
> A vet warning should be feasible though.

I agree.

Ian
Reply all
Reply to author
Forward
0 new messages