3 ms·
I recall another language that was trying to do something similar. In most languages you have to decide about x:1 versus x:* relationships very early and it’s a
by hinkley 7y ago
I recall another language that was trying to do something similar. In most languages you have to decide about x:1 versus x:* relationships very early and it’s a painful refactor to go back and fix it. This one tried to fix it as well so that much of the time you only changed the variable declaration and the code just worked.
jQuery made a similar observation, and many of its functions are list comprehensions. If they had chosen a different default behavior for empty lists I might still be championing it today. But the silent failures were a bitter pill to swallow.
In fact I sometimes still fantasize about building a mini front end framework containing the inverse behavior and some other more modern ideas.
- wavefunction 7y agox^n includes x^1
- hinkley 7y agoThose weren’t exponents and this sounds like a non sequitur. Also variance disagrees with you. A function that takes a single value may be generalized to take multiple values but it’s harder for a caller that expects a single value in return to be faced with multiple answers. If I ask for your shipping address and get three, I can’t send the package to three places. I have to change the workflow quite a bit.
- k__ 7y agoWhat's the inverse behavior?
- hinkley 7y agoAh, yes. I meant fail on an operation on an empty set. The number of times that I’ve had a potentially empty set is a fraction of all situations. Often a select all/select none situation, and adding a flag for silent failure in that case is cheap compared to all of the other bugs I’ve had to fix.