[Gambas-user] To wish list; optional compiler warning

Benoît Minisini gambas at ...1...
Thu Sep 8 21:36:14 CEST 2011


> Hi!
> Quick thought; it would be nice to have compiler warning if "byref" is
> missing from function/sub call.
> I know using byref is optional, but so far I have only forgot to add it.
> 
> Example:
> 
> Private Sub Test(Byref x As Integer)
> ...
> 
> And you can call it;
> Test(i)
> Or;
> Test(Byref i)
> 
> 
> Jussi

By having to specify ByRef in the caller, you can't forget that the function 
will modify your variable (forgetting that leads to hard-to-fix bugs) and it 
help readers of your code.

I added ByRef to Gambas only to help porting VB projects. In other cases, just 
don't use it, even if you find it more practical.

Regards,

-- 
Benoît Minisini




More information about the User mailing list