Runtime checks of parametric annotations

25 views
Skip to first unread message

Jake Wheat

unread,
May 24, 2022, 4:11:50 AM5/24/22
to Pyret Discuss
Hi All,

Quoting from here: https://www.pyret.org/docs/latest/s_annotations.html

> To properly express the constraint on the contents, we need to specialize the list annotation:

>    list-of-nums :: List<Number> = [list: 1, 2, 3]

> Note that this annotation will not dynamically check that every item in the list is in fact a Number — that would be infeasibly expensive.

Is there any hope for a non-infeasibly expensive way to check annotations like this dynamically?

Thanks,
Jake.

Shriram Krishnamurthi

unread,
May 24, 2022, 10:10:47 AM5/24/22
to pyret-...@googlegroups.com
There are lazy approaches, like that discussed by Findler and others in ~2007. But we don't plan to add these to Pyret in the foreseeable future.

Jake Wheat

unread,
May 25, 2022, 3:19:04 AM5/25/22
to Pyret Discuss
Thanks, I found some papers by Findler that look interesting.
Reply all
Reply to author
Forward
0 new messages