[Gambas-user] IsObject(NULL)

Demosthenes Koptsis demosthenesk at ...626...
Wed Nov 24 12:44:22 CET 2010


i will describe my thoughts about that,

i read the

http://gambasdoc.org/help/cat/constants

and i saw that a TRUE or FALSE value is a Language constant.
Also NULL is a Language constant!

So i expected from IsObject() to return FALSE when it is feed with
constants as argument.

So
PRINT IsObject(TRUE)       'False
PRINT IsObject(FALSE)      'False
PRINT IsObject(0)          'False
PRINT IsObject("a string") 'False

But
PRINT IsObject(NULL)       'True

Some more thoughts..
In wiki says that NULL is a void string
and indeed...

PRINT IsObject("")	'True

1) But what if someone want to check a void string?
2) How a 
   PRINT IsObject("a string") 'is False
   and a 
   PRINT IsObject("") 'is not False

both are strings and not Objects.


On Wed, 2010-11-24 at 12:21 +0100, Fabien Bodard wrote:
> Le 24 novembre 2010 11:59, Benoît Minisini
> <gambas at ...1...> a écrit :
> >> hi,
> >>
> >> PRINT IsObject(NULL)
> >>
> >> returns
> >> TRUE
> >>
> >> The NULL constant is an object?
> >
> > NULL is almost everything. So IsObject(Null) and IsString(Null) returns TRUE.
> > But IsDate(Null) returns FALSE, whereas Null can be a date.
> >
> > So things are not very logical there.
> 
> I think too .. as i can't use a null as an object so it is not an
> object... but it depend if isobject test the variable type or the
> content.
> 
> For exemple
> dim o as object
> 
> isobject(o) will return true even if o is null... o can only be an object
> 
> but
> dim v as variant
> 
> is object(v) will return false if it is null ... it can be anything
> 
> ....
> in my mind it will work like that ...
> 
> 
> >
> > --
> > Benoît Minisini
> >
> > ------------------------------------------------------------------------------
> > Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> > Tap into the largest installed PC base & get more eyes on your game by
> > optimizing for Intel(R) Graphics Technology. Get started today with the
> > Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> > http://p.sf.net/sfu/intelisp-dev2dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> 
> 
> 

-- 
Regards,
Demosthenes





More information about the User mailing list