[Gambas-devel] Yet another PING > Benoit

Benoît Minisini gambas at ...1...
Sun Jan 24 18:12:56 CET 2010


> No response required to this part:
> 
> The code below compiles fine, and it runs, however it experiences odd
>  behaviour:
> 
>   For nZ = 0 To aName.Count - 1
>     Letter = Mid(aSplitPhrase[iSplitPhrasePtr], 1, 1)
>     If LCase(Letter) = LCase(Mid(aName[nZ], 1, 1)) Then
>       aSplitPhrase[iSplitPhrasePtr] =
> ReplaceFirstOccurence(aSplitPhrase[iSplitPhrasePtr], Letter, "/" &
> Letter & "/")
>       OutputText &= aSplitPhrase[iSplitPhrasePtr] & mConst.$crlf
>       If iSplitPhrasePtr < aSplitPhrase.Count - 1 Then
>         ' Don't point past end
>         iSplitPhrasePtr += 1
>       End If
> ^^^^^^^^^^^
>     Else
>       If Trim(aName[nZ]) = mConst.$empty Then
>         OutputText &= Trim(aName[nZ]) & mConst.$crlf
>       Else
>         OutputText &= "/"
>         OutputText &= Trim(aName[nZ])
>         OutputText &= "/" & mConst.$crlf
>       End If
> ^^^^^^^^^^^
>     End If
> ^^^^^^^^^^^
>   Next
> 
> At first glance, to the untrained eye, all looks well. However the
> code has been copied from .NET 2008, pasted into gb3 and modified to
> run under gb3.
> 
> Neither the editor nor the compiler recognises "End If" as an error.

"End If" is an alternate syntax for "Endif" in Gambas.

> 
> In addition, "End Function" also causes other issues, which I won't go
> into right now, even though the code compiles and runs, though there
> are visibly verifiable problems in the IDE as a result.
> 
> The issue of "End" followed by some unknown statement is a big problem
> for translation projects because it causes unnecessary debugging, and
> despite my respect for you and the team regarding the work done to
> date, the help text simply sucks and is not any help at all. The wider
> issue is that gb's failure to reject obvious errors reflects more on
> gb than it does on the programmer's knowledge of the language.
> 

I don't understand the problem at all.

> I would like a response to this, if you see fit:
> 
> My opinion is that, whilst I should be aware of these problems, gb
> should still reject anything following the End statement that is not
> expected. "If" and "Function" being two examples.

Actually I did that for make porting VB code easier!

"End If" is allowed instead of "Endif".

"End Function" is allowed instead of "End" only if the "Function" keyword was 
used to declare the function.

"End Sub" is allowed instead of "End" only if the "Sub" or "Procedure" keyword 
was used to declare the function.

> 
> Comments also not requiring a response:
> 
> Of course, despite fixing the above, I still haven't found what is
> causing the problem I'm trying to solve. I merely realised the above
> as a problem while trying to sort out another problem :)
> 

Maybe you should tell what the odd behaviour is exactly. But "End If" is 
clearly not the problem.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list