You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Borrows are module level operations that should be easy. Making them easier involves a way to quickly and easily select a module a procedure name and whether to export them
Consider the following:
typeNotString=distinctstringfromsystemborrow add # Borrows all `add` from system and does not export themimport std/strutils
fromstrutilsborrow contains*for NotString
proc contains(s: string, chars: set[char]): bool {.borrow.}
# The above replaces the exported with an unexported contains,# leaving the `contains(s, sub: string): bool` variant exported
Rules for this borrowing:
The old borrow syntax can still be used, but is preferred to use just for overridding export level (Still looking for a better way)
Module must be included in borrowing
Multiple borrows can happen at once borrow from strutils contains, capitalizeAscii for NotString borrow strutils.contains, system.add for NotString
Export marker can be applied to export all borrows from a statement
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Borrows are module level operations that should be easy. Making them easier involves a way to quickly and easily select a module a procedure name and whether to export them
Consider the following:
Rules for this borrowing:
borrow from strutils contains, capitalizeAscii for NotString
borrow strutils.contains, system.add for NotString
Beta Was this translation helpful? Give feedback.
All reactions