# Discusson about &

**URL:** <https://forum.crystal-lang.org/t/discusson-about/6276>\
**Category:** Crystal Contrib\
**Created:** [January 8, 2024, 4:25am UTC](https://forum.crystal-lang.org/t/discusson-about/6276 "2024-01-08T04:25:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![femto](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/femto/32/2246_2.png) [@femto](https://forum.crystal-lang.org/u/femto)\
**Post date:** [January 8, 2024, 4:25am UTC](https://forum.crystal-lang.org/t/discusson-about/6276/1 "2024-01-08T04:25:15Z")

</div>

Hello, &.call is the same thing of calling method on first arg,  
is it same as &:call in ruby?

Coming from ruby background, I’m quite confused by that,  
I have to mentally translate &.call to &:call,  
in ruby &. means safe navigation operator

&sth means calling to\_proc on it  
so foo(&sth) →   
if sth is already a proc, to\_proc is same as itself, otherwise calls to\_proc on it,  
you can &:foo because Symbol has to\_proc

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [January 8, 2024, 4:36am UTC](https://forum.crystal-lang.org/t/discusson-about/6276/2 "2024-01-08T04:36:17Z")

</div>

~~I’m not sure I follow what the question is, or what you’re suggesting?~~

`some_method &.foo` is the same as `some_method { |x| x.foo }` in Crystal. if thats what `&:foo` does in ruby, then yes they’re the same. Could consider adding that to [Crystal for Rubyists - Crystal](https://crystal-lang.org/reference/1.10/crystal_for_rubyists/index.html).

---

<div class="post-metadata">

**Author:** ![jgaskins](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/jgaskins/32/2449_2.png) [@jgaskins](https://forum.crystal-lang.org/u/jgaskins)\
**Post date:** [January 8, 2024, 5:49am UTC](https://forum.crystal-lang.org/t/discusson-about/6276/3 "2024-01-08T05:49:02Z")

</div>

It’s the same idea as the `Symbol#to_proc` shorthand in Ruby, yes. But it’s also more powerful in that you can pass arguments and chain method calls. In Ruby, if you want to do that, you can’t use the shorthand.

```crystal
# foo { |x| x.call("bar").baz }
foo(&.call("bar").baz)

```

One place this is super useful is in [`Log`](https://crystal-lang.org/api/1.10.1/Log.html) in the standard library. When you log things, the block yields a `Log::Emitter` which has an `emit` method so you can pass metadata for your log entries:

```crystal
log.debug &.emit "log message", foo: "bar", omg: "lol"

```
