The compiler does not necessarily know that Encodings.UTF8.Chr(13)   
will return the same value every time, nor does it need to.  That is  
my job.  At runtime, the line

static foo as String = Encodings.UTF8.Chr(13)

is executed the first time it is encountered.  That's how static  
variables work.

Charles Yeomans


On Mar 21, 2007, at 10:36 AM, Louis G5 Batayte wrote:

> Is that right? How does the compiler know that Encodings.UTF8.Chr(13)
> will return the same
> value every time it is called? We assume that, but unless the
> function is flagged to be executed
> at compile time, not run time, how would it know. If it is flagged to
> be executed at compile time, it would be executed only once anyway.
> If it gets executed only once at run time there has to be some
> compiled if testing coded in to know if it has executed or not.   
> Hmmmm?
>
> Lou
>
>
>
> On Mar 21, 2007, at 7:11 AM, Steve Garman wrote:
>
>> In a message regarding Re: Global properties? dated Wed, 21 Mar 2007
>> 08:57:21 +0000, Markus Winter said that ...
>>
>>>>    static foo as String = Encodings.UTF8.Chr(13)
>>>>    return foo
>>>> End Function
>>
>>> Couldn't you also just say
>>
>>>     Function CR.Get() as String
>>>         return Encodings.UTF8.Chr(13)
>>>     End Function
>>
>> Sure you could but then it has to be evaluated every time CR is
>> useded.
>>
>> Using the static variable allows a single evaluation the first time
>> the
>> getter is called.
>>
>>
>> -- 
>> Steve Garman
>> Using REALbasic Professional on Windows XP Pro
>>
>>
>> _______________________________________________
>> Unsubscribe or switch delivery mode:
>> <http://www.realsoftware.com/support/listmanager/>
>>
>> Search the archives:
>> <http://support.realsoftware.com/listarchives/lists.html>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to