scrml.dev v0.7.1
Reference › Keywords

is some

Existence predicate. A is some-annotated cell passes validation as long as a defined value is present — empty string IS some, zero IS some, false IS some. Only not fails it.

What it means

is some asserts that a cell holds a defined value — any defined value. It does not care whether the value is "meaningful" by domain rules. An empty string, zero, an empty array, a struct with no fields populated — all of these IS some. The only thing that fails is some is scrml's absence value, not.

Pairs with req (meaningful-value). "" IS some — but "" fails req. The two are deliberately distinct: existence and meaningfulness are different invariants, and they belong to different application domains.

Syntax

On a state cell:

<middleName: string is some> = ""
<nickname:   string is some> = ""

On a struct field:

type User:struct = {
  firstName:  string req       // must be meaningful
  middleName: string is some   // empty is fine
  lastName:   string req       // must be meaningful
}

Schema-column SQL lowering for is some is not currently enumerated in §39.5.8 (only req has an explicit NOT NULL + CHECK row). Use req on schema columns where you want the per-type empty-check CHECK constraint; leave columns unannotated where empty is fine.

Worked example

Profile edit form. The bio field is optional — an empty bio is a valid bio. We still want the field to be "present" (a defined string) for the schema, so we use is some rather than leaving the column unvalidated.

<program>

  <displayName: string req>     = "Alice"
  <bio:         string is some> = ""

  <form>
    <label>
      Display name (required)
      <input bind:value=@displayName>
      <errors of=@displayName/>
    </label>

    <label>
      Bio (optional)
      <textarea bind:value=@bio></textarea>
      <errors of=@bio/>       // never fires for empty string
    </label>

    <button disabled=!@displayName.isValid>Save</button>
  </form>

</program>

Semantics

is some is the inverse of not:

Value is some req
"" passes fails
"alice" passes passes
0 passes fails
false passes fails
[] passes fails
not fails fails

The one value that fails is some is not — scrml's single absence value. Languages with null and undefined collapse both onto not here.

When to choose is some vs req

  • Use req when the empty form-of-the-type is not a meaningful value in your domain. A user's first name. A product's price. A task's title. The empty/zero answer is an error, not a choice.
  • Use is some when the empty form-of-the-type is a meaningful answer. A user's middle name (some people don't have one). A task's description (optional). A scheduled temperature reading of 0°C (zero is a real temperature).
  • Use neither when the field is purely internal and never user-facing. A top-level single-value cell with no validator surface suppresses the .isValid synthesis (§55.5 Edge A). Note that compound cells always synthesise an .isValid surface regardless — the per-field surface composes upward via §55.5.

Related

Specification

Normative text: SPEC §42.2.5 (req vs is some, exact predicate-pair semantics) + §55.1 (universal-core predicate catalog — 14 predicates including is some and req). Spec lives at compiler/SPEC.md .