mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 22:13:29 +00:00
updates manual with codegenDecl on params docs (#22333)
* documents member * Update doc/manual_experimental.md Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
This commit is contained in:
@@ -2385,8 +2385,7 @@ Notice when calling a constructor in the section of a global variable initializa
|
||||
Member pragma
|
||||
=============
|
||||
|
||||
Similar to the `constructor` and `virtual` pragmas, the `member` pragma can be used to attach a `proc` or `func` to a type in C++.
|
||||
It is more flexible than `virtual` in the sense that it accepts not only names but also operators or destructors.
|
||||
Like the `constructor` and `virtual` pragmas, the `member` pragma can be used to attach a procedure to a C++ type. It's more flexible than the `virtual` pragma in the sense that it accepts not only names but also operators and destructors.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -2439,4 +2438,4 @@ proc `()`(f: NimFunctor; n:int) {.importcpp: "#(@)" .}
|
||||
NimFunctor()(1)
|
||||
```
|
||||
Notice we use the overload of `()` to have the same semantics in Nim, but on the `importcpp` we import the functor as a function.
|
||||
This allows to easy interop with functions that accepts for example a `const` operator in its signature.
|
||||
This allows to easy interop with functions that accepts for example a `const` operator in its signature.
|
||||
|
||||
Reference in New Issue
Block a user