Re: [swift-users] Swift 4.0 LLDBFrontend Crash

2017-10-16 Thread Alex Blewitt via swift-users
Please record this in a bug at bugs.swift.org so that it doesn’t get lost, if 
you haven’t already. 

Thanks!

Alex

Sent from my iPhone 

> On 16 Oct 2017, at 19:56, Edward Connell  wrote:
> 
> Specifying the clang import location is what is triggering the LLDBFrontend 
> crash. 
> I think you are saying that I should not need to specify the clang include 
> import location to the compiler.
> 
> I've attached the unmodified SwiftProtobuf example program found in the docs 
> at https://github.com/apple/swift-protobuf.git, so this is independent from 
> my project.
> 
> Are you able to simply do "swift build" and successfully debug and examine 
> values like "info"? 
> For me it fails unless I also specify the import location for the clang 
> include directory.
> 
> swift build -I/home/ed/swift/usr/lib/swift/clang/include
> 
> And yes I checked, I am picking up the correct swift binary
> 
> 
> Swift
> $ swift --version
> Swift version 4.0.1-dev (LLVM 2dedb62a0b, Clang b9d76a314c, Swift 00e34e4b1e)
> Target: x86_64-unknown-linux-gnu
> 
> LLDB failure output
> 
> $ lldb HelloWorld
> (lldb) target create "HelloWorld"
> Current executable set to 'HelloWorld' (x86_64).
> (lldb) b main.swift:20
> Breakpoint 1: where = HelloWorld`main + 1116 at main.swift:21, address = 
> 0x0041146c
> (lldb) run
> Process 20745 launched: 
> '/home/ed/Documents/prototest/.build/x86_64-unknown-linux/debug/HelloWorld' 
> (x86_64)
> Process 20745 stopped
> * thread #1, name = 'HelloWorld', stop reason = breakpoint 1.1
> frame #0: 0x0041146c HelloWorld`main at main.swift:21
>18 let binaryData: Data = try info.serializedData()
>19 
>20 // Deserialize a received Data object from `binaryData`
> -> 21 let decodedInfo = try BookInfo(serializedData: 
> binaryData)
>22 
>23 // Serialize to JSON format as a Data object
>24 let jsonData: Data = try info.jsonUTF8Data()
> Target 0: (HelloWorld) stopped.
> (lldb) p info
> error: in auto-import:
> failed to get module 'HelloWorld' from AST context:
> :1:10: note: in file included from :1:
> #include "CoreFoundation.h"
>  ^
> 
> error: /home/ed/swift/usr/lib/swift/CoreFoundation/CoreFoundation.h:26:10: 
> error: 'stdarg.h' file not found
> #include 
>  ^
> 
> /home/ed/swift/usr/lib/swift/CoreFoundation/CFStream.h:20:10: note: while 
> building module 'CDispatch' imported from 
> /home/ed/swift/usr/lib/swift/CoreFoundation/CFStream.h:20:
> #include 
>  ^
> 
> :1:10: note: in file included from :1:
> #include "dispatch.h"
>  ^
> 
> /home/ed/swift/usr/lib/swift/dispatch/dispatch.h:30:10: note: in file 
> included from /home/ed/swift/usr/lib/swift/dispatch/dispatch.h:30:
> #include 
>  ^
> 
> /home/ed/swift/usr/lib/swift/os/linux_base.h:19:10: note: in file included 
> from /home/ed/swift/usr/lib/swift/os/linux_base.h:19:
> #include 
>  ^
> 
> error: /usr/include/x86_64-linux-gnu/sys/param.h:23:10: error: 'stddef.h' 
> file not found
> #include 
>  ^
> 
> error: could not build C module 'CoreFoundation'
> 
> 
>> On Mon, Oct 16, 2017 at 11:00 AM, Alex Blewitt  wrote:
>> > On 16 Oct 2017, at 18:52, Edward Connell  wrote:
>> >
>> > While creating a bug report for this problem I placed my simple repro case 
>> > in a separate project with default build settings and I found that it no 
>> > longer crashes LLDB.
>> >
>> > My main project links to several system C libraries, because I am using 
>> > libpng, Cuda, etc...
>> > In order for LLDB to function with my project and load things from the AST 
>> > context, I was told to specify the clang include directory.
>> >
>> > swift build -Xswiftc -I${SWIFT_HOME}/lib/swift/clang/include
>> >
>> > In the past everything worked fine.
>> >
>> > The stand alone bug repro project has no C library dependencies, however 
>> > if I add this option, LLDB crashes.
>> 
>> If you can add that information to the bug report, including whawt version 
>> of swift you're using (with swiftc -v) and the crash report then that would 
>> allow others to see what problem you're experiencing.
>> 
>> I assume that SWIFT_HOME is the same location as the swift executable that 
>> you're running? Might be worth checking with 'which swift'.
>> 
>> > I tried eliminating this option from my main project, and from a separate 
>> > project using SwiftProtobuf. The result is that I am no longer able to 
>> > debug either of them. Is there some new way we are supposed to pick up 
>> > system imports, or is the a legitimate bug?
>> 
>> The Swift REPL on Linux needs to have the -I flag in order to work as 
>> expected. However, the swift compiler shouldn't need to have that 
>> information, since it will know where the corresponding include directory is.
>> 
>> Alex
> 
> 
___
swift-users mailing 

Re: [swift-users] Swift 4.0 LLDBFrontend Crash

2017-10-16 Thread Alex Blewitt via swift-users
> On 16 Oct 2017, at 18:52, Edward Connell  wrote:
> 
> While creating a bug report for this problem I placed my simple repro case in 
> a separate project with default build settings and I found that it no longer 
> crashes LLDB.
> 
> My main project links to several system C libraries, because I am using 
> libpng, Cuda, etc...
> In order for LLDB to function with my project and load things from the AST 
> context, I was told to specify the clang include directory.
> 
> swift build -Xswiftc -I${SWIFT_HOME}/lib/swift/clang/include
> 
> In the past everything worked fine.
> 
> The stand alone bug repro project has no C library dependencies, however if I 
> add this option, LLDB crashes.

If you can add that information to the bug report, including whawt version of 
swift you're using (with swiftc -v) and the crash report then that would allow 
others to see what problem you're experiencing. 

I assume that SWIFT_HOME is the same location as the swift executable that 
you're running? Might be worth checking with 'which swift'.

> I tried eliminating this option from my main project, and from a separate 
> project using SwiftProtobuf. The result is that I am no longer able to debug 
> either of them. Is there some new way we are supposed to pick up system 
> imports, or is the a legitimate bug?

The Swift REPL on Linux needs to have the -I flag in order to work as expected. 
However, the swift compiler shouldn't need to have that information, since it 
will know where the corresponding include directory is.

Alex
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] SwiftProtobuf unable to link on Ubuntu

2017-10-16 Thread Alex Blewitt via swift-users
> On 14 Oct 2017, at 21:41, Geordie J via swift-users  
> wrote:
> 
>> swift build -Xswiftc -I/home/ed/swift-protobuf/.build/release -Xlinker 
>> -L/home/ed/swift-protobuf/.build/release
> 
> Have you considered using Swift Package Manager to add protobuf as a project 
> dependency? Then you wouldn’t have to mess around with command line arguments 
> at all. I haven’t used protobuf yet so can’t help with specifics.

I'd strongly recommend using Swift Package Manager to help you here. You need 
to compile and build protobuf and have that linked into your product at the 
same time. Since this is what Swift PM works well for that's probably the 
longer-term supported way forward.

If you're still trying to do this via the command line, I recommend finding 
where you're compiling the .so for the swift-protobuf code, then using nm and 
grep to look through that library to confirm whether or not it contains the 
symbols that your code thinks is missing.

If you have acquired a swift-protobuf binary library from somewhere else, it 
may not have the Swift code you're looking for, or it may be compiled with a 
different version of Swift, both of which can affect the names of the symbols 
being linked. Generally speaking, any _T* symbols are Swift symbols, and that's 
usually a clue that either they are not present in the libraries you have 
specified in the command line, or the library you're linking against doesn't 
have them. Follow the rabbit down the hole and find out which if you are 
against using Swift PM.

Alex


___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift 4.0 LLDBFrontend Crash

2017-10-16 Thread Alex Blewitt via swift-users
Thanks for the analysis. Can you create a bug at https://bugs.swift.org 
 and attach the reproducing test case? That way it can 
be routed to the appropriate people, in case they're not on this mailing list.

Alex

