ATS Dynamic Loading

34 views
Skip to first unread message

aditya siram

unread,
Sep 22, 2016, 4:31:34 PM9/22/16
to ats-lang-users
Hi,
I was wondering if ATS supports something like an `eval` function. I realize there's a `dynload` for loading a DATS file at runtime but I was wondering if this can be extended to arbitrary code.
Thanks!
-deech

Hongwei Xi

unread,
Sep 22, 2016, 7:05:08 PM9/22/16
to ats-lan...@googlegroups.com

Dynload is for the purpose of initializing toplevel
name/values bindings.

I am not completely clear about what you really need here.

An example? A use case?

--
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/1a396ee2-3047-4ec6-add2-4f48485b55a1%40googlegroups.com.

aditya siram

unread,
Sep 23, 2016, 2:55:47 AM9/23/16
to ats-lang-users
I'm working on a toy Lisp implementation that outputs ATS as a compilation target. It would be convenient if ATS had an `eval`, for instance, `eval("1 + 2")` that compiled and loaded on-the-fly.
-deech

On Thursday, September 22, 2016 at 6:05:08 PM UTC-5, gmhwxi wrote:

Dynload is for the purpose of initializing toplevel
name/values bindings.

I am not completely clear about what you really need here.

An example? A use case?
On Thu, Sep 22, 2016 at 4:31 PM, aditya siram <aditya...@gmail.com> wrote:
Hi,
I was wondering if ATS supports something like an `eval` function. I realize there's a `dynload` for loading a DATS file at runtime but I was wondering if this can be extended to arbitrary code.
Thanks!
-deech

--
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.

gmhwxi

unread,
Sep 23, 2016, 10:11:52 AM9/23/16
to ats-lang-users
Here is my suggestion:

You can define a datatype as follows:

datatype expr(a: type) = ...

extern
fun
eval_expr{a:type} (e0: expr(a)) -> a

Your compiler needs to have two modes: for compiling to ATS and for
compilng to a value of the type expr(T) for some T.

I used to call expr a guarded recursive datatype, but Haskell people nowadays
call it a generalized datatype.

Or simply do

datatype expr = ...

and then use run-time checks to discover type information.

A lisp-like eval cannot be easily added to ATS due to typing complications.

aditya siram

unread,
Sep 23, 2016, 6:06:56 PM9/23/16
to ats-lang-users
Thank you for your feedback. I will do that.
Reply all
Reply to author
Forward
0 new messages