Re: [swift-users] Incorrect Fisher-Yates shuffle in example code

2017-12-17 Thread Dave Abrahams via swift-users
> On Dec 16, 2017, at 4:34 PM, Nevin Brackett-Rozinsky via swift-users > wrote: > > public extension MutableCollection where Self: RandomAccessCollection, > IndexDistance == Int { > IndexDistance == Int is an over-constraint, FWIW. Adding it is generally a mistake. Not a serious one, but

Re: [swift-users] Compiler fLag to activate SE-0143 (conditional conformance)?

2017-12-14 Thread Dave Abrahams via swift-users
> On Dec 14, 2017, at 1:08 PM, Slava Pestov via swift-users > wrote: > > > >> On Dec 14, 2017, at 10:56 AM, torquato via swift-users >> wrote: >> >> >> SE-0143 has been accepted, but is not activated by default in the last >> builds. As per Snapshot 2017-12-06 I get the Error message: "

Re: [swift-users] Exceptional values in the Comparable protocol

2017-07-11 Thread Dave Abrahams via swift-users
on Tue Jul 11 2017, Martin R wrote: > Thank you for the clarification! Sure, happy to help! -- -Dave ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] Exceptional values in the Comparable protocol

2017-07-10 Thread Dave Abrahams via swift-users
on Sun Jul 09 2017, Martin R wrote: > The Comparable protocol requires that < and == impose a strict total > order: exactly one of a==b, ab must hold for all values a and b > of a conforming type. > > But it is also noted that a conforming type may contain a subset of > „exceptional values“ whic

Re: [swift-users] Design guidelines for computed property vs no-arg method

2017-07-06 Thread Dave Abrahams via swift-users
on Wed Jul 05 2017, Jens Persson wrote: > On Wed, Jul 5, 2017 at 11:50 PM, Dave Abrahams via swift-users < > swift-users@swift.org> wrote: > >> … >> As a name, signum falls into the “term-of-art” category, so at least >> that part is in conformance to the

Re: [swift-users] Design guidelines for computed property vs no-arg method

2017-07-05 Thread Dave Abrahams via swift-users
on Wed Jul 05 2017, Jens Persson wrote: > Why is eg the BinaryInteger.signum() a method and not a computed property? > > public protocol BinaryInteger … { > /// Returns `-1` if this value is negative and `1` if it's positive; > /// otherwise, `0`. > /// > /// - Returns: The sign

Re: [swift-users] Associatedtype Naming Conventions

2017-06-06 Thread Dave Abrahams via swift-users
on Tue Jun 06 2017, Karl Wagner wrote: >> On 7. Jun 2017, at 00:25, Dave Abrahams via swift-users >> wrote: >> >> >> on Wed May 31 2017, Steven Brunwasser <http://swift-users-at-swift.org/>> wrote: >> > >>> Yes, I understand this.

Re: [swift-users] Associatedtype Naming Conventions

2017-06-06 Thread Dave Abrahams via swift-users
on Wed May 31 2017, Steven Brunwasser wrote: > Yes, I understand this. I was just wondering if there was a naming > convention I should use to differentiate them. I would try to find something more specific and descriptive than “Container” and “Element” if you think there's a chance they would

Re: [swift-users] Help! Slicing an array is very expensive

2017-05-17 Thread Dave Abrahams via swift-users
on Wed May 10 2017, Rick Mann wrote: >> On May 10, 2017, at 11:52 , Joe Groff wrote: >> >> >>> On May 8, 2017, at 4:47 PM, Rick Mann via swift-users >>> wrote: >>> > >>> I have this C library that interacts with some hardware over the >>> network that produces a ton of data. It tells me up

Re: [swift-users] Help! Slicing an array is very expensive

2017-05-17 Thread Dave Abrahams via swift-users
on Mon May 08 2017, Rick Mann wrote: > I have this C library that interacts with some hardware over the > network that produces a ton of data. It tells me up front the maximum > size the data might be so I can allocate a buffer for it, then does a > bunch of network requests downloading that dat

Re: [swift-users] withoutActuallyEscaping example question

2017-03-27 Thread Dave Abrahams via swift-users
on Mon Mar 27 2017, Jordan Rose wrote: >> On Mar 26, 2017, at 01:14, Slava Pestov via swift-users >> wrote: >> >> Hi Ray, >> >> There are two overloads of filter() available on ‘array.lazy’; the > >> version that takes an escaping closure and returns a >> LazyFilterCollection, and the versio

Re: [swift-users] Is this really a race condition?

2017-03-01 Thread Dave Abrahams via swift-users
on Wed Mar 01 2017, Edward Connell wrote: > The thread sanitizer on Linux is reporting that I have race conditions in > libswiftcore. The only one we currently know about that's actually in libswiftcore is the one addressed by https://github.com/apple/swift/pull/7183 > I eliminated enough cod

Re: [swift-users] Collection Oddities

2017-02-09 Thread Dave Abrahams via swift-users
on Tue Feb 07 2017, Guillaume Lessard wrote: >> On 7 févr. 2017, at 21:57, Slava Pestov wrote: >> >>> >>> On Feb 7, 2017, at 8:14 PM, Guillaume Lessard via swift-users >>> wrote: >>> > >>> I keep running into weird things with Swift 3 Collections. >>> >>> A) Collection has its count prope

