> On Jul 2, 2015, at 6:17 PM, Boon <
bo...@nanaimostudio.com> wrote:
>
> In language such as Java, under the hood there is actually a difference between string obtained via string literal vs initializer.
What kind of difference? I haven’t used Java much in a long time, but I used to work on the Java implementation at Apple and I don’t remember there being a difference.
> In Swift, are they equivalent under the hood?
In Cocoa an NSString created from a literal tends to be* of a different subclass than one created at runtime, but that doesn’t make any difference in its behavior; you have to inspect it at runtime (e.g. in the debugger) to detect the difference.
—Jens
* I’m being vague because the behavior varies between different OS versions, due to implementation changes in the runtime and frameworks.