Perfect Programming Language 
Author Message
 Perfect Programming Language

My musings on XS ( http://www.*-*-*.com/ ) led
me to think about programming languages in general - and what "the
world's best programming language" would look like. XS struck me a
potentially very good (OK - not really good), because it is so easy to
write a parser for it. Then it occurred to me that Forth - a language
that I have never written in, nor know much about - might actually fit
the bill. Forth is stack-based, so it ought to be quite easy to write
a parser for it compared to infix-based languages.

Consider the following equation:

   syntactic sugar + libraries = programming language
Now, the "library" aspect of a programming language is not really
inherent to the language itself. There's no intrinsic reason why perl
is good at regular expressions, whereas Visual Basic is not - it's
just that the people who wrote perl decided to include regular
expressions, whilst Microsoft did not. What we find, therefore, is
that language writers implement the same functionality over and over
again. Perl might have some useful library that python does not, and
vice versa. The chances are, though, that if you want to use some of
that functionality, you have to port over code - which is a waste of
time.

On the "syntactic sugar" front, some languages are definitely better
than others. I like python because it has lists built into the syntax.
So I can write something like:

 a = [1,2,3]
which I cannot do in C. I also like python's exception handling - it
is much better than Visual Basic. C does not have exception handling.
So I would rather write in python than C, because I can be more
productive.

This then leads to the argument: why have a programming language with
a fixed syntax at all? If you came up with a language whose syntax was
extensible, then you would have what I believe would be the world's
best programming language - let's call it PPL. PPL would consist of a
bunch of libraries of two types: "function libraries" (which are the
libraries that I have referred to in my definition of a programming
language above), plus "syntax libraries" (an entirely new concept).
These syntax libraries would be capable of converting an infix program
to a stack-based program (e.g. Forth). The stack-based program would
be specifically designed to be simple to compile.

So I could then imagine the scenario where someone woke up one day and
said: "hey, wouldn't it be grand if PPL supported
object-orientation?". The programmer would then write a syntax library
that implemented it, and distribute it like a normal library. Anyone
interested in object-orientation could then import the library and
hey-presto - instant object-orientation. It would also be possible to
translate just about any language to any other language, because I
would expect that its syntax could be encapsulated into a so-called
syntax library.

Thoughts and comments welcome!



Wed, 21 Sep 2005 19:46:03 GMT  
 Perfect Programming Language

Quote:

> This then leads to the argument: why have a programming language with
> a fixed syntax at all? If you came up with a language whose syntax was
> extensible, then you would have what I believe would be the world's
> best programming language - let's call it PPL.

Those who don't know Lisp are condemned to reinvent it, poorly :-)

--
   __("<         Marcin Kowalczyk

    ^^     http://qrnik.knm.org.pl/~qrczak/



Wed, 21 Sep 2005 20:33:24 GMT  
 Perfect Programming Language

Quote:

> > This then leads to the argument: why have a programming language with
> > a fixed syntax at all? If you came up with a language whose syntax was
> > extensible, then you would have what I believe would be the world's
> > best programming language - let's call it PPL.

> Those who don't know Lisp are condemned to reinvent it, poorly :-)

Thanks for the reply. As a follow-up ...

I quote from
http://www.paulgraham.com/icad.html
the following text:

If you look at these languages in order, Java, Perl, Python, you
notice an interesting pattern. At least, you notice this pattern if
you are a Lisp hacker. Each one is progressively more like Lisp.
Python copies even features that many Lisp hackers consider to be
mistakes. You could translate simple Lisp programs into Python line
for line. It's 2002, and programming languages have almost caught up
with 1958.



Thu, 22 Sep 2005 05:37:25 GMT  
 Perfect Programming Language
There are 3 things I look for in a programming language.  How easy is
it to document, how much code is wasted setting up for the useful
code, and how hard is it to debug?  That said, there are no good
languages, only good programmers.  ^.^

Starling



Fri, 23 Sep 2005 08:34:51 GMT  
 Perfect Programming Language

Quote:



> > Those who don't know Lisp are condemned to reinvent it, poorly :-)

And those who do know Lisp are condemned to reinvent Lisp, poorly.  :)

Quote:
> Thanks for the reply. As a follow-up ...

> I quote from
> http://www.paulgraham.com/icad.html
> the following text:

> If you look at these languages in order, Java, Perl, Python, you
> notice an interesting pattern. At least, you notice this pattern if
> you are a Lisp hacker. Each one is progressively more like Lisp.

Except that Java is the newest one.  -.-  At any rate, you could also
consider the progressive Lisp, Basic, Perl, and Java each one more
C-like in syntax.  As a concept, Lisp is perfect.  But to actually use
it...?

Starling
Who uses Lisp a lot, but doesn't have to like it.  :)



Fri, 23 Sep 2005 09:33:04 GMT  
 Perfect Programming Language


Quote:
> XS struck me a potentially very good (OK - not really good), because
> it is so easy to write a parser for it. Then it occurred to me that
> Forth - a language that I have never written in, nor know much about
> - might actually fit the bill. Forth is stack-based, so it ought to
> be quite easy to write a parser for it compared to infix-based
> languages.

Why is this such an important thing?  You only have to write the parser
*once*.  After that anyone can use it (if you make it available as a
library, and not just as a monolithic part of the compiler).

This is a mistake made by each of Lisp, Smalltalk and Forth, getting a
syntactically extensible language at the expense of readability.

Quote:
> This then leads to the argument: why have a programming language with
> a fixed syntax at all? If you came up with a language whose syntax was
> extensible, then you would have what I believe would be the world's
> best programming language - let's call it PPL.

I agree.  And there are a number of such languages.

Quote:
> PPL would consist of a bunch of libraries of two types: "function
> libraries" (which are the libraries that I have referred to in my
> definition of a programming language above), plus "syntax libraries"
> (an entirely new concept).

