-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
exporting normalizePathEnd #13000
exporting normalizePathEnd #13000
Conversation
seems like the best way to me |
What do you think about renaming the copy version to |
my 2 cents: I know there's a precedent for that (eg:
but ok with whatever you decide :) |
Divergent symbols are easier to recognize in IDE completion and easier to control in import statements, but if no one wants to rename it, I'm fine with it as is. |
The problem with this PR is that technically speaking you're relying on a compiler bug to achieve this. |
the "compiler bug" is IMO the more useful, consistent, less surprising behavior (and I've written code relying on that); we can just update the spec accordingly. The use-case in this PR is a good example; if we followed current spec, it'd lead to less DRY code. |
Hence my first comment. How would you like to do it? |
Agreed, however it then needs to have tests of its own to ensure we don't break this feature. And this also includes little things like "nim doc needs to list every exported proc..." |
proc main()=discard
export main just checked, |
|
||
else: | ||
proc normalizePathEnd(path: var string, trailingSep = false) = | ||
## Ensures ``path`` has exactly 0 or 1 trailing `DirSep`, depending on |
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.
i really don't like code duplication and we don't need runnableExamples + unittest for this un-exported version, all this is already in normalizePathEnd*
let's wait until #13123 is merged, then the simple: when (NimMajor, NimMinor) >= (1, 1):
export normalizePathEnd would work, avoiding all the above issues |
56e3780
to
cfbefc4
Compare
@disruptek #13123 got merged so you can now rebase against latest devel and use the simple
|
@timotheecour It still needs to be documented. |
this is what I mean: #13152 ; it shows documentation correctly and is simpler than this PR (and DRY) |
Nice. |
I dunno if this is the best way to conditionally export this proc in 1.1.