bdk-ffi icon indicating copy to clipboard operation
bdk-ffi copied to clipboard

Our use of default arguments in Swift, Kotlin, and Python

Open thunderbiscuit opened this issue 11 months ago • 1 comments

Uniffi has now a feature allowing default arguments for methods and class constructors. Use of this is common and expected by Swift, Kotlin, and Python developers.

In general this language feature is thought of as cleaning up call sites, helping readability and usability. It also simplifies class initializers and avoids method overloading for various ways methods can be called. We are making use of this feature in the BDK language bindings libraries, but because they are not available in Rust, I wanted to have an issue here to address it and allow folks to discover/understand why we chose to use them. We will use this to track discussion on the feature.

thunderbiscuit avatar Jan 29 '25 16:01 thunderbiscuit

Uniffi has now a feature allowing default arguments for methods and class constructors. Use of this is common and expected by Swift, Kotlin, and Python developers.

I quite like default args (as you mention common for a Swift dev).

We are making use of this feature in the BDK language bindings libraries, but because they are not available in Rust, I wanted to have an issue here to address it and allow folks to discover/understand why we chose to use them. We will use this to track discussion on the feature.

Have we gotten any feedback that others do not want this to be used? If so if we can add that info/reason here because I'd be interested so it could round out my thoughts. If not, I think you've laid out nicely why we do it, and we've had no other feedback since opened, so I'd say we close this issue and open up new issues for the places we should add default arguments (clients, descriptor, keys, etc?) because they are quite nice.

Totally open to anything, was just looking this Issue over again and wanted to lay out my thoughts and make sure I wasn't missing anything.

reez avatar Jun 19 '25 23:06 reez