[swift-users] Bls: Bls: module (de)-initialization

2016-12-21 Thread Mr Bee via swift-users
Sorry for not being clear. My english isn't very good either.
What I meant was static module linking (loading and unloading) for Swift 
modules. Also with initialization and deinitialization for Swift modules.
It's alright then. I just want to make sure. I'm a Pascal/Delphi programmer and 
sometimes I rely on such features in my applications. As a new and considered 
as modern programming language, I thought Swift would provide more advance 
features than Pascal/Delphi does.
Thank you. 
–Mr Bee
 

Pada Kamis, 22 Desember 2016 10:12, Joe Groff  menulis:
 

 
> On Dec 21, 2016, at 7:11 PM, Mr Bee  wrote:
> 
> > Unloading Swift modules will likely never be supported, since this would 
> > impose a ton of complexity and performance cost on the runtime for little 
> > benefit.
> 
> Hmmm… so Swift will only support static linking? I thought Swift is a modern 
> programming language with modern and advance features. Even Pascal/Delphi has 
> had those features since ages ago.

Swift supports dynamic linking just fine; like I said, "dlopen" works.

-Joe


   ___
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-21 Thread Joe Groff via swift-users

> On Dec 21, 2016, at 7:08 PM, 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
> ​
Thanks for the report! Please file it on bugs.swift.org if you have a moment.

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


Re: [swift-users] Bls: module (de)-initialization

2016-12-21 Thread Joe Groff via swift-users

> On Dec 21, 2016, at 7:11 PM, Mr Bee  wrote:
> 
> > Unloading Swift modules will likely never be supported, since this would 
> > impose a ton of complexity and performance cost on the runtime for little 
> > benefit.
> 
> Hmmm… so Swift will only support static linking? I thought Swift is a modern 
> programming language with modern and advance features. Even Pascal/Delphi has 
> had those features since ages ago.

Swift supports dynamic linking just fine; like I said, "dlopen" works.

-Joe

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


[swift-users] Bls: module (de)-initialization

2016-12-21 Thread Mr Bee via swift-users
> Unloading Swift modules will likely never be supported, since this would 
>impose a ton of complexity and performance cost on the runtime for little 
>benefit.
Hmmm… so Swift will only support static linking? I thought Swift is a modern 
programming language with modern and advance features. Even Pascal/Delphi has 
had those features since ages ago. 
–Mr Bee
 

Pada Kamis, 22 Desember 2016 1:06, Joe Groff via swift-users 
 menulis:
 

 
> On Dec 20, 2016, at 8:54 AM, Jens Alfke via swift-users 
>  wrote:
> 
> Also, AFAIK there is no mechanism in Swift (yet) to load or unload a module 
> at runtime, so a module load occurs when the program starts up, and an unload 
> occurs when the program exits. 

dlopen works fine, though the only supported ways of getting a callable symbol 
out of the loaded image are currently to use a C entry point or look up a type 
defined in the module by name. Unloading Swift modules will likely never be 
supported, since this would impose a ton of complexity and performance cost on 
the runtime for little benefit. (Apple's ObjC runtime does not support 
unloading dylibs after classes inside them have been reified either.)

-Joe
___
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


[swift-users] Swift 3 Whole Module Optimization Issue

2016-12-21 Thread Jun Zhang via swift-users
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


Re: [swift-users] module (de)-initialization

2016-12-21 Thread Joe Groff via swift-users

> On Dec 20, 2016, at 8:54 AM, Jens Alfke via swift-users 
>  wrote:
> 
> Also, AFAIK there is no mechanism in Swift (yet) to load or unload a module 
> at runtime, so a module load occurs when the program starts up, and an unload 
> occurs when the program exits. 

dlopen works fine, though the only supported ways of getting a callable symbol 
out of the loaded image are currently to use a C entry point or look up a type 
defined in the module by name. Unloading Swift modules will likely never be 
supported, since this would impose a ton of complexity and performance cost on 
the runtime for little benefit. (Apple's ObjC runtime does not support 
unloading dylibs after classes inside them have been reified either.)

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


[swift-users] Using the thread sanitizer with swift test

2016-12-21 Thread Martin Angers via swift-users
Hello,

This is my first message to the swift mailing lists, so I'd like to start
with a big thank you to the Swift core team and collaborators for all the
hard work.

My question is related to the thread sanitizer tool. Having worked mostly
with Go in recent years, I've become spoiled by the tooling and was really
happy to see that swift also had a data race detector. However, where in Go
I can write `go test -race` to run tests with the detector enabled, I tried
`swift test -Xswiftc -sanitize=thread` but ended up with the following
error:

"==46839==ERROR: Interceptors are not working. This may be because
ThreadSanitizer is loaded too late (e.g. via dlopen)."

`swift build -Xswiftc -sanitize=thread` seems to work (i.e. it compiles
without error) but since I want to test a library, that's not helpful in my
case.

Is that something that should be currently supported - in which case I'm
missing something - or if not, is it something that is likely to be
supported in the future? And then the next best thing at the moment would
be to write an executable that exercises my library and build+run it with
the thread sanitizer?

Thanks,
Martin Angers
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] Question on 3 tiers architecture with Swift backend

2016-12-21 Thread Sinardy Xing via swift-users
Hi Swift Users,

I want to build and apps like following architecture


Tier 1
Mobile and Browser

Tier 2
Swift Linux Apps (getting alot of JSON from Tier 3 and pass to Tier 1? )

Tier 3
MySQL database


My question is:

I have alot of SQL queries API to the database that I would like to be
place in Tier 2.
Currently what is the best approach to achieve this?

Thanks

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