Suggestion: change 'length' getter of combinatory function to 'getLength()' function
See original GitHub issueReasons
Principle of least astonishment: Properties in JavaScript are expected to be fast to access, but the current length
getter invokes factorial
function which is an O(n)
operation. Changing it to a function makes it explicit. (For reference, in Rust, slow operations are explicit)
Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
Length of a JavaScript object - Stack Overflow
This method gets all your object's property names in an array, so you can get the length of that array which ...
Read more >Eliminating native syntax · Issue #28791 · dart-lang/sdk - GitHub
Here's an example of a getter using the native syntax: int get length native "List_getLength";. And here's how I'd propose to change it ......
Read more >On Tracking Java Methods with Git Mechanisms - arXiv
Thus, just executing git-log is sufficient to know in which commits the two methods were changed. The command identifies that getLength() in ...
Read more >On tracking Java methods with Git mechanisms - ScienceDirect
The command identifies that getLength() in Person.java was changed in commit c100 and ... 2(a), the Git rename detection function can identify that...
Read more >Linter rules - Dart programming language
toString() or any == true , for example. Note that despite “Function” being a type, the semantics are close to identical to “dynamic”,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have unintentionally pushed the change directly to master https://github.com/sithmel/iter-tools/commit/6494104af17519ed7af5b4db6b0d68d1f4bf558c
“size” makes more sense. However, I would prefer
getSize()
tosize()
, becausesize
(without “get”) is expected to be a value, not a function (e.g.map.size
,set.size
).