NSRange error in docker

Hi,

I am using swift in a docker container. Now I wanted to use NSRange, which
according to the page is already fully implemented for linux.

However when I try to use 'lowerBound' or 'upperBound' it gives me the
following error:

error: value of type 'NSRange' (aka '_NSRange') has no member 'lowerBound'

I have looked into the implementation of NSRange in corelibs-foundation
<https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSRange.swift>,
where I can see that both properties have been defined in an extension.

Unfortunately, it seems that I can only use things defined on _NSRange and
not on its alias NSRange. Do you guys have any idea, what I am doing wrong?

Best regards,

Barbara

Interesting, those extensions aren't public for some reason which prevents their usage from outside of Foundation module. I’m curious if that was intentional due to unfinished work or something or they just forgot to export them.

Best regards,
Ludwig

···

25 сент. 2017 г., в 16:40, Barbara Reichart via swift-users <swift-users@swift.org> написал(а):

Hi,

I am using swift in a docker container. Now I wanted to use NSRange, which according to the page is already fully implemented for linux.
However when I try to use 'lowerBound' or 'upperBound' it gives me the following error:

error: value of type 'NSRange' (aka '_NSRange') has no member 'lowerBound'

I have looked into the implementation of NSRange in corelibs-foundation <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSRange.swift>, where I can see that both properties have been defined in an extension.
Unfortunately, it seems that I can only use things defined on _NSRange and not on its alias NSRange. Do you guys have any idea, what I am doing wrong?

Best regards,
Barbara
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

That's not how extensions in Swift work. All of those functions are definitely available.

Barbara, can you post your source somewhere? And can you check that your Docker image is actually new enough, using `swift --version`? (The Swift project doesn't publish an official Docker image, so unless you made it yourself from a package at swift.org <http://swift.org/> you could easily be using something out-of-date.)

Jordan

···

On Sep 25, 2017, at 15:06, Людвиг Вальда Васкес via swift-users <swift-users@swift.org> wrote:

Interesting, those extensions aren't public for some reason which prevents their usage from outside of Foundation module. I’m curious if that was intentional due to unfinished work or something or they just forgot to export them.

Best regards,
Ludwig

25 сент. 2017 г., в 16:40, Barbara Reichart via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> написал(а):

Hi,

I am using swift in a docker container. Now I wanted to use NSRange, which according to the page is already fully implemented for linux.
However when I try to use 'lowerBound' or 'upperBound' it gives me the following error:

error: value of type 'NSRange' (aka '_NSRange') has no member 'lowerBound'

I have looked into the implementation of NSRange in corelibs-foundation <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSRange.swift>, where I can see that both properties have been defined in an extension.
Unfortunately, it seems that I can only use things defined on _NSRange and not on its alias NSRange. Do you guys have any idea, what I am doing wrong?

Best regards,
Barbara
_______________________________________________
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

I’m not sure. As far as i know only extension which declare a protocol conformance for a type will have same visibility as type they implement it for. But if you simply extend a type, this extension will be internal by default.

Best regards,
Ludwig

···

26 сент. 2017 г., в 1:28, Jordan Rose <jordan_rose@apple.com> написал(а):

That's not how extensions in Swift work. All of those functions are definitely available.

Barbara, can you post your source somewhere? And can you check that your Docker image is actually new enough, using `swift --version`? (The Swift project doesn't publish an official Docker image, so unless you made it yourself from a package at swift.org <http://swift.org/> you could easily be using something out-of-date.)

Jordan

On Sep 25, 2017, at 15:06, Людвиг Вальда Васкес via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Interesting, those extensions aren't public for some reason which prevents their usage from outside of Foundation module. I’m curious if that was intentional due to unfinished work or something or they just forgot to export them.

Best regards,
Ludwig

25 сент. 2017 г., в 16:40, Barbara Reichart via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> написал(а):

Hi,

I am using swift in a docker container. Now I wanted to use NSRange, which according to the page is already fully implemented for linux.
However when I try to use 'lowerBound' or 'upperBound' it gives me the following error:

error: value of type 'NSRange' (aka '_NSRange') has no member 'lowerBound'

I have looked into the implementation of NSRange in corelibs-foundation <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSRange.swift>, where I can see that both properties have been defined in an extension.
Unfortunately, it seems that I can only use things defined on _NSRange and not on its alias NSRange. Do you guys have any idea, what I am doing wrong?

Best regards,
Barbara
_______________________________________________
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

Ah, seems i’m wrong in my conclusions, methods and properties in those extensions are marked as public, which makes them accessible from outside of Foundation module.
Sorry for confusing.

Best regards,
Ludwig

···

26 сент. 2017 г., в 1:36, Людвиг Вальда Васкес via swift-users <swift-users@swift.org> написал(а):

I’m not sure. As far as i know only extension which declare a protocol conformance for a type will have same visibility as type they implement it for. But if you simply extend a type, this extension will be internal by default.

Best regards,
Ludwig

26 сент. 2017 г., в 1:28, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> написал(а):

That's not how extensions in Swift work. All of those functions are definitely available.

Barbara, can you post your source somewhere? And can you check that your Docker image is actually new enough, using `swift --version`? (The Swift project doesn't publish an official Docker image, so unless you made it yourself from a package at swift.org <http://swift.org/> you could easily be using something out-of-date.)

Jordan

On Sep 25, 2017, at 15:06, Людвиг Вальда Васкес via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Interesting, those extensions aren't public for some reason which prevents their usage from outside of Foundation module. I’m curious if that was intentional due to unfinished work or something or they just forgot to export them.

Best regards,
Ludwig

25 сент. 2017 г., в 16:40, Barbara Reichart via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> написал(а):

Hi,

I am using swift in a docker container. Now I wanted to use NSRange, which according to the page is already fully implemented for linux.
However when I try to use 'lowerBound' or 'upperBound' it gives me the following error:

error: value of type 'NSRange' (aka '_NSRange') has no member 'lowerBound'

I have looked into the implementation of NSRange in corelibs-foundation <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSRange.swift>, where I can see that both properties have been defined in an extension.
Unfortunately, it seems that I can only use things defined on _NSRange and not on its alias NSRange. Do you guys have any idea, what I am doing wrong?

Best regards,
Barbara
_______________________________________________
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

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