Is it possible to have typeof

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

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.

I put an example on-line showing how to use ‘showtype’ and ‘showlvaltype’:

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.On Friday, February 21, 2014 1:43:59 AM UTC-5, chotu s wrote:

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

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.On Tue, May 12, 2015 at 6:13 PM, ‘Yannick Duchêne’ via ats-lang-users < ats-lan...@googlegroups.com> wrote:

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.


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.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/c94db493-430e-483b-a9f9-d914fc6dbacb%40googlegroups.com
https://groups.google.com/d/msgid/ats-lang-users/c94db493-430e-483b-a9f9-d914fc6dbacb%40googlegroups.com?utm_medium=email&utm_source=footer
.

$showtype does this.On Feb 21, 2014 1:44 AM, “chotu s” chot...@gmail.com wrote:

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


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
.

But I think it directly prints the string.On Feb 21, 2014 8:40 AM, “Brandon Barker” brandon...@gmail.com wrote:

$showtype does this.
On Feb 21, 2014 1:44 AM, “chotu s” chot...@gmail.com wrote:

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


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
.