[jira] [Commented] (THRIFT-3773) Swift Library

2019-01-02 Thread James E. King III (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16732410#comment-16732410
 ] 

James E. King III commented on THRIFT-3773:
---

Could anyone involved with the effort to get swift into thrift look at 
THRIFT-4547?  Thanks.

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
> Fix For: 0.12.0
>
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-12-18 Thread James E. King III (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16724187#comment-16724187
 ] 

James E. King III commented on THRIFT-3773:
---

Hello... in order to complete the 0.12.0 release notes I need to update the 
LANGUAGES.md file (top level) showing the version requirements and the types of 
transports / protocols / servers the swift library supports.  Please let me 
know as soon as possible.

Also, please let me know if anyone uses Cocoa any more (in general).  I would 
like to officially deprecate it in 0.12.0 so we can remove it in the next 
release.  Folks who still want to build Cocoa apps will be able to use thrift 
0.12.0 to do it.

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
> Fix For: 0.12.0
>
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-04-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16429725#comment-16429725
 ] 

ASF GitHub Bot commented on THRIFT-3773:


jeking3 commented on issue #1084: THRIFT-3773 Swift 3 Native Library
URL: https://github.com/apache/thrift/pull/1084#issuecomment-379541865
 
 
   Based on comments here and in THRIFT-3773 I have merged this despite it 
being incomplete.  I opened https://issues.apache.org/jira/browse/THRIFT-4547 
to track completion of this work.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-04-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16428796#comment-16428796
 ] 

ASF GitHub Bot commented on THRIFT-3773:


apocolipse commented on issue #1084: THRIFT-3773 Swift 3 Native Library
URL: https://github.com/apache/thrift/pull/1084#issuecomment-379278919
 
 
   Hey @jeking3 I'll answer as best I can given i haven't done much with Thrift 
in a while :) my coworker has taken up much of the Thrift work with Swift 
internally at my company.
   - No/Yes?  The compiler is written to allow for the Old Cocoa/Swift with a 
compiler flag, so anyone still using swift 1 or 2 should still be able to use 
the Cocoa style generator but will have to use a compiler flag
   - I don't believe thats documented anywhere
   - No tests written for this, that is future work
   - Should be exercisable in Travis though no tests currently
   - I'm not sure where the Swift compiler support for Xenial and Artful 
currently is, but should be available.
   - Given backwards compatibility with Cocoa/Swift generator this should work 
with all Swift versions v1 through v4 (for Swift 1 and 2, the Cocoa library 
which is Obj-C is required along with the cocoa flag when generating code, for 
Swift 3+ the dedicated Swift library is required)
   - LANGUAGES.md has not been updated
   - build/docker/README.md have not been updated
   - The cocoa implementation is separate from this implementation.  The Cocoa 
compiler/libraries exist for Obj-C, and Swift 1 & 2, whereas Swift 3+ operate 
independently without Cocoa (as Swift 3 and up can run on Linux without Obj-C 
runtime/libraries).  That being said the old Swift/Cocoa compiler is 
"gone/removed" and there is "only 1 Swift compiler" given the old Swift/Cocoa 
compiler is integrated in this as a compiler flag
   - Given this is a full rewrite it will not play nice with #1002, though 
since that PR is related to the Swift/Cocoa compiler and that has been 
integrated for backwards compatibility that PR can be rewritten to work with 
this.  My comments on that PR still stands, the style of "Namespacing" used 
there by prefixing class names is a Cocoa convention that is improper in Swift, 
This version does proper "namespacing" for Swift by putting generated files in 
namespaced folders which should then be imported as separate modules, adhering 
to Swift's module namespacing conventions, however for the Swiftv1+2/Cocoa side 
its an acceptable pattern.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-04-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16428418#comment-16428418
 ] 

ASF GitHub Bot commented on THRIFT-3773:


apocolipse commented on issue #1084: THRIFT-3773 Swift 3 Native Library
URL: https://github.com/apache/thrift/pull/1084#issuecomment-379278919
 
 
   Hey @jeking3 I'll answer as best I can given i haven't done much with Thrift 
in a while :) my coworker has taken up much of the Thrift work with Swift 
internally at my company.
   - No/Yes?  The compiler is written to allow for the Old Cocoa/Swift with a 
compiler flag, so anyone still using swift 1 or 2 should still be able to use 
the Cocoa style generator but will have to use a compiler flag
   - I don't believe thats documented anywhere
   - No tests written for this, that is future work
   - Should be exercisable in Travis though no tests currently
   - I'm not sure where the Swift compiler support for Xenial and Artful 
currently is, but should be available.
   - Given backwards compatibility with Cocoa/Swift generator this should work 
with all Swift versions v1 through v4
   - LANGUAGES.md has not been updated
   - build/docker/README.md have not been updated
   - The cocoa implementation is separate from this implementation.  The Cocoa 
compiler/libraries exist for Obj-C, and Swift 1 & 2, whereas Swift 3+ operate 
independently without Cocoa (as Swift 3 and up can run on Linux without Obj-C 
runtime/libraries).  That being said the old Swift/Cocoa compiler is 
"gone/removed" and there is "only 1 Swift compiler" given the old Swift/Cocoa 
compiler is integrated in this as a compiler flag
   - Given this is a full rewrite it will not play nice with #1002, though 
since that PR is related to the Swift/Cocoa compiler and that has been 
integrated for backwards compatibility that PR can be rewritten to work with 
this.  My comments on that PR still stands, the style of "Namespacing" used 
there by prefixing class names is a Cocoa convention that is improper in Swift, 
This version does proper "namespacing" for Swift by putting generated files in 
namespaced folders which should then be imported as separate modules, adhering 
to Swift's module namespacing conventions, however for the Swiftv1+2/Cocoa side 
its an acceptable pattern.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-04-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16428298#comment-16428298
 ] 

ASF GitHub Bot commented on THRIFT-3773:


jeking3 commented on issue #1084: THRIFT-3773 Swift 3 Native Library
URL: https://github.com/apache/thrift/pull/1084#issuecomment-379250554
 
 
   If you could answer my questions I can get started on merging this.
   Also how does this interact with https://github.com/apache/thrift/pull/1002 ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-03-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16420599#comment-16420599
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user yurikoles commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Hi @apocolipse,
Please consider taking into account usage of reserved keywords in *.thrift 
files. For example back end developers may use field with name `description` in 
their structures. And this same keyword then redefined in generated extension 
file. This causes compile errors.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-03-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16406239#comment-16406239
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Okay, so I could merge this, but I need to know (since I've never used 
cocoa, swift, or any of the apple stuff really):

* Are there breaking changes?
* Are they documented?
* Is it already running in the cross test or is that future work?
* Can this be exercised in the Travis CI build environment? (make check, 
make cross?)
* Can I add swift support to Ubuntu Xenial and Artful?
* What minimum and maximum versions are known supported?
* Has the LANGUAGES.md file been updated?
* Has the build/docker/README.md file been updated?
* Is this supposed to replace the cocoa implementation?  Should that be 
removed?

I can make some of these changes as part of finalization.  Thanks.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16390023#comment-16390023
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@JacopoMangiavacchi  Server side already works using something like Perfect 
or Zewo, I already have separate server adapters for them 
https://github.com/apocolipse/TPerfectHTTPServer

I'd advise making Swift-Nio support separate as well to ensure better 
compatibility.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-03-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389943#comment-16389943
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user JacopoMangiavacchi commented on the issue:

https://github.com/apache/thrift/pull/1084
  
I tested this PR and I see it already support also Swift 4.0 and I'm adding 
Swift-Nio support for easily implement also the server side.

