Am 2012-04-17 um 12:50 schrieb Mariano Martinez Peck:

> Hi guys. In Fuel, we need to identity which globals present in Smalltalk 
> globals are NOT classes or traits, because we need to manage them as globals. 
> So far we have a hardcoded list:
> 
> defaultGlobalSymbols
> 
>     ^ #(#Smalltalk #SourceFiles #Transcript #Undeclared #Display 
> #TextConstants #ActiveWorld #ActiveHand #ActiveEvent #Sensor #Processor 
> #ImageImports #SystemOrganization #World)
> 
> So...as every hardcoded stuff, this is not nice because as soon as globals 
> change, we need to fix this. So it would be nice if the system (pharo) can 
> provide us this information.
> 
> What do you think?

What about just asking whether the Associaction values are Behavior:

defaultGlobalSymbols

    ^ (self environment "or 'Smalltalk globals' or 'Smalltalk', to your taste"
        select: [:g | g isBehavior not]) keys

In my Squeak4.3 this yields

 #(#SourceFiles #Display #Processor #World #Smalltalk #Sensor #ImageImports 
#ActiveEvent #ScheduledControllers #ScriptingSystem #ActiveHand #Undeclared 
#ActiveWorld #CustomEventsRegistry #TextConstants #References #Transcript 
#SystemOrganization)


Bes
        -Tobias

PS: for the interested ones, here with values:
#ActiveEvent->[keystroke '<Cmd-p>'] 
#ActiveHand->a HandMorph(3216) 
#ActiveWorld->a PasteUpMorph(1622) [world] 
#CustomEventsRegistry->an IdentityDictionary( "stuff" ) 
#Display->DisplayScreen(800x600x32) 
#ImageImports->a Dictionary() 
#Processor->a ProcessorScheduler 
#References->an IdentityDictionary() 
#ScheduledControllers->nil 
#ScriptingSystem->a StandardScriptingSystem 
#Sensor->an EventSensor 
#Smalltalk->Smalltalk 
#SourceFiles->an ExpandedSourceFileArray( "stuff" ) 
#SystemOrganization->( "stuff" )
#TextConstants->a Dictionary(size 107) 
#Transcript->a TranscriptStream ''
#Undeclared->a Dictionary() 
#World->a PasteUpMorph(1622) [world] 


Reply via email to