On Tue, Dec 15, 2009 at 11:16 PM, Joshaven <[email protected]> wrote:

> For example is this (or a variant) a possibility for javascript
> syntax:
> var myFunction = *{return 'Hello World';};
>
> Can some character like "*" be expanded to "function ()" when the
> javascript source is being interpreted?
>
> This shortcut would make code a lot prettier!
>
> For extra credit I would also like to see the parentheses optional.
>

The JavaScript standard specifies no preprocessor (as C and C++ do), so this
isn't possible in vanilla JS. And v8 implements only vanilla JS + a small
handful of features to make embedding easier (a.g. custom get/set
interceptors).

You can actually use the $ character as a function or object name:

var $ = function() {...}

but $ is used by many web toolkits, and shouldn't be used (IMO) in client
code, to avoid collisions.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to