You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Foundation in this build does include NSString but there's lots a caveats associated with it. It's not bridged to String as it is on OS X yet and I suspect (but haven't verified yet,) that most other Foundation objects that are bridged on OS X are not yet bridged on Linux. So casting as in the example below will fail:
3> let foo: NSString = "foo"
foo: Foundation.NSString = \{
Foundation.NSObject = \{}
_cfinfo =
\{ info = 1920 pad = 0 }
_storage = "foo"
}
4> let bar = foo as String
repl.swift:4:11: error: cannot convert value of type 'NSString' to type 'String' in coercion
let bar = foo as String
^~~
While on OS X, it will do as expected:
3> let foo:NSString = "foo"
foo: NSString = "foo"
4> let bar = foo as String
bar: String = "foo"
In order for the Linux version of Swift-repl to recognize Foundation, it needs to be invoked as follows:
%: swift -lFoundation <rest of the parameters>
This tells Swift that you're using Foundation and to link (-l) with the Foundation shared library. However, this is not needed on OS X.
Feel free to contact me if you have any questions,
The text was updated successfully, but these errors were encountered:
To avoid derailing the bridging issue I'm removing LLDB for Swift from this issue. I've filed <rdar://problem/23902940> internally to track the notion that the broader notion that the REPL should respect a more inclusive notion of a default Swift "SDK" on Linux. What that should look like is a distinct and interesting question that probably deserves discussion on Swift.org, and it's definitely not REPL-specific.
Environment
OS X 10.11.1, Ubuntu 15.10
Additional Detail from JIRA
md5: fd4610a64cf6030b8952ae7fa9bfb6ba
is duplicated by:
Issue Description:
Foundation in this build does include NSString but there's lots a caveats associated with it. It's not bridged to String as it is on OS X yet and I suspect (but haven't verified yet,) that most other Foundation objects that are bridged on OS X are not yet bridged on Linux. So casting as in the example below will fail:
While on OS X, it will do as expected:
In order for the Linux version of Swift-repl to recognize
Foundation
, it needs to be invoked as follows:This tells Swift that you're using Foundation and to link (-l) with the Foundation shared library. However, this is not needed on OS X.
Feel free to contact me if you have any questions,
The text was updated successfully, but these errors were encountered: