Issue LOOP-WITH-NIL
Issue: LOOP-WITH-NIL

Forum: Editorial

References: LOOP

Category: CLARIFICATION/CHANGE

Edit history: 2004-07-20, Version 1 by Bruno Haible

Status: For CLiki consideration

Problem Description:

Is (loop with x of-type nil do (return x)) required to construct and return an "appropriate default value" for type NIL?

Proposal (LOOP-WITH-NIL:???):

Test case:

Rationale:

Current practice:

Cost to Implementors:

Cost to Users:

Cost of Non-Adoption:

Benefits:

Aesthetics:

Discussion:
  • Bruno Haible says: In (LOOP WITH var OF-TYPE typespec ...) the typespec can be an arbitrary type specifier, even one that is a non-recognizable empty type, e.g. (AND (SATISFIES NULL) (SATISFIES INTEGERP)). Therefore the macro expander has to be prepared to choose an arbitrary initialization value and to extend the variable's type:
(LOOP WITH var OF-TYPE (OR typespec (EQL default)) = default ...)
I'm not sure this needs to be written explicitly.