Is it possible to have typeof ..

48 views
Skip to first unread message

chotu s

unread,
Feb 21, 2014, 1:43:59 AM2/21/14
to ats-lan...@googlegroups.com
Is it possible to have primitive "typeof" which takes a expression and produce the type of that expression rep as a  string which can be printed.

For example :

val x : string = typeof(10)

Thanks



Brandon Barker

unread,
Feb 21, 2014, 8:40:44 AM2/21/14
to chotu s, ats-lan...@googlegroups.com

$showtype does this.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4zkDJ82JeSZFQF8GCFGk5f%2BuS70HGUbgSfyY4B9S019Wg%40mail.gmail.com.

Brandon Barker

unread,
Feb 21, 2014, 8:41:57 AM2/21/14
to chotu s, ats-lan...@googlegroups.com

But I think it directly prints the string.

gmhwxi

unread,
Feb 21, 2014, 12:45:42 PM2/21/14
to ats-lan...@googlegroups.com
I put an example on-line showing how to use 'showtype' and 'showlvaltype':

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/ATS-QA-LIST/qa-list-205.dats

If showtype is not available, try $showtype; showlvaltype should be available.

Both showtype and showlvaltype are based on $showtype, which indicates to the typechecker of ATS
that the type of its argument needs to be printed out during typechecking.

Yannick Duchêne

unread,
May 12, 2015, 6:13:20 PM5/12/15
to ats-lan...@googlegroups.com


Le vendredi 21 février 2014 18:45:42 UTC+1, gmhwxi a écrit :
I put an example on-line showing how to use 'showtype' and 'showlvaltype':

https://github.com/githwxi/ATS-Postiats/blob/master/doc/EXAMPLE/ATS-QA-LIST/qa-list-205.dats

If showtype is not available, try $showtype; showlvaltype should be available.

`showlvaltype`  seems to not be anymore.

 

Hongwei Xi

unread,
May 12, 2015, 6:17:03 PM5/12/15
to ats-lan...@googlegroups.com
See prelude/macrodef.sats:

macdef showtype (x) = $showtype ,(x)
macdef showview (x) = pridentity_v ($showtype ,(x))
macdef showviewtype (x) = pridentity_vt ($showtype ,(x))

It is called showviewtype. I will add showvtype for showviewtype later.



--
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.
Reply all
Reply to author
Forward
0 new messages