Difference between Apple and Linux versions of Swift - CompareOptions


(Jon Hoffman) #1

With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon


(Zhao Xin) #2

I think they should be the same when Swift 3 release. You example is just
how API will change from Swift 2 to 3. You can file a bug if you want to
speed up the changing.

Zhaoxin

···

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users < swift-users@swift.org> wrote:

With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jon Hoffman) #3

Thank you for the reply. I am pretty sure that you are correct about them being the same when Swift 3 is released. I am more concerned about which API will be the correct one when Swift 3 is officially released. My assumption is the Xcode version will be the final one but just wanted to verify it.
Thanks

Jon

···

On Jul 10, 2016, at 9:43 PM, Zhao Xin <owenzx@gmail.com> wrote:

I think they should be the same when Swift 3 release. You example is just how API will change from Swift 2 to 3. You can file a bug if you want to speed up the changing.

Zhaoxin

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(Zhao Xin) #4

You are right, the shorter one will exist in the final release. Always the
shorter ones.

Zhaoxin

···

On Mon, Jul 11, 2016 at 9:50 AM, Jon Hoffman <hoffman.jon@gmail.com> wrote:

Thank you for the reply. I am pretty sure that you are correct about them
being the same when Swift 3 is released. I am more concerned about which
API will be the correct one when Swift 3 is officially released. My
assumption is the Xcode version will be the final one but just wanted to
verify it.
Thanks

Jon

On Jul 10, 2016, at 9:43 PM, Zhao Xin <owenzx@gmail.com> wrote:

I think they should be the same when Swift 3 release. You example is just
how API will change from Swift 2 to 3. You can file a bug if you want to
speed up the changing.

Zhaoxin

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users < > swift-users@swift.org> wrote:

With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Tony Parker) #5

Feel free to file issues for us at bugs.swift.org <http://bugs.swift.org/> when you find these kinds of things. Since we have two different source code bases for these APIs, we need to find and fix these kinds of mismatches. This year has had a lot of renaming, so hopefully once we get them all done we should be good to go in the future.

- Tony

···

On Jul 10, 2016, at 6:50 PM, Jon Hoffman via swift-users <swift-users@swift.org> wrote:

Thank you for the reply. I am pretty sure that you are correct about them being the same when Swift 3 is released. I am more concerned about which API will be the correct one when Swift 3 is officially released. My assumption is the Xcode version will be the final one but just wanted to verify it.
Thanks

Jon

On Jul 10, 2016, at 9:43 PM, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

I think they should be the same when Swift 3 release. You example is just how API will change from Swift 2 to 3. You can file a bug if you want to speed up the changing.

Zhaoxin

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jon Hoffman) #6

Thank you for the reply. I just filed the issue (SR-2056) and if I find any more I will file them as well.

···

On Jul 12, 2016, at 6:12 PM, Tony Parker <anthony.parker@apple.com> wrote:

Feel free to file issues for us at bugs.swift.org <http://bugs.swift.org/> when you find these kinds of things. Since we have two different source code bases for these APIs, we need to find and fix these kinds of mismatches. This year has had a lot of renaming, so hopefully once we get them all done we should be good to go in the future.

- Tony

On Jul 10, 2016, at 6:50 PM, Jon Hoffman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Thank you for the reply. I am pretty sure that you are correct about them being the same when Swift 3 is released. I am more concerned about which API will be the correct one when Swift 3 is officially released. My assumption is the Xcode version will be the final one but just wanted to verify it.
Thanks

Jon

On Jul 10, 2016, at 9:43 PM, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

I think they should be the same when Swift 3 release. You example is just how API will change from Swift 2 to 3. You can file a bug if you want to speed up the changing.

Zhaoxin

On Mon, Jul 11, 2016 at 6:13 AM, Jon Hoffman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
With Swift 3.0 Preview 2 for Linux and Xcode Beta 2 for macOS, I see a
difference in the CompareOptions when I use the range(of:option:)
method of the String type. For example, in Xcode I use this code:

      if let newMatch = str.range(of: regExFindMatchString, options:
.regularExpression) {
            return str.substring(with: newMatch)
        } else {
            return nil
        }

notice the .regularExpression. However in the Linux version I need to
use the .regularExpressionSearch option like this:

    if let newMatch = str.range(of:regExFindMatchString, options:
.regularExpressionSearch) {
         return str.substring(with: newMatch)
    } else {
         return nil
    }

Is it safe to assume that the version that works with Xcode is going
to be the correct version once Swift 3.0 is released?

Thanks

Jon
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users