ES4 draft: Function
lhansen at adobe.com
Thu Mar 13 15:24:47 PDT 2008
> -----Original Message-----
> From: Waldemar Horwat [mailto:waldemar at google.com]
> Sent: 13. mars 2008 16:01
> To: Lars Hansen
> Cc: es4-discuss Discuss
> Subject: Re: ES4 draft: Function
> > static public function apply(fn /*: function*/, ...)
> > static public function bind(method /*: function*/, ...)
> > static public function call(fn /*: function*/, ...)
> > ...
> What does "/*: function*/" mean here? Are these arguments
> required to have the function type or not?
That is addressed in the NOTES section at the top of the document:
* The annotation '/*: function*/' below looks like that because the
reference implementation does not yet accept plain 'function' as a
type annotation to mean 'anything callable' (ticket #153).
That is, the arguments are required to be callable. (The reason it
up in the draft spec is that the code has been pulled out of the
reference implementation. (I could add code to the code snarfer that
removes the /* and the */, maybe.))
What it means to be callable is addressed in another note near the top:
<NOTE> Host functions may also not be instances of ''Function'' or its
subclasses, but must to some extent behave as if they are (see <XREF
target="Host objects">). However, host functions need not provide
''meta::invoke'' methods to be callable. The type ''function'',
defined elsewhere, matches invokable host functions even if they do
not have a ''meta::invoke'' method.
> > *Implementation*
> > The implementation of the meta function |invoke| is
> > implementation-dependent.
> Omit the implementation section altogether. Saying
> "implementation-dependent" is misleading here, as its
> behavior should not be implementation-dependent.
I understand the objection (you've made the point elsewhere as well)
and I will consider a different wording/structure.
Thanks for the comments.
More information about the Es4-discuss