Skip to content
  • Home Home Home, current page.
  • Moments Moments Moments, current page.

Saved searches

  • Remove
  • In this conversation
    Verified accountProtected Tweets @
Suggested users
  • Verified accountProtected Tweets @
  • Verified accountProtected Tweets @
  • Language: English
    • Bahasa Indonesia
    • Bahasa Melayu
    • Català
    • Čeština
    • Dansk
    • Deutsch
    • English UK
    • Español
    • Filipino
    • Français
    • Hrvatski
    • Italiano
    • Magyar
    • Nederlands
    • Norsk
    • Polski
    • Português
    • Română
    • Slovenčina
    • Suomi
    • Svenska
    • Tiếng Việt
    • Türkçe
    • Ελληνικά
    • Български език
    • Русский
    • Српски
    • Українська мова
    • עִבְרִית
    • العربية
    • فارسی
    • मराठी
    • हिन्दी
    • বাংলা
    • ગુજરાતી
    • தமிழ்
    • ಕನ್ನಡ
    • ภาษาไทย
    • 한국어
    • 日本語
    • 简体中文
    • 繁體中文
  • Have an account? Log in
    Have an account?
    · Forgot password?

    New to Twitter?
    Sign up
pcwalton's profile
Patrick Walton
Patrick Walton
Patrick Walton
@pcwalton

Tweets

Patrick Walton

@pcwalton

Research engineer at Mozilla

San Francisco, CA
pcwalton.github.io
Joined November 2009

Tweets

  • © 2018 Twitter
  • About
  • Help Center
  • Terms
  • Privacy policy
  • Cookies
  • Ads info
Dismiss
Previous
Next

Go to a person's profile

Saved searches

  • Remove
  • In this conversation
    Verified accountProtected Tweets @
Suggested users
  • Verified accountProtected Tweets @
  • Verified accountProtected Tweets @

Promote this Tweet

