Is there/can there be a tailcall optimisation for match types? #23130
              
                Unanswered
              
          
                  
                    
                      bishabosha
                    
                  
                
                  asked this question in
                Compiler internals Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
step 1. copy to clipboard a 200 elem tuple.
scala -e 'println((1 to 200).mkString("(", ",", ")"))' | pbcopystart repl with a small stack size
surely
Tuple.Lastshouldn't blow the stack because internally its representation as a match type can be turned into a loop?as it is unfortunately most of the tuple match types are not written in a tail recursive way if this optimisation was ever brought to production, are they frozen for compatibility or only the bound matters?
Beta Was this translation helpful? Give feedback.
All reactions