BlockClosure as a JavaScript constructor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BlockClosure as a JavaScript constructor

Nicolas Petton
Hi again :)

As you know, a BlockClosure in Amber is a function in JS. It was already
possible to use the 'new' operator in Amber with block closures, but
without parameters only.

Now Amber has BlockClosure>>newValue: and #newValue:value:
#newValue:value:value:

here's an example:
new Foo();                // JS version
Foo new.                  "Amber version"

new Foo(1,2);             // JS version
Foo newValue: 1 value: 2. "Amber version"

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: BlockClosure as a JavaScript constructor

Amber Milan Eskridge
Nice

On Mon, Dec 5, 2011 at 10:00 PM, Nicolas Petton
<[hidden email]> wrote:

> Hi again :)
>
> As you know, a BlockClosure in Amber is a function in JS. It was already
> possible to use the 'new' operator in Amber with block closures, but
> without parameters only.
>
> Now Amber has BlockClosure>>newValue: and #newValue:value:
> #newValue:value:value:
>
> here's an example:
> new Foo();                // JS version
> Foo new.                  "Amber version"
>
> new Foo(1,2);             // JS version
> Foo newValue: 1 value: 2. "Amber version"
>
> Cheers,
> Nico
>