Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Brent Royal-Gordon via swift-evolution
> On Jul 15, 2016, at 10:52 PM, Chris Lattner wrote: > > * What is your evaluation of the proposal? I agree with the core team that closed by default for classes is the right move. I also think that it makes sense for methods to be closed by default. **However**, I am seriously concerned

[swift-evolution] [Pitch] Set of AnyObject by reference

2016-07-17 Thread 张国晔 via swift-evolution
I'm building an document-based app, and I'm having a problem regarding to Set. What I hope to achieve is to have a Set of unique objects by their references. For example, I might put in two rectangles with the same height and width (which makes them equal, but they are still different instances)

Re: [swift-evolution] [Review] SE-0119: Remove access modifiers from extensions

2016-07-17 Thread Adrian Zubarev via swift-evolution
Because extensions are not types. They are still bound to the type you extend. IMHO they should obey the access rules types follow, but we don’t want to debate this anymore. It won’t ever happen. I don’t think that attacking people for their whining and laziness is very constructive. Please res

Re: [swift-evolution] [Pitch] Set of AnyObject by reference

2016-07-17 Thread Tino Heth via swift-evolution
> What I hope to achieve is to have a Set of unique objects by their > references. For example, I might put in two rectangles with the same height > and width (which makes them equal, but they are still different instances). I guess this is not the best place for such problems, but did you alre

Re: [swift-evolution] [Pitch] Set of AnyObject by reference

2016-07-17 Thread 张国晔 via swift-evolution
> 在 2016年7月17日,17:44,Tino Heth <2...@gmx.de> 写道: > > >> What I hope to achieve is to have a Set of unique objects by their >> references. For example, I might put in two rectangles with the same height >> and width (which makes them equal, but they are still different instances). > I guess th

[swift-evolution] Nested for-in loops syntax

