Skip to content

ProcessInfo.init() is public on Darwin but internal on Linux #1298

Open
@Kyle-Ye

Description

@Kyle-Ye

On Apple platforms, ProcessInfo inherits from NSObject, and as a result, the default init() initializer is automatically inferred as public.

However, on non-Apple platforms (e.g. Linux), ProcessInfo does not inherit from NSObject, and init() is inferred as internal. This leads to platform inconsistency in the following code:

let info = ProcessInfo()

This compiles successfully on Darwin platforms, but fails to compile on Linux with the error:

error: 'init' is inaccessible due to 'internal' protection level

I would like to ask:

  • Is this considered a platform inconsistency that needs to be aligned/fixed?
  • Or is it expected that ProcessInfo() is not a supported construction pattern, and the correct usage should always be ProcessInfo.processInfo singleton?

Thank you for your clarification and guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions