# My wishlist for the next version of Julia

**URL:** <https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987>\
**Category:** General Usage\
**Tags:** question, matlab\
**Created:** [October 18, 2021, 4:28pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987 "2021-10-18T16:28:46Z")\
**Posts on this page:** 5\
**Page:** 4

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 19, 2021, 5:34pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987/62 "2021-10-19T17:34:41Z")

</div>

Not sure if this was answered already, but I think it would still short-circuit in broadcasting. Just not the way that people wrote above.

In this example, I don’t think you’d see anything printed, although I can’t test as I’m still on an older Julia version.

```julia
function f(x)
    println("f was called")
    isodd(x)
end

x = [false, false, false]
y = [1, 2, 3]
z = x .&& f.(y)

```

I think this should be the same as this, so it shouldn’t execute `f`:

```julia
broadcast(x, y) do _x, _y
    _x && f_(y)
end

```

The examples above tried to short-circuit before the array arguments were even created, which doesn’t work.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 19, 2021, 5:44pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987/63 "2021-10-19T17:44:00Z")

</div>

In 1.7:

```julia
julia> f(x) = x
f (generic function with 2 methods)

julia> x = [true,false,true];

julia> x .&& f.([1,2,3])
3-element Vector{Integer}:
     1
 false
     3

```

or

```julia
julia> f(x) = println("I'm here $x")
f (generic function with 2 methods)

julia> x .&& f.([1,2,3])
I'm here 1
I'm here 3
3-element Vector{Union{Nothing, Bool}}:
      nothing
 false
      nothing

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 19, 2021, 6:48pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987/64 "2021-10-19T18:48:59Z")

</div>

Yup, there’s the short circuiting

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [October 19, 2021, 6:55pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987/65 "2021-10-19T18:55:55Z")

</div>

> [@MarcMush](#):
>
> other types are allowed on right side, but they are still evaluated, when they wouldn’t be with `&&` , that’s what I mean with _short-circuiting_
> 
> ```julia
> julia> false && error("not allowed")
> false
> 
> julia> [false, false] .&& error("not allowed")
> ERROR: not allowed
> Stacktrace:
> [1] error(s::String)
> @ Base .\error.jl:33
> [2] top-level scope
> @ REPL[24]:1
> 
> ```

You’re missing a dot.

```julia
julia> [false, false] .&& error.("not allowed")
2-element BitVector:
 0
 0

```

When you write `[false, false] .&& error("not allowed")` that’s a little like writing

```julia
A = [false, false]
b = error("not allowed")
C = BitVector(undef, 2) 
for i in eachindex(A)
    C[i] = A[i] && b
end

```

whereas when you write ` [false, false] .&& error("not allowed")` that instead becomes something like

```julia
A = [false, false]
C = BitVector(undef, 2) 
for i in eachindex(A)
    C[i] = A[i] && error("not allowed")
end

```

---

<div class="post-metadata">

**Author:** ![MarcMush](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marcmush/32/18006_2.png) [@MarcMush](https://discourse.julialang.org/u/MarcMush)\
**Post date:** [October 19, 2021, 9:22pm UTC](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987/66 "2021-10-19T21:22:56Z")

</div>

`.&&` just became much more intersting to me!

I will update my previous answers

[Previous page](https://discourse.julialang.org/t/my-wishlist-for-the-next-version-of-julia/69987.md?page=3)
