4 ms·
Originally I had milder "this could be a problem" objections, but now on my Nth edit I've fallen into "are you trying to drive us all insane" territory. So her
by Terr_ 13y ago
Originally I had milder "this could be a problem" objections, but now on my Nth edit I've fallen into "are you trying to drive us all insane" territory.
So here's the (shorter) list of issues, which I'll support later on with code samples:
1. The new behavior is invisible to most readings of the source code. It's just magic, and unless you've obsessively tracked the magic as it flows, you never know where it might be.
2. The magic can strike in any place, at any time, and can throw an exception when it happens. Even `a=b+c` is no longer safe.
3. Even when it doesn't throw an exception, the magic can cause anywhere/anytime pauses and delays. Good luck with that smooth animation function.
4. The assignment semantics mean that even the equals sign is not safe, and can fuck up my code.
5. Infinite loops?
6. Indefinite resolution?
______________
#1:
Should be self-evident. There's no way to know, reading code, whether a variable is a future, unless you backtrack it alllll the way. There are no annotations or markings as it flows.
That would be par-for-the-course in JS and fine except that we're not just talking about another scalar type, this is a whole new beast.
#2:
future function getCount(){
raise "OH GOD THE NETWORK IS DOWN";
}
var b = 7;
var c = getCount();
var a = b + c; // How was I supposed to expect an exception here!?
#3:
var congratulationAnimation = function(msg){
// Spend 1 second fading in different UI elements
var escaped = escapeForHtml(msg);
// Spend 1 second fading in message
// Spend 1 second fading in remainder of UI elements
};
var msg = getMessage(); // Secretly a future from somewhere
congratulationAnimation(msg);
// WTF, why is my animation pausing halfway!?!?
#4:
var msg = future;
alert(msg);
// [...elsewhere...]
// Store heroic status update
msg = "Today I beat up a baby";
msg += " godzilla which was terrorizing a local school";
// OH GOD THEY THINK I'M A VILLAIN NOW
#5:
// I have no clue what this'll do.
var a = future;
a = 1 + a;
#6:
// What does this do, break console output forever?
var f = function(){
var a = future;
console.log(a);
}
f();
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]