From 140de09c68d2697c6b787873caf0b4445edb6374 Mon Sep 17 00:00:00 2001 From: Twan Koolen Date: Thu, 21 Dec 2017 09:51:32 +0100 Subject: [PATCH] [ci skip] Improve broadcast! extension docs. --- doc/src/manual/interfaces.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/src/manual/interfaces.md b/doc/src/manual/interfaces.md index 19c83f222a681..bf4d4ed09df07 100644 --- a/doc/src/manual/interfaces.md +++ b/doc/src/manual/interfaces.md @@ -618,3 +618,12 @@ broadcast!(f, dest, ::MyBroadcastStyle, As...) ``` Note the lack of bounds on `f`, `dest`, and `As...`. + +Third, simultaneously specializing on both the type of `dest` and the `BroadcastStyle` is fine. In this case, +it is also allowed to specialize on the types of the source arguments (`As...`). For example, these method signatures are OK: + +```julia +broadcast!(f, dest::DestType, ::MyBroadcastStyle, As...) +broadcast!(f, dest::DestType, ::MyBroadcastStyle, As::AbstractArray...) +broadcast!(f, dest::DestType, ::Broadcast.Scalar, As::Number...) +```