LtU论坛上一个正面的反馈

3 views
Skip to first unread message

zhang3

unread,
May 5, 2009, 11:51:53 AM5/5/09
to Zero programming language
尝试发一篇于LtU论坛,除了一些反对意见之外,居然还能收到一个高评价的反馈,不容易,记录在案,以资鼓励:)呵呵。

translation to english, maybe

Not really a translation, but a "trot" - I think I get this guy. What
he's saying makes a lot of sense. The first replies people have posted
seem to me to miss his point completely.

Recipe for a programming system:

Start by whipping up some very simple statically typed language - like
C or Pascal. Make a compiler for that, presumably with support for
separate compilation of components.

Next, make an IDE for that. You can interactively write a module of
some program in this language and the IDE will manage that as part of
a library of parts. It will help you combine lots of modules to
compile and link a complete program.

The IDE parses and somewhat analyzes code as you enter it. It can
complete identifier names. It can detect (in this simple base
langauge) static type errors.

That's all very familiar. But now:

We're going to add some limited programmability to the IDE in the form
of templates. A template is written in a syntactic superset of the
base language that includes a notation for abstraction over all
identifiers. He uses the notation of a "PSI" prefix. Instead of
declaring "int x;" you could declare "PSI-some-type x;". Or "int PSI-
some-var;".

One key thing is that templates are instantiated as needed by the IDE,
interactively, rather than "at compile time". The IDE will do some
inference to decide which templates to expand and exactly how (with
what parameters for "PSI-" terms) -- but because the process is
interactive the inference algorithm can be simple-minded and just ask
the user to resolve ambiguities.

So, there are really two program texts, here. The one the actual,
bottom of the world compiler deals with is in some, let's say, C-like
language. A real simple-minded language.

The upper language is that first language, plus "polymorphic"
templates, plus user-supplied hints to disambiguate the type inference
for an otherwise simple-minded type inference engine.

The IDE is critical to this idea to make it *easy* for users to know
when hints are needed (and to simplify the work of providing those
hints).

It's a very good idea. In a twisted way it reminds of "Subtext" - the
computer is *there* so why isn't it helping more with the automatable
parts of writing a program? Why are we still using dumb text editors,
for the most part?

It's different from subtext in that the "PSI-"-style templating and
the implied kind of "interactive type inference" is original (except
that somebody, somewhere has probably tried something somewhat similar
before :-)

-t

update: p.s.: it's a very subversive idea, too, in that it suggests a
completely different approach to problem that ever-more-sophisticated
type-theory-inspired systems are coming up with. A much simpler and
yet plausibly more powerful approach.
By Thomas Lord at Sat, 2009-01-31 00:58 | reply

zhang3

unread,
May 5, 2009, 11:53:35 AM5/5/09
to Zero programming language
只可惜LtU论坛上管理员不允许长篇大论的讨论,需要给出参考网站的网址,我的博客又是中文写成,只好作罢。待Demo出来,用程序说话吧。
Reply all
Reply to author
Forward
0 new messages