ITADN

Proper default handling

#480Openalbersonmiranda 创建于 2025-10-04
A
albersonmirandacommented
From @CGMossa on Extendr Discord: >Add and document `#[extendr(default = "ARG")]` for extendr-fn. Currently, we have `#[default]`, e.g. >``` >#[extendr] >fn hello(#[default = "world"]) who: &str) { rprintln("Hello >{who}!"); } >``` >but this is undesired because of macro hygiene. A macro is supposed to use its own name with properties like default, i.e. we ought to prefer >``` >fn hello(#[extendr(default = "world")]) who: &str) { >rprintln("Hello {who}!"); } >``` >even though it is more verbose. This way, we do not introduce conflict with other proc-macros. I suggest we keep #[default], but add the proper one #[extendr(default)] and simply phase it out eventually. Currently, #[default] is not documented well enough. - [ ] Add new default handling - [ ] Document
0 条评论