[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: union member already defined?
- Subject: Re: union member already defined?
- From: theos <theosjp@xxxxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Sun, 29 Jul 2018 20:50:28 +0900
- To: myrddin-dev@xxxxxxxxxxxxxx
hi iriri -
thanks for the hello and welcome. yes, i find what you guys have been
putting together really amazing.
regarding the union - hmm... interesting. i've had noticed that the
code compiled when i made the tags unique, but i thought that this cant
be right.
do you know what the motivation was to scope it this way compared to c?
thanks,
theo
On 07/29/2018 09:43 AM, iriri wrote:
> Union tags must be unique within a given namespace.
>
> type u1 =
> `A1 int
> `B1 flt64
> ;;
>
> type u2 =
> `A2 flt64
> `B2 char
> ;;
>
> ---- On Sat, 28 Jul 2018 02:21:33 -0700 theos <theosjp@xxxxxxxxx> wrote ----
> > hi,
> >
> > i started to learn myrddin recently and was going through the tutorial.
> > i am getting - somewhat unexpected - an "already defined" error for the
> > below union example. this is with the latest version on linux.
> >
> > is this supposed to be this way? and if so what am i doing wrong?
> >
> > % mbld -R u2.myr
> > u2.myr:2: `a already defined on u2.myr:7
> > FAIL: 6m u2.myr
> >
> > % 6m u2.myr
> > u2.myr:2: `a already defined on u2.myr:7
> >
> > % cat u2.myr
> > type u1 = union
> > `a int
> > `b flt
> > ;;
> >
> > type u2 = union
> > `a flt
> > `b char
> > ;;
> >
> > const main = {
> >
> > }
> >
> > its error-ing out in stab.c - i've poked a bit around in putucon and
> > gram.y, but had to confess to myself that i dont really know what i am
> > looking for/at.
> >
> > Breakpoint 3, putucon (st=0x5555557d1070, uc=0x5555557dc460) at stab.c:495
> > 495 lfatal(old->loc, "`%s already defined on %s:%d",
> > (gdb) bt
> > #0 putucon (st=0x5555557d1070, uc=0x5555557dc460) at stab.c:495
> > #1 0x0000555555578d30 in installucons (st=0x5555557d1070,
> > t=0x5555557dc6a0) at gram.y:1252
> > #2 0x0000555555574484 in yyparse () at gram.y:248
> > #3 0x0000555555563e3b in main (argc=2, argv=0x7fffffffe728) at main.c:276
> >
> > thank you,
> > theo.
> >
> >
> >
>
>
>