Purpose of "G:" reference in LISP samples?

Started by nwgeo · 2007-10-15 23:44 UTC · 5 replies · SMF topic #68

I have been coding in LISP for many years, but have stepped away from the dialog bog environment back in version 2000.  Inserting menus and dealing with the new pbjects just proved to be too cumbersome to manage.  I am, however, pleasantly surprised at the features of this Open Source tool.  So, I'm highly motivated to get back into the game.  My newbie problem:

I am trying to re-understand the interactions of events and how they relate to dialog boxes in general.  To that end I have been poking around in the "Examples" folder and found the following on lines 46 & 47:

    (IF g:bs_filelist
      (PROGN (SETQ g:bs_filelist (VL-SORT g:bs_filelist '<))

I feel pretty dumb asking this, but what does the "G:" refer to?  I know about the keyboard command syntax [e.g. "C:" for keyboard commands], it's just that I haven't come across this parrticular nomenclature before.  Does this refer to a global command or variable?

Thank you, in advance, for the simple answer to this :)
directorypowerful
I didn't code that example so I'm not 100% sure, but I think it's just means it's a Global varable.
It's nothing special like the C: keywork.
Maybe Kerry will let us know. :)
author=nwgeo link=topic=68.msg286#msg286 date=1192491843 wrote:
    (IF g:bs_filelist
      (PROGN (SETQ g:bs_filelist (VL-SORT g:bs_filelist '<))

I feel pretty dumb asking this, but what does the "G:" refer to?


i think it is just how the variable is named. "g:" is used here probably as an indication that this is a global variable and will remain accessible after the command is finished. i've been following a similar naming convention and used glb::SomeName for global variables.

I personally use
g:
and
gvar:

as prefixes for global variables ...

You can use any colon prefix except c:  and  S: as far as I remember.
Thanks Kerry,

I had always reserved the ":" as a keyboard command directive.  Nice to know that a variable can have some scope outside of a routine.  Although isn't that always the case if you don't put the variable behind the local variable directive? "/"  Just curious.  I guess it's a good visual cue to have "gvar:" or "G:" in your code, just to remind you that something has scope....
author=nwgeo link=topic=68.msg296#msg296 date=1192553287 wrote:
......  Although isn't that always the case if you don't put the variable behind the local variable directive? "/"   Just curious. 


Yes, that's the case.

author=nwgeo link=topic=68.msg296#msg296 date=1192553287 wrote:
......I guess it's a good visual cue to have "gvar:" or "G:" in your code, just to remind you that something has scope....


Yep.