Re: [swift-users] unsafeBitCast to Unimplemented Class

2017-02-07 Thread Dave Abrahams via swift-users
on Mon Feb 06 2017, Andrew Trick wrote: >> On Feb 6, 2017, at 8:51 PM, Dave Abrahams wrote: >> >> >> on Mon Feb 06 2017, Andrew Trick wrote: >> > >>> Is a missing declaration a use case that needs to be supported? >> >> I couldn't say. >> >>> Wouldn’t it be more proper to use selector bas

Re: [swift-users] unsafeBitCast to Unimplemented Class

2017-02-06 Thread Dave Abrahams via swift-users
on Mon Feb 06 2017, Andrew Trick wrote: > Is a missing declaration a use case that needs to be supported? I couldn't say. > Wouldn’t it be more proper to use selector based dispatch in those > cases? Example, please? I don't know what that means, though I probably should. -- -Dave

Re: [swift-users] unsafeBitCast to Unimplemented Class

2017-02-05 Thread Dave Abrahams via swift-users
gs just work. > Is there a way to compare the type of self, other than using `is` > (which has the same issue as unsafeBitCast in that I don’t have the > declaration for it)? I think you might be able to use something like class_getName(type(of: x)) > > Saagar Jha > >

Re: [swift-users] unsafeBitCast to Unimplemented Class

