On Saturday 26 September 2009 04:04:22 kangax wrote:
> On Sep 24, 11:20 pm, Andrew Dupont <goo...@andrewdupont.net> wrote:
> > Unless anyone has serious objections, or has a better idea, I'm going
> > to add these as aliases of `Prototype.emptyFunction` and
> > `Prototype.K`, respectively. They belong better there, since in theory
> > the `Prototype` namespace is for internal stuff, not for stuff that
> > has value to end-user developers.
> It sure makes more sense to have those on `Function`. I kind of hate
> that we're putting yet another (completely made-up) method on yet
> another built-in native, but it looks like there's not much that can
> be done about it at this point anyway.
> As far as naming, I would probably go with `Function.empty` and
> `Function.identity` (`Function.K` looks neat but it would then make
> sense to uppercase `EMPTY` too, and I like lowercase version more).
> Now that we're on this subject, we can also add so often useful
> `Function.false` (i.e. `function(){ return false; }`). I use it all
> the time for things like preventing events -
> `someElement.onselectstart = Prototype.falseFunction;`, etc.
> Is anyone else using something like that?

I have Function.alwaysReturn( val );

So, I'd use Function.alwaysReturn( false ) in that case.

Is good for anywhere a function is expected but you want to insert a value. 
Eg, Function.alwaysReturn( 4 );

Function.alwaysReturn = 
        function ( val ){
                return (function(){return val});

my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to