Wednesday, April 07, 2010

Delimited continuations? In ECMAScript?

Well, no.

Besides breaking a lot of language invariants, first-class continuations would be a nightmare for portability, since different implementations implement different API's natively. Either you mandate capturing continuations across native frames, which is a hardship for implementers and a performance-killer, or you don't, which causes observably different behavior across browsers when they place native delimiters at different points in the continuations-- leading to lots of painful bug reports and nasty market dynamics where everyone has to tailor their implementations to track the most popular.

So that won't happen. But!

JS 1.7 introduced Pythonic generators, which allow you to suspend a single function activation. This alleviates some of the painful CPS patterns people have to use on the web to interact with the event-loop-concurrent, single-thread-of-control semantics of JavaScript on the web. But it's also a little ad hoc. And Kris Zyp recently made the helpful suggestion that we could explore a design for a simpler, more general single-frame continuation-capture operation for Harmony.

What we're talking about here is a restricted version of delimited continuations: the delimiters are implicit--they're at function boundaries. But otherwise it's very much in that space. And there's a loooot of prior work on this topic. I'll post later with a little background and some notes about the design space of delimited continuations for ES.

44 comments:

Mitch said...

I think I understand scheme's call/cc, and I was really excited originally to hear that kind of thing proposed for ES. Then later, on LTU, Brendan explained the script/native/script thing and I was sad.

I don't really get delimited continuations yet, I've seen Oleg Kiselyov posting about them a lot but I don't understand just about everything he writes. Still, it's really exciting to see some kind of continuations show up again in ES context; I haven't really followed the ES email lists for a while but maybe it's time to start reading them again.

TL;DR - Yay!

jto said...

I think Lars Thomas Hansen's complaint about single-frame continuations is that they break lambda abstraction. Beta reduction changes the meaning. What do you think about that?

Dave Herman said...

Lars Thomas Hansen's complaint about single-frame continuations is that they break lambda abstraction.

Well, full continuations certainly do expose details of lambda abstractions. The main issue is if a library function takes a funarg and calls it, the funarg might capture the continuation and use it multiple times. (You can think of this as the funarg "highjacking" the control flow.) Turns out lots of standard Scheme libraries like map are buggy because they don't expect control to return multiple times.

I suspect the situation isn't as bad in the case of single-frame continuations, though. Did Lars tell you this in person, or is he on record somewhere publicly? I'm having drinks with him on Wednesday, so I'll ask him myself. :)

Beta reduction changes the meaning. What do you think about that?

Well, I'm not sure what you mean, exactly. The beta rule stays the same in the presence of call/cc. It just means that some of the invariants about function abstraction are gone.

Dave Herman said...

PS I should say, lots of implementations of standard Scheme libraries. Didn't mean to imply the spec is buggy.

jto said...

The beta rule stays the same in the presence of call/cc, yes. But not in the presence of single-frame continuations (or generators) because there every function call implicitly installs a delimiter.

EXPR

(function () { return EXPR; })()

I'm talking about the difference between these two in terms of what is captured if EXPR contains f->(x).

This is something lth mentioned to me while ES4 was going on. However now I'm a bit worried that I've misrepresented the importance of this objection compared to others; and it's been a year or two.

Dave Herman said...

I see what you're getting at now.

So first of all, there's no beta rule in JS, just an ad hoc semantics of functions, which are already exposed in the semantics: return is a delimited abort operation; arguments is function-specific; Function.arguments; Function.callee... heck, the spec even refers to function calls as "allocating an activation object" whose slots are the local variables.

