question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: change 'length' getter of combinatory function to 'getLength()' function

See original GitHub issue

Reasons

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:closed
  • Created 5 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
sithmelcommented, Jan 11, 2019

I have unintentionally pushed the change directly to master https://github.com/sithmel/iter-tools/commit/6494104af17519ed7af5b4db6b0d68d1f4bf558c

1reaction
KSXGitHubcommented, Jan 11, 2019

I can consider “size()” 😄

“size” makes more sense. However, I would prefer getSize() to size(), because size (without “get”) is expected to be a value, not a function (e.g. map.size, set.size).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found