apple/swift-metrics

Foundation usage

normanmaurer opened this issue · 9 comments

As I did not follow the whole discussion around the API I was wondering if we really want to put the requirement that you need to use Foundation:

@_exported import Foundation

Wouldn't it be better to make this an implementation detail ?

should definitely not be @_exported import

@weissi but wouldn't this also mean that our API should not take DispatchTime ?

DispatchTime is from Dispatch, not Foundation.

@Lukasa ah right... :D I am lost in Java land for too long ;)

@weissi but wouldn't this also mean that our API should not take DispatchTime ?

No, you can use whatever types you want. @_exported is only if you want to make to also export the whole other module from your module, ie. all symbols. It should very very rarely be used.

DispatchTime is in both Foundation (through @_exported import Dispatch) and in Dispatch

@normanmaurer @weissi @Lukasa there are two things here

  1. should we really use foundations

the answer to that is that this is why we separate CoreMetrics from Metrics module. the former does not use foundation and can be used in cases you don't want foundation. the latter add syntactic sugar for types (primarily durations) that come from foundation and dispatch. we can potentially do away with the sugar but i suspect it would be a very common need

  1. should we export foundation import

this seems like an oversight that needs to be fixed

i think can be closed via #9 and the and the answer above?

@tomerd sounds good to me