[nem-en] literal pattern matching

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Sep 24 10:20:04 CEST 2004


"Wiktor Zychla" <wzychla at vulcan.edu.pl> writes:

> Note, that k is bound inside the method body and should probably not
> be treated like a free-variable to match with any value of n. Instead,
> as bound variable, it probably should be matched "by value".

(IMHO you used these adjectives are backward. You want it to be
*bound* by the match, not *free* i.e. referring to a value defined
outside.)

How would you distinguish whether an identifier means "bind the
variable here" or "compare with its value"?

If you would do this by checking whether it has been defined, it
would be a bad idea, because the only way to ensure that this is
its definition would be to check that it has not been defined in
any active scope. Such "negative checks" should not be required.

SML has this problem with distinguishing constructors from variables.
Other similar languages fixed it by distinsuishing them by letter case.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/




More information about the devel-en mailing list