[TurboGears] Re: MochiKit and CallLater

2006-10-29 Thread Diez B. Roggisch

Bob Ippolito schrieb:
 On 10/27/06, percious [EMAIL PROTECTED] wrote:
 Sorry.  I probably posted this too early.  I got it figured out.  You
 need to send CallLater a function pointer, not func()
 
 JavaScript doesn't have macros, so a literal function call is *never*
 the right thing to do if the computation should be deferred in some
 way.
 
 I find it interesting that MANY people expect that magically
 callLater(0.5, foo()) should perform foo() after 0.5 seconds, even
 though that this behavior doesn't happen in ANY other common language
 or framework that I've seen.

Lack of functional programming courses I'd say :) And the fact that 
nowadays languages like JAVA don't have the concept of a function 
pointer/reference. So for some reason, people don't see the () as an 
actual operator.

Diez

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MochiKit and CallLater

2006-10-27 Thread percious

PS. Here is my JS.

function showAvailableParameters(result) {
var v = document.getElementById('availableParameters')
v.innerHTML = result.responseText
}

requestAvailableParameters = function(option) {
str = getForm()
var s = availableParameters+str
var d = doSimpleXMLHttpRequest(s);
d.addCallback(showAvailableParameters);
}

function checkBoxChecked(){
var v = document.getElementById('availableParameters')
v.innerHTML=htmlbodybiLoading.../i/b/body/html
if (req)
{
req.cancel()
}
var m = MochiKit.Base;

seconds = '.2'
req = callLater(0.2, requestAvailableParameters('checkbox'))
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MochiKit and CallLater

2006-10-27 Thread Bob Ippolito

On 10/27/06, percious [EMAIL PROTECTED] wrote:

 Sorry.  I probably posted this too early.  I got it figured out.  You
 need to send CallLater a function pointer, not func()

JavaScript doesn't have macros, so a literal function call is *never*
the right thing to do if the computation should be deferred in some
way.

I find it interesting that MANY people expect that magically
callLater(0.5, foo()) should perform foo() after 0.5 seconds, even
though that this behavior doesn't happen in ANY other common language
or framework that I've seen.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MochiKit and CallLater

2006-10-27 Thread Jorge Godoy

Bob Ippolito [EMAIL PROTECTED] writes:

 I find it interesting that MANY people expect that magically
 callLater(0.5, foo()) should perform foo() after 0.5 seconds, even
 though that this behavior doesn't happen in ANY other common language
 or framework that I've seen.

I understand what you mean, but it is like if one's mind parse:

  callLater(0.5, foo())

Specially when you want to pass some other parameters to the function:

  callLater(0.5, foo(something=thatthing))

(of course, the quotes doesn't exist and are here just for emphasizing what
might be on people's minds -- it was how I thought it at first...)

-- 
Jorge Godoy  [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---