|
|
| No such thing as a small change | |
| PerlMonks |
Re: Name a method that exposes a secretby duelafn (Parson) |
| on Sep 30, 2025 at 19:32 UTC ( [id://11166390]=note: print w/replies, xml ) | Need Help?? |
|
I see two oddities in the proposed unmask_secret_to. First, you have to use the buffer both as the invocant as well as an argument which is odd. Second, If you had two secrets that interface would be confusing, does it unmask the other secret or not?
Making unmask_secrets_to a plain exportable sub, not a method would address these issues (at least makes it clear what will happen in the second case). You could also implement an unmask_to (apply) method which would allow fine-grained access for multiple secret cases (or some people will just prefer that approach). So, "why not both"? I do not like #3, it is too easy to do accidentally and entirely un-greppable. On bikeshedding, for something that unmasks a secret, a generic name like "apply" isn't a good match. I'd suggest something greppable like unmask_to (which would be consistent with the unmask_secrets_to sub), or call_with_unmasked, or just unmask,
Update: Supporting SecretBuffers in another library could, I guess, look a bit like this (in the typical case of just wanting to unwrap any secrets passed in):
Good Day,
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||