abstype

47 views
Skip to first unread message

Brandon Barker

unread,
Feb 20, 2014, 9:27:52 PM2/20/14
to ats-lan...@googlegroups.com
What is the difference between 

abstype mytyp = ptr

and just 

abstype mytyp 


Is the first the same as:
abstype mytyp
typedef mytyp = ptr?

gmhwxi

unread,
Feb 20, 2014, 10:30:11 PM2/20/14
to ats-lan...@googlegroups.com

abstype mytyp = ptr // this one is correct
abstype mytype // this one currently causes problems during compilation (but it is okay during typechecking)

######

abstype mytyp
typedef mytyp = ptr?

Should never do this. If you do this, then the first declaration is shallowed.

Brandon Barker

unread,
May 14, 2014, 12:47:46 PM5/14/14
to ats-lan...@googlegroups.com
I am still a bit unclear on how to use these at times. If the implementation is still in flux, knowing what is intended versus what is implemented might also be helpful to know about.

For instance, is this:

abst@ype mtype = @{int, int}

essentially the same as:

abst@ype mytpe = ptr 
assume mytype = @{int, int}

?

My guess: no, but I don't really know why it wouldn't be.

gmhwxi

unread,
May 14, 2014, 12:55:37 PM5/14/14
to ats-lan...@googlegroups.com
You guessed right. The answer is negative.

The following declaration says that mytype is abstract and
its size equals the size of @(int, int).

abst@ype mytype = @(int, int)

In other words, mytype and @(int, int) have the same size.
This information is needed for allocating memory needed to store
a value of mytype.
Reply all
Reply to author
Forward
0 new messages