Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 11:42, Quincey Morris > wrote: > > On Sep 6, 2016, at 21:31 , Gerriet M. Denkmann wrote: >> >> My Swift book (2.2) has no mention of “private” (Swift 3 beta has). > > It’s in the 2.2 book under “Language Guide” section “Access Control” You are right. I used Books.app on

Re: Init in Swift

2016-09-06 Thread Marco S Hyman
> > My Swift book (2.2) has no mention of “private” (Swift 3 beta has). > But even assuming I had Swift 3, I do not quite understand how this should be > done (I may be a bit dense). Page 508 in the Swift 2.2 book I just downloaded from iBooks. “Getters and Setters Getters and setters for const

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 21:31 , Gerriet M. Denkmann wrote: > > My Swift book (2.2) has no mention of “private” (Swift 3 beta has). It’s in the 2.2 book under “Language Guide” section “Access Control" > But even assuming I had Swift 3, I do not quite understand how this should be > done (I may be a

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 11:28, Quincey Morris > wrote: > > On Sep 6, 2016, at 21:14 , Gerriet M. Denkmann wrote: >> >> But I cannot get this to work. > > Meaning … ?? A compiler error? What does the source code look like, of the > protocol with the class func in it? What is the error message?

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 10:49, Quincey Morris > wrote: > > On Sep 6, 2016, at 17:17 , Gerriet M. Denkmann wrote: >> >> But what to do about localConstantDependingOnSuper? […] > Anyway, this particular example is fairly easily solved by declaring > “localConstantDependingOnSuper” as ‘private(set)

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 21:14 , Gerriet M. Denkmann wrote: > > But I cannot get this to work. Meaning … ?? A compiler error? What does the source code look like, of the protocol with the class func in it? What is the error message? > NewSuper uses this classFunction like: > func otherFunction( arg:

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 10:49, Quincey Morris > wrote: > >> Another problem: >> Super → SubA and SubB. >> SubA → SubA1 and SubA2 >> SubB → SubB1 and SubB2 >> >> Both SubA1 and SubB1 have identical functions. As have SubA2 and SubB2. >> Multiple inheritance would be a solution here; but neither Ob

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 17:17 , Gerriet M. Denkmann wrote: > > But what to do about localConstantDependingOnSuper? Now you’re moving the goal posts. :) I said: > assuming the places of definition aren’t more complicated than in your code and you’re making it more complicated. Anyway, this particula

Re: Init in Swift

2016-09-06 Thread Greg Parker
> On Sep 6, 2016, at 5:17 PM, Gerriet M. Denkmann wrote: > >> On 5 Sep 2016, at 13:29, Quincey Morris >> wrote: >> >> More globally, this sort of thing is not terribly idiomatic for Swift, >> because you’re trying to hide things that could get exposed other ways, for >> example, by “hostile

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 5 Sep 2016, at 13:29, Quincey Morris > wrote: > > On Sep 4, 2016, at 22:50 , Gerriet M. Denkmann wrote: > > If you can’t do that, you can do it with a closure, assuming the places of > definition aren’t more complicated than in your code. Something like this: > >> class SuperClass >> {

Re: Init in Swift

2016-09-04 Thread Quincey Morris
On Sep 4, 2016, at 22:50 , Gerriet M. Denkmann wrote: > > I really want “onlyKnownBySubclass” to be a constant (i.e. let instead of var) There’s an easy way if you can declare both classes in the same file. Then, you can just declare the instance variable like this: > private(set) var on