www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - "How Hardware Will Shape Languages"

Just found through Reddit, "How Hardware Will Shape Languages" by David
Chisnall, it's one of those general articles that talk a lot and don't say a
lot:
http://www.informit.com/articles/printerfriendly.aspx?p=1638075

One of the ways out of the problems explained in the article is to improve the
type system of the language, so the programmer is able to express to the
compiler more refined invariants about the data and algorithms used. This is
why the D type system is a bit more powerful than the C type system, for
example you may use it to ask the compiler that a function doesn't use names
from outer scopes (using the pure attribute).

On the other hand, more expressive type systems require a more complex (and
sometimes slower) compiler, and often you need more brain to write the code
(because you need to use some precise language to express those extra
invariants). The language may become more complex.

So a possible solution is to allow extensions to the type system, plug-in type
systems. User-defined annotations/attributes plus static introspection may
allow the programmer to define little problem-specific extensions of the type
system. Python3 allows type annotations right for this purpose (so far I have
not seen them used much).

A possible problem with plug-in type systems is similar to the problem with
Lisp-style macros, they are powerful and useful, but they risk causing some
fragmentation in the community of that language users (because macros create
sub-languages that act a bit as islands, and designing languages is hard, so
often those little sub-languages are badly designed). Another problem is that a
language that allows the user to define a type system plug-in like the
unique/lent (Ownership System) requires a lot of semantic flexibility... I
don't think it's an easy thing to do. It looks harder than user-defined purity
for functions.

Bye,
bearophile
Oct 18 2010