Comments (6)
Very cryptically written. As I understand you want something like in:
in Pharo Smalltalk. AFAICT this construct is not Array-specific, it is useful in any object, if it would be added. What complicates it, is if result is null
or undefined
(which is not a problem in "everything is an object" Smalltalk). BTW what's wrong with plain
console.log([1,2,3].map(function(v){
return v+1;
}));
except it is a bit awkward? In ES6, a more awkward
((_=[1,2,3].map(function(v){
return v+1;
})) => console.log(_))()
is probably possible as well.
from ecma262.
@Herby Thank you , your description is more clear 👍
Let everything in js have a feed
method is all I want .
from ecma262.
// with the proposed Object.prototype.feed
[1,2,3].map(function(v){ return v + 1; }).feed(console.log.bind(console));
// or:
[1,2,3].map(_ => _ + 1).feed(_ => console.log(_));
// without it:
console.log([1,2,3].map(function(v){ return v + 1; }));
// or:
console.log([1,2,3].map(_ => _ + 1));
I can't see any justification for this.
from ecma262.
@michaelficarra It will make a more fluent and chain-able (like jQuery method chaining) programming experience.
from ecma262.
@Youmoo Libraries like underscore do this without extending Object.prototype
:
_([1,2,3]).map(_ => _ + 1).feed(_ => console.log(_)).done();
from ecma262.
Closing this now. Proposals should have an identified champion and repository set up where work happens. This is not the place to brainstorm about proposals.
from ecma262.
Related Issues (20)
- Extra Execution Context of the module HOT 6
- CreateMethodProperty vs CreateNonEnumerableDataPropertyOrThrow HOT 5
- commit snapshot banner obscures bottom of references pane
- `Function` and indirect `eval` shuold not capture context from where they are called. HOT 1
- Implicit passing of parameters into the abstract closure in ClassDefinitionEvaluation
- Specify a maximal depth of backtracking for RegExp
- Object() constructor does not always construct new ordinary object HOT 4
- OrdinaryCreateFromConstructor has wrong parameter type
- Should AggregateError#errors be listed as an instance property? HOT 3
- Call SortCompare only on actual elements HOT 14
- Rendering issue ("_numYearsN_") in DayFromYear HOT 1
- Note about [[TemplateMap]] in spec HOT 2
- There seems to be a fundamental contradiction between the specification of escape sequences between JSON and raw strings. HOT 6
- Annex F fails to document a breaking change to iteration HOT 7
- Parse error for whitespace (newline) following return statement HOT 7
- RegExp `\p`: `Unknown` value for `Script` / `Script_Extension` HOT 1
- `RevalidateAtomicAccess` will incorrectly fail on valid indices HOT 1
- 'instance of the Object type' should be 'member of the Object type' in Section 6.1.7 HOT 1
- Synthesized constructor in ClassDefinitionEvaluation is missing [[PrivateMethods]] and [[Fields]] HOT 1
- questions (possible bugs) re specification/language identity HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ecma262.