Stream: beginners

Topic: if True


view this post on Zulip Matthias Toepp (Apr 20 2023 at 14:03):

Does/should a single line if work in the repl?
What am I doing wrong?

» if True then "a" else "b"
thread 'main' panicked at 'invalid cond_layout: Erroneous', crates/compiler/mono/src/ir.rs:6637:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Folkert de Vries (Apr 20 2023 at 14:09):

you need Bool.true for technical reasons

view this post on Zulip Matthias Toepp (Apr 20 2023 at 14:17):

@Folkert de Vries
I kind of knew Bool.true but was a thing but was thrown off because True seemed to be a value... but it makes sense that I'm just defining a new tag on the fly named True.
Thanks!

view this post on Zulip Notification Bot (Apr 20 2023 at 15:59):

3 messages were moved here from #beginners > Is Infinity or NaN by Richard Feldman.

view this post on Zulip Richard Feldman (Apr 20 2023 at 15:59):

oh we should totally give a special-cased error for this!

view this post on Zulip Richard Feldman (Apr 20 2023 at 16:00):

people coming from Elm or Python likely expect it to be True and False

view this post on Zulip Anton (Apr 21 2023 at 08:34):

I wrote up an issue: #5318


Last updated: Jul 06 2025 at 12:14 UTC