On 7/20/07, James Paige <[EMAIL PROTECTED]> wrote:
> On Fri, Jul 20, 2007 at 05:02:46PM -0500, Mike Caron wrote:
> > On 7/20/07, James Paige <[EMAIL PROTECTED]> wrote:
> > > On Fri, Jul 20, 2007 at 11:12:03AM -0700, [EMAIL PROTECTED] wrote:
> > > > james
> > > > 2007-07-20 11:12:03 -0700 (Fri, 20 Jul 2007)
> > > > 200
> > > > Fixed broken stat editor in hero editor.
> > > > For some reason, UNION does not work at all so I had to write some
> > > > big ugly blocks of CASE statements until we can find a better way
> > > > to deal with the problem.
> > > > ---
> > >
> > > Ooh... on closer examination, this UNION problem affects a lot of stuff
> > > in GAME too. For example, when you get a level up, you stats do not
> > > increase.
> > >
> > > Does UNION work in FreeBasic 0.17 (and if it doesn't work in 0.16, why
> > > does it even compile?)
> >
> > In .16, Unions themselves work fine, if I recall correctly. However,
> > it may have had an issue with anonymous types. This issue has been
> > resolved in .17, however, where they work perfectly.
> >
>
> What is an anoymous type?

Type Foobar
  Union
    myint(3) as integer
    Type
      as integer a, b, c, d
    End Type
  End Union
End Type

Here we actually have both an anonymous type AND an anonymous union.
The anonymous bit means that they don't have names, which means that
the members pretend to be members of the parent ("Foobar.myint(1)",
"Foobar.a").

The purpose of anonymous types is primarily for convenience in Unions.
The above could also be written like this:

Type baz
   as integer a, b, c, d
End Type

Type Foobar
  Union
    myint(3) as integer
    myvars as baz
  End Union
End Type

But, in this case, you're forcing the myvars name, making it look like
"Foobar.myvars.a" and "Foobar.myint(3)"
-- 
Mike Caron
Tale of the Cave
http://taleofthecave.com
_______________________________________________
ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to