2017-02-04 Thread Dave Abrahams via swift-users
on Fri Feb 03 2017, Saagar Jha wrote: > Hello, > > I’m having an issue migrating some old Objective-C code that looks like this: > > @implementation Foo > > - (void)load { > // Swizzle one of Bar’s methods to call Foo’s baz method > } > > - (void)baz { > [self baz]; > if ([self

Re: [swift-users] Weird protocol behaviour.

2016-12-22 Thread Dave Abrahams via swift-users
on Thu Dec 22 2016, Mikhail Seriukov wrote: > Hello community! I' wondering if somebody can explain this to me. > Please take look at the snippet. > > protocol P {} > struct X:P {} > > func foo(_ x:A) {} > > func bar() { > //let x = X() // this compiles > let x = X() as P // this does no

Re: [swift-users] Dimensional analysis

2016-12-01 Thread Dave Abrahams via swift-users
on Mon Nov 28 2016, Rick Mann wrote: > My earlier post about converting Decimal to Double was part of a > larger effort by me to write a calculator app that supports > dimensional analysis/unit conversions. I've explored some existing > libraries on the topic, ranging from this one in Common Lis

Re: [swift-users] Implementing signum

2016-11-28 Thread Dave Abrahams via swift-users
on Sun Nov 20 2016, Hooman Mehr wrote: > Let me explain this a bit further: > > Swift generic programming is very different from C++ template programming. > Swift compiler needs to > type-check generic code on spot, not while instantiating the template > (because in Swift, > instantiation can

Re: [swift-users] Implementing signum

2016-11-28 Thread Dave Abrahams via swift-users
on Sun Nov 20 2016, Hooman Mehr wrote: > Let me explain this a bit further: > > Swift generic programming is very different from C++ template > programming. Swift compiler needs to type-check generic code on spot, > not while instantiating the template (because in Swift, instantiation > can occu

Re: [swift-users] Thinking in Swift: Click handling

2016-11-10 Thread Dave Abrahams via swift-users
on Thu Nov 10 2016, Rick Mann wrote: > Anyway, I'm just curious about the best way to implement this *in Swift* (as > opposed to say, C++). As someone who's used both languages extensively, there's nothing in about this problem that suggests I'd approach it particularly differently in the two

Re: [swift-users] Int32.divideWithOverflow

2016-11-09 Thread Dave Abrahams via swift-users
on Wed Nov 09 2016, Peter W A Wood wrote: > I am using Swift to generate some tests with overflowing 32-bit > integers. I have used the Int32.WithOverflow functions but have > come across a problem dividing Int32.min by -1 with overflow. I get an > overflow error: > > error: division '-21474

Re: [swift-users] [swift-dev] Initializing constant object graph with cycles

2016-11-07 Thread Dave Abrahams via swift-users
on Fri Nov 04 2016, Anton Mironov wrote: > This workaround looks better, but it is still workaround. > I can trust myself this month and month after that. But I will look at > this code after a while (or someone else will look at it) and will not > remember/know that there has to be some initial

Re: [swift-users] The value of enums

2016-11-06 Thread Dave Abrahams via swift-users
on Sun Nov 06 2016, Nevin Brackett-Rozinsky wrote: > …oh, I just realized we’re on -users not -evolution here. Perhaps I’ll > bring this up next time switch expressions are proposed. Thanks ;-) -- -Dave ___ swift-users mailing list swift-users@swif

Re: [swift-users] The value of enums

2016-11-06 Thread Dave Abrahams via swift-users
on Sun Nov 06 2016, Tino Heth wrote: > Enums are a fundamental part of Swift, so I guess they won't change > much — but I wonder if anyone shares my observations in real-life use… > > Afair, there are three different types of enums: > - Enums with raw values > - enums with associated objects > -

Re: [swift-users] What is "binding" memory?

2016-11-03 Thread Dave Abrahams via swift-users
on Wed Nov 02 2016, Andrew Trick wrote: >> On Nov 2, 2016, at 3:50 PM, Dave Abrahams wrote: >> >>> The original poster seemed to have the impression that the operation >>> of binding memory itself might affect program state, >> >> Formally speaking, it does! > > Oh boy. I keep failing at thi

Re: [swift-users] What is "binding" memory?

2016-11-02 Thread Dave Abrahams via swift-users
on Wed Nov 02 2016, Andrew Trick wrote: >> On Nov 2, 2016, at 12:58 PM, Dave Abrahams via swift-users >> wrote: >> >>> At the top of the migration guide is a link to the memory model explanation: >>> > https://github.com/apple/swift-evolution/blob/ma

Re: [swift-users] Localization in Swift.

2016-11-02 Thread Dave Abrahams via swift-users
on Wed Nov 02 2016, Jens Alfke wrote: >> On Nov 2, 2016, at 12:50 PM, Dave Abrahams via swift-users >> wrote: >> >> In my opinion, we can and must do much better for Swift. If there's >> something about “%” formatting that you particularly value, I'd

Re: [swift-users] What is "binding" memory?

2016-11-02 Thread Dave Abrahams via swift-users
on Tue Nov 01 2016, Andrew Trick wrote: >> On Nov 1, 2016, at 11:55 AM, Manfred Schubert via swift-users >> wrote: >> >> The "UnsafeRawPointer Migration" guide talks about "binding memory >> to a type“ as if that was a well known term. I have never heard of >> it yet though, and googling it r

Re: [swift-users] Localization in Swift.

2016-11-02 Thread Dave Abrahams via swift-users
on Tue Nov 01 2016, Jens Alfke wrote: >> On Nov 1, 2016, at 10:40 PM, Zhao Xin wrote: >> >> For example, if I want show the user that I have to ask him to give me >> permission of a folder, the > `url.path` has no need to translate. > > We’re getting off-topic, but paths do need to be transla

Re: [swift-users] dispatch concurrent map: is this right?

2016-10-31 Thread Dave Abrahams via swift-users
on Mon Oct 31 2016, Karl wrote: >> On 31 Oct 2016, at 05:15, Dave Abrahams wrote: >> >> >> on Sun Oct 30 2016, Karl > <http://razielim-at-gmail.com/>> wrote: >> > >>>> On 30 Oct 2016, at 19:23, Dave Abrahams via swift-users >

Re: [swift-users] Element vs. Iterator.Element

2016-10-31 Thread Dave Abrahams via swift-users
on Mon Oct 31 2016, Toni Suter wrote: > Hi, > > This extension on Array works as expected: > > extension Array where Element: CustomStringConvertible { > func f(_ x: Element) -> String { > return x.description > } > } > > But when I use Iterator.Element instead, I get an error me

Re: [swift-users] dispatch concurrent map: is this right?

2016-10-30 Thread Dave Abrahams via swift-users
on Sun Oct 30 2016, Dave Abrahams wrote: >> I quite like the API as an extension on Range. I think it would be a >> nice addition to Dispatch (once we start allowing additive proposals): >> >> extension Range where Bound : Strideable, Bound.Stride : SignedInteger { >> >> func concurrentMap(_ t

Re: [swift-users] dispatch concurrent map: is this right?

2016-10-30 Thread Dave Abrahams via swift-users
on Sun Oct 30 2016, Karl wrote: >> On 30 Oct 2016, at 19:23, Dave Abrahams via swift-users >> wrote: >> >> >> on Sun Oct 30 2016, Karl wrote: >> > >>>> On 30 Oct 2016, at 09:15, Karl wrote: >>>> >>>> I had t

Re: [swift-users] dispatch concurrent map: is this right?

2016-10-30 Thread Dave Abrahams via swift-users
on Sun Oct 30 2016, Karl wrote: >> On 30 Oct 2016, at 09:15, Karl wrote: >> >> I had the need for a concurrent map recently. I had a part of a >> program which needed to read chunks of data and concurrently process >> them and assemble the results in an array. This isn’t necessarily as >> obvi

Re: [swift-users] [Swift3][Linux][URLSession]: Core dump when trying to make simple HTTP request

2016-10-28 Thread Dave Abrahams via swift-users
Pasting a reply on behalf of Matt Wright (cc'd): > On Oct 27, 2016, at 1:57 PM, Dave Abrahams wrote: > > > From: Steven Harms via swift-users > Subject: [Swift3][Linux][URLSession]: Core dump when trying to make simple > HTTP request .. > Date: October 27, 2016 at 5:01:58 AM PDT > To: sw

Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-28 Thread Dave Abrahams via swift-users
on Thu Oct 27 2016, Rick Mann wrote: >> On Oct 26, 2016, at 22:23 , Dave Abrahams via swift-users >> wrote: >> >> >> on Wed Oct 26 2016, Rick Mann wrote: >> > >>> It seems fairly natural to want to do this: >>> >>> let bi

Re: [swift-users] Why can I not filter or map a dictionary to another dictionary?

2016-10-26 Thread Dave Abrahams via swift-users
on Wed Oct 26 2016, Rick Mann wrote: > It seems fairly natural to want to do this: > > let bigDictionary = ... > let smallerDictionary = bigDictionary.filter { key, value in returning Bool> } > Similarly, it seems natural to want to map this way. It's reasonable for filter, but maybe not for

Re: [swift-users] Set-uniqueness of instances with distinct hashValue

2016-10-23 Thread Dave Abrahams via swift-users
on Sun Oct 23 2016, milos wrote: > Given an array of instances of a `Hashable` value type, all equal > according to `Equatable` protocol, but with distinct `hashValue`s, Equal hashables must have the same hashValue. If you violate this rule, all bets are off. As the doc says: A hash value

Re: [swift-users] Subsequences and shared indices

2016-10-16 Thread Dave Abrahams via swift-users
on Thu Oct 13 2016, Tim Vermeulen wrote: > Is it a requirement that collections share indices with its > subsequence? Yes. > Array and ArraySlice do share indices, which is why ArraySlice isn’t > zero-based, and I think this is convenient. But String.CharacterView > doesn’t seem to share indi

Re: [swift-users] How to be DRY on ranges and closed ranges?

2016-10-16 Thread Dave Abrahams via swift-users
on Wed Oct 12 2016, Hooman Mehr wrote: >> On Oct 12, 2016, at 3:21 AM, Jean-Denis Muys via swift-users >> wrote: >> >> >> But this is not very DRY. >> >> What would be a more idiomatic way? >> > > The more idiomatic way is to look at API design in a new way. Note these > points: > > 1. `C

Re: [swift-users] How to be DRY on ranges and closed ranges?

2016-10-16 Thread Dave Abrahams via swift-users
on Wed Oct 12 2016, Jean-Denis Muys wrote: > Hi, > > I defined this: > > func random(from r: Range) -> Int { > let from = r.lowerBound > let to = r.upperBound > > let rnd = arc4random_uniform(UInt32(to-from)) > return from + Int(rnd) > } > > so that I can do: > > let testRandomV

Re: [swift-users] A sample Rational number type

2016-10-03 Thread Dave Abrahams via swift-users
on Sun Oct 02 2016, Hooman Mehr wrote: >> On Oct 2, 2016, at 5:23 PM, Dave Abrahams via swift-users >> wrote: >> Presumably you mean: >> >> let r2 = r±0.0005 // turn a Rational into a Double with no more than >>// .0005 round

Re: [swift-users] UnsafeMutablePointer on the stack?

2016-10-02 Thread Dave Abrahams via swift-users
on Sun Oct 02 2016, Mike Ferenduros wrote: > You can use a local like this: > var x: UInt32 = 0 > withUnsafePointer(to: x) { randomWordPT in > //your existing code here > } > > Or I'm not sure if small arrays go on the heap, but They do. > var bytes: [UInt8] = [0,0,0,0]

Re: [swift-users] A sample Rational number type

2016-10-02 Thread Dave Abrahams via swift-users
on Fri Sep 30 2016, Hooman Mehr wrote: > For anybody who is interested: This gist > > contains a Rational number implementation for Swift 3.0. It is a > single file that you can paste in a playground and take a look, or > remove t

Re: [swift-users] UnsafeMutablePointer on the stack?

2016-10-02 Thread Dave Abrahams via swift-users
on Sun Oct 02 2016, Jean-Denis Muys wrote: > Hi, > > I have some issues using the new raw memory API. For instance, let's > suppose I want to call the `SecRandomCopyBytes` API to generate a > cryptographically secure random 32-bit number. The difficulty is its 3rd > argument, which is declared a

Re: [swift-users] CharacterSet vs Set

2016-10-02 Thread Dave Abrahams via swift-users
on Sun Oct 02 2016, Jean-Denis Muys wrote: > I was playing with CharacterSet, and I came up with: > > let vowels = CharacterSet(charactersIn: "AEIOU") Yeah, because CharacterSet is a set of UnicodeScalars, not a set of Character. That should probably get fixed somehow. I suggest filing a rada

Re: [swift-users] Problem with COW optimization

2016-09-18 Thread Dave Abrahams via swift-users
on Sun Sep 18 2016, Adrian Zubarev wrote: > Dear Swift community, > > currently I’m building a value type XML library which is baked behind > the scene with a reference type to manage graph traversing between > nodes. I also like to COW optimize the xml graph, but I run into one > single problem

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-09-18 Thread Dave Abrahams via swift-users
on Tue Jun 28 2016, Jordan Rose wrote: >> On Jun 27, 2016, at 18:52, Tim Vermeulen wrote: >> >> Thanks for your reply. It didn’t clear up everything, though. The >> official documentation says "Weak references do not affect the >> result of this function.”, which suggests that weak (and unowne

Re: [swift-users] Chaining struct-mutating funcs

2016-08-10 Thread Dave Abrahams via swift-users
on Tue Aug 09 2016, Fritz Anderson wrote: > I’m sending directly to those who took time over my question, because, per > Michael’s request, I have a > minimal case to attach. Phrases in boldface are for skimmability, not > shouting. > > Strip out my use case (I’m encouraged that Dave recapitu

Re: [swift-users] Extending a generic type where T == Void

2016-08-09 Thread Dave Abrahams via swift-users
on Tue Aug 09 2016, Benedict Cohen wrote: > I have an enum that represents the states of a task: > > enum TaskState{ > case preparing > case ready(InType) > case executing(InType, TaskIdentifier) > case success(InType, OutType) > case failure(InType, Error) > > mutating func transition(toReady:

Re: [swift-users] Set size of byte array

2016-08-08 Thread Dave Abrahams via swift-users
on Fri Aug 05 2016, KS Sreeram wrote: >> On 05-Aug-2016, at 1:19 PM, Daniel Vollmer wrote: >> >> I’m by no means a Swift expert (not even a user at the moment), but I don't >> see a way to do this either. The best that comes to mind is initializing a >> ContiguousArray with the sufficient capa

Re: [swift-users] Chaining struct-mutating funcs

2016-08-08 Thread Dave Abrahams via swift-users
on Fri Aug 05 2016, Joe Groff wrote: > Since your backing buffer is copy-on-write, you can do the in-place > mutation optimization in your immutable implementations, something > like this: > > class C { > var value: Int > init(value: Int) { self.value = value } > } > > struct S { var c: C }

Re: [swift-users] generic function called recursively not compiling

2016-08-07 Thread Dave Abrahams via swift-users
on Thu Aug 04 2016, Ray Fix wrote: > I filed rdar://27700622 and attached a playground. > Any workaround magic I can do here? > > func quickSort(_ input: [Element]) -> [Element] { > if input.count < 2 { > return input > } > let pivot = input.first! > let left = input.dro

Re: [swift-users] non-mutating func that still mutates a struct, compiler not aware

2016-08-06 Thread Dave Abrahams via swift-users
on Sat Aug 06 2016, Raphael Sebbe wrote: >> Those UnsafeMutablePointer(…) calls aren’t correct. When an array is >> implicitly converted to a pointer in Swift, the pointer is only valid for >> the *immediate* call that it’s being passed to. In this case, that’s the >> UnsafeMutablePointer initia

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

2016-08-02 Thread Dave Abrahams via swift-users
on Tue Aug 02 2016, Rick Mann wrote: >> On Aug 2, 2016, at 13:07 , Dave Abrahams via swift-users >> wrote: >> >> >> on Mon Aug 01 2016, Rick Mann wrote: >> > >>>> On Aug 1, 2016, at 19:18 , Jack Lawrence wrote: >>>> >&g

Re: [swift-users] They had parens upon thars

2016-08-02 Thread Dave Abrahams via swift-users
on Tue Aug 02 2016, Travis Griggs wrote: > Chapter 1: > > Coming from a Smalltalk background, I was enjoying added all kinds of > properties to basic number types, for example: > > extension Double { > var rounded:Double { > return round(self) > } > } > > Chapter 2: > > I upgrad

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

2016-08-02 Thread Dave Abrahams via swift-users
on Mon Aug 01 2016, Rick Mann wrote: >> 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—m

Re: [swift-users] Why does RangeReplaceableCollection require an empty initialiser?

2016-07-06 Thread Dave Abrahams via swift-users
on Wed Jul 06 2016, Austin Zheng wrote: > Would this require a swift-evolution review, since it's technically an API > change? (removing the initializer requirement is something I am also > interested in seeing...) Yes. -- Dave ___ swift-users maili

Re: [swift-users] Why does RangeReplaceableCollection require an empty initialiser?

2016-07-06 Thread Dave Abrahams via swift-users
on Wed Jul 06 2016, Tim Vermeulen wrote: > RangeReplaceableCollection has three initialisers: init(), init(_:) > and init(repeating:count:). The latter two are implemented using the > empty initialiser. But why are these initialisers part of this > particular protocol? As far as I can tell, no o

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-28 Thread Dave Abrahams via swift-users
on Tue Jun 28 2016, Andrew Trick wrote: >> On Jun 28, 2016, at 9:32 AM, Jordan Rose via swift-users >> wrote: >> >> >>> On Jun 27, 2016, at 18:52, Tim Vermeulen wrote: >>> > >>> Thanks for your reply. It didn’t clear up everything, though. The >>> official documentation says "Weak referenc

Re: [swift-users] Checking whether an object is uniquely referenced, using a weak reference to it

2016-06-28 Thread Dave Abrahams via swift-users
on Tue Jun 28 2016, Jordan Rose wrote: >> On Jun 27, 2016, at 18:52, Tim Vermeulen wrote: >> >> Thanks for your reply. It didn’t clear up everything, though. The >> official documentation says "Weak references do not affect the >> result of this function.”, which suggests that weak (and unowne

Re: [swift-users] Protocols, `mutating` and Value vs Reference Types.

2016-04-29 Thread Dave Abrahams via swift-users
> The gist is self contained if you want to compile it yourself. > > Is this some kind of bug or the expected behavior? Looks like a bug to me! > > > On Apr 29, 2016, at 5:28 PM, Dave Abrahams via swift-users > wrote: > > on Fri Apr 29 2016, Hooman Mehr wrot

Re: [swift-users] Protocols, `mutating` and Value vs Reference Types.

2016-04-29 Thread Dave Abrahams via swift-users
on Fri Apr 29 2016, Hooman Mehr wrote: > Hi, > > I am designing APIs that need to support both reference (class/object) and > value > types. I am running into restrictions of `mutating` keyword in my protocols > and > this is causing a lot of duplication of code. In order to understand what I

Re: [swift-users] Trying to learn swift 3 renamification (as mattn calls it!)

2016-04-22 Thread Dave Abrahams via swift-users
on Thu Apr 21 2016, Erica Sadun wrote: > On Apr 21, 2016, at 2:23 PM, Ryan Lovelett > wrote: > > On Thu, Apr 21, 2016, at 04:13 PM, Erica Sadun wrote: > > On Apr 21, 2016, at 2:05 PM, Ryan Lovelett > wrote: > > On Thu, Apr 21, 2016, at 03:50 PM,

Re: [swift-users] Looping through all values between UInt8.min and UInt8.max

2016-04-08 Thread Dave Abrahams via swift-users
on Fri Apr 08 2016, Erica Sadun wrote: > On Apr 8, 2016, at 3:48 AM, tuuranton--- via swift-users > wrote: > > print(UInt8.min) //0 > > print(UInt8.max) //255 > > //Is there an easy way to loop between all values > > //between (and including both) UInt8.min and U

Re: [swift-users] Source code " : " guidelines

2016-03-25 Thread Dave Abrahams via swift-users
on Sat Dec 05 2015, Paul Schifferer wrote: > My personal preference is to put a space on both sides of the colon when it’s > used for declaration or extension: > > class SomeClass : SomeProtocol { >   var name : String > } > > and a space only after it’s used for providing a value (as in a func