development

Re: DynamicTyping

March 14, 2005 14:48:21.253

Martin Fowler has some interesting things to say about static and dynamic typing. It's not arant, and it's not an evangelical piece, either. Here's an interesting segment, but I'd suggest that you read all of it:

Another area where static typing is useful is that it allows programming environments to be much more helpful. The revelation here (as in so many things) was IntelliJ. With an IDE like this I really felt the type system was helping me. Even simple things like auto-completion are greatly helped by static types, and leading IDEs can do much more than that.

Despite this, there's still something particularly satisfying about programming in languages like Smalltalk and Ruby - and I think it has a great deal to do with the dynamic typing. Chatting at Camp 4 Coffee with Bruce Eckel we both agreed that one of the most frustrating things about the static/dynamic typing debate is that it's very hard to put into words the advantages of working in a dynamically typed language. Somehow things just seem to flow better when you're programming in that environment, even when I'm doing my Ruby in emacs instead of IntelliJ. (Smalltalk, of course, has both the language and a lovely programming environment.)

Mind you, there are loadable components for VisualWorks that give you auto-completion.

Comments

How does it work?

[Duncan] March 14, 2005 15:22:06.394

How does it figure out what to show in the auto-completion drop-down?

Re: DynamicTyping

[ Martin Kobetic] March 14, 2005 15:28:19.497

Comment by Martin Kobetic

It's not quite the same to offer all possibly matching symbols in the system, although still very helpful, and I wouldn't want to do without it. However I've noticed recently that the old tired AT class report tool actually looks at the declared types in class comments and warns you that you're sending suspicious messages to such and such variable (if you bother to run it). I was thinking it would probably be fairly easy to plug the same kind of mechanism into the auto-complete goodie. That way you might get close to having best of both, no rigid type system to lug on your back and yet a lot of focused feedback.

How Can It Work?

[Alex] March 14, 2005 16:41:32.386

Given that type is not known until runtime - an advantage of dynamic typing - how can the system know what messages are appropriate for an untyped variable?

Re: How smalltalk knows the type before runtime

[Terry] March 14, 2005 17:22:38.923

One way the IDE knows the possible types of a variable is that it can look at the messages sent to it. Frequently, there are only a few classes that would send the messages.

A more involved type analysis could be done using flow analysis.

Look at the messages sent to it?

[Alex] March 14, 2005 17:52:30.203

Presumably that is what I am trying to figure?? If I already know the message then what do I need completion for?

Re: Re: DynamicTyping

[ James Robertson] March 14, 2005 18:54:07.918

Comment by James Robertson

Alex,

This is why I never found Auto-Completion that useful in VW. Some people like it though, and the point is, dynamic typing doesn't obviate the possibility

Re: Dynamic Typing

[Terry] March 14, 2005 19:42:08.139

Alex

If the variable is an instance variable then the compiler may have several methods it can use to deduce the type. However, if it a method temporary, then it may have no information to use.

Re: DynamicTyping

[ Martin Kobetic] March 14, 2005 20:41:14.203

Comment by Martin Kobetic

What I meant is that there's a fairly old practice to include instance variable type annotations in the class comment, mostly for documentation purposes. Some people do that, some don't, but if the information is there, the type completion could take advantage of that. ADvance can also rely on that information so using the convention can actually serve multiple purposes.

Re: Re: DynamicTyping

[ Troy Brumley] March 14, 2005 21:54:15.616

Comment by Troy Brumley

FWIW, I never found a need for auto-complete in my Smalltalk work. Intention revealing selectors tend to be easy to guess once you know the vocabulary of the most frequently used objects. But, in a language without them, I like auto-complete.

Is there a statically typed language with readable, intention revealing "selectors", or do they all look like function calls with varying type signatures?

Re: DynamicTyping

[ daniel p] March 15, 2005 11:55:43.349

Comment by daniel p

He goes into why smalltalk/lisp are so good a bit more here too.... http://martinfowler.com/bliki/DomainSpecificLanguage.html Most of the promenent gurus of today have used smalltalk back it the early days of oo. All of them that have, love it.

Wing IDE Auto-completes for Python

[Christian Romney] March 15, 2005 22:04:46.829

Those wondering how it works should also check out the Wing IDE for Python. Spend two minutes with it and you see what auto-completes and what doesn't.

 Share Tweet This
-->