That said, you're right that this hooks one more piece of semantics into the meaning of functions. If JS hadn't long ago already gone down this road in spades, I would whole-heartedly agree. (For example, it'd be a total non-starter for Scheme. And if the lambdas proposal weren't dead, they'd be specified not to be implicitly delimited.)

Another way of putting it: rather than "changing the beta rule" (which is just a reduction rule), this ruins beta-equivalence. But beta-equivalence already doesn't hold in JS.

alexathomson said...

Get comprehensive round-the clock QuickBooks Support for all issues. The QuickBooks technical support team offers immediate assistance and can be reached by calling the QuickBooks Support Toll-free Number.

Smith John Live said...

Download and install the HP LaserJet Pro m404n driver
 
1.Go to the HP support site and download the driver
2.When you get the prompt choose the printer and then press download and run the HP Easy start
3.When prompted choose the printer and press the My print is not shown
4.Tap continue and then choose wireless network
5.Now follow the onscreen setup to finish the wireless network
To know more about the process of HP LaserJet pro m404n setup you can just give a call at. Also, drop in on our site for more steps on printer setup.

finnjordan100 said...

AVG Secure is a designed to keep your digital info safe and secure. Learn about its pricing, security features, and more in this review.
www.avg.com/retail | avg.com/retail |
Install AVG with license number |
AVG Download |
www.avg.com/activation

charlesbronson said...

Thank you for sharing excellent opinion. I am impressed by the details that you have going approximately for this website. I have more warn similar this blog. Click asleep to know these instruction
Norton setup | www.office.com/setup| office setup |
Avast customer support number | Avast help & support Number

Unknown said...

Did you realize there is a 12 word phrase you can communicate to your crush... that will induce deep emotions of love and impulsive appeal to you deep within his chest?

That's because hidden in these 12 words is a "secret signal" that fuels a man's instinct to love, cherish and guard you with his entire heart...

=====> 12 Words Who Fuel A Man's Love Response

This instinct is so hardwired into a man's brain that it will make him work harder than ever before to take care of you.

Matter of fact, triggering this powerful instinct is so essential to achieving the best possible relationship with your man that the second you send your man a "Secret Signal"...

...You'll immediately notice him expose his mind and soul for you in such a way he never expressed before and he will perceive you as the only woman in the galaxy who has ever truly appealed to him.

Elegant IT Services said...

Nice Post...Thanks for sharing the Information...
Elegant IT Services

wilder zayn said...

Mcafee.com/activate - Presently, technology is transforming at a quicker pace than ever. With all the growth in technology comes the increasing number of possibilities for cybercriminals to abuse. As a consequence, cybersecurity has become extremely essential in order to safeguard persona, consumer, and business information against various threats. visit on mcafee.com/activate | www.mcafee.com/activate | mcafee.com/activate

وصفات طبخ سريعة said...

IO GAMES and also pick up something similar for my Mitsubishi lancer GAME

Roku-comlink said...

If you need streaming at a great value, then you can go for Roku. You can use it easily once you have done Roku setup. It can be a massive benefit if you are using Roku.com/link, having access to thousands of channels.

augustwalker said...

how to setup a network printer windows 10 or system printer for your home or office and need to introduce it on Windows 10? Contrasted with the past times, including printers in Windows.

Home Appliance Services said...

We have thousands of happy customer in entire India. It's our entire team hard work who made us a remarkable brand in the field of AC installation and repair services. We believe in customer satisfaction and provides you, our services at the best market price. AC service engineer team at Samsung AC Service Centre in Jaipur are well qualified and fully trained.

hookstefan said...

the investigation for which eats up a tremendous portion
Assignment experts UK

Garmin.com/express-updates said...

It is also essential to frequently check Garmin express update.You can use Garmin express update version toupdate maps and ensure that the GPS functions accurately. It must remain updated to obtain the best performance.it's better to message on garmin.com/express, and you might get your solution.

Fubo.tv/Activate said...

Everyone knows that FuboTv is one of the best streaming platforms that provide you with a large number of sports and shows content. you can find anything on FuboTv from action shows to entertainment even educational stuff as per your requirement.You just have to complete Fubo.tv/Connect and then you are ready to go.
how do i activate FuboTV

Jaipur Escorts said...

Are you looking for sexy and bold call girls in Jaipur Escorts? So, you are searching for the right place because we are here now to give you an extreme level of sexual pleasure this you all time wanted with your wife and girlfriend but you never get it.

Fly Ash Supplier Louisiana said...

Hasten is uniquely positioned to maximize the success of its customers by utilizing its vast network of relationships along with its unwavering focus on its core principles of honesty, reliability, quality, credibility, and trust. With the goal of providing quality products, safely, and on a timely basis, Hasten will ensure you are satisfied with the end result.

Edmonton tile installation Contractor said...

Modern day caulk was invented in 1896, so if your home is older than that, you will have problems with tile staying in place.In the 1920s, acrylic, butyl, and silicone polymers were first developed and used in sealants. By the 1960s, synthetic-polymer-based sealants became available and that’s what we use today for the best bonding. Removing wall tiles is more difficult than removing floor tiles. Edmonton tile installation Contractor

Clothing women said...

Get Our Famous Hollywood Movies Leather outfits available at our Online Store Instyle.com, We offer free shipping.
Women's Leather Bomber Jackets

Jamie Starr said...

I found so many exciting matters in this particular content, I would like to request please keep posting such informative content. Check out apex focus groups inc canada

Unknown said...

Emblix Academy – Digital marketing institute in KPHB, we address all major and minor aspects required for any student’s advancement in digital marketing. Clutch USA named our Digital Marketing Institute the best SEO firm.

The future of digital marketing is promising and full of possibilities.
As a result, skilled digital marketers who can keep up with the rising demand are in high order.

In the Emblix Academy Digital marketing institute in KPHB, you will learn about all the major and minor modules of digital marketing, from Search engine marketing to Social Media Marketing and almost all Tools used for Digital Marketing.

One stop place for all Digital Marketing courses! Emblix Academy is a Team of dedicated Professionals with 12years of experience in various Digital Platforms. We assure to provide the best Digital Marketing courses to enhance your Career.

Certifications
• Search Advertising
• Display Advertising
• Analytics Certification
• Hubspot Certification
• Bing Certification
• Twitter Certification
• Facebook Certification

Website: https://emblixacademy.com/

Lazaro Coley said...

I'm always looking for free stuff on the web. There are other companies that offer free models.
Please refer to the article butterfly click on controller to know more about guide on how to Butterfly Click for an enhanced experience. Here you will read butterfly click on controller. Thank you for your attention!

mcafee.com activate said...

Thank You So Much For providing the important and Knowledgeable information

James K. said...

The setup process for every Canon model is almost similar, however the download through https //ij.start.cannon or http //ij.start.cannon and installation process may differ. Visit canon’s official site – ij.start.canon/ts3122 and download appropriate software and drivers one windows PC. You can also go to canon.com/ijsetup and use the “TS3122” name to get the latest software. Or if you have a CD, install it. ij.start canon is the manufacturer's site to download Canon printer drivers. Install and set up Canon Printer from ij.start.canon and obtain high-quality printing documents straightforwardly. cannon/ijsetup .

Anonymous said...

I wanted to thank you for this remarkable application! I really liked all your little things.
This is the topic you are going to read Click Counter. So if you want to learn more about this you can go through the name of the full article click speed test. Visit and be tech-aware.

Unknown said...

Digital Marketing Institute in KPHB, we address all major and minor aspects required for any student’s advancement in digital marketing. Clutch USA named our Digital Marketing Institute the best SEO firm.

The future of digital marketing is promising and full of possibilities.
As a result, skilled digital marketers who can keep up with the rising demand are in high order.

In the Emblix Academy Digital marketing institute in KPHB, you will learn about all the major and minor modules of digital marketing, from Search engine marketing to Social Media Marketing and almost all Tools used for Digital Marketing.


Website: Digital Marketing Institute in KPHB

Fubotv Activate said...

If the fubotv connect code, or different options are no longer working, you may also think about uninstalling and reinstalling the utility again. Download the software from the favored App save and deploy it again. In different cases, you can additionally attempt updating your application. fubo.tv/activate

zia sir said...

nice post
Stellar Toolkit for Data Recovery Crack

David malan said...

Your writing and structure have greatly impressed me.
blog Was this something you purchased, or did you make the changes yourself?
Whatever the situation may be, the most important thing is to listen to new music with high-quality lyrics.
It's rare to come across a blog of this calibre today.
wm recorder crack
stellar repair for outlook pro crack
artisteer crack
wondershare uniconverter crack

peacefull said...

I generally like the blog and I really respect your content.
The whole thing is going nicely here and ofcourse every one
is sharing information, genuinely good.Thanks
daemon tools pro crack
avast internet security crack
hitfilm pro crack
mathtype crack

Sabir Hussain said...

On the Internet, I was happy to discover this installation.
It was a wonderful read and I owe it to you at least once.
It touched my interest a little and you kindly kept it.
Become a fan of a new article on your site
bridgechecker crack
microsoft office 2016 crack
advanced systemcare ultimate crack
mixxx crack

Ismail said...

Hello there, could you tell me which blog platform you're working with?
I'm thinking about starting my blog soon, but I can't decide between BlogEngine/Wordpress/B2evolution and Drupal.
I'm curious because your design appears to be unique.
I'm looking for something different than other blogs.
P.S. Please accept my apologies for straying from the topic, but I had to inquire!
movavi slideshow maker crack
lightwave crack license key
gamesgod of war pc cd crack
internet download manager crack

Soft Crack said...

I am very impressed with your post because this post is very beneficial for me and provide a new knowledge to me. this blog has detailed information, its much more to learn from your blog post.I would like to thank you for the effort you put into writing this page.
I also hope that you will be able to check the same high-quality content later.Good work with the hard work you have done I appreciate your work thanks for sharing it. It Is very Wounder Full Post.This article is very helpful, I wondered about this amazing article.. This is very informative.
“you are doing a great job, and give us up to dated information”.
apowersoft pdf converter crack
vmware player crack
avira system speedup pro crack
picpick professional crack
easeus todo pctrans crack

Digital Marketing Institute in KPHB said...

Thanks for sharing such an interesting article. People should know this type of information to run in the flow and be present about what's going on in the market Digital Marketing Institute in KPHB

David Carter said...

あなたの作品、素晴らしい投稿が大好きです。 最新のモールス信号 の記事をチェックしていただければ幸いです。 短点と長点とも呼ばれる短点と長点は、モールス符号で通信のテキスト文字を表すために使用される 2 つの異なる信号持続時間の標準化されたシーケンスです。

Alicia Ranken said...

You should adjust the brightness settings to fix monitor Screen Burn-In Issue. Try lowering the brightness and contrast on your TV and watching some different content; it may go away on its own.

EMdigitizer said...

EMDigitizer has made embroidery services more efficient and productive. In the beginning, digitizing was done manually but with the passage of time, this has now become a digital process.

Flynn Bedford said...

Impressive. Thanks for the post. Keep it up. You’re doing a great job Man, Keep it up. Players who have a High CPS may be able to complete tasks more rapidly, providing them an edge in games with a brisk tempo. This can be especially helpful in games like first-person shooters and fighting games that call for quick responses. Using this profile you will get an idea about CPS Tester.

George Male said...

A true masterpiece of concise writing. This article wastes no words in delivering its profound message. Kudos to the author! Updating the touchpad drivers can often resolve jumpy behavior. Visit the manufacturer's website or use automatic driver update software to download and install the latest drivers for your specific laptop model. Go through this article to know more about fix Jumpy laptop touchpad issue.