No, your "syntax libraries" are what languages such as Dylan and Common
Lisp call "macros" and Forth calls "<BUILDS  DOES>".

Quote:
> These syntax libraries would be capable of converting an infix program
> to a stack-based program (e.g. Forth). The stack-based program would
> be specifically designed to be simple to compile.

There's no reason to do that.  You just have a core language, and the
macros expand into that.

For example, in Gwydion Dylan (http://www.gwydiondylan.org), just about
*all* of what progrmamers would regard as the normal built in
Pascal-like syntax of the language is actually implemented as macros in
the standard library.

Quote:
> So I could then imagine the scenario where someone woke up one day
> and said: "hey, wouldn't it be grand if PPL supported
> object-orientation?". The programmer would then write a syntax
> library that implemented it, and distribute it like a normal library.

Which is exactly how Common Lisp's o-o facility (CLOS) started out.

Unfortunately that library doesn't integrate the built-in primitive
types into the obejct system all that well (it can't, really), which is
why Dylan integrates a very similar object system into the base language.

Quote:
> Thoughts and comments welcome!

It's already been done -- go use it!

-- Bruce



Fri, 23 Sep 2005 16:06:12 GMT  
 Perfect Programming Language

Quote:

> There are 3 things I look for in a programming language.  How easy is
> it to document, how much code is wasted setting up for the useful
> code, and how hard is it to debug?  That said, there are no good
> languages, only good programmers.  ^.^

Flon's Law: There is not now, and never will be, a language in which
it is the least bit difficult to write bad programs.


Fri, 23 Sep 2005 16:37:10 GMT  
 Perfect Programming Language

Quote:

> Flon's Law: There is not now, and never will be, a language in which
> it is the least bit difficult to write bad programs.

So what?
I wnat a language in which is it easy to write good programs.
I'm still waiting for one...

Regards,
Joachim
--
Currently looking for a new job.



Fri, 23 Sep 2005 20:32:09 GMT  
 Perfect Programming Language

Quote:


>> Flon's Law: There is not now, and never will be, a language in which
>> it is the least bit difficult to write bad programs.
> So what?
> I wnat a language in which is it easy to write good programs.
> I'm still waiting for one...

I think we need to define what we mean by "good", "bad", "perfect" and so
on.

Presumably "perfect" means "as good as it is possible to be" but...
does good mean fast, reliable, bug-free on first compile/run?
does bad mean memory-hungry, buggy, inefficient?

One reason that there are so many languages is because "good" for a
numerical implementation of a 10,000 parameter model is not the same as
"good" for string-parsing.

I can imagine that the perfect string-parsing or modelling or AI or ...
language might exist.  I cannot see anyway in which there could be A
perfect language.

--

      Department of Biology, University of York, York, YO10 5YW



Fri, 23 Sep 2005 22:04:18 GMT  
 Perfect Programming Language

Quote:
> This then leads to the argument: why have a programming language with
> a fixed syntax at all? If you came up with a language whose syntax was
> extensible, then you would have what I believe would be the world's
> best programming language - let's call it PPL. PPL would consist of a
> bunch of libraries of two types: "function libraries" (which are the
> libraries that I have referred to in my definition of a programming
> language above), plus "syntax libraries" (an entirely new concept).
> These syntax libraries would be capable of converting an infix program
> to a stack-based program (e.g. Forth). The stack-based program would
> be specifically designed to be simple to compile.

To a large extent, this is the exact strategy that Microsoft is trying to
persue with .NET. That is, there exists a large .NET library, which any
application that is running in the .NET runtime can access. Furthermore, the
.NET runtime is generic enough so that any "modern" language can be compiled
to run in it. So while there may not exist "syntax libraries", there do
exist syntax compilers that basically achieve the same thing.

Granted, I've never actually used .NET, so I can't vouch for how accurate
the above statements are. I'm simply repeating information that I've gleaned
from magazine articles and other forms of Microsoft marketing.



Fri, 23 Sep 2005 22:10:50 GMT  
 Perfect Programming Language

Quote:


>>I wnat a language in which is it easy to write good programs.
>>I'm still waiting for one...

> I think we need to define what we mean by "good", "bad", "perfect" and so
> on.

> Presumably "perfect" means "as good as it is possible to be" but...
> does good mean fast, reliable, bug-free on first compile/run?
> does bad mean memory-hungry, buggy, inefficient?

That's part of the problem.
But not a particularly big one - you can get 90% goodness in all these
areas. For the remaining 10% - well, there's always assembly.

BTW you forgot maintainability, and that's a central issue for >90% of
all software written on this planet. Perfection for some specialized
area like AI or parsing fades before this goal.
AND it's an area where open research questions are plentiful.

Regards,
Joachim
--
Currently looking for a new job.



Sat, 24 Sep 2005 01:44:31 GMT  
 Perfect Programming Language

Quote:



> > XS struck me a potentially very good (OK - not really good), because
> > it is so easy to write a parser for it. Then it occurred to me that
> > Forth - a language that I have never written in, nor know much about
> > - might actually fit the bill. Forth is stack-based, so it ought to
> > be quite easy to write a parser for it compared to infix-based
> > languages.

> Why is this such an important thing?  You only have to write the parser
> *once*.  After that anyone can use it (if you make it available as a
> library, and not just as a monolithic part of the compiler).

No, and I don't advocate that way of thinking about it.

You need some sort of parser for every tool that needs to understand
the code at all.  Lisp's is easy: `r' `e' `a' `d'.

Unfortunately in other languages, there's a vicious circle where the
lack of trivial parsing has led to the mindset that tools are
extra/add-on/outside the realm of the language, which in turn devalues
trivial parsing.

For myself, the ease I have found in building tools to work on code
weighs very heavily, and the alleged difficulty of reading Lisp weighs
not at all.

--
Tom Breton at panix.com, username tehom.  http://www.panix.com/~tehom



Sat, 24 Sep 2005 08:27:06 GMT  
 Perfect Programming Language

Quote:

> Unfortunately in other languages, there's a vicious circle where the
> lack of trivial parsing has led to the mindset that tools are
> extra/add-on/outside the realm of the language, which in turn devalues
> trivial parsing.

I don't think it's ease of parsing, it's ease of using the resulting
parse tree.
I wouldn't want to write a tree walker for a C++ parse tree, I'd have to
consider too many constructs. In Lisp or Smalltalk, it's easy, because
both have a simple, regular semantics. (Of course, a simple and regular
semantics usually results in a simple, regular syntax.)

Regards,
Joachim
--
Currently looking for a new job.



Sat, 24 Sep 2005 15:17:39 GMT  
 Perfect Programming Language

Quote:



>>>I wnat a language in which is it easy to write good programs.
>>>I'm still waiting for one...

>> I think we need to define what we mean by "good", "bad", "perfect" and so
>> on.

>> Presumably "perfect" means "as good as it is possible to be" but...
>> does good mean fast, reliable, bug-free on first compile/run?
>> does bad mean memory-hungry, buggy, inefficient?
> That's part of the problem.
> But not a particularly big one - you can get 90% goodness in all these
> areas. For the remaining 10% - well, there's always assembly.

But you still haven't said what "good" actually means!

Quote:
> BTW you forgot maintainability, and that's a central issue for >90% of
> all software written on this planet. Perfection for some specialized
> area like AI or parsing fades before this goal.
> AND it's an area where open research questions are plentiful.

I was just throwing in some suggestions.  Yes maintainability, other
possiblities might include developer time, platform availability, platform
independance.  You can probably think of more as well!

--

      Department of Biology, University of York, York, YO10 5YW



Sat, 24 Sep 2005 16:19:04 GMT  
 Perfect Programming Language

Quote:


>>I wouldn't want to write a tree walker for a C++ parse tree, I'd have to
>>consider too many constructs. In Lisp or Smalltalk, it's easy, because
>>both have a simple, regular semantics.

> Not once you start using macros they don't.

Oh, right. You'd need to either analyze the macros (not decidable, but
you can probably get by with some pattern matching heuristics), or just
keep them as black boxes. The latter is probably not a good idea if
you're working on a contemporary Lisp - macros do too important things
there.

Strangely enough, this all is not a problem with Smalltalk. Smalltalks
don't use (or need) macros.
Of course, some design patterns are left unformalized in Smalltalk (such
as MI), and any tree walker will not see that. It doesn't seem to be a
large problem in practice :-)

Regards,
Joachim
--
Currently looking for a new job.



Sat, 24 Sep 2005 18:37:55 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Perfect Programming Language

2. Perfect Programming Language

3. Golf - The perfect problem to compare languages with?

4. Your perfect language.

5. Make the language Perfect/SOS

6. Yet another perfect number program

7. Yet another perfect number program

8. A Language Primer required for A Programming Language

9. Use a new language: Structured Programming Language

10. All Languages Programming Contest -- Extending the language (4)

11. All Languages Programming Contest -- Extending the language (3)

12. The Icon Programming Language (was: Discussions of languages)

 

 
Powered by phpBB® Forum Software