New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace all runtime platform checks with linktime conditions #3335
Replace all runtime platform checks with linktime conditions #3335
Conversation
@@ -836,8 +836,10 @@ object File { | |||
|
|||
// found an absolute path. continue from there. | |||
case link if link(0) == separatorChar => | |||
if (Platform.isWindows() && strncmp(link, c"\\\\?\\", 4.toUInt) == 0) | |||
path | |||
if (isWindows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be possible to remove the include of Platform
.
I was moving quickly, but I did not see any other uses of it in the this new file.
This PR is a public service, thank you. It eliminates some artifacts of Evolution. I looked at the network related files. A quick scan for concept, not character by character. I did not see any edits to |
Thank you for the review!
This is a good question. These are public APIs and they are implemented slightly differently than |
I think the APIs are public in the sense of "having been in SN variants released to the wild" not public Please double check my thinking, too easy to throw the baby out with the bath water. There might be C code backing the Platform
Yes, I myself have been left pondering when to use I am a big fan of the Python "one way to do things" concept. |
This is correct, these are Native lib APIs that are not private to Scala Native.
Well, there is some nuance here 😅 I described the However, even though the scala-native/nativelib/src/main/resources/scala-native/platform/platform.c Lines 15 to 37 in 26830d4
Although in other instances they may also do runtime checks e.g. scala-native/nativelib/src/main/resources/scala-native/platform/platform.c Lines 49 to 56 in 26830d4
In any case, at least for the current checks we have in |
OK, I think I have found a counter example which argues for keeping
At first blush, it looks like some Platform.c code could be eliminated and Platform.scala So, leaving the .c code, possibly with a comment in Platform.scala might defer diving |
Upon further investigation: Rationalizing/unifying I hereby withdraw my proposal to rationalize |
You can rebase it on top of #3337 when it's merge to get rid of failing tests in tools/test |
…ative#3335) (cherry picked from commit 5820225)
(cherry picked from commit 5820225)
No reason to pay a performance penalty at runtime when we can elide the useless code at linking time.