The lin effect on ordinary (not lambda) function

17 views
Skip to first unread message

Yannick Duchêne

unread,
Aug 3, 2018, 9:38:22 PM8/3/18
to ats-lang-users
I just checked this and got an unexpected result:

This, is OK:

        viewtypedef t = () -<lin> void

        var f:t = llam() => ()
        val () = f()
        // val () = f() // Error, evaluation is already consumed.

This, is unexpected:

        fn g():<lin> void = ()

        val () = g()
        val () = g() // Should be an error but is not?

I though the second evaluation would trigger an error, but since an ordinary function is not an l‑value, may be it can’t be linear. But if this is the explanation, then this effect should be rejected on ordinary function. Unless I’m wrong …

`$showtype` says `g` is of type sort, not viewtype sort.

Hongwei Xi

unread,
Aug 3, 2018, 9:44:56 PM8/3/18
to ats-lan...@googlegroups.com
Right now, 'lin' in the following declaration is ignored:

fn g():<lin> void = ()

The only way to get a linear function is through 'llam'.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/221f64a7-38e9-4a22-8767-c860587cfeee%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages