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

Not really, not for TS at least. If you just want to take a string and call it an email address and have your function only accept email addresses (the simplest use case) then you need to use branding. That's not encapsulation.


Or double your GC burden by using a wrapper class.




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

Search: