The Paradox of Partial Parametricity

Kevin Smith zenparsing at gmail.com
Fri May 10 06:58:24 PDT 2013


>      class AsyncTable<T,U> {
>>         constructor() {
>>             this.m = Map<T,U>(); // encapsulation doesn't matter for this
>> example
>>         }
>>         set(keyP :Promise<T>, val :U) {
>>             keyP.then(key => { this.m.set(key, val) });
>>         }
>>         get(keyP :Promise<T>) :Promise<U> {
>>             return keyP.then(key => this.m.get(key));
>>         }
>>     }
>>
>>
The way to make this work would be to lift the value stored in the map.

    get(keyP :Promise<T>) :Promise<U> {
        return keyP.then(key => Q.fullfill(this.m.get(key)));
    }

Do you agree?  Is your premise that forgetting such a "lawyer-ly" detail
will amount to a foot-gun?

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130510/818cba82/attachment.html>


More information about the es-discuss mailing list