[swift-dev] (Re-)compiling the stdlib

Christian Hoffmann hffmnn at googlemail.com
Thu Oct 6 13:40:32 CDT 2016


Hi there,

quick question from someone who likes to get started on the stdlib and
therefore sometimes likes to change an implementation, just to get a better
understanding, what is going on.

So let's say, I changed something in Bool.swift, e.g. to let the
implementation of `description` in the `CustomStringConvertible`
extension return 'YES' or 'NO'.

Ok, so doing a
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
compiles fine -> Perfect!

Running the REPL via `./build/ds/swift-macosx-x86_64/bin/swift` gives:

***  You are running Swift's integrated REPL,  ***
***  intended for compiler and stdlib          ***
***  development and testing purposes only.    ***
***  The full REPL is built as part of LLDB.   ***
***  Type ':help' for assistance.              ***
(swift) let someBool = true
// someBool : Bool = YES
(swift) print (someBool.description)
YES

Once again: Perfect and as expected!

So after seeing, that this was kind of a bad idea and resetting these
changes,
re-triggering the same build command
`./swift/utils/build-script --debug-swift-stdlib --build-subdir=ds --`
runs much faster (as expected), BUT:
a newly started REPL gives the same results, as before and not as I
would expect a `true` or `false`.

I also tried to add a new method:
```
let someBool = true
// someBool : Bool = YES
let someBoolStr = someBool.anotherFunc()
LLVM ERROR: Program used external function '__TFSb11anotherFuncfT_SS' which
could not be resolved!
```

Once again: After a clean build, everything seems to work perfect.
Any idea, what needs to be "retriggered", so that the REPL or `swiftc`
picks up the new stdlib?

Thank you and Regards,
Christian Hoffmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20161006/14672c07/attachment.html>


More information about the swift-dev mailing list