On Jan 16, 2011, at 3:19 PM, Michael Haufe (TNO) wrote:
> On Jan 16, 2:07 pm, Miller Medeiros <[email protected]> wrote:
>> [...]
>> for me one of the biggest "problems" of JavaScript is that there is 1000
>> ways of doing the same thing... that's why IDEs can't do automatic error
>> check or autocomplete properly and also the reason why books like Stoyan's
>> JavaScript Patterns are so important..
>
> Current IDEs can't can't check because they don't implement type
> inference plain and simple. It is certainly possible to auto-complete
> as well as error check statically most JavaScript programs. They just
> simply don't.
>
Can you imagine how hard it is to determine what should happen and what is the
execution context when you have different engines, code branching based on
features/environment and millions of different patterns for encapsulation,
inheritance, etc?
Building tools for static languages is easier since you have way more metadata
on the code and an stricter structure. The same way that is way easier to
create a XML parser than an HTML parser.
I prefer to have no error check at all than to have an error check that I can't
trust. (same thing for documentations, maps and compass)
Using the last example as a reference, what should the IDE autocomplete or
error check in this case:
> o = new (function(){
> try { f() } catch(_){ return A }
> return B
> }())
`o` could be an instance of `A` or `B` and the IDE have no idea if both
implement the same interface or inherit from the same objects... - I agree with
JSLint in this case: "weird construction".
and if you have mixIns of dynamic objects? and if the objects you are using are
stored on a different JS file from a 3rd party library loaded dynamically?
type inference and dynamic code evaluation solves many problems but still a
small part of the whole problem. - if anyone ever seen what VisualStudio is
capable of doing for C# and what FDT and FlashDevelop does for ActionScript 3
you guys know what I mean... I really like JavaScript but sometimes I miss a
good IDE.
PS: I'm not a C# developer or used VisualStudio that many times but I have
friends that are and they showed me really cool features, LINQ autocomplete and
type inference on the function scope (by using `var` without type declaration)
is probably one of the coolest ones. - this presentation is old but pretty
good: http://blip.tv/file/1317881
PS2: static/strong-typed langues only makes sense when you are using tools that
help you find problems and reduce the amount of work required (smart
autocomplete, auto class import, smart refactoring, code snippets, templates,
etc), otherwise you have all the overload but almost no gains.
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]