Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Adrian Zubarev via swift-evolution
We had some really really long talks about that before. Search for something like `AnyValue` and `ValueSemantics`. ;) -- Adrian Zubarev Sent with Airmail Am 31. Juli 2017 um 07:33:36, Daryle Walker via swift-evolution (swift-evolution@swift.org(mailto:swift-evolution@swift.org)) schrieb: >

Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Daryle Walker via swift-evolution
> On Jul 31, 2017, at 1:19 AM, Xiaodi Wu wrote: > > Daryle, this discussion has indeed taken place before. One good place to > start is the Google result for "swift evolution non-conformance". I added SR-5589, to request a counter protocol to AnyObject. > On Sun, Jul 30, 2017 at 5:30 PM, Dary

Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Xiaodi Wu via swift-evolution
Daryle, this discussion has indeed taken place before. One good place to start is the Google result for "swift evolution non-conformance". On Sun, Jul 30, 2017 at 5:30 PM, Daryle Walker via swift-evolution < swift-evolution@swift.org> wrote: > > > On Jul 30, 2017, at 5:03 PM, Tino Heth <2...@gmx.

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread John McCall via swift-evolution
> On Jul 30, 2017, at 11:43 PM, Daryle Walker wrote: > The parameters for a fixed-size array type determine the type's size/stride, > so how could the bounds not be needed during compile-time? The compiler can't > layout objects otherwise. Swift is not C; it is perfectly capable of laying out

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Daryle Walker via swift-evolution
The parameters for a fixed-size array type determine the type's size/stride, so how could the bounds not be needed during compile-time? The compiler can't layout objects otherwise. Or do you mean that the bounds are integer literals? (That's what I have in the design document now.) Sent from

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread John McCall via swift-evolution
> On Jul 29, 2017, at 7:01 PM, Daryle Walker via swift-evolution > wrote: > The “constexpr” facility from C++ allows users to define constants and > functions that are determined and usable at compile-time, for compile-time > constructs but still usable at run-time. The facility is a key step f

Re: [swift-evolution] [Pitch] New Version of Array Proposal

2017-07-30 Thread Daryle Walker via swift-evolution
> On Jul 30, 2017, at 4:54 PM, Félix Cloutier wrote: > >> Le 29 juil. 2017 à 16:01, Daryle Walker a écrit : >> >>> On Jul 25, 2017, at 2:14 AM, Félix Cloutier via swift-evolution >>> wrote: >>> >>> It seems to me that I'm the one advocating for fewer language changes, and >>> the majority

[swift-evolution] Intended behavior of typealiases in extensions?

2017-07-30 Thread Jens Persson via swift-evolution
Typealiases in extensions currently does not work as expected or intended, as can be demonstrated by the following example: struct S { var hmm: (A, B, C) } extension S where A == Bool { typealias B = A static func printB() { print(B.self) } } extension S where A == Float { typealia

Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Daryle Walker via swift-evolution
> On Jul 30, 2017, at 5:03 PM, Tino Heth <2...@gmx.de> wrote: > >> [Apologies if this is in Swift 4 already.] >> >> We can have generic parameters match a protocol. But I have an idea in my >> head that involves the type NOT conforming to a protocol. I don’t think we >> have a way currently to

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Robert Bennett via swift-evolution
Is there any reason that constexpr couldn’t be inferred? Wherever you need something to be compile time constant — value-based generics, rawValue enum cases, etc — the compiler could make sure that the value was known at compile time, and if not then raise an error. Basically, assume everything

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Daryle Walker via swift-evolution
> On Jul 30, 2017, at 5:34 PM, Tino Heth <2...@gmx.de> wrote: > >> If you read my reply to Daniel Vollmer, you’ll find that we’re thinking >> about the exact same thing. > Good to hear — read that post later, but I guess repeating doesn't hurt here: > People still talk about macros... ;-) > >

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Tino Heth via swift-evolution
> If you read my reply to Daniel Vollmer, you’ll find that we’re thinking about > the exact same thing. Good to hear — read that post later, but I guess repeating doesn't hurt here: People still talk about macros... ;-) >> So while I think they’re both great features to have, I assume the core

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Chris Lattner via swift-evolution
On Jul 30, 2017, at 10:03 AM, Gor Gyolchanyan via swift-evolution wrote: > Tino Heth: > If you read my reply to Daniel Vollmer, you’ll find that we’re thinking about > the exact same thing. Your code snippers show my vision of compiletime > beautifully 🙂. > Now what I really want at this point

Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Robert Bennett via swift-evolution
This has come up before (aside: I can’t wait for a real forum because of exactly this; it would be great if we had a StackOverflow-like feature where the subject of your post would be searched against past threads to see if it’s a duplicate, or at least to allow you to go back and see where the

Re: [swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Tino Heth via swift-evolution
> [Apologies if this is in Swift 4 already.] > > We can have generic parameters match a protocol. But I have an idea in my > head that involves the type NOT conforming to a protocol. I don’t think we > have a way currently to work with this. Why do you want that? When something conforms, you kn

Re: [swift-evolution] [Pitch] New Version of Array Proposal

2017-07-30 Thread Félix Cloutier via swift-evolution
> Le 29 juil. 2017 à 16:01, Daryle Walker a écrit : > > >> On Jul 25, 2017, at 2:14 AM, Félix Cloutier via swift-evolution >> wrote: >> >> It seems to me that I'm the one advocating for fewer language changes, and >> the majority of sub-features that are being requested here don't feel >>

[swift-evolution] [Pitch][Bug?] Test for Anti-Conformance During Generics

2017-07-30 Thread Daryle Walker via swift-evolution
[Apologies if this is in Swift 4 already.] We can have generic parameters match a protocol. But I have an idea in my head that involves the type NOT conforming to a protocol. I don’t think we have a way currently to work with this. In C++, templates can be specialized or partially specialized.

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
> On Jul 30, 2017, at 9:29 PM, Christopher Kornher wrote: > > I am not sure that macros and annotations would be good, either. It may be > impossible to avoid them, given Swift’s goal of “world domination”. Both > features are very useful in certain applications. I’d argue that exposing swift’

Re: [swift-evolution] [Pitch] Throwing unwrap operators

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
That seems like a straight-forward way of plugging that particular hole in the ”less-than-normal” feature set of Swift. I do, however, think that ??? Is not a great choice, because it doesn’t indicate the error handling at all. Considering that the traditional ?? means “unwrap optional or use the

Re: [swift-evolution] [Pitch] Throwing unwrap operators

2017-07-30 Thread Erica Sadun via swift-evolution
From 2016: See: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160404/014272.html and https://gist.github.com/erica/5a26d523f3d6ffb74e34d179740596f7

Re: [swift-evolution] [Pitch] Throwing unwrap operators

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
I like the general direction where this is going, but I haven’t settled on an opinion regarding its appearance yet. I’ve argued before that the gap between optionals and errors should be closed by making it easy to swift from optionals to non-optionals with throwing. The “unwrap-or-die” idea disc

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Christopher Kornher via swift-evolution
I am not sure that macros and annotations would be good, either. It may be impossible to avoid them, given Swift’s goal of “world domination”. Both features are very useful in certain applications. We could continue to use custom tools like Cog and Sourcery when we need to, or standardize and b

[swift-evolution] [Pitch] Throwing unwrap operators

2017-07-30 Thread Robert Bennett via swift-evolution
This idea was sparked by conversation in another thread about a more concise way to write the following: guard let x1 = f1(), let x2 = f2(), ... else { ... } doSomething(with: x1) doSomething(with: x2) ... It was suggested to write a function that throws when an optional is nil, and then wrappi

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Christopher Kornher via swift-evolution
For completeness: I forgot to mention that I have been meaning to check-out Sourcery, which is possibly a more “Swifty” tool. I use Cog’s file-scope extensively, and it is unclear to me if that is a feature of Sourcery https://github.com/krzysztofzablocki/Sourcery OK, now I am sure that someone

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
I don’t think a Cog-like or Gyb-like macro system would be good. That’s essentially a preprocessor and we all know how that worked out for C. The only a code-generation feature can exist in a safe language like Swift is by making it a first-class citizen as described previously. I’m not sure whe

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Christopher Kornher via swift-evolution
I assume that the planned “hygienic macro” facility, if it has access to metadata, or “annotations", could be used for these sorts of meta tasks, . This is slightly off-topic, but I hope that there is a way for macros to be fully expanded and debuggable (and even formatted). I use Cog with Swift

Re: [swift-evolution] [Pitch] New Version of Array Proposal

2017-07-30 Thread Tino Heth via swift-evolution
> And other people complained about that! If I learned anything from Swift evolution, than it is that there are terrifying differences in the perception of things ;-) — Some want to get rid of object orientation, others are fond of it — Some want to enforce that "self." has always to be written o

Re: [swift-evolution] Fast String Comparison From String Arrays

2017-07-30 Thread Kenny Leung via swift-evolution
This is a bit off topic, but does anybody know the data structure that supports Xcode’s fabulous case-insensitive-in-order-yet-disjoint-substring search? -Kenny > On Jul 28, 2017, at 1:57 PM, Huon Wilson via swift-evolution > wrote: > > >> On Jul 28, 2017, at 05:54, Omar Charif via swift-ev

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
Tino Heth: If you read my reply to Daniel Vollmer, you’ll find that we’re thinking about the exact same thing. Your code snippers show my vision of compiletime beautifully 🙂. Now what I really want at this point is to here the opinions of the core team on this topic. Swift Core Team: Have you g

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Tino Heth via swift-evolution
> more elaborate compile-time facilities, which would also provide extremely > powerful meta programming features That's an interesting twist — but whenever you put a "meta" somewhere, things tend to get complicated, and people end up with different associations to the topic… ;-) I took a brief

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Gor Gyolchanyan via swift-evolution
> On Jul 30, 2017, at 1:03 PM, Daniel Vollmer via swift-evolution > wrote: > > Hello, > >> On 30. Jul 2017, at 08:52, Gor Gyolchanyan via swift-evolution >> wrote: > > [snip] > >> This is a huge undertaking, but if we split it in two parts: "executing at >> compiletime" and "exposing swift

Re: [swift-evolution] [Planning][Request] "constexpr" for Swift 5

2017-07-30 Thread Daniel Vollmer via swift-evolution
Hello, > On 30. Jul 2017, at 08:52, Gor Gyolchanyan via swift-evolution > wrote: [snip] > This is a huge undertaking, but if we split it in two parts: "executing at > compiletime" and "exposing swift’s frontend”, this could surely be done by > Swift 5. From all the ideas that I’ve had or see