Jean-François Bigot wrote: > Nevertheless I really don't understand why the slots of <abc> are > lowercase and accessors in the scope are uppercase. It's really hard > for me to switch from the one to > other and keeping in mind that it's the same object behind.
Hi Jeff! Right now, with-slots is experimental. So I have it coded to use my personal convention of variable bindings in all caps. However, if Slava decided to have with-slots in basis, I'm sure it would be implemented with the more conservative lower-case variables. And at that point I'd have to hack together a with-SLOTS for my code... ;-) I don't like to force conventions on anybody... But I do find them useful. In Scheme and Lisp, function calls are denoted by parenthesis. So when you're reading code, you can tell if something's a procedure, just by it's position in a list. Not so with Factor code... So I like to use lot's of conventions for different kinds of objects; I definately like this part of the Perl culture. I.e. "different things should look different". So far I have conventions for class names and lexically bound variables. 'with-slots' goes with the all caps, but I'm leaning towards yet another convention for the special case of variables bound by with-slots. Perhaps ->xyz and xyz-> for example. However, it'd be good to get alot more experience with with-slots first. Lastly, I'd like to say something about the implementation of with-slots. Factor has words, macros, and parsing words. The semantics of macros are familiar to Lispers; you expand an expression into another expression at compile time. These sorts of macros are great fun and are right at home in Factor. However, with-slots is not a macro in this sense. The with-slots expression conceptually expands into an expression involving [let and [wlet. Those are in turn parsing words. with-slots is also a parsing word. So the standard Factor mechanism for macros cannot be employed here. Alarmingly, the implementation doesn't generate expressions involving the actual [let and [wlet words! It must resort to using the backend 'let' and 'wlet' tuple datastructures. At this point, this strikes me as a weakness in locals and macros. I.e. with this kind of abstraction, traditional macros break down. Parsing words are really a whole new ball game. Ed ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk