Re: [swift-users] Where did “powl” go?

2016-07-05 Thread Antonino Ficarra via swift-users
long double math.h functions appear to not be exported in swift. I don’t know why. This horrible hack works: // in f80.h extern void sqrt_f80( void *result, const void *v ); extern void pow_f80( void *result, const void *v, const void *e ); ... // in f80.c void sqrt_f80( void *result, const voi

Re: [swift-users] another issue with tuples

2016-07-05 Thread Zhao Xin via swift-users
Tuple is not designed to be used as commonly as classes and structs. NOTE > Tuples are useful for temporary groups of related values. They are not > suited to the creation of complex data structures. If your data structure > is likely to persist beyond a temporary scope, model it as a class or > s

[swift-users] another issue with tuples

2016-07-05 Thread Aaron Bohannon via swift-users
Yesterday, it was pointed out that a variable name referring to a tuple cannot be used as a pattern. I have noticed another sort of inconsistency in how tuples are treated when they are referenced by name: func f() -> Int { return 5 } let t = ("a", f) let _: (String, () throws -> Int) = t // t

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Brent Royal-Gordon via swift-users
> On Jul 5, 2016, at 11:39 AM, Adriano Ferreira via swift-users > wrote: > > Do you think this should be filed as a bug or just wait until the Swift team > removes the old stride method? The old method is probably a stub that tells the fix-its how to find the new one, so it's there to stay. F

Re: [swift-users] [Bug or ByDesign?] unowned optional values not allowed

2016-07-05 Thread Zhao Xin via swift-users
According to you description, you should use weak var parent:A! Zhaoxin On Mon, Jul 4, 2016 at 2:29 PM, Karl via swift-users wrote: > Currently it’s not possible to have an unowned optional value. E.g: > > class A { > unowned var parent : A? // ‘unowned’ may only be applied to >

Re: [swift-users] Expression pattern cannot be a named tuple constant

2016-07-05 Thread Neil Faiman via swift-users
SR-1993. > On Jul 5, 2016, at 4:15 PM, Jordan Rose wrote: > > I'd definitely consider that a bug. Can you file it at bugs.swift.org? > > Jordan > >> On Jul 4, 2016, at 14:56, Neil Faiman via swift-users >> wrote: >> >> (Resending — this didn’t get any responses when I sent it a month ago.)

Re: [swift-users] Checking if an UnsafeMutablePointer is NULL in Swift 3

2016-07-05 Thread Dmitri Gribenko via swift-users
On Tue, Jul 5, 2016 at 3:40 PM, Vinicius Vendramini via swift-users wrote: > Hi all! > > Used to be in Swift 2.x I only had to compare an unsafe pointer (obtained > from a C API) to nil to know whether or not it was NULL. After conversion to > Swift 3, it seems that isn’t allowed anymore. > > I

[swift-users] Checking if an UnsafeMutablePointer is NULL in Swift 3

2016-07-05 Thread Vinicius Vendramini via swift-users
Hi all! Used to be in Swift 2.x I only had to compare an unsafe pointer (obtained from a C API) to nil to know whether or not it was NULL. After conversion to Swift 3, it seems that isn’t allowed anymore. I remember watching something about it in WWDC but I can’t remember (or find) the solutio

Re: [swift-users] Expression pattern cannot be a named tuple constant

2016-07-05 Thread Jordan Rose via swift-users
I'd definitely consider that a bug. Can you file it at bugs.swift.org? Jordan > On Jul 4, 2016, at 14:56, Neil Faiman via swift-users > wrote: > > (Resending — this didn’t get any responses when I sent it a month ago.) > > Swift 2.2 in Xcode 7.3.1. > > Apparently you cannot use a named tuple

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Joe Groff via swift-users
This is a known bug. The definition of 'stride' inside 'Int' for migration from Swift 2 causes the compiler to fail to find the global function. https://bugs.swift.org/browse/SR-1798 -Joe > On Jul 4, 2016, at 8:41 PM, Adriano Ferreira via swift-users > wrote: > > Hi everyone! > > I’m conver

Re: [swift-users] Specifying A Dynamic Type In Swift Generics

2016-07-05 Thread Kenny Leung via swift-users
So, restating the question: You want to have a method on a class such that it will return an object which is genericised with that class. Like: class A { func createB() -> B { } } So that if you have C which is a subclass of A, calling createB() would return B, and not B Is that corre

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Adriano Ferreira via swift-users
Thanks Martin, now it works! Do you think this should be filed as a bug or just wait until the Swift team removes the old stride method? Best, — A > On Jul 5, 2016, at 1:25 PM, Martin R via swift-users > wrote: > > It seems that the extension method > >extension Strideable { >p

[swift-users] Where did “powl” go?

2016-07-05 Thread Jeff Kelley via swift-users
Hello all, I’m using Xcode 8.0 and Swift 3 on OS X 10.11, and I’m trying to use powl in an OS X Playground. I see the definition of the pow-related functions in math.h here: extern float powf(float, float); extern double pow(double, double); extern long double powl(long double, long dou

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Martin R via swift-users
It seems that the extension method extension Strideable { public func stride(to end: Self, by stride: Self.Stride) -> StrideTo } from Swift 2.2 is still known to the compiler and only marked as unavailable in Swift 3, as this code example demonstrates: extension Int {

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Adriano Ferreira via swift-users
Any suggestions on how to work around it or to fix it? Thanks in advance! — A > On Jul 5, 2016, at 12:00 PM, Zhao Xin wrote: > > You are right. Int conforms to Strideable. > > Now it seams like a bug. As in a playground. below are code works and doesn't > work > > extension Int { > fu

Re: [swift-users] [Bug or ByDesign?] unowned optional values not allowed

2016-07-05 Thread Jordan Rose via swift-users
Longstanding bug, rdar://problem/17277899 . Surprisingly few people have asked for it. Jordan > On Jul 3, 2016, at 23:29, Karl via swift-users wrote: > > Currently it’s not possible to have an unowned optional value. E.g: > > class A { > unowned var parent : A? // ‘unowned’ may onl

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Zhao Xin via swift-users
You are right. Int conforms to Strideable. Now it seams like a bug. As in a playground. below are code works and doesn't work extension Int { func test() { let temp = stride(from:1, to:10, by:2) // error } } extension Float { func test() { let temp = stride(fro

[swift-users] Specifying A Dynamic Type In Swift Generics

2016-07-05 Thread Jon Akhtar via swift-users
I have a generic class that I would like to use. I¹ll include the whole source. public final class EventRegistration { private(set) var event: E? private var token: AnyObject? public init() {} public init(event: AppEvent, token: AnyObject) { self.e

Re: [swift-users] Cannot invoke 'stride' with an argument list of type '(from: Int, to: Int, by: Int)'

2016-07-05 Thread Shawn Erickson via swift-users
Int conforms to Strideable byway of Integer <- SignedInteger <- Int (not exactly sure how it will be once the integer proposal is implemented but it will still be strideable). -Shawn On Mon, Jul 4, 2016 at 10:38 PM Zhao Xin via swift-users < swift-users@swift.org> wrote: > In Swift 3, > > func st

[swift-users] Permission problem with Swift 3.0 Preview 1 on Ubuntu 14.04

2016-07-05 Thread Martin R via swift-users
I downloaded and installed Swift 3.0 Preview 1 on Ubuntu 14.04, following the instructions in https://swift.org/download/#releases. For some reason, all files in the swift-3.0-PREVIEW-1-ubuntu14.04/usr/lib/swift/CoreFoundation directory of the archive have mode "-rw-r-", i.e. they are not