Skip to content

Conversation

sabiwara
Copy link
Contributor

@sabiwara sabiwara commented Jan 23, 2025

Taking 40164fc one step further and support and/or boolean operators, leveraging the new list of nodes approach:

Screenshot 2025-01-23 at 19 26 58

Basically we'll generate these:

# node 1
{:multi_value, {:falsy, [], nil}, result = falsy}

# node 2
(
  result = result || x
  {:multi_value, {:||, [], [{:falsy, [], nil}, {:x, [], nil}]}, result}
)

# node 3
(
  result = result && 1 / x
  {:value, {:&&, [], [...args]},, result}
)

I think __block__ would make sense too and could be done in a same way.

@sabiwara sabiwara merged commit fb7a22e into elixir-lang:main Jan 23, 2025
8 of 9 checks passed
@sabiwara sabiwara deleted the dbg-and-or branch January 23, 2025 08:25
@sabiwara
Copy link
Contributor Author

@josevalim for code blocks, I think we could do it if we simplify it a bit (no loss IMHO):

(a=1; b=2; a + b) |> dbg()

Current:

Code block:
(
  a = 1 #=> 1
  b = 2 #=> 2
  a + b #=> 3
)

Instead I propose:

a = 1 #=> 1
b = 2 #=> 2
a + b #=> 3

WDYT?

@josevalim
Copy link
Member

Agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants