Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Guarantees at compile time:

Array<double> means the only element you will encounter is a double.

Array<ISomeInterface> means the only element you will encounter is of type ISomeInterface.

hence, you can express part of some code's requirements via the types that a function,class exposes and/or requires.

these requirements can then be checked at compile time.

without this you have to defer the "checking" to runtime.



I'm sorry, I meant why generics are a big deal. Thanks though!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: