I've seen the term "lexical variable" a few times, mostly in the context of closures. Paul Graham uses the term in his books on Lisp referring to variables defined using the let expression.
I understand that lexical scoping is another name for static scoping. Is lexical variable just a variable that is visible in a program unit's refer...
I am reading the book 'Practical Common Lisp' by Peter Seibel.
In Chapter 6, "Variables" sections
"Lexical Variables and Closures" and "Dynamic, a.k.a. Special, Variables".
http://www.gigamonkeys.com/book/variables.html
My problem is that the examples in both sections show how (let ...) can shadow global variables and doesn't really te...
How does lexical scope help the compilers? Does it help in compilation or optimization?
...
I want brief intro to lexical scope
...
A couple of years ago I started writing an interpreter for a little Domain Specific Language which included programmer-defined functions.
At first I implemented variable scope using a simple stack of symbol-tables. But now I want to move to proper lexical scoping (with the option of closures). Can anyone explain or point me at a good e...
Hi,
I have a pointer which points to a function. I would like to:
if (mode == 0)
{
const unsigned char *packet = read_serial_packet(src, &len);
} else {
const unsigned char *packet = read_network_packet(fd, &len);
}
But I cannot do it because my compiler complains when I first use the pointer later in the code.
error...
Hi all,
I just finished reading about scoping in the R intro, and am very curious about the <<- assignment.
The manual showed one (very interesting) example for "<<-", which I feel I understood. What I am still missing is the context of when this can be useful.
So what I would love to read from you are examples (or links to examples) ...
Sometimes I need a useful utility function, like List::Util::max in the middle of a large program that does lots of stuff. So if I do
use List::Util 'max';
At the top of my program, I'm stuck with that symbol, polluting my whole namespace, even though I only need it in one subroutine.
So I've been thinking of trying a different patte...
I think the answer is yes but I just want to make sure. so if I have
sub something {
my $_;
my @array = ...;
while ( @array ) {
say;
}
}
is the my $_; actually effective at lexicalizing the parameter passed to the say?
In this particular case I'm using the DZP::UnusedVarsTests and it's complaining that I haven...
From the "our" perldoc:
our has the same scoping rules as my, but does not necessarily create a variable.
This means that variables declared with our should not be visible across files, because file is the largest lexical scope. But this is not true. Why?
...