13 Matching Annotations
- Sep 2024
-
www.gertgoet.com www.gertgoet.com
-
variable :FORCE_SSL, :boolean, default: '1'
-
- Sep 2022
-
-
Ruby's keyword args work a little differently than similar implementations (selectors in Objective C, for instance). The value on the right-hand side of the colon is the default, not the local name.
-
- Mar 2022
-
github.com github.com
-
t.datetime :seen_at, default: { expr: 'NOW()' }
-
- Mar 2021
-
dry-rb.org dry-rb.org
-
Default Values
-
- Feb 2021
-
github.com github.com
-
hash :with_defaults, default: {} do boolean :likes_cookies, default: true end
-
- Oct 2020
-
www.npmjs.com www.npmjs.com
-
const debounceFunc = debounce(1000, false, (num) => { console.log('num:', num);}); // Can also be used like this, because atBegin is false by defaultconst debounceFunc = debounce(1000, (num) => { console.log('num:', num);});
-
-
stackoverflow.com stackoverflow.com
-
Looks like the problem is that debounce defaults to waiting for 0 ms ... which is completely useless!
It would be (and is) way to easy to omit the 2nd parameter to https://lodash.com/docs/4.17.15#debounce.
Why is that an optional param with a default value?? It should be required!
There must be some application where a delay of 0 is useless. https://www.geeksforgeeks.org/lodash-_-debounce-method/ alludes to / implies there may be a use:
When the wait time is 0 and the leading option is false, then the func call is deferred until to the next tick.
But I don't know what that use case is. For the use case / application of debouncing user input (where each character of input is delayed by at least 10 ms -- probably > 100 ms -- a delay of 0 seems utterly useless.
-
-
github.com github.com
-
However, in function components there really isn't much need for this pattern since you can just use JS default arguments
-
-
softwareengineering.stackexchange.com softwareengineering.stackexchange.com
-
But recently I started to think about default values as some sort of a technical debt ... which is not a straight bad thing but something that could provide some "short term financing" get us to survive the project
-
Right, and if most uses of an FTP service use new FtpService() the one that sets an alternate port will stand out (service.SetPort(12345))
-
General rules of thumb
-
The question about default values in general - default return function values, default parameter values, default logic for when something is missing, default logic for handling exceptions, default logic for handling the edge conditions etc.
-
For a long time I considered default values to be a "pure evil" thing, something that "cloaks the catastrophe" and results in a very hard do find bugs.
-