# \[ANN\] Pipebraces.jl – piping with braces

**URL:** <https://discourse.julialang.org/t/ann-pipebraces-jl-piping-with-braces/93718>\
**Category:** Package Announcements\
**Created:** [January 29, 2023, 1:20am UTC](https://discourse.julialang.org/t/ann-pipebraces-jl-piping-with-braces/93718 "2023-01-29T01:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qsong](https://avatars.discourse-cdn.com/v4/letter/q/d07c76/32.png) [@qsong](https://discourse.julialang.org/u/qsong)\
**Post date:** [January 29, 2023, 1:20am UTC](https://discourse.julialang.org/t/ann-pipebraces-jl-piping-with-braces/93718/1 "2023-01-29T01:20:04Z")

</div>

The idea of piping with curly braces was [proposed two months ago](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue-rev-3/90836). Here is another implementation in favor of `|> {}` instead.  
[https://github.com/ianqsong/Pipebraces.jl](https://github.com/ianqsong/Pipebraces.jl)

Take an example in the proposal post for quick comparison.

> [@Fixing the Piping/Chaining Issue (Rev 3)](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue-rev-3/90836/1):
>
> _Example from [DataPipes.jl](https://gitlab.com/aplavin/DataPipes.jl) Readme_
> 
> ```julia
> "a=1 b=2 c=3".{
> split,
> map({
> split(it, "=")
> (Symbol(it[1]) => parse(Int, it[2]))
> }, it),
> NamedTuple,
> }
> 
> ```

Using `Pipebraces.jl` it would be

```jl
julia> "a=1 b=2 c=3" |> {
       split;
       @. split(_, "=");
       map(Symbol(_[1]) => parse(Int, _[2]), __);
       NamedTuple
       }
(a = 1, b = 2, c = 3)

```

`Pipebraces.jl` is a small extension to the surface syntax of `Julia Base` and I would like it to be a simple/straightforward piping tool for prototyping. (It’s not necessary to use the syntax for production code.) For more detailed usage please read [README](https://github.com/ianqsong/Pipebraces.jl#readme).

From the previous discussion in the proposal post I know the new syntax of `|> {}` doesn’t meet everyone’s need. But all improvement suggestions are very welcome.

---

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [January 29, 2023, 1:55am UTC](https://discourse.julialang.org/t/ann-pipebraces-jl-piping-with-braces/93718/2 "2023-01-29T01:55:13Z")

</div>

If you prefer to use `|>`, with [my implementation](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue-rev-3/90836) you can already write:

```julia
julia> "a=1 b=2 c=3" |> {
           split
           @. split(it, "=")
           map({Symbol(it[1]) => parse(Int, it[2])}, it)
           NamedTuple
       }
(a = 1, b = 2, c = 3)

```

(although, as previously [explained](https://discourse.julialang.org/t/fixing-the-piping-chaining-issue-rev-3/90836/41), there are reasons to prefer `obj.{...}` over `obj |> {...}`)

What do you believe to be the advantages of this approach over my proposal?

---

<div class="post-metadata">

**Author:** ![qsong](https://avatars.discourse-cdn.com/v4/letter/q/d07c76/32.png) [@qsong](https://discourse.julialang.org/u/qsong)\
**Post date:** [January 29, 2023, 5:45am UTC](https://discourse.julialang.org/t/ann-pipebraces-jl-piping-with-braces/93718/3 "2023-01-29T05:45:49Z")

</div>

They now look like twins in this example. But if you take a look at the source codes they are two different implementations (I didn’t check your up-to-date version though).

`Pipebraces.jl` intends to stay with `Base` as close as possible. I mean without `|>` call, curly braces in `Pipebraces.jl` behavior the same as in `Base`.

```plaintext
julia> 1 |> {sin(_^2)}
0.8414709848078965
julia> {sin(_^2)}
ERROR: syntax: { } vector syntax is discontinued around REPL[9]:1
Stacktrace:
 [1] top-level scope

```
