How can I use namespaces in Gambit? Are there any examples?
--Vijay
Afficher les réponses par date
On Fri, 02 Sep 2011 10:33:19 -0500, Vijay Mathew mathew.vijay@gmail.com wrote:
How can I use namespaces in Gambit? Are there any examples?
There is a page on namespaces in the Gambit wiki:
http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Namespaces
Evan
Also check the examples/ directory in the Gambit distro, and possibly the Termite distro.
2011/9/2 Evan Hanson evhan@thunktastic.com
On Fri, 02 Sep 2011 10:33:19 -0500, Vijay Mathew mathew.vijay@gmail.com wrote:
How can I use namespaces in Gambit? Are there any examples?
There is a page on namespaces in the Gambit wiki:
http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Namespaces
Evan _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On 2011-09-02, at 11:33 AM, Vijay Mathew wrote:
How can I use namespaces in Gambit? Are there any examples?
--Vijay
There's an example in my ILC2010 presentation (http://www.iro.umontreal.ca/~gambit/Gambit-inside-out.pdf) and also in the examples/iOS directory.
Marc
I've noticed that documents which say that Scheme is lexically scoped. Although I've tried reading up on the concept, I'm not sure that I understand it. Can someone help?
Thanks, Steve
On 2011-09-05, at 10:02 AM, Steve Graham wrote:
I've noticed that documents which say that Scheme is lexically scoped. Although I've tried reading up on the concept, I'm not sure that I understand it. Can someone help?
Thanks, Steve
If X is declared in some form (e.g. a let), then it is only "visible" in the body of that form (unless it is declared at a deeper level). It is "lexical" because the concept of "nesting" is purely textual (based on the source code only, not the run-time behaviour of the program).
Marc
On Sep 5, 2011, at 10:02 AM, Steve Graham wrote:
Can someone help?
Marc's reply is, of course, succinct and correct.
If you want a fuller understanding of scope, I've found the wikipedia article to be relatively clear and to the point: http://en.wikipedia.org/wiki/Scope_(computer_science)
It covers both lexical (a.k.a. "static") scope, and dynamic scope, and gives examples.
hth
warmest regards,
Ralph
Raffael Cavallaro raffaelcavallaro@me.com
On 5 Sep 2011, at 15:51, Raffael Cavallaro wrote:
On Sep 5, 2011, at 10:02 AM, Steve Graham wrote:
Can someone help?
Marc's reply is, of course, succinct and correct.
If you want a fuller understanding of scope, I've found the wikipedia article to be relatively clear and to the point: http://en.wikipedia.org/wiki/Scope_(computer_science)
It covers both lexical (a.k.a. "static") scope, and dynamic scope, and gives examples.
If you've got a C language kind of background, to a reasonable approximation, dynamic scoping is a lot like a global variable: anyone who reads or writes a given binding sees the same one. It caries similar risks to a global variable, but there are also some handy things you can do with them such as set up exception handlers. Static / lexical scoping is like the normal local variables in a function.
Hope that helps (and that if it's nonsense someone will correct me).
Cheers, B
I think a dynamic variable is more like a global variable but with a stack of values; where the stack reflects the modifications of the run-time call stack.
On Mon, Sep 5, 2011 at 2:27 PM, Benjohn Barnes benjohn@fysh.org wrote:
On 5 Sep 2011, at 15:51, Raffael Cavallaro wrote:
On Sep 5, 2011, at 10:02 AM, Steve Graham wrote:
Can someone help?
Marc's reply is, of course, succinct and correct.
If you want a fuller understanding of scope, I've found the wikipedia
article to be relatively clear and to the point:
http://en.wikipedia.org/wiki/Scope_(computer_science)
It covers both lexical (a.k.a. "static") scope, and dynamic scope, and
gives examples.
If you've got a C language kind of background, to a reasonable approximation, dynamic scoping is a lot like a global variable: anyone who reads or writes a given binding sees the same one. It caries similar risks to a global variable, but there are also some handy things you can do with them such as set up exception handlers. Static / lexical scoping is like the normal local variables in a function.
Hope that helps (and that if it's nonsense someone will correct me).
Cheers, B
-- benjohn@fysh.org - Twitter @benjohnbarnes - Skype benjohnbarnes - Mobile +44 (0) 7968 851 636
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
One thing that helped me grok a little better lexical vs dynamic scope is to make a crude but perhaps useful comparison to C++:
lexical scope <--> tracing C++ method calls on non-virtual methods. You can tell trace the flow of control on paper beforehand; and know what's going to happen before running it, always.
dynamic scope <--> C++ virtual method invocation. You don't know until runtime which code (or variable value in the case of dynamic variables) are being talked about, because method dispatch (and variable access in the case of dynamic variables) depends on runtime current state.
I think dynamic variables (which are available in Common Lisp but not in most Schemes, if I understand right) and dynamic scoping are broader in application (a superset of) the facilities provided by C++ virtual methods, but it's the nearest thing in a language that you more likely familiar with.
Does that help?
Experts, feel free to improve on this comparison.
- Jason
On Mon, Sep 5, 2011 at 9:51 AM, Raffael Cavallaro raffaelcavallaro@mac.comwrote:
On Sep 5, 2011, at 10:02 AM, Steve Graham wrote:
Can someone help?
Marc's reply is, of course, succinct and correct.
If you want a fuller understanding of scope, I've found the wikipedia article to be relatively clear and to the point: http://en.wikipedia.org/wiki/Scope_(computer_science)
It covers both lexical (a.k.a. "static") scope, and dynamic scope, and gives examples.
hth
warmest regards,
Ralph
Raffael Cavallaro raffaelcavallaro@me.com
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On 09/05/11 at 02:31pm, Jason E. Aten wrote:
I think dynamic variables (which are available in Common Lisp but not in most Schemes, if I understand right)
In many Schemes, dynamic variables are approximated by parameter objects, described in SRFI-39 (by none other than Marc Feeley).
http://srfi.schemers.org/srfi-39/srfi-39.html
Evan