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

2017-12-17 Thread Slava Pestov via swift-users
> On Dec 14, 2017, at 7:42 PM, Dave Abrahams wrote: > > IMO it makes as much sense to mention the flag in the proposal as it does to > point at a proof-of-concept implementation that accompanies a proposal. > Generally we only accept proposals that “have an

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

2017-12-14 Thread Slava Pestov via swift-users
> 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: "Conditional > conformance of 'Array' to 'Foo' depends on an

Re: [swift-users] Swift's method dispatch

2017-12-08 Thread Slava Pestov via swift-users
Hi Jens, I think the problem is that overload ranking always prefers a protocol requirement to a protocol extension member, because usually you want the dynamic dispatch through the requirement instead of calling the default implementation. But it appears that this heuristic does not take into

Re: [swift-users] Multiple Class Types in Protocol Composition

2017-12-07 Thread Slava Pestov via swift-users
Hi Mario, You’re right that this part of the proposal was not fully implemented. Computing the common ancestor of two superclasses is a little tricky here because it would force us to resolve the superclass type of a class when realizing a subclass existential. This would introduce circular

Re: [swift-users] Experimenting with conditional conformances

2017-11-28 Thread Slava Pestov via swift-users
Hi Antonio, This is explicitly mentioned in the original proposal. We do not allow multiple conditional conformances to be defined for the same type. Instead, is it possible to express your conformance as follows? extension Array : Intertial where Element : Inertial { … } Or do you really

Re: [swift-users] Where to read about *.swiftmodule file format?

2017-11-28 Thread Slava Pestov via swift-users
Hi Volodymyr, The format is not documented anywhere and is subject to change. A good starting point is include/swift/Serialization/ModuleFormat.h, but I would first be curious to know what exactly you’re planning on doing with it. It might be better to extend swift-ide-test and similar

Re: [swift-users] Functions getting compiled multiple times

2017-11-05 Thread Slava Pestov via swift-users
> On Nov 5, 2017, at 12:23 PM, Dan Stenmark via swift-users > wrote: > > I’ve recently been profiling our compile times using the > -debug-time-function-bodies flag, and I’ve noticed that some functions seem > to be listed multiple times. I know that

Re: [swift-users] How to store ref to any kind of function, and call with it argument list?

2017-11-03 Thread Slava Pestov via swift-users
(Int) -> Int is not a subtype of (Any) -> Any, because a value of the latter type can be called with an argument type that is not an Int, for example a String: let fn: (Int) -> Int = … let fn2 = (Any) -> Any = fn // pretend this works fn2(“hi”) // what does this do? I think you’ll need to do

Re: [swift-users] How to store ref to any kind of function, and call with it argument list?

2017-11-03 Thread Slava Pestov via swift-users
Unfortunately we don’t have a way to invoke a function with a runtime argument list because that would require runtime code generation in the most general case. I would hack around it by handling the common cases of no arguments, 1 argument, 2 arguments, etc up to some fixed number of

Re: [swift-users] Redundant superclass constraint

2017-10-25 Thread Slava Pestov via swift-users
Hi Phil, I think the warning is bogus in this case. Do you mind filing a bug? Slava > On Oct 24, 2017, at 11:00 PM, Phil Kirby via swift-users > wrote: > > Original StackOverflow post: > >

Re: [swift-users] Expression was too complex to be solved in reasonable time

2017-10-24 Thread Slava Pestov via swift-users
> On Oct 24, 2017, at 3:05 PM, Nate Birkholz via swift-users > wrote: > > Doing a tutorial from RayWenderlich. > https://www.raywenderlich.com/125313/make-game-like-candy-crush-spritekit-swift-part-4 > >

Re: [swift-users] [Feature Request] Extend the `defer` statement

