[swift-users] Restrict parameter to value type

Martin Knabbe m.knabbe at mytaxi.com
Thu Oct 19 05:46:51 CDT 2017

Is there a way to restrict the type of a parameter to value types only
(struct)? I know of Any and AnyObject, but I'm missing AnyValue.

How can I achieve something like the following, to make sure that the
parameter is immutable and has copy-on-write feature?

protocol Actor: class {
    func send(message: AnyValue)

I'm curious why AnyValue is missing. Can someone answer this?

Thanks in advance.

Board of Directors: Andrew Pinnington, Alistair McCann, Jonas Gumny
Commercial Register: HRB 110377

The information and attached file(s) (if any) contained in this email is 
confidential and may be legally privileged. It is intended solely for the 
addressee. Any access to this email by persons other than the addressee is 
prohibited. If you are not the addressee for whom this email is intended, 
you may not disclose, copy, distribute or store this email. If you receive 
this in error, please delete and email confirmation to the sender. Thank 
you for your cooperation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171019/7aff7a60/attachment.html>

More information about the swift-users mailing list