ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schaible, Jörg" <>
Subject RE: JavaDoc generation
Date Tue, 29 Jan 2002 14:07:52 GMT
Hi Thomas,

>I've never used BSF or Rhino before, nor have I done any 
>serious Javascript
>programming, but it seems strange to me that recursion is not properly

ahem, JavaScript supports recursion very well and Rhino is (one of) the best
JavaScript implementations. Sadly, most people treat this language as quick
and dirty HTML hacker's tool and fail to recognize the language's
specialities (JS has even OOP support).

Concerning recursion most people fail to use variable scope in JS properly:

function fac(x)
	y = x;
	if (x > 1)
		y = fac( x-1 ) * y;
	return y;

This function will return always 1! 'y' is defined as global variable!

function fac(x)
	var y = x;
	if (x > 1)
		y = fac( x-1 ) * y;
	return y;

This will work as expected! 'y' is in local scope.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message