[swift-users] Question about "lazy initialization" in CommandLine.arguments documentation

Martin R martinr448 at gmail.com
Thu Jan 11 03:06:42 CST 2018


The `CommandLine` documentation (https://developer.apple.com/documentation/swift/commandline) states about the `arguments` property:

    ... also use lazy initialization of static properties to safely initialize the swift arguments.

Apparently this originates from the markup comments in https://github.com/apple/swift/blob/master/stdlib/public/core/CommandLine.swift#L48:

    /// Access to the swift arguments, also use lazy initialization of static
    /// properties to safely initialize the swift arguments.
    public static var arguments: [String]
      = (0..<Int(argc)).map { String(cString: _unsafeArgv[$0]!) }


- Is this something the _user_ of `CommandLine` must know?
- If yes, what does it tell me?
- Or is it a remark about the _implementation_ (and should not be part of the public documentation)?

Regards, Martin



More information about the swift-users mailing list