Consuming var views?

64 views
Skip to first unread message

Shea Levy

unread,
Sep 7, 2014, 10:34:32 PM9/7/14
to ats-lan...@googlegroups.com
Hi all,

I have a function where I create an instance of a dataview from an
@-view of a var, and after the function I then break the dataview back
down into the component @-view. The compiler then complains that the
component @-view is not consumed, how can I consume it?

~Shea

Hongwei Xi

unread,
Sep 7, 2014, 10:40:37 PM9/7/14
to ats-lan...@googlegroups.com
Code?



~Shea

--
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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/20140908023429.GC2286%40nixos.hsd1.nh.comcast.net.

Shea Levy

unread,
Sep 7, 2014, 10:47:18 PM9/7/14
to ats-lan...@googlegroups.com
Simple reproduction:

> implement main() = let
> var x = 1 : int
> prval some = Some_v(view@(x))
> prval Some_v y = some
> in 0 end

gives me two errors:

> the linear dynamic variable [y$65(-1)] needs to be consumed but it is preserved with the type [S2EVar(0)] instead.
> the linear dynamic variable [x$view$66(-1)] is preserved but with an incompatible type.

Which make sense to me but I'm not sure how to fix it.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLqDYjgz5JoL_rpmW%3Dxedzj%2BOFdiuvZPLrA2oRkh-7QK_A%40mail.gmail.com.

gmhwxi

unread,
Sep 7, 2014, 11:32:53 PM9/7/14
to ats-lan...@googlegroups.com

implement main() = let
   var x = 1 : int
   prval some = Some_v{int@x}(view@x)

   prval Some_v y = some
   prval () = view@(x) := y
in 0 end

Shea Levy

unread,
Sep 8, 2014, 12:19:42 AM9/8/14
to ats-lan...@googlegroups.com
Ah ha, thanks!
> > > > email to ats-lang-user...@googlegroups.com <javascript:>.
> > > > To post to this group, send email to ats-lan...@googlegroups.com
> > <javascript:>.
> > > > Visit this group at http://groups.google.com/group/ats-lang-users.
> > > > To view this discussion on the web visit
> > > >
> > https://groups.google.com/d/msgid/ats-lang-users/20140908023429.GC2286%40nixos.hsd1.nh.comcast.net
> > > > .
> > > >
> > >
> > > --
> > > 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-user...@googlegroups.com <javascript:>.
> > > To post to this group, send email to ats-lan...@googlegroups.com
> > <javascript:>.
> --
> 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-user...@googlegroups.com.
> To post to this group, send email to ats-lan...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/75b55cd6-2d55-4bc6-afc3-f88e82d4716f%40googlegroups.com.

Zhiqiang Ren

unread,
Sep 8, 2014, 4:30:01 PM9/8/14
to ats-lan...@googlegroups.com
prval some = Some_v{int@x}(view@x)

Am I understanding correct that the static term {int@x} references a dynamic expression "x"? Thanks.

gmhwxi

unread,
Sep 8, 2014, 4:34:36 PM9/8/14
to ats-lan...@googlegroups.com

In int@x, x is static.

The declaration 'var x: int' also introduces a static address 'x'.
Reply all
Reply to author
Forward
0 new messages