Questions tagged [name-binding]
33 questions
2
votes
1 answer
Python; name bindings are not object references?
I am trying to understand what exactly a Python name binding is, and when this binding is interpreted.
In c,
include
int main()
{
int X = 42;
int* Y[1];
Y[0] = &X;
X = 666;
printf("%d", *Y[0]);
return 0;
}
prints 666. I was expecting the…

Tommy
- 12,588
- 14
- 59
- 110
2
votes
2 answers
Why and how does the Python interpreter remember literal objects
I am surprised by the following result, using Python 2.7.4:
>>> id(5)
5068376
>>> id(5)
5068376
When the expression 5 is evaluated, a new object is created with the identity of 5068376. Now, I would expect that repeating the same statement would…

Sharp3
- 108
- 4
1
vote
1 answer
Inject right object depending on method parameters at ninject factory namebinding
I use ninject and ninject factory extension as follows:
I created two interfaces, the first interface is for the factory and the second is for the concrete class to be injected depending on the arguments at the factory method.
The factory…

dot
- 486
- 1
- 8
- 17
1
vote
0 answers
Unable to get @NameBinding working for jaxrs Interceptors with cxf
1
vote
0 answers
Protect "Private" Objects in My R Package
Motivation
I am developing an R package (call it pkg) which collects in a running cache some objects generated by its function calls. It is simple enough to implement the cache as a list object (call it .cache) in the pkg namespace. However, I want…

Greg
- 3,054
- 6
- 27
1
vote
1 answer
In R can I find the environment associated with a lazy argument?
Sorry this is a little complicated.
I want to capture an argument expression, but also know which environment it should be evaluated in. Something like this:
make.promise = function(x = print(b), b = 7) {
expr = substitute(x)
env =…

Owen
- 38,836
- 14
- 95
- 125
1
vote
0 answers
JAX-RS writer interceptor works for every response even with NameBinding
I need to intercept a response from the server that was generated for a specific API call and change it.
I used the JAX-RS 'WriterInterceptor' for this and I have created a NameBinding as well. But the server is intercepting every response out…

Raveen Athapaththu
- 190
- 1
- 1
- 13
1
vote
1 answer
Name binding and language binding
Name binding and language binding are different concepts. But I wonder if they are related and how they differ? Especially interested in the relation part. For example, if language binding is implemented in terms of name binding?
Thanks and regards!

Tim
- 1
- 141
- 372
- 590
1
vote
1 answer
Jersey Namebinding technique in Spring Boot Rest
I have seen the name binding strategy from jersey to shield the api, it's pretty cool for authentication, and it's pretty cool to just annotate the endpoints you want to authenticate, and in jersey you can bind the annotation to the filter.
does…

Ricardo
- 17
- 5
1
vote
1 answer
MySQL name binding?
SELECT Score, (SELECT COUNT(*) FROM (SELECT DISTINCT Score FROM Scores WHERE Score >= s.Score) AS tmp) AS Rank
FROM Scores s
ORDER BY Score DESC
Can anyone tell me why s.score column unknown to the innermost subquery?

Chao Peng
- 87
- 2
- 8
1
vote
2 answers
Saving the current value of a variable for later use in a local scope
I want to to create functions in a loop, depending on the loop variable (for use with PyQT), but the functions are not "dereferencing" the loop variable as I want. (I don't know the proper terminology, so forgive my sloppiness.) This is a simple…

Jellby
- 2,360
- 3
- 27
- 56
1
vote
4 answers
How to bind a name with multiple objects or values in python
I saw in a book about language description that says
On the other hand, a name can be bound to no object (a dangling pointer),
one object (the usual case), or several objects (a parameter name in a
recursive function).
How can we bind a name to…

BugShotGG
- 5,008
- 8
- 47
- 63
0
votes
2 answers
Why does lambda capture by reference is still working with dangling references?
To my surprise, the following C++ program:
#include
#include
int main() {
std::function f;
{
int x = 1;
f = [&x]() { std::cout << x; };
}
//std::cout << x; // error: use of…

Géry Ogam
- 6,336
- 4
- 38
- 67
0
votes
1 answer
SQLServer 2014 - using name without schema qualification
I have table and view with same name: "dbo.Users" (table) and "www.Users" (table). There are select statements all over the code that look like this:
SELECT u_id, u_name from Users WHERE ...
I checked with two different users and it seems that view…

Jędrzej Dudkiewicz
- 1,053
- 8
- 21
0
votes
1 answer
Can python optimize out excessive name binding?
Can the python compiler optimize away unnecssary name binding ? For example, can a function defined as:
def add_one(x):
a = x
b = a
c = b
d = c
e = d
f = e
g = f
return g + 1
be optimized to just
def add_one(x):
…

RBF06
- 2,013
- 2
- 21
- 20