jashkenas/coffee-script — Issue #1917: Running a function without ()
Author: johnnywengluu
Created: 2011-12-07 08:20:51+00:00
State: open

There are always some functions you want to execute quickly either on browser or server side. Eg.

clear()

It would be much better to just type:

clear

I see no point of having the () when you don't specify any argument. Also it will be more consistent with how it's done when you have arguments.

And if these requests will be implemented: https://github.com/jashkenas/coffee-script/issues/1407 https://github.com/jashkenas/coffee-script/issues/1495 then the only time we need () is when you have no arguments.

This is the only way to have functions as commands in the browser. After all, the only scripting language we have for browser environment is javascript, and it's not encouraging anyone to make functions you can run in the console quickly if you have to type () each time.

This will also open up the door for the backend coffee REPL:

clone
copy
move

etc.

If what we want is to retrieve the function instead we could just do something like "callback.fn" or "<- callback".

I believe this will bring innovation into JS world to be a scripting language for ad hoc queries as well.