> On 13 Oct 2017, at 22:09, Edward Connell via swift-users 
>  wrote:
> 
> I was able to boil down a repro that has nothing to do with my project, woo 
> hoo!
> Put a break at the print statement and run. When it hits the break point 
> LLDBFrontend crashes.
> The do/catch seems to be necessary to trigger the crash
> 
> Swift 4.0 release
> Ubuntu 16.04
> 
> Ed
> 
> 
> import Foundation
> 
> public class SomeClass { }
> 
> public struct SomeStruct {
>   public weak var someClass: SomeClass?
> }
> 
> do {
>   let data = SomeStruct()
> 
>   print("break here")
> } catch {
>   print(String(describing: error))
> }
> 
> 
> On Fri, Oct 13, 2017 at 10:21 AM, Edward Connell via swift-users 
> > wrote:
> Hi Michael,
> Thanks, I created and attached a log for you with "types" and "expressions" 
> enabled
> I set a breakpoint right before calling the function that triggers the crash, 
> enabled logging, then continued. I was trying to reduce the amount of log 
> output to sift through.
> 
> This was run with the Swift 4.0 release version
> Let me know if you want me to try anything else.
> 
> Thanks, Ed
> 
> 
> 
> On Thu, Oct 12, 2017 at 11:13 AM, Michael Gottesman  > wrote:
> I just added a section to ./docs/DebuggingTheCompiler.rst on how to get 
> enable logging from LLDB.
> 
> Can you enable the logging there and add file an SR?
> 
> Michael
> 
>> On Oct 7, 2017, at 11:27 AM, Edward Connell > > wrote:
>> 
>> Hi Michael,
>> No I am not evaluating an expression or anything. This all worked fine in 
>> past builds.
>> 
>> I simply set a breakpoint in a function and after stopping while gathering 
>> values for the debugger view, it crashes.
>> 
>> It doesn't crash in all functions, but it does crash when trying to stop in 
>> many different functions.
>> An example function signature where it crashes is (DataView is a concrete 
>> struct):
>> 
>> public func setupForward(mode: EvaluationMode, inData: DataView, labels: 
>> DataView?,
>>   outData: inout DataView, backData: 
>> inout DataView?) throws { ... }
>> 
>> Before calling the function, all of the parameters have valid values that I 
>> can examine. But as soon as I step into this function, LLDB crashes with 
>> that message. It behaves the same way with other functions that have 
>> different signatures.
>> 
>> I tried to create a very simple repro case using this signature, but it 
>> didn't crash. My project is on GitHub and this can be easily reproduced. The 
>> only pain is installing my project on your test machine.
>> 
>> Ubuntu 16.04
>> Swift 4.0 release
>> NVidia gpu
>> Netlib https://github.com/ewconnell/Netlib/wiki#installation 
>> 
>> CLion IDE with Swift plugin
>> 
>> 1) do a debug build
>> 2) set a breakpoint at CudaSoftmax.swift:44  or any line in the function
>> 3) run
>> 4) when it stops LLDBFrontend crashes
>> 
>> LLDBFrontend: 
>> /home/buildnode/jenkins/workspace/oss-swift-4.0-package-linux-ubuntu-16_04/swift/lib/SILOptimizer/Mandatory/AccessEnforcementSelection.cpp:613:
>>  (anonymous namespace)::SourceAccess (anonymous 
>> namespace)::AccessEnforcementSelection::getSourceAccess(swift::SILValue): 
>> Assertion `isa(address) || isa(address)' failed.
>> Stack dump:
>> 0.   While running pass #10 SILModuleTransform ""Access Enforcement 
>> Selection"".
>> 
>> 
>> Using the LLDB CLI I am able to stop there. If I try "fr var -O" with 
>> mode, inData, and labels, it prints their values no problem
>> outData and backData gives me a segmentation violation
>> The visible difference is the "inout"
>> 
>> Not sure what the problem is. It worked fine in the past.
>> 
>> If you can think of an experiment I can try to create a simple repro case, 
>> please let me know.
>> 
>> Thanks, Ed
>> 
>> On Fri, Oct 6, 2017 at 4:34 PM, Michael Gottesman > > wrote:
>> It looks like this is failing during guaranteed optimization. Are you 
>> running an expression in the debugger and we are crashing there?
>> 
>> Michael
>> 
>>> On Oct 6, 2017, at 11:53 AM, Edward Connell via swift-users 
>>> > wrote:
>>> 
>>> While trying to debug a Netlib function, LLDB is crashing
>>> 
>>> I'm not sure what this assert means.
>>> 
>>> LLDBFrontend: 
>>> /home/buildnode/jenkins/workspace/oss-swift-4.0-package-linux-ubuntu-16_04/swift/lib/SILOptimizer/Mandatory/AccessEnforcementSelection.cpp:613:
>>>  (anonymous namespace)::SourceAccess (anonymous 

Re: [swift-users] Using libdispatch with Trunk Development snapshot

2017-10-07 Thread Alex Blewitt via swift-users
This sounds like a bug. There were some changes recently to migrate the build 
towards CMake and it may be that they have broken the build accordingly.

Since I can't find one, can you create a bug at https://bugs.swift.org with the 
snapshot build that you saw the issue is?

Alex

> On 7 Oct 2017, at 17:08, Lane Schwartz via swift-users 
>  wrote:
> 
> Hi,
> 
> I'm on Ubuntu 16, and I'd like to try out the current Trunk Development 
> snapshot. I successfully downloaded and installed it. But when I tried 
> compiling my sample program with it, I got an error that libdispatch wasn't 
> available. 
> 
> I looked in the directory, and sure enough, the development snapshots do not 
> appear to include libdispatch. Is this intentional? What is the recommended 
> mechanism for getting libdispatch when using the Trunk Development snapshots?
> 
> Thanks,
> Lane
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Is URLSession actually working on Linux

2017-10-06 Thread Alex Blewitt via swift-users
> On 5 Oct 2017, at 19:18, Georgios Moschovitis  
> wrote:
> 
> I am wondering, is there an ETA for 4.0.1 ?

I'm not aware of there being an ETA, but according to 
https://swift.org/download/ last year Swift 3.0 was released on September 13, 
2016 and then a subsequent Swift 3.0.1 was released on October 28, 2016. 

Alex
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift for Nuttx RTOS

2017-10-06 Thread Alex Blewitt via swift-users
> On 5 Oct 2017, at 22:47, Igor Mironenko via swift-users 
>  wrote:
> 
> This may be a strange question, but I would like to understand, since both 
> Mac OS and Nuttx RTOS are POSIX certified would it be possible in any way to 
> create a program using Swift language but compile to run it on Nuttx? 
> 
> Is it something that would require a special compiler to be build 
> specifically for Nuttx, just like there is one for Swift for Linux? In my 
> understanding Swift compiles to a binary code and does work with C/C++. What 
> am I missing here? I googled and looks like I'm the only one interested in 
> such work.

Hi Igor,

Currently Swift requires libraries such as libswiftCore to be compiled for the 
target platform before being able to compile Swift programs for that platform. 
This has a number of dependencies, including being able to build a custom build 
of clang and other support libraries such as dispatch and foundation.

While there is work that allows this project to be compiled for Linux 
platforms, and others are working on porting it to Android, and other more 
estoteric platforms, there's nothing been done so far (that I'm aware of) that 
has targetted Nuttx.

You are likely to have to do some work in order to get Swift building on Nuttx 
first - once that's done, you may be able to cross-compile programs from a Mac 
to do there.

Alex
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Is URLSession actually working on Linux

2017-10-04 Thread Alex Blewitt via swift-users

> On 3 Oct 2017, at 19:15, Geordie Jay via swift-users  
> wrote:
> 
> 2017-10-03 20:10 GMT+02:00 Georgios Moschovitis via swift-users 
> >:
> I implemented a simple RSS feed aggregator. I used code like...
> 
> let data = try! Data(contentsOf: feedURL)
> 
> or
> 
> let session = URLSession(configuration: URLSessionConfiguration.default)
> let task = session.dataTask(with: url, completionHandler: completionHandler)
> task.resume()
> 
> ...to fetch the data.
> 
> While my application worked perfectly when running on macOS, when I tried to 
> run
> it on Ubuntu it started crashing randomly with errors like...
> 
> *** Error in `bin/….': double free or corruption (fasttop): 
> 0x7f388ff0 ***
> Aborted

There were some issues which were fixed on the swift-4 branch but which didn't 
make it in before the swift 4.0 release was cut. These fixes will be in the 
next point release of Swift.

Have you tried the code with the latest nightly build to verify whether that 
has fixed the issue you're seeing?

> Are there any issues with the implementation of Foundation for Linux?
> 
> tldr; Pretty sure, yes.

There has been a reasonable amount of work put in recently, particularly with 
Data and URLSession. 

You can have a look at the list of open issues for Foundation on Linux:

https://bugs.swift.org/issues/?jql=status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20component%20%3D%20Foundation

Note that some of the issues may have been recently closed but not made it into 
a release.

One of my colleagues recently fixed an issue with concurrent data races, which 
has a similar effect to the one you're describing but may not be the same:

https://bugs.swift.org/browse/SR-5936 

Alex___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Where to report this bug?

2017-09-22 Thread Alex Blewitt via swift-users
Hmm... probably worth filing a bug at https://bugs.swift.org 
<https://bugs.swift.org/> then with the below test case.

Alex

> On 22 Sep 2017, at 10:14, Martin R <martinr...@gmail.com> wrote:
> 
> But the purpose of 
> 
> func dividedReportingOverflow(by other: Int 
> ) -> (partialValue: Int 
> , overflow: Bool 
> )
> 
> is to report an overflow in the return value. And actually this compiles and 
> runs in Xcode 9 if the code is on top-level in main.m:
> 
> let minusOne = -1
> let r1 = Int.min.dividedReportingOverflow(by: minusOne)
> print(r1) // (partialValue: -9223372036854775808, overflow: true)
> 
> let zero = 0
> let r2 = Int.min.dividedReportingOverflow(by: zero)
> print(r2) // (partialValue: -9223372036854775808, overflow: true)
> 
> But the same code inside a function (or do-block) fails to compile:
> 
> func foo() {
> let minusOne = -1
> let r1 = Int.min.dividedReportingOverflow(by: minusOne)
> // error: division '-9223372036854775808 / -1' results in an overflow
> print(r1)
> 
> let zero = 0
> let r2 = Int.min.dividedReportingOverflow(by: zero)
>     // error: division by zero
> print(r2)
>}
> 
> Martin
> 
> 
>> On 22. Sep 2017, at 10:19, Alex Blewitt via swift-users 
>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>> 
>> Int.min is the smallest negative value, and Int.max is the largest positive 
>> value (that fits in an Int). However, the absolute value of Int.min is 
>> larger than the absolute value of Int.max. So you can't convert Int.min into 
>> -Int.min because it's larger than Int.max.
>> 
>> In other words, this is expected behaviour :)
>> 
>> For example:
>> 
>> Int.min + Int.max = 1
>> 
>> If they were the same value, it would be zero.
>> 
>> Alex
>> 
>>> On 22 Sep 2017, at 02:42, Peter W A Wood via swift-users 
>>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>>> 
>>> Entering the following statement in a playground gives an overflow error. 
>>> Where should I report this?
>>> 
>>> Statement:
>>> 
>>> Int.min.dividedReportingOverflow(by:-1)
>>> 
>>> Playground log:
>>> 
>>> Playground execution failed:
>>> 
>>> error: MyPlayground.playground:3:9: error: division '-9223372036854775808 / 
>>> -1' results in an overflow
>>> Int.min.dividedReportingOverflow(by:-1)
>>> 
>>> Peter
>>> ___
>>> swift-users mailing list
>>> swift-users@swift.org <mailto:swift-users@swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-users 
>>> <https://lists.swift.org/mailman/listinfo/swift-users>
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org <mailto:swift-users@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Where to report this bug?

