[Gambas-user] I can't believe this... I can!

Caveat Gambas at ...1950...
Tue Oct 9 10:02:01 CEST 2012


You've defined IS_ARRAY_NAME twice!

Once you have it declared 'at the class level':

'Special treatment for array names
Public IS_ARRAY_NAME As Boolean
Public CALL_DEPTH As Integer = -1

but you have also defined the variable Is_array_name in your Sub 
scan_file():

Dim Is_array_name As Boolean = False

     Try ifile = Open fname For Input
     If Error Then Stop Event

So I imagine that in your Sub you set the local variable to TRUE but 
when you get into write_token() it no longer has a local variable to 
refer to and is then looking at the 'class level' variable which you've 
never set.

Seems there might something a little fishy in the way the debugger 
doesn't distinguish between the local and the global variable properly 
(try watching both of them!)... Benoit perhaps a little something to 
look at, or perhaps we could give a compiler warning if you're 
hiding/stomping on variables by defining them twice?

Program works beautifully if you remove the second (local) declaration 
of IS_ARRAY_NAME.

Kind regards,
Caveat

On 09/10/12 09:28, Fabien Bodard wrote:
> Static public?
> Le 9 oct. 2012 03:14, "RICHARD WALKER" <richard.j.walker at ...247...> a
> écrit :
>
>> Sorry to spam the list - forgot to restore the diagnostic "Stop" for
>> "Public findme as String[]". Corrected in this one.
>>
>> Simple instructions;
>> 1. Use the file chooser to locate/select this program's FMain.class
>> 2. Choose a conversion option - the default "mangled" is OK
>> 3. Create a "Watch" for the "IS_ARRAY_NAME" boolean
>> 4. Click "Process" and then trace the code for the "Public findme as
>> String[]" line.
>>
>> The value is True at the call to write_token() and FALSE inside
>> write_token().
>>
>> Time for bed. Goodnight all.
>>
>> R
>>
>>
>> ------------------------------------------------------------------------------
>> Don't let slow site performance ruin your business. Deploy New Relic APM
>> Deploy New Relic app performance management and know exactly
>> what is happening inside your Ruby, Python, PHP, Java, and .NET app
>> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
>> http://p.sf.net/sfu/newrelic-dev2dev
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>





More information about the User mailing list