Skip to content

Comments

simplify position constructor#195

Merged
jgillich merged 1 commit intomainfrom
simplify-position-ctor
Sep 29, 2025
Merged

simplify position constructor#195
jgillich merged 1 commit intomainfrom
simplify-position-ctor

Conversation

@sargunv
Copy link
Collaborator

@sargunv sargunv commented Sep 29, 2025

Not sure why these were separate. @JvmOverloads takes care of the Java overload, and the small extra branch is cheap. Technically, altitude now gets boxed when it's passed, but thanks to arena allocators I'd be shocked if that matters in practice.

@sargunv sargunv requested a review from jgillich September 29, 2025 08:28
@jgillich jgillich enabled auto-merge (squash) September 29, 2025 08:35
@jgillich jgillich merged commit 3e8fe68 into main Sep 29, 2025
9 checks passed
@jgillich jgillich deleted the simplify-position-ctor branch September 29, 2025 08:44
@westnordost
Copy link
Collaborator

Not sure why these were separate. @jvmoverloads takes care of the Java overload, and the small extra branch is cheap.

I think this discussion is relevant:

maplibre/maplibre-java#40 (comment)

It concerns overloads with default parameters, so, applies to this change.

https://youtrack.jetbrains.com/issue/KT-38685/Generate-overloaded-obj-c-functions-for-functions-with-default-parameter-values

@jgillich
Copy link
Collaborator

Interesting, so this means that someone calling this via Objective-C would not get the additional constructor? But any Kotlin -> Kotlin/Native code will still have it, right?

The readme says "supports Kotlin Multiplatform and Java projects", so I'd consider Objective-C and Swift outside of the scope of this library.

@sargunv
Copy link
Collaborator Author

sargunv commented Sep 29, 2025

KMP has been improving Swift export lately, so I could see this improving through the compiler over time since Swift does support defaults.

In the meantime, well:

  • we don't yet publish a swift export
  • if we did, it's probably not a huge deal to pass a null arg until the compiler supports defaults or overloads, or just add these overloads back in

Very curious about the state of existing Turf ports on Swift. Would a swift export of this library be useful to that ecosystem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants