Re: [swift-evolution] Support for newtype feature/typesafe calculations

2016-01-06 Thread James Campbell via swift-evolution
I've managed to implement this already in the language with a few ugly corners due to the lack of generic protocols. I created a protocol based on Box (https://github.com/robrix/Box/) which works really well. I have extended this to handle certain special protocols like Equatable so you can do

[swift-evolution] Support for newtype feature/typesafe calculations

2016-01-05 Thread Grzegorz Adam Hankiewicz via swift-evolution
Hello, newcomer here. The other day I was reading about https://www.reddit.com/r/swift/comments/3zbk64/type_math/ and given the verbose solutions decided to pitch a possible language improvement. But after reading through the archives it seems that this idea has already been pitched before: *

Re: [swift-evolution] Support for newtype feature/typesafe calculations

2016-01-05 Thread Jeremy Pereira via swift-evolution
I’m not saying your proposal would not be useful, but in the case of all of your examples, there are solutions that can be implemented now that might be better than just creating a new-type-but-exactly-the-same. > On 5 Jan 2016, at 16:11, Grzegorz Adam Hankiewicz via swift-evolution >

Re: [swift-evolution] Support for newtype feature/typesafe calculations

2016-01-05 Thread Thorsten Seitz via swift-evolution
> Am 05.01.2016 um 17:11 schrieb Grzegorz Adam Hankiewicz via swift-evolution > : > > The ideal would be for the compiler to pretend Euros or RefTablePk are > different types, yet use their parent type at the binary level. This needs a > specific syntax to teach the

Re: [swift-evolution] Support for newtype feature/typesafe calculations

2016-01-05 Thread Matthew Johnson via swift-evolution
> On Jan 5, 2016, at 11:16 AM, Thorsten Seitz via swift-evolution > wrote: > > >> Am 05.01.2016 um 17:11 schrieb Grzegorz Adam Hankiewicz via swift-evolution >> : >> >> The ideal would be for the compiler to pretend Euros or RefTablePk

Re: [swift-evolution] Support for newtype feature/typesafe calculations

2016-01-05 Thread Matthew Johnson via swift-evolution
Thanks for doing the work to collect links related to this topic! I am planning to give them a read. You may be interested in the proposal I am working on for automatic protocol forwarding. The first draft was posted to the list last week: