[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: let vs. local
this is at the margins of the language, and is subject to change.
currently, only dynamically bound (let + global scope) are consulted
for fn- and set- prefixes. i'm not sure i can defend the reasoning
which led to that behavior. at one point it seemed logical, but
it doesn't any longer. my inclincation is to change that, but i
need to think about it first. comments, anyone?
as to an equivalent of the builtin operator, i hadn't even thought
of just undefining the function until your note. i had expected to
always do something like
local (rm = `{whatis rm}) fn rm { $rm -i $* }
but i like the proposed
fn rm { let (fn rm) rm -i $* }
very much. the disadvantage that the latter form has is that if there
are multiple layers of definition (an fn rm is already defined) that
version is skipped, which is not necessarily bad. the other thing is
that this generalizes into
fn builtin func args { let (fn-^$func=) $func $args }
which is quite nice.
as a footnote, in my first example, the preferable form will become
local (rm = <>{%whatis rm}) fn rm { $rm -i $* }
at some point not too far off in the future.