2017-09-22 Thread Alex Blewitt via swift-users
Int.min is the smallest negative value, and Int.max is the largest positive 
value (that fits in an Int). However, the absolute value of Int.min is larger 
than the absolute value of Int.max. So you can't convert Int.min into -Int.min 
because it's larger than Int.max.

In other words, this is expected behaviour :)

For example:

Int.min + Int.max = 1

If they were the same value, it would be zero.

Alex

> On 22 Sep 2017, at 02:42, Peter W A Wood via swift-users 
>  wrote:
> 
> Entering the following statement in a playground gives an overflow error. 
> Where should I report this?
> 
> Statement:
> 
> Int.min.dividedReportingOverflow(by:-1)
> 
> Playground log:
> 
> Playground execution failed:
> 
> error: MyPlayground.playground:3:9: error: division '-9223372036854775808 / 
> -1' results in an overflow
> Int.min.dividedReportingOverflow(by:-1)
> 
> Peter
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] RSS feed for the Swift.org blog not working

2017-09-20 Thread Alex Blewitt via swift-users
As you will have noted in my prior response, the atom.xml includes the blog 
post from yesterday that announced Swift 4.0 release. So clearly the posts are 
included and there is something failing in your client. Please investigate 
further.

The posts appear to be listed in ascending date order (i.e. more recent ones 
are at the bottom). If your client is assuming they are in descending order, 
and only showing you the first N posts, then you might have this behaviour. For 
example:

$ grep title atom.xml
  Swift.org
The Swift.org Blog
The Swift Linux Port
Swift 3 API Design Guidelines
Swift 2.2 Release Process
It's Coming: the Great Swift API Transformation
Continuous Integration now Available
Swift Benchmark Suite now Available
Expanding Commit Access
Swift 2.2 Released!
New Features in Swift 2.2
Swift 3.0 Release Process
Swift 2.3
Swift 3.0 Preview 1 Released!
Xcode Playground Support
Swift 3.0 Released!
Whole-Module Optimization in Swift 3
Server APIs Work Group
Swift 3.1 Release Process
Swift Evolution Status Page Now Available
Faster Mix-and-Match Builds with Precompiled Bridging Headers
Swift 4 Release Process
Swift 3.1 Released!
Swift Source Compatibility Test Suite Now Available
Swift Package Manager Manifest API Redesign
Swift Local Refactoring
Swift 4.0 Released!

Alex

> On 20 Sep 2017, at 21:30, Craig Maynard via swift-users 
>  wrote:
> 
> The plot thickens.. 
> 
> Apparently my cranky old news reader doesn't understand SSL (see error 
> below). I tried http://swift.org/atom.xml and now I'm seeing a subset of 
> posts. The last one in the list is dated 1/27/2017 and has the title "Faster 
> Mix-and-Match Builds with Precompiled Bridging Header". Nothing after that.
> 
> Would it be possible to serve all the posts from http://swift.org/atom.xml?
> 
> Thanks,
> Craig
> 
> 
>> On Sep 20, 2017, at 2:12 PM, Martin Man  wrote:
>> 
>> From 
>> https://www.osstatus.com/search/results?platform=all=all=-9824
>> 
>> -9824 = errSSLPeerHandshakeFail
>> 
>> This looks like a network issue between your client and swift.org
>> 
>> 
>>> On 20 Sep 2017, at 16:54, Craig Maynard via swift-users 
>>>  wrote:
>>> 
>>> When I subscribe to the RSS feed at https://swift.org/atom.xml, I'm not 
>>> seeing any blog posts. My newsreader is emitting this error message:
>>> 
>>> 2017-09-20 13:27:28 -0400: Download Error: Domain: SSL Type: error code: 
>>> -9824 URL: https://swift.org/atom.xml
> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] RSS feed for the Swift.org blog not working

2017-09-20 Thread Alex Blewitt via swift-users
The feed seems to have data in it, and includes the swift 4.0 release note:

  
Swift 4.0 Released!



  Ted Kremenek


https://swift.org/blog/swift-4-0-released/"/>
2017-09-19T05:00:00-07:00
https://swift.org/blog/swift-4-0-released/
pSwift 4 is now officially released!  Swift 4 
builds on the strengths of Swift 3, delivering greater robustness and 
stability, providing source code compatibility with Swift 3, ma
king improvements to the standard library, and adding features like archival 
and serialization./p

When you curl the feed, what happens?

curl https://swift.org/atom.xml

Note that the feed is an Atom feed, rather than an RSS feed, but it should 
still be possible for your favourite news reader to process it. It may also be 
caused by having marked the feed as read; in which case, removing it and adding 
it again should work.

Alex

> On 20 Sep 2017, at 16:54, Craig Maynard via swift-users 
>  wrote:
> 
> I'm a happy user of NetNewsWire 3.3 and I follow dozens of blogs with no 
> problems. However, when I subscribe to the RSS feed at 
> https://swift.org/atom.xml, I'm not seeing any blog posts. Who should I 
> contact to report a problem with this feed?
> 
> Craig
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] noob question about modules

2017-09-13 Thread Alex Blewitt via swift-users
No, submodules in Swift bear little relation to sub packages in Java. It's 
really just a way of partitioning the namespace within a single module. Nor is 
there any relation between the path and the name of the module either.

Alex

> On 12 Sep 2017, at 22:41, blaster_in_black via swift-users 
>  wrote:
> 
> Hi,
> 
> I am beginning with Swift 4 (coming from the Java world) but I do not have 
> yet a Swift development environment to experiment with. Therefore my 
> question(s) might sound a bit silly. Unfortunately, I haven't been able to 
> answer them by reading the online Language Guide.
> 
> 1) What makes a submodule? I can see online examples about how to import 
> them, but not how to create one or any other further details about them. Are 
> they like Java packages inside a jar? Do their hierarchical name 
> (prefix1.prefix2. ... .submodulename) reflect a path tree on the filesystem 
> (/prefix1/prefix2. ... /submodulename), just as it happens with Java packages?
> 2) Can two different submodules within a single module export two different 
> classes under a single class name? Like module.submodule1.MyType and 
> module.submodule2.myType.
> 
> Thanks in advance.
> 
> David
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] #selector() in Swift

2017-08-10 Thread Alex Blewitt via swift-users
> On 10 Aug 2017, at 07:04, Mohit Athwani via swift-users 
>  wrote:
> 
> With closures being first class citizens in Swift and the ability of closures 
> to be able to capture scope, it seems a little archaic to me that the 
> #selector() feature exists in Swift. 
> 
> For example, why does
> func addTarget(_ target: Any?, 
> action: Selector 
> , 
>for controlEvents: UIControlEvents 
> )
> 
> have a Selector type for action. Why can’t action be defined to be a closure  
> for example:
> addTarget(_ target: Any?, 
> action: (sender: UIControl?, forEvent event:UIEvent?) -> Void, 
>for controlEvents: UIControlEvents 
> )
> 
> What do you guys think?

Selectors have been around since the start of the Objective-C platform, before 
either macOS or iOS existed. Blocks weren't added into macOS until relatively 
recently (from iOS 4 
https://en.wikipedia.org/wiki/Blocks_(C_language_extension) 
 if you're 
interested).

So many of the APIs that predated the introduction of blocks worked by having a 
selector that could be called back on a target, and these APIs are still 
present today in current releases of macOS and iOS.

The Swift based API is purely there because there are some APIs that aren't 
capable of taking a block, and hence aren't capable of taking a Swift closure.

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift linux repl can't import

