Questions tagged [variable-names]
256 questions
4
votes
2 answers
Create multiple numbered variables based on a int
How would I create a number of NSDictionary variables using an array's count?
This is basically what I came up with, but I'm not sure how to make this work with Objective-C syntax. doesntContainAnother is an NSArray. I want the names of the…

S-T-R-E-G-A
- 277
- 3
- 11
4
votes
4 answers
Do you use particular conventions for naming complementary variables?
I often find myself trying to come up with good names for complementary pairs of variables; where two variables denote opposing concepts, two participants in some sort of duologue, and so on.
This might be better explained by a counter-example - I…

Dylan Beattie
- 53,688
- 35
- 128
- 197
3
votes
1 answer
Neat way to distinguish identifiers and variable names (ANTLR)?
How can we distinguish a variable name, and an identifer, in an ANTLR grammar?
VAR: ('A'..'Z')+ DIGIT* ;
IDENT : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')*;
The piece of grammar (in ANTLR) does not work because the compiler…

zell
- 9,830
- 10
- 62
- 115
3
votes
2 answers
How to get the name of variable in NSE with dplyr
So I've found many times various different ways to achieve this, but as of the past year or so there have been changes to the way dplyr handles non standard evaluation. Essentially one way to achieve this is as follows:
require("dplyr")
test <-…

JoeTheShmoe
- 433
- 6
- 13
3
votes
3 answers
Can I print out the instance name of a class?
I'm trying to print out the instance name of a class.
In this example it's a timer that prints out how long various overlapping sections of my code are running:
class timerstart:
def __init__(self):
# Sets some variables with system…

Audelia
- 101
- 1
- 3
3
votes
3 answers
Python: Change variable suffix with for loop
I know this was asked a lot but I can not work with/understand the answers so far.
I want to change the suffix of variables in a for loop.
I tried all answers the stackoverflow search provides. But it is difficult to understand specific codes the…

Martin Flower
- 105
- 3
- 11
3
votes
4 answers
Replace placeholders in text by referencing a translation variable
I'm trying to remove eval from the following function. I tried with sprintf and ${} , but still cannot find a solution.
Here the function:
function parseDbString(string $value = 'Looking for a good {{ $pippo }}'){
$pippo='Pizza';
return…

Vixed
- 3,429
- 5
- 37
- 68
3
votes
2 answers
get powershell variable name from actual variable
I am trying to figure out how to get the name of a powershell variable from the object, itself.
I'm doing this because I'm making changes to an object passed by reference into a function, so I don't know what the object will be and I am using the…

Rob Traynere
- 585
- 1
- 7
- 14
3
votes
2 answers
Examine Bash variables with dynamic names
I'm trying to read from Bash variables for which I know name suffixes, but I want to iterate through the prefixes.
I give an example below:
var1_name="variable1"
var1_size="2"
var2_name="variable2"
var2_size="3"
vars=(var1 var2)
for v in…

Ofri Rips
- 153
- 1
- 10
3
votes
2 answers
Maintainable code with non-descriptive variable names
I'm working with LexisNexis VisualFiles, whose scripting language doesn't allow for descriptive variable names - all it allows is "temporary fields" and "local fields" named TF01, TF02 or LF01, LF02 etc. Other data comes from "entities" so the…

Matte Black
- 31
- 4
3
votes
2 answers
In R: pass column name as argument and use it in function with dplyr::mutate() and lazyeval::interp()
This question links to this SO answer except that here I want to use the variable specified as function arg in a mutate_(). It works if I don't make any "calculations" in the mutate_():
data <-
data.frame(v1=c(1,2),
…

user3375672
- 3,728
- 9
- 41
- 70
3
votes
3 answers
Where are the variable/reference names or types stored in memory for stack/heap variables?
I think I understand the main difference between stack and heap.
In the following program, an Object of size n is created on the heap. A pointer p refering to this sofar nameless object is created on the stack, where it occupies 4 bytes (at least on…

mr_T
- 2,571
- 3
- 22
- 39
2
votes
9 answers
What would be a good variable name for a rectangle the describes an objects position and size?
The title is fairly self-explanatory, but I'll reiterate: What would be a good variable name for a rectangle that describes an objects position and size.
EDIT - The object is a paddle for a Pong-like game, and there is already a rectangle named…

xian
- 4,657
- 5
- 34
- 38
2
votes
1 answer
R: Generate variable names, evaluate a function within a list of functions, and assign those values to the generated variable names within a loop
Please excuse me if there are already answers to this, but I can't quite figure it out from the archives.
I have generated a list of very similar functions via a for-loop in R:
adoptint.fun=list()
for(i in 1:40) {
#function name for each…

SMM
- 193
- 1
- 3
- 12
2
votes
0 answers
Why are events written as $event in Angular?
I'm an Angular beginner, and during the course of learning Angular, various tutorials and websites have used naming conventions that declare events as $event as shown in below snippet:
@HostListener('dragover', ['$event'])
onDragOver($event) {
…

Marc Al
- 27
- 1
- 6