Primitive usage

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

Primitive usage

Oleg
Hello Guys!

I would like to know why and when should i use primitives. This is an
example from TabManager:

   onWindowResize: aBlock
      <jQuery(window).resize(aBlock)>

Why did not you simple write: 'window' asJQuery resize: aBlock

Thanks,
Oleg


Reply | Threaded
Open this post in threaded view
|

Re: Primitive usage

abergel
Good question

Alexandre


On 30 Sep 2011, at 16:52, Oleg wrote:

> Hello Guys!
>
> I would like to know why and when should i use primitives. This is an
> example from TabManager:
>
>   onWindowResize: aBlock
>      <jQuery(window).resize(aBlock)>
>
> Why did not you simple write: 'window' asJQuery resize: aBlock
>
> Thanks,
> Oleg
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.





Reply | Threaded
Open this post in threaded view
|

Re: Primitive usage

gokr
On 10/01/2011 03:21 AM, Alexandre Bergel wrote:
> Good question

AFAIK (disregarding the example) the reasoning behind "primitives" goes
like:

- Either some technical subtlety prevents using the "Amber2js" approach,
like say function names beginning with capital letter (or do we support
that now?) etc.

- Or we want performance, not in this case though.

- Or we want to reach into the underlying js guts in some way, that we
can't do in Amber.

- Or the developer in question knew the js code, but didn't immediately
see how it would be written in Amber. :)


...I am not sure there are any more "reasons" than the above. We should
*really* write a wiki page describing the mechanisms/rules/subtleties in
doing Amber->js and vice versa. For example:

        - Inside embedded js code you can actually use the Amber method temps!
        - You can also reach ivars, but you really need to know the syntax

regards, Göran
               
Reply | Threaded
Open this post in threaded view
|

Re: Primitive usage

Nicolas Petton
The reason for this particular example is that when I wrote it, there was no way to call a JS library from Amber without writing a binding.

Cheers,
Nico



2011/10/1 Göran Krampe <[hidden email]>
On 10/01/2011 03:21 AM, Alexandre Bergel wrote:
Good question

AFAIK (disregarding the example) the reasoning behind "primitives" goes like:

- Either some technical subtlety prevents using the "Amber2js" approach, like say function names beginning with capital letter (or do we support that now?) etc.

- Or we want performance, not in this case though.

- Or we want to reach into the underlying js guts in some way, that we can't do in Amber.

- Or the developer in question knew the js code, but didn't immediately see how it would be written in Amber. :)


...I am not sure there are any more "reasons" than the above. We should *really* write a wiki page describing the mechanisms/rules/subtleties in doing Amber->js and vice versa. For example:

       - Inside embedded js code you can actually use the Amber method temps!
       - You can also reach ivars, but you really need to know the syntax

regards, Göran