Re: [swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Jack Lawrence via swift-users
Serial is the default for a DispatchQueue. Jack > On Aug 1, 2016, at 4:34 PM, Jon Shier via swift-users > wrote: > > Is it? I can’t tell by either the generated interface (default is not a > useful value to expose) or a brief read of the Queue.swift file for it. > > > Jon > >> On Aug 1, 20

Re: [swift-users] More questions about protocol/value programming

2016-08-01 Thread Karl via swift-users
A protocol can require that a certain initialiser exists, but it can’t provide a default implementation (you can add initialisers in a protocol extension IIRC, but then they must delegate to an actual, required initialiser). A protocol is not the same thing as a subclass. Any type could conform

Re: [swift-users] Swift Package Manager – system-module and code

2016-08-01 Thread Omri Mor via swift-users
That isn’t quite what I mean. There’s a system-level library, in say /usr/local/lib/libfoo.dylib (or libfoo.so on Linux), with a header in /usr/local/include/foo.h. foo.h has complex macros that cannot be imported into Swift, so they need a C wrapper/bridge. This is, say, foo_bridge.c and foo_br

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Jacob Bandes-Storch via swift-users
er, I guess it's probably plain ol' map, rather than flatMap. On Mon, Aug 1, 2016 at 8:28 PM, Jacob Bandes-Storch wrote: > You can think of this like flatMap: > > let count = s.flatMap { $0.characters.count } ?? 0// like > s?.characters.count ?? 0 > let count = s.flatMap { $0.charact

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Jacob Bandes-Storch via swift-users
You can think of this like flatMap: let count = s.flatMap { $0.characters.count } ?? 0// like s?.characters.count ?? 0 let count = s.flatMap { $0.characters }.flatMap { $0.count } ?? 0 // like (s?.characters)?.count ?? 0 Jacob On Mon, Aug 1, 2016 at 10:26 AM, Stephen Schaub via swi

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Jordan Rose via swift-users
I happen to agree with Jens, though Dave Abrahams (and Crusty) might disagree with me. The number one consideration for choosing between a value type and a reference type is “do I want value semantics or reference semantics?” If I want to talk about a particular shape, talk about “that one”, I c

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Jens Alfke via swift-users
> On Aug 1, 2016, at 7:24 PM, Rick Mann wrote: > > But my model has implicit reference semantics: multiple instances of a part > can share a PartDefinition; it is intended that if the PartDefinition > changes, all the referencing instances get the change. Bingo. That’s the very definition of

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rick Mann via swift-users
> On Aug 1, 2016, at 19:18 , Jack Lawrence wrote: > > Jens: Why? There are significant benefits to value semantics for this type of > problem, for the reasons laid out in the WWDC videos. It would be helpful to > know why you disagree in this case—maybe there are solutions to the issues > you

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Jack Lawrence via swift-users
Jens: Why? There are significant benefits to value semantics for this type of problem, for the reasons laid out in the WWDC videos. It would be helpful to know why you disagree in this case—maybe there are solutions to the issues you’re thinking of. Rick: I’d think that value semantics would be

Re: [swift-users] Why can't structs inherit from other structs?

2016-08-01 Thread Dave Reed via swift-users
> On Aug 1, 2016, at 8:28 PM, Rick Mann via swift-users > wrote: > > It sure seems natural. > > Is there some reason the language can't allow a sub-struct to add member > variables, such that the whole is treated like a contiguous set of members? > > In my case, I have a rect-like value type

Re: [swift-users] Why can't structs inherit from other structs?

2016-08-01 Thread Jens Alfke via swift-users
I’m pretty sure one of the reasons is because inheritance implies method inheritance, which implies being able to override methods, and that opens a big can of worms which will be familiar to any experienced C++ programmers. Swift struct methods aren’t dynamically dispatched; they’re just functi

Re: [swift-users] Development Snapshots: Which Xcode?

2016-08-01 Thread Saagar Jha via swift-users
I checked in my /Library/Developer/Toolchains and found "swift-DEVELOPMENT-SNAPSHOT-2016-05-31-a.xctoolchain”. I’m not sure if it’s still available, though. Saagar Jha > On Aug 1, 2016, at 18:18, Robert Vaessen wrote: > > Thanks, Saagar. > > No need to look; I'll grab Xcode 8. > > ———

Re: [swift-users] Development Snapshots: Which Xcode?

2016-08-01 Thread Robert Vaessen via swift-users
Thanks, Saagar. No need to look; I'll grab Xcode 8.  ——— Robert Vaessen 704-996-1080 rob...@rvaessen.com On August 1, 2016 at 9:15:14 PM, Saagar Jha (saa...@saagarjha.com) wrote: It appears so, as further down the page it says: Swift 3.0 • macOS 10.11.5 (El Capitan) • Xcode 8.0 bet

Re: [swift-users] Development Snapshots: Which Xcode?

2016-08-01 Thread Saagar Jha via swift-users
It appears so, as further down the page it says: Swift 3.0 • macOS 10.11.5 (El Capitan) • Xcode 8.0 beta or later I remember there being a Swift 3 toolchain that worked with Xcode 7…let me see if I can find it. Saagar Jha > On Aug 1, 2016, at 18:12, Robert Vaessen via swift-u

[swift-users] Development Snapshots: Which Xcode?

2016-08-01 Thread Robert Vaessen via swift-users
Can swift 3 development snapshots (such as swift-DEVELOPMENT-SNAPSHOT-2016-07-29-a-osx.pkg) be installed and then selected as  toolchain in Xcode 7.3.1? Looking through the Download section of Swift.org gives me the impression that Xcode 8.0 Beta must be used. ——— Robert Vaessen 70

[swift-users] Why can't structs inherit from other structs?

2016-08-01 Thread Rick Mann via swift-users
It sure seems natural. Is there some reason the language can't allow a sub-struct to add member variables, such that the whole is treated like a contiguous set of members? In my case, I have a rect-like value type, but I'd rather it inherit from CGRect, rather than contain a CGRect. That makes

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rick Mann via swift-users
> On Aug 1, 2016, at 16:32 , Jens Alfke wrote: > > >> On Aug 1, 2016, at 1:19 AM, Rick Mann via swift-users >> wrote: >> >> It seems like reference semantics are more appropriate here. > > Yes, they are. (Just because structs exist doesn’t mean you have to use them > everywhere.) Of cours

Re: [swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Jon Shier via swift-users
Is it? I can’t tell by either the generated interface (default is not a useful value to expose) or a brief read of the Queue.swift file for it. Jon > On Aug 1, 2016, at 6:52 PM, Brent Royal-Gordon wrote: > >> On Aug 1, 2016, at 3:15 PM, Jon Shier via swift-users >> wrote: >> >> Swifters:

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Jens Alfke via swift-users
> On Aug 1, 2016, at 1:19 AM, Rick Mann via swift-users > wrote: > > It seems like reference semantics are more appropriate here. Yes, they are. (Just because structs exist doesn’t mean you have to use them everywhere.) —Jens___ swift-users mailing

Re: [swift-users] Draft guide for id-as-Any migration and known issues

2016-08-01 Thread Joe Groff via swift-users
I've also posted the document as a gist, to gather updates as I collect them: https://gist.github.com/jckarter/5ffa9ba75050b94cd2cf9092b332a866 -Joe > On Aug 1, 2016, at 11:46 AM, Joe Groff via swift-users > wrote: > > Hi everyone. SE-0116 should be landing in snapshots soon, which changes ho

Re: [swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Brent Royal-Gordon via swift-users
> On Aug 1, 2016, at 3:15 PM, Jon Shier via swift-users > wrote: > > Swifters: > It seems that in Xcode 8 beta 4, DispatchQueueAttributes was refactored > to be DispatchQueue.Attributes but in the process lost the .serial attribute. > How are we to create serial queues now? On a related

[swift-users] Serial DispatchQueue and documentation?

2016-08-01 Thread Jon Shier via swift-users
Swifters: It seems that in Xcode 8 beta 4, DispatchQueueAttributes was refactored to be DispatchQueue.Attributes but in the process lost the .serial attribute. How are we to create serial queues now? On a related note, where can we find the latest documentation for the Dispatch overlay?

Re: [swift-users] AttributedString gone in Xcode 8 beta 4?

2016-08-01 Thread Dave Reed via swift-users
Ah, I thought there was already a value type AttributedString that I was now using. Thanks, Dave Reed > On Aug 1, 2016, at 5:35 PM, Shawn Erickson wrote: > > I believe the removal of NS from some foundation types was reversed after > feedback and further consideration. > > https://github.com/

Re: [swift-users] AttributedString gone in Xcode 8 beta 4?

2016-08-01 Thread Shawn Erickson via swift-users
I believe the removal of NS from some foundation types was reversed after feedback and further consideration. https://github.com/apple/swift-evolution/blob/master/proposals/0086-drop-foundation-ns.md && https://github.com/apple/swift-evolution/commit/bea5eab614b954775754639fb83a957a180152e1#diff-e

[swift-users] AttributedString gone in Xcode 8 beta 4?

2016-08-01 Thread Dave Reed via swift-users
I was updating my project from beta 3 to beta 4 today and it seems AttributedString disappeared. Changing it to NSAttributedString fixed it. I don't see anything in the Release Notes about AttributedString. Is it gone permanently? Or am I doing something wrong? Thanks, Dave Reed _

[swift-users] More questions about protocol/value programming

2016-08-01 Thread Rick Mann via swift-users
In my schematic capture app, I had a class hierarchy that started with Element. From that I derived PartDefinition and PartInstance. Element has an immutable UUID, name, and description. Element knows how to encode itself as XML by conforming to an XMLCoding protocol. Now I'm trying to make Ele

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Ingo Maier via swift-users
Yes, parenthesized expressions are primary expressions, which in turn are all postfix expressions as specified by the first grammar rule for postfix expressions and also the note you mentioned. I do think that swiftc's behavior is the most intuitive. I just think the spec needs to be clarified in t

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Stephen Schaub via swift-users
Ingo, Thanks for pointing me to the specification. The example given in that section is helpful. You make a good point about what constitutes "the outermost expression." Parenthesized expressions, according to the spec, are primary expressions, not postfix expressions, but the spec also states th

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Ingo Maier via swift-users
If you are looking for the actual rules, they are defined in the language reference, in the section on optional chaining expressions [1]. It states that if you have an optional chaining expression of the form `expression?` then "If the value of the optional-chaining expression is nil, all of the o

[swift-users] Draft guide for id-as-Any migration and known issues

2016-08-01 Thread Joe Groff via swift-users
Hi everyone. SE-0116 should be landing in snapshots soon, which changes how Objective-C APIs import into Swift. Instead of relying on special implicit conversions to AnyObject, we now import the ObjC APIs using `Any` to get the same effect without special language rules. I've written up a draft

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Stephen Schaub via swift-users
Got it, I think! I didn't understand that the chaining of intermediate properties worked that way. Thanks very much for the explanation. Stephen On Mon, Aug 1, 2016 at 2:25 PM, Saagar Jha wrote: > When you write `(s?.characters).count`, the parentheses are evaluated > first; `(s?.characters)`

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Saagar Jha via swift-users
When you write `(s?.characters).count`, the parentheses are evaluated first; `(s?.characters)` gives an `String.CharacterView?`. Accessing the `String.CharacterView?`’s `count` property requires a `?`: `(s?.characters)?.count`. `s?.characters.count`, on the other hand, is applying chaining, whi

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Stephen Schaub via swift-users
I understand that the String.characters property is not optional. However, I am puzzled as to why s?.characters.count is legal, but (s?.characters).count is not. This seems counterintuitive. Can someone explain the logic or rules being used here? Stephen On Mon, Aug 1, 2016 at 2:09 PM, Saa

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Saagar Jha via swift-users
Saagar Jha This isn’t quite how optional chaining in Swift works; see the Swift Programming Guide , specifically “Linking Multiple Levels of Chaining". Basically, `s?.chara

Re: [swift-users] Optional chaining and String properties

2016-08-01 Thread Rimantas Liubertas via swift-users
> > var s: String? = "Foo" > print(s?.characters) > > The result indicates that s?.characters is indeed an Optional instance, > indicating that s?.characters.count should be illegal. > > Why is s?.characters.count a legal expression? See print(s?.characters.count) — you get the optional des

[swift-users] Optional chaining and String properties

2016-08-01 Thread Stephen Schaub via swift-users
With optional chaining, if I have a Swift variable var s: String? s might contain nil, or a String wrapped in an Optional. So, I tried this to get its length: let count = s?.characters?.count ?? 0 However, the compiler wants this: let count = s?.characters.count ?? 0 or this:

Re: [swift-users] Toolchain 07/29

2016-08-01 Thread Charles Lane via swift-users
The 7/25 snapshot worked fine for me. The 7/29 snapshot only worked if you marked the func as @nonobjc. > 7/25 does not work for me. -- E > > > On Aug 1, 2016, at 10:51 AM, Charles Lanewrote: > > > > The 7/25 snapshot seems to work. That was before AnyObject was changed to > > Any. > > > > Re

Re: [swift-users] Toolchain 07/29

2016-08-01 Thread Erica Sadun via swift-users
7/25 does not work for me. -- E > On Aug 1, 2016, at 10:51 AM, Charles Lane wrote: > > The 7/25 snapshot seems to work. That was before AnyObject was changed to Any. > > Regards, > Charles Lane > > >> On Aug 1, 2016, at 11:17 AM, Erica Sadun wrote: >> >> What is the most recent snapshot tha

Re: [swift-users] Toolchain 07/29

2016-08-01 Thread Charles Lane via swift-users
The 7/25 snapshot seems to work. That was before AnyObject was changed to Any. Regards, Charles Lane > On Aug 1, 2016, at 11:17 AM, Erica Sadun wrote: > > What is the most recent snapshot that will actually work and compile code? > 7/29 and 7/28 both fail for me. > > Thanks! > > -- Erica >

Re: [swift-users] C compatible structs

2016-08-01 Thread Dmitri Gribenko via swift-users
On Mon, Aug 1, 2016 at 4:20 AM, KS Sreeram via swift-users wrote: > Hello > > Is it possible to declare Swift structs that have C compatible memory > layout? The only supported way to do this is to declare your structs in a C header that you import in Swift as a module, and #include in your C lib

Re: [swift-users] [swift-evolution] Multi dimensional - iterator, Iterator2D, Iterator3D

2016-08-01 Thread Saagar Jha via swift-users
With your method, don't you need to write a new method for every dimension? On Mon, Aug 1, 2016 at 08:43 Ted F.A. van Gaalen via swift-users < swift-users@swift.org> wrote: > Hi Erica > > That would also be a workable solution, but imho still too tedious as > it has been so for many years, with ne

Re: [swift-users] My Email

2016-08-01 Thread Dvir Julius - Play Actual via swift-users
Of course. Feel free to delete the messages. Sincerely, Dvir Julius On 1 August 2016 at 16:25:45, Saagar Jha (saagarjh...@gmail.com) wrote: I'm sorry; it looks like I jumped to conclusions too quickly :) Either way, is there a way to delete messages? On Mon, Aug 1, 2016 at 06:18 Dvir Julius -

Re: [swift-users] My Email

2016-08-01 Thread Dvir Julius - Play Actual via swift-users
Hello Sirs, The email was sent by mistake. I am not a spammer :-) This email domain belongs to a company of mine, and as I said, it was mistakenly sent to you sirs. Sincerely, Dvir Julius On 1 August 2016 at 16:12:10, Saagar Jha (saagarjh...@gmail.com) wrote: It's most likely just spam…just

Re: [swift-users] [swift-evolution] Multi dimensional - iterator, Iterator2D, Iterator3D

2016-08-01 Thread Ted F.A. van Gaalen via swift-users
Hi Erica That would also be a workable solution, but imho still too tedious as it has been so for many years, with nested iteration statements… many times this is for;; for;; for tables and for;;for;;for;; for 3D structuring. Swift offers nice features (like protocols and generics as you kno

Re: [swift-users] Toolchain 07/29

2016-08-01 Thread Erica Sadun via swift-users
What is the most recent snapshot that will actually work and compile code? 7/29 and 7/28 both fail for me. Thanks! -- Erica > On Jul 31, 2016, at 4:19 PM, Charles Lane via swift-users > wrote: > > Bug report SR-2234 has been filed. > > Thanks > > >> On Jul 31, 2016, at 4:38 PM, Mark Lace

Re: [swift-users] C compatible structs

2016-08-01 Thread KS Sreeram via swift-users
> On 01-Aug-2016, at 5:17 PM, Chris McIntyre > wrote: > > Swift's strideOf my give you what you want (I'm not at my Mac to test) It doesn’t. Swift uses a different layout than C. In the earlier example code, strideof(Bar) is 8 in Swift, whereas sizeof(Bar) is 12 in C. Best KS Sreeram _

Re: [swift-users] My Email

2016-08-01 Thread Saagar Jha via swift-users
I'm sorry; it looks like I jumped to conclusions too quickly :) Either way, is there a way to delete messages? On Mon, Aug 1, 2016 at 06:18 Dvir Julius - Play Actual wrote: > Hello Sirs, > > The email was sent by mistake. > I am not a spammer :-) > > This email domain belongs to a company of mine

Re: [swift-users] My Email

2016-08-01 Thread Saagar Jha via swift-users
It's most likely just spam…just leave it alone. Replying will make it more likely that he'll respond. On Mon, Aug 1, 2016 at 04:35 James Campbell via swift-users < swift-users@swift.org> wrote: > :) Did you mean to do this ? > > *___* > > *James⎥Head of Trolls* > >

Re: [swift-users] [Docs] - Documentation for the standard library

2016-08-01 Thread Zhao Xin via swift-users
https://developer.apple.com/reference/swift Xcode 8 beta 3 also has build-in help docs for swift 3. Zhaoxin On Mon, Aug 1, 2016 at 8:20 PM, Adrian Brink wrote: > Isn't the documentation described here >

Re: [swift-users] [Docs] - Documentation for the standard library

2016-08-01 Thread Adrian Brink via swift-users
Isn't the documentation described [here](https://link.nylas.com/link/cpvvu89b6khaohz5hhf2xh3dw/local-30f79cfa- 350d/0?redirect=https%3A%2F%2Fswift.org%2Fdocumentation%2F%23the-swift- programming-language&r=c3dpZnQtdXNlcnNAc3dpZnQub3Jn) only about swift itself and not about the standard library?

Re: [swift-users] [Docs] - Documentation for the standard library

2016-08-01 Thread zh ao via swift-users
go to swift.org Zhaoxin Get Outlook for iOS On Mon, Aug 1, 2016 at 7:16 PM +0800, "Adrian Brink via swift-users" wrote: Hi, on the github repo for swift (https://github.com/apple/swift) it says that many of the docs are out-of-date. Is there a community effort to fix that, because

Re: [swift-users] My Email

2016-08-01 Thread James Campbell via swift-users
:) Did you mean to do this ? *___* *James⎥Head of Trolls* *ja...@supmenow.com ⎥supmenow.com * *Sup* *Runway East * *10 Finsbury Square* *London* * EC2A 1AF * On 27 July 2016 at 14:05, Dvir Julius - Play Actual via swift-users < swift-use

[swift-users] C compatible structs

2016-08-01 Thread KS Sreeram via swift-users
Hello Is it possible to declare Swift structs that have C compatible memory layout? In the code below, Foo and Bar have different sizes in Swift and C. Is it possible to make the Swift structs have the same layout as their C counterparts? // Swift struct Foo { var x: Int32; var a: Int

[swift-users] [Docs] - Documentation for the standard library

2016-08-01 Thread Adrian Brink via swift-users
Hi, on the github repo for swift (https://github.com/apple/swift) it says that many of the docs are out-of-date. Is there a community effort to fix that, because if there is I would like to contribute. Sent from [Nylas N1](https://link.nylas.com/link/cpvvu89b6khaohz5hhf2xh3dw /local-7

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rick Mann via swift-users
> On Aug 1, 2016, at 02:25 , Rimantas Liubertas wrote: > > > I did. That's one of the two talks I mentioned. > > Well, so they did cover this, didn't they? You move item, you get the new > struct with the new position. And if you save the old one, you have a cheap > way to implement undo. T

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rick Mann via swift-users
> On Aug 1, 2016, at 02:14 , Rimantas Liubertas wrote: > > > Similarly, in the diagramming example from the WWDC videos, how would that > app handle the user editing existing Drawables in the Diagram? Let's say you > allow the user to click on a Drawable and drag it to another location in the

Re: [swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rimantas Liubertas via swift-users
> Similarly, in the diagramming example from the WWDC videos, how would that > app handle the user editing existing Drawables in the Diagram? Let's say > you allow the user to click on a Drawable and drag it to another location > in the canvas. Is this reasonable: > See this talk too: https://deve

[swift-users] Are value semantics really appropriate in a diagramming app?

2016-08-01 Thread Rick Mann via swift-users
I watched the WWDC 2015 video about protocol-oriented programming and value semantics. Both of them use the example of a diagramming app, where the user can make a diagram of circles and polygons. They make a protocol for Drawable (makes sense), and then make Circle and Polygon structs. I'm wor

Re: [swift-users] Memory layout of enums

2016-08-01 Thread Martin R via swift-users
I think that is treated in https://github.com/apple/swift/blob/master/docs/ABI.rst, in the sections "Single-Payload Enums" and "Multi-Payload Enums". Martin > On 01 Aug 2016, at 08:36, KS Sreeram via swift-users > wrote: > > Hi > > Is there any place I can read about the memory layout of en