[Gambas-user] Bug

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Aug 26 13:56:58 CEST 2011


I didn't say compiler should stop, interpreter should stop!

It shouldn't be legal for same reason as these:
Dim a As Integer = "string"
Dim a As Integer = Null

It's type mismatch. Null is not same as zero.
If you want to be able to give two different object references to same
variable, use type object or variant.

Also this is change in behaviour, since earlier you had to declare variable
for multiple different objects as object.
Dim a As Object
Only then variable 'a' was able to be whatever; Class1, TextBox or Null.

Sometimes I use object as parameter type so that I can use null to signify
missing object,
but then my code is made to handle nulls. So the biggest problem is
debugging.

Is there some standard for how this should be?

Jussi



On Fri, Aug 26, 2011 at 09:20, Caveat <Gambas at ...1950...> wrote:

> Why shouldn't it be legal?  As it stands, it's not good code and it's
> certainly not very useful but why should the compiler stop you setting
> something to null?  What if there's a line of code between, should it
> then be legal?
>
> regards,
> Caveat
>
> On Fri, 2011-08-26 at 02:35 +0300, Jussi Lahtinen wrote:
> > I think this shouldn't be legal:
> >
> > Dim a As New Class1
> > a = Null
> >
> > But there is no error message.
> >
> > Gambas 3 rev 4039 @ Ubuntu 11.04 64bit
> >
> >
> > Jussi
> >
> ------------------------------------------------------------------------------
> > EMC VNX: the world's simplest storage, starting under $10K
> > The only unified storage solution that offers unified management
> > Up to 160% more powerful than alternatives and 25% more efficient.
> > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
>
> ------------------------------------------------------------------------------
> EMC VNX: the world's simplest storage, starting under $10K
> The only unified storage solution that offers unified management
> Up to 160% more powerful than alternatives and 25% more efficient.
> Guaranteed. http://p.sf.net/sfu/emc-vnx-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