cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia Conforto <tobia.confo...@linux.it>
Subject Java strings vs. Javascript strings
Date Mon, 27 Aug 2007 10:08:49 GMT
Hello

Am I the only Cocoon user who is extremely annoyed by the fact that Java
strings are not Javascript strings are not Java strings?

Depending on the context, in your Flowscript you have to use either:

	str.startsWith("...")
	str.length()
	str.codePointAt(n)

and the rest of java.lang.String methods, or:

	str.match(/^.../)
	str.length
	str.charCodeAt(n)

and the rest of Javascript String methods.

This is very annoying and a huge waste of time, at least for me.

I found that I can wrap every string in a Javascript String(...)
constructor, so the following always work:

	String(str).match(/^.../)
	String(str).length
	String(str).charCodeAt(n)

But it's ugly, repetitive, and prone to errors.

And don't get me started on testing for a null value or void string!

This is giving me headaches.

Can't Rhino, or whatever piece of software is bridging Javascript to Java,
do the Right Thing and present every string as a Javascript string when
I'm programming in Javascript?  Can it be configured to do so?

Am I doing something wrong?


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message