Re: Closures versus objects
Steve Dekorte <[email protected]>
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On 17 Feb 2007, at 12:17 pm, Mike Newhall wrote:
> They might be separate issues. For example, in the presence of
> generic functions, which are dispatched dynamically on type and do
> not introduce any new syntax at the call site, one can have the
> best of both worlds and do things like:
>
> move_first_to_last = function(seq) { atInsert(seq, 0, popLast
> (seq)) }
>
> 'seq' just needs to be a type for which the two generics used are
> implemented, the same requirement as in using methods.
What might be separate issues? To be clear, I didn't say you couldn't
do dynamic dispatch with functions (I specifically said you could)
but at the cost of having two different semantics (static and
dynamic) and the result feeling like one language implemented on top
of another. If the semantics are always dynamic (and types are
mutable), then the only difference AFAICS is syntax.
- Steve