Declare -- was Re: [E-Lang] ERTP-aware MintMaker

Dean Tribble
Fri, 16 Feb 2001 14:11:16 -0800

For starters, please, please use a new subject when introducing a new 
construct/discussion topic.

The following strenuous objections may lead to some guidelines for 
determining the new syntax.

- it makes 'def' violate the fundamental scoping rule (major)

- it makes it lexically inobvious whether a 'def' introduces a new name or 
not--you can't tell whether you need to look before it (major)

- it introduces another keyword that binds names (minor)

- it's not clear which occurrence (the declare or the def) can have value 
guards, etc.

The above concerns drive towards a syntax in which resolving the promise is 
not a declaration syntax (because the value has already been 
declared).  Thus, figure out that syntax first, and the guard desires will 
drive the declaration issues.  For example,

def foo

with no value provided makes it a promise for 'foo' (though a ValueGuard 
would be allowed).

resolve(foo) := bar

would resolve 'foo' to be 'bar'.  In the above, 'def foo' could be 
approximated as

def [foo, foo__resolver] := PromiseMaker new

and 'resolve(foo)' becomes


Conceivably you could use a different keyword instead of 'def' (e.g., 
'promise'), but

- the above syntax is otherwise illegal
- it would not make sense to use a Promise in a  'var' slot
- it permits of ValueGuards in exactly one (syntactically familiar) place
- the immutability properties required by 'def' are preserved (it never has 
a different value)

It seems like this is worth considering.  I would prefer a more obvious 
syntax to the 'resolve(foo)', though.