Java Virtal Machine.net

[ News ] rss

September 18, 2009

Poll Result: Java Is Most Preeminent in Europe. Some voters in this past week's java.net poll questioned whether the question could be answered, but the result showed that a plurality of voters considered Europe to be region where Java has the greatest market share among competing technologi...

More »

September 17, 2009

Sun Collaborates with Software Freedom International to Connect More than 25,000 Developers and Students in 30 Countries for Software Freedom Day 2009. Building on its commitment to empower developers and students across the globe, Sun Microsystems, Inc. (NASDAQ: JAVA) is sponsoring more than 300 community style events in more than 30 countries for Software Freedom Day (SFD) on September 19, 2009. W...

More »

November/2009
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
2930     

[ Archives News
for 'Developers' ]

home > news > developers > javascript type inference in netbeans

JavaScript Type Inference in NetBeans

Roman Strobl has just published a screencast of the new JavaScript editor in NetBeans 6.1. The demo is around 5 minutes and highlights many of the editing features. I'd like to dwell on the type inference part a bit. Around four minutes into the demo, Roman shows that NetBeans figures out the types of expressions, including those involving function calls. In his example, all the types happened to be Strings so it may look like a lucky coincidence. It's not! Here's some code fragments showing in more detail what's going on. Let's start with a jQuery expression in an HTML file - in my last entry I showed how code completion already helps you fill in the strings inside the jQuery dollar function. NetBeans knows the return type of the dollar function so we're only presented with jQuery methods here: jQuery methods return the jQuery object itself as the return value, so we can chain calls into jQuery. We'll do that here by calling a function on the return value from addClass: As you can see, when NetBeans knows the return type of a function, it's shown in code completion item separated by a colon. Here I want to call the queue() method which returns an array of functions. Let's see what happens if we just call functions on the result object: As you can see - we're getting methods on the Array class, since we're getting an array back. Let's pick a specific element in the array instead, and see what code completion g...


Date: April, 29 2008
Url: http://blogs.sun.com/tor/entry/javascript_type_inference


Others News

Leave a Reply

Name (required)
Mail (will not be published) (required)
Website
You don't see letters?

Enter the code shown above (required)


Related

©2002-2008Java-Virtual-Machine.net :Java Archive: :Solve Crosswords de fr ru pt es : JVM: :Free PC Download: :Micrometer: