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

What are the pros of leaving out the type identifier when declaring a generic type? I understand that it's viable to not provide some "Type" identifier to denote a generic type, but I feel like it's better to have it for clarity. What happens when you have a function that accepts two kinds of generic types? This inconsistency doesn't seem worth it to me


Each parameter in a function without a type identifier is a unique generic type. This means any function with two typeless parameters already accepts two different kinds of generic types.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: