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

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Sep 9 23:13:06 CEST 2011


What's that supposed to do?
Catch doesn't do catch anything since missing byref doesn't rise error!

Jussi


On Fri, Sep 9, 2011 at 22:51, Fabien Bodard <gambas.fr at ...626...> wrote:

> yes like :
>
> Private Function ModifyThat(byRef i as integer) as boolean
>
>  i+=6*4
>
> catch
>  return true
>
> end
>
>
>
> to use it
>
> if not Modifythat(ByRef iMyVal) Then Print iMyVal
>
>
> sometime it can be usefull to catch the error in the calling function
>
>
>
>
>
> 2011/9/9 Jussi Lahtinen <jussi.lahtinen at ...626...>:
> > After I read what Fabien wrote, I realised what you meant and I think you
> > misunderstood my problem.
> >
> > My problem is *not *that I have to write byref to function declaration
> and
> > to function call.
> > My problem is that if I forget to write byref to function call, I will
> get
> > silent bugs.
> >
> > I think either byfer should be mandatory to write to function call, or
> there
> > should be warning from missing byref keyword.
> >
> > Jussi
> >
> >
> >
> > 2011/9/8 Benoît Minisini <gambas at ...1...>
> >
> >> > 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
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Doing More with Less: The Next Generation Virtual Desktop
> >> What are the key obstacles that have prevented many mid-market
> businesses
> >> from deploying virtual desktops?   How do next-generation virtual
> desktops
> >> provide companies an easier-to-deploy, easier-to-manage and more
> affordable
> >> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >
> ------------------------------------------------------------------------------
> > Why Cloud-Based Security and Archiving Make Sense
> > Osterman Research conducted this study that outlines how and why cloud
> > computing security and archiving is rapidly being adopted across the IT
> > space for its ease of implementation, lower cost, and increased
> > reliability. Learn more.
> http://www.accelacomm.com/jaw/sfnl/114/51425301/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> --
> Fabien Bodard
>
>
> ------------------------------------------------------------------------------
> Why Cloud-Based Security and Archiving Make Sense
> Osterman Research conducted this study that outlines how and why cloud
> computing security and archiving is rapidly being adopted across the IT
> space for its ease of implementation, lower cost, and increased
> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
> _______________________________________________
> 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