Hacker News new | past | comments | ask | show | jobs | submit login

I like this idea, except for the fact that the extra parametrer pollutes the method signature and method calls, for something that really should only be a compile-time directive.

I'm actually curious why something like this has never been included as a language feature, it seems trivial to come up with a syntax for fine-grained access control, that is fully backwards-compatible and a true zero-cost abstraction.

Most obvious first shot:

  class A
      void badgedFunction() const friend Device, SomeOtherClass;
Did you ever check with the C++ working group if there are any proposals for language extensions for this purpose?

Yeah, polluting the signatures is a shame.

I've only just decided that I enjoy using this pattern so my internal standards committee hadn't progressed to the proposal stage yet. :)

Your syntax makes perfect sense to me, and I think it would make a great addition to the language. I wonder what the real working group would say. (I tried quickly googling for something that might sound like an existing proposal but came up empty.)

Registration is open for Startup School 2019. Classes start July 22nd.

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