Re: Reference and First-Class Function
"Vladimir Nesterovsky" <[email protected]> Sat, 20 Dec 2008 22:48:33 +0200
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Dimitre,
You may approach to this problem from two different perspectives:
1. Postulate existance of function closures,
and derive references from closures.
2. Postulate existance of references and indirect function calls,
and derive closures from these constructs.
If there were inline functions I would prefer 1.
If I had to model these features through extension functions
and extension objects only, I would use 2.
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com
> > Once again, closures "have references" to external variables.
>
> > As I said even in my previous message, a closure contains a
> > reference.
>
> Or put in another way: if you get closures, you get references.
This statement ignores the fact that the term "reference" is used in the
definition of "closure" I quoted the definition of closure from Wikipedia
and the places where the term "reference" is used.
>
> > A closure relies on the concept of reference being already
> > implemented.
>
> I wouldn't put it like that. Closures does not rely on the feature
> of reference being available in the language, even if their
> implementation needs to provide that in some way.
A very interesting statement... :) So, we confess of having to use
references ... from somewhere...???
Then we deny references existed when we used them...
Then we say: We give you references *for free* !
This made my day, Thank you.
>
> And as Michael showed us, if you get closures, you get references for
> free.
Of course -- as you already have *references* inside the closure!
Dr. Kay did't show anything. He expressed his believes on the topic.
On the other side, I provided quotes to the definition of closure. This is
not my belief, but the oficial definition.
The definition of closure uses references, so it is not what Dr. Kay is
speaking about.
Therefore, it would be correct if Dr. Kay stops calling "closure" the thing
he is talking about, rename it to something else, and most importantly, show
how this "something else" can create a reference out of thin air.