2017-10-08 Thread Slava Pestov via swift-users
I think you can achieve what you want by having the ‘defer’ block capture a mutable local variable. Eg, func doStuff() { var success = false defer { if !success { // do some additional cleanup } } … success = true … return result } > On Oct 8, 2017, at 7:34 PM,

Re: [swift-users] How to check the type of a concrete class that inherits from a generic class?

2017-10-07 Thread Slava Pestov via swift-users
You can try upcasting the value to NSObject first, and then performing a conditional downcast to Controller1 and Controller2. At this point the type checker will not have enough information to decide that the cast always fails, and should no longer emit a warning. Slava > On Oct 6, 2017, at

Re: [swift-users] How to check the type of a concrete class that inherits from a generic class?

2017-10-07 Thread Slava Pestov via swift-users
Oh I see. I think the problem is that with Objective-C generics, you can always cast from Foo to Foo, because the type parameters do not really exist. Swift’s type checking logic for casts assumes Swift generic semantics, where in general Foo and Foo are unrelated types. Do you mind filing a

Re: [swift-users] How to check the type of a concrete class that inherits from a generic class?

2017-10-07 Thread Slava Pestov via swift-users
Can you post a self-contained example, including the declaration of NSFetchedResultsController? Slava > On Oct 6, 2017, at 11:28 PM, Glen Huang via swift-users > wrote: > > Hi, > > I defined some concrete classes inheriting from a generic class like this: > > class

Re: [swift-users] How to resolve "type(of: instance)" being shadowed by "instance.type"?

2017-09-22 Thread Slava Pestov via swift-users
> On Sep 22, 2017, at 10:10 PM, Glen Huang via swift-users > wrote: > > I have a class like this: > > class File { > type: FileType > url: URL > func fetch(from server: Server) { > type(of: server).get(from: url) > } > } > > However, it fails to compile

Re: [swift-users] Can't implement generic subscript in protocol

2017-09-15 Thread Slava Pestov via swift-users
> On Sep 15, 2017, at 4:26 PM, Slava Pestov wrote: > > >> On Sep 15, 2017, at 12:40 PM, Joanna Carter via swift-users >> wrote: >> >> Xcode Version 9.0 (9A235) >> >> Hmmm. I'm now getting a segmentation fault : 11 on a constructor when trying >>

Re: [swift-users] Can't implement generic subscript in protocol

2017-09-15 Thread Slava Pestov via swift-users
> On Sep 15, 2017, at 12:40 PM, Joanna Carter via swift-users > wrote: > > Xcode Version 9.0 (9A235) > > Hmmm. I'm now getting a segmentation fault : 11 on a constructor when trying > to implement type erasure : Swift 4.0 had issues with members and member references

Re: [swift-users] Can't implement generic subscript in protocol

2017-09-15 Thread Slava Pestov via swift-users
> On Sep 15, 2017, at 12:40 PM, Joanna Carter via swift-users > wrote: > > Greetings > > Now we've got generic subscripts, I thought I'd play… > > protocol DataProvider > { > subscript(index: Int) -> itemType { get } > } This is a valid usage of your protocol: func

Re: [swift-users] Can you use @autoclosure in a setter?

2017-09-11 Thread Slava Pestov via swift-users
ill not accomplish what Nevin is >> trying to do. >> >>> On Sep 11, 2017, at 3:08 PM, Slava Pestov via swift-users >>> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >>> >>> You can have valueSource store a cl

Re: [swift-users] Can you use @autoclosure in a setter?

2017-09-11 Thread Slava Pestov via swift-users
will be eagerly evaluated > to produce `newValue`. So this will not accomplish what Nevin is trying to > do. > >> On Sep 11, 2017, at 3:08 PM, Slava Pestov via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> You can ha

Re: [swift-users] Can you use @autoclosure in a setter?

2017-09-11 Thread Slava Pestov via swift-users
You can have valueSource store a closure that captures the autoclosure value. For example, set { valueSource = { newValue } } Slava > On Sep 11, 2017, at 11:04 AM, Nevin Brackett-Rozinsky via swift-users > wrote: > > Hi, quick question here: > > I have a class with

Re: [swift-users] Type alias with a "where" clause specifying required associated type

2017-09-05 Thread Slava Pestov via swift-users
It’s just placeholder syntax for ‘a value whose type is given by a generic parameter in the following signature’. Slava > On Sep 5, 2017, at 4:44 AM, Rudolf Adamkovič wrote: > > I see. TBH, I don’t understand why it says “Any” in the "generalized > existentials” but

Re: [swift-users] Is this a compiler bug?

2017-09-04 Thread Slava Pestov via swift-users
Yeah, looks like a bug. Do you mind filing a JIRA? Slava > On Sep 4, 2017, at 8:55 PM, Howard Lovatt via swift-users > wrote: > > Hi All, > > Is this a compiler bug? > > struct Box { > var value: T > init(_ value: T) { self.value = value } > /// Unboxing

Re: [swift-users] Type alias with a "where" clause specifying required associated type

2017-09-04 Thread Slava Pestov via swift-users
Hi Rudolf, What you are describing is not possible right now. The protocol PointType cannot be used as a type at all, because it has an associated type requirement. Also it is not clear what a ‘where’ clause attached to a type alias would mean. There has been some discussion of ‘generalized

Re: [swift-users] Type of expression is ambiguous for static tuples

2017-09-01 Thread Slava Pestov via swift-users
Yeah, my understanding is that .foo syntax only works if ‘foo’ is an immediate static member of the contextual type where the expression appears. So nested member access like .foo.b ar does not make sense. Slava > On Sep 1, 2017, at 6:04 AM, Adrian Zubarev via swift-users >

Re: [swift-users] Swift4/iOS question

2017-08-28 Thread Slava Pestov via swift-users
> On Aug 28, 2017, at 1:58 PM, Travis Griggs via swift-users > wrote: > > If I need to take this question elsewhere, please point me to the right list. > > I decided to take the dive this morning and give XCode9 beta and Swift 4 a > try. I’m tired of not being able to

Re: [swift-users] Where to download Swift v.3.2 for Linux?

2017-08-24 Thread Slava Pestov via swift-users
HI Mr Bee, “Swift 3.2” refers to running the Swift 4.0 compiler with the -swift-version 3 flag. It is not a separate download. Slava > On Aug 24, 2017, at 7:44 AM, Mr Bee via swift-users > wrote: > > Hi all, > > I'm now using Swift v.3.0 on Linux (ubuntu) and about

Re: [swift-users] Question with calling a method which returns `Self` on super

2017-08-10 Thread Slava Pestov via swift-users
> On Aug 10, 2017, at 8:23 PM, Slava Pestov via swift-users > <swift-users@swift.org> wrote: > > Hi Lincoln, > > This is a known issue with ‘super’ method calls: > https://bugs.swift.org/browse/SR-1736 <https://bugs.swift.org/browse/SR-1736> >

Re: [swift-users] Question with calling a method which returns `Self` on super

2017-08-10 Thread Slava Pestov via swift-users
Hi Lincoln, This is a known issue with ‘super’ method calls: https://bugs.swift.org/browse/SR-1736 A workaround is to cast the result of the supermethod call to Self explicitly: let copied = super.copy() as! Self Slava > On Aug 10, 2017, at 8:16 PM,

Re: [swift-users] @_transparent allowing a data member inside an enum inside MemoryLayout.swift

2017-08-02 Thread Slava Pestov via swift-users
> On Aug 2, 2017, at 4:01 PM, Shyamal Chandra via swift-users > wrote: > > Hi, > > After reading the Ray Wenderlich website tutorial [1] about Unsafe Swift, I > was checking out this file [3] inside swift/stdlib/public/core titled > MemoryLayout.swift. However, I was

Re: [swift-users] Constraining the conforming type of a protocol

2017-07-29 Thread Slava Pestov via swift-users
What you’re trying to do should be equivalent to this: protocol Toggling : Equatable { … } It’s a bug that placing the constraint on ‘Self’ does not have the same effect though; do you mind filing a JIRA? Slava > On Jul 29, 2017, at 12:24 PM, Ray Fix via swift-users

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread Slava Pestov via swift-users
Hopefully we will one day have generalized existentials which would at least allow a heterogeneous array of protocols with an associated type; however it is not clear how such an existential could conform to Hashable in a general way, given that Hashable implies Equatable which has a Self

Re: [swift-users] Convenience initializers in structs?

2017-07-18 Thread Slava Pestov via swift-users
Hi Jens, While I’m not familiar with the integer API in the standard library, structs and enums certainly can have convenience initializers. They must delegate to another initializer (either convenience or designated) rather than initializing the fields of the type one by one. Slava > On Jul

Re: [swift-users] Printing Enums?

2017-07-17 Thread Slava Pestov via swift-users
There’s already a radar filed for this (I don’t know if there’s a JIRA bug though). The problem is that the standard library’s reflection mechanism only knows how to map the in-memory representation of an enum to a case name for native Swift enums. Objective-C enums are represented by their

Re: [swift-users] Is there any harm that an @escaping handler never called?

2017-07-11 Thread Slava Pestov via swift-users
No, there is no requirement to invoke a closure at least once, escaping or not. Slava > On Jul 11, 2017, at 3:55 PM, Zhao Xin via swift-users > wrote: > > For example, I have an async query, I pass it an `@escaping resultHandler`. > If there is any results, the handler

Re: [swift-users] How to add this generic static func as a protocol requirement?

2017-07-07 Thread Slava Pestov via swift-users
Try using an associated type for the result of foo(): protocol P { associatedtype R static func foo(_ v: T) -> R } Slava > On Jul 7, 2017, at 1:50 AM, Jens Persson via swift-users > wrote: > > protocol P { > // … > // For example the following will not

Re: [swift-users] Is "lazy let" on the schedule anywhere?

2017-06-26 Thread Slava Pestov via swift-users
If you’re not passing the value type as an inout, how will the ‘lazy let’ property write back the new value? Slava > On Jun 26, 2017, at 3:32 PM, Edward Connell via swift-users > wrote: > > It sure would be nice if the compiler supported lazy lets for structs. Any >

Re: [swift-users] Optional generics question

2017-06-08 Thread Slava Pestov via swift-users
> On Jun 8, 2017, at 11:11 AM, Joel Loeshelle via swift-users > wrote: > > Hi all, > > Is there any support for having an optional type in an initializer? My use > case is I want to have a struct SectionWrapper that includes information > about a Collection View

Re: [swift-users] Swift 4 protocol with associatedtype conforming to itself

2017-06-07 Thread Slava Pestov via swift-users
> On Jun 7, 2017, at 12:46 AM, Jens Persson wrote: > > Ok, I thought it was part of SE-0142 (which has status "implemented (Swift > 4)”. That’s just the where clause part. There’s still plenty you can accomplish with them even if they do not introduce recursive

Re: [swift-users] Swift 4 protocol with associatedtype conforming to itself

2017-06-07 Thread Slava Pestov via swift-users
This is a rather complex feature that is not actually implemented in Swift 4 (or Swift 3 for that matter). Work is underway to support this, though. The fact that the second example does not produce a diagnostic is a bug (probably you will not be able to define a type that conforms to P2

Re: [swift-users] Associatedtype Naming Conventions

2017-05-31 Thread Slava Pestov via swift-users
> On May 31, 2017, at 4:16 PM, Steven Brunwasser wrote: > > Basically, my library contains a bunch of collection-like protocols, which > can be combined in different ways and can be compatible with each other in > certain combinations when the proper types align.

Re: [swift-users] Associatedtype Naming Conventions

2017-05-31 Thread Slava Pestov via swift-users
Can you give an example of a problematic name collision? Does fully qualifying names not help? Slava > On May 31, 2017, at 4:01 PM, Steven Brunwasser via swift-users > wrote: > > Hi, > > I have a library which uses a few generic protocols with identically named >

Re: [swift-users] override-like keyword for default implementations

2017-05-16 Thread Slava Pestov via swift-users
It’s not clear if such a keyword can be designed in a way that covers all cases. For example, consider a protocol extension that provides a default implementation for a requirement in a different protocol: protocol R { func f() } protocol P {} extension P { func f() } struct S : R, P {}

Re: [swift-users] Swift build-script Smaller Memory Footprint?

2017-05-07 Thread Slava Pestov via swift-users
On Darwin (which uses its own linker and not GNU ld), you can definitely build Swift with less than 16GB of RAM available. Maybe you could try gold? Slava > On May 6, 2017, at 7:21 PM, Brandon B via swift-users > wrote: > > Hello, > > I’m installing Swift 3 on

Re: [swift-users] How to use a protocol to infer a generic type with constraints

2017-05-02 Thread Slava Pestov via swift-users
Hi Satoshi, Protocols do not conform to themselves. Only concrete types can conform to protocols in the current implementation of Swift. Slava > On May 2, 2017, at 1:57 AM, Satoshi Nakagawa via swift-users > wrote: > > Hi, > > I got a build error "Generic parameter

Re: [swift-users] Performance in Trunk builds vs 3.1.1

2017-04-25 Thread Slava Pestov via swift-users
Can you share the code for your benchmark? Slava > On Apr 25, 2017, at 6:34 AM, Proyb P via swift-users > wrote: > > I have testing the performance between trunk builds downloaded from Swift > website (April 22 and 24) and 3.1.1 > > Fibonacci (N: 50) benchmark: >

Re: [swift-users] Swift creduce

2017-04-19 Thread Slava Pestov via swift-users
Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues. Slava > On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users > wrote: > > Is there a version of 'creduce' for Swift? > > I did some basic googling and

Re: [swift-users] Compile time tests

2017-03-31 Thread Slava Pestov via swift-users
We have an undocumented -verify flag you can use for this. Here’s some code that doesn’t type check because the second call to g() is passing a type that does not conform to protocol P: protocol P {} protocol Q {} struct R : P {} struct S : Q {} func g(_: T) {} g(R()) g(S()) //

Re: [swift-users] Protocol conformance failure

2017-03-21 Thread Slava Pestov via swift-users
Worth mentioning that @objc protocols do conform to themselves as long as they do not have static methods or initializer requirements. However this may be too heavy-handed if a simple overload can do the trick. Slava > On Mar 9, 2017, at 1:10 PM, Guillaume Lessard via swift-users >

Re: [swift-users] inline best practices?

2017-03-02 Thread Slava Pestov via swift-users
Here’s an overview of @inline(__always): - It is an annotation for the performance inliner, which only runs in -O builds. The performance inliner uses heuristics to figure out what to inline, so most of the time explicit annotations are not necessary, and sometimes it won’t inline something

Re: [swift-users] question on generics

2017-02-22 Thread Slava Pestov via swift-users
> On Feb 22, 2017, at 4:23 PM, David Sweeris via swift-users > wrote: > > >> On Feb 22, 2017, at 16:08, Dave Reed via swift-users >> wrote: >> >> I suspect this can't be done (at least not right now), but wanted to check. >> >> I'd like to

Re: [swift-users] question about covariant subtyping

2017-02-22 Thread Slava Pestov via swift-users
It looks intentional. Function conversions can be performed on argument and return types that are related via ‘Subtype’ constraints in the constraint solver, however array conversions are only possible via the ‘Conversion’ relation. Changing this would require some additional work in SILGen to

Re: [swift-users] Weird function call behaviour

2017-02-22 Thread Slava Pestov via swift-users
> On Feb 22, 2017, at 1:01 PM, David Hart <david.w.h...@me.com> wrote: > > >> On 22 Feb 2017, at 21:59, Slava Pestov via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: >> >> When a class conforms to a prot

Re: [swift-users] The case of broken polymorphism or "Cannot convert value of type to expected argument type"?

2017-02-21 Thread Slava Pestov via swift-users
> On Feb 20, 2017, at 4:17 PM, Jon Shier wrote: > > Also possibly related is the covariance in protocol requirements. The > following example doesn’t compile without casting the arrays or single values > to the exact types required in the protocols, despite being covariant

Re: [swift-users] The case of broken polymorphism or "Cannot convert value of type to expected argument type"?

2017-02-21 Thread Slava Pestov via swift-users
> On Feb 20, 2017, at 4:07 PM, Howard Lovatt wrote: > > It is confusing in Swift what can be covariant and what is invariant, > consider: > > // Covarant arrays work > class A {} > class B: A {} > let a = A() // A > let b = B() // B > var

Re: [swift-users] The case of broken polymorphism or "Cannot convert value of type to expected argument type"?

2017-02-16 Thread Slava Pestov via swift-users
Hi Isaac, This is not about associated types. Rather, the issue is that a ‘Thing’ is a ‘Something’, but you are casting it to ‘Something’. The two types are not related; in general, if A is a subtype of B, then G is not a subtype of G.

Re: [swift-users] Getting started with development

2017-02-13 Thread Slava Pestov via swift-users
Here is the general guide for contributions: https://swift.org/contributing/ If you want ideas for simple things to fix, look at the ‘StarterBug’ label in the bug tracker:

Re: [swift-users] How flatMap's signature is able to translate from Optional to [Type]?

2017-02-13 Thread Slava Pestov via swift-users
> On Feb 13, 2017, at 4:40 PM, Maxim Veksler via swift-users > wrote: > > I'm trying to understand the signature of flapMap that allows it to "strip > down" Optional from a type, when called on an Optional collection but remain > same type when called on a non option

Re: [swift-users] Collection Oddities

2017-02-07 Thread Slava Pestov via swift-users
> 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 property defined as an Int via IndexDistance: > > public protocol Collection : Indexable, Sequence {

Re: [swift-users] Static type when expecting dynamic type

2017-02-02 Thread Slava Pestov via swift-users
The problem is were not marking the materializeForSet accessor in DefaultMutableReference.value as an override. Definitely a bug: sil_vtable DefaultMutableReference { #MutableReference.init!initializer.1: _TFC1d23DefaultMutableReferencecfT_GS0_x_ // DefaultMutableReference.init() ->

Re: [swift-users] Initializers

2017-01-27 Thread Slava Pestov via swift-users
> On Jan 27, 2017, at 10:39 AM, tuuranton--- via swift-users > wrote: > > Yes, but why? > > What's the rationale for this? > > What would be so bad about allowing overriding a non-failable initializer > with a failable initializer? If the non-failable initializer

Re: [swift-users] Protocol extension gotcha... or bug?

2017-01-23 Thread Slava Pestov via swift-users
> On Jan 23, 2017, at 7:31 AM, Wagner Truppel via swift-users > wrote: > > Say you have a protocol and an extension of it, like so: > > protocol P { > var item: String { get } > } > > extension P { > var item: String { > return "P" > } > } > > Now imagine

Re: [swift-users] Exclamation mark's in swift parameter listings?

2017-01-18 Thread Slava Pestov via swift-users
Boxing usually refers to out-of-line allocation of values on the heap. For example, values of protocol type (as well as Any) will box their payload, depending on size. Slava > On Jan 18, 2017, at 10:53 PM, Rien wrote: > > Thanks Slava, > > Then my memory wasn’t that

Re: [swift-users] make a static/class method return type be the subclass it is called with

2017-01-10 Thread Slava Pestov via swift-users
> On Jan 9, 2017, at 11:59 PM, Pierre Monod-Broca via swift-users > wrote: > > Hi again, > > You might want to look at Self requirement in protocols for exemple: > protocol P { > func items(/*...*/) -> [Self] > } > class C: P { > func items(/*...*/) -> [C] { >...

Re: [swift-users] Is it possible to compile swift code to dynamic library?

2017-01-09 Thread Slava Pestov via swift-users
Right now, we don’t have an ‘official’ way to expose Swift APIs to C. However there is the completely unsupported and subject to change or removal at any time @_cdecl attribute. Eg, @_cdecl(“bar_foo") public func foo(x: Int) -> Int { return x } This defines a function callable from C as:

Re: [swift-users] inout generic struct parameter error

2017-01-01 Thread Slava Pestov via swift-users
Nice catch. Here’s a minimal test case: struct G {} func f1(_: inout G) {} func f2(_: inout G) {} func g1(t: G) { let _ = f1() // cannot pass immutable value as inout argument: 't' is a 'let' constant } func g2(t: G) { let _ = f2() // cannot convert value of type 'G' to expected argument

Re: [swift-users] Compiler crashes while resolving generics constraints

2016-12-26 Thread Slava Pestov via swift-users
орь Никитин <devni...@icloud.com> wrote: > > Now I’m not sure that it’s a compiler bug. > Maybe I not provide enough info of the type system or whatever else > > Thanks for the help! > >> 26 дек. 2016 г., в 22:49, Slava Pestov via swift-users >> <swift-use

Re: [swift-users] Compiler crashes while resolving generics constraints

2016-12-26 Thread Slava Pestov via swift-users
t’s talking about the two different types (both named ‘Remote’). If you feel this behavior is in error, do you mind filing a JIRA bug? Slava > > >> 25 дек. 2016 г., в 23:50, Slava Pestov via swift-users >> <swift-users@swift.org <mailto:swift-users@swift.org>> написал

Re: [swift-users] Weird protocol behaviour.

2016-12-25 Thread Slava Pestov via swift-users
> On Dec 22, 2016, at 4:43 PM, Howard Lovatt via swift-users > wrote: > > The following variation works: > > protocol P {} > > class P1:P {} > > class X:P1 {} > > func foo(_ x:A) {} > > func bar() { > //let x = X() // this compiles > let x = X() as P1 //

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

2016-11-02 Thread Slava Pestov via swift-users
I don’t remember the details, but IIRC ‘Iterator’ is an inferred associated type on Array, so it cannot appear in the ‘where’ clause of an extension. This is a known limitation of the name lookup code — presently it cannot recur into associated type inference due to circularity. We plan on

Re: [swift-users] Swift in bare-metal embedded programming/Swift runtime

2016-08-16 Thread Slava Pestov via swift-users
> On Aug 15, 2016, at 3:36 PM, Rick Mann wrote: > > Well, even C++ requires some amount of run time. On a larger MCU, the runtime > shouldn't be a problem at all. What I want to do is minimize the amount of OS > I have to implement. For example, using newlib >

Re: [swift-users] Swift in bare-metal embedded programming/Swift runtime

2016-08-11 Thread Slava Pestov via swift-users
Even if you take care not to create class instances, the compiler emits many calls to runtime functions to implement features such as generics, casts and existentials. It is possible to write code where a large number of runtime calls are optimized away, but I don’t think they can be eliminated