tk3369  
                
               
                 
              
                  
                    April 30, 2019,  6:46am
                   
                   
              1 
               
             
            
              Given a tuple, how do I extract the type parameters information?   It seems that I can do the following but I’m wondering if there’s a better  way i.e. using a public API rather than accessing the types or parameters field (which seems “private” to me).  Similar post from 1.5 years ago .
julia> x = (1, 2, "a", 'c')
(1, 2, "a", 'c')
julia> tx = typeof(x)
Tuple{Int64,Int64,String,Char}
julia> tx.types
svec(Int64, Int64, String, Char)
julia> tx.parameters
svec(Int64, Int64, String, Char)
 
             
            
               
               
               
            
            
           
          
            
            
              julia> fieldtypes(typeof(x))
(Int64, Int64, String, Char)
 
             
            
               
               
              2 Likes 
            
            
           
          
            
              
                tk3369  
                
               
              
                  
                    April 30, 2019,  6:55am
                   
                   
              3 
               
             
            
              This is perfect but I’m curious how you figured this out?  I tried to find the right function using methodswith but did not see anything like this.
             
            
               
               
               
            
            
           
          
            
            
              
I was missing this functionality (as you noted in the topic you linked), so I made the PR 
  
  
    
    
  
      
    
      JuliaLang:master ← tpapp:tp/add-fieldtypes
    
      
        
          opened 02:11PM - 11 Oct 18 UTC 
        
        
        
       
   
 
  
    Add `Base.fieldtypes`. Cf `fieldnames` vs `fieldname`.
Fixes #24312, but is m… ore general. See discussion there. 
   
   
  
    
    
  
  
 
If you think the discoverability of this is lacking and could be improved, perhaps you should make a PR.
             
            
               
               
              1 Like 
            
            
           
          
            
              
                tk3369  
                
               
              
                  
                    April 30, 2019,  8:17am
                   
                   
              5 
               
             
            
              Haha…   That’s great!  Thanks a lot for your contribution!