-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
type
Style = ref object
color: int
proc f*(style: Style) =
if not style.isNil:
echo style.color
else:
echo style.color
f(Style(color: 2))
f(nil)I expect that f wouldn't be able to compile, as it's obvious that its fields are inaccessible in the else branch.
Nim can already prove a lot of nil related errors, so catching those should be a good step forward for type safety (nil runtime errors are obviously a very serious problem)
bluenote10