Dear all, I'm trying to write following code:
```ats #include "share/atspre_define.hats" #include "share/atspre_staload.hats" #define RTM_DELETE 0x2 #define ENOTSUP 45 typedef rtentry = @{ member_a = int } typedef nhop_object = @{ member_b = int } vtypedef rib_cmd_info = @{ rc_rt = [l:addr] (rtentry @ l | ptr l) } fun rtsock_routemsg {l1,l2:addr} (pfrt: !rtentry@l1, pfnh: !nhop_object@l2 | cmd: int, rt: ptr l1, nh: ptr l2, fibnum: int): int = cmd + !rt.member_a + !nh.member_b fun rib_del_route {l:addr} (pf: !rib_cmd_info? >> rib_cmd_info @ l | rc: ptr l): int = undefined() fun rib_action {l:addr} (pf: !rib_cmd_info? >> rib_cmd_info @ l | action: int, rc: ptr l): int = case+ action of | RTM_DELETE => rib_del_route(pf | rc) | _ => ENOTSUP implement main0 () = { var rc: rib_cmd_info prval pfrc = view@rc val error = rib_action(pfrc | RTM_DELETE, addr@rc) prval () = view@rc := pfrc } ``` But above code causes following error: ``` $ patscc -D_GNU_SOURCE -DATS_MEMALLOC_LIBC main.dats -lpthread /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 694(line=36, offs=35) -- 696(line=36, offs=37): error(3): the function argument needs to be a left-va lue. /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 680(line=36, offs=21) -- 702(line=36, offs=43): error(3): the linear dynamic variable [pf$4748(-1)] i s preserved but with an incompatible type. /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 680(line=36, offs=21) -- 702(line=36, offs=43): error(3): mismatch of static terms (tyleq): The actual term is: S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l(8480) )))))) The needed term is: S2Eat(S2Etyrec(flt0; npf=-1; rc_rt=S2Eexi(l$8631(14298); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l$8631(14298))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l$8 631(14298)))))); S2Evar(l(8484))) /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 817(line=42, offs=26) -- 821(line=42, offs=30): error(3): the dynamic expression cannot be assigned t he type [S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l(8480)))))))]. /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 817(line=42, offs=26) -- 821(line=42, offs=30): error(3): mismatch of static terms (tyleq): The actual term is: S2Eat(S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l (8480))))))); S2Evar(rc(8485))) The needed term is: S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l(8480) )))))) /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 744(line=39, offs=22) -- 875(line=44, offs=2): error(3): the linear dynamic variable [rc$view$5549(-1 )] is preserved but with an incompatible type. /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 744(line=39, offs=22) -- 875(line=44, offs=2): error(3): mismatch of static terms (tyleq): The actual term is: S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l$8634$8635(14302))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l$8634$8635(14302)))) The needed term is: S2Ecst(ptr_type) /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 744(line=39, offs=22) -- 875(line=44, offs=2): error(3): mismatch of static terms (tyleq): The actual term is: S2Eexi(l$8634(14301); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l$8634(14301))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l$8634(14301))))) The needed term is: S2Ecst(ptr_type) /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 744(line=39, offs=22) -- 875(line=44, offs=2): error(3): mismatch of static terms (tyleq): The actual term is: S2Etyrec(flt0; npf=-1; rc_rt=S2Eexi(l$8634(14301); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l$8634(14301))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l$8634(14 301)))))) The needed term is: S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l(8480) )))))) /home/kiwamu/src/metasepi-postmortem/PR/FreeBSD-kernel/253800/Resolution/ATS2/fix/main.dats: 744(line=39, offs=22) -- 875(line=44, offs=2): error(3): mismatch of static terms (tyleq): The actual term is: S2Eat(S2Etyrec(flt0; npf=-1; rc_rt=S2Eexi(l$8634(14301); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l$8634(14301))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l$8 634(14301)))))); S2Evar(rc(8485))) The needed term is: S2Eat(S2Etyrec(flt0; npf=-1; rc_rt=S2Etop(knd=0; S2Eexi(l(8480); ; S2Etyrec(flt0; npf=1; 0=S2Eapp(S2Ecst(@); S2Ecst(rtentry), S2Evar(l(8480))), 1=S2Eapp(S2Ecst(ptr); S2Evar(l (8480))))))); S2Evar(rc(8485))) ``` Using view in vtypedef is bad manner on ATS2? Best regards, -- Kiwamu Okabe at METASEPI DESIGN -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAEvX6d%3DoBJV8NS9nVh3gjaWYhduuxuCeEBSTa3%2BzdjFU1XpgSA%40mail.gmail.com.