But practically, when are you interested to query existence of a global which is not a class?

Concerning asClass, it does not resolve anything, how do you specify the environment?
Will it be included into the String and decoded? 'MyEnvironment.MyClass' asClass?
What if you don't provide a fully qualified string?


2013/5/2 Pavel Krivanek <pavel.krivanek@gmail.com>
asGlobalOrSomethingLikeThat :-)

-- Pavel


On Thu, May 2, 2013 at 11:59 AM, stephane ducasse <stephane.ducasse@free.fr> wrote:

On May 2, 2013, at 10:36 AM, Frank Shearar <frank.shearar@gmail.com> wrote:

> What's "global"? Even if you haven't implemented scoped environments,
> rather use a name that doesn't imply that you'll never have scoped
> environments.

:)
this is why I proposed asClass

Now asGlobal can be interpreted as as globally accessible stuff.


> #asClass sounds better, except for Guillermo's point about well-known
> things that aren't classes.
>
> frank
>
> On 2 May 2013 09:31, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
>> Sounds a bit like VW #{ }
>>
>> This sounds good to me, but don't use globalBinding, I would expect this one
>> to answer the binding (Asociation) rather than the value.
>>
>>
>> 2013/5/2 Sven Van Caekenberghe <sven@stfx.eu>
>>>
>>>
>>> On 02 May 2013, at 06:03, Igor Stasenko <siguctua@gmail.com> wrote:
>>>
>>>> Hi, all
>>>>
>>>> do not think that i am drunk or vent crazy, asking such silly
>>>> question, which at best should be asked only by beginner :)
>>>>
>>>> I know the answer:
>>>>
>>>> Smalltalk at: #SomeName
>>>>
>>>> or
>>>>
>>>> Smalltalk globals at: #SomeName
>>>>
>>>> what stroke me, just now, that both answers is wrong!
>>>>
>>>> It should be:
>>>>
>>>> #SomeName asGlobal
>>>>
>>>> (or suggest more appropriate/precise method name for a symbol)
>>>
>>> ConfigurationOfXYZ globalValue project bleedingEdge load.
>>>
>>> ConfigurationOfXYZ globalValueIfPresent: [ :configuration | configuration
>>> project bleedingEdge load ]
>>>
>>> An alternative could be globalBinding, but that is more technical.
>>>
>>> #asGlobal sounds like a conversion, on the other hand it is an accepted
>>> idiom.
>>>
>>>> optionally, we could also have one, with handling absent case:
>>>>
>>>> #SomeName asGlobalIfAbsent: []
>>>>
>>>> same , but only if present:
>>>>
>>>> #SomeName asGlobalIfPresent: [:global | ]
>>>>
>>>>
>>>> Currently, there is 941 references to 'Smalltalk' global in my pharo
>>>> image.
>>>> If we introduce this convenience method, it will shrink this number
>>>> considerably,
>>>> not saying that code will be more elegant and concise compare:
>>>>
>>>> (Smalltalk globals at: #Foo) doSomething
>>>>
>>>> and
>>>>
>>>> #Foo asGlobal doSomething
>>>>
>>>> P.S. What really strikes me is why we don't have such method from very
>>>> beginning,
>>>> and instead refer to 'Smalltalk' all over the places.
>>>> Some things are so deeply indoctrinated in our minds, that we don't
>>>> even think that it can be different.
>>>>
>>>> --
>>>> Best regards,
>>>> Igor Stasenko.
>>>>
>>>
>>>
>>
>