The MSDN page on ByRef and ByVal keywords isn't very helpful; unless I somehow skipped it, they're simply being referred to as "keywords" everywhere.

One of the main contributors of the Rubberduck project is working on a very cool Encapsulate Field refactoring, and the UI is coming along pretty nicely.. except I have a problem with the label above the dropdown for ByRef/ByVal, which says "Accessibility":

Rubberduck's "Encapsulate Field" refactoring dialog

I don't like "Accessibility" because I'm using it elsewhere for Public/Private/Friend access modifiers where it feels more accurate.

I don't want to use "Modifier" because IMO it's just a short for "access modifier".

I'd like that label to be accurate, but my vocabulary is apparently lacking and I don't know what to call these keywords.

What should this label say, to be accurate? What's the word I'm looking for? What "family of keywords" do ByRef/ByVal belong to?

closed as primarily opinion-based by gnat, GlenH7, jmoreno, Scant Roger, Thomas Owens Dec 21 '15 at 23:36

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    As one of the comments says, it shouldn't be there at all -- ByRef for a property is a bit insane. If even possible, it's evil -- allowing you to change the variables of callers without their knowledge. – jmoreno Dec 18 '15 at 2:07
  • A lot of documentation in the "VB Universe", (so, not specifically VBA) seems to refer to this as the "Passing Mechanism". – Damien_The_Unbeliever Dec 18 '15 at 8:14
  • @jmoreno I completely agree. I'll make it ByVal without a possibility to change it to ByRef other than manually editing the generated code, and "problem solved"! VBA can compile a tremendous amount of evil nonsense you know :-) still, I like that there's finally a place online that puts a name on these keywords. – Mathieu Guindon Dec 18 '15 at 15:31

In this case, I would use "Pass As" (or "Pass").

You have a flow that perfectly matches this usage.

  • Variable name: foo
  • Pass as: ByVal / Pass: ByRef

This fits your workflow perfectly and incidentally is exactly what the article you reference indicates.

As you read through your options, it reads perfectly when using 'Pass As' as you can simply read through the heading and select the text appropriately - "'Variable name' foo, 'Pass As' value."

If you wanted to make it slightly read better you could make your list options "Value" and "Reference" depending on if your target audience is VBA programmers or non-VBA programmers who may be slightly less familiar with ByVal and ByRef keywords.

Or alternatively, change it to "Pass:" and make it "By Reference (ByRef)" and "By Value (ByVal)" in the dropdown. It looks like your dropdown has the space to show all this text. Or just the ByRef/ByVal keywords.

  • I'd use "Pass as ByVal" or "Pass by value". "Pass by ByVal" sounds weird. – immibis Dec 17 '15 at 21:55
  • @immibis good call! – enderland Dec 17 '15 at 21:57
  • 3
    Also, you might consider radio buttons instead of dropdowns, given that there are so few choices. – Kyralessa Dec 18 '15 at 1:26
  • @Kyralessa that's exactly what I told Mat in chat, too. And I think is what they went with for the final design :-) – enderland Dec 18 '15 at 15:41

I would use either of these 3 terms to label a dropdown selecting that:

  1. Semantics
  2. Pass by
  3. Parameter modifier
  • I like "Semantics" – Mathieu Guindon Dec 17 '15 at 17:26
  • I like "Parameter Modifier". – Hosch250 Dec 17 '15 at 17:36

"Pass By Semantics" is probably closest to what you are looking for.

  • argh stealing my speedy delivery hat! Eeeeevil! – Jimmy Hoffa Dec 17 '15 at 17:25
  • 2
    I already have one, happy to give you this one... – Oded Dec 17 '15 at 17:26

The most exact and formal term for this would be "Aliasing semantics".

When ByRef is used, the name inside the function is an alias for the caller's variable -- all changes to either one are immediately visible to the other. With ByVal, the name inside the function is a distinct copy of the caller's variable (of course, both the caller's and function's copy may refer to the same object, but they are distinct in that reassigning the parameter inside the function does not reassign the caller's variable).

The options would be

  • Alias (ByRef)
  • Copy (ByVal)

Some platforms add a third possibility, where aliasing the caller's variable is done but it is not allowed for more than one parameter to alias overlapping objects. (The idea behind C restrict keyword, one also finds this in IDL, where the attribute keyword is unique). .NET doesn't have a good way to encode this knowledge.


I'd call it an "[argument] category".

The argument has a name, a type and a category.

Not the answer you're looking for? Browse other questions tagged or ask your own question.