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

> Your example would be clearer if you used a pointer instead of a reference

I actually used the reference deliberately here because, unlike a pointer, a reference cannot be rebound.

But yes, I agree, this isn't good design. Off the top of my head I can think of at least one way to enable the same thing with a tiny bit of special (and rather obvious) syntax without introducing a footgun. It wouldn't even need any new keywords!

  foo x{this x, ...};


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

Search: