Arc Forumnew | comments | leaders | submitlogin
1 point by aw 4811 days ago | link | parent

have you considered just making every global implicit?

An intriguing idea!

Imagine for example you wanted to find out how often one part of your code was directly or indirectly calling "map", but you didn't all the other concurrent calls to "map" to be recorded. Easy, just parameterize "map" to do the tracing you want within the call to your code; and everything else is unaffected.



1 point by akkartik 4811 days ago | link

Common lisp programs tend to define globals using defvar. Are those dynamic/special vars the same thing as racket's parameters?

-----

1 point by aw 4811 days ago | link

I haven't programmed in Common Lisp enough myself to tell for sure, but just looking at http://cl-cookbook.sourceforge.net/process.html they do appear to be similar -- at least in the sense of having a per-thread state.

-----

1 point by rocketnia 4811 days ago | link

I haven't heard of an implementation of CL with call/cc (but maybe I just haven't looked very hard XD ). Because of that, I think simulating a Racket parameter in Common Lisp would be just the same as simulating a Racket preserved thread cell (i.e. a thread-local box which is initialized in each thread to the value it had in the parent thread).

If 'defvar (and 'defparameter too?) dynamic variables have per-thread state, the next question is whether they're "preserved," and after that it's a matter of whether they have their own quirky properties or additional features apparent only in context. For instance, a Racket parameterization may or may not map well to a Common Lisp dynamic environment.

But maybe the more important question is: What do you expect from an implicit variable, and is 'defvar sufficient for that? For my purposes, any Arc global variable is (usually) sufficient, and I use Lathe's 'w/global to rebind one for a naive dynamic extent.

-----