What is lense?

85 views
Skip to first unread message

gmhwxi

unread,
Jul 7, 2024, 12:50:08 PM7/7/24
to ats-lang-users
Yes, it is lense (not lens).

"Lense" is word I coined that means something kind of related to
the notion of 'tense' in grammar.

(I tried 'linse' but settled on 'lense').

If the lense of a verb is '1', then the verb maintains its object.
If the lense of a verb is '0', then the verb consumes its object.

The typical word whose lense is 0 is 'free' (as in freeing an object).
And the typical word whose lense is 1 is 'copy'.

In ATS3 library, the name of a function should, by convention, indicate
explicitly the lense of the verb contained in the name.

Cheers,

--Hongwei


gmhwxi

unread,
Jul 7, 2024, 12:56:20 PM7/7/24
to ats-lang-users
By the way, what I said below only applies to verbs
processing linear objects. There is no lense for verbs
processing non-linear objects.

Vanessa McHale

unread,
Jul 10, 2024, 10:38:54 PM7/10/24
to ats-lan...@googlegroups.com
Interesting! I think lenses have popped up in the context of machine learning, where information “flows up”


The notion of information/discarding information is present in linear logic, quite eager to see how this pans out!

Cheers,
Vanessa McHale

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/1abd3417-527d-4afb-a8e4-5b9e05d025bfn%40googlegroups.com.

Dambaev Alexander

unread,
Jul 12, 2024, 8:50:28 AM7/12/24
to ats-lan...@googlegroups.com
Hi everyone,

so lense is a best practice of how to name functions to not to rely on a memory of a programmer and to be able to tell what function accepts and maybe consumes? There is no enforcement from the compiler, am I got it right? :)

чт, 11 июл. 2024 г. в 02:38, Vanessa McHale <vamc...@gmail.com>:

gmhwxi

unread,
Jul 12, 2024, 9:03:52 AM7/12/24
to ats-lang-users
>> not to rely on a memory of a programmer

It is more than that.

For instance, we can have list_vt_tally0 and list_vt_tally1.
Based on the names, you can tell that the former one consumes the given linear list
but the latter one does not. Say we have:

#symload tally0 with llist_vt_tally0
#symload tally1 with llist_vt_tally1

Then the programmer can decide the lense of 'tally', that is, choose either tally0 or tally1.

>> There is no enforcement from the compiler, am I got it right? :)

Yes, it is just a naming convention right now. I suppose that we can write a checker to flag
out function names that violate this convention. Kind of like grammar checking.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages