Skip to content

Commit abf6152

Browse files
authored
Removed deprecations for @pack (#102)
Updated docs for PR 101
1 parent 86796e9 commit abf6152

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

docs/src/manual.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ specialized packing of datatypes.
258258
## The type-specific (un)pack macros (somewhat dangerous)
259259
260260
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:
262262
263263
```julia
264264
function fn(var, pa::Para)
@@ -273,6 +273,11 @@ end
273273
out, pa = fn(7, pa)
274274
```
275275
276+
When needing a new instance, e.g. for immutables, use the no-bang version:
277+
```
278+
pa2 = @pack_Para
279+
```
280+
276281
However, note that the (un-)packing macros which unpack all fields
277282
have a few pitfalls, as changing the type definition will change what
278283
local variables are available in a function using `@unpack_*`. Examples:

src/Parameters.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,6 @@ macro pack!(args)
788788
esc(_pack_bang(args))
789789
end
790790

791-
macro pack(args)
792-
Base.depwarn("The macro `@pack` is deprecated, use `@pack!`", Symbol("@pack"))
793-
esc(_pack_bang(args))
794-
end
795791
function _pack_bang(args)
796792
args.head!=:(=) && error("Expression needs to be in the form of an assignment.")
797793
suitecase, items = args.args

0 commit comments

Comments
 (0)