Block

  • Tweet with a location

    You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more

    Your lists

    Create a new list


    Under 100 characters, optional

    Privacy

    Copy link to Tweet

    Embed this Tweet

    Embed this Video

    Add this Tweet to your website by copying the code below. Learn more

    Add this video to your website by copying the code below. Learn more

    Hmm, there was a problem reaching the server.

    By embedding Twitter content in your website or app, you are agreeing to the Twitter Developer Agreement and Developer Policy.

    Preview

    Why you're seeing this ad

    Log in to Twitter

    · Forgot password?
    Don't have an account? Sign up »

    Sign up for Twitter

    Not on Twitter? Sign up, tune into the things you care about, and get updates as they happen.

    Sign up
    Have an account? Log in »

    Two-way (sending and receiving) short codes:

    Country Code For customers of
    United States 40404 (any)
    Canada 21212 (any)
    United Kingdom 86444 Vodafone, Orange, 3, O2
    Brazil 40404 Nextel, TIM
    Haiti 40404 Digicel, Voila
    Ireland 51210 Vodafone, O2
    India 53000 Bharti Airtel, Videocon, Reliance
    Indonesia 89887 AXIS, 3, Telkomsel, Indosat, XL Axiata
    Italy 4880804 Wind
    3424486444 Vodafone
    » See SMS short codes for other countries

    Confirmation

     

    Welcome home!

    This timeline is where you’ll spend most of your time, getting instant updates about what matters to you.

    Tweets not working for you?

    Hover over the profile pic and click the Following button to unfollow any account.

    Say a lot with a little

    When you see a Tweet you love, tap the heart — it lets the person who wrote it know you shared the love.

    Spread the word

    The fastest way to share someone else’s Tweet with your followers is with a Retweet. Tap the icon to send it instantly.

    Join the conversation

    Add your thoughts about any Tweet with a Reply. Find a topic you’re passionate about, and jump right in.

    Learn the latest

    Get instant insight into what people are talking about now.

    Get more of what you love

    Follow more accounts to get instant updates about topics you care about.

    Find what's happening

    See the latest conversations about any topic instantly.

    Never miss a Moment

    Catch up instantly on the best stories happening as they unfold.

    Patrick Walton‏ @pcwalton Oct 19

    The cost of guaranteed tail call optimization is that you have to adopt the Pascal (callee side) convention for stack frame cleanup, so functions can’t reuse outgoing argument space. Does it matter in practice? Dunno.

    8:30 AM - 19 Oct 2018
    • 1 Retweet
    • 13 Likes
    • Shawn Brendan Zabarauskas Zaki Manian Rob Palmer Jason Mulligan Jacob Matthews D-MO sevpuri ihnorton
    4 replies 1 retweet 13 likes
      1. New conversation
      2. Tony Garnock-Jones‏ @leastfixedpoint Oct 19
        Replying to @pcwalton

        I don't understand what you mean by "reuse": if a fn makes multiple non-tail calls it reuses a region of stack for each; and if it finishes with a tail call, it reuses the place its own inbound args went. What am I missing?

        1 reply 0 retweets 0 likes
      3. Patrick Walton‏ @pcwalton Oct 19
        Replying to @leastfixedpoint

        The problem is if you tail call a function that takes more argument space than you do.

        2 replies 0 retweets 0 likes
      4. Patrick Walton‏ @pcwalton Oct 19
        Replying to @pcwalton @leastfixedpoint

        (What you describe is called "sibling call optimization", and it's a special case of TCO. GCC and LLVM will do sibling call optimization since it works with the C calling convention.)

        0 replies 0 retweets 1 like
      5. End of conversation
      1. New conversation
      2. Sam Tobin-Hochstadt‏ @samth Oct 19
        Replying to @pcwalton

        There are definitely multiple calling conventions possible for tail calls. Rabbit did it differently than almost all compilers today, for example.

        1 reply 0 retweets 3 likes
      3. Lars Bergstrom‏ @larsberg_ Oct 19
        Replying to @samth @pcwalton

        Yes, and if you think of "guaranteed tail call optimization" as a degenerate case of code from a compiler that CPS transforms before final gen, there's a family of calling conventions even within a single compiler (self recursive, known target, unknown, FV(f)=0 vs. >0, etc.).

        0 replies 0 retweets 1 like
      4. End of conversation
      1. New conversation
      2. Yehuda Katz  🥨‏Verified account @wycats Oct 19
        Replying to @pcwalton

        And having to memorize the patterns. Give me growable stacks and I love you. Give me tail calls and maybe I'll think about it sometimes.

        2 replies 0 retweets 1 like
      3. Sam Tobin-Hochstadt‏ @samth Oct 19
        Replying to @wycats @pcwalton

        What's "the patterns"? return f(x) is a tail call, other stuff not so much.

        1 reply 0 retweets 0 likes
      4. Yehuda Katz  🥨‏Verified account @wycats Oct 19
        Replying to @samth @pcwalton

        But then I have to avoid using other kinds of recursion. Growable stacks don't have that problem.

        1 reply 0 retweets 0 likes
      5. Sam Tobin-Hochstadt‏ @samth Oct 19
        Replying to @wycats @pcwalton

        I'm not knocking growable stacks! Neither pointless low limits on resources nor holding onto resources that are no longer needed are things we should accept from our systems.

        1 reply 0 retweets 0 likes
      6. Yehuda Katz  🥨‏Verified account @wycats Oct 19
        Replying to @samth @pcwalton

        I'm saying that from a programming model perspective, growable stacks let me stop thinking about recursion limits as fundamental, while PTC or TCO lets me try to optimize a subset of recursion cases. The former is a more fundamental improvement to my QOL.

        1 reply 0 retweets 1 like
      7. Sam Tobin-Hochstadt‏ @samth Oct 19
        Replying to @wycats @pcwalton

        I agree that if you have arbitrary depth stacks, then proper tail calls cause your program to work (vs crash) in many fewer cases. But I think that "allow the programmer to avoid using too many resources" is fundamental as well.

        1 reply 0 retweets 0 likes
      8. Yehuda Katz  🥨‏Verified account @wycats Oct 19
        Replying to @samth @pcwalton

        Which works as long as you spend the time to structure your recursive program to use tail calls for recursion.

        1 reply 0 retweets 0 likes
      9. Sam Tobin-Hochstadt‏ @samth Oct 19
        Replying to @wycats @pcwalton

        No the point is that you *can* avoid holding onto unnecessary resources. Without proper tail calls, some programs have memory leaks that you can't fix.

        1 reply 0 retweets 1 like
      10. 1 more reply
      1. Stu Hood‏ @stuhood Oct 19
        Replying to @pcwalton

        Is this something that could be monomorphized? Or is the issue more to do with the complexity of having multiple calling conventions?

        0 replies 0 retweets 0 likes
        Thanks. Twitter will use this to make your timeline better. Undo
        Undo

    Loading seems to be taking a while.

    Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.

      Promoted Tweet

      false

      • © 2018 Twitter
      • About
      • Help Center
      • Terms
      • Privacy policy
      • Cookies
      • Ads info