Author Topic: What use is an uninitialed variant?  (Read 1697 times)

0 Members and 1 Guest are viewing this topic.

hermanm

  • Guest
What use is an uninitialed variant?
« on: June 25, 2009, 12:11:37 PM »
I posted this on a.a.c., but so far no response over there.
Maybe someone here knows...

Suppose this:

Command: (setq var (vlax-make-variant))
#<variant 0 >

I see these functions in the manual:
(vlax-variant-change-type var type);Returns the value of a variant after
changing it from one data type to another
(vlax-variant-type var);Determines the data type of a variant
(vlax-variant-value var):Returns the value of a variant

but, I see no function to set the value

So, if you can't set the value, what good is it?
And if it is possible to do that, then it is possible to change the value of a variant once created.
But, I don't see a way to do it.

Am I missing something?

By contrast, we have:

(vlax-safearray-get-element var element...)
(vlax-safearray-put-element var index... value)

?

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: What use is an uninitialed variant?
« Reply #1 on: June 25, 2009, 12:16:14 PM »
Could it be that it is only meant as a one way door? Meaning that we can only build and pass a variant. -i.e. If you need to alter ``it'', remake it and pass it back?

Shot from the hip.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

hermanm

  • Guest
Re: What use is an uninitialed variant?
« Reply #2 on: June 25, 2009, 12:48:38 PM »
Sure, immutable data.

But if that is the case, what possible use is an uninitialized variant (one which contains no data)?

Inquiring minds want to know.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: What use is an uninitialed variant?
« Reply #3 on: June 25, 2009, 01:56:28 PM »
Ah, ok i think i'm caught up to you now. Let me think a sec.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: What use is an uninitialed variant?
« Reply #4 on: June 25, 2009, 02:31:57 PM »
huh?! That is weird. The only thing i can think of is it could be for passing nil to an external in an arg or whatever. Other then that, i have no idea. I have another idea but it might take me a sec to set it up.

Funny how vbempty and vbnull are type long with 0 or 1.

(setq varempty (vlax-make-variant vlax-vbempty))
(vlax-variant-type varempty)
> 3
(vlax-variant-value varempty)
> 0

(setq varnull (vlax-make-variant vlax-vbnull))
(vlax-variant-type varnull)
> 3
(vlax-variant-value varnull)
> 1
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org