Skip to content

Comment on The Next Big JVM Languageparent

Comments

Unfortunately, providing solid autocompletion for dynamic languages implies solving the halting problem.

How so? you just need reflection. Slime does it for Common Lisp and it doesn't break a sweat, that is, without using any advanced MOP stuff.

Reflection implies that you're running the code at code editing time, otherwise there's nothing to reflect over. That, in turn, opens up a huge can of worms for a large class of applications which aren't easily editable in what effectively is a debug session.

Just to be clear, this is what I mean when I talk about autocompletion (cursor is |):

    def foo(bar):
        bar.|
In order to complete on bar, you need to know the symbols available on the potential runtime values of bar. Everything can be in a system image, and you still don't know what gets through to foo() unless you either symbolically or actually evaluate the code and have a semantic breakpoint at the start of foo().

Reflection doesn't mean "you're running the code at editing time". I hope we're not confusing Java reflection with Eclipse's aggressive compilation of things as you type.

As per your specific example, I think the reason SLIME works is because Common Lisp uses generic functions, instead of class methods. The calls are not Object.Method() rather Method(Object:Class) so Metho| always resolves.

However, I will grant you this: automatic class loading will easily trip up SLIME and similar tools.

Hmmm, I am gonna need to think about this further.

I have no idea what Eclipse does as you type; I don't normally use Eclipse. I am, however, employed to maintain a static language compiler which is used by its IDE for code completion (Delphi in RAD Studio). I also implemented the runtime reflection object model (Rtti unit) used in the latest versions of Delphi.

By reflection, I'm talking about interrogating runtime objects to see what's available on them. They need to be runtime objects because of monkeypatching and similar techniques. Because they're runtime objects, in some sense the code needs to be run in order to interrogate the objects. That execution may be symbolic, but that symbolic evaluation hits the halting problem, because it's normally a Turing-equivalent machine which determines how the objects will get constructed.

SLIME autocompletion for Lisp works beautifully, and that language is about as dynamic as they come. What's the problem here?

I've addressed that in the other comments.

Oops; your reply happened between the time I loaded the page and the time I hit the reply button. I think it would be cool if Reddit-style comment systems could show new comments in realtime, Wave-style. The number one complaint about wave is that "it's cool, but I don't know what I would use it for". People already know what to use sites like HN for.

I'm not sure how usable it would be to have comments suddenly appearing -- it might get overwhelming if there are over 1000 comments, as on some Reddit articles -- but I think it could be pleasant on a smaller site like HN.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.