# Named fields in viewtypes?

**URL:** <https://discourse.ats-lang.org/t/named-fields-in-viewtypes/597>\
**Category:** Google Group\
**Created:** [September 12, 2014, 2:43am UTC](https://discourse.ats-lang.org/t/named-fields-in-viewtypes/597 "2014-09-12T02:43:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shea\_Levy](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@Shea\_Levy](https://discourse.ats-lang.org/u/Shea_Levy)\
**Post date:** [September 12, 2014, 2:43am UTC](https://discourse.ats-lang.org/t/named-fields-in-viewtypes/597/1 "2014-09-12T02:43:41Z")

</div>

Hi all,

From [1](http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/x3321.html), I see that the view and type of a viewtype can be access with  
.0 and .1, respectively. Is there a way to name these like a record?

Thanks,  
Shea

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [September 12, 2014, 3:28am UTC](https://discourse.ats-lang.org/t/named-fields-in-viewtypes/597/2 "2014-09-12T03:28:43Z")

</div>

vtypedef tptr (a:t@ype, l:addr) = (a @ l | ptr l)

can also be defined as follows:

vypedef tptr (a:t@ype, l:addr) = @{ tptr\_pf= a @ l | tptr\_ptr= ptr l}On Thursday, September 11, 2014 10:44:01 PM UTC-4, Shea Levy wrote:

> Hi all,
> 
> From [1](http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/x3321.html), I see that the view and type of a viewtype can be access with  
> .0 and .1, respectively. Is there a way to name these like a record?
> 
> Thanks,  
> Shea

---

<div class="post-metadata">

**Author:** ![Shea\_Levy](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@Shea\_Levy](https://discourse.ats-lang.org/u/Shea_Levy)\
**Post date:** [September 12, 2014, 8:49am UTC](https://discourse.ats-lang.org/t/named-fields-in-viewtypes/597/3 "2014-09-12T08:49:19Z")

</div>

Ah ha, thanks!

~SheaOn Thu, Sep 11, 2014 at 08:28:43PM -0700, gmhwxi wrote:

> vtypedef tptr (a:t@ype, l:addr) = (a @ l | ptr l)
> 
> can also be defined as follows:
> 
> vypedef tptr (a:t@ype, l:addr) = @{ tptr\_pf= a @ l | tptr\_ptr= ptr l}
> 
> On Thursday, September 11, 2014 10:44:01 PM UTC-4, Shea Levy wrote:
> 
> > Hi all,
> > 
> > From [1](http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/x3321.html), I see that the view and type of a viewtype can be access with  
> > .0 and .1, respectively. Is there a way to name these like a record?
> > 
> > Thanks,  
> > Shea
> 
> –  
> 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](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/ats-lang-users](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/a7f3d264-4aa2-4810-8a39-a0bedac1f5cf%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/a7f3d264-4aa2-4810-8a39-a0bedac1f5cf%40googlegroups.com).
