Skip to content

Instantly share code, notes, and snippets.

@PeterRK
PeterRK / package level generics.md
Last active October 16, 2018 03:59
package level generics

Package level generics may look less confusing.

package abc(Key,Value)

contract CompileCheck(a1 Key, a2 Value) {
	//...
}

type Pair struct {
	K Key
@networkimprov
networkimprov / txt.md
Last active December 4, 2018 19:38
Please Don't Mangle the Function Signature, re Go2 generics proposal

For gosh sakes, don't make us read code with the scrutiny of a compiler :-) A type declaration after a function name is confusingly similar to an argument list.

Which witch is which?

  • func Stuff(type T Something)(input T) error { ... }
  • func Stuffed(input Somethingelse) error { ... }

C++ style is fine; variations on paren placement can be considered

  • (type T, U) Something // line break or semicolon
    (type V) // more on next line