2016-07-17 Thread Maxim Bogdanov via swift-evolution
Hello, community. As I understood from documentation the only way to iterate multidimensional array or a dictionary (with for loop) is this: let multidimensionalDictionary = ["a":["b": "c"], "b":["c": "d"], "c": ["d": "e"]] for (key, value) in multidimensionalDictionary { for (nestedKey, nest

Re: [swift-evolution] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Tino Heth via swift-evolution
I naturally assumed that "public" and "open" would be two separate concepts, as it has been expressed that orthogonality* is favored. But actually reading the proposal, it says: "open is invalid on declarations that are not also public", which imho not only is an unnecessary mingling of the two c

Re: [swift-evolution] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Tino Heth via swift-evolution
I naturally assumed that "public" and "open" would be two separate concepts, as it has been expressed that orthogonality* is favored. But actually reading the proposal, it says: "open is invalid on declarations that are not also public", which imho not only is an unnecessary mingling of the two c

Re: [swift-evolution] [Review] SE-0119: Remove access modifiers from extensions

2016-07-17 Thread L. Mihalkovic via swift-evolution
Regards (From mobile) > On Jul 17, 2016, at 8:07 AM, Adrian Zubarev via swift-evolution > wrote: > > My first draft had some mistakes related access modifier on extension but the > final proposal does fully understands how they work and aims to eliminate > default access modifier behavior.

Re: [swift-evolution] [Review] SE-0119: Remove access modifiers from extensions

2016-07-17 Thread Adrian Zubarev via swift-evolution
That’s what this mailing list is for. To discuss everything with the community and the core team behind Swift. If you don’t try, you won’t get anything. If everyone would be afraid to tackle something that might go really wrong during review, nothing will happen at all. We’ll end up with a langu

Re: [swift-evolution] [Discussion] Seal `T.Type` into `Type`

2016-07-17 Thread Adrian Zubarev via swift-evolution
For those who are interested, this is the latest version of the proposal: https://gist.github.com/DevAndArtist/1332e1458e0791f8f4b1649cbeb4fce5 Casting as written in this proposal works in theory, but I had some problems implementing it, so it does work with protocols conformance We also have s

Re: [swift-evolution] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Károly Lőrentey via swift-evolution
> On 2016-07-16, at 07:52, Chris Lattner via swift-evolution > wrote: > The second review of "SE-0117: Default classes to be non-subclassable > publicly" begins now and runs through July 22. The proposal is available here: > > > https://github.com/apple/swift-evolution/blob/master/propo

Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0123: Disallow coercion to optionals in operator arguments

2016-07-17 Thread Brent Royal-Gordon via swift-evolution
> * What is your evaluation of the proposal? I'm not in favor. Briefly: I may soon propose an overload of `..<` like so: func ..< (lhs: Bound?, rhs: Bound?) -> IncompleteRange {…} This operator is one which ought to lift its parameters to greater optionality. I can only assume t

Re: [swift-evolution] [Review] SE-0121: Remove `Optional` Comparison Operators

2016-07-17 Thread Brent Royal-Gordon via swift-evolution
> * What is your evaluation of the proposal? Another quick hit. The proposal says this: >>> Until generics are more mature, the issue of Optional being conditionally >>> Comparable can't be fully discussed/implemented, so it makes the most sense >>> to remove these questionably-useful ope

Re: [swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials

2016-07-17 Thread Brent Royal-Gordon via swift-evolution
> On Jul 14, 2016, at 1:36 PM, Johannes Neubauer via swift-evolution > wrote: > > 1. Custom implementation of equals operator `==` for value types should be > forbidden. Rationale: Why has it been added in the first place? For omitting > some values from the equals test? This limitation would

Re: [swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials

2016-07-17 Thread Johannes Neubauer via swift-evolution
> Am 17.07.2016 um 15:11 schrieb Brent Royal-Gordon : > >> On Jul 14, 2016, at 1:36 PM, Johannes Neubauer via swift-evolution >> wrote: >> >> 1. Custom implementation of equals operator `==` for value types should be >> forbidden. Rationale: Why has it been added in the first place? For omitt

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Karl Wagner via swift-evolution
As an alternative to having `open` as a separate access level, we could instead have it merely imply `public`: the canonical form would be `public open`, but source code could just say `open`. Generated interfaces would always say `public open`, so searching for `public` in those would wor

Re: [swift-evolution] [Draft] Harmonize access modifiers for extensions

2016-07-17 Thread Xiaodi Wu via swift-evolution
That's a good point. I will incorporate these into a revised draft. Only two things will change: ``` public struct Foo { // implicitly internal func frobnicate1() { } } public extension Foo { // currently implicitly public // // depending on which alternative is adopted, // the proposa

Re: [swift-evolution] [Draft] Harmonize access modifiers for extensions

2016-07-17 Thread Adrian Zubarev via swift-evolution
I still don’t catch to point here. There is no implicit public there. It’s explicit set by the default access modifier of extensions. It’s how they work and how they should remain (at least as long the community want default access modifier to exist on extensions). Disallowing setting public on

Re: [swift-evolution] [Draft] Harmonize access modifiers for extensions

2016-07-17 Thread Xiaodi Wu via swift-evolution
The proposal is that the access modifier for an extension will either be removed entirely or remain as an upper bound, losing its function as a default access modifier. The default access modifier rule permits public methods to be written without `public func`; this is a proposal to remove that fea

Re: [swift-evolution] Nested for-in loops syntax

2016-07-17 Thread Nevin Brackett-Rozinsky via swift-evolution
I think this use-case is too narrow for dedicated syntax in the standard library. However, it should be simple enough for you to write your own function, let’s call it `unpack`, which produces a sequence that does what you want. While you’re at it you could also try writing a `cross` function tha

Re: [swift-evolution] [Draft] Harmonize access modifiers for extensions

2016-07-17 Thread Adrian Zubarev via swift-evolution
I tackled it as an upper bound but highly rejected by the community. That’s exactly what my proposal was all about. An upper boundary would be more elegant, but I still see arguments ‘because it’s not a type’. I could live without access modifiers on extensions in general. The default access mo

Re: [swift-evolution] [Draft] Harmonize access modifiers for extensions

2016-07-17 Thread Xiaodi Wu via swift-evolution
I understand how it works. By aligning access modifier rules inside extensions with those inside types, all other modifiers would continue to work as it does now (implicitly internal members would be limited by the upper bound). The only change in this respect is removing the ability to have publi

Re: [swift-evolution] [Proposal] Variadics as Attribute

2016-07-17 Thread Haravikk via swift-evolution
> On 15 Jul 2016, at 20:14, Tino Heth <2...@gmx.de> wrote: > > The last post in this thread is nearly a week ago... did you already apply > for review? > It would be a pity if this topic isn't finished, and I think a reduced > variant that merely replaces "values: Int…" with "@variadic _ values

Re: [swift-evolution] [Pitch] Set of AnyObject by reference

2016-07-17 Thread Dmitri Gribenko via swift-evolution
On Sun, Jul 17, 2016 at 2:00 AM, 张国晔 via swift-evolution wrote: > I'm building an document-based app, and I'm having a problem regarding to Set. > > What I hope to achieve is to have a Set of unique objects by their references. Try this: public final class ReferenceEqualityBox : Hashable { pub

Re: [swift-evolution] [Review] SE-0119: Remove access modifiers from extensions

2016-07-17 Thread Jose Cheyo Jimenez via swift-evolution
> On Jul 16, 2016, at 11:16 PM, Xiaodi Wu via swift-evolution > wrote: > >> On Sun, Jul 17, 2016 at 1:07 AM, Adrian Zubarev via swift-evolution >> wrote: >> My first draft had some mistakes related access modifier on extension but >> the final proposal does fully understands how they work a

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Garth Snyder via swift-evolution
Is there a summary somewhere of the motivation for allowing methods to be declared non-overridable within open classes? I’m not asking about any particular syntax or default, just why you'd want this facility at all. The proposal doesn’t mention this, and the discussion of the initial version n

Re: [swift-evolution] Nested for-in loops syntax

2016-07-17 Thread T.J. Usiyan via swift-evolution
re: cross (nod to Dave Abrahams for the clean implementation) /// 'Cartesian product' of two sequences public func cartesianProduct(lhs:Left, rhs:Right) -> [(Left.Iterator.Element, Right.Iterator.Element)] { return lhs.flatMap { x in rhs.map { (x, $0) } } } On Sun, Jul 17, 2016 at 11:54 AM,

Re: [swift-evolution] [Review] SE-0119: Remove access modifiers from extensions

2016-07-17 Thread Xiaodi Wu via swift-evolution
On Sun, Jul 17, 2016 at 1:42 PM, Jose Cheyo Jimenez wrote: > > > On Jul 16, 2016, at 11:16 PM, Xiaodi Wu via swift-evolution < > swift-evolution@swift.org> wrote: > > On Sun, Jul 17, 2016 at 1:07 AM, Adrian Zubarev via swift-evolution < > swift-evolution@swift.org> wrote: > >> My first draft had

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Xiaodi Wu via swift-evolution
I too would be interested in this info. Brent's numbers look daunting indeed (nearly 2000 annotations for methods and properties in corelibs-foundation alone). What use cases are supported by sealed-but-not-final public methods in open classes? On Sun, Jul 17, 2016 at 2:14 PM, Garth Snyder via sw

Re: [swift-evolution] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Dave Abrahams via swift-evolution
on Sun Jul 17 2016, Tino Heth wrote: > I naturally assumed that "public" and "open" would be two separate > concepts, as it has been expressed that orthogonality* is favored. > But actually reading the proposal, it says: > "open is invalid on declarations that are not also public", which imho >

Re: [swift-evolution] [Idea] Wrap switch cases in curly braces

2016-07-17 Thread G B via swift-evolution
I think the discussion on this has run its course and it sounds like there’s mixed feelings, but it’s mostly a matter of opinion between consistency and “ugliness”. As I understand it, the “socialization” process isn’t meant to reach consensus, but to hone the proposal (or abandon it if the fee

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Brent Royal-Gordon via swift-evolution
> On Jul 17, 2016, at 7:29 AM, Karl Wagner wrote: > > Open and public are orthogonal concepts, just like final and public are today. Are they? Given that "open" *means* "subclassable/overridable in public scope", what would it mean for something to be open, but not public? `final` *is* orthogo

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread Scott James Remnant via swift-evolution
I reviewed the original proposal, and this revised text is a much better step forwards; I still think there are a few changes I’d like to see before fully getting behind it. Consider this a +0.5. I like the use of the additional `open` keyword on top of `public`, it has a nice symmetry to the

Re: [swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials

2016-07-17 Thread Félix Cloutier via swift-evolution
Your initial rationale no longer makes sense with your suggested solution. If the dumb comparison returns false, people can still introduce side effects in the comparison method, except that now it's even harder to find out because all of my equality tests have been rewritten as "memcmp(a, b) ||

Re: [swift-evolution] [Pitch] Set of AnyObject by reference

2016-07-17 Thread 张国晔 via swift-evolution
> 在 2016年7月18日,02:08,Dmitri Gribenko 写道: > > On Sun, Jul 17, 2016 at 2:00 AM, 张国晔 via swift-evolution > wrote: >> I'm building an document-based app, and I'm having a problem regarding to >> Set. >> >> What I hope to achieve is to have a Set of unique objects by their >> references. > > Try

Re: [swift-evolution] [Review] SE-0121: Remove `Optional` Comparison Operators

2016-07-17 Thread Mike Sanderson via swift-evolution
> > * What is your evaluation of the proposal? > +1. Agree the comparison can be surprising, and it also confuses some people trying to understand optionals, apparently; I once couldn't convince someone how it worked until shortly afterwards for another issue @jckarter phrased it "Optional

Re: [swift-evolution] [swift-evolution-announce] [Review #2] SE-0117: Default classes to be non-subclassable publicly

2016-07-17 Thread L. Mihalkovic via swift-evolution
Regards (From mobile) > On Jul 17, 2016, at 9:14 PM, Garth Snyder via swift-evolution > wrote: > > Is there a summary somewhere of the motivation for allowing methods to be > declared non-overridable within open classes? > > I’m not asking about any particular syntax or default, just why you

Re: [swift-evolution] Proposals: (1) Forbidding custom `==` for value types, (2) `dispatch` keyword, (3) `default`-result for methods with `Self`, and (4) Poor-Mans-Existentials

2016-07-17 Thread Susan Cheng via swift-evolution
so, you want to propose default == operator but not forbidding all peoples to custom == operator? Why don't just adding the following function to std library? public func == (lhs: T, rhs: T) -> Bool { var lhs = lhs var rhs = rhs return memcmp(&lhs, &rhs, sizeof(T.self)) == 0 } T