File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ specialized packing of datatypes.
258
258
## The type-specific (un)pack macros (somewhat dangerous)
259
259
260
260
The `@with_kw` macro automatically produces type-specific (un-)pack
261
- macros of form `@unpack_TypeName` and `@pack_TypeName! ` which unpack/pack all fields:
261
+ macros of form `@unpack_TypeName`, `@pack_TypeName!`, and `@pack_TypeName` which unpack/pack all fields:
262
262
263
263
``` julia
264
264
function fn (var, pa:: Para )
273
273
out, pa = fn (7 , pa)
274
274
```
275
275
276
+ When needing a new instance, e.g. for immutables, use the no-bang version:
277
+ ```
278
+ pa2 = @pack_Para
279
+ ```
280
+
276
281
However, note that the (un-)packing macros which unpack all fields
277
282
have a few pitfalls, as changing the type definition will change what
278
283
local variables are available in a function using `@unpack_*`. Examples:
Original file line number Diff line number Diff line change @@ -788,10 +788,6 @@ macro pack!(args)
788
788
esc (_pack_bang (args))
789
789
end
790
790
791
- macro pack (args)
792
- Base. depwarn (" The macro `@pack` is deprecated, use `@pack!`" , Symbol (" @pack" ))
793
- esc (_pack_bang (args))
794
- end
795
791
function _pack_bang (args)
796
792
args. head!= :(= ) && error (" Expression needs to be in the form of an assignment." )
797
793
suitecase, items = args. args
You can’t perform that action at this time.
0 commit comments