2017-07-27 Thread Alex Blewitt via swift-users
For the mail (so it's easier to find than in a bug tracking system) the fix is 
to specify the clang include headers either with an -I on the swift invocation 
command line, or via the variables C_INCLUDE_PATH and CPLUS_INCLUDE_PATH

setting the C_INCLUDE_PATH and CPLUS_INCLUDE_PATH environment variables to the 
Clang header include path did indeed work

$ export C_INCLUDE_PATH=/swift/usr/lib/swift/clang/include/
$ export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
$
$ swift
Welcome to Swift version 4.0-dev (LLVM a15decabe3, Clang 14ff3d9712, Swift 
d574ed67d6). Type :help for assistance.
  1> import Foundation
  2> let status = "woohoo! 'import Foundation' works on Linux"
status: String = "woohoo! \'import Foundation\' works on Linux"

It really shouldn't be necessary to have to specify additional flags or 
variables to have Swift's REPL work out of the box on Linux, like it used to 
with Swift 3.0.

Alex

> On 26 Jul 2017, at 05:17, Mason Mark via swift-users  
> wrote:
> 
> Just to update the record, Matthias M. Schneider posted a workaround on 
> bugs.swift.org .
> 
> By setting the C_INCLUDE_PATH and CPLUS_INCLUDE_PATH environment variables to 
> point to the Clang headers directory, it is possible to both import 
> Foundation in the REPL (without using -I to pass the header include path) and 
> also to debug a built executable with lldb.
> 
> Example is on the bug tracker:
> 
> https://bugs.swift.org/browse/SR-3648?focusedCommentId=27131=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-27131
>  
> 
> 
> Cheers,
> 
> — Mason
> 
>> On Jul 12, 2017, at 13:16, Mason Mark via swift-users > > wrote:
>> 
>> I'm reviving this somewhat-old thread because it's still the most prominent 
>> search result when googling this issue to debug it (other than the 
>> below-referenced SR-3648).
>> 
>> The workaround of using -I to pass an include path to swift was working for 
>> me, because as noted by Will Stanton below, the issue was only coming up 
>> when trying to use the REPL on Linux (builds aren't affected).
>> 
>> However, the same issue comes up when debugging a swift executable on Linux 
>> using lldb, which I now need to do. So I'd love to know if anybody has found 
>> a workaround.
>> 
>> When you try to "po foo" in lldb, assuming foo is some object that uses 
>> Foundation, lldb errors out with a cascade of #include errors, ultimately 
>> ending with the same "error: 'stddef.h' file not found" (just like the REPL 
>> does).
>> 
>> I posted a comment to the official bug thread[1] which includes the full 
>> lldb output. 
>> 
>> My reason for posting to the list here is mainly to see if somebody has 
>> figured out a workaround, e.g.: 
>> 
>> - Does installing swift and all its stuff in /usr/lib help? 
>> 
>> - Is there some way to get lldb to do the equivalent of `swift -I 
>> ~/a-swift/usr/lib/swift/clang/include/`?
>> 
>> - Are there any versions of Linux where this issue does not occur? (Occurs 
>> for me with both Swift 3 and 4-dev, on Ubuntu 16.04.)
>> 
>> - etc.
>> 
>> Thanks for any pointers or tips. Unlike with the REPL case and its 
>> workaround, for trying to debug Swift executables on Linux this seems to be 
>> a show-stopper for me.
>> 
>> — Mason
>> 
>> 
>> [1]: https://bugs.swift.org/browse/SR-3648
>> 
>> 
>> 
>>> On Apr 5, 2017, at 11:53, Will Stanton via swift-users 
>>>  wrote:
>>> 
>>> From https://bugs.swift.org/browse/SR-3648, the work-around seems to be 
>>> passing -I /path/to/extracted/usr/lib/swift/clang/include when invoking 
>>> swift (credit Lukas and others, SR-3794 is more active)
>>> So, ex. `swift -I ~/a-swift/usr/lib/swift/clang/include/`
>>> 
>>> Fortunately, the issue has only come up for me in the REPL. `swift build` 
>>> works fine: I can build packages without an awkward -Xswiftc…
>>> 
>>> I wonder if the issue has anything to do with the clang-builtin-headers 
>>> install component? (Maybe swiftc/something gets hardcoded with a path 
>>> somewhere?)
>>> 
>>> Would be interested in learning more about install options, toolchains, and 
>>> the build! I’ve been wanting to track down for a while now, how does 
>>> --install-prefix affect the build? I’ve been relying on install_destdir to 
>>> get a swift...
>>> 
>>> Regards,
>>> Will Stanton
>>> 
 On Apr 4, 2017, at 9:17 PM, Rick Mann via swift-users 
  wrote:
 
 The installation instructions for Swift on Linux imply that the tarball 
 can be extracted anywhere, and the PATH set, and all should be well. But 
 unfortunately, while that's partly true, when I try to import packages, it 
 fails (Ubuntu 16.04 on Parallels on macOS 10.12.3):
 
 $ swift
 Welcome to Swift version 3.1 

Re: [swift-users] Printing Enums?

2017-07-17 Thread Alex Blewitt via swift-users
> On 17 Jul 2017, at 15:15, Michael Rogers via swift-users 
>  wrote:
> 
> Hi, All:
> 
> Can someone please enlighten me as to why the first enum works as expected, 
> giving me Melbourne, but the second gives UIModalPresentationStyle rather 
> than fullScreen?

Sure - it's because it's an alias that is imported via Objective-C rather than 
defined in Swift:

typedef NS_ENUM(NSInteger, UIModalPresentationStyle) {
UIModalPresentationFullScreen = 0,
UIModalPresentationPageSheet NS_ENUM_AVAILABLE_IOS(3_2) 
__TVOS_PROHIBITED,
UIModalPresentationFormSheet NS_ENUM_AVAILABLE_IOS(3_2) 
__TVOS_PROHIBITED,
UIModalPresentationCurrentContext NS_ENUM_AVAILABLE_IOS(3_2),
UIModalPresentationCustom NS_ENUM_AVAILABLE_IOS(7_0),

(you can see this in the UIViewController.h file in the UIKit, which is found 
underneath your Xcode install)

The importer notes that the name of such typedef'd constants effectively become 
translated into an enum as far as Swift source code is concerned, but it's a 
different kind of case.

Having said that, it might be a bug in the case that the description of the 
constant isn't the name of the element type. It would be worth raising this on 
bugs.swift.org and use this example in case there's something that can be done 
to fix it.

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Disable "indexing while building" in Xcode9 (unknown argument: `-index-store-path`)

2017-07-05 Thread Alex Blewitt via swift-users
Did you file radars for the below? If others have already reported it, then 
yours will count as a dupe towards it, and the more dupes that a specific radar 
has the higher visibility it has.

Alex

> On 5 Jul 2017, at 10:37, Jens Persson <j...@bitcycle.com> wrote:
> 
> I'm using Xcode 9 beta 2 (on Sierra 10.12.5) and my top 3 annoyances are:
> 
> 1. Having to manually scroll the text editor sideways to follow the 
> caret/cursor as it moves out of view (!) while editing a line that is wider 
> than the text editor.
> 
> 2. Non-working "File -> Add Files" (Options: Copy items if needed unchecked) 
> displaying cryptic error dialog message:
> "An assistant session is already running on this window"
> Have to use drag and drop as a workaround.
> 
> 3. Jump to definition of std lib types / funcs more buggy than in 8.3.3 
> (sometimes not able to locate the definition, no visible cursor when in the 
> jumped-to editor).
> 
> I was surprised 1 hadn't been fixed in the second beta. Is everyone assuming 
> that it must have been reported thousands of times already, or am I the only 
> one experiencing it?
> 
> /Jens
> 
> 
> On Wed, Jul 5, 2017 at 10:53 AM, Alex Blewitt via swift-users 
> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
> A workaround is to add SWIFT_INDEX_STORE_ENABLE=NO as a build time setting in 
> Xcode, which prevents this argument being added to the call to swiftc.
> 
> 
> 
>> On 5 Jul 2017, at 02:02, Anders Hasselqvist via swift-users 
>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>> 
>> Hi,
>> 
>> I've been trying to use the swift4 snapshot toolchains with Xcode9 beta with 
>> little success.
>> 
>> When building I get the error:
>> "
>> :0: error: unknown argument: '-index-store-path'
>> Command 
>> /Library/Developer/Toolchains/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-29-a.xctoolchain/usr/bin/swiftc
>>  failed with exit code 1
>> "
>> 
>> I believe that this because of missing "indexing while building" support in 
>> the open source swift in the currently available snapshots. (The feature was 
>> merged just a few days ago: https://github.com/apple/swift/pull/10726 
>> <https://github.com/apple/swift/pull/10726>)
>> 
>> Is there a way to disable "indexing while building" in Xcode9?
>> 
>> Thanks,
>> Anders
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org <mailto:swift-users@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users 
>> <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users 
> <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Maintaining the contact information in CONTRIBUTORS.txt file

2017-07-03 Thread Alex Blewitt via swift-users
>From https://swift.org/CONTRIBUTORS.txt  
>on the website (which is I presume the one you're referring to):
Names below this line are automatically generated from the repository logs.  It 
contains the information about the committer that was publicly present when the 
commit was made.
So the information is periodically regenerated from the git commit data 
associated with the changes. Since the git commit history is immutable, you 
can't go back and retroactively replace existing e-mail addresses with other 
ones, even if that e-mail server is no longer valid.

I don't know who is responsible for re-generating that list; but I suspect when 
it is regenerated, any such local changes are overwritten in any case.

So as soon as you next commit with a new e-mail address, it will be appended to 
the existing list the next time it's run.

Alex

> On 3 Jul 2017, at 08:35, swiftlover swiftlover via swift-users 
>  wrote:
> 
>  
> Each contributor is responsible for adding his or her name to the 
> CONTRIBUTORS.txt file at the project’s root and maintaining the contact 
> information.
>  
> How can I update my email (mail server that I used was shut down)?
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Class vs Structures

2017-06-29 Thread Alex Blewitt via swift-users
> On 29 Jun 2017, at 18:16, Vitor Navarro via swift-users 
>  wrote:
> 
> Hi,
> 
> I know this question is probably done a thousand times, but I wanted to hear 
> from Swift dev community.

What is the question?

> I think both of them have right places for usage depending on the occasion 
> but documentation, WWDC and the internet give opposite answers regarding this.

Do you have references that you can share?

> Do you guys have any guideline regarding usage here?

The Swift Programming Language  sums up the similarities and differences 
between classes and structures quite well:

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html
 


Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift on Centos7

2017-06-28 Thread Alex Blewitt via swift-users
It's something that isn't currently supported at the moment - follow 
https://bugs.swift.org/browse/SR-100  for 
more updates as others have tried to get it building there as well.

Alex
 
> On 28 Jun 2017, at 10:28, Alexander via swift-users  
> wrote:
> 
> Good day,
> 
> Maybe this is wrong channel to ask, but I try to build swift on Centos7 :)
> And facing some errors on the build process, and Im really stuck. Maybe 
> someone can help me how to check more details about this error?
> 
> build
> ~/tmp/swiftbuild/swift /swift-work
> utils/build-script: note: using preset 'buildbot_linux_build_fedora23', which 
> expands to
> 
> utils/build-script --assertions --release --llbuild --swiftpm --xctest 
> --build-subdir=buildbot_linux --lldb --release --test --validation-test 
> --foundation -- --swift-enable-ast-verifier=0 --install-swift --install-lldb 
> --install-llbuild --install-swiftpm --install-xctest --install-prefix=/usr 
> '--swift-install-components=compiler;clang-builtin-headers;stdlib;sdk-overlay;dev'
>  --build-swift-static-stdlib=1 --skip-test-lldb=1 
> --install-destdir=/root/tmp/swiftbuild/package 
> --installable-package=/root/tmp/swiftbuild/package/swift-linux-x86_64-fedora-2017-06-27--18:00:38.tgz
>  --verbose-build=1 --build-args=-j2 --install-foundation --reconfigure
> 
> + mkdir -p /root/tmp/swiftbuild/build/buildbot_linux
> + env HOST_VARIABLE_linux_x86_64__SWIFT_BENCHMARK_TARGETS= 
> HOST_VARIABLE_linux_x86_64__SWIFT_RUN_BENCHMARK_TARGETS= 
> HOST_VARIABLE_linux_x86_64__SWIFT_SDKS=LINUX 
> HOST_VARIABLE_linux_x86_64__SWIFT_STDLIB_TARGETS=swift-stdlib-linux-x86_64 
> HOST_VARIABLE_linux_x86_64__SWIFT_TEST_TARGETS=check-swift-validation-linux-x86_64
>  /root/tmp/swiftbuild/swift/utils/build-script-impl --workspace 
> /root/tmp/swiftbuild --build-dir /root/tmp/swiftbuild/build/buildbot_linux 
> --install-prefix /usr --host-target linux-x86_64 --stdlib-deployment-targets 
> linux-x86_64 --host-cc /usr/bin/clang --host-cxx /usr/bin/clang++ 
> --darwin-xcrun-toolchain default --darwin-deployment-version-osx=10.9 
> --darwin-deployment-version-ios=7.0 --darwin-deployment-version-tvos=9.0 
> --darwin-deployment-version-watchos=2.0 --cmake /usr/bin/cmake 
> --cmark-build-type Release --llvm-build-type Release --swift-build-type 
> Release --swift-stdlib-build-type Release --lldb-build-type Release 
> --foundation-build-type Release --libdispatch-build-type Release 
> --libicu-build-type Release --xctest-build-type Release --swiftpm-build-type 
> Release --swift-enable-assertions true --swift-stdlib-enable-assertions true 
> --swift-analyze-code-coverage false --cmake-generator Ninja --build-jobs 4 
> '--common-cmake-options=-G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang 
> -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ 
> -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja' '--build-args=-j2 -j4 -v' 
> --cmark-cmake-options= '--llvm-cmake-options=-DLLVM_ENABLE_ASSERTIONS=TRUE 
> -DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;PowerPC;SystemZ' 
> '--swift-cmake-options=-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=FALSE 
> -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE' --lldb-cmake-options= 
> --llbuild-cmake-options= --libdispatch-cmake-options= 
> --foundation-cmake-options= --xctest-cmake-options= --swiftpm-cmake-options= 
> --build-stdlib-deployment-targets all --ninja-bin=/usr/bin/ninja 
> --verbose-build --skip-build-libicu --skip-build-playgroundlogger 
> --skip-build-playgroundsupport --build-swift-dynamic-stdlib 
> --build-swift-static-stdlib --build-swift-dynamic-sdk-overlay 
> --skip-build-ios-device --skip-build-ios-simulator --skip-build-tvos-device 
> --skip-build-tvos-simulator --skip-build-watchos-device 
> --skip-build-watchos-simulator --skip-build-android --skip-test-ios-host 
> --skip-test-ios-simulator --skip-test-tvos-host --skip-test-tvos-simulator 
> --skip-test-watchos-host --skip-test-watchos-simulator 
> --skip-test-android-host --validation-test --skip-test-benchmarks 
> --skip-test-optimized --android-deploy-device-path /data/local/tmp 
> --swift-enable-ast-verifier=0 --install-swift --install-lldb 
> --install-llbuild --install-swiftpm --install-xctest 
> '--swift-install-components=compiler;clang-builtin-headers;stdlib;sdk-overlay;dev'
>  --skip-test-lldb=1 --install-destdir=/root/tmp/swiftbuild/package 
> --installable-package=/root/tmp/swiftbuild/package/swift-linux-x86_64-fedora-2017-06-27--18:00:38.tgz
>  --install-foundation --reconfigure --llvm-lit-args=-sv
> Building the standard library for: swift-stdlib-linux-x86_64
> Running Swift tests for: check-swift-validation-linux-x86_64
> cmark: using gold linker
> + mkdir -p /root/tmp/swiftbuild/build/buildbot_linux/cmark-linux-x86_64
> + pushd /root/tmp/swiftbuild/build/buildbot_linux/cmark-linux-x86_64
> ~/tmp/swiftbuild/build/buildbot_linux/cmark-linux-x86_64 
> ~/tmp/swiftbuild/swift
> + env /usr/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang 
> 

Re: [swift-users] stack trace of Swift executable

2017-05-03 Thread Alex Blewitt via swift-users
Greg,

This occurs when compiled with swiftc -g as well. In fact, I think 'swift 
build', when run by default, will compile with swiftc -g. It's only when you 
run 'swift build --configuration release' that it will compile without it.

$ swiftc --version
Apple Swift version 3.1 (swift-3.1.1-RELEASE)
Target: x86_64-apple-macosx10.9
$ swiftc -g main.swift
$ ./main
Hello, world!
fatal error: unexpectedly found nil while unwrapping an Optional value
Current stack trace:
0libswiftCore.dylib 0x00010edc7160 swift_reportError + 
125
1libswiftCore.dylib 0x00010ede3ac0 
_swift_stdlib_reportFatalError + 60
2libswiftCore.dylib 0x00010ebd4260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
3libswiftCore.dylib 0x00010ed4f120 partial apply for 
(_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never).(closure #2) + 109
4libswiftCore.dylib 0x00010ebd4260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
5libswiftCore.dylib 0x00010ed01d00 specialized 
_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never + 96
6main   0x00010eb91340 say(message : 
String?) -> () + 248
7main   0x00010eb911e0 main + 328
8libdyld.dylib  0x7fffb444d234 start + 1
Illegal instruction: 4

Note that lldb can symbolicate the result and identify the return value, by 
looking at the backtrace:

$ lldb main
(lldb) target create "main"
Current executable set to 'main' (x86_64).
(lldb) run
Process 33032 launched: '/tmp/main' (x86_64)
Hello, world!
fatal error: unexpectedly found nil while unwrapping an Optional value
2017-05-03 10:41:17.340963+0100 main[33032:55100807] fatal error: unexpectedly 
found nil while unwrapping an Optional value
Current stack trace:
0libswiftCore.dylib 0x0001002c1160 swift_reportError + 
125
1libswiftCore.dylib 0x0001002ddac0 
_swift_stdlib_reportFatalError + 60
2libswiftCore.dylib 0x0001000ce260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
3libswiftCore.dylib 0x000100249120 partial apply for 
(_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never).(closure #2) + 109
4libswiftCore.dylib 0x0001000ce260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
5libswiftCore.dylib 0x0001001fbd00 specialized 
_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never + 96
6main   0x00011340 say(message : 
String?) -> () + 248
7main   0x000111e0 main + 328
8libdyld.dylib  0x7fffb444d234 start + 1
Process 33032 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION 
(code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x0001001fbd60 libswiftCore.dylib`function signature 
specialization  of 
Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : 
Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never + 96
libswiftCore.dylib`function signature specialization  of Swift._fatalErrorMessage 
(Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : 
Swift.UInt, flags : Swift.UInt32) -> Swift.Never:
->  0x1001fbd60 <+96>: ud2
0x1001fbd62 <+98>: nopw   %cs:(%rax,%rax)

libswiftCore.dylib`protocol witness table accessor for  Swift.AnySequence 
: Swift.Sequence in Swift:
0x1001fbd70 <+0>:  pushq  %rbp
0x1001fbd71 <+1>:  movq   %rsp, %rbp
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION 
(code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x0001001fbd60 libswiftCore.dylib`function signature 
specialization  of 
Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : 
Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never + 96
frame #1: 0x00011438 main`say(message=nil) -> () at main.swift:5
frame #2: 0x00011328 main`main at main.swift:8
frame #3: 0x7fffb444d235 libdyld.dylib`start + 1
frame #4: 0x7fffb444d235 libdyld.dylib`start + 1

I suspect this is because Swift is generating a .dSYM which is read by LLDB but 
either not read or not loaded by the swift runtime when producing the backtrace:

$ find .
.
./main
./main.dSYM
./main.dSYM/Contents
./main.dSYM/Contents/Info.plist
./main.dSYM/Contents/Resources
./main.dSYM/Contents/Resources/DWARF

Re: [swift-users] stack trace of Swift executable

2017-05-02 Thread Alex Blewitt via swift-users
If you can reproduce it, and run it under lldb, it will print the source line 
for you:

$ lldb .build/debug/main
(lldb) target create ".build/debug/main"
ruCurrent executable set to '.build/debug/main' (x86_64).
(lldb) run
Process 19013 launched: '/private/tmp/main/.build/debug/main' (x86_64)
Hello, world!
fatal error: unexpectedly found nil while unwrapping an Optional value
2017-05-02 09:17:11.351608+0100 asdf[19013:54205130] fatal error: unexpectedly 
found nil while unwrapping an Optional value
Current stack trace:
0libswiftCore.dylib 0x0001002c1160 swift_reportError + 
125
1libswiftCore.dylib 0x0001002ddac0 
_swift_stdlib_reportFatalError + 60
2libswiftCore.dylib 0x0001000ce260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
3libswiftCore.dylib 0x000100249120 partial apply for 
(_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never).(closure #2) + 109
4libswiftCore.dylib 0x0001000ce260 specialized 
specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> A) 
-> A + 342
5libswiftCore.dylib 0x0001001fbd00 specialized 
_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
UInt, flags : UInt32) -> Never + 96
6main   0x00011340 say(message : 
String?) -> () + 248
7main   0x000111e0 main + 328
8libdyld.dylib  0x7fffb444d234 start + 1
Process 19013 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION 
(code=EXC_I386_INVOP, subcode=0x0)
frame #0: 0x0001001fbd60 libswiftCore.dylib`function signature 
specialization  of 
Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : 
Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never + 96
libswiftCore.dylib`function signature specialization  of Swift._fatalErrorMessage 
(Swift.StaticString, Swift.StaticString, file : Swift.StaticString, line : 
Swift.UInt, flags : Swift.UInt32) -> Swift.Never:
->  0x1001fbd60 <+96>: ud2
0x1001fbd62 <+98>: nopw   %cs:(%rax,%rax)

libswiftCore.dylib`protocol witness table accessor for  Swift.AnySequence 
: Swift.Sequence in Swift:
0x1001fbd70 <+0>:  pushq  %rbp
0x1001fbd71 <+1>:  movq   %rsp, %rbp

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION 
(code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x0001001fbd60 libswiftCore.dylib`function signature 
specialization  of 
Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, file : 
Swift.StaticString, line : Swift.UInt, flags : Swift.UInt32) -> Swift.Never + 96
frame #1: 0x00011438 main`say(message=nil) -> () at main.swift:5
frame #2: 0x00011328 main`main at main.swift:8
frame #3: 0x7fffb444d235 libdyld.dylib`start + 1
frame #4: 0x7fffb444d235 libdyld.dylib`start + 1

There is a symbolication tool available for Linux in the 
~/swift/utils/symbolicate-linux-fatal, and Xcode can do the same symbolication 
for you as well.

Alex

> On 28 Apr 2017, at 22:28, Nick Snyder via swift-users  
> wrote:
> 
> I have a simple main.swift that looks like this:
> 
> ```
> print("Hello, world!")
> let x: String? = nil
> 
> func say(message: String?) {
> print(x!) // intentional crash
> }
> 
> say(message: x)
> ```
> 
> Running this results in the crash
> 
> ```
> $ swift build && ./.build/debug/hello
> Hello, world!
> fatal error: unexpectedly found nil while unwrapping an Optional value
> Current stack trace:
> 0libswiftCore.dylib 0x000110120130 swift_reportError 
> + 129
> 1libswiftCore.dylib 0x00011013cb50 
> _swift_stdlib_reportFatalError + 60
> 2libswiftCore.dylib 0x00010ff2d250 specialized 
> specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> 
> A) -> A + 342
> 3libswiftCore.dylib 0x0001100a7e90 partial apply for 
> (_fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
> UInt, flags : UInt32) -> Never).(closure #2) + 109
> 4libswiftCore.dylib 0x00010ff2d250 specialized 
> specialized StaticString.withUTF8Buffer ((UnsafeBufferPointer) -> 
> A) -> A + 342
> 5libswiftCore.dylib 0x00011005a9a0 specialized 
> _fatalErrorMessage(StaticString, StaticString, file : StaticString, line : 
> UInt, flags : UInt32) -> Never + 96
> 6hello  0x00010fee6200 main + 345
> 7libdyld.dylib  0x7fffe0375234 start + 1
> Illegal instruction: 4
> ```
> 
> From the crash, how do I map back line 6 to an actual line in main.swift?
> ___
> 

Re: [swift-users] Build swift on FreeBSD

2017-04-18 Thread Alex Blewitt via swift-users
The error may be because of the missing symbol you saw earlier. The build has a 
setting SWIFT_LINK_OBJC_RUNTIME which should default to NO on non-Darwin 
systems, but I don't know how the detection works on FreeBSD.

The symbol is being emitted by the clang compiler and it seems to think there's 
a GnuStep header somewhere, so that would be where you could start looking to 
see what is happening: 

https://github.com/apple/swift-clang/blob/1a3164ee1c8b9916812b0b92ef8adf9f723b3057/lib/CodeGen/CGException.cpp#L104

Alex

> On 15 Apr 2017, at 09:41, J O via swift-users  wrote:
> 
> Hello, I am a freebsd user. Swift interests me. I clone the swift git to 
> freebsd os and build it then I don't know how to play with it, these are my 
> experience:
>  
> mkdir swift-sources
> cd swift-sources
> git clone https://github.com/apple/swift 
> ./swift/utils/update-checkout --clone
> cd swift
> ./utils/build-script -R
>  
> After build finished, the swift has been generated:
> $ cd ../
> $ ls ./build/Ninja-ReleaseAssert/   
> cmark-freebsd-x86_64   llvm-freebsd-x86_64
> libdispatch-freebsd-x86_64 swift-freebsd-x86_642
>  
> But when I invoke swift and swiftc, it show these errors:
> $ ./build/Ninja-ReleaseAssert/swift-freebsd-x86_64/bin/swift
> :0: error: could not load the swift standard library
>  
> So the first question is how can I configure the swift standard library?
> I need swift working to learn swift programming.
>  
> The second question:
> $ echo "print(\"Hello Swift!\")" > code.swift
> $ ./build/Ninja-ReleaseAssert/swift-freebsd-x86_64/bin/swiftc code.swift
> $ ls
> build  log.01.txt
> clang  ninja
> cmark  swift
> code   swift-corelibs-foundation
> code.swift swift-corelibs-libdispatch
> compiler-rtswift-corelibs-xctest
> llbuildswift-integration-tests
> lldb   swift-xcode-playground-support
> llvm   swiftpm
> $ ./code
> /usr/home/f/bin/sources/swift-sources/build/Ninja-ReleaseAssert/swift-freebsd-x86_64/lib/swift/freebsd/libswiftCore.so:
>  Undefined symbol "__gnustep_objcxx_personality_v0"
>  
> Swiftc can fortunitely compile the code, but when I run it, it
> reports __gnustep_objcxx_personality_v0 is undefined symbol.
> Yes, really it doesn't have gnustep or objcxx. I only want swift
> and swiftc working. What should I do next?
>  
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift Concurrency and Actor model

2017-04-12 Thread Alex Blewitt via swift-users
> On 11 Apr 2017, at 23:37, Greg Parker via swift-users  
> wrote:
> 
>> 
>> On Apr 11, 2017, at 9:10 AM, Gerard Iglesias via swift-users 
>> > wrote:
>> 
>> Thanx for the link on this…
>> 
>> I am experimenting the use of dispatch queue to mimic somme Actor Model 
>> things and it is not a bad idea, dispatch queue are perfect for that.
>> 
>> I wonder what is the scalability of the Dispatch layer, are we able to 
>> create a bunch of dispatch queue without putting the system on its knees ? I 
>> will do tests
> 
> Dispatch queues are intended to be cheap, comparable to a pthread_mutex IIRC.
> 
> The limited resource are the top-level global queues, DispatchQueue.main and 
> DispatchQueue.global(…). There are a limited number of threads available to 
> service concurrent items on those queues (around 500 threads on macOS and 
> iOS, IIRC). If too many concurrent work items are pushed into the global 
> queues at one time then the process may deadlock when dispatch exhausts its 
> thread pool.

These can be accessed via sysctl, for future reference:

$ sysctl kern.wq_max_threads kern.wq_max_constrained_threads 
kern.wq_max_threads: 512
kern.wq_max_constrained_threads: 64

The limit of 64 applies to lower-priority items (which is the default, IIRC) so 
you may find that you hit the 64 limit faster than you hit the 512 limit.

Alex___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Why does this leak?

2017-03-28 Thread Alex Blewitt via swift-users
> On 28 Mar 2017, at 05:41, Rick Aurbach  wrote:
> 
> That wouldn’t work directly. The “leak” occurs when processing a segue called 
> in response to a user button push. (I suppose I could attempt to wire up a UI 
> Test, but would rather not go down that route.)
> 
> What I can try is to see if I can create a simple, artificial example. If it 
> also reports a leak, then I could try looping it. I’ll look into it in the 
> morning.

You could try doing something like:

static let choser:ColorChoser = ColorChoser()
choser.textChoserType = .text

Run that in Xcode and see if it shows a leak.

Alex
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Why does this leak?

2017-03-27 Thread Alex Blewitt via swift-users

> On 26 Mar 2017, at 18:43, Rick Aurbach via swift-users 
>  wrote:
> 
> I have a situation where I have a leak that I do not understand. I would be 
> very grateful if someone could explain it to me and offer an idea of how I 
> can make the pattern work without leaking:

How are you determining that this is leaking? There was an issue in Xcode where 
the 'leaks' detector was unable to introspect the memory layout of a Swift 
object containing an enum stored property and incorrectly flagging other such 
reachable objects as leaks. If that's the case, do you still see the same 
behaviour flagged in the latest Xcode?

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Building Swift from source

2017-02-21 Thread Alex Blewitt via swift-users

> On 21 Feb 2017, at 04:38, Mohit Athwani via swift-users 
>  wrote:
> 
> To compile, I've been using:
> ./swift/utils/build-script --preset=buildbot_linux_1604 
> install_destdir=/tmp/install installable_package=/tmp/swift.tar.gz
> 
> This process takes a very long time. I was wondering if there was a quicker 
> way for subsequent builds.

If you're just testing whether you can build successfully or not, then you 
could use the buildbot_incremental_linux preset. You can also build a version 
standalone without using a preset, like build-script --release 

The commands that a preset corresponds to are stored in 

https://github.com/apple/swift/blob/master/utils/build-presets.ini

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Master branch not compiling

2017-02-21 Thread Alex Blewitt via swift-users
The LLDB master still fails to build and has been failing for the last 11 days 
on Linux:

https://ci.swift.org/job/oss-lldb-incremental-linux-ubuntu-16_04/ 

https://ci.swift.org/job/oss-lldb-incremental-linux-ubuntu-16_10/ 


When you run 'update-checkout --reset-to-master' it will pull in the failing 
commit for lldb.

The Swift package only builds because it's using a pinned version of lldb 
corresponding to commit bdf3964387c993cefc4c0c5afed31fd5a9957f6d 

https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/ws/lldb/.git/HEAD/*view*/

It looks like the swift-lldb checkout is using the 'stable' branch rather than 
'master'. If you try resetting that to your lldb checkout it may work.

Alex

> On 21 Feb 2017, at 00:49, Mohit Athwani via swift-users 
>  wrote:
> 
> Just pulled and merged and same problem!
> 
> Cheers!
> 
> 
> --
> Mohit Athwani
> http://about.me/mohitathwani
> 
> On Feb 20, 2017, 3:04 PM -0800, Greg Parker , wrote:
>> 
>>> On Feb 20, 2017, at 12:56 PM, Mohit Athwani via swift-users 
>>> > wrote:
>>> 
>>> Hello,
>>>  I fetched updates from upstream into my forked and cloned repository and 
>>> tried to compile for linux_1604 and the compile fails with error: no 
>>> matching constructor for initialization of swift::TypeAliasDecl
>>> 
>>> Wondering if anybody else is facing this issue. This is the master branch 
>>> btw
>> 
>> IIRC there was a temporary problem here a few days ago. Does it still fail 
>> if you pull changes from today's master?
>> 
>> 
>> -- 
>> Greg Parker gpar...@apple.com  Runtime 
>> Wrangler
>> 
>> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Array elements assign to variables

2017-01-27 Thread Alex Blewitt via swift-users
On 27 Jan 2017, at 11:27, TUNG CK via swift-users  wrote:
> 
> Python, we have this
>for pixel in pixels:
>r, g, b, brightness = pixel
>.
> 
> I wonder how to do it in swift? is there a more swifty way to do something 
> like this below?
>for pixel in pixels {
>var r = pixel[0]
>var g = pixel[1]
>var b = pixel[2]
>var brightness = pixel[3]
> .
> }

If Pixel is a tuple instead of an array, you can do:

var (r,g,b,brightness) = pixel

Alex

  1> let Pixel = (1,2,3,4)
Pixel: (Int, Int, Int, Int) = {
  0 = 1
  1 = 2
  2 = 3
  3 = 4
}
  2> var (r,g,b,brightness) = Pixel
r: Int = 1
g: Int = 2
b: Int = 3
brightness: Int = 4
  3>  

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Using Task on Linux

2017-01-09 Thread Alex Blewitt via swift-users
When you run it with absolute paths for the 'swift' and 'python' executables, 
does it work then?

Alex

> On 9 Jan 2017, at 06:20, Mr Bee via swift-users  wrote:
> 
> Hi,
> 
> I'm writing a simple editor on Linux for Swift language. I use Task (was 
> NSTask) to run the Swift REPL. Unfortunately, Task failed to execute the 
> Swift REPL for no obvious reasons. The Swift compiler and REPL are installed 
> just fine and able to execute any Swift codes. However, my exact same code 
> has no problem to run bash commands.
> 
> Here's the code:
> _
> 
> import Foundation
> 
> extension Task {
>   func execute(command: String, currentDir: String = "~", arguments: [String] 
> = [], input: String = "") -> String {
> if !input.isEmpty {
>   let pipeIn = Pipe()
>   self.standardInput = pipeIn
>   // multiple inputs are separated by newline
>   if let input = input.data(using: String.Encoding.utf8) {
> pipeIn.fileHandleForWriting.write(input)
>   }
> }
> 
> let pipeOut = Pipe()
> self.standardOutput = pipeOut
> 
> self.arguments = arguments
> self.launchPath = command
> self.currentDirectoryPath = currentDir
> 
> self.launch()
> let output = pipeOut.fileHandleForReading.readDataToEndOfFile()
> self.waitUntilExit()
> 
> return String(data: output, encoding: String.Encoding(rawValue: 
> String.Encoding.utf8.rawValue))!
>   }
> }
> 
> print(Task().execute(command: "swift", arguments: ["test.swift"]))  // <- 
> FAILED
> // print(Task().execute(command: "python", arguments: ["test.py"])) // <- 
> FAILED
> // print(Task().execute(command: "/bin/ls", arguments: ["-l"])) // <- OK
> 
> _
> 
> The test code is just a simple hello world program, nothing fancy. Can 
> anybody here enlighten me what did I wrong with the code? I'm using Swift 
> v.3.0 on Ubuntu Linux 14.04.
> 
> Thank you.
> 
> Regards,
> 
> 
> –Mr Bee
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Possible bug in Swift REPL autocompletion?

2016-12-23 Thread Alex Blewitt via swift-users
I think this is a known issue but I don't know what the bug is. Please can you 
create a bug on https://bugs.swift.org  and include a 
reproduction, including what output you see?

Thanks,

Alex

> On 22 Dec 2016, at 21:19, Eugenio Baglieri via swift-users 
>  wrote:
> 
> Good evening, i was  playing with swift REPL. I imported Darwin and using c 
> functions. I noted that autocompletion is unusable if the last character is a 
> parenthesis “(“. 
> The autocompletion seems to not get account of the already written function 
> name, and after parenthesis shows as possible completion an infinite list 
> with all the parameters of all loaded libraries. 
> 
> Is this an issue that could be opened? You can reproduce this following these 
> steps:
> 
> - launch swift from terminal
> - write “import Darwin” on Mac, or “import Glibc” on Ubuntu
> - digit “fop” and press tab, you’ll get autocompleted with “fopen(“ press tab 
> again
> 
> — 
> Eugenio B.
> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift 3 Whole Module Optimization Issue

2016-12-23 Thread Alex Blewitt via swift-users
Can you raise a bug at https://bugs.swift.org  with 
the details, including the crash dump?

Thanks,

Alex

> On 22 Dec 2016, at 02:48, Jun Zhang via swift-users  
> wrote:
> 
> Hi, everyone.
>I think I found a swift 3 whole module optimization issue. The code below, 
> when building with release configuration and running on an iOS 10 real 
> device, will always causes a crash.
> 
> import UIKit
> class ViewController: UIViewController {
> override func viewDidLoad() {
> super.viewDidLoad()
> // Do any additional setup after loading the view.
> super.viewDidLoad()
> 
> let orderby = "time"
> let url = "http://www.sample.com/api/index.php 
> ?\(orderby)"
> 
> Log("Request url: \(url)")
> 
> if let url = URL(string: url) {
> let request = URLRequest(url: url)
> print(request)
> }
> }
> override func didReceiveMemoryWarning() {
> super.didReceiveMemoryWarning()
> // Dispose of any resources that can be recreated.
> }
> 
> }
> func Log(_ log: String) {
> //NSLog("%@", log)
> }
> 
> You can see the attachment for more detail info.
> Or if you use github, this is the repo: 
> https://github.com/zaczh/Swift3ClosureDemo 
> 
> ​
>  Swift3ClosureDemo-master.zip 
> ​
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Ubuntu/Centos docker with swift 3

2016-12-12 Thread Alex Blewitt via swift-users




Sent from my iPhone 
> On 12 Dec 2016, at 22:32, Gerard Iglesias  wrote:
> 
> Hello,
> 
> Something important to note, i have created an image from scratch installing 
> emacs in place of vim.
> 
> But to get swift working we have to run the image with privilege access like 
> this 
> 
> docker run -ti --privileged=true theImageName
> 
> Unless we get an error when running the REPL

Yes, if you want to run the repl or lldb then you either need --privileged or 
--security-opt seccomp:unconfined and --cap-add SYS_PTRACE. 

You might also want to specify --rm which will remove your containers runtime 
image afterwards, as otherwise you will end up with many nearly identical 
copies of your container on disk. 

Alex 
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Trouble with initial checkout

2016-12-08 Thread Alex Blewitt via swift-users
If you want to use the branch swift-3.0.2-PREVIEW-1 tag then you should run 
update-checkout with that tag name, to ensure that you're on the right one.

You can run:

swift/utils/update-checkout --tag swift-3.0.2-PREVIEW-1

If you find that you have problems with repository state (that you didn't 
apply) then you can add --reset-to-remote or --clean, which will guarantee you 
are in a better starting point.

Alex

> On 8 Dec 2016, at 04:00, Ryan Parman via swift-users  
> wrote:
> 
> I’ve been using Git for about 8 years now, so I know my way around. But in 
> checking out a release of Swift, I’m running into errors.
> 
> ```
> $ git clone -q -b swift-3.0.2-PREVIEW-1 https://github.com/apple/swift.git;
> Note: checking out 'dc2c3d580f52367eebaada34901a945466e947df'.
> 
> You are in 'detached HEAD' state. You can look around, make experimental
> changes and commit them, and you can discard any commits you make in this
> state without impacting any branches by performing another checkout.
> 
> If you want to create a new branch to retain commits you create, you may
> do so (now or later) by using -b with the checkout command again. Example:
> 
>  git checkout -b 
> ```
> 
> So far, so good. (I also did this exact same thing with swift-3.0.1-RELEASE — 
> same issue.)
> 
> Now, for the util scripts:
> 
> ```
> $ cd swift && \
>./utils/update-checkout --clone && \
>./utils/build-script -r \
> ;
> --- Cloning 'compiler-rt' ---
> + git clone --recursive https://github.com/apple/swift-compiler-rt.git 
> compiler-rt
> Cloning into 'compiler-rt'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 67008, done.
> remote: Compressing objects: 100% (721/721), done.
> remote: Total 67008 (delta 461), reused 0 (delta 0), pack-reused 66286
> Receiving objects: 100% (67008/67008), 12.01 MiB | 6.94 MiB/s, done.
> Resolving deltas: 100% (54564/54564), done.
> Already on 'stable'
> Your branch is up-to-date with 'origin/stable'.
> --- Cloning 'llvm' ---
> + git clone --recursive https://github.com/apple/swift-llvm.git llvm
> Cloning into 'llvm'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 1288275, done.
> remote: Compressing objects: 100% (1733/1733), done.
> remote: Total 1288275 (delta 1048), reused 0 (delta 0), pack-reused 1286542
> Receiving objects: 100% (1288275/1288275), 288.84 MiB | 10.42 MiB/s, done.
> Resolving deltas: 100% (1065091/1065091), done.
> Checking out files: 100% (22170/22170), done.
> Already on 'stable'
> Your branch is up-to-date with 'origin/stable'.
> --- Cloning 'swift-xcode-playground-support' ---
> + git clone --recursive 
> https://github.com/apple/swift-xcode-playground-support.git 
> swift-xcode-playground-support
> Cloning into 'swift-xcode-playground-support'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 483, done.
> remote: Total 483 (delta 0), reused 0 (delta 0), pack-reused 482
> Receiving objects: 100% (483/483), 139.53 KiB | 0 bytes/s, done.
> Resolving deltas: 100% (301/301), done.
> Already on 'master'
> Your branch is up-to-date with 'origin/master'.
> --- Cloning 'swift-corelibs-foundation' ---
> + git clone --recursive 
> https://github.com/apple/swift-corelibs-foundation.git 
> swift-corelibs-foundation
> Cloning into 'swift-corelibs-foundation'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 13088, done.
> remote: Compressing objects: 100% (58/58), done.
> remote: Total 13088 (delta 17), reused 0 (delta 0), pack-reused 13030
> Receiving objects: 100% (13088/13088), 8.57 MiB | 6.03 MiB/s, done.
> Resolving deltas: 100% (9875/9875), done.
> Already on 'master'
> Your branch is up-to-date with 'origin/master'.
> --- Cloning 'clang' ---
> + git clone --recursive https://github.com/apple/swift-clang.git clang
> Cloning into 'clang'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 628505, done.
> remote: Compressing objects: 100% (498/498), done.
> remote: Total 628505 (delta 316), reused 15 (delta 15), pack-reused 627992
> Receiving objects: 100% (628505/628505), 128.49 MiB | 9.96 MiB/s, done.
> Resolving deltas: 100% (532138/532138), done.
> Checking out files: 100% (13004/13004), done.
> Already on 'stable'
> Your branch is up-to-date with 'origin/stable'.
> --- Cloning 'llbuild' ---
> + git clone --recursive https://github.com/apple/swift-llbuild.git llbuild
> Cloning into 'llbuild'...
> warning: templates not found /usr/local/git/share/git-core/templates
> remote: Counting objects: 7253, done.
> remote: Compressing objects: 100% (3/3), done.
> remote: Total 7253 (delta 1), reused 0 (delta 0), pack-reused 7250
> Receiving objects: 100% (7253/7253), 6.90 MiB | 4.61 MiB/s, done.
> Resolving deltas: 100% (4769/4769), done.
> Already on 'master'
> Your branch is up-to-date with 

Re: [swift-users] Decimal to Double?

2016-11-28 Thread Alex Blewitt via swift-users
NSDecimal conforms to the ExpressibleBy(Float|Integer)Literal, but that just 
means it can be created from a literal value, not the other way around:

https://github.com/apple/swift-corelibs-foundation/blob/108a5b0006912c6cf6b59e4954255237bf01b67a/Foundation/NSDecimal.swift#L319-L329
 
<https://github.com/apple/swift-corelibs-foundation/blob/108a5b0006912c6cf6b59e4954255237bf01b67a/Foundation/NSDecimal.swift#L319-L329>



extension Decimal : ExpressibleByFloatLiteral {
public init(floatLiteral value: Double) {
self.init(value)
}
}

extension Decimal : ExpressibleByIntegerLiteral {
public init(integerLiteral value: Int) {
self.init(value)
}
}

It would be relatively simple for the NSDecimal to add an extension initialiser 
to Double to allow construction directly from an NSDecimal, but it would have 
to be done for both the Linux and Darwin implementations.

Alex

> On 28 Nov 2016, at 17:15, David Sweeris <daveswee...@mac.com> wrote:
> 
> 
> On Nov 28, 2016, at 09:48, Philippe Hausler via swift-users 
> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
> 
>> This might be a bit nicer since that is relying on NSNumber bridges. You can 
>> bridge to NSDecimalNumber directly like this: 
>> 
>> (Decimal(1.0) as NSDecimalNumber).doubleValue
>> 
>> (but perhaps we should consider adding initializers that follow the same 
>> pattern as Double that don’t have to bridge to solve the problem)
>> 
>>> On Nov 28, 2016, at 2:40 AM, Alex Blewitt via swift-users 
>>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
>>> 
>>> You can wrap it with an NSDecimalNumber, and then cast it to a Double from 
>>> there:
>>> 
>>> Double(NSDecimalNumber(decimal:Decimal(1.0)))
>>> 
>>> Alex
>>> 
>>>> On 28 Nov 2016, at 10:13, Rick Mann via swift-users <swift-users@swift.org 
>>>> <mailto:swift-users@swift.org>> wrote:
>>>> 
>>>> How do I get a Double from a Decimal?
>>>> 
>>>> TIA,
>>>> 
>>>> -- 
>>>> Rick Mann
>>>> rm...@latencyzero.com <mailto:rm...@latencyzero.com>
>>>> 
>>>> 
>>>> ___
>>>> swift-users mailing list
>>>> swift-users@swift.org <mailto:swift-users@swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-users 
>>>> <https://lists.swift.org/mailman/listinfo/swift-users>
>>> 
>>> ___
>>> swift-users mailing list
>>> swift-users@swift.org <mailto:swift-users@swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-users 
>>> <https://lists.swift.org/mailman/listinfo/swift-users>
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org <mailto:swift-users@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users 
>> <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> Does NSDecimalNumber conform to the floating point literal whosywhatsit 
> protocol? If not, wouldn't both of those examples just covert a Double to a 
> decimal and back again? Would there be a purpose to that? Like maybe it'd get 
> rounded differently or something?
> 
> Once you have an NSDecimalNumber variable, though, I don't know of any better 
> way than that '.doubleValue' property you and Alex mentioned.
> 
> - Dave Sweeris

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] comparison Non-Optional and Optional without unwrap

2016-10-18 Thread Alex Blewitt via swift-users

> On 18 Oct 2016, at 09:58, Седых Александр via swift-users 
>  wrote:
> 
> This code work: 
> 
> let one: Int? = 5
> let two = 5
> let result = one == two
>  
> print(result)
> 
> //print true
> 
> Why we can access to Optional value without unwrap within comparison 
> operations?

The 'one' value isn't being unwrapped; the 'two' value is being wrapped in an 
optional, and then compared. In effect, it's doing:

let result = one == Optional(two)

This allows you to pass in non-optional values to functions that take optional 
arguments, e.g.

func printme(_ i:Int?) { print("\(i)") }

printme(one)
printme(two)

Alex___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Swift migration bug

2016-10-03 Thread Alex Blewitt via swift-users
> On 30 Sep 2016, at 19:30, Nate Birkholz via swift-users 
>  wrote:
> 
> I found a bug in Swift 2.3 migration in the XCUITests, not sure if the bug 
> goes to swift.org  or to Apple.
> 
> UI test generator uses the syntax (XCUIElement).children(matching: .other) 
> but the compiler only recognizes childrenMatchingType(.Other), and you have 
> to manually change the instances. Makes generating UI Tests a pain!

Please open a bug at https://bugs.swift.org  and then 
it can be re-routed if necessary. If you can attach the snippet of code with 
before/after that would help.

Thanks!

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] IBM and Swift on the Server

2016-04-13 Thread Alex Blewitt via swift-users
At QCon London earlier this year, IBM came to speak about their work with Swift 
on the server and their use on Linux. I interviewed them afterwards about it, 
and now both the presentation and interview write-up are available on InfoQ, in 
case you’re interested:

http://www.infoq.com/presentations/swift-server
http://www.infoq.com/articles/Ibm-swift

Alex
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users