-
-
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
add decls.byLent, turns an expression into a let
#14875
Conversation
let
Meh, before allowing |
I can't find an example where it produces unsafe code (of the form: stack variable escapes its stack frame). eg, this works: when true:
proc byLent2[T](a: T): lent T =
result = a
proc baz: auto = [3,4]
proc main()=
let s0 = [12,13]
let s = byLent2(baz())
let s2 = [12,13]
doAssert s == [3,4]
main() but even if such examples existed, |
The way |
I don't like having to use/remember arbitrarily different names like: that leaves these 2 options:
I'd be fine with standardizing on option 2, but it'd require the |
@Araq PTAL,
|
No, it's not. It was a mistake to add to os.nim, it misuses overloading and needs to be deprecated. In fact, we need compiler support to prevent this from happening again. Overloading by |
And btw, the fact that these procs lack the export marker was super confusing. since((1, 1)):
export normalizePathEnd is also not code that should be supported, export is for forwarding, not for avoiding the export stars! |
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions. |
add decls.byLent which turns an argument into a let-param; one use case is forcing a
let param
overload.this was kind of blocked by
now that these
lent
bugs have been fixed (#14578 and #14557 and #14576), this is worthwhile.which is a reduction of the only test failure I'm getting in #14869, for package https://github.com/Vindaar/ggplotnim
2020-07-01T10:34:35.1020690Z /Users/runner/.nimble/pkgs/ginger-0.2.5/ginger.nim(1358, 40) Error: expression 'updateScale(view, it)' has no type (or is ambiguous)
using
byLent
is the correct way to handle this IMO