Any update on this merge ?  Thanks a lot


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2018-02-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16355364#comment-16355364
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user jorgeazevedo commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Any movement on this? I'd love to see this merged.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-12-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16294333#comment-16294333
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user tbartelmess commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Any movement on this? I'd love to see this merged.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-11-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16234483#comment-16234483
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@nsuke hah good catch, bad habits from other languages ;)  Fixed 


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-11-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16234195#comment-16234195
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r148288455
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_generator.cc ---
@@ -245,22 +297,30 @@ class t_swift_generator : public t_oop_generator {
  */
 void t_swift_generator::init_generator() {
   // Make output directory
-  MKDIR(get_out_dir().c_str());
+  string module = get_real_swift_module(program_);
+  string out_dir = get_out_dir();
+  string module_path = out_dir;
+  string name = capitalize(program_name_);
+  if (namespaced_ and !module.empty()) {
--- End diff --

I just noticed that this broke Windows build.
It seems that VC++ does not support alternative keywords in our settings.
 Can you replace`and` with `&&` ? We'll see if it fixes the build.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>Priority: Major
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-10-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16225525#comment-16225525
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@nsuke requested cleanup completed


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-10-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16223541#comment-16223541
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r147555627
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_generator.cc.old ---
@@ -0,0 +1,3249 @@
+/*
--- End diff --

Can you remove this one if it's no longer used ?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-10-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16223542#comment-16223542
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r147555608
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_generator.cc ---
@@ -95,19 +110,20 @@ class t_swift_generator : public t_oop_generator {
   void generate_xception(t_struct* txception);
   void generate_service(t_service* tservice);
 
-  void print_const_value(ostream& out,
- string name,
- t_type* type,
- t_const_value* value,
- bool defval = false,
- bool is_property = false);
+  // void print_const_value(ostream& out,
+  //string name,
+  //t_type* type,
+  //t_const_value* value,
+  //bool defval = false,
+  //bool is_property = false);
--- End diff --

Can you remove commented out code, if useless ? Otherwise please put a 
comment as to why we need to keep it as a comment.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-10-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16223540#comment-16223540
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on the issue:

https://github.com/apache/thrift/pull/1084
  
This replaces current Swift2 generator/lib with new one which supports 
Swift3. The current one is still kept as option `swift:cocoa`, though.

Swift 2 has been not usable with latest XCode for months now so it makes 
sense to me to land this to master. Reviews have been done by contributors 
before, although a few more cleanup might be needed.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-10-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16218782#comment-16218782
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
What needs to happen next to move this forward?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16041295#comment-16041295
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Also, to anyone using this, I'm making a pretty decent sized change right 
now to how `TEnums` work with Swift Enums.  Backstory is that Swift enums are 
overly opinionated and don't work well if a new enum value is added to a 
service and the client hasn't updated.

Other languages handle this pretty easily since enums are just Ints to 
them, they simply read and store the value even if it doesn't match a case.  
Since Swift's enums are finite and opinionated, and not backed by Ints, this 
posed a bit of a challenge.  I initially designed the TEnums to be 
RawRepresentable Int32 since it just made sense at the time, this let the 
library handle read/write generically and the generator only needed to declare 
the cases and an empty init case.  The problem arose when we saw it failing 
when new values came in.  Granted it was designed to do so, but we needed a way 
internally to gracefully handle that.

As a replacement, I'm removing the RawRepresentable/Int32 requirement on 
TEnums, and removing the protocol read from the library as well, they will 
retain a rawValue and init(rawValue:) to facilitate serialization and maintain 
compatibility with code that may be already using those, but they're no longer 
inherently RawRepresentable.  The reason for this decision was to add an 
`.unknown(Int32)` case that retains the extra value.  
This is an opt-in case, so you'll need to use the generator flag 
`safe_enums`, but this way you don't lose that information, and in the likely 
event you'll pull something that has an unknown enum value and then need to 
send it back to a service, you'll retain the appropriate value and maintain 
compatibility between server/client version mismatch.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16041293#comment-16041293
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Yeah, it’s implemented in Swift 4.


![img_1999](https://user-images.githubusercontent.com/2100868/26892962-c6356fa6-4b6e-11e7-8394-1964d6ee.PNG)


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16041279#comment-16041279
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Its just a proposal so far, i don't think it'll be implemented for Swift 3 
(but i havent been keeping close track, correct me if i'm wrong)  It'll make 
more sense to do once Swift4 drops and SPM is beefed up.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16041276#comment-16041276
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
> SE-0162 [ 
https://github.com/apple/swift-evolution/blob/master/proposals/0162-package-manager-custom-target-layouts.md
 ] added API for controlling where the source files for each target should be 
found. This allows SwiftPM to support source trees that don't conform to the 
standard package layout conventions.

Can we take advantage of this so that people can use the library from the 
official repo?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16037169#comment-16037169
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@gotev feel free to contribute anything that was mentioned there.  Its 
otherwise code complete (and likely better supported than the already merged 
Swift2 and Cocoa/Obj-C generators), I will contribute more to tests as I can 
but its not high priority for me right now.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-06-02 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16034783#comment-16034783
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user gotev commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@jeking3 @apocolipse What it's left to be done for this pull request to be 
merged? I can provide some help. Is 
[this](https://github.com/apache/thrift/pull/1084#issuecomment-289279668) 
everything it's needed?





> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-03-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15942260#comment-15942260
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
None that I know of.  What you can do is:

1. Make sure language support is in the Dockerfile for the ubuntu and 
debian builds.
2. Look for CROSS_LANGS in the top level Makefile.am.  That should lead you 
to the rest.
3. You will need a TestServer and TestClient implementation; you can look 
in test/cpp or test/perl for example implementations.  You will probably need a 
new test/ subdirectory for swift.
4. Make cross until it works.  If a test reliably fails (and is supposed 
to) put it into the known test failures file by running "test.py -U merge" from 
the test directory after running make cross.

Note that adding to CROSS_LANGS will also run the cross feature tests as 
well, which are in test/features.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-03-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15941995#comment-15941995
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@jeking3 no, any docs on whats needed for that?  I can add it in.  The old 
Cocoa+Swift generator was lacking here as well. (As is the Obj-C Cocoa 
generator)


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-03-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15941714#comment-15941714
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Are these changes integrated into the "make cross" cross-language 
validation suite?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2017-02-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15888775#comment-15888775
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Update 2/28/2017:
Old Swift generator and new merged into one,
Old generator under `cocoa` option, `promise_kit` option only available for 
old generator as well.

I don't have any Swift 2.x projects so i can't really test, but if anyone 
else wants to spot check code and test against old versions that'd be great.  
I've left the old swift generator CC file in tact (moved to `*.cc..old`), and 
spaced out things such that it lines up with the new code line for line for 
comparison.

Next and last steps to make this production ready IMO is namespacing, I'm 
going to add an option to namespace by splitting into subdirectories.  Actually 
configuring projects will be left up to the developer.  I'll add some output 
describing how to do it in SPM, but injecting the targets into SPM or Xcodeproj 
are beyond the scope of Thrift so for now the only thing namespacing will do is 
place source files in their own namespace relative directory, generate imports 
when necessary, and appropriately namespace types.  Any suggestions or input 
are welcome.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-12-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15767715#comment-15767715
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@nsuke I've removed the attribution, will keep it in my personal Lib repo 
thats used strictly for SPM integration.  Fixed the error codes you mentioned 
above.

I'll go ahead and merge the old cocoa generator in and put it behind a 
flag.  Ideally, users leveraging existing Swift 2.x Cocoa bindings are using 
Cocoapods, and have a lock to the specific commit they're using.  This isn't 
always the case, but should serve at least a basic level of protection on their 
client/library dependency side.  From the Generator's perspective, it will be 
completely broken unless they checkout the most recent commit before I merge 
them (or change any build steps to use the new generator). 
In terms of their existing code if they're extending the library or 
inheriting from it, some of it may break given some of the interfaces have 
changed towards Value-typed interfaces.  Extensions should for the most part 
operate properly so long as they're not calling changed interfaces.   All of 
this is of course purely speculative as I've not gone through the process of 
trying to migrate.   Long story short however there should be facilities to hit 
old lib/generator when needed and given Swift is compiled, migrating code over 
shouldn't introduce any breaking changes or unexpected behaviors.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-12-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15765972#comment-15765972
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r93366702
  
--- Diff: lib/swift/README.md ---
@@ -0,0 +1,217 @@
+Thrift Swift Library
+=
+
+License
+---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+Brought to you by [FiscalNote, Inc](http://www.fiscalnote.com/)
--- End diff --

AFAICT, there is no hard rule for this but it has never happened for us 
before either.
So for it to happen we would need a policy for our project first.
Feel free to start a discussion in dev@thrift.apache.org mailing list.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-12-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15765971#comment-15765971
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r93367768
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2553 @@
+/*
--- End diff --

Assigning simple "--gen swift" to this one sounds good to me, given the 
Swift 2.x situation and this beeing pure Swift implementation.

In general, though, removing is hard.
The most natural course of action would be to keep current one as an 
generator switch like "swift:cocoa".

For completely replacement, we need ordinal considerations for any breaking 
changes.
How hard it is to migrate existing users' code ?
It seems to me that anyone who extended library code (inheritance etc) 
would be in a huge trouble.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-12-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15765970#comment-15765970
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r93366730
  
--- Diff: lib/swift/Sources/TProtocolError.swift ---
@@ -0,0 +1,146 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+import Foundation
+
+public struct TProtocolError : TError {
+  public init() { }
+
+  public enum Code : TErrorCode {
+case unknown
+case invalidData
+case negativeSize
+case sizeLimit(limit: Int, got: Int)
+case badVersion(expected: String, got: String)
+case notImplemented
+case depthLimit
+
+public var thriftErrorCode: Int {
+  switch self {
+  case .unknown:return 0
+  case .invalidData:return 1
+  case .negativeSize:   return 2
+  case .sizeLimit:  return 3
+  case .badVersion: return 4
+  case .notImplemented: return 5
+  case .depthLimit: return 6
+  }
+
+}
+public var description: String {
+  switch self {
+  case .unknown:return "Unknown TProtocolError"
+  case .invalidData:return "Invalid Data"
+  case .negativeSize:   return "Negative Size"
+  case .sizeLimit(let limit, let got):
+return "Message exceeds size limit of \(limit) (received: \(got)"
+  case .badVersion(let expected, let got):
+return "Bad Version. (Expected: \(expected), Got: \(got)"
+  case .notImplemented: return "Not Implemented"
+  case .depthLimit: return "Depth Limit"
+  }
+}
+  }
+  
+  public enum ExtendedErrorCode : TErrorCode {
+case unknown
+case missingRequiredField(fieldName: String)
+case unexpectedType(type: TType)
+case mismatchedProtocol(expected: String, got: String)
+public var thriftErrorCode: Int {
+  switch self {
+  case .unknown:  return 1001
+  case .missingRequiredField: return 1002
+  case .unexpectedType:   return 1003
+  case .mismatchedProtocol:   return 1003
--- End diff --

The last two values seems in conflict.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661788#comment-15661788
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87716435
  
--- Diff: lib/swift/README.md ---
@@ -0,0 +1,217 @@
+Thrift Swift Library
+=
+
+License
+---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+Brought to you by [FiscalNote, Inc](http://www.fiscalnote.com/)
--- End diff --

If required by Apache sure, though my company would like a mention 
somewhere if possible, since they agreed to allow me build this on company time.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661783#comment-15661783
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87716408
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2553 @@
+/*
--- End diff --

While I don't disagree, I can potentially see future problems arising when 
I try to introduce namespacing via modules.  
Additionally, Swift 2.x won't be supported by Apple any longer after 2.x 
next year, so that might make a good case to axe the old one and just call this 
the canonical `Swift` generator, thoughts?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661785#comment-15661785
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87716418
  
--- Diff: lib/swift/Sources/LinuxHelper.swift ---
@@ -0,0 +1,34 @@
+//
+//  LinuxHelper.swift
+//  Thrift
+//
+//  Created by Christopher Simpson on 8/22/16.
+//
+//
--- End diff --

Will update


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661404#comment-15661404
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87710735
  
--- Diff: lib/swift/Sources/LinuxHelper.swift ---
@@ -0,0 +1,34 @@
+//
+//  LinuxHelper.swift
+//  Thrift
+//
+//  Created by Christopher Simpson on 8/22/16.
+//
+//
--- End diff --

Wrong file header ?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661402#comment-15661402
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87710725
  
--- Diff: lib/swift/Package.swift ---
@@ -0,0 +1,12 @@
+//let package = Package(
--- End diff --

A file header would be nice.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661403#comment-15661403
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87710760
  
--- Diff: lib/swift/README.md ---
@@ -0,0 +1,217 @@
+Thrift Swift Library
+=
+
+License
+---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+
+Brought to you by [FiscalNote, Inc](http://www.fiscalnote.com/)
--- End diff --

Can this line be removed ?

@jfarrell I couldn't find reference but is it problematic to put a company 
name into patches or doc ?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15661405#comment-15661405
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r87710644
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2553 @@
+/*
--- End diff --

This particular file shares more than half of its content with existing 
t_swift_generator.cc.
While we can certainly do this, alternative would be to add a flag into 
existing one.
See Node.js generator where we have separate `lib/nodejs` directory but 
single t_js_generator.cc with `gen_node_` field.

As the difference is often new separate method calls, such a merging might 
not introduce much of a clutter.
What do you think ?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15660346#comment-15660346
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Woah, nice!


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-11-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15660337#comment-15660337
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Update:
I've modified the generated Async clients to use a new `TAsyncResult` 
parameter for callbacks rather than Optional Return/Error tuples.   Short 
version of why is that those parameters are always mutually exclusive, and 
there's no really good way to have a non-optional return or throw pattern for 
async.
With the `TAsyncResult`, non-optional return values are encapsulated 
within a throwing func in the enum, such that you can handle your do/catch 
block in a callback.  Consider the following example:

```swift
/// normal: public func hello() throws -> String
do {
  let world = try hello()
} catch let e { handle(e) }

/// async:   public func hello(completion: @escaping (TAsyncResult) 
-> Void)
hello() {
  do {
 let world = try $0.value()
  catch let e { handle(e) }
}
```


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>Assignee: Chris Simpson
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15616176#comment-15616176
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
I've created 2 separate HTTP Servers using external libraries and made them 
available to play with
https://github.com/apocolipse/TZewoHTTPServer  and
https://github.com/apocolipse/TPerfectHTTPServer

Their interface is identical to the TSocketServer included, so they can be 
quickly and easily swapped out to test differences between them.  Created as 
separate libs to avoid no external dependency requirement for Thrift.
Apple has announced a Server API team, so hopefully in the future we can 
have Swift STD type httpservers built-in, but for now this will do.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15608167#comment-15608167
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on the issue:

https://github.com/apache/thrift/pull/1084
  
I have not. 


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15603118#comment-15603118
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
I don’t see a `[MyService]ProcessorAsync` in the generated code. How do I 
handle requests in an asynchronous manner?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15603104#comment-15603104
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
Oh I didn’t know about the `async_clients` option… thanks! 


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602748#comment-15602748
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@fumoboy007 There is `TAsyncClient` in TClient.swift as well as 
`TAsyncTransport/Factory` in TTransport.swift, and the generator will generate 
async clients properly (`--gen swift_3:async_clients`), for servers, the design 
I've seen so far is that they're asynchronous by creating new transports for 
each request for an async server, so its incumbent on the base thrift server 
implementation to handle async code, in which the simple socket server I've 
included should handle it fine, as well as the Perfect server example I posted 
in the readme should work as well. 

Can you elaborate on anything more that you'd like to see?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602734#comment-15602734
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
One major issue I encountered is the async support. There doesn’t seem to 
be an asynchronous `TProcessor`/`TProtocol`/`TClient` API in the base/generated 
code.

Async support is important for high-efficiency server applications. (At 
least until [SR-2905](https://bugs.swift.org/browse/SR-2905) is implemented for 
Linux.) I can explain this in more detail if desired.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15602381#comment-15602381
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@fumoboy007 @ChristopherRogers Have you all found any other outstanding 
issues that need addressing?


@nsuke @kdubb What final steps do we need to do to get this into the 
official Thrift codebase?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-10-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15562646#comment-15562646
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r82631304
  
--- Diff: compiler/cpp/src/thrift/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
--- End diff --

Fixed


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15519594#comment-15519594
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80368318
  
--- Diff: compiler/cpp/src/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
+#include "platform.h"
+
+using std::map;
+using std::ostream;
+using std::ofstream;
+using std::ostringstream;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
+static const string endl = "\n"; // avoid ostream << std::endl flushes
+
+/**
+ * Swift 3 code generator.
+ *
+ * Designed from the Swift/Cocoa code generator(s)
+ */
+class t_swift_3_generator : public t_oop_generator {
+public:
+  t_swift_3_generator(t_program* program,
+const map& parsed_options,
+const string& option_string)
+: t_oop_generator(program) {
+(void)option_string;
+map::const_iterator iter;
+
+log_unexpected_ = false;
+async_clients_ = false;
+debug_descriptions_ = false;
+no_strict_ = false;
+
+for( iter = parsed_options.begin(); iter != parsed_options.end(); 
++iter) {
+  if( iter->first.compare("log_unexpected") == 0) {
+log_unexpected_ = true;
+  } else if( iter->first.compare("async_clients") == 0) {
+async_clients_ = true;
+  } else if( iter->first.compare("no_strict") == 0) {
+no_strict_ = true;
+  } else if( iter->first.compare("debug_descriptions") == 0) {
+debug_descriptions_ = true;
+  } else {
+throw "unknown option swift:" + iter->first;
+  }
+}
+
+out_dir_base_ = "gen-swift";
+  }
+
+  /**
+   * Init and close methods
+   */
+
+  void init_generator();
+  void close_generator();
+
+  void generate_consts(vector consts);
+
+  /**
+   * Program-level generation functions
+   */
+
+  void generate_typedef(t_typedef* ttypedef);
+  void generate_enum(t_enum* tenum);
+  void generate_struct(t_struct* tstruct);
+  void generate_xception(t_struct* txception);
+  void generate_service(t_service* tservice);
+
+  void print_const_value(ostream& out,
+ string name,
+ t_type* type,
+ t_const_value* value,
+ bool defval = false,
+ bool is_property = false);
+  void render_const_value(ostream& out,
+  t_type* type,
+  t_const_value* value);
+
+  void generate_swift_struct(ofstream& out,
+ t_struct* tstruct,
+ bool is_private,
+ bool is_result);
+  void generate_swift_struct_init(ofstream& out,
+  t_struct* tstruct,
+  bool all,
+  bool is_private);
+
+  void generate_swift_struct_implementation(ofstream& out,
+t_struct* tstruct,
+bool is_result,
+bool is_private);
+  void generate_swift_struct_hashable_extension(ofstream& out,
+t_struct* tstruct,
+bool is_private);
+  void 

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15519588#comment-15519588
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80368238
  
--- Diff: lib/swift/Sources/TMultiplexedProtocol.swift ---
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+public class TMultiplexedProtocol: 
TWrappedProtocol {
+  public let separator = ":"
+
+  public var serviceName = ""
+  
+  public convenience init(on transport: TTransport, serviceName: String) {
+self.init(on: transport)
+self.serviceName = serviceName
+  }
+
+  override public func writeMessageBegin(name: String,
+ type messageType: TMessageType,
+ sequenceID: Int32) throws {
+switch messageType {
+case .call, .oneway:
+  var serviceFunction = serviceName
+  serviceFunction += serviceName == "" ? "" : separator
+  serviceFunction += name
+  return try super.writeMessageBegin(name: serviceFunction,
+ type: messageType,
+ sequenceID: sequenceID)
+default:
--- End diff --

That would require redundantly duplicated code.  Semantically this is just 
"If call or oneway, pad the message call, otherwise forward it through"


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15519366#comment-15519366
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80365498
  
--- Diff: compiler/cpp/src/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
+#include "platform.h"
+
+using std::map;
+using std::ostream;
+using std::ofstream;
+using std::ostringstream;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
+static const string endl = "\n"; // avoid ostream << std::endl flushes
+
+/**
+ * Swift 3 code generator.
+ *
+ * Designed from the Swift/Cocoa code generator(s)
+ */
+class t_swift_3_generator : public t_oop_generator {
+public:
+  t_swift_3_generator(t_program* program,
+const map& parsed_options,
+const string& option_string)
+: t_oop_generator(program) {
+(void)option_string;
+map::const_iterator iter;
+
+log_unexpected_ = false;
+async_clients_ = false;
+debug_descriptions_ = false;
+no_strict_ = false;
+
+for( iter = parsed_options.begin(); iter != parsed_options.end(); 
++iter) {
+  if( iter->first.compare("log_unexpected") == 0) {
+log_unexpected_ = true;
+  } else if( iter->first.compare("async_clients") == 0) {
+async_clients_ = true;
+  } else if( iter->first.compare("no_strict") == 0) {
+no_strict_ = true;
+  } else if( iter->first.compare("debug_descriptions") == 0) {
+debug_descriptions_ = true;
+  } else {
+throw "unknown option swift:" + iter->first;
+  }
+}
+
+out_dir_base_ = "gen-swift";
+  }
+
+  /**
+   * Init and close methods
+   */
+
+  void init_generator();
+  void close_generator();
+
+  void generate_consts(vector consts);
+
+  /**
+   * Program-level generation functions
+   */
+
+  void generate_typedef(t_typedef* ttypedef);
+  void generate_enum(t_enum* tenum);
+  void generate_struct(t_struct* tstruct);
+  void generate_xception(t_struct* txception);
+  void generate_service(t_service* tservice);
+
+  void print_const_value(ostream& out,
+ string name,
+ t_type* type,
+ t_const_value* value,
+ bool defval = false,
+ bool is_property = false);
+  void render_const_value(ostream& out,
+  t_type* type,
+  t_const_value* value);
+
+  void generate_swift_struct(ofstream& out,
+ t_struct* tstruct,
+ bool is_private,
+ bool is_result);
+  void generate_swift_struct_init(ofstream& out,
+  t_struct* tstruct,
+  bool all,
+  bool is_private);
+
+  void generate_swift_struct_implementation(ofstream& out,
+t_struct* tstruct,
+bool is_result,
+bool is_private);
+  void generate_swift_struct_hashable_extension(ofstream& out,
+t_struct* tstruct,
+bool is_private);
+  void 

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15518789#comment-15518789
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80357489
  
--- Diff: lib/swift/Sources/TProtocol.swift ---
@@ -0,0 +1,182 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+import Foundation
+//
+
+public enum TMessageType: Int32 {
+  case call = 1
+  case reply = 2
+  case exception = 3
+  case oneway = 4
+}
+
+public enum TType: Int32 {
+  case stop = 0
+  case void = 1
+  case bool = 2
+  case byte = 3
--- End diff --

'byte' is deprecated in the IDL, so I would go with 'i8' instead. 
Relatedly, the read/write methods need to use `Int8` instead of `UInt8`.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15518788#comment-15518788
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80355989
  
--- Diff: compiler/cpp/src/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
+#include "platform.h"
+
+using std::map;
+using std::ostream;
+using std::ofstream;
+using std::ostringstream;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
+static const string endl = "\n"; // avoid ostream << std::endl flushes
+
+/**
+ * Swift 3 code generator.
+ *
+ * Designed from the Swift/Cocoa code generator(s)
+ */
+class t_swift_3_generator : public t_oop_generator {
+public:
+  t_swift_3_generator(t_program* program,
+const map& parsed_options,
+const string& option_string)
+: t_oop_generator(program) {
+(void)option_string;
+map::const_iterator iter;
+
+log_unexpected_ = false;
+async_clients_ = false;
+debug_descriptions_ = false;
+no_strict_ = false;
+
+for( iter = parsed_options.begin(); iter != parsed_options.end(); 
++iter) {
+  if( iter->first.compare("log_unexpected") == 0) {
+log_unexpected_ = true;
+  } else if( iter->first.compare("async_clients") == 0) {
+async_clients_ = true;
+  } else if( iter->first.compare("no_strict") == 0) {
+no_strict_ = true;
+  } else if( iter->first.compare("debug_descriptions") == 0) {
+debug_descriptions_ = true;
+  } else {
+throw "unknown option swift:" + iter->first;
+  }
+}
+
+out_dir_base_ = "gen-swift";
+  }
+
+  /**
+   * Init and close methods
+   */
+
+  void init_generator();
+  void close_generator();
+
+  void generate_consts(vector consts);
+
+  /**
+   * Program-level generation functions
+   */
+
+  void generate_typedef(t_typedef* ttypedef);
+  void generate_enum(t_enum* tenum);
+  void generate_struct(t_struct* tstruct);
+  void generate_xception(t_struct* txception);
+  void generate_service(t_service* tservice);
+
+  void print_const_value(ostream& out,
+ string name,
+ t_type* type,
+ t_const_value* value,
+ bool defval = false,
+ bool is_property = false);
+  void render_const_value(ostream& out,
+  t_type* type,
+  t_const_value* value);
+
+  void generate_swift_struct(ofstream& out,
+ t_struct* tstruct,
+ bool is_private,
+ bool is_result);
+  void generate_swift_struct_init(ofstream& out,
+  t_struct* tstruct,
+  bool all,
+  bool is_private);
+
+  void generate_swift_struct_implementation(ofstream& out,
+t_struct* tstruct,
+bool is_result,
+bool is_private);
+  void generate_swift_struct_hashable_extension(ofstream& out,
+t_struct* tstruct,
+bool is_private);
+  

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15518787#comment-15518787
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80357106
  
--- Diff: compiler/cpp/src/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
+#include "platform.h"
+
+using std::map;
+using std::ostream;
+using std::ofstream;
+using std::ostringstream;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
+static const string endl = "\n"; // avoid ostream << std::endl flushes
+
+/**
+ * Swift 3 code generator.
+ *
+ * Designed from the Swift/Cocoa code generator(s)
+ */
+class t_swift_3_generator : public t_oop_generator {
+public:
+  t_swift_3_generator(t_program* program,
+const map& parsed_options,
+const string& option_string)
+: t_oop_generator(program) {
+(void)option_string;
+map::const_iterator iter;
+
+log_unexpected_ = false;
+async_clients_ = false;
+debug_descriptions_ = false;
+no_strict_ = false;
+
+for( iter = parsed_options.begin(); iter != parsed_options.end(); 
++iter) {
+  if( iter->first.compare("log_unexpected") == 0) {
+log_unexpected_ = true;
+  } else if( iter->first.compare("async_clients") == 0) {
+async_clients_ = true;
+  } else if( iter->first.compare("no_strict") == 0) {
+no_strict_ = true;
+  } else if( iter->first.compare("debug_descriptions") == 0) {
+debug_descriptions_ = true;
+  } else {
+throw "unknown option swift:" + iter->first;
+  }
+}
+
+out_dir_base_ = "gen-swift";
+  }
+
+  /**
+   * Init and close methods
+   */
+
+  void init_generator();
+  void close_generator();
+
+  void generate_consts(vector consts);
+
+  /**
+   * Program-level generation functions
+   */
+
+  void generate_typedef(t_typedef* ttypedef);
+  void generate_enum(t_enum* tenum);
+  void generate_struct(t_struct* tstruct);
+  void generate_xception(t_struct* txception);
+  void generate_service(t_service* tservice);
+
+  void print_const_value(ostream& out,
+ string name,
+ t_type* type,
+ t_const_value* value,
+ bool defval = false,
+ bool is_property = false);
+  void render_const_value(ostream& out,
+  t_type* type,
+  t_const_value* value);
+
+  void generate_swift_struct(ofstream& out,
+ t_struct* tstruct,
+ bool is_private,
+ bool is_result);
+  void generate_swift_struct_init(ofstream& out,
+  t_struct* tstruct,
+  bool all,
+  bool is_private);
+
+  void generate_swift_struct_implementation(ofstream& out,
+t_struct* tstruct,
+bool is_result,
+bool is_private);
+  void generate_swift_struct_hashable_extension(ofstream& out,
+t_struct* tstruct,
+bool is_private);
+  

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15518785#comment-15518785
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80357625
  
--- Diff: lib/swift/Sources/TMultiplexedProtocol.swift ---
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+public class TMultiplexedProtocol: 
TWrappedProtocol {
+  public let separator = ":"
+
+  public var serviceName = ""
+  
+  public convenience init(on transport: TTransport, serviceName: String) {
+self.init(on: transport)
+self.serviceName = serviceName
+  }
+
+  override public func writeMessageBegin(name: String,
+ type messageType: TMessageType,
+ sequenceID: Int32) throws {
+switch messageType {
+case .call, .oneway:
+  var serviceFunction = serviceName
+  serviceFunction += serviceName == "" ? "" : separator
+  serviceFunction += name
+  return try super.writeMessageBegin(name: serviceFunction,
+ type: messageType,
+ sequenceID: sequenceID)
+default:
--- End diff --

I would omit `default` and instead explicitly list the remaining cases for 
switch statements like this where the compiler can prove that all cases were 
exhausted.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15518786#comment-15518786
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r80355496
  
--- Diff: compiler/cpp/src/generate/t_swift_3_generator.cc ---
@@ -0,0 +1,2458 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "t_oop_generator.h"
+#include "platform.h"
+
+using std::map;
+using std::ostream;
+using std::ofstream;
+using std::ostringstream;
+using std::set;
+using std::string;
+using std::stringstream;
+using std::vector;
+
+static const string endl = "\n"; // avoid ostream << std::endl flushes
+
+/**
+ * Swift 3 code generator.
+ *
+ * Designed from the Swift/Cocoa code generator(s)
+ */
+class t_swift_3_generator : public t_oop_generator {
+public:
+  t_swift_3_generator(t_program* program,
+const map& parsed_options,
+const string& option_string)
+: t_oop_generator(program) {
+(void)option_string;
+map::const_iterator iter;
+
+log_unexpected_ = false;
+async_clients_ = false;
+debug_descriptions_ = false;
+no_strict_ = false;
+
+for( iter = parsed_options.begin(); iter != parsed_options.end(); 
++iter) {
+  if( iter->first.compare("log_unexpected") == 0) {
+log_unexpected_ = true;
+  } else if( iter->first.compare("async_clients") == 0) {
+async_clients_ = true;
+  } else if( iter->first.compare("no_strict") == 0) {
+no_strict_ = true;
+  } else if( iter->first.compare("debug_descriptions") == 0) {
+debug_descriptions_ = true;
+  } else {
+throw "unknown option swift:" + iter->first;
+  }
+}
+
+out_dir_base_ = "gen-swift";
+  }
+
+  /**
+   * Init and close methods
+   */
+
+  void init_generator();
+  void close_generator();
+
+  void generate_consts(vector consts);
+
+  /**
+   * Program-level generation functions
+   */
+
+  void generate_typedef(t_typedef* ttypedef);
+  void generate_enum(t_enum* tenum);
+  void generate_struct(t_struct* tstruct);
+  void generate_xception(t_struct* txception);
+  void generate_service(t_service* tservice);
+
+  void print_const_value(ostream& out,
+ string name,
+ t_type* type,
+ t_const_value* value,
+ bool defval = false,
+ bool is_property = false);
+  void render_const_value(ostream& out,
+  t_type* type,
+  t_const_value* value);
+
+  void generate_swift_struct(ofstream& out,
+ t_struct* tstruct,
+ bool is_private,
+ bool is_result);
+  void generate_swift_struct_init(ofstream& out,
+  t_struct* tstruct,
+  bool all,
+  bool is_private);
+
+  void generate_swift_struct_implementation(ofstream& out,
+t_struct* tstruct,
+bool is_result,
+bool is_private);
+  void generate_swift_struct_hashable_extension(ofstream& out,
+t_struct* tstruct,
+bool is_private);
+  

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-23 Thread Chris Simpson (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15517318#comment-15517318
 ] 

Chris Simpson commented on THRIFT-3773:
---

I'm a bit biased since I wrote it, but I can say that my company is starting to 
use this in production code with our next iOS push.

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-23 Thread Jens Geyer (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15517307#comment-15517307
 ] 

Jens Geyer commented on THRIFT-3773:


@all: Any Swift devs around that want to participate in reviewing this stuff?

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-23 Thread Darren Mo (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15516925#comment-15516925
 ] 

Darren Mo commented on THRIFT-3773:
---

So how does one get an Apache Thrift pull request merged?

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15498099#comment-15498099
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on the issue:

https://github.com/apache/thrift/pull/1084
  
```
Compile Swift Module 'Thrift' (37 sources)
/Users/…/Packages/Thrift-1.0.0/Sources/TSet.swift:22:70: warning: 
'IndexableBase' is deprecated: it will be removed in Swift 4.0.  Please use 
'Collection' instead
public struct TSet : Collection, 
IndexableBase, ExpressibleByArrayLiteral, Hashable, TSerializable {
 ^
```


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15486444#comment-15486444
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user SirWellington commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78503326
  
--- Diff: lib/swift/Sources/TApplicationError.swift ---
@@ -0,0 +1,157 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+public struct TApplicationError : TError {
+  public enum Code : TErrorCode {
+case unknown
+case unknownMethod(methodName: String?)
+case invalidMessageType
+case wrongMethodName(methodName: String?)
+case badSequenceId
+case missingResult(methodName: String?)
+case internalError
+case protocolError
+case invalidTransform
+case invalidProtocol
+case unsupportedClientType
+
+
+/// Initialize a TApplicationError with a Thrift error code
+/// Normally this would be achieved with RawRepresentable however
+/// by doing this we can allow for associated properties on enum cases 
for
+/// case specific context data in a Swifty, type-safe manner.
+///
+/// - parameter thriftErrorCode: Integer TApplicationError(exception) 
error code.  
+///  Default to 0 (.unknown)
+public init(thriftErrorCode: Int) {
+  switch thriftErrorCode {
+  case 1:  self = .unknownMethod(methodName: nil)
+  case 2:  self = .invalidMessageType
+  case 3:  self = .wrongMethodName(methodName: nil)
+  case 4:  self = .badSequenceId
+  case 5:  self = .missingResult(methodName: nil)
+  case 6:  self = .internalError
+  case 7:  self = .protocolError
+  case 8:  self = .invalidProtocol
+  case 9:  self = .invalidTransform
+  case 10: self = .unsupportedClientType
+  default: self = .unknown
+  }
+}
+public var thriftErrorCode: Int {
+  switch self {
+  case .unknown:return 0
+  case .unknownMethod:  return 1
+  case .invalidMessageType: return 2
+  case .wrongMethodName:return 3
+  case .badSequenceId:  return 4
+  case .missingResult:  return 5
+  case .internalError:  return 6
+  case .protocolError:  return 7
+  case .invalidProtocol:return 8
+  case .invalidTransform:   return 9
+  case .unsupportedClientType:  return 10
+  }
+}
+
+public var description: String {
+  /// Output "for #methodName" if method is not nil else empty
+  let methodUnwrap: (String?) -> String =  { method in
+return "\(method == nil ? "" : " for \(method ?? "")")"
+  }
+  switch self {
+  case .unknown:  return "Unknown 
TApplicationError"
+  case .unknownMethod(let method):return "Unknown 
Method\(methodUnwrap(method))"
+  case .invalidMessageType:   return "Invalid Message Type"
+  case .wrongMethodName(let method):  return "Wrong Method 
Name\(methodUnwrap(method))"
+  case .badSequenceId:return "Bad Sequence ID"
+  case .missingResult(let method):return "Missing 
Result\(methodUnwrap(method))"
+  case .internalError:return "Internal Error"
+  case .protocolError:return "Protocol Error"
+  case .invalidProtocol:  return "Invalid Protocol"
+  case .invalidTransform: return "Invalid Transform"
+  case .unsupportedClientType:return "Unsupported Client Type"
+  }
+}
+  }
+
+  public init() { }
+  
+  public init(thriftErrorCode code: Int, message: String?=nil) {
--- End diff --

Might wanna space out the `String?=nil` to `String? 

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15484987#comment-15484987
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@ChristopherRogers @fumoboy007 I implemented union support with enums, 
here's an example of generated code:
```
union TestUnion {
  1: i32 data,
  2: string message,
  3: bool success
}
```

```swift
public enum TestUnion {
  case data(val: Int32)
  case message(val: String)
  case success(val: Bool)
}
public func ==(lhs: TestUnion, rhs: TestUnion) -> Bool {
  return {
switch (lhs, rhs) {
case (.data(let lval), .data(let rval)): return lval == rval
case (.message(let lval), .message(let rval)): return lval == rval
case (.success(let lval), .success(let rval)): return lval == rval
default: return false
}
  }()
}

extension TestUnion : CustomStringConvertible {
  public var description : String {
var desc = "TestUnion."
switch self {
case .data(let val): desc += "data(val: \(val))"
case .message(let val): desc += "message(val: \(val))"
case .success(let val): desc += "success(val: \(val))"
}
return desc
  }
}

extension TestUnion : Hashable {
  public var hashValue : Int {
let prime = 31
var result = 1
switch self {
case .data(let val): result = prime &* val.hashValue
case .message(let val): result = prime &* val.hashValue
case .success(let val): result = prime &* val.hashValue
}

return result
  }
}

extension TestUnion : TStruct {

  public static var fieldIds: [String: Int32] {
return ["data": 1, "message": 2, "success": 3, ]
  }

  public static var structName: String { return "TestUnion" }

  public static func read(from proto: TProtocol) throws -> TestUnion {
_ = try proto.readStructBegin()
var ret: TestUnion?
fields: while true {

  let (_, fieldType, fieldID) = try proto.readFieldBegin()

  switch (fieldID, fieldType) {
case (_, .stop):break fields
case (1, .i32): ret = TestUnion.data(val: try 
Int32.read(from: proto))
case (2, .string):   ret = TestUnion.message(val: 
try String.read(from: proto))
case (3, .bool):ret = TestUnion.success(val: 
try Bool.read(from: proto))
case let (_, unknownType):  try proto.skip(type: unknownType)
  }
  try proto.readFieldEnd()
}

if let ret = ret {
  return ret
}

throw TProtocolError(error: .unknown, message: "Missing required value 
for type: TestUnion")  }
}
```


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15484841#comment-15484841
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@nsuke I considered that when starting out, however the differences between 
Swift 2 and 3 are pretty dramatic that makes shared code minimal (i.e. 
everything in this library is Value typed, compared to the Swift/Cocoa 
generator).
Conceptually, this /is/ the `Swift` generator, and the other one is 
technically Cocoa Swift.
Additionally, due to limitations with SPM, sharing code might not be the 
most sane option.
One key difference with this and the existing Swift library, this library 
has no intention of Objective-C interop, it is a pure Swift approach.  

We could argue for moving the old Swift generator to be used like `--gen 
cocoa:swift` which would be more appropriate in my opinion.

As far as sharing code between them goes, the amount that is the same 
should be negligable, but packaging is the biggest concern.  Cocoapods isn't 
overly friendly with picking/choosing source files from different locations in 
the file heirarchy, and SPM isn't capable of pointing at sources not in 
`Sources` at all (hence the need for a separate repo for the time being to 
leverage it with SPM).


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15484815#comment-15484815
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user nsuke commented on the issue:

https://github.com/apache/thrift/pull/1084
  
There's a substantial amount of code duplication with existing swift 
generator.
Do you have any idea as to reducing them ?
As I've never seen anyone advocating the current practice of "single big 
file per language", we could, for example, extract common part to another file 
or even introduce a swift sub directory etc.

Internal structures aside, doesn't it make more sense to have a sub-option 
like --gen swift:3 rather than a separate language option ?

CC: @kdubb for review and/or comments.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482999#comment-15482999
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
That'll require generation of both read and write serialization code (which 
I try to abstract much of to the library), but its doable I suppose.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482996#comment-15482996
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@ChristopherRogers Something like this?
```
union AUnion {
  1: string result,
  2: CustomException error
}
```
```swift
enum AUnion {
  case result(val: String)
  case error(val: CustomException)
}
```


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482993#comment-15482993
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78313579
  
--- Diff: lib/swift/Sources/LinuxHelper.swift ---
@@ -0,0 +1,42 @@
+//
+//  LinuxHelper.swift
+//  Thrift
+//
+//  Created by Christopher Simpson on 8/22/16.
+//
+//
+
+import Foundation
+import CoreFoundation
+
+#if os(Linux)
+/// Extensions for Linux for incomplete Foundation API's.
+/// swift-corelibs-foundation is not yet 1:1 with OSX/iOS Foundation
+
+extension URLSession {
+  // Current one uses NSURLRequest which doesn't currently bridge
+  @discardableResult
+  open func dataTask(with request: URLRequest, completionHandler: 
@escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask {
--- End diff --

I’m not too sure how the tagging/branching works in the Swift repo, but I 
see that the 
[commit](https://github.com/apple/swift-corelibs-foundation/commit/cffa65a1f933ddb29b7d3d21cd1756caeddc238f)
 is in `swift-3.0-branch` (as well as `master`) and is included in the 
`swift-3.0-GM-CANDIDATE` tag.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482986#comment-15482986
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user ChristopherRogers commented on the issue:

https://github.com/apache/thrift/pull/1084
  
I noticed you haven't special cased unions (they'll just be generated as 
structs.) Have you looked into adding support for this? I'd love to be able to 
use Swift's enums with Thrift's union types.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482968#comment-15482968
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78313057
  
--- Diff: lib/swift/Sources/LinuxHelper.swift ---
@@ -0,0 +1,42 @@
+//
+//  LinuxHelper.swift
+//  Thrift
+//
+//  Created by Christopher Simpson on 8/22/16.
+//
+//
+
+import Foundation
+import CoreFoundation
+
+#if os(Linux)
+/// Extensions for Linux for incomplete Foundation API's.
+/// swift-corelibs-foundation is not yet 1:1 with OSX/iOS Foundation
+
+extension URLSession {
+  // Current one uses NSURLRequest which doesn't currently bridge
+  @discardableResult
+  open func dataTask(with request: URLRequest, completionHandler: 
@escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask {
--- End diff --

@fumoboy007 Which tag was that added in?  I'm attempting to have this match 
up with GM (its been tricky the past few weeks -_-)
I don't mind floating it since on the Darwin side, this stuff is all good 
to go where its hard to update swift, whereas the linux side its a little 
easier to update Swift to snapshots to ensure a solid library build.


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482960#comment-15482960
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312854
  
--- Diff: lib/swift/Sources/LinuxHelper.swift ---
@@ -0,0 +1,42 @@
+//
+//  LinuxHelper.swift
+//  Thrift
+//
+//  Created by Christopher Simpson on 8/22/16.
+//
+//
+
+import Foundation
+import CoreFoundation
+
+#if os(Linux)
+/// Extensions for Linux for incomplete Foundation API's.
+/// swift-corelibs-foundation is not yet 1:1 with OSX/iOS Foundation
+
+extension URLSession {
+  // Current one uses NSURLRequest which doesn't currently bridge
+  @discardableResult
+  open func dataTask(with request: URLRequest, completionHandler: 
@escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask {
--- End diff --

Not necessary anymore I think: 
https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSURLSession/NSURLSession.swift#L423


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482956#comment-15482956
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user apocolipse commented on the issue:

https://github.com/apache/thrift/pull/1084
  
@fumoboy007 thanks, thought i had the overflow ones in there, will add them 
back in :) 


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482951#comment-15482951
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312577
  
--- Diff: lib/swift/Sources/TStruct.swift ---
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/// Protocol for Generated Structs to conform to
+/// Dictionary maps field names to internal IDs and uses Reflection
+/// to iterate through all fields.  
+/// `writeFieldValue(_:name:type:id:)` calls `TSerializable.write(to:)` 
internally
+/// giving a nice recursive behavior for nested TStructs, TLists, TMaps, 
and TSets
+public protocol TStruct : TSerializable {
+  static var fieldIds: [String: Int32] { get }
+  static var structName: String { get }
+}
+
+public extension TStruct {
+  public static var fieldIds: [String: (id: Int32, type: TType)] { return 
[:] }
+  public static var thriftType: TType { return .struct }
+  
+  public func write(to proto: TProtocol) throws {
+// Write struct name first
+try proto.writeStructBegin(name: Self.structName)
+
+try self.forEach { name, value, id in
+  // Write to protocol
+  try proto.writeFieldValue(value, name: name,
+type: value.thriftType, id: id)
+}
+try proto.writeFieldStop()
+try proto.writeStructEnd()
+  }
+  
+  public var hashValue: Int {
+let prime = 31
+var result = 1
+self.forEach { _, value, _ in
+  result = prime * result + (value.hashValue)
--- End diff --

`&*`, `&+`?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482948#comment-15482948
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312532
  
--- Diff: lib/swift/Sources/TSet.swift ---
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import Foundation
+
+public struct TSet : SetAlgebra, 
Hashable, Collection, ExpressibleByArrayLiteral, TSerializable {
+  /// Typealias for Storage type
+  typealias Storage = Set
+  
+  
+  /// Internal Storage used for TSet (Set\)
+  internal var storage : Storage
+  
+  
+  /// Mark: Collection
+  
+  public typealias Indices = Storage.Indices
+  public typealias Index = Storage.Index
+  public typealias IndexDistance = Storage.IndexDistance
+  public typealias SubSequence = Storage.SubSequence
+  
+  
+  public var indices: Indices { return storage.indices }
+  
+  // Must implement isEmpty even though both SetAlgebra and Collection 
provide it due to their conflciting default implementations
+  public var isEmpty: Bool { return storage.isEmpty }
+  
+  public func distance(from start: Index, to end: Index) -> IndexDistance {
+return storage.distance(from: start, to: end)
+  }
+  
+  public func index(_ i: Index, offsetBy n: IndexDistance) -> Index {
+return storage.index(i, offsetBy: n)
+  }
+  
+  public func index(_ i: Index, offsetBy n: IndexDistance, limitedBy 
limit: Index) -> Index? {
+return storage.index(i, offsetBy: n, limitedBy: limit)
+  }
+  
+  public subscript (position: Storage.Index) -> Element? {
+return storage[position]
+  }
+  
+  /// Mark: SetAlgebra
+  internal init(storage: Set) {
+self.storage = storage
+  }
+  
+  public func contains(_ member: Element) -> Bool {
+return storage.contains(member)
+  }
+  
+  public mutating func insert(_ newMember: Element) -> (inserted: Bool, 
memberAfterInsert: Element) {
+return storage.insert(newMember)
+  }
+  
+  public mutating func remove(_ member: Element) -> Element? {
+return storage.remove(member)
+  }
+  
+  public func union(_ other: TSet) -> TSet {
+return TSet(storage: storage.union(other.storage))
+  }
+  
+  public mutating func formIntersection(_ other: TSet) {
+return storage.formIntersection(other.storage)
+  }
+  
+  public mutating func formSymmetricDifference(_ other: TSet) {
+return storage.formSymmetricDifference(other.storage)
+  }
+  
+  public mutating func formUnion(_ other: TSet) {
+return storage.formUnion(other.storage)
+  }
+  
+  public func intersection(_ other: TSet) -> TSet {
+return TSet(storage: storage.intersection(other.storage))
+  }
+  
+  public func symmetricDifference(_ other: TSet) -> TSet {
+return TSet(storage: storage.symmetricDifference(other.storage))
+  }
+  
+  public mutating func update(with newMember: Element) -> Element? {
+return storage.update(with: newMember)
+  }
+  
+  /// Mark: IndexableBase
+  
+  public var startIndex: Index { return storage.startIndex }
+  public var endIndex: Index { return storage.endIndex }
+  public func index(after i: Index) -> Index {
+return storage.index(after: i)
+  }
+
+  public func formIndex(after i: inout Storage.Index) {
+storage.formIndex(after: )
+  }
+  
+  public subscript(bounds: Range) -> SubSequence {
+return storage[bounds]
+  }
+
+  
+  /// Mark: Hashable
+  public var hashValue : Int {
+let prime = 31
+var result = 1
+for element in storage {
+  result = prime * result + element.hashValue

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482947#comment-15482947
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312512
  
--- Diff: lib/swift/Sources/TMap.swift ---
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public struct TMap: 
Collection, ExpressibleByDictionaryLiteral, Hashable, TSerializable {
+  typealias Storage = Dictionary
+  public typealias Element = Storage.Element
+  public typealias Index = Storage.Index
+  public typealias IndexDistance = Storage.IndexDistance
+  public typealias Indices = Storage.Indices
+  public typealias SubSequence = Storage.SubSequence
+  internal var storage = Storage()
+  
+  /// Mark: Be Like Dictionary
+  
+  public func indexForKey(_ key: Key) -> Index? {
+return storage.index(forKey: key)
+  }
+  
+  public mutating func updateValue(_ value: Value, forKey key: Key) -> 
Value? {
+return updateValue(value, forKey: key)
+  }
+  
+  public mutating func removeAtIndex(_ index: DictionaryIndex) 
-> (Key, Value) {
+return removeAtIndex(index)
+  }
+  
+  public mutating func removeValueForKey(_ key: Key) -> Value? {
+return storage.removeValue(forKey: key)
+  }
+  
+  public init(minimumCapacity: Int) {
+storage = Storage(minimumCapacity: minimumCapacity)
+  }
+  
+  public subscript (key: Key) -> Value? {
+get {
+  return storage[key]
+}
+set {
+  storage[key] = newValue
+}
+  }
+  
+  /// Mark: Collection
+  
+  public var indices: Indices {
+return storage.indices
+  }
+  
+  public func distance(from start: Index, to end: Index) -> IndexDistance {
+return storage.distance(from: start, to: end)
+  }
+  
+  public func index(_ i: Index, offsetBy n: IndexDistance) -> Index {
+return storage.index(i, offsetBy: n)
+  }
+  
+  public func index(_ i: Index, offsetBy n: IndexDistance, limitedBy 
limit: Index) -> Index? {
+return storage.index(i, offsetBy: n, limitedBy: limit)
+  }
+  
+  public subscript(position: Index) -> Element {
+return storage[position]
+  }
+  
+  /// Mark: IndexableBase
+  
+  public var startIndex: Index { return storage.startIndex }
+  public var endIndex: Index { return storage.endIndex }
+  public func index(after i: Index) -> Index {
+return storage.index(after: i)
+  }
+  
+  public func formIndex(after i: inout Index) {
+storage.formIndex(after: )
+  }
+  
+  public subscript(bounds: Range) -> SubSequence {
+return storage[bounds]
+  }
+  
+  /// Mark: DictionaryLiteralConvertible
+  
+  public init(dictionaryLiteral elements: (Key, Value)...) {
+storage = Storage()
+for (key, value) in elements {
+  storage[key] = value
+}
+  }
+
+  /// Mark: Hashable
+  
+  public var hashValue: Int {
+let prime = 31
+var result = 1
+for (key, value) in storage {
+  result = prime * result + key.hashValue
--- End diff --

`&*`, `&+`?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with 

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482943#comment-15482943
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312455
  
--- Diff: lib/swift/Sources/TApplicationError.swift ---
@@ -0,0 +1,157 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+public struct TApplicationError : TError {
+  public enum Code : TErrorCode {
+case unknown
+case unknownMethod(methodName: String?)
+case invalidMessageType
+case wrongMethodName(methodName: String?)
+case badSequenceId
+case missingResult(methodName: String?)
+case internalError
+case protocolError
+case invalidTransform
+case invalidProtocol
+case unsupportedClientType
+
+
+/// Initialize a TApplicationError with a Thrift error code
+/// Normally this would be achieved with RawRepresentable however
+/// by doing this we can allow for associated properties on enum cases 
for
+/// case specific context data in a Swifty, type-safe manner.
+///
+/// - parameter thriftErrorCode: Integer TApplicationError(exception) 
error code.  
+///  Default to 0 (.unknown)
+public init(thriftErrorCode: Int) {
+  switch thriftErrorCode {
+  case 1:  self = .unknownMethod(methodName: nil)
+  case 2:  self = .invalidMessageType
+  case 3:  self = .wrongMethodName(methodName: nil)
+  case 4:  self = .badSequenceId
+  case 5:  self = .missingResult(methodName: nil)
+  case 6:  self = .internalError
+  case 7:  self = .protocolError
+  case 8:  self = .invalidProtocol
+  case 9:  self = .invalidTransform
+  case 10: self = .unsupportedClientType
+  default: self = .unknown
+  }
+}
+public var thriftErrorCode: Int {
+  switch self {
+  case .unknown:return 0
+  case .unknownMethod:  return 1
+  case .invalidMessageType: return 2
+  case .wrongMethodName:return 3
+  case .badSequenceId:  return 4
+  case .missingResult:  return 5
+  case .internalError:  return 6
+  case .protocolError:  return 7
+  case .invalidProtocol:return 8
+  case .invalidTransform:   return 9
+  case .unsupportedClientType:  return 10
+  }
+}
+
+public var description: String {
+  /// Output "for #methodName" if method is not nil else empty
+  let methodUnwrap: (String?) -> String =  { method in
+return "\(method == nil ? "" : " for \(method ?? "")")"
+  }
+  switch self {
+  case .unknown:  return "Unknown 
TApplicationError"
+  case .unknownMethod(let method):return "Unknown 
Method\(methodUnwrap(method))"
+  case .invalidMessageType:   return "Invalid Message Type"
+  case .wrongMethodName(let method):  return "Wrong Method 
Name\(methodUnwrap(method))"
+  case .badSequenceId:return "Bad Sequence ID"
+  case .missingResult(let method):return "Missing 
Result\(methodUnwrap(method))"
+  case .internalError:return "Internal Error"
+  case .protocolError:return "Protocol Error"
+  case .invalidProtocol:  return "Invalid Protocol"
+  case .invalidTransform: return "Invalid Transform"
+  case .unsupportedClientType:return "Unsupported Client Type"
+  }
+}
+  }
+
+  public init() { }
+  
+  public init(thriftErrorCode code: Int, message: String?=nil) {
+self.error = Code(thriftErrorCode: code)
+self.message = message
  

[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15482945#comment-15482945
 ] 

ASF GitHub Bot commented on THRIFT-3773:


Github user fumoboy007 commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1084#discussion_r78312489
  
--- Diff: lib/swift/Sources/TList.swift ---
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public struct TList : RandomAccessCollection, 
MutableCollection, ExpressibleByArrayLiteral, TSerializable, Hashable {
+  typealias Storage = Array
+  public typealias Indices = Storage.Indices
+
+  internal var storage = Storage()
+  public init() { }
+  public init(arrayLiteral elements: Element...) {
+self.storage = Storage(storage)
+  }
+
+  /// Mark: Hashable
+  public var hashValue : Int {
+let prime = 31
+var result = 1
+for element in storage {
+  result = prime * result + element.hashValue
--- End diff --

`&*`, `&+`?


> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-09-09 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15477946#comment-15477946
 ] 

ASF GitHub Bot commented on THRIFT-3773:


GitHub user apocolipse opened a pull request:

https://github.com/apache/thrift/pull/1084

THRIFT-3773 Swift 3 Native Library

Here is my implementation of the Thrift library for Swift 3.0, pure swift.  
There is no Objective-C requirement here. 
For implementation and design details, please refer to comments here:
https://issues.apache.org/jira/browse/THRIFT-3773?jql=text%20~%20%22swift%22
And to the README here:
https://github.com/apocolipse/thrift/tree/master/lib/swift

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apocolipse/thrift master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1084.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1084


commit 295b81ca504c3542bdf49e949cbbcb6493e1e3f1
Author: Chris Simpson 
Date:   2016-06-28T04:09:06Z

Initial 3.0 commit, copy over swift generator and update makefiles to build

commit 3faf93e9daab54351a74c5f5ea91002b95b1b7cb
Author: Chris Simpson 
Date:   2016-06-28T04:13:41Z

Removed PromiseKit option

commit a55b69a90daf6bdc1c6e0658a04c44d647ab090a
Author: Chris Simpson 
Date:   2016-06-28T17:50:15Z

Swifty Enums and function signatures

commit 0d77f8f5e6fe6b2c25af33508ddc83fbd5a5ea4a
Author: Chris Simpson 
Date:   2016-07-01T05:54:35Z

Add in lib, updated code gen

commit 105b14b0d0fbbe132de6e6db4fb153637d8ab1a6
Author: Chris Simpson 
Date:   2016-07-20T18:00:29Z

Merge branch 'master' of github.com:apache/thrift

commit cf5e1a01d82e1cee73754ffd01d9838a3bd2e7f9
Author: Chris Simpson 
Date:   2016-08-19T18:12:47Z

meh

commit 59d2d6263a5a524a5aab348ff3475fd9ed6af553
Author: Chris Simpson 
Date:   2016-08-19T18:12:51Z

Merge branch 'master' of github.com:apache/thrift

commit 6faca578da091f8ab4fe0358d26019a8665028cf
Author: Chris Simpson 
Date:   2016-08-24T19:55:47Z

Error and fileprivate

commit d8166d9a820f9d830b35b7b857cb8b8d9364521a
Author: Chris Simpson 
Date:   2016-08-25T19:08:17Z

Fix for TEnum's and constant enum value rendering

commit b0755f6d6c6e76b4a1982938df77a17aead91d1b
Author: Chris Simpson 
Date:   2016-08-25T20:50:32Z

Merge branch 'master' of https://github.com/apache/thrift

commit 8d3436f83d826c5e83066954b9eb55609ece1651
Author: Chris Simpson 
Date:   2016-09-07T19:33:21Z

Working compiler

commit 286c7a951393ee78c04405355cd1b5010fb94df9
Author: Chris Simpson 
Date:   2016-09-09T18:03:46Z

Add sources

commit fcec22a5c456be82fffa1009ea3f99b84ad4a8b8
Author: Chris Simpson 
Date:   2016-09-09T18:47:33Z

Working Library

commit 1398375fca765a7552fba3908095362f4054fe64
Author: Chris Simpson 
Date:   2016-09-09T18:48:12Z

Merge branch 'master' of https://github.com/apache/thrift




> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-08-26 Thread Chris Simpson (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15439489#comment-15439489
 ] 

Chris Simpson commented on THRIFT-3773:
---

I currently have everything I'm working on in a private repo unfortunately, 
I'll push updates to my public fork of Thrift soon.
Currently its changing quickly due to Swift 3.0 being finalized, there still 
isn't 1:1 parity on API's so I have some extensions filling in the gaps, as 
well as some things are still unimplemented (Like URLSession :/).
Good news is I've tested out Binary/Compact protocols on both OSX and Linux and 
they work great, THTTP/SessionTransport work great on OSX (again still 
unimplemented in linux :/ ), and TSocketTransport works on both platforms. I 
renamed the existing Cocoa TSocketTransport implementation that I converted to 
swift to TCFSocketTransport and created a separate TSocketTransport leveraging 
posix sockets since Input/OutputStreams are still not 100% complete in Linux 
(However once they're done we can get rid of direct stuff since InputStream 
will have getStreamsToHost()).
Also contemplated making a GCD based async socket but couldn't get it to work 
properly so temporarily shelved that idea.

One thing i'm having issue with is serialization from other languages.  I 
decided that Structs shouldn't have an empty init() case and that non-optional 
vars shouldn't be initialized with empty types (i.e. no var userID = Int32()), 
but that presents compatibility problems with other languages (python 
specifically) where empty structs can be created and written with NULL values 
for required fields that weren't set.  In reality this shouldn't be an issue as 
properly designed interfaces will ensure the server is populating any/all 
required fields, but I may throw in a strict option to default use empty 
initialization and not use it when strict is set (this creates a cleaner 
Swift-ier interface).

Other things I've not yet tested or implemented are server implementations, 
however thats what's on my plate now ;).  TSocketServer should work fine (it 
compiles and everything needed is implemented in Linux), and I've decided not 
to write an HTTPServer implementation since there's too much overhead to throw 
into the library and not an existing one within the standard library (and the 
goal is to not have any dependancies).  I may show an example of how to use a 
3rd party HTTPServer as a thrift HTTP Server however which would fulfill most 
needs for that, there are several competing Swift HTTP Server implementations 
already, and in the near future there are sure to be some even better 
performing ones now that GCD is available on Linux properly.

A few more thing I need to shore up and test are async clients, and default 
values for the code generator, as well as I'd like to try to do something for 
namespacing.  My current plan for namespacing is to have the generator dump 
generated source in subdirectories per-namespace such that they can be imported 
as separate modules into whatever project (whether it be SPM or Xcode based), 
any thoughts on this are very welcome as I havent given it much thought but 
it's something that's definitely needed (Already ran into a namespace collision 
with some IDL's we use at work where we have an `Error` struct... Apple renamed 
Swift's ErrorType to ErrorProtocol and finally Error, so in the generator I 
actually explicitly specify Swift.Error for any exception types to avoid local 
namespace collisions, but that presents a problem if its not modularized)

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-08-26 Thread Darren Mo (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15438676#comment-15438676
 ] 

Darren Mo commented on THRIFT-3773:
---

This is really great! What is the current status of this Swift language binding?

Very anxious to start using Thrift with pure Swift! I will try to help if I 
can. :-)

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> - Fully compatible with the code that is currently generated by the Cocoa 
> compiler (both Objective-C and Swift).
> - Ability to run on Linux
> - Pure Swift, no Objective-C code.
> - No dependencies on closed source apple libraries
> - Keep the same interface, so that the library is compatible with the code 
> the current cocoa compiler generates
> - Better server support that the current Objective-C library.
> - Follow the new Swift packaging format to be compatible with the Swift 
> Package manager



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (THRIFT-3773) Swift Library

2016-07-01 Thread Chris Simpson (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15358479#comment-15358479
 ] 

Chris Simpson commented on THRIFT-3773:
---

I've started working on this and have made a fair amount of progress so far so 
I'll post for others to comment on and give input, 
https://github.com/apocolipse/thrift

A couple of notes per the design goals:
- This will not be compatible with the Cocoa-Swift compiler, a new Swift 
compiler is being rewritten, and being written towards Swift 3.0 API Design 
guidelines.
- Run on Linux was the first goal
- Pure Swift library clean of any Objective-C or even Cocoa paradigms
- Only dependent on Foundation (The Swift variant coming with Swift 3.0)
- Interface will mostly be the same, but will notably be "Swift First" in 
design, so the library likely wont be directly compatible with Cocoa generated 
code and vise versa.
- Objective-C library out of scope for this
- Swift packaging has been considered but may also be out of scope, SPM is 
still in its infancy and not very flexible yet, and other alternatives are "3rd 
party" enough to ignore.

I've mostly finished the Library so far, but its still a WIP.  I'm working 
through the code generator.

A couple of notes on what I changed and why it wont be so compatible with the 
Cocoa generator/library
- Completely redone error model.  Errors are all very "Swifty", still giving 
appropriate underlying error codes and messages but with an interface for 
throwing and reading done in a clean manner (Throwing most errors is just 1 
line of code!)
- Abstracting much of the generated code to the library via protocol 
extensions.  It struck me as odd that TStruct.write() was being repeatedly 
generated for every type of struct, when it could be abstracted at the protocol 
level with reflection.  Similarly TEnum's are all RawRepresentable Int32 Enum's 
that can also be similarly abstracted in the library.  Replacing all generated 
TStruct.write() generation is a single lookup dictionary for field ID's 
generated for each struct (Which also doubles as a quick reference to field 
ID's for dev's looking at the generated code)
- Default Values!  Default values weren't handled at all in the Cocoa (Obj-C Or 
Swift) library/generators.  Additionally, non-optional properties on struct's 
were initialized with an empty version of their type!  Not only confusing (What 
is the value of `let num = Int32()` ?) but requires that all TSerializable 
structs and enums have init()'s as well, making for a headache when asking 
"whats the default value then?".  Removing `init()` requirements, and properly 
implementing non-optional values, as well as including default values for both 
struct members and service methods is a primary goal here (still havent nailed 
out how to handle service methods as protocol declarations can't have default 
values in Swift, however it can be implemented in the generated Clients, or as 
a protocol extension, and/or as a default value for the args_struct's member)
- Value Typed transports and Swift 3.0 API design.  Foundation in Swift 3.0 
gives us a value typed Data, so all the transports have been rewritten to take 
advantage of Data as a value type.  This results in cleaner code as less Unsafe 
pointers are being thrown around everywhere.  In addition, I've updated much of 
the interfaces to be more conforming to the Swift 3.0 API Guidelines, this 
means things like all TProtocol methods are named `func read() -> String` 
rather than `func readString() -> String` (per API Guidelines, remove redundant 
words!)  This can be changed if the Thrift community feels TProtocol methods at 
the least need to look the same everywhere, however I felt at the time this was 
a good fit.  Similar changes to TProcessor, TTransport, Factories, etc. were 
made to streamline naming (no extra words, don't name fields as their type, and 
so on)

Stretch goal (and somewhat implemented) - Documentation!  Thrift supports 
docstrings in IDL files for everything, transposing them to Swift would be a 
great tool when using with Xcode, option+click to look up docstrings!

Again, all a WIP and would love some feedback and input, The library is 95% 
complete (compiles fine, crude tests were successful) and the code generator is 
about 50% complete (generated code somewhat compiles)

> Swift Library
> -
>
> Key: THRIFT-3773
> URL: https://issues.apache.org/jira/browse/THRIFT-3773
> Project: Thrift
>  Issue Type: New Feature
>  Components: Swift - Library
>Reporter: Thomas Bartelmess
>
> We already have the option to generate Swift code in the Cocoa compiler, 
> however large parts of the (Objective-C) Cocoa Library still depend on Cocoa 
> and  Objective-C.
> It would be good to have a native Swift library that doesn't depend on the 
> Cocoa libraries.
> Design goals:
> -