Small doc improvements for std/with#17556
Conversation
| ## use `arg` as the first argument. | ||
| ## **This evaluates `arg` multiple times!** | ||
| ## | ||
| ## .. caution:: This evaluates `arg` multiple times! |
There was a problem hiding this comment.
add / integrate an example showing _ and add explain we can use _ in the doc comment (allows cases where we don't replace the "first argument")
var x = 1
var y = 100
with x:
+=2
*=10
y+=_
assert (x, y) == (30, 130)
IMO we should, in future PR. I'm in favor of splitting large modules (times, os, sugar etc) into smaller ones + re-exporting those in the original large module, which allows granular access when needed (cyclic dependencies etc) or easy access to all symbols by default.
trickier than it seems, but it's possible, using similar implementation as (or reusing) #13750, but that would deserve its own PR. |
Some notes:
sincepragma can't be used here (see template/macro pragmas don't work in templates (eg:byaddr,sinceetc) #15920), at least it has no effect on the generated documentation.withis not part of thesugarmodule? If not, should this perhaps be reexported bysugarin the future?withmacro evaluatesargmultiple times, should this be changed to only evaluate it once? If not, what are the reasons for this (should be documented imo)?