dry-configurable icon indicating copy to clipboard operation
dry-configurable copied to clipboard

Leave setting values as `Undefined` rather than coercing to `nil` for un-set settings

Open timriley opened this issue 3 years ago • 2 comments

This is something @solnic mentioned a while ago as a change he'd like to see for 1.0.0. Opening this so we can have the discussion as whether this is something we still want.

timriley avatar Apr 14 '21 00:04 timriley

Related to this would be changing the expected signature for setting value processor blocks: they must be prepared for their value argument not to be provided for undefined values, so a processor block like this:

-> v {
  # some logic
}

Must become:

-> v = "default" {
  # some logic
}

When a setting is defined with a default, however, this can just be kept as -> v { }, since the default value will always be passed.

This arrangement would encourage the authors of the setting definitions to make sure they're properly handling the case of a non-provided value in their processor blocks if no default is otherwise defined.

timriley avatar Apr 14 '21 00:04 timriley

I'm in favor. This is definitely the place that can benefit from Undefined. I wish we didn't have to break things but this is for the greater good :) Mb we could have prev behavior ... configurable (but not default).

flash-gordon avatar Apr 14 '21 06:04 flash-gordon