[Gambas-user] Newbie question * 3

karl at ...1303... karl at ...1303...
Tue Jan 3 02:58:53 CET 2006


Hi All,

	I've got a few queries for you guys:

My System:
AMD 2700+
1Gig RAM
Running SuSe 10.0

Gambas 'Release'  v1.0.11-0 
Gambas 'Devel' v1.9.21-0
Both are the current SuSe builds from:
ftp://ftp.gwdg.de/pub/linux/misc/suser-gbv/rpms/

1)  It seems that the release version of Gambas does not trim 
trailing whitespace from lines whereas the devel version does.  How 
can I stop the devel version from doing this? (in most cases it's 
there for a reason! :-) )

2)  Gambas seems to evaluate logical AND statements in a 'VB like' 
fashion rather than an 'other languages' kind of way.  By this I mean 
that it evaluates both operands even if the first is false (and 
therefore the whole must be false).  The result is that you end up 
with blocks of code nested more deeply than should be necessary. In 
the following example the inner conditional block is necessary 
because if colAttendee.Current.Selected is read while there is no 
selected item, an error is raised. Please note I'm just using this as 
a demonstration of what I mean by 'more deeply nested'.

Eg:
case a (current gambas))
DIM colAttendee AS ColumnView
IF colAttendee.Count > 0 THEN
   IF colAttendee.Current.Selected = TRUE THEN
       ' Do more things
   END IF
END IF 

case b ('ideal'))
DIM colAttendee AS ColumnView
IF colAttendee.Count > 0 AND colAttendee.Current.Selected = TRUE THEN
   ' Do more things
END IF

My query is: Is this the expected behaviour, and if so, are there any 
plans to ever make AND not evaluate it's right operand if the left is 
false?

3)  The following code raises an error (and displays the "got foo" 
message) in my release  version of gambas (as you might expect :-) ), 
but none is raised in the devel version.  Is this a bug, or am I 
doing something wrong?

PUBLIC SUB Form_Open()
   TRY foobar()
   IF ERROR THEN Message("got foo")
END

PUBLIC FUNCTION foobar() AS Boolean
   Error.Raise("foo")
END


Thanks for reading,
Karl Martindale





More information about the User mailing list